The code to install wireguard onto Ubiquiti devices can be found here: GitHub WireGuard for Ubiquiti
For an EdgeRouter Lite, which are the units that I have the commands to install the package are:
curl -OL https://github.com/WireGuard/wireguard-vyatta-ubnt/releases/download/1.0.20220627-1/e100-v2-v1.0.20220627-v1.0.20210914.deb
sudo dpkg -i e100-v2-v1.0.20220627-v1.0.20210914.deb
Then you need to create the keys necessary for Wireguard to communicate - which uses the local filesystem.
The default directory is typically /home/ubnt
, but it can change depending on the logged in user.
To generate the key pair you use:
wg genkey | tee privatekey | wg pubkey > publickey
An example configuration using the above keys is shown below:
set interfaces wireguard wg0 private-key /home/ubnt/privatekey
set interfaces wireguard wg0 peer peers-public-key allowed-ips 0.0.0.0/0
set interfaces wireguard wg0 address 192.0.2.1/30
set interfaces wireguard wg0 route-allowed-ips false
set interfaces wireguard wg0 listen-port 51820