ansible-role-postfix/files/update_clients.sh
2023-01-30 23:56:26 +02:00

15 lines
463 B
Bash

#!/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
postmap /etc/postfix/allowed_clients
for client in "${clients[@]}"
do
client_ip=$(dig "${client}" | grep -v '^;' |grep "\sA\s" | awk '{print($5)}')
echo "${client_ip}" >> /etc/postfix/allowed_clients
done