You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
499 B

#!/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