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.
34 lines
685 B
34 lines
685 B
#!/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
|
|
systemctl restart sympa wwsympa.socket
|