Browse Source

Added Sieve configuration

bugfixes
gau1991 10 years ago
parent
commit
4d3193ce26
  1. 29
      ee/cli/plugins/stack.py
  2. 4
      ee/cli/templates/default-sieve.mustache
  3. 12
      ee/cli/templates/dovecot.mustache
  4. 10
      ee/core/variables.py

29
ee/cli/plugins/stack.py

@ -264,6 +264,22 @@ class EEStackController(CementBaseController):
EEShellExec.cmd_exec("postconf -e \"smtpd_tls_key_file = "
"/etc/ssl/private/postfix.pem\"")
# Sieve configuration
if not os.path.exists('/var/lib/dovecot/sieve/'):
os.makedirs('/var/lib/dovecot/sieve/')
# Custom sieve configuration by EasyEngine
data = dict()
ee_sieve = open('/var/lib/dovecot/sieve/default.sieve', 'w')
self.app.render((data), 'default-sieve.mustache',
out=ee_sieve)
ee_sieve.close()
# Compile sieve rules
EEShellExec.cmd_exec("chown -R vmail:vmail /var/lib/dovecot")
EEShellExec.cmd_exec("sievec /var/lib/dovecot/sieve/"
"default.sieve")
if len(packages):
if any('/usr/bin/wp' == x[1] for x in packages):
EEShellExec.cmd_exec("chmod +x /usr/bin/wp")
@ -433,7 +449,7 @@ class EEStackController(CementBaseController):
EEMysql.execute("create database if not exists roundcubemail")
EEMysql.execute("grant all privileges on roundcubemail.* to "
" roundcube@localhost IDENTIFIED BY "
"{password}".format(password=rc_passwd))
"'{password}'".format(password=rc_passwd))
EEShellExec.cmd_exec("mysql roundcubemail < /var/www/"
"roundcubemail/htdocs/SQL/mysql"
".initial.sql")
@ -444,11 +460,20 @@ class EEStackController(CementBaseController):
"config.inc.php")
EEShellExec.cmd_exec("sed -i \"s\'mysql://roundcube:pass@"
"localhost/roundcubemail\'mysql://"
"roundcube:${password}@localhost/"
"roundcube:{password}@localhost/"
"roundcubemail\'\" /var/www/roundcubemail"
"/htdocs/config/config."
"inc.php".format(password=rc_passwd))
# Sieve plugin configuration in roundcube
EEShellExec.cmd_exec("sed -i \"s:\$config\['plugins'\] = array"
"(:\$config\['plugins'\] = array(\n "
"'sieverules',:\" /var/www/roundcubemail"
"/htdocs/config/config.inc.php")
EEShellExec.cmd_exec("echo \"\$config['sieverules_port'] = "
"4190;\" >> /var/www/roundcubemail/htdocs"
"/config/config.inc.php")
@expose()
def install(self):
pkg = EEAptGet()

4
ee/cli/templates/default-sieve.mustache

@ -0,0 +1,4 @@
require "fileinto";
if header :contains "X-Spam-Flag" "YES" {
fileinto "Junk";
}

12
ee/cli/templates/dovecot.mustache

@ -46,3 +46,15 @@ plugin {
autosubscribe3 = Drafts
autosubscribe4 = Sent
}
protocol lmtp {
postmaster_address = {{email}}
mail_plugins = $mail_plugins sieve
}
plugin {
sieve = ~/.dovecot.sieve
sieve_global_path = /var/lib/dovecot/sieve/default.sieve
sieve_global_dir = /var/lib/dovecot/sieve/
sieve_dir = ~/sieve
}

10
ee/core/variables.py

@ -57,7 +57,7 @@ class EEVariables():
ee_postfix_repo = ""
ee_postfix = ["postfix"]
# Dovecot repo and packages
# Mail repo and packages
ee_mail_repo = ("deb http://http.debian.net/debian-backports {codename}"
"-backports main".format(codename=ee_platform_codename))
@ -66,7 +66,13 @@ class EEVariables():
"dovecot-managesieved", "postfix-mysql", "php5-cgi",
"php5-json", "php-gettext"]
# Repo
# Mailscanner repo and packages
ee_mailscanner_repo = ()
ee_mailscanner = ["amavisd-new", "spamassassin", "clamav", "clamav-daemon",
"arj", "zoo", "nomarch", "cpio", "lzop",
"cabextract", "p7zip", "rpm", "unrar-free"]
# Repo path
ee_repo_file = "ee-repo.list"
ee_repo_file_path = ("/etc/apt/sources.list.d/" + ee_repo_file)

Loading…
Cancel
Save