added serverNames section

This commit is contained in:
Asif Bacchus 2019-01-05 02:11:49 -07:00
parent 260bcea10f
commit d440addca3
2 changed files with 45 additions and 3 deletions

View File

@ -5,14 +5,14 @@
"bookmarks": [
-1,
17,
36,
38,
-1,
-1,
-1,
-1,
-1,
-1,
420
110
]
}
]

View File

@ -27,11 +27,13 @@ unset CAChainPath
unset DHPath
# set variables
hostname=$(hostname)
serverNames_working=()
serverNames=()
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])"
regexHostname="(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])"
certbotFiles=(cert.pem chain.pem fullchain.pem privkey.pem)
hostname=$(hostname)
configPath="./etc.${hostname}"
# set tags to update
@ -76,6 +78,46 @@ while true; do
done
### get server names for this installation
echo -e "\n${mag}NIGNX needs to know what hostnames it should answer. You can pick as many"
echo "hostnames as you like. Please ensure you provide fully-qualified domain"
echo "names unless you are providing special names such as 'localhost' and fully"
echo "understand what that means in this context."
echo -e "\nIf you're setting up this system with SSL, then make sure your hostnames"
echo "match what appears on your certificates!"
echo -e "\n${warn}You will be prompted to enter one hostname at a time."
echo "Provide a blank-entry (hit enter) when you're done."
echo -e "'X' will exit the script, as always${norm}\n"
while true; do
read -p "What hostnames should this server answer to? " inputServerName
case "${inputServerName}" in
'')
break
;;
[Xx]*)
echo -e "\n${cyan}---exiting---\n${norm}"
exit 1
;;
*)
# check hostname for validity
if [[ ! "${inputServerName}" =~ ^${regexHostname}$ ]]; then
echo -e "\n${err}Invalid hostname${norm}"
else
serverNames_working+=("${inputServerName}")
fi
;;
esac
done
# create new array with unqiue values only
declare -A uniqueSN
for name in "${serverNames_working[@]}"; do
uniqueSN["${name}"]=""
done
for sn in "${!uniqueSN[@]}"; do
serverNames+=("${sn}")
done
### SSL related options
# using certbot?
while true; do