ssl root path validation and parked duplicate fix
Now we validate root path before request a certificate. Parked site fixed error when domain already exist.
This commit is contained in:
parent
9a37741d4b
commit
5fecb0cf50
14
lib/site-ssl
14
lib/site-ssl
|
@ -8,7 +8,15 @@ source /opt/webinoly/lib/general
|
|||
site_ssl_on() {
|
||||
local cermail=$(conf_read mail)
|
||||
local root="$domain"
|
||||
[[ $cache == "-root" && -n $value ]] && root="$value"
|
||||
if [[ $cache == "-root" && -n $value && -a /etc/nginx/sites-available/$value ]]; then
|
||||
root="$value"
|
||||
elif [[ $cache == "-root" && -n $value && ! -a /etc/nginx/sites-available/$value ]]; then
|
||||
echo "${red}Root path domain is not a valid domain or is not found/hosted in this server!${end}"
|
||||
exit 1
|
||||
elif [[ $cache == "-root" && -z $value ]]; then
|
||||
echo "${red}Please, enter a valid root path domain!${end}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "${gre}"
|
||||
echo "*************************************************************************************************"
|
||||
|
@ -37,9 +45,9 @@ site_ssl_on() {
|
|||
done
|
||||
|
||||
# Create new certificate
|
||||
if [[ ! -a /etc/letsencrypt/live/$domain/fullchain.pem && $subdomflag == 0 ]]; then
|
||||
if [[ ! -a /etc/letsencrypt/live/$domain/fullchain.pem && $subdomflag == 0 && $(conf_read debug) != "true" ]]; then
|
||||
sudo letsencrypt certonly --webroot -w /var/www/$root/htdocs/ -d $domain -d www.$domain --email $cermail --agree-tos
|
||||
elif [[ ! -a /etc/letsencrypt/live/$domain/fullchain.pem && $subdomflag == 1 ]]; then
|
||||
elif [[ ! -a /etc/letsencrypt/live/$domain/fullchain.pem && $subdomflag == 1 && $(conf_read debug) != "true" ]]; then
|
||||
sudo letsencrypt certonly --webroot -w /var/www/$root/htdocs/ -d $domain --email $cermail --agree-tos
|
||||
fi
|
||||
|
||||
|
|
|
@ -176,6 +176,12 @@ elif [ "$type" == "-wpsubdom" ]; then
|
|||
|
||||
# Parked Domain
|
||||
elif [ "$type" == "-parked" ]; then
|
||||
# Check for duplicate sites
|
||||
if [[ -a /etc/nginx/sites-available/$domain ]]; then
|
||||
echo "${red}Site $domain could not be created because already exists!${end}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mapto="NeverMatchAtFirstDotCom"
|
||||
[[ -n $value ]] && mapto="$value"
|
||||
|
||||
|
|
Loading…
Reference in a new issue