Added fixes for rpm based system usage
This commit is contained in:
@@ -249,6 +249,12 @@ prepare_web_domain_values() {
|
||||
# Add web config
|
||||
add_web_config() {
|
||||
# Check if folder already exists
|
||||
if [ "$1" = "httpd" ]; then
|
||||
confd="conf.h.d"
|
||||
else
|
||||
confd="conf.d"
|
||||
fi
|
||||
|
||||
if [ ! -d "$HOMEDIR/$user/conf/web/$domain" ]; then
|
||||
mkdir -p "$HOMEDIR/$user/conf/web/$domain/"
|
||||
fi
|
||||
@@ -309,8 +315,8 @@ add_web_config() {
|
||||
chmod 640 $conf
|
||||
|
||||
if [[ "$2" =~ stpl$ ]]; then
|
||||
rm -f /etc/$1/conf.d/domains/$domain.ssl.conf
|
||||
ln -s $conf /etc/$1/conf.d/domains/$domain.ssl.conf
|
||||
rm -f /etc/$1/$confd/domains/$domain.ssl.conf
|
||||
ln -s $conf /etc/$1/$confd/domains/$domain.ssl.conf
|
||||
|
||||
# Rename/Move extra SSL config files
|
||||
find=$(find $HOMEDIR/$user/conf/web/*.$domain.org* 2> /dev/null)
|
||||
@@ -326,8 +332,8 @@ add_web_config() {
|
||||
fi
|
||||
done
|
||||
else
|
||||
rm -f /etc/$1/conf.d/domains/$domain.conf
|
||||
ln -s $conf /etc/$1/conf.d/domains/$domain.conf
|
||||
rm -f /etc/$1/$confd/domains/$domain.conf
|
||||
ln -s $conf /etc/$1/$confd/domains/$domain.conf
|
||||
# Rename/Move extra config files
|
||||
find=$(find $HOMEDIR/$user/conf/web/*.$domain.org* 2> /dev/null)
|
||||
for f in $find; do
|
||||
@@ -394,6 +400,11 @@ replace_web_config() {
|
||||
|
||||
# Delete web configuration
|
||||
del_web_config() {
|
||||
if [ "$1" = "httpd" ]; then
|
||||
confd="conf.h.d"
|
||||
else
|
||||
confd="conf.d"
|
||||
fi
|
||||
conf="$HOMEDIR/$user/conf/web/$domain/$1.conf"
|
||||
local confname="$domain.conf"
|
||||
if [[ "$2" =~ stpl$ ]]; then
|
||||
@@ -410,17 +421,17 @@ del_web_config() {
|
||||
rm -f $legacyconf
|
||||
|
||||
# Remove old global includes file
|
||||
rm -f /etc/$1/conf.d/hestia.conf
|
||||
rm -f /etc/$1/$confd/hestia.conf
|
||||
fi
|
||||
|
||||
# Remove domain configuration files and clean up symbolic links
|
||||
rm -f "$conf"
|
||||
|
||||
if [ -n "$WEB_SYSTEM" ] && [ "$WEB_SYSTEM" = "$1" ]; then
|
||||
rm -f "/etc/$WEB_SYSTEM/conf.d/domains/$confname"
|
||||
rm -f "/etc/$WEB_SYSTEM/$confd/domains/$confname"
|
||||
fi
|
||||
if [ -n "$PROXY_SYSTEM" ] && [ "$PROXY_SYSTEM" = "$1" ]; then
|
||||
rm -f "/etc/$PROXY_SYSTEM/conf.d/domains/$confname"
|
||||
rm -f "/etc/$PROXY_SYSTEM/$confd/domains/$confname"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -787,6 +798,16 @@ add_mail_ssl_config() {
|
||||
|
||||
# Delete SSL support for mail domain
|
||||
del_mail_ssl_config() {
|
||||
if [ "$WEB_SYSTEM" = "httpd" ]; then
|
||||
confd="conf.h.d"
|
||||
else
|
||||
confd="conf.d"
|
||||
fi
|
||||
if [ "$PROXY_SYSTEM" = "httpd" ]; then
|
||||
pconfd="conf.h.d"
|
||||
else
|
||||
pconfd="conf.d"
|
||||
fi
|
||||
# Check to prevent accidental removal of mismatched certificate
|
||||
wildcard_domain="\\*.$(echo "$domain" | cut -f 1 -d . --complement)"
|
||||
mail_cert_match=$($BIN/v-list-mail-domain-ssl $user $domain | awk '/SUBJECT|ALIASES/' | grep -wE " $domain| $wildcard_domain")
|
||||
@@ -799,8 +820,8 @@ del_mail_ssl_config() {
|
||||
|
||||
# Remove SSL vhost configuration
|
||||
rm -f $HOMEDIR/$user/conf/mail/$domain/*.*ssl.conf
|
||||
rm -f /etc/$WEB_SYSTEM/conf.d/domains/$WEBMAIL_ALIAS.$domain.ssl.conf
|
||||
rm -f /etc/$PROXY_SYSTEM/conf.d/domains/$WEBMAIL_ALIAS.$domain.ssl.conf
|
||||
rm -f /etc/$WEB_SYSTEM/$confd/domains/$WEBMAIL_ALIAS.$domain.ssl.conf
|
||||
rm -f /etc/$PROXY_SYSTEM/$pconfd/domains/$WEBMAIL_ALIAS.$domain.ssl.conf
|
||||
|
||||
# Remove SSL certificates
|
||||
rm -f $HOMEDIR/$user/conf/mail/$domain/ssl/*
|
||||
@@ -821,6 +842,11 @@ del_mail_ssl_certificates() {
|
||||
|
||||
# Add webmail config
|
||||
add_webmail_config() {
|
||||
if [ "$1" = "httpd" ]; then
|
||||
confd="conf.h.d"
|
||||
else
|
||||
confd="conf.d"
|
||||
fi
|
||||
mkdir -p "$HOMEDIR/$user/conf/mail/$domain"
|
||||
conf="$HOMEDIR/$user/conf/mail/$domain/$1.conf"
|
||||
if [[ "$2" =~ stpl$ ]]; then
|
||||
@@ -883,13 +909,13 @@ add_webmail_config() {
|
||||
if [[ "$2" =~ stpl$ ]]; then
|
||||
if [ -n "$WEB_SYSTEM" ]; then
|
||||
forcessl="$HOMEDIR/$user/conf/mail/$domain/$WEB_SYSTEM.forcessl.conf"
|
||||
rm -f /etc/$1/conf.d/domains/$WEBMAIL_ALIAS.$domain.ssl.conf
|
||||
ln -s $conf /etc/$1/conf.d/domains/$WEBMAIL_ALIAS.$domain.ssl.conf
|
||||
rm -f /etc/$1/$confd/domains/$WEBMAIL_ALIAS.$domain.ssl.conf
|
||||
ln -s $conf /etc/$1/$confd/domains/$WEBMAIL_ALIAS.$domain.ssl.conf
|
||||
fi
|
||||
if [ -n "$PROXY_SYSTEM" ]; then
|
||||
forcessl="$HOMEDIR/$user/conf/mail/$domain/$PROXY_SYSTEM.forcessl.conf"
|
||||
rm -f /etc/$1/conf.d/domains/$WEBMAIL_ALIAS.$domain.ssl.conf
|
||||
ln -s $conf /etc/$1/conf.d/domains/$WEBMAIL_ALIAS.$domain.ssl.conf
|
||||
rm -f /etc/$1/$confd/domains/$WEBMAIL_ALIAS.$domain.ssl.conf
|
||||
ln -s $conf /etc/$1/$confd/domains/$WEBMAIL_ALIAS.$domain.ssl.conf
|
||||
fi
|
||||
|
||||
# Add rewrite rules to force HTTPS/SSL connections
|
||||
@@ -904,12 +930,12 @@ add_webmail_config() {
|
||||
find $HOMEDIR/$user/conf/mail/ -maxdepth 1 -type f \( -name "$domain.*" -o -name "ssl.$domain.*" -o -name "*nginx.$domain.*" \) -exec rm {} \;
|
||||
else
|
||||
if [ -n "$WEB_SYSTEM" ]; then
|
||||
rm -f /etc/$1/conf.d/domains/$WEBMAIL_ALIAS.$domain.conf
|
||||
ln -s $conf /etc/$1/conf.d/domains/$WEBMAIL_ALIAS.$domain.conf
|
||||
rm -f /etc/$1/$confd/domains/$WEBMAIL_ALIAS.$domain.conf
|
||||
ln -s $conf /etc/$1/$confd/domains/$WEBMAIL_ALIAS.$domain.conf
|
||||
fi
|
||||
if [ -n "$PROXY_SYSTEM" ]; then
|
||||
rm -f /etc/$1/conf.d/domains/$WEBMAIL_ALIAS.$domain.conf
|
||||
ln -s $conf /etc/$1/conf.d/domains/$WEBMAIL_ALIAS.$domain.conf
|
||||
rm -f /etc/$1/$confd/domains/$WEBMAIL_ALIAS.$domain.conf
|
||||
ln -s $conf /etc/$1/$confd/domains/$WEBMAIL_ALIAS.$domain.conf
|
||||
fi
|
||||
# Clear old configurations
|
||||
find $HOMEDIR/$user/conf/mail/ -maxdepth 1 -type f \( -name "$domain.*" \) -exec rm {} \;
|
||||
@@ -918,27 +944,47 @@ add_webmail_config() {
|
||||
|
||||
# Delete webmail support
|
||||
del_webmail_config() {
|
||||
if [ "$WEB_SYSTEM" = "httpd" ]; then
|
||||
confd="conf.h.d"
|
||||
else
|
||||
confd="conf.d"
|
||||
fi
|
||||
if [ "$PROXY_SYSTEM" = "httpd" ]; then
|
||||
pconfd="conf.h.d"
|
||||
else
|
||||
pconfd="conf.d"
|
||||
fi
|
||||
if [ -n "$WEB_SYSTEM" ]; then
|
||||
rm -f $HOMEDIR/$user/conf/mail/$domain/$WEB_SYSTEM.conf
|
||||
rm -f /etc/$WEB_SYSTEM/conf.d/domains/$WEBMAIL_ALIAS.$domain.conf
|
||||
rm -f $HOMEDIR/$user/$confd/mail/$domain/$WEB_SYSTEM.conf
|
||||
rm -f /etc/$WEB_SYSTEM/$confd/domains/$WEBMAIL_ALIAS.$domain.conf
|
||||
fi
|
||||
|
||||
if [ -n "$PROXY_SYSTEM" ]; then
|
||||
rm -f $HOMEDIR/$user/conf/mail/$domain/$PROXY_SYSTEM.*conf
|
||||
rm -f /etc/$PROXY_SYSTEM/conf.d/domains/$WEBMAIL_ALIAS.$domain.conf
|
||||
rm -f /etc/$PROXY_SYSTEM/$pconfd/domains/$WEBMAIL_ALIAS.$domain.conf
|
||||
fi
|
||||
}
|
||||
|
||||
# Delete SSL webmail support
|
||||
del_webmail_ssl_config() {
|
||||
if [ "$WEB_SYSTEM" = "httpd" ]; then
|
||||
confd="conf.h.d"
|
||||
else
|
||||
confd="conf.d"
|
||||
fi
|
||||
if [ "$PROXY_SYSTEM" = "httpd" ]; then
|
||||
pconfd="conf.h.d"
|
||||
else
|
||||
pconfd="conf.d"
|
||||
fi
|
||||
if [ -n "$WEB_SYSTEM" ]; then
|
||||
rm -f $HOMEDIR/$user/conf/mail/$domain/$WEB_SYSTEM.*ssl.conf
|
||||
rm -f /etc/$WEB_SYSTEM/conf.d/domains/$WEBMAIL_ALIAS.$domain.ssl.conf
|
||||
rm -f /etc/$WEB_SYSTEM/$confd/domains/$WEBMAIL_ALIAS.$domain.ssl.conf
|
||||
fi
|
||||
|
||||
if [ -n "$PROXY_SYSTEM" ]; then
|
||||
rm -f $HOMEDIR/$user/conf/mail/$domain/$PROXY_SYSTEM.*ssl.conf
|
||||
rm -f /etc/$PROXY_SYSTEM/conf.d/domains/$WEBMAIL_ALIAS.$domain.ssl.conf
|
||||
rm -f /etc/$PROXY_SYSTEM/$pconfd/domains/$WEBMAIL_ALIAS.$domain.ssl.conf
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user