OP#561 add custom conf file

This commit is contained in:
2026-04-05 15:40:23 +02:00
parent 29fdd46341
commit 80cf3c0d47
3 changed files with 17 additions and 8 deletions

View File

@@ -24,7 +24,7 @@
## Features ## Features
- install required binaries - install required binaries
- manage configuration based on parameters - manage local custom configuration based on parameters, overriding the defaults
- manage service - manage service
- (optional) manage firewall - (optional) manage firewall

View File

@@ -10,8 +10,8 @@ class confdroid_ssh::main::files (
file { $sshd_config_path: file { $sshd_config_path:
ensure => file, ensure => file,
path => $sshd_config_path, path => $sshd_config_path,
owner => 'root', owner => $sshd_user,
group => 'root', group => $sshd_user,
mode => '0640', mode => '0640',
selrange => s0, selrange => s0,
selrole => object_r, selrole => object_r,
@@ -21,11 +21,17 @@ class confdroid_ssh::main::files (
} }
if $ssh_manage_config { if $ssh_manage_config {
file { "${ssh_etc_path}/sshd_config.d": file { $sshd_custom_conf:
ensure => directory, ensure => file,
owner => 'root', path => $sshd_custom_conf,
group => 'root', owner => $sshd_user,
group => $sshd_user,
mode => '0755', mode => '0755',
selrange => s0,
selrole => object_r,
seltype => etc_t,
seluser => system_u,
content => template($sshd_custom_erb),
} }
} }
} }

View File

@@ -8,6 +8,7 @@
# @param [String] ssh_fw_port port to use for SSHD and in fw # @param [String] ssh_fw_port port to use for SSHD and in fw
# @param [String] ssh_fw_order order of firewall rule # @param [String] ssh_fw_order order of firewall rule
# @param [String] ssh_source_range source range for firewall rule # @param [String] ssh_source_range source range for firewall rule
# @param [Boolean] ssh_manage_config whether to manage the configuration
############################################################################## ##############################################################################
class confdroid_ssh::params ( class confdroid_ssh::params (
@@ -36,6 +37,8 @@ class confdroid_ssh::params (
$sshd_service = 'sshd' $sshd_service = 'sshd'
$sshd_config_path = "${ssh_etc_path}/sshd_config" $sshd_config_path = "${ssh_etc_path}/sshd_config"
$sshd_custom_path = "${ssh_etc_path}/sshd_config.d" $sshd_custom_path = "${ssh_etc_path}/sshd_config.d"
$sshd_custom_conf = "${sshd_custom_path}/10-custom.conf"
$sshd_custom_erb = 'confdroid_ssh/ssh_custom_conf.erb'
$sshd_config_erb = 'confdroid_ssh/ssh_config.erb' $sshd_config_erb = 'confdroid_ssh/ssh_config.erb'
# includes must be last # includes must be last