Generate key if file is empty

This commit is contained in:
Héctor Molinero Fernández 2021-06-14 23:07:48 +02:00
parent 91d4d6df76
commit 36a092a77f

View File

@ -2,8 +2,8 @@
Address = 10.10.10.1/24, fd10:10:10::1/64 Address = 10.10.10.1/24, fd10:10:10::1/64
ListenPort = 51820 ListenPort = 51820
# Load keys # Load keys
PostUp = [ -e '/etc/wireguard/%i-privatekey' ] || (umask 077 && wg genkey > '/etc/wireguard/%i-privatekey') PostUp = [ -s '/etc/wireguard/%i-privatekey' ] || (umask 077 && wg genkey > '/etc/wireguard/%i-privatekey')
PostUp = [ -e '/etc/wireguard/%i-publickey' ] || (umask 022 && wg pubkey < '/etc/wireguard/%i-privatekey' > '/etc/wireguard/%i-publickey') PostUp = [ -s '/etc/wireguard/%i-publickey' ] || (umask 022 && wg pubkey < '/etc/wireguard/%i-privatekey' > '/etc/wireguard/%i-publickey')
PostUp = wg set '%i' private-key '/etc/wireguard/%i-privatekey' PostUp = wg set '%i' private-key '/etc/wireguard/%i-privatekey'
# Load peers # Load peers
PostUp = [ -e '/etc/wireguard/%i-peers.conf' ] || (umask 022 && touch '/etc/wireguard/%i-peers.conf') PostUp = [ -e '/etc/wireguard/%i-peers.conf' ] || (umask 022 && touch '/etc/wireguard/%i-peers.conf')