Welcome, Guest
Please Login or Register.
Lost Password?
Re: One-liner to add SPF records to all domains (1 viewing)
Post Reply

TOPIC: Re: One-liner to add SPF records to all domains

#3099
RyanJohnson (User)
Posts: 6
graphgraph
Re: Re: Re: Re: One-liner to add SPF records to all domains 2006/11/09 21:51  
Thanks Joe,

This look like fun.. !

What directory to I issue his command from? Will it work for FC4?

Cheers,
Ryan
  The administrator has disabled public write access.
#3100
Joe (Admin)
Posts: 4084
graph
Re: Re: Re: Re: Re: One-liner to add SPF records to all domains 2006/11/09 21:56  
Hey Ryan,

Yes, it'll work on every OS. The BIND hosts file format is identical.

You'll execute it in the directory where your hosts files live (domain.com.hosts). On Fedora Core 4, and most other Red Hat based systems, I believe that'll be /var/named/chroot/var/named
  The administrator has disabled public write access.
#4358
tabletguy (User)
Posts: 51
graphgraph
Re: One-liner to add SPF records to all domains 2007/03/30 22:20  
Hmmm.

On my system, which you guys set up a year+ ago, it's just /var/named
  The administrator has disabled public write access.
#13378
merlynx (User)
Posts: 48
graphgraph
Re: Re: Re: One-liner to add SPF records to all 2008/06/03 23:04  
Hmmm...

I just don't get how to use this.

I created a bash script with this code in it, ran it, and it like deleted all the text in my .hosts files.

So I'm sitting here asking myself why didn't I backup in a test directory and run it...

bummer.
  The administrator has disabled public write access.
#13400
Joe (Admin)
Posts: 4084
graph
Re: Re: Re: One-liner to add SPF records to all 2008/06/04 12:43  
I created a bash script with this code in it, ran it, and it like deleted all the text in my .hosts files.

So I'm sitting here asking myself why didn't I backup in a test directory and run it...


Oh no! I'm not sure how that could happen, but this post does pre-date the migration to Joomla, and so the formatting may have made something go terribly amiss...and, of course, there's now a command line tool to accomplish this same task. So, it's no longer necessary.

Here's the way to do it now (the path to the Webmin dir is different on different operating systems...this is RHEL/CentOS/Fedora):

Code:

cd /usr/libexec/webmin/virtual-server sudo ./modify-dns.pl --all-domains --spf



You can also add other hosts, if you want using the "spf-add hostname" option.

As for your problem of losing all of your zones...I think one could do (I'm going to ask Jamie to check my work on this one, so wait until he confirms that this is non-dangerous):

Code:

sudo ./disable-feature.pl --all-domains --dns sudo ./enable-feature.pl --all-domains --dns



Which I think will recreate the DNS zones for all of your domains. Of course, if you have domains that you don't want to have DNS enabled, you'll probably need to get a bit more clever (or manually specify domains and run the command several times).

Again, on this last one, let's wait for Jamie to chime in with a sanity check to be sure I'm not telling you to do something stupid.
  The administrator has disabled public write access.
#13406
JamieCameron (Admin)
Posts: 362
graphgraph
Re: Re: Re: One-liner to add SPF records to all 2008/06/04 13:47  
You can safely re-create all your DNS records using the commands Joe gave, although this will create them with just the standard records.

Also, this assumes that you have DNS enabled for all your domains. If not, a better command would be like :

Code:

sudo bash cd /usr/libexec/webmin/virtual-server domains=`./list-domains.pl --name-only --with-feature dns` for d in $domains; do   ./disable-feature.pl --domain $d --dns   ./enable-feature.pl --domain $d --dns done

  The administrator has disabled public write access.
#13502
merlynx (User)
Posts: 48
graphgraph
Re: Re: Re: One-liner to add SPF records to all 2008/06/06 14:14  
Thanks guys, I did something similar through the "list virtual servers" interface.

The problem is, not postfix has the infamous "User unknown in virtual alias table;" and much of the mail is not being accepted.

I've tried to fix it and read a few threads - (i.e. don't have "myorigin" set and so on...)

Don't know where to go with it at this point.
  The administrator has disabled public write access.
#13504
Joe (Admin)
Posts: 4084
graph
Re: Re: Re: One-liner to add SPF records to all 2008/06/06 16:18  
I've tried to fix it and read a few threads - (i.e. don't have "myorigin" set and so on...)

If that's the case, your hostname is broken in some way.

There are three possible causes of the error (that I've ever seen, anyway):

1. myorigin set incorrectly (pretty much whatever you set it to is gonna be incorrect, because nobody knows what it's for...so, leaving it out is the only sane choice) ;-)

2. User actually does not exist in the virtual alias table. You can look to see...either it's there, or it isn't.

3. Hostname of the box is broken. Either it has a DNS entry that points somewhere else, there is an MX record for it pointing somewhere else (though I think we'd get a relaying error instead), the hosts file entry is wrong somehow, or you've explicitly told Postfix that your hostname is something that it isn't. Somehow Postfix doesn't think your box is the hostname it thinks it's running on. Fix your hostname, restart postfix, problem solved.
  The administrator has disabled public write access.
#14231
merlynx (User)
Posts: 48
graphgraph
Re: Re: Re: One-liner to add SPF records to all 2008/06/27 14:31  
It was the DNS issue.
The IP addresses had changed on the server (one went down with a different IP, the other came up with another IP, reverse DNS and nameserver glue records were all tweaked....)

Once DNS was sorted out - it's faring well.

Thanks again!
  The administrator has disabled public write access.
Post Reply
get the latest posts directly to your desktop

Talk and Get Help

Support
Forums
Bugs and Issues

Get Virtualmin

OS Support
Buy Online
Download
Copyright 2005-2007 Virtualmin, Inc. All rights reserved.