Skip to content

Commit

Permalink
openvpn.sh fix unintentional reuse of auth by cert_auth
Browse files Browse the repository at this point in the history
  • Loading branch information
David Personette committed Dec 10, 2018
1 parent 463c0da commit c496e88
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions openvpn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ set -o nounset # Treat unset variables as an error
# passwd) Password to access the cert
# Return: conf file that supports certificate authentication
cert_auth() { local passwd="$1"
grep -q "^${passwd}\$" $auth || {
echo "$passwd" >$auth
grep -q "^${passwd}\$" $cert_auth || {
echo "$passwd" >$cert_auth
}
chmod 0600 $auth
grep -q "^askpass ${auth}\$" $conf || {
chmod 0600 $cert_auth
grep -q "^askpass ${cert_auth}\$" $conf || {
sed -i '/askpass/d' $conf
echo "askpass $auth" >>$conf
echo "askpass $cert_auth" >>$conf
}
}

Expand Down Expand Up @@ -204,7 +204,8 @@ The 'command' (if provided and valid) will be run instead of openvpn
}

dir="/vpn"
auth="$dir/vpn.cert_auth"
auth="$dir/vpn.auth"
cert_auth="$dir/vpn.cert_auth"
conf="$dir/vpn.conf"
cert="$dir/vpn-ca.crt"
route="$dir/.firewall"
Expand Down

0 comments on commit c496e88

Please sign in to comment.