* Add the display of the Motd upon successful ssh login.
This commit is contained in:
parent
7416d97298
commit
1178ec827d
|
@ -16,6 +16,8 @@
|
|||
* Edit script's name: an underscore (_) in the name prevent the script to runs.
|
||||
* Add a template to manage the static motd (/etc/motd).
|
||||
* Rename the ::config class into ::install, because it's provide and install everything to have dynamic Motd.
|
||||
* Add the display of the Motd upon successful ssh login.
|
||||
|
||||
|
||||
---------------------------------------
|
||||
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
# == Class: dynmotd::config
|
||||
#
|
||||
# Configure the display of the Motd
|
||||
#
|
||||
class dynmotd::config {
|
||||
|
||||
# Need to print Motd upon successful ssh login
|
||||
if $dynmotd::print_motd_ssh == true {
|
||||
augeas { 'print_motd_ssh':
|
||||
context => '/files/etc/pam.d/sshd',
|
||||
changes => [
|
||||
"set *[module = 'pam_motd.so']/argument motd=${dynmotd::dynmotd_path}",
|
||||
],
|
||||
onlyif => "match *[argument = 'motd=${dynmotd::dynmotd_path}'] size == 0",
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} # Private class: dynmotd::config
|
|
@ -36,6 +36,7 @@
|
|||
# Copyright 2015 Your name here, unless otherwise noted.
|
||||
#
|
||||
class dynmotd (
|
||||
$dynmotd_path = $dynmotd::params::dynmotd_path,
|
||||
$update_motd_dir_path = $dynmotd::params::update_motd_dir_path,
|
||||
$system_info_script_name = $dynmotd::params::system_info_script_name,
|
||||
$system_info_script_content = $dynmotd::params::system_info_script_content,
|
||||
|
@ -49,8 +50,13 @@ class dynmotd (
|
|||
$service_info_script_content = $dynmotd::params::service_info_script_content,
|
||||
$static_motd_path = $dynmotd::params::static_motd_path,
|
||||
$static_motd_content = $dynmotd::params::static_motd_content,
|
||||
$print_motd_ssh = $dynmotd::params::print_motd_ssh,
|
||||
) inherits dynmotd::params {
|
||||
|
||||
include dynmotd::install
|
||||
include dynmotd::config
|
||||
|
||||
Class['dynmotd::install'] ->
|
||||
Class['dynmotd::config']
|
||||
|
||||
} # Public class: dynmotd
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
class dynmotd::params {
|
||||
case $::osfamily {
|
||||
'Debian': {
|
||||
# The dynamic Motd provide by the update motd directory
|
||||
$dynmotd_path = '/var/run/motd'
|
||||
|
||||
# Dynamic Motd's script directory
|
||||
$update_motd_dir_path = '/etc/update-motd.d'
|
||||
|
@ -23,6 +25,9 @@ class dynmotd::params {
|
|||
$static_motd_path = '/etc/motd'
|
||||
$static_motd_content = 'dynmotd/static_motd.erb'
|
||||
|
||||
# Print Motd
|
||||
$print_motd_ssh = true
|
||||
|
||||
}
|
||||
}
|
||||
} # Private class: dynmotd::params
|
||||
|
|
Loading…
Reference in New Issue