OP#78 define is added and tested working

This commit is contained in:
2026-04-14 17:01:44 +02:00
parent 5508f5a51f
commit af538bb0e9
2 changed files with 33 additions and 3 deletions

View File

@@ -6,6 +6,13 @@
# (without .conf extension)
# @param [Array[String]] config_content array of configuration lines to
# include in the custom config
# @example
# confdroid_ssh::custom::custom_config { '50-test':
# config_name => '50-test',
# config_content => ['PasswordAuthentication no'],
# }
# this will create a file called /etc/ssh/sshd_config.d/50-test.conf with the content:
# PasswordAuthentication no and notify the sshd service to reload the configuration
##############################################################################
define confdroid_ssh::custom::custom_config (
@@ -17,11 +24,10 @@ define confdroid_ssh::custom::custom_config (
$sshd_service = $confdroid_ssh::params::sshd_service
$custom_config_erb = 'confdroid_ssh/custom_config.erb'
$config_basename = regsubst($config_name, '\\.conf$', '')
$config_file = "${config_basename}.conf"
$config_file = "${config_name}.conf"
file { "${sshd_custom_path}/${config_file}":
ensure => file,
content => template($custom_config_erb),
owner => 'root',
group => 'root',
mode => '0600',
@@ -29,6 +35,7 @@ define confdroid_ssh::custom::custom_config (
selrole => object_r,
seltype => etc_t,
seluser => system_u,
content => template($custom_config_erb),
notify => Service[$sshd_service],
}
}