donaldzou / WGDashboard

Simple dashboard for WireGuard VPN written in Python w/ Flask
Apache License 2.0
1.41k stars 207 forks source link

Backup peers #332

Open hadi-dindar opened 3 weeks ago

hadi-dindar commented 3 weeks ago

Is it possible to to backup peers for upload new wg-dasboard ?

DaanSelen commented 3 weeks ago

Hello @hadi-dindar can you add context as in backup peers how? Most peers, or at least they public keys are stored in the Wireguard configuration file in /etc/wireguard/wg*.conf. So copying that file would make everything work.

For what use case?

hadi-dindar commented 3 weeks ago

Hello @hadi-dindar can you add context as in backup peers how? Most peers, or at least they public keys are stored in the Wireguard configuration file in /etc/wireguard/wg*.conf. So copying that file would make everything work.

For what use case?

i changed contect to backup peers , but when i use this way and i copay past peers from old wg.conf file to new wg.conf (new server ) it shown unknown name in panel . not incloude peers name !

DaanSelen commented 3 weeks ago

This looks like a case explained on: https://github.com/donaldzou/WGDashboard?tab=readme-ov-file#existing-wireguard-configurations

Here is my example on an existing WireGuard configuration:

[Interface]
...

[Peer]
#Name# = Name Custom 1
PublicKey = <KEY>
AllowedIPs = 10.0.0.2/32

[Peer]
#Name# = Custom Name 2
PublicKey = <KEY>
AllowedIPs = 10.0.0.3/32

If you add the: #Name# = Custom Name 2 entries it takes that:" image

And to confirm this, WGDashboard will print the names when starting up, here an example because I have it on hand:

wgdashboard  | [WGDashboard] Starting WGDashboard with Gunicorn in the background.
wgdashboard  | ['#Name#', 'Name Custom 1']
wgdashboard  | ['#Name#', 'Custom Name 2']
wgdashboard  | [WGDashboard] WGDashboard w/ Gunicorn will be running on 0.0.0.0:10086
wgdashboard  | [WGDashboard] Access log file is at ./log/access_2024_08_22_21_52_26.log
wgdashboard  | [WGDashboard] Error log file is at ./log/error_2024_08_22_21_52_26.log
wgdashboard  | [WGDashboard] Checking if WGDashboard w/ Gunicorn started successfully
wgdashboard  | [WGDashboard] WGDashboard w/ Gunicorn started successfully

Hope this helps!