created git repo for easy script\n probably works pretty good
This commit is contained in:
commit
1c0c34bc78
|
|
@ -0,0 +1,4 @@
|
|||
Endpoint="HOST:PORT"
|
||||
EPubkey="PUBKEY"
|
||||
Allowedips="IPS"
|
||||
Dns="DNSSERVER"
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
#!/bin/ash
|
||||
|
||||
EnvironmentFile="0connection-info.env"
|
||||
echo "[*] Using server information from file \"$EnvironmentFile\""
|
||||
if [ ! -f "$EnvironmentFile" ]
|
||||
then
|
||||
echo "[!] $EnvironmentFile not found"
|
||||
exit
|
||||
fi
|
||||
source "$EnvironmentFile"
|
||||
|
||||
echo -n "Name: "
|
||||
read Name
|
||||
echo -n "Assigned IP (no mask): "
|
||||
read Ip
|
||||
|
||||
|
||||
umask 077;
|
||||
wg genkey | tee "client-$Name" | wg pubkey > "client-$Name.pub"; wg genpsk > "client-$Name.psk";
|
||||
echo "[*] Generated Keys"
|
||||
|
||||
cat << EOF >> "client-$Name.conf"
|
||||
[Interface]
|
||||
PrivateKey = $(cat "client-$Name")
|
||||
Address = "$Ip/32"
|
||||
DNS = $Dns
|
||||
|
||||
[Peer]
|
||||
PublicKey = $EPubkey
|
||||
PresharedKey = $(cat "client-$Name.psk")
|
||||
AllowedIPs = $Allowedips
|
||||
Endpoint = $Endpoint
|
||||
PersistentKeepalive = 25
|
||||
EOF
|
||||
|
||||
echo "[*] Generated config"
|
||||
echo "[*] Peer setup lines:"; echo;
|
||||
|
||||
cat << EOF | tee "client-$Name.srv"
|
||||
[Peer]
|
||||
# $Name #
|
||||
PublicKey = $(cat "client-$Name.pub")
|
||||
PresharedKey = $(cat "client-$Name.psk")
|
||||
AllowedIPs = "$Ip/32"
|
||||
EOF
|
||||
|
||||
echo;
|
||||
echo "[*] Generated server lines and outputed to file \"client-$Name.srv\""
|
||||
umask 022;
|
||||
echo "[*] All done!"
|
||||
Loading…
Reference in New Issue