Version information
This version is compatible with:
- Puppet Enterprise 2023.2.x, 2023.1.x, 2023.0.x, 2021.7.x, 2021.6.x, 2021.5.x, 2021.4.x, 2021.3.x, 2021.2.x, 2021.1.x, 2021.0.x, 2019.8.x, 2019.7.x, 2019.5.x, 2019.4.x, 2019.3.x, 2019.2.x, 2019.1.x, 2019.0.x
- Puppet >= 6.0.0 < 8.0.0
- , ,
Start using this module
Add this module to your Puppetfile:
mod 'treydock-root', '5.0.0'
Learn more about managing modules with a PuppetfileDocumentation
puppet-root
Table of Contents
- Overview
- Usage - Configuration options
- Reference - Parameter and detailed reference to all options
- Limitations - OS compatibility, etc.
- Development - Guide for contributing to the module
Overview
This module manages the Linux root user.
Puppet 6 has soft dependencies on the following modules:
Usage
root
include ::root
Manage root and define mailaliases, ssh_authorized_keys and set a password.
root::mailaliases:
- 'root@example.com'
root::password: '$1$Bp8B.dWo$DUVekjsAsU0ttWZmS37P5'
root::ssh_authorized_keys:
- 'ssh-rsa somelonghash== user@fqdn'
Authorized keys can also be set using a hash.
root::ssh_authorized_keys:
user@fqdn:
type: 'ssh-rsa'
key: 'somelonghash=='
To export a system's root RSA key
root::export_key: true
To collect exported root RSA keys from multiple tags
root::collect_exported_keys: true
root::collect_exported_keys_tags:
- "${::domain}"
- 'foo'
Add Kerberos principals to /root/.k5login
:
root::kerberos_login_principals:
- user1@EXAMPLE.COM
- user2@EXAMPLE.COM
Add Kerberos principals and commands to /root/.k5users
. Note that user3 and user4 will not have commands defined. The examples also illustrate defining commands as strings or arrays.
root::kerberos_users_commands:
user1@EXAMPLE.COM:
- /bin/systemctl
- /bin/cat
user2@EXAMPLE.COM: /bin/systemctl /bin/cat
user3@EXAMPLE.COM: ''
user4@EXAMPLE.COM: []
If a different module manages Kerberos for root, disable Kerberos in this module:
root::manage_kerberos: false
Set an automatic logout for idle interactive shells (in seconds):
root::logout_timeout: 600
Reference
http://treydock.github.io/puppet-module-root/
Limitations
This module has been tested on:
- RedHat & CentOS 6 x86_64
- RedHat & CentOS 7 x86_64
Development
Testing
Testing requires the following dependencies:
- rake
- bundler
Install gem dependencies
bundle install
Run unit tests
bundle exec rake test
If you have Vagrant >= 1.2.0 installed you can run system tests
bundle exec rake acceptance
Reference
Table of Contents
Classes
Public Classes
root
: Manage root user
Private Classes
root::kerberos
: Private classroot::params
: Private classroot::rsakey::export
: Private class
Defined types
Public Defined types
root::ssh_authorized_key
: Define root user's ssh_authorized_key resources
Private Defined types
root::rsakey::collect
: Private class
Classes
root
Manage root user
Examples
include ::root
Parameters
The following parameters are available in the root
class:
mailaliases
mailaliases_hiera_merge
ssh_authorized_keys
ssh_authorized_keys_hiera_merge
password
purge_ssh_keys
export_key
export_key_options
export_key_tag
collect_exported_keys
collect_exported_keys_tags
ssh_private_key_source
ssh_public_key_source
logout_timeout
manage_kerberos
kerberos_login_principals_hiera_merge
kerberos_login_principals
kerberos_users_commands_hiera_merge
kerberos_users_commands
mailaliases
Data type: Array
An array that defines mailaliases for the root user (defaults to an empty array).
When an empty array is given Mailaliases[root] is set to ensure => absent
.
Default value: []
mailaliases_hiera_merge
Data type: Boolean
Boolean that determines if the Hiera lookup merging is used for root::mailaliases
values.
Default value: true
ssh_authorized_keys
Data type: Variant[Array, Hash]
Defines ssh_autorized_keys to be passed to the root::ssh_authorized_key
defined type.
See root::ssh_authorized_key
for examples of valid formats
Default value: {}
ssh_authorized_keys_hiera_merge
Data type: Boolean
Boolean that determines if the Hiera lookup merging root::ssh_authorized_keys
values.
Default value: true
password
Data type: Optional[String]
The password hash used for the root account.
Default value: undef
purge_ssh_keys
Data type: Boolean
Sets if unmanaged SSH keys will be purged for the root account.
Default value: true
export_key
Data type: Boolean
Sets if the root SSH RSA key should be created and exported.
Default value: false
export_key_options
Data type: Optional[Array]
Options to set for the exported SSH RSA key
Default value: undef
export_key_tag
Data type: String
The tag to use when exporting the root SSH RSA key.
Default value: $::domain
collect_exported_keys
Data type: Boolean
Sets if the export root SSH RSA keys should be collected.
Default value: false
collect_exported_keys_tags
Data type: Array
Array of tags for root SSH RSA keys to collect.
Default value: [$::domain]
ssh_private_key_source
Data type: Optional[String]
The source for root's SSH RSA private key
Default value: undef
ssh_public_key_source
Data type: Optional[String]
The source for root's SSH RSA public key
Default value: undef
logout_timeout
Data type: Optional[Integer[0, default]]
Time (in seconds) before idle interactive terminals will logout
Default value: undef
manage_kerberos
Data type: Boolean
Boolean that sets if Kerberos files should be managed
Default value: true
kerberos_login_principals_hiera_merge
Data type: Boolean
Boolean that determines if the Hiera lookup merging root::kerberos_login_principals
values.
Default value: true
kerberos_login_principals
Data type: Array
The Kerberos principals to write to /root/.k5login
Default value: []
kerberos_users_commands_hiera_merge
Data type: Boolean
Boolean that determines if the Hiera lookup merging root::kerberos_users_commands
values.
Default value: true
kerberos_users_commands
Data type: Hash[String[1], Variant[String, Array]]
The Kerberos user principals and commands to write to /root/.k5users
Default value: {}
Defined types
root::ssh_authorized_key
Define root user's ssh_authorized_key resources
Examples
Define ssh_authorized_key using Hash
root::ssh_authorized_key { 'user@fqdn':
type => 'ssh-rsa',
key => 'somelonghash==',
}
Define ssh_authorized_key using name string
root::ssh_authorized_key { 'ssh-rsa somelonghash== user@fqdn': }
Parameters
The following parameters are available in the root::ssh_authorized_key
defined type:
ensure
Data type: Any
ssh_authorized_key ensure property
Default value: 'present'
key
Data type: Any
The SSH key hash
Default value: 'UNSET'
options
Data type: Any
The SSH key options
Default value: 'UNSET'
type
Data type: Any
The type of SSH key.
Default value: 'UNSET'
Change log
All notable changes to this project will be documented in this file. The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
v5.0.0 (2022-03-15)
Changed
v4.6.0 (2020-10-26)
Added
v4.5.0 (2020-10-21)
Added
v4.4.0 (2020-09-18)
Added
v4.3.0 (2020-05-12)
Added
v4.2.0 (2019-10-03)
Added
v4.1.1 (2019-05-09)
Added
Fixed
v4.1.0 (2019-05-07)
4.0.0 (2019-03-22)
3.0.0 (2017-10-26)
2.0.0 (2017-10-26)
1.0.0 (2014-05-09)
v0.0.3 (2013-06-12)
v0.0.2 (2013-05-14)
v0.0.1 (2013-05-14)
* This Changelog was automatically generated by github_changelog_generator
Dependencies
- puppetlabs/stdlib (>= 4.13.1 <9.0.0)
- puppetlabs/mailalias_core (>= 1.0.0 <2.0.0)
- puppetlabs/sshkeys_core (>= 1.0.0 <3.0.0)
Copyright (C) 2014 Trey Dockendorf <treydock@tamu.edu> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.