2021-03-24 01:11:11 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
IP=$(curl ifconfig.me)
|
|
|
|
curl_retval=$?
|
2021-03-24 01:14:45 +01:00
|
|
|
|
2021-03-24 10:31:58 +01:00
|
|
|
if [ $curl_retval -gt 0 ]; then
|
2021-03-24 01:14:45 +01:00
|
|
|
# TODO send warning email to postmaster here
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2021-03-24 01:11:11 +01:00
|
|
|
host_answer=$(host "$IP")
|
|
|
|
rev_dns="${host_answer##* }"
|
|
|
|
rev_dns="${rev_dns%.}"
|
|
|
|
|
|
|
|
echo "Rev. DNS is: $rev_dns"
|
|
|
|
|
2021-03-24 01:14:45 +01:00
|
|
|
sed -e "s/^myhostname.*/myhostname = $rev_dns/" -i /etc/postfix/main.cf
|