OP#78 add define

This commit is contained in:
2026-04-14 16:20:49 +02:00
parent 1e52fd312d
commit 5508f5a51f
3 changed files with 43 additions and 1 deletions

View File

@@ -25,7 +25,7 @@
## Features ## Features
- install required binaries - install required binaries
- manage required files and directories including selinux context - manage required files and directories including selinux context
- manage service - manage service
- (optional) manage firewall - (optional) manage firewall

View File

@@ -0,0 +1,34 @@
## confdroid_ssh::custom::custom_config.pp
# Module name: confdroid_ssh
# Author: 12ww1160 (12ww1160@confdroid.com)
# @summary Class manages custom configurations for SSH
# @param [String] config_name name of the custom configuration file
# (without .conf extension)
# @param [Array[String]] config_content array of configuration lines to
# include in the custom config
##############################################################################
define confdroid_ssh::custom::custom_config (
String $config_name,
Array[String] $config_content,
) {
$sshd_custom_path = $confdroid_ssh::params::sshd_custom_path
$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"
file { "${sshd_custom_path}/${config_file}":
ensure => file,
content => template($custom_config_erb),
owner => 'root',
group => 'root',
mode => '0600',
selrange => s0,
selrole => object_r,
seltype => etc_t,
seluser => system_u,
notify => Service[$sshd_service],
}
}

View File

@@ -0,0 +1,8 @@
###############################################################################
##### DO NOT EDIT THIS FILE MANUALLY #
##### This file is managed by Puppet. Any changes to this file will be #
##### overwritten. Update the Puppet define input instead. #
###############################################################################
<% @config_content.each do |config_line| -%>
<%= config_line %>
<% end -%>