Open linutsdc opened 8 years ago
In practice, automatically detects the interface? Came here to ask the same thing. Maybe like eth0|wlan0
as input and it does whichever applicable.
On my computer, added /etc/systemd/system/knockd-alt.service
;
[Unit]
Description=Port-Knocking Daemon
After=network.target
[Service]
ExecStart=/usr/bin/knockd -i $(ip route show |grep default | cut -f 5 -d ' ')
[Install]
WantedBy=multi-user.target
-i
overrides the config. But i'd rather the configuration file itself somehow supports it? It could support the @
notation, but would make more sense to make it refer to configuration files.
I have a script that starts knockd which pulls the interface associated with the default route on the host. It's something along these lines:
ip route show | awk '$1=="default" && $2=="via" && $4=="dev" { print $5 }'
It pulls out he p5p1 from:
Is that something that could be baked into knockd?