ansible-role-postfix/files/update_clients.sh

16 lines
466 B
Bash
Raw Normal View History

2022-10-11 09:19:06 +02:00
#!/bin/bash
declare clients=( hiljainen.susurrando.com www.susurrando.com oc.koti.site)
rm /etc/postfix/allowed_clients
touch /etc/postfix/allowed_clients
chown postfix.postfix /etc/postfix/allowed_clients
chmod o-rwx /etc/postfix/allowed_clients
2023-01-30 22:56:26 +01:00
postmap /etc/postfix/allowed_clients
2022-10-11 09:19:06 +02:00
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