How to do Wireguard monitoring?

New to Wireguard and to this forum, but long time user of LSIO Docker containers (Plex, Jackett, Radarr, Sonarr, Transmission, Unifi, Jellyfin) .

I just installed a Wireguard server using the Docker container on my Unraid box. It all work very good though I am now disturbed by how simple it is to connect… Let’s imagine that my peer1.conf got misplaced and a bad actor gets it. As far as I have understood, he can simply import it in his client and he is in my network.

Right, so, I understand that this is like a password and I should handle with care. but how to fix the issue should it happen?

Would there be a way to monitor who has connected lately so that I can kick off a peer if there is suspected unauthorized access?

Thanks already

monitoring WireGuard is crucial to ensure its proper functioning and identify any issues. By enabling logging, monitoring logs, and using monitoring tools, you can effectively monitor WireGuard and ensure its reliability and security.

Thanks for your feedback. And how can I do that?

wireguard is connectionless, you’re not going to get any logging of the type you want.

the closest thing you can do is have the dynamic_debug control monitor the wireguard module and check dmesg. This assumes your kernel was compiled with CONFIG_DYNAMIC_DEBUG