mirror of
https://github.com/myvesta/vesta
synced 2025-08-14 18:49:21 -07:00
Refactoring stage VI (mail)
This commit is contained in:
parent
fb40168aa3
commit
f2133f9776
34 changed files with 219 additions and 486 deletions
|
@ -68,7 +68,7 @@ increase_dbhost_values
|
|||
increase_user_value "$user" '$U_DATABASES'
|
||||
|
||||
# Adding db to db conf
|
||||
str="DB='$database' DBUSER='$dbuser' HOST='$host' TYPE='$type'"
|
||||
str="DB='$database' DBUSER='$dbuser' MD5='$md5' HOST='$host' TYPE='$type'"
|
||||
str="$str CHARSET='$charset' U_DISK='0' SUSPENDED='no' TIME='$TIME'"
|
||||
str="$str DATE='$DATE'"
|
||||
echo "$str" >> $USER_DATA/db.conf
|
||||
|
|
|
@ -61,6 +61,7 @@ zone="$USER_DATA/dns/$domain.conf"
|
|||
dns_rec="ID='$id' RECORD='$record' TYPE='$rtype' PRIORITY='$priority'"
|
||||
dns_rec="$dns_rec VALUE='$dvalue' SUSPENDED='no' TIME='$TIME' DATE='$DATE'"
|
||||
echo "$dns_rec" >> $zone
|
||||
chmod 660 $zone
|
||||
|
||||
# Sorting records
|
||||
sort_dns_records
|
||||
|
|
|
@ -18,7 +18,7 @@ account=$3
|
|||
password=$4
|
||||
quota=${5-0}
|
||||
|
||||
# Importing variables
|
||||
# Includes
|
||||
source $VESTA/conf/vesta.conf
|
||||
source $VESTA/func/shared.sh
|
||||
source $VESTA/func/domain.sh
|
||||
|
@ -28,39 +28,22 @@ source $VESTA/func/domain.sh
|
|||
# Verifications #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Checking arg number
|
||||
check_args '4' "$#" 'user domain account password quota'
|
||||
|
||||
# Checking argument format
|
||||
check_args '4' "$#" 'user domain account password [quota]'
|
||||
validate_format 'user' 'domain' 'account' 'password' 'quota'
|
||||
|
||||
# Checking dns system is enabled
|
||||
is_system_enabled 'MAIL_SYSTEM'
|
||||
|
||||
# Checking user
|
||||
is_system_enabled "$MAIL_SYSTEM"
|
||||
is_object_valid 'user' 'USER' "$user"
|
||||
|
||||
# Checking user is active
|
||||
is_object_unsuspended 'user' 'USER' "$user"
|
||||
|
||||
# Checking domain
|
||||
is_domain_valid 'mail'
|
||||
|
||||
# Checking domain is not suspened
|
||||
is_domain_suspended 'mail'
|
||||
|
||||
# Checking package
|
||||
is_object_valid 'mail' 'DOMAIN' "$domain"
|
||||
is_object_unsuspended 'mail' 'DOMAIN' "$domain"
|
||||
is_package_full 'MAIL_ACCOUNTS'
|
||||
|
||||
# Checking account
|
||||
is_mail_account_free
|
||||
is_mail_new "$account"
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Action #
|
||||
#----------------------------------------------------------#
|
||||
password=$(/usr/sbin/dovecotpw -s md5 -p "$password")
|
||||
str="$account:$password:$user:mail::$HOMEDIR/$user:$quota"
|
||||
md5=$(/usr/sbin/dovecotpw -s md5 -p "$password")
|
||||
str="$account:$md5:$user:mail::$HOMEDIR/$user:$quota"
|
||||
echo $str >> $HOMEDIR/$user/conf/mail/$domain/passwd
|
||||
|
||||
|
||||
|
@ -69,17 +52,21 @@ echo $str >> $HOMEDIR/$user/conf/mail/$domain/passwd
|
|||
#----------------------------------------------------------#
|
||||
|
||||
str="ACCOUNT='$account' ALIAS='' QUOTA='$quota' AUTOREPLY='no' FWD=''"
|
||||
str="$str U_DISK='0' SUSPENDED='no' DATE='$DATE'"
|
||||
str="$str MD5='$md5' U_DISK='0' SUSPENDED='no' TIME='$TIME' DATE='$DATE'"
|
||||
echo "$str" >> $USER_DATA/mail/$domain.conf
|
||||
chmod 660 $USER_DATA/mail/$domain.conf
|
||||
|
||||
# Increase mail accounts counter
|
||||
accounts=$(wc -l $USER_DATA/mail/$domain.conf|cut -f 1 -d ' ')
|
||||
accounts=$(wc -l $USER_DATA/mail/$domain.conf | cut -f 1 -d ' ')
|
||||
increase_user_value "$user" '$U_MAIL_ACCOUNTS'
|
||||
update_domain_value 'mail' '$ACCOUNTS' "$accounts"
|
||||
update_object_value 'mail' 'DOMAIN' "$domain" '$ACCOUNTS' "$accounts"
|
||||
|
||||
# Hiding password
|
||||
EVENT="DATE='$DATE' TIME='$TIME' COMMAND='$SCRIPT'"
|
||||
EVENT="$EVENT ARGUMENTS='$user $domain ***** $quota'"
|
||||
|
||||
# Logging
|
||||
EVENT="$DATE $SCRIPT $user $domain ***** $quota"
|
||||
log_history "$EVENT" "v_delete_mail_account $user $domain $account"
|
||||
log_history "$EVENT"
|
||||
log_event "$OK" "$EVENT"
|
||||
|
||||
exit
|
||||
|
|
|
@ -17,7 +17,7 @@ domain_idn=$(idn -t --quiet -a "$domain")
|
|||
account=$3
|
||||
malias=$4
|
||||
|
||||
# Importing variables
|
||||
# Includes
|
||||
source $VESTA/conf/vesta.conf
|
||||
source $VESTA/func/shared.sh
|
||||
source $VESTA/func/domain.sh
|
||||
|
@ -27,32 +27,16 @@ source $VESTA/func/domain.sh
|
|||
# Verifications #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Checking arg number
|
||||
check_args '4' "$#" 'user domain account alias'
|
||||
|
||||
# Checking argument format
|
||||
validate_format 'user' 'domain' 'account' 'malias'
|
||||
|
||||
# Checking dns system is enabled
|
||||
is_system_enabled 'MAIL_SYSTEM'
|
||||
|
||||
# Checking user
|
||||
is_system_enabled "$MAIL_SYSTEM"
|
||||
is_object_valid 'user' 'USER' "$user"
|
||||
|
||||
# Checking user is active
|
||||
is_object_unsuspended 'user' 'USER' "$user"
|
||||
|
||||
# Checking domain
|
||||
is_domain_valid 'mail'
|
||||
|
||||
# Checking domain is not suspened
|
||||
is_domain_suspended 'mail'
|
||||
|
||||
# Checking account
|
||||
is_mail_account_valid
|
||||
|
||||
# Checking account
|
||||
is_mail_account_free "$malias"
|
||||
is_object_valid 'mail' 'DOMAIN' "$domain"
|
||||
is_object_unsuspended 'mail' 'DOMAIN' "$domain"
|
||||
is_object_valid "mail/$domain" 'ACCOUNT' "$account"
|
||||
is_object_unsuspended "mail/$domain" 'ACCOUNT' "$account"
|
||||
is_mail_new "$malias"
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
|
@ -60,7 +44,7 @@ is_mail_account_free "$malias"
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# Adding exim alias
|
||||
str="$mailas@$domain:$account@$domain"
|
||||
str="$malias@$domain:$account@$domain"
|
||||
echo "$str" >> $HOMEDIR/$user/conf/mail/$domain/aliases
|
||||
|
||||
|
||||
|
@ -69,17 +53,16 @@ echo "$str" >> $HOMEDIR/$user/conf/mail/$domain/aliases
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# Adding vesta alias
|
||||
aliases=$(get_domain_value "mail/$domain" '$ALIAS' "ACCOUNT='$account'")
|
||||
aliases=$(get_object_value "mail/$domain" 'ACCOUNT' "$account" '$ALIAS')
|
||||
if [ -z "$aliases" ]; then
|
||||
aliases="$malias"
|
||||
else
|
||||
aliases="$aliases,$malias"
|
||||
fi
|
||||
update_domain_value "mail/$domain" '$ALIAS' "$aliases" "ACCOUNT='$account'"
|
||||
update_object_value "mail/$domain" 'ACCOUNT' "$account" '$ALIAS' "$aliases"
|
||||
|
||||
# Logging
|
||||
cmd='v_delete_mail_account_alias'
|
||||
log_history "$EVENT" "$cmd $user $domain $account $malias"
|
||||
log_history "$EVENT"
|
||||
log_event "$OK" "$EVENT"
|
||||
|
||||
exit
|
||||
|
|
|
@ -15,9 +15,9 @@ domain=$(idn -t --quiet -u "$2" )
|
|||
domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
|
||||
domain_idn=$(idn -t --quiet -a "$domain")
|
||||
account=$3
|
||||
malias=$4
|
||||
autoreply=$4
|
||||
|
||||
# Importing variables
|
||||
# Includes
|
||||
source $VESTA/conf/vesta.conf
|
||||
source $VESTA/func/shared.sh
|
||||
source $VESTA/func/domain.sh
|
||||
|
@ -26,25 +26,26 @@ source $VESTA/func/domain.sh
|
|||
#----------------------------------------------------------#
|
||||
# Verifications #
|
||||
#----------------------------------------------------------#
|
||||
check_args '4' "$#" 'user domain account alias'
|
||||
validate_format 'user' 'domain' 'account' 'malias'
|
||||
is_system_enabled 'MAIL_SYSTEM'
|
||||
|
||||
check_args '4' "$#" 'user domain account autoreply'
|
||||
validate_format 'user' 'domain' 'account' 'autoreply'
|
||||
is_system_enabled "$MAIL_SYSTEM"
|
||||
is_object_valid 'user' 'USER' "$user"
|
||||
is_object_unsuspended 'user' 'USER' "$user"
|
||||
is_object_valid 'mail' 'DOMAIN' "$domain"
|
||||
is_object_unsuspended 'mail' 'DOMAIN' "$domain"
|
||||
is_object_valid "mail/$domain" 'ACCOUNT' "$account"
|
||||
is_object_unsuspended "mail/$domain" 'ACCOUNT' "$account"
|
||||
is_key_empty "mail/$domain" '' '$AUTOREPLY'
|
||||
exit
|
||||
is_object_value_empty "mail/$domain" 'ACCOUNT' "$domain" '$AUTOREPLY'
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Action #
|
||||
#----------------------------------------------------------#
|
||||
exit
|
||||
# Adding exim alias
|
||||
str="$mailas@$domain:$account@$domain"
|
||||
echo "$str" >> $HOMEDIR/$user/conf/mail/$domain/aliases
|
||||
# Add exim autoreply
|
||||
echo -e "$autoreply" > $HOMEDIR/$user/conf/mail/$domain/autoreply.$account.msg
|
||||
chown -R root:mail $HOMEDIR/$user/conf/mail/$domain/autoreply.$account.msg
|
||||
chmod 660 $HOMEDIR/$user/conf/mail/$domain/autoreply.$account.msg
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
|
@ -52,17 +53,12 @@ echo "$str" >> $HOMEDIR/$user/conf/mail/$domain/aliases
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# Adding vesta alias
|
||||
aliases=$(get_domain_value "mail/$domain" '$ALIAS' "ACCOUNT='$account'")
|
||||
if [ -z "$aliases" ]; then
|
||||
aliases="$malias"
|
||||
else
|
||||
aliases="$aliases,$malias"
|
||||
fi
|
||||
update_domain_value "mail/$domain" '$ALIAS' "$aliases" "ACCOUNT='$account'"
|
||||
echo -e "$autoreply" > $USER_DATA/mail/$account@$domain.msg
|
||||
chmod 660 $USER_DATA/mail/$account@$domain.msg
|
||||
update_object_value "mail/$domain" 'ACCOUNT' "$domain" '$AUTOREPLY' 'yes'
|
||||
|
||||
# Logging
|
||||
cmd='v_delete_mail_account_alias'
|
||||
log_history "$EVENT" "$cmd $user $domain $account $malias"
|
||||
log_history "$EVENT"
|
||||
log_event "$OK" "$EVENT"
|
||||
|
||||
exit
|
||||
|
|
|
@ -19,7 +19,7 @@ antivirus=${4-yes}
|
|||
dkim=${5-yes}
|
||||
dkim_size=${6-512}
|
||||
|
||||
# Importing variables
|
||||
# Includes
|
||||
source $VESTA/conf/vesta.conf
|
||||
source $VESTA/func/shared.sh
|
||||
source $VESTA/func/domain.sh
|
||||
|
@ -29,25 +29,12 @@ source $VESTA/func/domain.sh
|
|||
# Verifications #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Checking arg number
|
||||
check_args '2' "$#" 'user domain [antispam] [antivirus] [dkim] [dkim_size]'
|
||||
|
||||
# Checking argument format
|
||||
validate_format 'user' 'domain' 'antispam' 'antivirus' 'dkim' 'dkim_size'
|
||||
|
||||
# Checking dns system is enabled
|
||||
is_system_enabled 'MAIL_SYSTEM'
|
||||
|
||||
# Checking user
|
||||
is_system_enabled "$MAIL_SYSTEM"
|
||||
is_object_valid 'user' 'USER' "$user"
|
||||
|
||||
# Checking user is active
|
||||
is_object_unsuspended 'user' 'USER' "$user"
|
||||
|
||||
# Checking domain
|
||||
is_domain_new 'mail'
|
||||
|
||||
# Checking package
|
||||
is_package_full 'MAIL_DOMAINS'
|
||||
|
||||
|
||||
|
@ -92,7 +79,7 @@ if [ "$dkim" = 'yes' ]; then
|
|||
chmod 660 $HOMEDIR/$user/conf/mail/$domain/dkim.pem
|
||||
|
||||
# Adding dkim dns records
|
||||
check_dns_domain=$(is_domain_valid 'dns')
|
||||
check_dns_domain=$(is_object_valid 'dns' 'DOMAIN' "$domain")
|
||||
if [ "$?" -eq 0 ]; then
|
||||
p=$(cat $USER_DATA/mail/$domain.pub|grep -v ' KEY---'|tr -d '\n')
|
||||
record='_domainkey'
|
||||
|
@ -107,7 +94,9 @@ fi
|
|||
|
||||
# Adding domain to vesta db
|
||||
s="DOMAIN='$domain' ANTIVIRUS='$antivirus' ANTISPAM='$antispam' DKIM='$dkim'"
|
||||
s="$s ACCOUNTS='0' U_DISK='0' CATCHALL='' SUSPENDED='no' DATE='$DATE'"
|
||||
s="$s ACCOUNTS='0' U_DISK='0' CATCHALL='' SUSPENDED='no' TIME='$TIME'"
|
||||
s="$s DATE='$DATE'"
|
||||
|
||||
echo $s >> $USER_DATA/mail.conf
|
||||
touch $USER_DATA/mail/$domain.conf
|
||||
chmod 660 $USER_DATA/mail.conf
|
||||
|
@ -122,7 +111,7 @@ chmod 660 $USER_DATA/mail/$domain.conf
|
|||
increase_user_value "$user" '$U_MAIL_DOMAINS'
|
||||
|
||||
# Logging
|
||||
log_history "$EVENT" "v_delete_mail_domain $user $domain"
|
||||
log_history "$EVENT"
|
||||
log_event "$OK" "$EVENT"
|
||||
|
||||
exit
|
||||
|
|
|
@ -15,7 +15,7 @@ domain=$(idn -t --quiet -u "$2" )
|
|||
domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
|
||||
domain_idn=$(idn -t --quiet -a "$domain")
|
||||
|
||||
# Importing variables
|
||||
# Includes
|
||||
source $VESTA/conf/vesta.conf
|
||||
source $VESTA/func/shared.sh
|
||||
source $VESTA/func/domain.sh
|
||||
|
@ -25,29 +25,14 @@ source $VESTA/func/domain.sh
|
|||
# Verifications #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Checking arg number
|
||||
check_args '2' "$#" 'user domain'
|
||||
|
||||
# Checking argument format
|
||||
validate_format 'user' 'domain'
|
||||
|
||||
# Checking dns system is enabled
|
||||
is_system_enabled 'MAIL_SYSTEM'
|
||||
|
||||
# Checking user
|
||||
is_system_enabled "$MAIL_SYSTEM"
|
||||
is_object_valid 'user' 'USER' "$user"
|
||||
|
||||
# Checking user is active
|
||||
is_object_unsuspended 'user' 'USER' "$user"
|
||||
|
||||
# Checking domain
|
||||
is_domain_valid 'mail'
|
||||
|
||||
# Checking domain is not suspened
|
||||
is_domain_suspended 'mail'
|
||||
|
||||
# Checking errorlog is not added
|
||||
is_domain_key_empty 'mail' '$ANTISPAM'
|
||||
is_object_valid 'mail' 'DOMAIN' "$domain"
|
||||
is_object_unsuspended 'mail' 'DOMAIN' "$domain"
|
||||
is_object_value_empty 'mail' 'DOMAIN' "$domain" '$ANTISPAM'
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
|
@ -55,7 +40,7 @@ is_domain_key_empty 'mail' '$ANTISPAM'
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# Adding antispam key to config
|
||||
if [ -z "$(grep 'antispam' $HOMEDIR/$user/conf/mail/$domain/protection)" ]; then
|
||||
if [ -z "$(grep spam $HOMEDIR/$user/conf/mail/$domain/protection)" ]; then
|
||||
echo 'antispam' >> $HOMEDIR/$user/conf/mail/$domain/protection
|
||||
fi
|
||||
|
||||
|
@ -64,10 +49,10 @@ fi
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# Adding antispam in config
|
||||
update_domain_value 'mail' '$ANTISPAM' 'yes'
|
||||
update_object_value 'mail' 'DOMAIN' "$domain" '$ANTISPAM' 'yes'
|
||||
|
||||
# Logging
|
||||
log_history "$EVENT" "v_delete_mail_domain_antispam $user $domain"
|
||||
log_history "$EVENT"
|
||||
log_event "$OK" "$EVENT"
|
||||
|
||||
exit
|
||||
|
|
|
@ -15,7 +15,7 @@ domain=$(idn -t --quiet -u "$2" )
|
|||
domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
|
||||
domain_idn=$(idn -t --quiet -a "$domain")
|
||||
|
||||
# Importing variables
|
||||
# Includes
|
||||
source $VESTA/conf/vesta.conf
|
||||
source $VESTA/func/shared.sh
|
||||
source $VESTA/func/domain.sh
|
||||
|
@ -25,29 +25,14 @@ source $VESTA/func/domain.sh
|
|||
# Verifications #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Checking arg number
|
||||
check_args '2' "$#" 'user domain'
|
||||
|
||||
# Checking argument format
|
||||
validate_format 'user' 'domain'
|
||||
|
||||
# Checking dns system is enabled
|
||||
is_system_enabled 'MAIL_SYSTEM'
|
||||
|
||||
# Checking user
|
||||
is_system_enabled "$MAIL_SYSTEM"
|
||||
is_object_valid 'user' 'USER' "$user"
|
||||
|
||||
# Checking user is active
|
||||
is_object_unsuspended 'user' 'USER' "$user"
|
||||
|
||||
# Checking domain
|
||||
is_domain_valid 'mail'
|
||||
|
||||
# Checking domain is not suspened
|
||||
is_domain_suspended 'mail'
|
||||
|
||||
# Checking current value
|
||||
is_domain_key_empty 'mail' '$ANTIVIRUS'
|
||||
is_object_valid 'mail' 'DOMAIN' "$domain"
|
||||
is_object_unsuspended 'mail' 'DOMAIN' "$domain"
|
||||
is_object_value_empty 'mail' 'DOMAIN' "$domain" '$ANTIVIRUS'
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
|
@ -59,15 +44,16 @@ if [ -z "$(grep 'virus' $HOMEDIR/$user/conf/mail/$domain/protection)" ]; then
|
|||
echo 'antivirus' >> $HOMEDIR/$user/conf/mail/$domain/protection
|
||||
fi
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Vesta #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Adding antivirus in config
|
||||
update_domain_value 'mail' '$ANTIVIRUS' 'yes'
|
||||
update_object_value 'mail' 'DOMAIN' "$domain" '$ANTIVIRUS' 'yes'
|
||||
|
||||
# Logging
|
||||
log_history "$EVENT" "v_delete_mail_domain_antivirus $user $domain"
|
||||
log_history "$EVENT"
|
||||
log_event "$OK" "$EVENT"
|
||||
|
||||
exit
|
||||
|
|
|
@ -16,7 +16,7 @@ domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
|
|||
domain_idn=$(idn -t --quiet -a "$domain")
|
||||
email="$3"
|
||||
|
||||
# Importing variables
|
||||
# Includes
|
||||
source $VESTA/conf/vesta.conf
|
||||
source $VESTA/func/shared.sh
|
||||
source $VESTA/func/domain.sh
|
||||
|
@ -26,29 +26,14 @@ source $VESTA/func/domain.sh
|
|||
# Verifications #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Checking arg number
|
||||
check_args '3' "$#" 'user domain email'
|
||||
|
||||
# Checking argument format
|
||||
validate_format 'user' 'domain' 'email'
|
||||
|
||||
# Checking dns system is enabled
|
||||
is_system_enabled 'MAIL_SYSTEM'
|
||||
|
||||
# Checking user
|
||||
is_system_enabled "$MAIL_SYSTEM"
|
||||
is_object_valid 'user' 'USER' "$user"
|
||||
|
||||
# Checking user is active
|
||||
is_object_unsuspended 'user' 'USER' "$user"
|
||||
|
||||
# Checking domain
|
||||
is_domain_valid 'mail'
|
||||
|
||||
# Checking domain is not suspened
|
||||
is_domain_suspended 'mail'
|
||||
|
||||
# Checking errorlog is not added
|
||||
is_domain_key_empty 'mail' '$CATCHALL'
|
||||
is_object_valid 'mail' 'DOMAIN' "$domain"
|
||||
is_object_unsuspended 'mail' 'DOMAIN' "$domain"
|
||||
is_object_value_empty 'mail' 'DOMAIN' "$domain" '$CATCHALL'
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
|
@ -56,8 +41,8 @@ is_domain_key_empty 'mail' '$CATCHALL'
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# Adding catchall alias
|
||||
sed -i "/*@demo.vestacp.com:/d" $HOMEDIR/$user/conf/mail/$domain/aliases
|
||||
echo "*@demo.vestacp.com:$email" >> $HOMEDIR/$user/conf/mail/$domain/aliases
|
||||
sed -i "/*@$domain:/d" $HOMEDIR/$user/conf/mail/$domain/aliases
|
||||
echo "*@$domain:$email" >> $HOMEDIR/$user/conf/mail/$domain/aliases
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
|
@ -65,10 +50,11 @@ echo "*@demo.vestacp.com:$email" >> $HOMEDIR/$user/conf/mail/$domain/aliases
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# Adding antispam in config
|
||||
update_domain_value 'mail' '$CATCHALL' "$email"
|
||||
update_object_value 'mail' 'DOMAIN' "$domain" '$CATCHALL' "$email"
|
||||
|
||||
|
||||
# Logging
|
||||
log_history "$EVENT" "v_delete_mail_domain_catchall $user $domain"
|
||||
log_history "$EVENT"
|
||||
log_event "$OK" "$EVENT"
|
||||
|
||||
exit
|
||||
|
|
|
@ -16,7 +16,7 @@ domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
|
|||
domain_idn=$(idn -t --quiet -a "$domain")
|
||||
dkim_size=${3-512}
|
||||
|
||||
# Importing variables
|
||||
# Includes
|
||||
source $VESTA/conf/vesta.conf
|
||||
source $VESTA/func/shared.sh
|
||||
source $VESTA/func/domain.sh
|
||||
|
@ -26,29 +26,14 @@ source $VESTA/func/domain.sh
|
|||
# Verifications #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Checking arg number
|
||||
check_args '2' "$#" 'user domain [dkim_size]'
|
||||
|
||||
# Checking argument format
|
||||
validate_format 'user' 'domain' 'dkim_size'
|
||||
|
||||
# Checking dns system is enabled
|
||||
is_system_enabled 'MAIL_SYSTEM'
|
||||
|
||||
# Checking user
|
||||
is_system_enabled "$MAIL_SYSTEM"
|
||||
is_object_valid 'user' 'USER' "$user"
|
||||
|
||||
# Checking user is active
|
||||
is_object_unsuspended 'user' 'USER' "$user"
|
||||
|
||||
# Checking domain
|
||||
is_domain_valid 'mail'
|
||||
|
||||
# Checking domain is not suspened
|
||||
is_domain_suspended 'mail'
|
||||
|
||||
# Checking errorlog is not added
|
||||
is_domain_key_empty 'mail' '$DKIM'
|
||||
is_object_valid 'mail' 'DOMAIN' "$domain"
|
||||
is_object_unsuspended 'mail' 'DOMAIN' "$domain"
|
||||
is_object_value_empty 'mail' 'DOMAIN' "$domain" '$DKIM'
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
|
@ -67,7 +52,7 @@ chown root:mail $HOMEDIR/$user/conf/mail/$domain/dkim.pem
|
|||
chmod 660 $HOMEDIR/$user/conf/mail/$domain/dkim.pem
|
||||
|
||||
# Checking dns domain
|
||||
check_dns_domain=$(is_domain_valid 'dns')
|
||||
check_dns_domain=$(is_object_valid 'dns' 'DOMAIN' "$domain")
|
||||
if [ "$?" -eq 0 ]; then
|
||||
# Adding dkim dns records
|
||||
p=$(cat $USER_DATA/mail/$domain.pub|grep -v ' KEY---'|tr -d '\n')
|
||||
|
@ -86,10 +71,10 @@ fi
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# Adding dkim in config
|
||||
update_domain_value 'mail' '$DKIM' 'yes'
|
||||
update_object_value 'mail' 'DOMAIN' "$domain" '$DKIM' 'yes'
|
||||
|
||||
# Logging
|
||||
log_history "$EVENT" "v_delete_mail_domain_dkim $user $domain"
|
||||
log_history "$EVENT"
|
||||
log_event "$OK" "$EVENT"
|
||||
|
||||
exit
|
||||
|
|
|
@ -172,6 +172,7 @@ PACKAGE='$package'
|
|||
$package_data
|
||||
CONTACT='$email'
|
||||
CRON_REPORTS='yes'
|
||||
MD5='$(awk -v user=$user -F : 'user == $1 {print $2}' /etc/shadow)'
|
||||
RKEY='$(gen_password)'
|
||||
SUSPENDED='no'
|
||||
SUSPENDED_USERS='0'
|
||||
|
|
|
@ -182,8 +182,8 @@ increase_user_value "$user" '$U_WEB_ALIASES'
|
|||
# Defining domain variables
|
||||
str="DOMAIN='$domain' IP='$ip' IP6='' ALIAS='$aliases' TPL='$template'"
|
||||
str="$str $template_data SSL='no' SSL_HOME='single' NGINX='' NGINX_EXT=''"
|
||||
str="$str STATS='' STATS_USER='' U_DISK='0' U_BANDWIDTH='0' SUSPENDED='no'"
|
||||
str="$str TIME='$TIME' DATE='$DATE'"
|
||||
str="$str STATS='' STATS_USER='' STATS_CRYPT='' U_DISK='0' U_BANDWIDTH='0'"
|
||||
str="$str SUSPENDED='no' TIME='$TIME' DATE='$DATE'"
|
||||
|
||||
# Registering domain
|
||||
echo "$str" >> $USER_DATA/web.conf
|
||||
|
|
|
@ -32,7 +32,7 @@ is_object_valid 'user' 'USER' "$user"
|
|||
is_object_unsuspended 'user' 'USER' "$user"
|
||||
is_object_valid 'web' 'DOMAIN' "$domain"
|
||||
is_object_unsuspended 'web' 'DOMAIN' "$domain"
|
||||
is_object_value_empty 'web' 'DOMAIN' "$domain" '$STATS_USER'
|
||||
is_object_value_exist 'web' 'DOMAIN' "$domain" '$STATS'
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
|
@ -52,7 +52,7 @@ Require valid-user" > $stats_dir/.htaccess
|
|||
# Generating htaccess user and password
|
||||
rm -f $stats_dir/.htpasswd
|
||||
htpasswd -bc $stats_dir/.htpasswd "$stats_user" "$stats_pass" &>/dev/null
|
||||
|
||||
stats_crypt=$(grep $stats_user: $stats_dir/.htpasswd |cut -f 2 -d :)
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Vesta #
|
||||
|
@ -60,6 +60,7 @@ htpasswd -bc $stats_dir/.htpasswd "$stats_user" "$stats_pass" &>/dev/null
|
|||
|
||||
# Adding stats user in config
|
||||
update_object_value 'web' 'DOMAIN' "$domain" '$STATS_USER' "$stats_user"
|
||||
update_object_value 'web' 'DOMAIN' "$domain" '$STATS_CRYPT' "$stats_crypt"
|
||||
|
||||
# Hiding password
|
||||
EVENT="DATE='$DATE' TIME='$TIME' COMMAND='$SCRIPT'"
|
||||
|
|
|
@ -50,6 +50,9 @@ esac
|
|||
# Vesta #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Update config value
|
||||
update_object_value 'db' 'DB' "$database" '$MD5' "$md5"
|
||||
|
||||
# Hiding password
|
||||
EVENT="DATE='$DATE' TIME='$TIME' COMMAND='$SCRIPT'"
|
||||
EVENT="$EVENT ARGUMENTS='$user $database *****'"
|
||||
|
|
|
@ -16,7 +16,7 @@ domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
|
|||
domain_idn=$(idn -t --quiet -a "$domain")
|
||||
email="$3"
|
||||
|
||||
# Importing variables
|
||||
# Includes
|
||||
source $VESTA/conf/vesta.conf
|
||||
source $VESTA/func/shared.sh
|
||||
source $VESTA/func/domain.sh
|
||||
|
@ -26,38 +26,22 @@ source $VESTA/func/domain.sh
|
|||
# Verifications #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Checking arg number
|
||||
check_args '3' "$#" 'user domain email'
|
||||
|
||||
# Checking argument format
|
||||
validate_format 'user' 'domain' 'email'
|
||||
|
||||
# Checking dns system is enabled
|
||||
is_system_enabled 'MAIL_SYSTEM'
|
||||
|
||||
# Checking user
|
||||
is_system_enabled "$MAIL_SYSTEM"
|
||||
is_object_valid 'user' 'USER' "$user"
|
||||
|
||||
# Checking user is active
|
||||
is_object_unsuspended 'user' 'USER' "$user"
|
||||
|
||||
# Checking domain
|
||||
is_domain_valid 'mail'
|
||||
|
||||
# Checking domain is not suspened
|
||||
is_domain_suspended 'mail'
|
||||
is_object_valid 'mail' 'DOMAIN' "$domain"
|
||||
is_object_unsuspended 'mail' 'DOMAIN' "$domain"
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Action #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Get old catchall
|
||||
catchall=$(get_domain_value 'mail' '$CATCHALL')
|
||||
|
||||
# Change cathcall alias
|
||||
sed -i "/*@demo.vestacp.com:/d" $HOMEDIR/$user/conf/mail/$domain/aliases
|
||||
echo "*@demo.vestacp.com:$email" >> $HOMEDIR/$user/conf/mail/$domain/aliases
|
||||
sed -i "/*@$domain:/d" $HOMEDIR/$user/conf/mail/$domain/aliases
|
||||
echo "*@$domain:$email" >> $HOMEDIR/$user/conf/mail/$domain/aliases
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
|
@ -65,10 +49,11 @@ echo "*@demo.vestacp.com:$email" >> $HOMEDIR/$user/conf/mail/$domain/aliases
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# Change catchall in config
|
||||
update_domain_value 'mail' '$CATCHALL' "$email"
|
||||
update_object_value 'mail' 'DOMAIN' "$domain" '$CATCHALL' "$email"
|
||||
|
||||
|
||||
# Logging
|
||||
log_history "$EVENT" "v_change_mail_domain_catchall $user $domain $catchall"
|
||||
log_history "$EVENT"
|
||||
log_event "$OK" "$EVENT"
|
||||
|
||||
exit
|
||||
|
|
|
@ -75,6 +75,7 @@ SHELL='$SHELL'
|
|||
BACKUPS='$BACKUPS'
|
||||
CONTACT='$CONTACT'
|
||||
CRON_REPORTS='$CRON_REPORTS'
|
||||
MD5='$MD5'
|
||||
RKEY='$RKEY'
|
||||
SUSPENDED='$SUSPENDED'
|
||||
SUSPENDED_USERS='$SUSPENDED_USERS'
|
||||
|
|
|
@ -34,6 +34,7 @@ is_object_unsuspended 'user' 'USER' "$user"
|
|||
|
||||
# Changing user password
|
||||
echo "$password" | /usr/bin/passwd "$user" --stdin &>/dev/null
|
||||
md5=$(awk -v user=$user -F : 'user == $1 {print $2}' /etc/shadow)
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
|
@ -42,6 +43,7 @@ echo "$password" | /usr/bin/passwd "$user" --stdin &>/dev/null
|
|||
|
||||
# Changing RKEY value
|
||||
update_user_value "$user" '$RKEY' "$(gen_password)"
|
||||
update_user_value "$user" '$MD5' "$md5"
|
||||
|
||||
# Hiding password
|
||||
EVENT="DATE='$DATE' TIME='$TIME' COMMAND='$SCRIPT' ARGUMENTS='$user *****'"
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
user=$1
|
||||
domain=$(idn -t --quiet -u "$2" )
|
||||
|
||||
# Importing variables
|
||||
# Includes
|
||||
source $VESTA/conf/vesta.conf
|
||||
source $VESTA/func/shared.sh
|
||||
source $VESTA/func/domain.sh
|
||||
|
@ -24,23 +24,13 @@ source $VESTA/func/domain.sh
|
|||
# Verifications #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Checking arg number
|
||||
check_args '2' "$#" 'user domain'
|
||||
|
||||
# Checking argument format
|
||||
validate_format 'user' 'domain'
|
||||
|
||||
# Checking web system is enabled
|
||||
is_system_enabled 'MAIL_SYSTEM'
|
||||
|
||||
# Checking user
|
||||
is_system_enabled "$MAIL_SYSTEM"
|
||||
is_object_valid 'user' 'USER' "$user"
|
||||
|
||||
# Checking user is active
|
||||
is_object_unsuspended 'user' 'USER' "$user"
|
||||
|
||||
# Checking domain exist
|
||||
is_domain_valid 'mail'
|
||||
is_object_valid 'mail' 'DOMAIN' "$domain"
|
||||
is_object_unsuspended 'mail' 'DOMAIN' "$domain"
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
|
@ -65,15 +55,14 @@ sed -i "/DOMAIN='$domain'/ d" $USER_DATA/mail.conf
|
|||
rm -f $USER_DATA/mail/$domain.conf
|
||||
rm -f $USER_DATA/mail/$domain.pem
|
||||
rm -f $USER_DATA/mail/$domain.pub
|
||||
# autoreply
|
||||
rm -f $USER_DATA/mail/*@$domain.msg
|
||||
|
||||
# Decreasing domain value
|
||||
decrease_user_value "$user" '$U_MAIL_DOMAINS'
|
||||
decrease_user_value "$user" '$U_MAIL_ACCOUNTS' "$accounts"
|
||||
|
||||
# Logging
|
||||
cmd='"v_add_mail_domain'
|
||||
log_history "$EVENT" "$cmd $user $domain $ANTISPAM $ANTIVIRUS $DKIM"
|
||||
log_history "$EVENT"
|
||||
log_event "$OK" "$EVENT"
|
||||
|
||||
exit
|
||||
|
|
|
@ -15,7 +15,7 @@ domain=$(idn -t --quiet -u "$2" )
|
|||
domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
|
||||
domain_idn=$(idn -t --quiet -a "$domain")
|
||||
|
||||
# Importing variables
|
||||
# Includes
|
||||
source $VESTA/conf/vesta.conf
|
||||
source $VESTA/func/shared.sh
|
||||
source $VESTA/func/domain.sh
|
||||
|
@ -25,29 +25,14 @@ source $VESTA/func/domain.sh
|
|||
# Verifications #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Checking arg number
|
||||
check_args '2' "$#" 'user domain'
|
||||
|
||||
# Checking argument format
|
||||
validate_format 'user' 'domain'
|
||||
|
||||
# Checking dns system is enabled
|
||||
is_system_enabled 'MAIL_SYSTEM'
|
||||
|
||||
# Checking user
|
||||
is_system_enabled "$MAIL_SYSTEM"
|
||||
is_object_valid 'user' 'USER' "$user"
|
||||
|
||||
# Checking user is active
|
||||
is_object_unsuspended 'user' 'USER' "$user"
|
||||
|
||||
# Checking domain
|
||||
is_domain_valid 'mail'
|
||||
|
||||
# Checking domain is not suspened
|
||||
is_domain_suspended 'mail'
|
||||
|
||||
# Checking current value
|
||||
is_domain_value_exist 'mail' '$ANTISPAM'
|
||||
is_object_valid 'mail' 'DOMAIN' "$domain"
|
||||
is_object_unsuspended 'mail' 'DOMAIN' "$domain"
|
||||
is_object_value_exist 'mail' 'DOMAIN' "$domain" '$ANTISPAM'
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
|
@ -63,10 +48,10 @@ sed -i "/antispam/d" $HOMEDIR/$user/conf/mail/$domain/protection
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# Delete antispam in config
|
||||
update_domain_value 'mail' '$ANTISPAM' 'no'
|
||||
update_object_value 'mail' 'DOMAIN' "$domain" '$ANTISPAM' 'no'
|
||||
|
||||
# Logging
|
||||
log_history "$EVENT" "v_add_mail_domain_antispam $user $domain"
|
||||
log_history "$EVENT"
|
||||
log_event "$OK" "$EVENT"
|
||||
|
||||
exit
|
||||
|
|
|
@ -15,7 +15,7 @@ domain=$(idn -t --quiet -u "$2" )
|
|||
domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
|
||||
domain_idn=$(idn -t --quiet -a "$domain")
|
||||
|
||||
# Importing variables
|
||||
# Includes
|
||||
source $VESTA/conf/vesta.conf
|
||||
source $VESTA/func/shared.sh
|
||||
source $VESTA/func/domain.sh
|
||||
|
@ -25,29 +25,14 @@ source $VESTA/func/domain.sh
|
|||
# Verifications #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Checking arg number
|
||||
check_args '2' "$#" 'user domain'
|
||||
|
||||
# Checking argument format
|
||||
validate_format 'user' 'domain'
|
||||
|
||||
# Checking dns system is enabled
|
||||
is_system_enabled 'MAIL_SYSTEM'
|
||||
|
||||
# Checking user
|
||||
is_system_enabled "$MAIL_SYSTEM"
|
||||
is_object_valid 'user' 'USER' "$user"
|
||||
|
||||
# Checking user is active
|
||||
is_object_unsuspended 'user' 'USER' "$user"
|
||||
|
||||
# Checking domain
|
||||
is_domain_valid 'mail'
|
||||
|
||||
# Checking domain is not suspened
|
||||
is_domain_suspended 'mail'
|
||||
|
||||
# Checking current value
|
||||
is_domain_value_exist 'mail' '$ANTIVIRUS'
|
||||
is_object_valid 'mail' 'DOMAIN' "$domain"
|
||||
is_object_unsuspended 'mail' 'DOMAIN' "$domain"
|
||||
is_object_value_exist 'mail' 'DOMAIN' "$domain" '$ANTIVIRUS'
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
|
@ -63,10 +48,10 @@ sed -i "/antivirus/d" $HOMEDIR/$user/conf/mail/$domain/protection
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# Delete antivirus in config
|
||||
update_domain_value 'mail' '$ANTIVIRUS' 'no'
|
||||
update_object_value 'mail' 'DOMAIN' "$domain" '$ANTIVIRUS' 'no'
|
||||
|
||||
# Logging
|
||||
log_history "$EVENT" "v_add_mail_domain_antivirus $user $domain"
|
||||
log_history "$EVENT"
|
||||
log_event "$OK" "$EVENT"
|
||||
|
||||
exit
|
||||
|
|
|
@ -15,7 +15,7 @@ domain=$(idn -t --quiet -u "$2" )
|
|||
domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
|
||||
domain_idn=$(idn -t --quiet -a "$domain")
|
||||
|
||||
# Importing variables
|
||||
# Includes
|
||||
source $VESTA/conf/vesta.conf
|
||||
source $VESTA/func/shared.sh
|
||||
source $VESTA/func/domain.sh
|
||||
|
@ -25,40 +25,22 @@ source $VESTA/func/domain.sh
|
|||
# Verifications #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Checking arg number
|
||||
check_args '2' "$#" 'user domain'
|
||||
|
||||
# Checking argument format
|
||||
validate_format 'user' 'domain'
|
||||
|
||||
# Checking dns system is enabled
|
||||
is_system_enabled 'MAIL_SYSTEM'
|
||||
|
||||
# Checking user
|
||||
is_system_enabled "$MAIL_SYSTEM"
|
||||
is_object_valid 'user' 'USER' "$user"
|
||||
|
||||
# Checking user is active
|
||||
is_object_unsuspended 'user' 'USER' "$user"
|
||||
|
||||
# Checking domain
|
||||
is_domain_valid 'mail'
|
||||
|
||||
# Checking domain is not suspened
|
||||
is_domain_suspended 'mail'
|
||||
|
||||
# Checking current value
|
||||
is_domain_value_exist 'mail' '$CATCHALL'
|
||||
is_object_valid 'mail' 'DOMAIN' "$domain"
|
||||
is_object_unsuspended 'mail' 'DOMAIN' "$domain"
|
||||
is_object_value_exist 'mail' 'DOMAIN' "$domain" '$CATCHALL'
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Action #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Get old catchall
|
||||
email=$(get_domain_value 'mail' '$CATCHALL')
|
||||
|
||||
# Delete cathcall alias
|
||||
sed -i "/*@demo.vestacp.com:/d" $HOMEDIR/$user/conf/mail/$domain/aliases
|
||||
sed -i "/*@$domain:/d" $HOMEDIR/$user/conf/mail/$domain/aliases
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
|
@ -66,10 +48,10 @@ sed -i "/*@demo.vestacp.com:/d" $HOMEDIR/$user/conf/mail/$domain/aliases
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# Delete catchall in config
|
||||
update_domain_value 'mail' '$CATCHALL' ''
|
||||
update_object_value 'mail' 'DOMAIN' "$domain" '$CATCHALL' ''
|
||||
|
||||
# Logging
|
||||
log_history "$EVENT" "v_add_mail_domain_catchall $user $domain $email"
|
||||
log_history "$EVENT"
|
||||
log_event "$OK" "$EVENT"
|
||||
|
||||
exit
|
||||
|
|
|
@ -14,7 +14,7 @@ user=$1
|
|||
domain=$(idn -t --quiet -u "$2" )
|
||||
domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
|
||||
|
||||
# Importing variables
|
||||
# Includes
|
||||
source $VESTA/conf/vesta.conf
|
||||
source $VESTA/func/shared.sh
|
||||
source $VESTA/func/domain.sh
|
||||
|
@ -24,29 +24,14 @@ source $VESTA/func/domain.sh
|
|||
# Verifications #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Checking arg number
|
||||
check_args '2' "$#" 'user domain'
|
||||
|
||||
# Checking argument format
|
||||
validate_format 'user' 'domain'
|
||||
|
||||
# Checking dns system is enabled
|
||||
is_system_enabled 'MAIL_SYSTEM'
|
||||
|
||||
# Checking user
|
||||
is_system_enabled "$MAIL_SYSTEM"
|
||||
is_object_valid 'user' 'USER' "$user"
|
||||
|
||||
# Checking user is active
|
||||
is_object_unsuspended 'user' 'USER' "$user"
|
||||
|
||||
# Checking domain
|
||||
is_domain_valid 'mail'
|
||||
|
||||
# Checking domain is not suspened
|
||||
is_domain_suspended 'mail'
|
||||
|
||||
# Checking errorlog is not added
|
||||
is_domain_value_exist 'mail' '$DKIM'
|
||||
is_object_valid 'mail' 'DOMAIN' "$domain"
|
||||
is_object_unsuspended 'mail' 'DOMAIN' "$domain"
|
||||
is_object_value_exist 'mail' 'DOMAIN' "$domain" '$DKIM'
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
|
@ -59,10 +44,10 @@ rm -f $USER_DATA/mail/$domain.pub
|
|||
rm -f $HOMEDIR/$user/conf/mail/$domain/dkim.pem
|
||||
|
||||
# Checking dns domain
|
||||
check_dns_domain=$(is_domain_valid 'dns')
|
||||
check_dns_domain=$(is_object_valid 'dns' 'DOMAIN' "$domain")
|
||||
if [ "$?" -eq 0 ]; then
|
||||
records=$($BIN/v_list_dns_domain_records $user $domain plain)
|
||||
dkim_records=$(echo "$records" |grep -w '_domainkey'|cut -f 1 -d ' ')
|
||||
dkim_records=$(echo "$records" |grep -w '_domainkey' | cut -f 1 -d ' ')
|
||||
for id in $dkim_records; do
|
||||
$BIN/v_delete_dns_domain_record $user $domain $id
|
||||
done
|
||||
|
@ -73,11 +58,11 @@ fi
|
|||
# Vesta #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Adding dkim in config
|
||||
update_domain_value 'mail' '$DKIM' 'no'
|
||||
# Updatoing config
|
||||
update_object_value 'mail' 'DOMAIN' "$domain" '$DKIM' 'no'
|
||||
|
||||
# Logging
|
||||
log_history "$EVENT" "v_add_mail_domain_dkim $user $domain"
|
||||
log_history "$EVENT"
|
||||
log_event "$OK" "$EVENT"
|
||||
|
||||
exit
|
||||
|
|
|
@ -51,6 +51,8 @@ rm -f $HOMEDIR/$user/web/$domain/stats/.htaccess
|
|||
|
||||
# Update config
|
||||
update_object_value 'web' 'DOMAIN' "$domain" '$STATS_USER' ''
|
||||
update_object_value 'web' 'DOMAIN' "$domain" '$STATS_CRYPT' ''
|
||||
|
||||
|
||||
# Logging
|
||||
log_history "$EVENT"
|
||||
|
|
|
@ -14,7 +14,7 @@ user=$1
|
|||
domain=$2
|
||||
format=${3-shell}
|
||||
|
||||
# Importing variables
|
||||
# Includes
|
||||
source $VESTA/func/shared.sh
|
||||
|
||||
|
||||
|
@ -22,27 +22,18 @@ source $VESTA/func/shared.sh
|
|||
# Verifications #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Checking args
|
||||
check_args '2' "$#" 'user domain [format]'
|
||||
|
||||
# Checking argument format
|
||||
validate_format 'user' 'domain'
|
||||
|
||||
# Checking user
|
||||
is_object_valid 'user' 'USER' "$user"
|
||||
|
||||
# Checking domain
|
||||
is_domain_valid 'mail'
|
||||
is_object_valid 'mail' 'DOMAIN' "$domain"
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Action #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Defining config
|
||||
conf=$USER_DATA/mail/$domain.conf
|
||||
|
||||
# Defining fileds to select
|
||||
conf=$USER_DATA/mail/$domain.conf
|
||||
fields="\$ACCOUNT \$ALIAS \$FWD \$AUTOREPLY \$U_DISK \$SUSPENDED \$DATE"
|
||||
|
||||
# Listing domain accounts
|
||||
|
|
|
@ -15,7 +15,7 @@ user=$1
|
|||
domain=$2
|
||||
format=${3-shell}
|
||||
|
||||
# Importing variables
|
||||
# Includes
|
||||
source $VESTA/func/shared.sh
|
||||
|
||||
# Json function
|
||||
|
@ -23,19 +23,10 @@ json_list_domain() {
|
|||
i=1
|
||||
fileds_count=$(echo "$fields" | wc -w)
|
||||
line=$(grep "DOMAIN='$domain'" $conf)
|
||||
|
||||
# Print top bracket
|
||||
echo '{'
|
||||
|
||||
# Assing key=value
|
||||
eval $line
|
||||
|
||||
# Starting output loop
|
||||
for field in $fields; do
|
||||
# Parsing key=value
|
||||
eval value=$field
|
||||
|
||||
# Checking first field
|
||||
if [ "$i" -eq 1 ]; then
|
||||
echo -e "\t\"$value\": {"
|
||||
else
|
||||
|
@ -45,26 +36,19 @@ json_list_domain() {
|
|||
echo -e "\t\t\"${field//$/}\": \"$value\""
|
||||
fi
|
||||
fi
|
||||
# Updating iterator
|
||||
(( ++i))
|
||||
done
|
||||
|
||||
# If there was any output
|
||||
if [ -n "$value" ]; then
|
||||
echo -e ' }'
|
||||
fi
|
||||
# Printing bottom json bracket
|
||||
echo -e "}"
|
||||
}
|
||||
|
||||
# Shell function
|
||||
shell_list_domain() {
|
||||
line=$(grep "DOMAIN='$domain'" $conf)
|
||||
|
||||
# Parsing key=value
|
||||
eval $line
|
||||
|
||||
# Print result line
|
||||
for field in $fields; do
|
||||
eval key="$field"
|
||||
echo "${field//$/}: $key "
|
||||
|
@ -76,24 +60,17 @@ shell_list_domain() {
|
|||
# Verifications #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Checking args
|
||||
check_args '2' "$#" 'user domain [format]'
|
||||
|
||||
# Checking user
|
||||
is_object_valid 'user' 'USER' "$user"
|
||||
|
||||
# Checking domain exist
|
||||
is_domain_valid 'mail'
|
||||
is_object_valid 'mail' 'DOMAIN' "$domain"
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Action #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Defining config
|
||||
conf=$USER_DATA/mail.conf
|
||||
|
||||
# Defining fileds to select
|
||||
conf=$USER_DATA/mail.conf
|
||||
fields='$DOMAIN $ANTIVIRUS $ANTISPAM $DKIM $ACCOUNTS $U_DISK $CATCHALL
|
||||
$SUSPENDED $DATE'
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ user=$1
|
|||
domain=$2
|
||||
format=${3-shell}
|
||||
|
||||
# Importing variables
|
||||
# Includes
|
||||
source $VESTA/func/shared.sh
|
||||
|
||||
# Json function
|
||||
|
@ -41,14 +41,9 @@ shell_list_ssl() {
|
|||
# Verifications #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Checking args
|
||||
check_args '2' "$#" 'user domain [format]'
|
||||
|
||||
# Checking user
|
||||
is_object_valid 'user' 'USER' "$user"
|
||||
|
||||
# Checking domain exist
|
||||
is_domain_valid 'mail'
|
||||
is_object_valid 'mail' 'DOMAIN' "$domain"
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
user=$1
|
||||
format=${2-shell}
|
||||
|
||||
# Importing variables
|
||||
# Includes
|
||||
source $VESTA/func/shared.sh
|
||||
|
||||
|
||||
|
@ -21,13 +21,8 @@ source $VESTA/func/shared.sh
|
|||
# Verifications #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Checking args
|
||||
check_args '1' "$#" 'user [format]'
|
||||
|
||||
# Checking argument format
|
||||
validate_format 'user'
|
||||
|
||||
# Checking user
|
||||
is_object_valid 'user' 'USER' "$user"
|
||||
|
||||
|
||||
|
@ -35,12 +30,10 @@ is_object_valid 'user' 'USER' "$user"
|
|||
# Action #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Defining config
|
||||
conf=$USER_DATA/mail.conf
|
||||
|
||||
# Defining fileds to select
|
||||
conf=$USER_DATA/mail.conf
|
||||
fields="\$DOMAIN \$ANTIVIRUS \$ANTISPAM \$DKIM \$ACCOUNTS \$U_DISK \$CATCHALL"
|
||||
fields="$fields \$SUSPENDED \$DATE"
|
||||
fields="$fields \$SUSPENDED \$TIME \$DATE"
|
||||
|
||||
# Listing domains
|
||||
case $format in
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
# Argument defenition
|
||||
user=$1
|
||||
|
||||
# Importing variables
|
||||
# Includes
|
||||
source $VESTA/conf/vesta.conf
|
||||
source $VESTA/func/shared.sh
|
||||
source $VESTA/func/domain.sh
|
||||
|
@ -22,19 +22,10 @@ source $VESTA/func/domain.sh
|
|||
# Verifications #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Checking arg number
|
||||
check_args '1' "$#" 'user'
|
||||
|
||||
# Checking argument format
|
||||
validate_format 'user'
|
||||
|
||||
# Checking mail system is enabled
|
||||
is_system_enabled 'MAIL_SYSTEM'
|
||||
|
||||
# Checking user
|
||||
is_system_enabled "$MAIL_SYSTEM"
|
||||
is_object_valid 'user' 'USER' "$user"
|
||||
|
||||
# Checking user is active
|
||||
is_object_unsuspended 'user' 'USER' "$user"
|
||||
|
||||
|
||||
|
@ -54,14 +45,8 @@ if [ ! -d "$USER_DATA/mail" ]; then
|
|||
mkdir $USER_DATA/mail
|
||||
fi
|
||||
|
||||
# Defining config
|
||||
conf="$USER_DATA/mail.conf"
|
||||
search_string="DOMAIN"
|
||||
field='$DOMAIN'
|
||||
domains=$(dom_clear_search)
|
||||
|
||||
# Starting loop
|
||||
for domain in $domains; do
|
||||
for domain in $(search_objects 'dns' 'SUSPENDED' "*" 'DOMAIN'); do
|
||||
|
||||
# Defining variables
|
||||
get_domain_values 'mail'
|
||||
|
@ -108,7 +93,7 @@ for domain in $domains; do
|
|||
done
|
||||
|
||||
# Adding dkim dns records
|
||||
check_dns_domain=$(is_domain_valid 'dns')
|
||||
check_dns_domain=$(is_object_valid 'dns' 'DOMAIN' "$domain")
|
||||
if [ "$?" -eq 0 ]; then
|
||||
p=$(cat $pub|grep -v ' KEY---'|tr -d '\n')
|
||||
record='_domainkey'
|
||||
|
@ -153,9 +138,6 @@ update_user_value "$user" '$U_MAIL_ACCOUNTS' "$U_MAIL_ACCOUNTS"
|
|||
update_user_value "$user" '$SUSPENDED_MAIL' "$SUSPENDED_MAIL"
|
||||
update_user_value "$user" '$U_DISK_MAIL' "$U_DISK_MAIL"
|
||||
|
||||
# Adding task to the vesta pipe
|
||||
$BIN/v_restart_mail
|
||||
|
||||
# Logging
|
||||
log_event "$OK" "$EVENT"
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ domain=$(idn -t --quiet -u "$2" )
|
|||
domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
|
||||
domain_idn=$(idn -t --quiet -a "$domain")
|
||||
|
||||
# Importing variables
|
||||
# Includes
|
||||
source $VESTA/conf/vesta.conf
|
||||
source $VESTA/func/shared.sh
|
||||
source $VESTA/func/domain.sh
|
||||
|
@ -25,26 +25,13 @@ source $VESTA/func/domain.sh
|
|||
# Verifications #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Checking arg number
|
||||
check_args '2' "$#" 'user domain'
|
||||
|
||||
# Checking argument format
|
||||
validate_format 'user' 'domain'
|
||||
|
||||
# Checking dns system is enabled
|
||||
is_system_enabled 'MAIL_SYSTEM'
|
||||
|
||||
# Checking user
|
||||
is_system_enabled "$MAIL_SYSTEM"
|
||||
is_object_valid 'user' 'USER' "$user"
|
||||
|
||||
# Checking user is active
|
||||
is_object_unsuspended 'user' 'USER' "$user"
|
||||
|
||||
# Checking domain
|
||||
is_domain_valid 'mail'
|
||||
|
||||
# Checking domain is not suspened
|
||||
is_domain_suspended 'mail'
|
||||
is_object_valid 'mail' 'DOMAIN' "$domain"
|
||||
is_object_unsuspended 'mail' 'DOMAIN' "$domain"
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
|
@ -60,7 +47,7 @@ rm -f /etc/exim/domains/$domain
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# Updating config
|
||||
update_domain_value 'mail' '$SUSPENDED' 'yes'
|
||||
update_object_value 'mail' 'DOMAIN' "$domain" '$SUSPENDED' 'yes'
|
||||
|
||||
# Logging
|
||||
log_event "$OK" "$EVENT"
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
# Argument defenition
|
||||
user=$1
|
||||
|
||||
# Importing variables
|
||||
# Includes
|
||||
source $VESTA/conf/vesta.conf
|
||||
source $VESTA/func/shared.sh
|
||||
source $VESTA/func/domain.sh
|
||||
|
@ -22,16 +22,9 @@ source $VESTA/func/domain.sh
|
|||
# Verifications #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Checking arg number
|
||||
check_args '1' "$#" 'user'
|
||||
|
||||
# Checking argument format
|
||||
validate_format 'user'
|
||||
|
||||
# Checking dns system is enabled
|
||||
is_system_enabled 'MAIL_SYSTEM'
|
||||
|
||||
# Checking user
|
||||
is_system_enabled "$MAIL_SYSTEM"
|
||||
is_object_valid 'user' 'USER' "$user"
|
||||
|
||||
|
||||
|
@ -39,16 +32,8 @@ is_object_valid 'user' 'USER' "$user"
|
|||
# Action #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Defining config
|
||||
conf="$USER_DATA/mail.conf"
|
||||
|
||||
# Defining fileds to select
|
||||
field='$DOMAIN'
|
||||
search_string="SUSPENDED='no'"
|
||||
domains=$(dom_clear_search)
|
||||
|
||||
# Starting suspend loop
|
||||
for domain in $domains; do
|
||||
for domain in $(search_objects 'mail' 'SUSPENDED' "no" 'DOMAIN'); do
|
||||
$BIN/v_suspend_mail_domain "$user" "$domain"
|
||||
done
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ domain=$(idn -t --quiet -u "$2" )
|
|||
domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
|
||||
domain_idn=$(idn -t --quiet -a "$domain")
|
||||
|
||||
# Importing variables
|
||||
# Includes
|
||||
source $VESTA/conf/vesta.conf
|
||||
source $VESTA/func/shared.sh
|
||||
source $VESTA/func/domain.sh
|
||||
|
@ -25,26 +25,12 @@ source $VESTA/func/domain.sh
|
|||
# Verifications #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Checking arg number
|
||||
check_args '2' "$#" 'user domain'
|
||||
|
||||
# Checking argument format
|
||||
validate_format 'user' 'domain'
|
||||
|
||||
# Checking dns system is enabled
|
||||
is_system_enabled 'MAIL_SYSTEM'
|
||||
|
||||
# Checking user
|
||||
is_object_valid 'user' 'USER' "$user"
|
||||
|
||||
# Checking user is active
|
||||
is_object_unsuspended 'user' 'USER' "$user"
|
||||
|
||||
# Checking domain
|
||||
is_domain_valid 'mail'
|
||||
|
||||
# Checking domain is not suspened
|
||||
is_domain_value_exist 'mail' '$SUSPENDED'
|
||||
is_object_valid 'mail' 'DOMAIN' "$domain"
|
||||
is_object_suspended 'mail' 'DOMAIN' "$domain"
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
|
@ -60,7 +46,7 @@ ln -s $HOMEDIR/$user/conf/mail/$domain /etc/exim/domains/
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# Updating config
|
||||
update_domain_value 'mail' '$SUSPENDED' 'no'
|
||||
update_object_value 'mail' 'DOMAIN' "$domain" '$SUSPENDED' 'no'
|
||||
|
||||
# Logging
|
||||
log_event "$OK" "$EVENT"
|
||||
|
|
|
@ -22,16 +22,9 @@ source $VESTA/func/domain.sh
|
|||
# Verifications #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Checking arg number
|
||||
check_args '1' "$#" 'user'
|
||||
|
||||
# Checking argument format
|
||||
validate_format 'user'
|
||||
|
||||
# Checking dns system is enabled
|
||||
is_system_enabled 'MAIL_SYSTEM'
|
||||
|
||||
# Checking user
|
||||
is_system_enabled "$MAIL_SYSTEM"
|
||||
is_object_valid 'user' 'USER' "$user"
|
||||
|
||||
|
||||
|
@ -39,23 +32,10 @@ is_object_valid 'user' 'USER' "$user"
|
|||
# Action #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Defining config
|
||||
conf="$USER_DATA/mail.conf"
|
||||
|
||||
# Defining fileds to select
|
||||
field='$DOMAIN'
|
||||
|
||||
# Defining search string
|
||||
search_string="SUSPENDED='yes'"
|
||||
|
||||
# Parsing suspeneded domains
|
||||
#domains=$(dom_clear_search)
|
||||
|
||||
|
||||
# Starting unsuspend loop
|
||||
#for domain in $domains; do
|
||||
# $BIN/v_unsuspend_mail_domain "$user" "$domain"
|
||||
#done
|
||||
for domain in $(search_objects 'mail' 'SUSPENDED' "yes" 'DOMAIN'); do
|
||||
$BIN/v_unsuspend_mail_domain "$user" "$domain"
|
||||
done
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue