Browse Source

Added Error Handling for Sieve and Amavis

old-stable
gau1991 11 years ago
parent
commit
02a2b15c11
  1. 14
      src/modules/stack/install/mail/ee_mod_setup_amavis.sh
  2. 14
      src/modules/stack/install/mail/ee_mod_setup_sieve.sh

14
src/modules/stack/install/mail/ee_mod_setup_amavis.sh

@ -3,18 +3,22 @@
function ee_mod_setup_amavis() function ee_mod_setup_amavis()
{ {
# Confiure Amavis # Confiure Amavis
sed -i "s'#@'@'" /etc/amavis/conf.d/15-content_filter_mode sed -i "s'#@'@'" /etc/amavis/conf.d/15-content_filter_mode && \
sed -i "s'# ' '" /etc/amavis/conf.d/15-content_filter_mode sed -i "s'# ' '" /etc/amavis/conf.d/15-content_filter_mode \
|| ee_lib_error "Unable to setup Amavis, exit status = " $?
# Add mail filtering rules # Add mail filtering rules
sed -i "s/use strict;/use strict;\n\$sa_spam_subject_tag = undef;\n\$spam_quarantine_to = undef;\n\$sa_tag_level_deflt = undef;\n\n# Prevent spams from automatically rejected by mail-server\n\$final_spam_destiny = D_PASS;\n# We need to provide list of domains for which filtering need to be done\n@lookup_sql_dsn = (\n ['DBI:mysql:database=vimbadmin;host=127.0.0.1;port=3306',\n 'vimbadmin',\n 'password']);\n\n\$sql_select_policy = 'SELECT domain FROM domain WHERE CONCAT("@",domain) IN (%k)';/" /etc/amavis/conf.d/50-user sed -i "s/use strict;/use strict;\n\$sa_spam_subject_tag = undef;\n\$spam_quarantine_to = undef;\n\$sa_tag_level_deflt = undef;\n\n# Prevent spams from automatically rejected by mail-server\n\$final_spam_destiny = D_PASS;\n# We need to provide list of domains for which filtering need to be done\n@lookup_sql_dsn = (\n ['DBI:mysql:database=vimbadmin;host=127.0.0.1;port=3306',\n 'vimbadmin',\n 'password']);\n\n\$sql_select_policy = 'SELECT domain FROM domain WHERE CONCAT("@",domain) IN (%k)';/" /etc/amavis/conf.d/50-user \
|| ee_lib_error "Unable to setup Amavis, exit status = " $?
# Configure Postfix to use Amavis # Configure Postfix to use Amavis
# For postfix main.cf # For postfix main.cf
postconf -e "content_filter = smtp-amavis:[127.0.0.1]:10024" postconf -e "content_filter = smtp-amavis:[127.0.0.1]:10024"
# For postfix master.cf # For postfix master.cf
sed -i "s/1 pickup/1 pickup\n -o content_filter=\n -o receive_override_options=no_header_body_checks/" /etc/postfix/master.cf sed -i "s/1 pickup/1 pickup\n -o content_filter=\n -o receive_override_options=no_header_body_checks/" /etc/postfix/master.cf \
|| ee_lib_error "Unable to setup Amavis, exit status = " $?
cat /usr/share/easyengine/mail/amavis-master.cf >> /etc/postfix/master.cf cat /usr/share/easyengine/mail/amavis-master.cf >> /etc/postfix/master.cf
} }

14
src/modules/stack/install/mail/ee_mod_setup_sieve.sh

@ -3,11 +3,13 @@
function ee_mod_setup_amavis() function ee_mod_setup_amavis()
{ {
# Enable sieve plugin support for dovecot-lmtp # Enable sieve plugin support for dovecot-lmtp
sed -i "s' #mail_plugins = \$mail_plugins' postmaster_address = admin@example.com\n mns sieve'" /etc/dovecot/conf.d/20-lmtp.conf sed -i "s' #mail_plugins = \$mail_plugins' postmaster_address = admin@example.com\n mns sieve'" /etc/dovecot/conf.d/20-lmtp.conf \
|| ee_lib_error "Unable to add sieve plugin support for dovecot-lmtp, exit status = " $?
# Sieve dovecot-pluign configuration # Sieve dovecot-pluign configuration
sed -i "s'sieve = ~/.dovecot.sieve'sieve = ~/.dovecot.sieve\n sieve_global_path = /var/lib/dovecot/sieve/default.sieve'" /etc/dovecot/conf.d/90-sieve.conf sed -i "s'sieve = ~/.dovecot.sieve'sieve = ~/.dovecot.sieve\n sieve_global_path = /var/lib/dovecot/sieve/default.sieve'" /etc/dovecot/conf.d/90-sieve.conf && \
sed -i "s'#sieve_global_dir ='sieve_global_dir = /var/lib/dovecot/sieve/'" /etc/dovecot/conf.d/90-sieve.conf sed -i "s'#sieve_global_dir ='sieve_global_dir = /var/lib/dovecot/sieve/'" /etc/dovecot/conf.d/90-sieve.conf \
|| ee_lib_error "Unable to setup Sieve dovecot-pluign, exit status = " $?
# Create global Sieve rules file # Create global Sieve rules file
mkdir -p /var/lib/dovecot/sieve/ mkdir -p /var/lib/dovecot/sieve/
@ -15,9 +17,11 @@ function ee_mod_setup_amavis()
chown -R vmail:vmail /var/lib/dovecot chown -R vmail:vmail /var/lib/dovecot
# Compile Sieve rules # Compile Sieve rules
sievec /var/lib/dovecot/sieve/default.sieve sievec /var/lib/dovecot/sieve/default.sieve \
|| ee_lib_error "Unable to compile Sieve rules, exit status = " $?
# Configure Roundcube # Configure Roundcube
sed -i "s:\$config\['plugins'\] = array(:\$config\['plugins'\] = array(\n 'sieverules':" /var/www/roundcubemail/htdocs/config/config.inc.php sed -i "s:\$config\['plugins'\] = array(:\$config\['plugins'\] = array(\n 'sieverules':" /var/www/roundcubemail/htdocs/config/config.inc.php \
|| ee_lib_error "Unable to configure Sieve Roundcube plugin, exit status = " $?
echo "\$config['sieverules_port'] = 4190;" >> /var/www/roundcubemail/htdocs/config/config.inc.php echo "\$config['sieverules_port'] = 4190;" >> /var/www/roundcubemail/htdocs/config/config.inc.php
} }

Loading…
Cancel
Save