skip manual cert and key path prompting if using Certbot
This commit is contained in:
parent
f0008b1d71
commit
c93d5ac9c5
270
setup.sh
270
setup.sh
@ -113,150 +113,152 @@ if [ "${useCertbot}" -eq 1 ]; then
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# not using Certbot: get location of certificate
|
# only process manual certificate paths if NOT using Certbot
|
||||||
while true; do
|
if [ "${useCertbot}" -eq 0 ]; then
|
||||||
read -p "What is the path to your primary SSL certificate? " inputCertPath
|
# not using Certbot: get location of certificate
|
||||||
case "${inputCertPath}" in
|
while true; do
|
||||||
'')
|
read -p "What is the path to your primary SSL certificate? " inputCertPath
|
||||||
echo -e "\n${err}You cannot have an empty path to your SSL certificate${norm}"
|
case "${inputCertPath}" in
|
||||||
;;
|
'')
|
||||||
[Xx]*)
|
echo -e "\n${err}You cannot have an empty path to your SSL certificate${norm}"
|
||||||
echo -e "\n${cyan}---exiting---\n${norm}"
|
;;
|
||||||
exit 1
|
[Xx]*)
|
||||||
;;
|
echo -e "\n${cyan}---exiting---\n${norm}"
|
||||||
*)
|
exit 1
|
||||||
# validate path
|
;;
|
||||||
if [ -f "${inputCertPath}" ]; then
|
*)
|
||||||
CertPath="${inputCertPath}"
|
# validate path
|
||||||
break
|
if [ -f "${inputCertPath}" ]; then
|
||||||
else
|
CertPath="${inputCertPath}"
|
||||||
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]*)
|
|
||||||
CertPath="${inputCertPath}"
|
|
||||||
break
|
|
||||||
;;
|
|
||||||
[Nn]*)
|
|
||||||
break
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
if [ -n "${CertPath}" ]; then
|
|
||||||
break
|
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]*)
|
||||||
|
CertPath="${inputCertPath}"
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
[Nn]*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
if [ -n "${CertPath}" ]; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
;;
|
||||||
;;
|
esac
|
||||||
esac
|
done
|
||||||
done
|
|
||||||
|
|
||||||
# not using Certbot: get location of private key
|
# not using Certbot: get location of private key
|
||||||
while true; do
|
while true; do
|
||||||
read -p "What is the path to your primary SSL private key? " inputKeyPath
|
read -p "What is the path to your primary SSL private key? " inputKeyPath
|
||||||
case "${inputKeyPath}" in
|
case "${inputKeyPath}" in
|
||||||
'')
|
'')
|
||||||
echo -e "\n${err}You cannot have an empty path to your SSL private key${norm}"
|
echo -e "\n${err}You cannot have an empty path to your SSL private key${norm}"
|
||||||
;;
|
;;
|
||||||
[Xx]*)
|
[Xx]*)
|
||||||
echo -e "\n${cyan}---exiting---\n${norm}"
|
echo -e "\n${cyan}---exiting---\n${norm}"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
# validate path
|
# validate path
|
||||||
if [ -f "${inputKeyPath}" ]; then
|
if [ -f "${inputKeyPath}" ]; then
|
||||||
KeyPath="${inputKeyPath}"
|
KeyPath="${inputKeyPath}"
|
||||||
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]*)
|
|
||||||
KeyPath="${inputKeyPath}"
|
|
||||||
break
|
|
||||||
;;
|
|
||||||
[Nn]*)
|
|
||||||
break
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
if [ -n "${KeyPath}" ]; then
|
|
||||||
break
|
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]*)
|
||||||
|
KeyPath="${inputKeyPath}"
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
[Nn]*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
if [ -n "${KeyPath}" ]; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
;;
|
||||||
;;
|
esac
|
||||||
esac
|
done
|
||||||
done
|
|
||||||
|
|
||||||
# dhparam: get location of DH Parameters file
|
# dhparam: get location of DH Parameters file
|
||||||
while true; do
|
while true; do
|
||||||
read -p "What is the path to your DH Parameters file? (default: /etc/ssl/certs/dhparam.pem) " inputDHPath
|
read -p "What is the path to your DH Parameters file? (default: /etc/ssl/certs/dhparam.pem) " inputDHPath
|
||||||
case "${inputDHPath}" in
|
case "${inputDHPath}" in
|
||||||
'')
|
'')
|
||||||
# verify default path exists
|
# verify default path exists
|
||||||
inputDHPath="/etc/ssl/certs/dhparam.pem"
|
inputDHPath="/etc/ssl/certs/dhparam.pem"
|
||||||
if [ -f "${inputDHPath}" ]; then
|
if [ -f "${inputDHPath}" ]; then
|
||||||
DHPath="${inputDHPath}"
|
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
|
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
|
fi
|
||||||
fi
|
;;
|
||||||
;;
|
[Xx]*)
|
||||||
[Xx]*)
|
echo -e "\n${cyan}---exiting---\n${norm}"
|
||||||
echo -e "\n${cyan}---exiting---\n${norm}"
|
exit 1
|
||||||
exit 1
|
;;
|
||||||
;;
|
*)
|
||||||
*)
|
# validate path
|
||||||
# validate path
|
if [ -f "${inputDHPath}" ]; then
|
||||||
if [ -f "${inputDHPath}" ]; then
|
DHPath="${inputDHPath}"
|
||||||
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
|
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
|
fi
|
||||||
fi
|
;;
|
||||||
;;
|
esac
|
||||||
esac
|
done
|
||||||
done
|
fi
|
||||||
|
|
||||||
|
|
||||||
# debug section
|
# debug section
|
||||||
echo "Local IP4: $IP4"
|
echo "Local IP4: $IP4"
|
||||||
|
Loading…
Reference in New Issue
Block a user