Skip to content

Commit a0842dc

Browse files
Merge pull request #184 from avanier/allow_password_for_sftp
Allow password authentification for sftp
2 parents a6498da + a3ce83d commit a0842dc

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
@@ -222,7 +222,7 @@ ForceCommand internal-sftp -l VERBOSE
222222
ChrootDirectory <%= @node['ssh-hardening']['ssh']['server']['sftp']['chroot'] %>
223223
AllowTcpForwarding no
224224
AllowAgentForwarding no
225-
PasswordAuthentication no
225+
PasswordAuthentication <%= ((@node['ssh-hardening']['ssh']['server']['sftp']['password_authentication']) ? 'yes' : 'no' ) %>
226226
PermitRootLogin no
227227
X11Forwarding no
228228
<% else %>

0 commit comments

Comments
 (0)