Import WireGuard private key

Hello!

I’m trying to configure a VyOS instance to connect to a WireGuard VPN provider.
This provider is supplying both their public key but also a private key for me to use when connecting.

I can’t find a way to import a private key in the official docs, only how to generate one.

Is there a way to import a private key?
Have I maybe misunderstood something?

Example (fake) of the configuration my provider have given me:

[Interface]
PrivateKey = CCDLzjaJyZRiduN4Qk4vcpPiFPDJ5a6EHSeryrbFdW8=

Address = 10.0.0.5/24
DNS = 10.0.0.10, 10.0.0.11

[Peer]
PublicKey = e2YIp/0hLXpUFA2pBqVvR635OLF8dP5DEpgXnSx5rn4=
Endpoint = vpn.example.com:12345
AllowedIPs = 0.0.0.0/0

This is valid only for the rolling release. 1.2 does it differently. Using the fake data provided you would configure like this.

set interfaces wireguard wg0 address '10.0.0.5/24'
set interfaces wireguard wg0 description 'fake-config'
set interfaces wireguard wg0 mtu '1420'
set interfaces wireguard wg0 peer fake-peer address 'vpn.example.com'
set interfaces wireguard wg0 peer fake-peer allowed-ips '0.0.0.0/0'
set interfaces wireguard wg0 peer fake-peer persistent-keepalive '15'
set interfaces wireguard wg0 peer fake-peer port '12345'
set interfaces wireguard wg0 peer fake-peer pubkey 'e2YIp/0hLXpUFA2pBqVvR635OLF8dP5DEpgXnSx5rn4='
set interfaces wireguard wg0 private-key 'wg0'

You place your private.key and public.key files containing their respective values at this location

/config/auth/wireguard/wg0

Thank you!
This worked brilliantly.
I had actually configured everything correctly except putting the keys in /config.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.