Skip to content

Latest commit

 

History

History
683 lines (407 loc) · 18 KB

File metadata and controls

683 lines (407 loc) · 18 KB

Reference

Table of Contents

Classes

Defined types

Classes

sudo

File:: init.pp Author:: Sebastien Varrette (Sebastien.Varrette@uni.lu) Copyright:: Copyright (c) 2011 Sebastien Varrette License:: GPL-3.0


= Class: sudo

Configure and manage sudo and sudoers files

== Actions

Install and configure sudo

== Parameters (cf sudo-params.pp)

$ensure:: Default: 'present'. The Puppet ensure attribute (can be either 'present' or 'absent') absent will ensure the sudo package is removed $configfile:: Default: '/etc/sudoers'. The configuration file to use.

== Requires

n/a

== Sample Usage

include 'sudo'

You can then specialize the various aspects of the configuration, for instance

    class { 'sudo':
        configfile => '/tmp/sudoers'
    }

== Warnings

/!\ Always respect the style guide available here[http://docs.puppetlabs.com/guides/style_guide]

[Remember: No empty lines between comments and class definition]

Parameters

The following parameters are available in the sudo class:

ensure

Data type: Any

Default value: $sudo::params::ensure

configfile

Data type: Any

Default value: $sudo::params::configfile

sudo::common

File:: common.pp Author:: Sebastien Varrette (Sebastien.Varrette@uni.lu) Copyright:: Copyright (c) 2015 Sebastien Varrette (www[]) License:: GPLv3


= Class sudo::common

Base class to be inherited by the other sudo classes, containing the common code.

Note: respect the Naming standard provided here[http://projects.puppetlabs.com/projects/puppet/wiki/Module_Standards]

sudo::common::debian

File:: common/debian.pp Author:: Sebastien Varrette (sebastien.varrette@uni.lu) Copyright:: Copyright (c) 2015 Sebastien Varrette License:: GPL-3.0


= Class: sudo::common::debian

Specialization class for Debian systems

sudo::common::redhat

File:: common/redhat.pp Author:: Sebastien Varrette (sebastien.varrette@uni.lu) Copyright:: Copyright (c) 2015 Sebastien Varrette License:: GPL-3.0


= Class: sudo::common::debian

Specialization class for Redhat systems

sudo::params

File:: params.pp Author:: Sebastien Varrette (Sebastien.Varrette@uni.lu) Copyright:: Copyright (c) 2011 Sebastien Varrette License:: GPLv3

Time-stamp: <Ven 2014-09-05 21:43 svarrette>

= Class: sudo::params

In this class are defined as variables values that are used in other sudo classes. This class should be included, where necessary, and eventually be enhanced with support for more OS

== Warnings

/!\ Always respect the style guide available here[http://docs.puppetlabs.com/guides/style_guide]

The usage of a dedicated param classe is advised to better deal with parametrized classes, see http://docs.puppetlabs.com/guides/parameterized_classes.html

[Remember: No empty lines between comments and class definition]

Defined types

sudo::alias::command

File:: command.pp Author:: Sebastien Varrette (Sebastien.Varrette@uni.lu) Copyright:: Copyright (c) 2011 Sebastien Varrette (www[http://varrette.gforge.uni.lu]) License:: GPLv3


= Define: sudo::alias::command

Permits to define a command alias in the sudoers files (directive Cmnd_Alias) These are groups of related commands...

== Pre-requisites

  • The class 'sudo' should have been instanciated

== Parameters:

[ensure] default to 'present', can be 'absent' (BEWARE: it will remove the associated file) Default: 'present'

[commandlist] List of commands to add in the definition of the alias

== Examples

sudo::alias::command{ 'NETWORKING': cmdlist => [ '/sbin/route', '/sbin/ifconfig', '/bin/ping', '/sbin/dhclient', '/sbin/iptables' ] }

This will create the following entry in the sudoers files:

Networking

Cmnd_Alias NETWORKING = /sbin/route, /sbin/ifconfig, /bin/ping, /sbin/dhclient, /sbin/iptables

== Warnings

/!\ Always respect the style guide available here[http://docs.puppetlabs.com/guides/style_guide]

[Remember: No empty lines between comments and class definition]

Parameters

The following parameters are available in the sudo::alias::command defined type:

cmdlist

Data type: Any

Default value: []

ensure

Data type: Any

Default value: 'present'

sudo::alias::host

File:: host.pp Author:: Sebastien Varrette (Sebastien.Varrette@uni.lu) Copyright:: Copyright (c) 2011 Sebastien Varrette (www[http://varrette.gforge.uni.lu]) License:: GPLv3


= Define: sudo::alias::host

Permits to define a host alias in the sudoers files (directive Host_Alias)

== Pre-requisites

  • The class 'sudo' should have been instanciated

== Parameters:

[ensure] default to 'present', can be 'absent' Default: 'present'

[comment] A comment to be placed on top of the definition

[hostlist] List of hosts to add in the definition of the alias

[order] Placement order of the directive. Default: 20

== Examples

sudo::alias::host{ 'SERVERS': hostlist => [ '192.168.0.1', '192.168.0.2' ], comment => 'This is all the servers' } sudo::alias::host{ 'NETWORK': hostlist => [ '192.168.0.0/255.255.255.0' ] } sudo::alias::host{ 'WORKSTATIONS': hostlist => [ 'NETWORK', '!SERVER' ], comment => 'This is every machine in the network that is not a server' }

This will create the following entry in the sudoers files:

== Warnings

/!\ Always respect the style guide available here[http://docs.puppetlabs.com/guides/style_guide]

[Remember: No empty lines between comments and class definition]

Parameters

The following parameters are available in the sudo::alias::host defined type:

hostlist

Data type: Any

Default value: []

comment

Data type: Any

Default value: ''

ensure

Data type: Any

Default value: 'present'

sudo::alias::user

File:: user.pp Author:: Sebastien Varrette (Sebastien.Varrette@uni.lu) Copyright:: Copyright (c) 2011 Sebastien Varrette (www[http://varrette.gforge.uni.lu]) License:: GPLv3


= Define: sudo::alias::user

Permits to define a user alias in the sudoers files (directive User_Alias) These aren't often necessary, as you can use regular groups (ie, from files, LDAP, NIS, etc) in this file - just use %groupname rather than USERALIAS

== Pre-requisites

  • The class 'sudo' should have been instanciated

== Parameters:

[ensure] default to 'present', can be 'absent' Default: 'present'

[userlist] List of users to add in the definition of the alias

[order] Placement order of the directive. Default: 25

== Examples

sudo::alias::user{ 'ADMINS': userlist => [ 'jsmith', 'mikem' ] }

This will create the following entry in the sudoers files: User_Alias ADMINS = jsmith, mikem

== Warnings

/!\ Always respect the style guide available here[http://docs.puppetlabs.com/guides/style_guide]

[Remember: No empty lines between comments and class definition]

Parameters

The following parameters are available in the sudo::alias::user defined type:

userlist

Data type: Any

Default value: []

ensure

Data type: Any

Default value: 'present'

order

Data type: Any

Default value: 25

sudo::conf

File:: conf.pp Author:: Hyacinthe Cartiaux (Hyacinthe.Cartiaux@uni.lu) Copyright:: Copyright (c) 2020 Hyacinthe Cartiaux License:: GPLv3


= Define: sudo::conf

The definition sudo::conf is a compatibility definition for saz/sudo All parameters are passed to sudo::directive

== Pre-requisites

  • The class 'sudo' should have been instanciated

== Parameters:

[ensure] default to 'present', can be 'absent' (BEWARE: it will remove the associated file) Default: 'present'

[content] Specify the contents of the Defaults directive as a string. Newlines, tabs, and spaces can be specified using the escaped syntax (e.g., \n for a newline) Note that each line SHOULD start by 'Defaults' -- see sudoers(5)

[source] Copy a file as the content of the Defaults directive. Uses checksum to determine when a file should be copied. Valid values are either fully qualified paths to files, or URIs. Currently supported URI types are puppet and file. If content was not specified, you are expected to use the source

[priority] This parameter is ignored

[*sudo_file_name] Name of the file in /etc/sudoers.d. If empty, $name is used

== Examples

   sudo::conf {'admin_users':
      content => "%admin ALL=(ALL) ALL\n",
   }

== Warnings

/!\ Always respect the style guide available here[http://docs.puppetlabs.com/guides/style_guide]

[Remember: No empty lines between comments and class definition]

Parameters

The following parameters are available in the sudo::conf defined type:

content

Data type: Any

Default value: ''

source

Data type: Any

Default value: ''

priority

Data type: Any

Default value: 0

sudo_file_name

Data type: Any

Default value: ''

ensure

Data type: Any

Default value: 'present'

sudo::defaults::spec

File:: spec.pp Author:: Sebastien Varrette (Sebastien.Varrette@uni.lu) Copyright:: Copyright (c) 2011 Sebastien Varrette (www[http://varrette.gforge.uni.lu]) License:: GPLv3


= Define: sudo::defaults::spec

Permits to define a default specifications

== Pre-requisites

  • The class 'sudo' should have been instanciated

== Parameters:

[ensure] default to 'present', can be 'absent' Default: 'present'

[content] Specify the contents of the Defaults directive as a string. Newlines, tabs, and spaces can be specified using the escaped syntax (e.g., \n for a newline) Note that each line SHOULD start by 'Defaults' -- see sudoers(5)

[source] Copy a file as the content of the Defaults directive. Uses checksum to determine when a file should be copied. Valid values are either fully qualified paths to files, or URIs. Currently supported URI types are puppet and file. If content was not specified, you are expected to use the source

== Examples

   sudo::defaults::spec { 'env_keep':
   content => "

Defaults env_reset Defaults env_keep = "COLORS DISPLAY HOSTNAME LS_COLORS" Defaults env_keep += "MAIL PS1 PS2 USERNAME LANG LC_ADDRESS LC_CTYPE" Defaults env_keep += "LC_COLLATE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES" Defaults env_keep += "LC_TIME LC_ALL LANGUAGE"\n", }

This will create the following entry in the sudoers files:

Defaults env_reset Defaults env_keep = "COLORS DISPLAY HOSTNAME LS_COLORS" Defaults env_keep += "MAIL PS1 PS2 USERNAME LANG LC_ADDRESS LC_CTYPE" Defaults env_keep += "LC_COLLATE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES" Defaults env_keep += "LC_TIME LC_ALL LANGUAGE"

== Warnings

/!\ Always respect the style guide available here[http://docs.puppetlabs.com/guides/style_guide]

[Remember: No empty lines between comments and class definition]

Parameters

The following parameters are available in the sudo::defaults::spec defined type:

content

Data type: Any

Default value: ''

source

Data type: Any

Default value: ''

ensure

Data type: Any

Default value: 'present'

sudo::directive

File:: directive.pp Author:: Sebastien Varrette (Sebastien.Varrette@uni.lu) Copyright:: Copyright (c) 2011 Sebastien Varrette (www[http://varrette.gforge.uni.lu]) License:: GPLv3


= Define: sudo::directive

The definition sudo::directive provides a simple way to write sudo configurations parts. If you want do define aliases for users (resp. commands), consider using sudo::alias::user (resp. sudo::alias::command). If you want to configure 'Defaults' specifications, consider using sudo::defaults::spec. If you use a sudo version >= 1.7.2, the sudo directive part is validated via visudo and removed if syntax is not correct.

== Pre-requisites

  • The class 'sudo' should have been instanciated

== Parameters:

[ensure] default to 'present', can be 'absent' (BEWARE: it will remove the associated file) Default: 'present'

[content] Specify the contents of the Defaults directive as a string. Newlines, tabs, and spaces can be specified using the escaped syntax (e.g., \n for a newline) Note that each line SHOULD start by 'Defaults' -- see sudoers(5)

[source] Copy a file as the content of the Defaults directive. Uses checksum to determine when a file should be copied. Valid values are either fully qualified paths to files, or URIs. Currently supported URI types are puppet and file. If content was not specified, you are expected to use the source

== Examples

   sudo::directive {'admin_users':
      content => "%admin ALL=(ALL) ALL\n",
   }

== Warnings

/!\ Always respect the style guide available here[http://docs.puppetlabs.com/guides/style_guide]

[Remember: No empty lines between comments and class definition]

Parameters

The following parameters are available in the sudo::directive defined type:

content

Data type: Any

Default value: ''

source

Data type: Any

Default value: ''

ensure

Data type: Any

Default value: 'present'