Article 4RNSM Efficient way to disable a user to sudo via puppet

Efficient way to disable a user to sudo via puppet

by
sparkling
from LinuxQuestions.org on (#4RNSM)
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:

Code: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:

Code:#centos ALL=(ALL) NOPASSWD: ALLBut 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 youlatest?d=yIl2AUoC8zA latest?i=YxwZBXrCIjc:WIeTV8kH4Go:F7zBnMy latest?i=YxwZBXrCIjc:WIeTV8kH4Go:V_sGLiP latest?d=qj6IDK7rITs latest?i=YxwZBXrCIjc:WIeTV8kH4Go:gIN9vFwYxwZBXrCIjc
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments