sudoers
A simple template to semantically manage allowed commands in sudoers.d
Version information
released Feb 6th 2017
Start using this module
Add this module to your Puppetfile:
mod 'phinze-sudoers', '0.1.3'
Learn more about managing modules with a PuppetfileDocumentation
phinze/sudoers — version 0.1.3 Feb 6th 2017
sudoers::allowed_command
Puppet module for creating sudoers user specifications
Install
Using the Puppet Module Tool:
$ puppet module install phinze/sudoers
As a git submodule:
$ git submodule add git@github.com:phinze/puppet-sudoers.git modules/sudoers
Usage
The following puppet declaration:
sudoers::allowed_command{ "acme":
command => "/usr/sbin/service",
user => "acme",
require_password => false,
comment => "Allows access to the service command for the acme user"
}
Creates the file:
# /etc/sudoers.d/acme
acme ALL=(root) NOPASSWD: /usr/sbin/service
As user 'acme' you can now run the service command without a password, eg:
$ sudo service rsyslog restart
Parameters
The allowed_command
type takes the following options (with defaults in brackets):
[*command*] - the command you want to give access to, eg. '/usr/sbin/service'
[*filename*] - the name of the file to be placed in /etc/sudoers.d/ ($title)
[*host*] - hosts which can run command (ALL)
[*run_as*] - user to run the command as (root)
[*user*] - user to give access to
[*group*] - group to give access to
[*require_password*] - require user to give password, setting to false sets 'NOPASSWD:' (true)
[*comment*] - comment to add to the file
[*allowed_env_variables*] - allowed list of env variables ([])
[*require_exist*] - Require the Group or User to exist. Setting this to false for example is needed if the user groups come from Active Directory. (true)
[*no_tty*] - remove default tty requirement (false)
The MIT License (MIT) Copyright (c) 2016 Paul Hinze Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.