Showing with 4,269 additions and 771 deletions.
  1. +4 −2 .github/workflows/ci.yaml
  2. +11 −3 CHANGELOG.md
  3. +9 −18 Gemfile
  4. +69 −0 README.md
  5. +1,148 −718 REFERENCE.md
  6. +1 −1 Rakefile
  7. +12 −0 data/os/Archlinux.yaml
  8. +1 −0 data/os/Debian/10.yaml
  9. +1 −0 data/os/Debian/11.yaml
  10. +1 −0 data/os/RedHat/7.yaml
  11. +1 −0 data/os/RedHat/8.yaml
  12. +30 −0 data/os/RedHat/9.yaml
  13. +1 −0 data/os/SLED/10.yaml
  14. +1 −0 data/os/SLED/11.yaml
  15. +1 −0 data/os/SLED/12.yaml
  16. +1 −0 data/os/SLED/15.yaml
  17. +1 −0 data/os/SLES/10.yaml
  18. +1 −0 data/os/SLES/11.yaml
  19. +1 −0 data/os/SLES/12.yaml
  20. +1 −0 data/os/SLES/15.yaml
  21. +1 −0 data/os/Solaris/10.yaml
  22. +1 −0 data/os/Solaris/11.yaml
  23. +1 −0 data/os/Solaris/9.yaml
  24. +1 −0 data/os/Ubuntu/18.04.yaml
  25. +1 −0 data/os/Ubuntu/20.04.yaml
  26. +25 −0 data/os/Ubuntu/22.04.yaml
  27. +4 −0 hiera.yaml
  28. +47 −0 manifests/config_file_client.pp
  29. +47 −0 manifests/config_file_server.pp
  30. +47 −2 manifests/init.pp
  31. +47 −1 manifests/server.pp
  32. +44 −3 metadata.json
  33. +2 −0 spec/acceptance/nodesets/centos-7.yml
  34. +25 −0 spec/acceptance/nodesets/rocky-9.yml
  35. +21 −0 spec/acceptance/nodesets/ubuntu-2204.yml
  36. +5 −5 spec/classes/init_data_types_spec.rb
  37. +2 −3 spec/classes/init_params_spec.rb
  38. +123 −6 spec/classes/init_spec.rb
  39. +2 −2 spec/classes/server_data_types_spec.rb
  40. +2 −2 spec/classes/server_params_spec.rb
  41. +134 −5 spec/classes/server_spec.rb
  42. +312 −0 spec/defines/config_file_client_spec.rb
  43. +312 −0 spec/defines/config_file_server_spec.rb
  44. +5 −0 spec/fixtures/testing/Archlinux-_ssh_config
  45. +10 −0 spec/fixtures/testing/Archlinux-_sshd_config
  46. +6 −0 spec/fixtures/testing/RedHat-9_ssh_config
  47. +7 −0 spec/fixtures/testing/RedHat-9_ssh_config.d
  48. +8 −0 spec/fixtures/testing/RedHat-9_sshd_config
  49. +11 −0 spec/fixtures/testing/RedHat-9_sshd_config.d
  50. +11 −0 spec/fixtures/testing/Ubuntu-22.04_ssh_config
  51. +14 −0 spec/fixtures/testing/Ubuntu-22.04_sshd_config
  52. +46 −0 spec/fixtures/untouched/Archlinux-2023-01-30_ssh_config
  53. +116 −0 spec/fixtures/untouched/Archlinux-2023-01-30_sshd_config
  54. +52 −0 spec/fixtures/untouched/RedHat-8_ssh_config
  55. +144 −0 spec/fixtures/untouched/RedHat-8_sshd_config
  56. +55 −0 spec/fixtures/untouched/RedHat-9_ssh_config
  57. +15 −0 spec/fixtures/untouched/RedHat-9_ssh_config.d-50-redhat.conf
  58. +130 −0 spec/fixtures/untouched/RedHat-9_sshd_config
  59. +22 −0 spec/fixtures/untouched/RedHat-9_sshd_config.d-50-redhat.conf
  60. +53 −0 spec/fixtures/untouched/Ubuntu-22.04_ssh_config
  61. +123 −0 spec/fixtures/untouched/Ubuntu-22.04_sshd_config
  62. +377 −0 spec/type_aliases/ssh_config_spec.rb
  63. +339 −0 spec/type_aliases/sshd_config_spec.rb
  64. +13 −0 templates/config_file.epp
  65. +2 −0 templates/ssh_config.erb
  66. +104 −0 types/ssh_config.pp
  67. +104 −0 types/sshd_config.pp
