diff --git a/setup.sh b/setup.sh index 4dfa56c..ec931a6 100644 --- a/setup.sh +++ b/setup.sh @@ -22,6 +22,7 @@ unset useCertbot unset CertbotDomain unset CertPath unset KeyPath +unset DHPath 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])" @@ -188,7 +189,70 @@ while true; do break fi fi - echo -e "${norm}" + ;; + esac +done + +# dhparam: get location of DH Parameters file +while true; do + read -p "What is the path to your DH Parameters file? (default: /etc/ssl/certs/dhparam.pem) " inputDHPath + case "${inputDHPath}" in + '') + # verify default path exists + inputDHPath="/etc/ssl/certs/dhparam.pem" + if [ -f "${inputDHPath}" ]; then + DHPath="${inputDHPath}" + break + else + echo -e "\n${warn}The file you specified doesn't exist${norm}" + while true; do + read -p "Do you want to use this path anyways? " yn + case $yn in + [Yy]*) + DHPath="${inputDHPath}" + break + ;; + [Nn]*) + break + ;; + *) + ;; + esac + done + if [ -n "${DHPath}" ]; then + break + fi + fi + ;; + [Xx]*) + echo -e "\n${cyan}---exiting---\n${norm}" + exit 1 + ;; + *) + # validate path + if [ -f "${inputDHPath}" ]; then + DHPath="${inputDHPath}" + break + else + echo -e "\n${warn}The file you specified doesn't exist${norm}" + while true; do + read -p "Do you want to use this path anyways? " yn + case $yn in + [Yy]*) + DHPath="${inputDHPath}" + break + ;; + [Nn]*) + break + ;; + *) + ;; + esac + done + if [ -n "${DHPath}" ]; then + break + fi + fi ;; esac done @@ -200,5 +264,6 @@ echo "Using Certbot: $useCertbot" echo "CertbotDomain: $CertbotDomain" echo "CertPath: $CertPath" echo "KeyPath: $KeyPath" +echo "DHPath: $DHPath" exit 0