File tree 1 file changed +3
-6
lines changed
1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -16,9 +16,8 @@ case "$1" in
16
16
17
17
sudo mkdir -p /etc/wireguard
18
18
19
- if ! sudo test -f " /etc/wireguard/controlplane.conf" ; then
20
- sudo test -f " /etc/wireguard/private.key" || wg genkey | sudo tee " /etc/wireguard/private.key" > /dev/null
21
- cat << EOF | sudo tee /etc/wireguard/controlplane.conf
19
+ sudo test -f " /etc/wireguard/private.key" || wg genkey | sudo tee " /etc/wireguard/private.key" > /dev/null
20
+ cat << EOF | sudo tee /etc/wireguard/controlplane.conf
22
21
[Interface]
23
22
PrivateKey = $( cat /etc/wireguard/private.key)
24
23
@@ -27,8 +26,7 @@ PublicKey = $gw_public
27
26
AllowedIPs = $gw_ip
28
27
Endpoint = $gw_endpoint
29
28
EOF
30
- sudo chmod 600 /etc/wireguard/controlplane.conf
31
- fi
29
+ sudo chmod 600 /etc/wireguard/controlplane.conf
32
30
33
31
sudo wireguard-go " $dev "
34
32
sudo wg setconf " $dev " /etc/wireguard/controlplane.conf
37
35
sudo ifconfig " $dev " up
38
36
sudo route -q -n add -inet " $network " -interface " $dev "
39
37
sudo wg
40
- echo -e " done! your public key:\n$( sudo cat /etc/wireguard/private.key | wg pubkey) "
41
38
;;
42
39
43
40
" down" )
You can’t perform that action at this time.
0 commit comments