From 7d34c0cae6ada7c1c18c55943f60b19b0b04468b Mon Sep 17 00:00:00 2001 From: Kaladin Light <0.kaladin@gmail.com> Date: Fri, 11 Nov 2016 17:45:48 -0500 Subject: [PATCH] Fixes Issue #148 --- scripts/makeOVPN.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/scripts/makeOVPN.sh b/scripts/makeOVPN.sh index 60210a1..233fec1 100644 --- a/scripts/makeOVPN.sh +++ b/scripts/makeOVPN.sh @@ -68,13 +68,16 @@ function keyPASS() { exit 1 fi + #Escape chars in PASSWD + PASSWD=$(echo -n $PASSWD | sed -e 's/\\/\\\\/g' -e 's/\//\\\//g' -e 's/\$/\\\$/g' -e 's/!/\\!/g' -e 's/\./\\\./g' -e "s/'/\\\'/g" -e 's/"/\\"/g' -e 's/\*/\\\*/g' -e 's/\@/\\\@/g' -e 's/\#/\\\#/g' -e 's/£/\\£/g' -e 's/%/\\%/g' -e 's/\^/\\\^/g' -e 's/\&/\\\&/g' -e 's/(/\\(/g' -e 's/)/\\)/g' -e 's/-/\\-/g' -e 's/_/\\_/g' -e 's/\+/\\\+/g' -e 's/=/\\=/g' -e 's/\[/\\\[/g' -e 's/\]/\\\]/g' -e 's/;/\\;/g' -e 's/:/\\:/g' -e 's/|/\\|/g' -e 's//\\>/g' -e 's/,/\\,/g' -e 's/?/\\?/g' -e 's/~/\\~/g' -e 's/{/\\{/g' -e 's/}/\\}/g') + #Build the client key and then encrypt the key expect << EOF set timeout -1 spawn ./build-key-pass "$NAME" - expect "Enter PEM pass phrase" { send "$PASSWD\r" } - expect "Verifying - Enter PEM pass phrase" { send "$PASSWD\r" } + expect "Enter PEM pass phrase" { send "\\\$PASSWD\\r" } + expect "Verifying - Enter PEM pass phrase" { send "\\\$PASSWD\\r" } expect "Country Name" { send "\r" } expect "State or Province Name" { send "\r" } expect "Locality Name" { send "\r" } @@ -95,9 +98,9 @@ EOF expect << EOF set timeout -1 spawn openssl rsa -in "$NAME$OKEY" -des3 -out "$NAME$KEY" - expect "Enter pass phrase for" { send "$PASSWD\r" } - expect "Enter PEM pass phrase" { send "$PASSWD\r" } - expect "Verifying - Enter PEM pass" { send "$PASSWD\r" } + expect "Enter pass phrase for" { send "\\\$PASSWD\\r" } + expect "Enter PEM pass phrase" { send "\\\$PASSWD\\r" } + expect "Verifying - Enter PEM pass" { send "\\\$PASSWD\\r" } expect eof EOF }