Browse Source

fix_dmarc_dkim_local_off

main
pvincent 2 weeks ago
parent
commit
f2fe26c7ba
  1. 9
      sympa/miaou/miaou-install-from-import-sympa
  2. 33
      sympa/recipe/sympa_fix_dmarc_dkim_local_off.recipe
  3. 27
      sympa/recipe/sympa_fix_dmarc_off.recipe

9
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

33
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

27
sympa/recipe/sympa_fix_dmarc_off.recipe

@ -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
Loading…
Cancel
Save