6 changes: 4 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ jobs:
fail-fast: false
matrix:
include:
- ruby: 2.7.0
- ruby: 2.7.6
puppet: 7
fixtures: .fixtures.yml
allow_failure: false
- ruby: 2.7.0
- ruby: 2.7.6
puppet: 7
fixtures: .fixtures-latest.yml
allow_failure: true
Expand Down Expand Up @@ -50,7 +50,9 @@ jobs:
- "debian-10"
- "centos-7"
- "rocky-8"
- "rocky-9"
- "ubuntu-1804"
- "ubuntu-2204"
puppet:
- "puppet7"
env:
Expand Down
14 changes: 11 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org).

## [v4.1.0](https://github.com/ghoneycutt/puppet-module-ssh/tree/v4.1.0) (2023-04-06)

[Full Changelog](https://github.com/ghoneycutt/puppet-module-ssh/compare/v4.0.0...v4.1.0)

### UNCATEGORIZED PRS; LABEL THEM ON GITHUB

- OS support updates and manage config.d files [\#402](https://github.com/ghoneycutt/puppet-module-ssh/pull/402) ([treydock](https://github.com/treydock))

## [v4.0.0](https://github.com/ghoneycutt/puppet-module-ssh/tree/v4.0.0) (2022-11-28)

[Full Changelog](https://github.com/ghoneycutt/puppet-module-ssh/compare/v3.62.0...v4.0.0)
Expand Down Expand Up @@ -78,7 +86,7 @@ All notable changes to this project will be documented in this file. The format
### UNCATEGORIZED PRS; LABEL THEM ON GITHUB

- Disable ServerkeyBits on RHEL 7.4 and later [\#278](https://github.com/ghoneycutt/puppet-module-ssh/pull/278) ([tuxmea](https://github.com/tuxmea))
- Fixing an inaccuracy within README.md [\#266](https://github.com/ghoneycutt/puppet-module-ssh/pull/266) ([zyamada](https://github.com/zyamada))
- Fixing an inaccuracy within README.md [\#266](https://github.com/ghoneycutt/puppet-module-ssh/pull/266) ([meowomancer](https://github.com/meowomancer))

## [v3.57.0](https://github.com/ghoneycutt/puppet-module-ssh/tree/v3.57.0) (2017-12-11)

Expand Down Expand Up @@ -558,7 +566,6 @@ All notable changes to this project will be documented in this file. The format

- Add macs params [\#72](https://github.com/ghoneycutt/puppet-module-ssh/pull/72) ([ghoneycutt](https://github.com/ghoneycutt))
- Add ability to specify Ciphers option in ssh\_config and sshd\_config [\#71](https://github.com/ghoneycutt/puppet-module-ssh/pull/71) ([ghoneycutt](https://github.com/ghoneycutt))
- Add StrictModes parameter for sshd [\#68](https://github.com/ghoneycutt/puppet-module-ssh/pull/68) ([ghoneycutt](https://github.com/ghoneycutt))

## [v3.12.0](https://github.com/ghoneycutt/puppet-module-ssh/tree/v3.12.0) (2014-05-22)

Expand All @@ -574,6 +581,7 @@ All notable changes to this project will be documented in this file. The format

### UNCATEGORIZED PRS; LABEL THEM ON GITHUB

- Add StrictModes parameter for sshd [\#68](https://github.com/ghoneycutt/puppet-module-ssh/pull/68) ([ghoneycutt](https://github.com/ghoneycutt))
- Add version dependency to firewall module to support Forge [\#65](https://github.com/ghoneycutt/puppet-module-ssh/pull/65) ([ghoneycutt](https://github.com/ghoneycutt))

## [v3.10.0](https://github.com/ghoneycutt/puppet-module-ssh/tree/v3.10.0) (2014-05-16)
Expand Down Expand Up @@ -721,4 +729,4 @@ All notable changes to this project will be documented in this file. The format



\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
27 changes: 9 additions & 18 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,23 @@ ruby_version_segments = Gem::Version.new(RUBY_VERSION.dup).segments
minor_version = ruby_version_segments[0..1].join('.')

group :development do
gem "facter", '< 4.0', require: false
gem "fast_gettext", '1.1.0', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.1.0')
gem "fast_gettext", require: false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.1.0')
gem "json_pure", '<= 2.0.1', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0')
gem "json", '= 1.8.1', require: false if Gem::Version.new(RUBY_VERSION.dup) == Gem::Version.new('2.1.9')
gem "json", '= 2.0.4', require: false if Gem::Requirement.create('~> 2.4.2').satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "json", '= 2.1.0', require: false if Gem::Requirement.create(['>= 2.5.0', '< 2.7.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "puppet-module-posix-default-r#{minor_version}", '~> 1.0', require: false, platforms: [:ruby]
gem "puppet-module-posix-dev-r#{minor_version}", '~> 1.0', require: false, platforms: [:ruby]
gem "puppet-module-win-default-r#{minor_version}", '~> 1.0', require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "puppet-module-win-dev-r#{minor_version}", '~> 1.0', require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "puppet-lint-param-docs", require: false
gem "voxpupuli-puppet-lint-plugins", '>= 3.0', require: false
gem "github_changelog_generator", require: false, git: 'https://github.com/skywinder/github-changelog-generator', ref: '20ee04ba1234e9e83eb2ffb5056e23d641c7a018' if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2')
gem "voxpupuli-test", '5.4.1', require: false
gem "faraday", '~> 1.0', require: false
gem "github_changelog_generator", require: false
gem "puppet-blacksmith", require: false
gem "puppet-strings", require: false
gem "rubocop-performance", require: false
end
group :system_tests do
gem "puppet-module-posix-system-r#{minor_version}", '~> 0.5', require: false, platforms: [:ruby]
gem "puppet-module-win-system-r#{minor_version}", '~> 0.5', require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "beaker", *location_for(ENV['BEAKER_VERSION'] || '~> 4.0')
gem "beaker", *location_for(ENV['BEAKER_VERSION'] || '~> 4.29')
gem "beaker-abs", *location_for(ENV['BEAKER_ABS_VERSION'] || '~> 0.1')
gem "beaker-pe", require: false
gem "beaker-hostgenerator"
gem "beaker-rspec"
gem "beaker-docker"
gem "beaker-puppet"
gem "beaker-puppet_install_helper", require: false
gem "beaker-module_install_helper", require: false
end

puppet_version = ENV['PUPPET_GEM_VERSION']
Expand Down
69 changes: 69 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,15 @@ known to work on many, many platforms since its creation in 2010.

### Known to work

* Archlinux
* Debian 10
* Debian 11
* EL 7
* EL 8
* EL 9
* Ubuntu 18.04 LTS
* Ubuntu 20.04 LTS
* Ubuntu 22.04 LTS
* Solaris 10
* Solaris 11

Expand Down Expand Up @@ -115,6 +118,72 @@ ssh::config_entry { 'jenkins github.com':
}
```

# Manage configurations files in .d directories
SSH supports configuration files in .d directories via the `include` directive. This module enables you to also manage these files. You need to set directives for the server (eg: /etc/ssh/sshd_config.d) and client (eg: /etc/ssh/ssh_config.d) part seperatly as they support different directives.

You can activate the management by ensuring `$include` is defined and pass a hash with the needed SSH directives and their values.
Directives can be passed as hash via the `$ssh::config_files` and `$ssh::server::config_files` parameters. Directives passed as hash via `lines` will be checked for correct names and values. Directives passed as array via `custom` will not be checked and will be added to the configuration file. Similar to the main configuration files.

Different file permissions can be specified via `owner`, `group`, or `mode`.
You can remove a file by setting `ensure` to `absent`.

## Sample usage:
Manage the client configuration file /etc/ssh/ssh_config.d/50-redhat.conf with some directives and default file permissions (0644 root:root).
``` yaml
ssh::include: /etc/ssh/ssh_config.d/*.conf
ssh::config_files:
'50-redhat':
lines:
Match: 'final all'
Include: '/etc/crypto-policies/back-ends/openssh.config'
GSSAPIAuthentication: 'yes'
ForwardX11Trusted: 'yes'
```
Manage the server configuration file /etc/ssh/sshd_config.d/50-redhat.conf with some directives and default file permissions (0600 root:root).
``` yaml
ssh::server::include: /etc/ssh/sshd_config.d/*.conf
ssh::server::config_files:
'50-redhat':
lines:
Include: '/etc/crypto-policies/back-ends/opensshserver.config'
SyslogFacility: 'AUTHPRIV'
ChallengeResponseAuthentication: 'no'
GSSAPIAuthentication: 'yes'
GSSAPICleanupCredentials: 'no'
UsePAM: 'yes'
X11Forwarding: 'yes'
PrintMotd: 'no'
```
You can also specify different file permissions by setting $owner, $group, or $mode accordingly:
``` yaml
ssh::include: /etc/ssh/ssh_config.d/*.conf
ssh::config_files:
'50-redhat':
owner: 'name'
group: 'group'
mode: '0664'
lines:
Match: 'final all'
GSSAPIAuthentication: 'yes'
```
Using directives that are not supported by this module:
``` yaml
ssh::include: /etc/ssh/ssh_config.d/*.conf
ssh::config_files:
'50-redhat':
custom:
- 'Directive1 Value1'
- 'Directive2 Value2'
```
Remove the file /etc/ssh/ssh_config.d/50-redhat.conf:
``` yaml
ssh::include: /etc/ssh/ssh_config.d/*.conf
ssh::config_files:
'50-redhat':
ensure: 'absent'
```
## Upgrading
Expand Down
Loading