| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- #!/bin/bash
- # info: add mail domain antivirus support
- # options: USER DOMAIN
- #
- # The function enables 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")
- # Includes
- source $VESTA/conf/vesta.conf
- source $VESTA/func/main.sh
- source $VESTA/func/domain.sh
- #----------------------------------------------------------#
- # Verifications #
- #----------------------------------------------------------#
- check_args '2' "$#" 'USER DOMAIN'
- validate_format 'user' 'domain'
- 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_value_empty 'mail' 'DOMAIN' "$domain" '$ANTIVIRUS'
- #----------------------------------------------------------#
- # Action #
- #----------------------------------------------------------#
- # Adding antivirus key to config
- 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_object_value 'mail' 'DOMAIN' "$domain" '$ANTIVIRUS' 'yes'
- # Logging
- log_history "enabled antivirus on $domain"
- log_event "$OK" "$EVENT"
- exit
|