Recovery Methods When You've Messed Up the Server-Side Configuration File in Wireguard
Hello, it's Muno.
I'm currently working on something that automatically creates and connects configuration files using RPC, but it was too much trouble, so I tried it directly on my Wireguard server and completely messed it up.
I was able to recover easily, so I'll make a note of it.
Still able to check connection with wg show
Since it can be confirmed with wg show, the session itself seems to be continuing, but once you down/destroy it, it's over.
You can check the settings below.
wg showconf wg0
The wg0 above is the interface name.
Then, write it to a file.
wg showconf wg0 > /usr/local/etc/wireguard/wg0.conf
This should be okay for now.
Edit Configuration File
If you check the file output with vim, you'll see that the endpoint destination as viewed from the server side is specified, so delete it, and it should be fine.
Lesson Learned
Don't perform critical operations in a production environment!