diff --git a/bin/v_add_mail_domain b/bin/v_add_mail_domain index 0e8e5904..cbdffa2d 100755 --- a/bin/v_add_mail_domain +++ b/bin/v_add_mail_domain @@ -65,6 +65,9 @@ chown -R root:mail $V_HOME/$user/conf/mail/$domain chmod 770 $V_HOME/$user/conf/mail/$domain chmod 660 $V_HOME/$user/conf/mail/$domain* +# Adding symlink +ln -s $V_HOME/$user/conf/mail/$domain /etc/exim/domains/ + # Adding antispam protection if [ "$antispam" = 'yes' ]; then echo 'antispam' >> $V_HOME/$user/conf/mail/$domain/protection diff --git a/bin/v_add_mail_domain_antivirus b/bin/v_add_mail_domain_antivirus index 3df94946..81f5615d 100755 --- a/bin/v_add_mail_domain_antivirus +++ b/bin/v_add_mail_domain_antivirus @@ -2,7 +2,7 @@ # info: add mail domain antivirus support # options: user domain # -# The function enables clamav for incomming emails. +# The function enables clamav scan for incomming emails. #----------------------------------------------------------# @@ -47,7 +47,7 @@ is_domain_valid 'mail' # Checking domain is not suspened is_domain_suspended 'mail' -# Checking errorlog is not added +# Checking current value is_domain_key_empty 'mail' '$ANTIVIRUS' @@ -55,7 +55,7 @@ is_domain_key_empty 'mail' '$ANTIVIRUS' # Action # #----------------------------------------------------------# -# Adding antispam key to config +# Adding antivirus key to config if [ -z "$(grep 'virus' $V_HOME/$user/conf/mail/$domain/protection)" ]; then echo 'antivirus' >> $V_HOME/$user/conf/mail/$domain/protection fi @@ -64,7 +64,7 @@ fi # Vesta # #----------------------------------------------------------# -# Adding antispam in config +# Adding antivirus in config update_domain_value 'mail' '$ANTIVIRUS' 'yes' # Logging diff --git a/bin/v_add_mail_domain_cactchall b/bin/v_add_mail_domain_cactchall index abf21ab7..22c70e4f 100755 --- a/bin/v_add_mail_domain_cactchall +++ b/bin/v_add_mail_domain_cactchall @@ -32,7 +32,6 @@ check_args '3' "$#" 'user domain email' # Checking argument format format_validation 'user' 'domain' 'email' -exit # Checking dns system is enabled is_system_enabled 'MAIL_SYSTEM' @@ -50,27 +49,27 @@ is_domain_valid 'mail' is_domain_suspended 'mail' # Checking errorlog is not added -is_domain_key_empty 'mail' '$ANTIVIRUS' +is_domain_key_empty 'mail' '$CATCHALL' #----------------------------------------------------------# # Action # #----------------------------------------------------------# -# Adding antispam key to config -if [ -z "$(grep 'virus' $V_HOME/$user/conf/mail/$domain/protection)" ]; then - echo 'antivirus' >> $V_HOME/$user/conf/mail/$domain/protection -fi +# Adding catchall alias +sed -i "/*@demo.vestacp.com:/d" $V_HOME/$user/conf/mail/$domain/aliases +echo "*@demo.vestacp.com:$email" >> $V_HOME/$user/conf/mail/$domain/aliases + #----------------------------------------------------------# # Vesta # #----------------------------------------------------------# # Adding antispam in config -update_domain_value 'mail' '$ANTIVIRUS' 'yes' +update_domain_value 'mail' '$CATCHALL' "$email" # Logging -log_history "$V_EVENT" "v_delete_mail_domain_antivirus $user $domain" +log_history "$V_EVENT" "v_delete_mail_domain_catchall $user $domain" log_event 'system' "$V_EVENT" exit diff --git a/bin/v_delete_dns_domain_record b/bin/v_delete_dns_domain_record index b9864879..fe184358 100755 --- a/bin/v_delete_dns_domain_record +++ b/bin/v_delete_dns_domain_record @@ -63,6 +63,7 @@ fi sort_dns_records # Updating zone +conf="$V_HOME/$user/conf/dns/$domain.db" update_domain_zone diff --git a/bin/v_delete_mail_domain_antispam b/bin/v_delete_mail_domain_antispam new file mode 100755 index 00000000..4250a32a --- /dev/null +++ b/bin/v_delete_mail_domain_antispam @@ -0,0 +1,73 @@ +#!/bin/bash +# info: delete mail domain antispam support +# options: user domain +# +# The function disable spamassasin for incomming emails. + + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user=$1 +domain=$(idn -t --quiet -u "$2" ) +domain=$(echo $domain | tr '[:upper:]' '[:lower:]') +domain_idn=$(idn -t --quiet -a "$domain") + +# Importing variables +source $VESTA/conf/vars.conf +source $V_CONF/vesta.conf +source $V_FUNC/shared.func +source $V_FUNC/domain.func + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '2' "$#" 'user domain' + +# Checking argument format +format_validation 'user' 'domain' + +# Checking dns system is enabled +is_system_enabled 'MAIL_SYSTEM' + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + +# Checking domain +is_domain_valid 'mail' + +# Checking domain is not suspened +is_domain_suspended 'mail' + +# Checking current value +is_domain_value_exist 'mail' '$ANTISPAM' + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Delete antispam key +sed -i "/antispam/d" $V_HOME/$user/conf/mail/$domain/protection + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Delete antispam in config +update_domain_value 'mail' '$ANTISPAM' 'no' + +# Logging +log_history "$V_EVENT" "v_add_mail_domain_antispam $user $domain" +log_event 'system' "$V_EVENT" + +exit diff --git a/bin/v_delete_mail_domain_antivirus b/bin/v_delete_mail_domain_antivirus new file mode 100755 index 00000000..dce1e840 --- /dev/null +++ b/bin/v_delete_mail_domain_antivirus @@ -0,0 +1,73 @@ +#!/bin/bash +# info: delete mail domain antivirus support +# options: user domain +# +# The function disables clamav scan for incomming emails. + + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user=$1 +domain=$(idn -t --quiet -u "$2" ) +domain=$(echo $domain | tr '[:upper:]' '[:lower:]') +domain_idn=$(idn -t --quiet -a "$domain") + +# Importing variables +source $VESTA/conf/vars.conf +source $V_CONF/vesta.conf +source $V_FUNC/shared.func +source $V_FUNC/domain.func + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '2' "$#" 'user domain' + +# Checking argument format +format_validation 'user' 'domain' + +# Checking dns system is enabled +is_system_enabled 'MAIL_SYSTEM' + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + +# Checking domain +is_domain_valid 'mail' + +# Checking domain is not suspened +is_domain_suspended 'mail' + +# Checking current value +is_domain_value_exist 'mail' '$ANTIVIRUS' + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Delete antivirus key +sed -i "/antivirus/d" $V_HOME/$user/conf/mail/$domain/protection + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Delete antivirus in config +update_domain_value 'mail' '$ANTIVIRUS' 'no' + +# Logging +log_history "$V_EVENT" "v_add_mail_domain_antivirus $user $domain" +log_event 'system' "$V_EVENT" + +exit diff --git a/bin/v_delete_mail_domain_dkim b/bin/v_delete_mail_domain_dkim new file mode 100755 index 00000000..d642bcaa --- /dev/null +++ b/bin/v_delete_mail_domain_dkim @@ -0,0 +1,84 @@ +#!/bin/bash +# info: delete mail domain dkim support +# options: user domain [dkim_size] +# +# The function delete DKIM domain pem. + + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user=$1 +domain=$(idn -t --quiet -u "$2" ) +domain=$(echo $domain | tr '[:upper:]' '[:lower:]') + +# Importing variables +source $VESTA/conf/vars.conf +source $V_CONF/vesta.conf +source $V_FUNC/shared.func +source $V_FUNC/domain.func + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '2' "$#" 'user domain' + +# Checking argument format +format_validation 'user' 'domain' + +# Checking dns system is enabled +is_system_enabled 'MAIL_SYSTEM' + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + +# 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' + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Generating dkim +rm -f $V_USERS/$user/mail/$domain.pem +rm -f $V_USERS/$user/mail/$domain.pub +rm -f $V_HOME/$user/conf/mail/$domain/dkim.pem + +# Checking dns domain +check_dns_domain=$(is_domain_valid 'dns') +if [ "$?" -eq 0 ]; then + records=$($V_BIN/v_list_dns_domain_records $user $domain plain) + dkim_records=$(echo "$records" |grep -w '_domainkey'|cut -f 1 -d ' ') + for id in $dkim_records; do + $V_BIN/v_delete_dns_domain_record $user $domain $id + done +fi + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Adding dkim in config +update_domain_value 'mail' '$DKIM' 'no' + +# Logging +log_history "$V_EVENT" "v_add_mail_domain_dkim $user $domain" +log_event 'system' "$V_EVENT" + +exit