Browse Source

removed $confdir

Dominik 2 years 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
   peer=$1
   ip=$2
   ip=$2
 
 
-  cat >$confdir/$peer.conf <<EOL
+  cat >$peer.conf <<EOL
 # Client config for $peer
 # Client config for $peer
 [Interface]
 [Interface]
-PrivateKey = `cat $confdir/$peer.key`
+PrivateKey = `cat $peer.key`
 Address = $ip
 Address = $ip
 DNS = $dns
 DNS = $dns
  
  
 [Peer]
 [Peer]
-PublicKey = `cat $confdir/$servername.pub`
+PublicKey = `cat $servername.pub`
 AllowedIPs = $network
 AllowedIPs = $network
 Endpoint = $servername:$serverport
 Endpoint = $servername:$serverport
 PersistentKeepalive = 15
 PersistentKeepalive = 15
-PresharedKey = `cat $confdir/$peer.psk`
+PresharedKey = `cat $peer.psk`
 EOL
 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
 wgkeypair $servername
 
 
 ## Create server config
 ## Create server config
-echo debug $confdir/$servername.conf
-cat >$confdir/$servername.conf <<EOL
+cat >$servername.conf <<EOL
 # Config for $peer
 # Config for $peer
 [Interface]
 [Interface]
-PrivateKey = `cat $confdir/$servername.key`
+PrivateKey = `cat $servername.key`
 Address = $serverip
 Address = $serverip
 DNS = $dns
 DNS = $dns
 EOL
 EOL
@@ -75,10 +74,10 @@ while read peer;
    wgconfig $host $ip
    wgconfig $host $ip
 
 
    # Add peers to server config
    # Add peers to server config
-      cat >>$confdir/$servername.conf <<EOL
+      cat >>$servername.conf <<EOL
 [Peer]
 [Peer]
-PublicKey = `cat $confdir/$host.pub`
+PublicKey = `cat $host.pub`
 AllowedIPs = $ip
 AllowedIPs = $ip
-PresharedKey = `cat $confdir/$host.psk`
+PresharedKey = `cat $host.psk`
 EOL
 EOL
  done < peers.cfg
  done < peers.cfg