diff --git a/sympa/miaou/miaou-install-from-import-sympa b/sympa/miaou/miaou-install-from-import-sympa index 2390362..a41d840 100755 --- a/sympa/miaou/miaou-install-from-import-sympa +++ b/sympa/miaou/miaou-install-from-import-sympa @@ -47,9 +47,9 @@ function install_fake_additional { miaou-recipe "$CONTAINER" "$BASEDIR"/../recipe/sympa_ldap_auth_remote.recipe } -function fix_dmarc_off { - echo 'fix dmarc off...' - miaou-recipe "$CONTAINER" "$BASEDIR"/../recipe/sympa_fix_dmarc_off.recipe +function fix_dmarc_dkim_local_off { + echo 'fix dmarc dkim local off...' + miaou-recipe "$CONTAINER" "$BASEDIR"/../recipe/sympa_fix_dmarc_dkim_local_off.recipe } function fix_dkim_global_on { @@ -71,6 +71,7 @@ miaou-push $CONTAINER $IMPORT_FILE /root/ echo "launch the import process" miaou-exec $CONTAINER -- /opt/miaou-sympa/tools/sympa_import.bash "/root/$import_base" -fix_dmarc_off fix_dkim_global_on +fix_dmarc_dkim_local_off + install_fake_additional diff --git a/sympa/recipe/sympa_fix_dmarc_dkim_local_off.recipe b/sympa/recipe/sympa_fix_dmarc_dkim_local_off.recipe new file mode 100644 index 0000000..6713609 --- /dev/null +++ b/sympa/recipe/sympa_fix_dmarc_dkim_local_off.recipe @@ -0,0 +1,33 @@ +#!/usr/bin/env miaou-recipe + +# CONSTANTS + +LIST_DATA_DIR=/var/lib/sympa/list_data +FOUND=false + +# FUNCTIONS + +function fix_for_local_config { + config_files=$(find $LIST_DATA_DIR -name "config" -type f) + for i in $config_files; do + if grep -q -e ^dmarc -e ^dkim $i; then + FOUND=true + echo "found problematic configuration in $i" + remove_section_from_file $i dkim + remove_section_from_file $i dmarc + fi + done +} + +function remove_section_from_file { + local file=$1 + local section=$2 + awk "/^$section/{found=1} !found{print} /^$/{found=0}" $file > $file.new + mv $file.new $file + chown sympa:sympa $file +} + +# MAIN + +set -Eue +fix_for_local_config diff --git a/sympa/recipe/sympa_fix_dmarc_off.recipe b/sympa/recipe/sympa_fix_dmarc_off.recipe deleted file mode 100644 index 8f02f49..0000000 --- a/sympa/recipe/sympa_fix_dmarc_off.recipe +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env miaou-recipe - -# CONSTANTS - -LIST_DATA_DIR=/var/lib/sympa/list_data - -# FUNCTIONS - -function fix_dmarc_off { - config_files=$(find $LIST_DATA_DIR -name "config" -type f) - for i in $config_files; do - if grep -q "^dmarc_protection" $i; then - echo "found 'dmarc' in $i" - remove_dmarc_section_from_file $i - fi - done -} - -function remove_dmarc_section_from_file { - local file=$1 - awk '/^dmarc_protection/{found=1} !found{print} /^$/{found=0}' $file >$file -} - -# MAIN - -set -Eue -fix_dmarc_off