diff --git a/data/hooks/conf_regen/31-amavis b/data/hooks/conf_regen/31-amavis new file mode 100644 index 000000000..f25c70fe4 --- /dev/null +++ b/data/hooks/conf_regen/31-amavis @@ -0,0 +1,37 @@ +#!/bin/bash +set -e + +force=$1 + +function safe_copy () { + if [[ "$force" == "True" ]]; then + sudo yunohost service safecopy \ + -s amavis $1 $2 --force + else + sudo yunohost service safecopy \ + -s amavis $1 $2 + fi +} + +cd /usr/share/yunohost/templates/amavis + +sudo mkdir -p /etc/amavis/conf.d/ + +# Copy plain single configuration files +files="05-domain_id +05-node_id +15-content_filter_mode +20-debian_defaults" + +for file in $files; do + safe_copy $file /etc/amavis/conf.d/$file +done + +main_domain=$(cat /etc/yunohost/current_host) +cat 50-user.sed \ + | sed "s/{{ main_domain }}/$main_domain/g" \ + | sudo tee 50-user +safe_copy 50-user /etc/amavis/conf.d/50-user + + +sudo service amavis restart diff --git a/data/templates/amavis/20-debian_defaults b/data/templates/amavis/20-debian_defaults index fb8d835de..83e553d28 100644 --- a/data/templates/amavis/20-debian_defaults +++ b/data/templates/amavis/20-debian_defaults @@ -119,8 +119,8 @@ $banned_filename_re = new_RE( qr'^application/x-msdos-program$'i, qr'^application/hta$'i, -# qr'^application/x-msmetafile$'i, # Windows Metafile MIME type -# qr'^\.wmf$', # Windows Metafile file(1) type +# qr'^application/x-msmetafile$'i, # Windows Metafile MIME type +# qr'^\.wmf$', # Windows Metafile file(1) type # qr'^message/partial$'i, qr'^message/external-body$'i, # rfc2046 MIME types diff --git a/data/templates/amavis/50-user.j2 b/data/templates/amavis/50-user.sed similarity index 89% rename from data/templates/amavis/50-user.j2 rename to data/templates/amavis/50-user.sed index 129da4f25..b0e7ce148 100644 --- a/data/templates/amavis/50-user.j2 +++ b/data/templates/amavis/50-user.sed @@ -8,9 +8,9 @@ use strict; # the directives you can use in this file # -$myhostname = "{{ domain }}"; +$myhostname = "{{ main_domain }}"; -$mydomain = "{{ domain }}"; +$mydomain = "{{ main_domain }}"; # Enable LDAP support $enable_ldap = 1;