I am building a Wireguard tool for myself and I would like to receive events when a peer connects or disconnects. Does someone know if this is possible through some kernel API or EBPF?
I am building a Wireguard tool for myself and I would like to receive events when a peer connects or disconnects. Does someone know if this is possible through some kernel API or EBPF?
Thinking of the top if my head. I haven’t tested this.
wg show lists connect peers, amongst other things. You can pipe that to grep to filter for just the peers.
With watch, you can periodically do the commands mentioned above, and execute another command on change.
With ntfy.sh you can easily get notifications on android or iphone.
The whole thing would look like.