Skip to content

Commit a3ce83d

Browse files
committed
allow password authentification for sftp
1 parent b47c92e commit a3ce83d

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ override['ssh-hardening']['ssh']['server']['listen_to'] = node['ipaddress']
7575
* `['ssh-hardening']['ssh']['server']['sftp']['enable']` - `false`. Set to `true` to enable the SFTP feature of OpenSSH daemon
7676
* `['ssh-hardening']['ssh']['server']['sftp']['group']` - `sftponly`. Sets the `Match Group` option of SFTP to allow SFTP only for dedicated users
7777
* `['ssh-hardening']['ssh']['server']['sftp']['chroot']` - `/home/%u`. Sets the directory where the SFTP user should be chrooted
78+
* `['ssh-hardening']['ssh']['server']['sftp']['password_authentication']` - `false`. Set to `true` if password authentication should be enabled
7879
* `['ssh-hardening']['ssh']['server']['authorized_keys_path']` - `nil`. If not nil, full path to an authorized keys folder is expected
7980
* `['ssh-hardening']['ssh']['server']['extras']` - `{}`. Add extra configuration options, see [below](#extra-configuration-options) for details
8081

attributes/default.rb

+4-3
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@
112112
server['extras'] = {}
113113

114114
# sshd sftp options
115-
server['sftp']['enable'] = false
116-
server['sftp']['group'] = 'sftponly'
117-
server['sftp']['chroot'] = '/home/%u'
115+
server['sftp']['enable'] = false
116+
server['sftp']['group'] = 'sftponly'
117+
server['sftp']['chroot'] = '/home/%u'
118+
server['sftp']['password_authentication'] = false
118119
end

templates/default/opensshd.conf.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ ForceCommand internal-sftp -l VERBOSE
215215
ChrootDirectory <%= @node['ssh-hardening']['ssh']['server']['sftp']['chroot'] %>
216216
AllowTcpForwarding no
217217
AllowAgentForwarding no
218-
PasswordAuthentication no
218+
PasswordAuthentication <%= ((@node['ssh-hardening']['ssh']['server']['sftp']['password_authentication']) ? 'yes' : 'no' ) %>
219219
PermitRootLogin no
220220
X11Forwarding no
221221
<% else %>

0 commit comments

Comments
 (0)