Skip to content

Commit d50650d

Browse files
author
SteveLowe
committed
Split password_authentication into client and server
1 parent 985d9f6 commit d50650d

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

attributes/default.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,11 @@
6666
default['ssh']['allow_groups'] = [] # sshd
6767
default['ssh']['print_motd'] = false # sshd
6868
default['ssh']['print_last_log'] = false # sshd
69-
default['ssh']['password_authentication'] = false # sshd + ssh
7069
# set this to nil to let us use the default OpenSSH in case it's not set by the user
7170
default['ssh']['use_dns'] = nil # sshd
7271
# set this to nil to let us detect the attribute based on the node platform
7372
default['ssh']['use_privilege_separation'] = nil
7473
default['ssh']['max_auth_tries'] = 2 # sshd
7574
default['ssh']['max_sessions'] = 10 # sshd
75+
default['ssh']['client']['password_authentication'] = false # ssh
76+
default['ssh']['server']['password_authentication'] = false # sshd

templates/default/openssh.conf.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ RhostsRSAAuthentication no
8888
RSAAuthentication yes
8989

9090
# Disable password-based authentication, it can allow for potentially easier brute-force attacks.
91-
PasswordAuthentication <%= ((@node['ssh']['password_authentication']) ? "yes" : "no" ) %>
91+
PasswordAuthentication <%= ((@node['ssh']['client']['password_authentication']) ? "yes" : "no" ) %>
9292

9393
# Only use GSSAPIAuthentication if implemented on the network.
9494
GSSAPIAuthentication no

templates/default/opensshd.conf.erb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ HostbasedAuthentication no
104104
# Enable PAM to enforce system wide rules
105105
UsePAM <%= ((@node['ssh']['use_pam']) ? "yes" : "no" ) %>
106106
# Disable password-based authentication, it can allow for potentially easier brute-force attacks.
107-
PasswordAuthentication <%= ((@node['ssh']['password_authentication']) ? "yes" : "no" ) %>
107+
<% passsword_auth = @node['ssh']['server']['password_authentication'] || !!@node['ssh']['password_authentication'] -%>
108+
PasswordAuthentication <%= (passsword_auth ? "yes" : "no" ) %>
108109
PermitEmptyPasswords no
109110
ChallengeResponseAuthentication no
110111

0 commit comments

Comments
 (0)