HacklabJKL / visitors

Visitor data collector using DHCP leases
GNU General Public License v3.0
0 stars 1 forks source link

Support for non-server router #17

Open samip5 opened 3 years ago

samip5 commented 3 years ago

Currently this will not work on an EdgeRouter-X, due to the small flash on-board and RAM limitations. Systemd journal is also not being used. Python agent to send logs with to an backend should be done.

Filesystem                Size      Used Available Use% Mounted on
ubi0_0                  214.9M    155.8M     54.4M  74% /root.dev
overlay                 214.9M    155.8M     54.4M  74% /
devtmpfs                122.9M         0    122.9M   0% /dev
tmpfs                   123.6M         0    123.6M   0% /dev/shm
tmpfs                   123.6M    444.0K    123.2M   0% /run
tmpfs                     5.0M         0      5.0M   0% /run/lock
tmpfs                   123.6M         0    123.6M   0% /sys/fs/cgroup
tmpfs                   123.6M     72.0K    123.6M   0% /var/log
tmpfs                   123.6M      4.0K    123.6M   0% /tmp
tmpfs                   123.6M         0    123.6M   0% /lib/init/rw
tmpfs                   123.6M         0    123.6M   0% /run/shm
none                    123.6M    512.0K    123.1M   0% /opt/vyatta/config
tmpfs                    24.7M         0     24.7M   0% /run/user/1000

$ free -h
              total        used        free      shared  buff/cache   available
Mem:           247M         90M        7.3M        1.0M        149M        146M
PetteriAimonen commented 3 years ago

One option could be for the host to run ssh root@router tail -f /var/log/dhcp.log to get the logs in realtime. Wouldn't need any installations on the router, except for an ssh key.

samip5 commented 3 years ago

One option could be for the host to run ssh root@router tail -f /var/log/dhcp.log to get the logs in realtime. Wouldn't need any installations on the router, except for an ssh key.

It seems that the router is not logging the requests at all as in there's no log file for DHCP that shows anything useful. Daemon seems to be dhcpd3, but it can be changed to dnsmasq I think.

PetteriAimonen commented 3 years ago

dhcpd3 can be given -tf option to log transactions: http://www.linuxcertif.com/man/8/dhcpd3/

zouppen commented 3 years ago

The log via SSH is a viable option but the registration page needs to be on the local LAN (or routable address without NAT such as VPN connection to the site) because it maps IP addresses to MAC addresses. This needs some thinking. It doesn't need to be layer-2 connectivity (Ethernet) because DHCP server log parser actually serves the IP to MAC mapping. The registration page only takes the IP and checks the current mapping from the database.

samip5 commented 3 years ago

Most hacklabs probably have a RPi that can be used for a backend/front.

zouppen commented 3 years ago

Okay then, a better idea would be to craft a Debian package or docker image for this thing. You could easily run the DHCP server there as well, just turn off the server from Edgerouter.

samip5 commented 3 years ago

Okay then, a better idea would be to craft a Debian package or docker image for this thing. You could easily run the DHCP server there as well, just turn off the server from Edgerouter.

Running the DHCP server not on the router is not really a good solution, at least it does not sound like a good option even if it would be easy to do.

zouppen commented 3 years ago

Why? It's quite normal and has been commonplace to run DHCP on a separate computer. For example if you have a Microsoft AD server for example.

I'm just thinking about a minimum viable product, because it's more easy to turn off DHCP on a router than to give dozends of installation instructions and packages to all kinds of embedded routers out there.

samip5 commented 3 years ago

Why? It's quite normal and has been commonplace to run DHCP on a separate computer. For example if you have a Microsoft AD server for example. I'm just thinking about a minimum viable product, because it's more easy to turn off DHCP on a router than to give dozends of installation instructions and packages to all kinds of embedded routers out there.

The point of this ticket is to support non-server router, which that wouldn't be.