matthewwall / weewx-interceptor

weewx driver that intercepts web traffic from internet 'bridge' devices such as Acurite Access, ObserverIP, OS LW30x, LaCross GW1000U, FineOffset GW1000
GNU General Public License v3.0
105 stars 44 forks source link

v5 weewx python3 documentation updates #120

Open vinceskahan opened 5 months ago

vinceskahan commented 5 months ago

Matthew - here's some documentation tweaks that might help folks on v5 get interceptor running under python3 on a pi....

Install and configure the prerequisites, assuming you have 'pip' available already...

# for a pip installation of weewx
source /home/pi/weewx-venv/bin/activate
pip3 install libpcap
pip3 install pypcap

# or for a dpkg installation of weewx
sudo apt-get install -y libpcap-dev
sudo python3 -m pip install libpcap pypcap --break-system-packages

Install the driver and enable it

weectl extension install https://github.com/matthewwall/weewx-interceptor/archive/master.zip
weectl station reconfigure --no-prompt --driver=user.interceptor

And edit weewx.conf to fill in the config entry to listen....

[Interceptor]
    driver = user.interceptor
    device_type = ecowitt-client
    mode = listen
    port = 8000
    iface = wlan0

The result is it seems (seems...) to listen ok although I don't have any gear emitting data that it could hear. At a minimum things seem to run ok and the info above might be worth using when you get around to updating the toplevel readme for v5....

Re: how to get the non-privileged user weewx (or pi etc.) to listen on a privileged port, all I can find is references to set network capabilities on the python binary itself ala sudo setcap cap_net_raw+eip /usr/bin/python3.11 but to me that seems like a bit of a security risk. Quick test without doing that seems to listen ok in a dpkg installation on unprivileged ports such as 8000.

vinceskahan commented 5 months ago

added dpkg commands for getting the pcap items installed (tested in vagrant deb12) and also how to possibly permit the unprivileged user access to sniff or listen on privileged ports, which seems like a security risk to me. At a minimum it would make things quietly break if you ever updated your python version afterward.