arnoudj / puppet-sudo

Puppet module to manage sudoers.
8 stars 23 forks source link

Use validate_cmd parameter #17

Closed petems closed 9 years ago

petems commented 10 years ago

It'd probably be a good idea to have some sort of check to make sure you don't break your sudo rules, as I've managed to do just now :+1:

So far this seems to work:

if $ensure == 'present' {
    file { "/etc/sudoers.d/$name":
      content => template('sudo/sudoers.erb'),
      owner   => 'root',
      group   => 'root',
      mode    => '0440',
      validate_cmd => '/usr/sbin/visudo -c -f %',
    }
  }

I've got a pull-request for this coming :+1: