Browse Source

removed $confdir

Dominik 9 months ago
parent
commit
3c505ccc11
1 changed files with 11 additions and 12 deletions
  1. 11 12
      linux/wireguard/create-config/wg-createconfig.sh

+ 11 - 12
linux/wireguard/create-config/wg-createconfig.sh

@@ -25,23 +25,23 @@ wgconfig() {
   peer=$1
   ip=$2
 
-  cat >$confdir/$peer.conf <<EOL
+  cat >$peer.conf <<EOL
 # Client config for $peer
 [Interface]
-PrivateKey = `cat $confdir/$peer.key`
+PrivateKey = `cat $peer.key`
 Address = $ip
 DNS = $dns
  
 [Peer]
-PublicKey = `cat $confdir/$servername.pub`
+PublicKey = `cat $servername.pub`
 AllowedIPs = $network
 Endpoint = $servername:$serverport
 PersistentKeepalive = 15
-PresharedKey = `cat $confdir/$peer.psk`
+PresharedKey = `cat $peer.psk`
 EOL
 
-  qrencode  -t ANSIUTF8 -r $confdir/$peer.conf > $peer-qr.txt
-  qrencode  -t png -r $confdir/$peer.conf > $peer.png
+  qrencode  -t ANSIUTF8 -r $peer.conf > $peer-qr.txt
+  qrencode  -t png -r $peer.conf > $peer.png
 }
 
 
@@ -55,11 +55,10 @@ cd $confdir
 wgkeypair $servername
 
 ## Create server config
-echo debug $confdir/$servername.conf
-cat >$confdir/$servername.conf <<EOL
+cat >$servername.conf <<EOL
 # Config for $peer
 [Interface]
-PrivateKey = `cat $confdir/$servername.key`
+PrivateKey = `cat $servername.key`
 Address = $serverip
 DNS = $dns
 EOL
@@ -75,10 +74,10 @@ while read peer;
    wgconfig $host $ip
 
    # Add peers to server config
-      cat >>$confdir/$servername.conf <<EOL
+      cat >>$servername.conf <<EOL
 [Peer]
-PublicKey = `cat $confdir/$host.pub`
+PublicKey = `cat $host.pub`
 AllowedIPs = $ip
-PresharedKey = `cat $confdir/$host.psk`
+PresharedKey = `cat $host.psk`
 EOL
  done < peers.cfg