Script to install WireGuard on Ubiquiti

Because i had some issues with configuration lost on Edgerouter ER-4 after power loss i’ve search how to upgrade wireguard without losing configuration (like pubkey and privkey).
I found this. Works pretty good. Installed. Saved. Reboot.

[email protected]:~$ sudo -i
[email protected]:~# cd /config/scripts
[email protected]:/config/scripts# curl -LO --silent https://github.com/whiskerz007/ubnt_get_wireguard/raw/master/get_wireguard.sh
[email protected]:/config/scripts# chmod +x get_wireguard.sh
[email protected]:/config/scripts# ./get_wireguard.sh
[INFO] Board model: EdgeRouter 4
[INFO] Board type: e300
[INFO] Board repo mapping: e300
[INFO] Firmware version: v2.0.4.5199165.190605.1549
[INFO] Installed WireGuard version: 0.0.20190601-1
[INFO] Release version: 0.0.20191219-2
[INFO] Debian package URL: https://github.com/Lochnair/vyatta-wireguard/releases/download/0.0.20191219-2/wireguard-v2.0-e300-0.0.20191219-2.deb
Downloading WireGuard package…
Checking WireGuard package integrity…
Backing up running configuration…
Removing running WireGuard configuration…
Removing WireGuard module…
Installing WireGuard…
Restoring previous running configuration…
Enabling WireGuard installation after firmware update…
WireGuard has been successfully installed.
[email protected]:/config/scripts# exit

Added cron for future updates:

[email protected]:~$ configure
[edit]
[email protected]# set system task-scheduler task get_wireguard executable path /config/scripts/get_wireguard.sh
[edit]
[email protected]# set system task-scheduler task get_wireguard interval 7d
[edit]
[email protected]# commit
[ system task-scheduler ]
Restarting cron (via systemctl): cron.service.
[edit]
[email protected]# save
Saving configuration to '/config/config.boot'…
Done
[edit]
[email protected]# exit
exit

Leave a reply:

Your email address will not be published.

Site Footer