ansible-role-postfix/files/update_clients.sh

16 lines
546 B
Bash
Raw Normal View History

2022-10-11 09:19:06 +02:00
#!/bin/bash
2023-01-30 23:10:17 +01:00
declare clients=( hiljainen.susurrando.com deu1.susurrando.com adpvm01.susurrando.com adpvm02.susurrando.com adpvm03.susurrando.com adpvm04.susurrando.com)
2022-10-11 09:19:06 +02:00
rm /etc/postfix/allowed_clients
touch /etc/postfix/allowed_clients
chown postfix.postfix /etc/postfix/allowed_clients
chmod o-rwx /etc/postfix/allowed_clients
for client in "${clients[@]}"
do
client_ip=$(dig "${client}" | grep -v '^;' |grep "\sA\s" | awk '{print($5)}')
2023-01-30 23:04:13 +01:00
echo "${client_ip} OK" >> /etc/postfix/allowed_clients
2023-01-30 22:56:26 +01:00
done
2023-01-30 23:10:17 +01:00
postmap /etc/postfix/allowed_clients