Skip to content

Commit 345e303

Browse files
committed
set KbdInteractiveAuthentication on newer SSH versions
1 parent d0cacee commit 345e303

7 files changed

Lines changed: 28 additions & 17 deletions

File tree

README.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
11
# Puppet SSH
22

3-
[![Puppet Forge modules by saz](https://img.shields.io/puppetforge/mc/saz.svg)](https://forge.puppetlabs.com/saz)
4-
[![Puppet Forge](http://img.shields.io/puppetforge/v/saz/ssh.svg)](https://forge.puppetlabs.com/saz/ssh)
5-
[![Puppet Forge downloads](https://img.shields.io/puppetforge/dt/saz/ssh.svg)](https://forge.puppetlabs.com/saz/ssh)
6-
[![Puppet Forge score](https://img.shields.io/puppetforge/f/saz/ssh.svg)](https://forge.puppetlabs.com/saz/ssh)
7-
[![Build Status](https://github.com/saz/puppet-ssh/workflows/CI/badge.svg)](https://github.com/saz/puppet-ssh/actions?query=workflow%3ACI)
8-
93
Manage SSH client and server via Puppet.
10-
Source: https://github.com/saz/puppet-ssh
114

125
## Requirements
6+
137
* Exported resources for host keys management
148
* puppetlabs/stdlib
159
* puppetlabs/concat
@@ -31,6 +25,7 @@ options => {
3125
This is working for both, client and server.
3226

3327
### Both client, server and per user client configuration
28+
3429
Host keys will be collected and distributed unless
3530
`storeconfigs_enabled` is `false`.
3631

@@ -71,6 +66,7 @@ class { 'ssh':
7166
```
7267

7368
### Hiera example
69+
7470
```yaml
7571
ssh::storeconfigs_enabled: true
7672

@@ -106,6 +102,7 @@ ssh::users_client_options:
106102
```
107103
108104
### Client only
105+
109106
Collected host keys from servers will be written to `known_hosts` unless
110107
`storeconfigs_enabled` is `false`
111108

@@ -189,6 +186,7 @@ SSH configuration file will be `/var/lib/bob/.ssh/config`.
189186
```
190187

191188
### Server only
189+
192190
Host keys will be collected for client distribution unless
193191
`storeconfigs_enabled` is `false`
194192

@@ -226,7 +224,6 @@ class { 'ssh::server':
226224
}
227225
```
228226

229-
230227
## Default options
231228

232229
### Client
@@ -251,6 +248,7 @@ class { 'ssh::server':
251248
```
252249

253250
## Overwriting default options
251+
254252
Default options will be merged with options passed in.
255253
If an option is set both as default and via options parameter, the latter
256254
will win.
@@ -305,6 +303,7 @@ PasswordAuthentication no
305303
```
306304

307305
## Defining host keys for server
306+
308307
You can define host keys your server will use
309308

310309
```puppet
@@ -327,7 +326,6 @@ ssh::server::host_key {'ssh_host_rsa_key':
327326
Both of these definitions will create ```/etc/ssh/ssh_host_rsa_key``` and
328327
```/etc/ssh/ssh_host_rsa_key.pub``` and restart sshd daemon.
329328

330-
331329
## Adding custom match blocks
332330

333331
```puppet

data/AIX.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ ssh::server::service_name: 'sshd'
88
ssh::sftp_server_path: '/usr/sbin/sftp-server'
99
ssh::server::host_priv_key_group: 0
1010
ssh::server::default_options:
11-
AcceptEnv: 'LANG LC_*'
12-
ChallengeResponseAuthentication: 'no'
11+
X11Forwarding: 'yes'
1312
PrintMotd: 'no'
13+
AcceptEnv: 'LANG LC_*'
1414
Subsystem: "sftp %{lookup('ssh::sftp_server_path')}"
1515
UsePAM: 'no'
16-
X11Forwarding: 'yes'

data/OpenBSD.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ ssh::server::service_name: 'sshd'
77
ssh::sftp_server_path: '/usr/libexec/sftp-server'
88
ssh::server::host_priv_key_group: 0
99
ssh::server::default_options:
10-
ChallengeResponseAuthentication: 'no'
1110
X11Forwarding: 'yes'
1211
PrintMotd: 'no'
1312
AcceptEnv: 'LANG LC_*'

data/Solaris.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@ ssh::server::service_name: 'svc:/network/ssh:default'
66
ssh::sftp_server_path: 'internal-sftp'
77

88
ssh::server::default_options:
9-
ChallengeResponseAuthentication: 'no'
109
X11Forwarding: 'yes'
1110
PrintMotd: 'no'
1211
Subsystem: "sftp %{lookup('ssh::sftp_server_path')}"
1312
HostKey:
1413
- "%{lookup('ssh::server::sshd_dir')}/ssh_host_rsa_key"
1514
- "%{lookup('ssh::server::sshd_dir')}/ssh_host_dsa_key"
16-
15+
1716
ssh::client::default_options: {}

data/common.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ ssh::server::issue_net : '/etc/issue.net'
2929
ssh::knownhosts::collect_enabled : true
3030

3131
ssh::server::default_options:
32-
ChallengeResponseAuthentication: 'no'
3332
X11Forwarding: 'yes'
3433
PrintMotd: 'no'
3534
AcceptEnv: 'LANG LC_*'

manifests/server.pp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,12 @@
101101
if $use_augeas {
102102
$merged_options = sshserver_options_to_augeas_sshd_config($options, $options_absent, { 'target' => $ssh::server::sshd_config })
103103
} else {
104-
$merged_options = deep_merge($default_options, $options)
104+
if 'ssh_server_version_release' in $facts and $facts['ssh_server_version_release'] and versioncmp($facts['ssh_server_version_release'], '8.6') >= 0 {
105+
$default_options_real = $default_options + { 'KbdInteractiveAuthentication' => 'no' }
106+
} else {
107+
$default_options_real = $default_options + { 'ChallengeResponseAuthentication' => 'no' }
108+
}
109+
$merged_options = deep_merge($default_options_real, $options)
105110
}
106111

107112
contain ssh::server::install

spec/classes/server_spec.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@
77
context "on #{os}" do
88
let(:facts) { os_facts }
99

10+
case os_facts[:os]['name']
11+
when 'Debian'
12+
if os_facts[:os]['release']['major'] == '12'
13+
context 'with ssh_server_version_release set to 10.0' do
14+
let(:facts) { os_facts.merge(ssh_server_version_release: '10.0') }
15+
16+
sshd_config = "# File is managed by Puppet\n\nAcceptEnv LANG LC_*\nKbdInteractiveAuthentication no\nPrintMotd no\nSubsystem sftp /usr/lib/openssh/sftp-server\nUsePAM yes\nX11Forwarding yes\n"
17+
it { is_expected.to contain_concat__fragment('global config').with_content(sshd_config) }
18+
end
19+
end
20+
end
21+
1022
svc_name = case os_facts[:os]['family']
1123
when 'Debian'
1224
'ssh'

0 commit comments

Comments
 (0)