Skip to content
This repository was archived by the owner on Dec 26, 2020. It is now read-only.

Commit cff51e1

Browse files
authored
Merge pull request #199 from MatthiasLohr/feature/CustomOptions
Support for custom configuration
2 parents eacd9c1 + daa3b03 commit cff51e1

File tree

5 files changed

+21
-0
lines changed

5 files changed

+21
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ Warning: This role disables root-login on the target server! Please make sure yo
7373
|`ssh_macs` | [] | Change this list to overwrite macs. Defaults found in `defaults/main.yml` |
7474
|`ssh_kex` | [] | Change this list to overwrite kexs. Defaults found in `defaults/main.yml` |
7575
|`ssh_ciphers` | [] | Change this list to overwrite ciphers. Defaults found in `defaults/main.yml` |
76+
|`ssh_custom_options` | [] | Custom lines for SSH client configuration |
77+
|`sshd_custom_options` | [] | Custom lines for SSH daemon configuration |
7678

7779
## Example Playbook
7880

defaults/main.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,3 +221,9 @@ ssh_server_revoked_keys: []
221221
# Set to false to turn the role into a no-op. Useful when using
222222
# the Ansible role dependency mechanism.
223223
ssh_hardening_enabled: true
224+
225+
# Custom options for SSH client configuration file
226+
ssh_custom_options: []
227+
228+
# Custom options for SSH daemon configuration file
229+
sshd_custom_options: []

templates/openssh.conf.j2

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,7 @@ Compression yes
115115
# Disable experimental client roaming. This is known to cause potential issues with secrets being disclosed to malicious servers and defaults to being disabled.
116116
UseRoaming {{ 'yes' if ssh_client_roaming else 'no' }}
117117
{% endif %}
118+
119+
{% for line in ssh_custom_options %}
120+
{{ line }}
121+
{% endfor %}

templates/opensshd.conf.j2

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,10 @@ DebianBanner {{ 'yes' if (ssh_print_debian_banner|bool) else 'no' }}
221221
# Reject keys that are explicitly blacklisted
222222
RevokedKeys /etc/ssh/revoked_keys
223223

224+
{% for line in sshd_custom_options %}
225+
{{ line }}
226+
{% endfor %}
227+
224228
{% if sftp_enabled %}
225229
# SFTP matching configuration
226230
# ===========================

tests/default_custom.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,8 @@
7676
ssh_kex:
7777
- diffie-hellman-group-exchange-sha256
7878
- diffie-hellman-group-exchange-sha1
79+
ssh_custom_options:
80+
- "Include /etc/ssh/ssh_config.d/*"
81+
sshd_custom_options:
82+
- "AcceptEnv LANG"
83+

0 commit comments

Comments
 (0)