Monday, August 29, 2011

Sudo and DNS

So, come to find out sudo can be configured with the following option:

(sudo man page)
fqdn
Set this flag if you want to put fully qualified host names in the sudoers file. ...

Ok, story time...

There I am minding my own business when my buddy comes up to me asking why it is taking so long for him to use sudo. It was taking almost a good 3 minutes to run a single sudo command.

After stupidly restarting the machine and having the issue come back my little brother asks me if the same thing is happening with root (`su -`), no it wasn't. Come to find out CentOS was nice enough to enable the nice little feature that requires DNS to resolve properly in order to run any sudo commands.

In the documentation it gives the following warning:

Beware that turning on fqdn requires sudo to make DNS lookups which may make sudo unusable if DNS stops working (for example if the machine is not plugged into the network).

So remember, if you are going to enable the fqdn option with sudo make sure to always be connected to the network and have your DNS properly resolving otherwise things are going to get messy.

Does anyone else know of any distributions that enable fqdn with sudo?