Efficient way to disable a user to sudo via puppet

218 Views Asked by At

I have puppet 6 installed in my environment and would like to ensure that the user centos cannot sudo on all of my agents. I can create somethings like this:

modules/sudoer/manifests/disable_sudo.pp

# Manage the sudoers file
class sudoers {
  file { '/etc/sudoers':
    source => 'puppet:///modules/sudoers/sudoers',
    mode => '0440', 
    owner => 'root',
    group => 'root',
  }
}   

And then create a modules/sudoers/files/sudoers file and put the content I like in there and make sure the centos line is commented out:

#centos ALL=(ALL)   NOPASSWD: ALL

But this is very lengthy and in puppet 3, I could only use sudo::disable_centos: true in the hiera. Is there a better way for letting puppet prevent the user centos from sudo? Thank you

0

There are 0 best solutions below