NHAS / wag

Simple Wireguard 2FA
BSD 3-Clause "New" or "Revised" License
508 stars 27 forks source link

PersistentKeepaliveInterval on server config creates handshake loops while client disconnected #64

Closed oakdmsaoskdmmokm closed 11 months ago

oakdmsaoskdmmokm commented 1 year ago

Hello,

Thanks for your work on this, really nice tool :)

I've tested WAG and wonder if PersistentKeepaliveInterval should be in the server config. As long as the parameter exists, the server will try to reach back sessions that have actually been disconnected already by the user. When using logging to syslog it will output something like this:

Handshake for peer 90 did not complete after 5 seconds, retrying (try 15) Sending handshake initiation to peer 90 Handshake for peer 90 did not complete after 5 seconds, retrying (try 17) .... Handshake for peer 90 did not complete after 20 attempts, giving up Sending keepalive packet to peer 90 Sending handshake initiation to peer 90 Handshake for peer 90 did not complete after 5 seconds, retrying (try 2)

It will repeat this and keep retrying for ever for each client that ever connected, until the client is back online. From what I understood the keepalive setting should only be used in the client config? Once the parameter is removed and the application is rebuilt, the messages stops.

Thanks

NHAS commented 1 year ago

Huh.

That is there to stop NAT entries from expiring. But. I think you're right that it should be client lead rather than server led.

I'll change this.

Thanks!

NHAS commented 10 months ago

Howdy, this has been brought back as ServerPersistentKeepAlive just for clarity, if this option is <0 then it will be disabled. Currently on unstable