jamescun / wg-api

WG-API is a JSON-RPC Server for WireGuard
MIT License
151 stars 21 forks source link

Persistence: WireGuad Interface/Peer Configuration #7

Open jamescun opened 4 years ago

jamescun commented 4 years ago

WG-API currently makes no attempt to persist WireGuard configuration between restarts. The restart may be of the wg-api daemon, or of the system itself.

In the case of the wg-api daemon being restarted, all configuration is persisted as the WireGuard interface itself is used as the source of truth. No persistence nessecary.

In the case of the system restarting, the system may not be configured with wg-quick to load configuration on startup, and thus wg-api will see an empty state. No attempt is made to store configuration changes made by wg-api on termination, this must be done seperately.

WG-API should have a mechanism to snapshot and restore WireGuard's interface/peer configuration, perferably in a format that is compatible with wg-quick.

vandot commented 4 years ago

@jamescun isnt SaveConfig = true inside server config for that?

jamescun commented 4 years ago

@vandot SaveConfig = true is a feature that is part of wg-quick rather than wg, and requires extra configuration to automatically load/save configuration as part of boot/shutdown.

This question is whether or not wg-api should have the same / similar functionality, or if we should simply document how to achieve this with wg-quick

vandot commented 4 years ago

@jamescun for start at least to document that people configure server with SaveConfig = true