From 7a6c6a9ac464f0cfbba214bcf6578e5774ee10b4 Mon Sep 17 00:00:00 2001 From: Asif Bacchus Date: Fri, 4 Jan 2019 22:56:24 -0700 Subject: [PATCH] added private key path section --- .vscode/numbered-bookmarks.json | 18 +++++++++++++- setup.sh | 43 +++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 1 deletion(-) diff --git a/.vscode/numbered-bookmarks.json b/.vscode/numbered-bookmarks.json index 4c08963..9aa6c22 100644 --- a/.vscode/numbered-bookmarks.json +++ b/.vscode/numbered-bookmarks.json @@ -1,3 +1,19 @@ { - "bookmarks": [] + "bookmarks": [ + { + "fsPath": "$ROOTPATH$/setup.sh", + "bookmarks": [ + -1, + 17, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1 + ] + } + ] } \ No newline at end of file diff --git a/setup.sh b/setup.sh index d572801..163e7bd 100644 --- a/setup.sh +++ b/setup.sh @@ -21,6 +21,7 @@ unset IP4 unset useCertbot unset CertbotDomain unset CertPath +unset KeyPath detectedIP=$(ip route get 1 | sed -n 's/^.*src \([0-9.]*\) .*$/\1/p') regexIP4="(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])" @@ -152,11 +153,53 @@ while true; do esac done +# not using Certbot: get location of private key +while true; do + read -p "What is the path to your primary SSL private key? " inputKeyPath + case "${inputKeyPath}" in + '') + echo -e "\n${err}You cannot have an empty path to your SSL private key${norm}" + ;; + [Xx]*) + echo -e "\n${cyan}---exiting---\n${norm}" + exit 1 + ;; + *) + # validate path + if [ -f "${inputKeyPath}" ]; then + KeyPath="${inputKeyPath}" + break + else + echo -e "\n${warn}The file you specified doesn't exist" + while true; do + read -p "Do you want to use this path anyways? " yn + echo -e "${norm}" + case $yn in + [Yy]*) + KeyPath="${inputKeyPath}" + break + ;; + [Nn]*) + break + ;; + *) + ;; + esac + done + if [ -n "${KeyPath}" ]; then + break + fi + fi + ;; + esac +done + # debug section echo "Local IP4: $IP4" echo "Using Certbot: $useCertbot" echo "CertbotDomain: $CertbotDomain" echo "CertPath: $CertPath" +echo "KeyPath: $KeyPath" exit 0