Using Perl to make changes to your DNS files

Example : You would like to change “v=spf1 a mx ip4:1.2.3.4 ?all” to “v=spf1 a mx ip4:1.2.3.4 -all”

of course, where 1.2.3.4 should be replaced by your server IP.

If you’d rather do this to all of your domain, you can use perl

cd /var/named

perl -pi -e ’s/\?all/\-all/’ *.db

change /var/named to the appropriate directory for your db files for your OS (/etc/bind, /etc/namdb)

Restart named after making the changes.

Trackback URI | Comments RSS

Leave a Reply

You must be logged in to post a comment.