-
Notifications
You must be signed in to change notification settings - Fork 236
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for sshd_config include files (#390)
Add include_dir parameter for specifying an include directory at the top of sshd_config. Add ssh::server::config_file resource type for creating config files within the include directory. Provides include parameter for including externally managed config files. This is primarily intended for including crypto policies in RedHat 9 family. Add data for RedHat 9 family to add include directory and config file to load crypto policies for OpenSSH server by default.
- Loading branch information
1 parent
d835046
commit 698dd67
Showing
6 changed files
with
94 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
ssh::server::include_dir: '/etc/ssh/sshd_config.d' | ||
ssh::server::config_files: | ||
50-redhat: | ||
include: '/etc/crypto-policies/back-ends/opensshserver.config' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# @summary Resource type for managing a config file in the include dir. | ||
# | ||
# @param mode | ||
# File mode for the config file. | ||
# | ||
# @param include | ||
# Absolute path to config file to include at the top of the config file. This | ||
# is intended for including files not managed by this module (crypto policies). | ||
# | ||
# @param options | ||
# Dynamic hash for openssh server option | ||
# | ||
define ssh::server::config_file ( | ||
Stdlib::Absolutepath $path = "${ssh::server::include_dir}/${name}.conf", | ||
Stdlib::Filemode $mode = $ssh::server::sshd_config_mode, | ||
Optional[Stdlib::Absolutepath] $include = undef, | ||
Hash $options = {}, | ||
) { | ||
if !$ssh::server::include_dir { | ||
fail('ssh::server::config_file() define not supported if ssh::server::include_dir not set') | ||
} | ||
|
||
case $ssh::server::validate_sshd_file { | ||
true: { | ||
$sshd_validate_cmd = '/usr/sbin/sshd -tf %' | ||
} | ||
default: { | ||
$sshd_validate_cmd = undef | ||
} | ||
} | ||
|
||
concat { $path: | ||
ensure => present, | ||
owner => 0, | ||
group => 0, | ||
mode => $mode, | ||
validate_cmd => $sshd_validate_cmd, | ||
notify => Service[$ssh::server::service_name], | ||
} | ||
|
||
concat::fragment { "sshd_config_file ${title}": | ||
target => $path, | ||
content => template("${module_name}/sshd_config.erb"), | ||
order => '00', | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters