diff --git a/README.md b/README.md index 9f71fed..e2b0d65 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ This "root" module simply define few preferences for the root user. ### What root affects * Root's configuration files (/root/.profile, /root/.bashrc,…). +* Root's mail can be forward to other addresses. ### Beginning with root @@ -51,6 +52,16 @@ class { 'root': Then, every connection from 10.10.10.1 or 192.168.0.42 will automatically have ZSH as default shell. +### Forward mail + +Root's mail can be forward to other addresses. You can specify thoses addresses with the ADDRESS_TO_FORWARD argument : + +``` +class { 'root': + address_to_forward => 'username@domain.org,firstname.lastname@other-domain.org', +} +``` + ## Reference ### Classes @@ -63,6 +74,9 @@ Then, every connection from 10.10.10.1 or 192.168.0.42 will automatically have Z * `profile_content` : Template file used to generate the previous configuration file. Defaults to 'root/preferences/profile.erb'. * `bashrc_path` : Path to the Bash's rcfile. Defaults to '/root/.bashrc'. * `bashrc_content` : Template file used to generate the previous configuration file. Default to 'root/preferences/bashrc.erb'. +* `forward_path` : Path to the forward file. Defaults to '/root/.forward'. +* `forward_content` : Template file used to generate the previous configuration file. Default to 'root/preferences/forward.erb'. +* `address_to_forward` : List of addresses that must receive root's mails. Default to ''. * `default_shell_path` : Path to a bin file to use as default shell for root. Defaults to '/bin/bash'. * `ip_zsh` : A regex to determine if a ssh client should have ZSH as default shell. Defaults to '127.0.0.1'. diff --git a/manifests/config.pp b/manifests/config.pp index 1d5f955..a0de6c9 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -19,6 +19,12 @@ class root::config { content => template($root::bashrc_content), } + # Mail + file { $root::forward_path: + ensure => present, + content => template($root::forward_content), + } + # Shell user { 'root': shell => "${root::default_shell_path}", diff --git a/manifests/init.pp b/manifests/init.pp index 3adaee9..36b1fb9 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -41,6 +41,9 @@ class root ( $bashrc_path = $root::params::bashrc_path, $bashrc_content = $root::params::bashrc_content, $bashrc_content = $root::params::bashrc_content, + $forward_path = $root::params::forward_path, + $forward_content = $root::params::forward_content, + $address_to_forward = $root::params::address_to_forward, $default_shell_path = $root::params::default_shell_path, $ip_zsh = $root::params::ip_zsh, ) inherits root::params { diff --git a/manifests/params.pp b/manifests/params.pp index f59f4ab..4246b3f 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -9,6 +9,11 @@ class root::params { $bashrc_path = '/root/.bashrc' $bashrc_content = 'root/preferences/bashrc.erb' + # Mail + $forward_path = '/root/.forward' + $forward_content = 'root/preferences/forward.erb' + $address_to_forward = '' + # Shell $default_shell_path = '/bin/bash' # For those IP, auto-launch ZSH as default shell diff --git a/templates/preferences/forward.erb b/templates/preferences/forward.erb new file mode 100644 index 0000000..997f528 --- /dev/null +++ b/templates/preferences/forward.erb @@ -0,0 +1 @@ +<%= scope.lookupvar('root::address_to_forward') %>