From 914833c7b83653268ee50b8ff805e083f866d202 Mon Sep 17 00:00:00 2001 From: Stephen Toth Date: Sat, 2 Sep 2023 20:01:45 -0500 Subject: [PATCH] modified main script to output into subdir added gitignore forgot to exclude the gitignore from gitignore so yeah... --- .gitignore | 4 ++++ 1genconfig.sh | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5a27e61 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +0* +client-* +!0*.def +!1* diff --git a/1genconfig.sh b/1genconfig.sh index 6c46396..6a7a9b5 100755 --- a/1genconfig.sh +++ b/1genconfig.sh @@ -1,5 +1,7 @@ #!/bin/ash +OutputDir="clients/" + EnvironmentFile="0connection-info.env" echo "[*] Using server information from file \"$EnvironmentFile\"" if [ ! -f "$EnvironmentFile" ] @@ -16,6 +18,7 @@ read Ip umask 077; +cd "clients" wg genkey | tee "client-$Name" | wg pubkey > "client-$Name.pub"; wg genpsk > "client-$Name.psk"; echo "[*] Generated Keys" @@ -43,8 +46,8 @@ 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\"" +echo "[*] Generated server lines and outputed to file \"${OutputDir}client-$Name.srv\"" +cd .. umask 022; echo "[*] All done!"