You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+34-5Lines changed: 34 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,11 +39,14 @@ This cookbook provides secure ssh-client and ssh-server configurations.
39
39
*`['ssh']['use_pam']` - `false` to disable pam authentication
40
40
*`['ssh']['print_motd']` - `false` to disable printing of the MOTD
41
41
*`['ssh']['print_last_log']` - `false` to disable display of last login information
42
-
*`default['ssh']['deny_users']` - `[]` to configure `DenyUsers`, if specified login is disallowed for user names that match one of the patterns.
43
-
*`default['ssh']['allow_users']` - `[]` to configure `AllowUsers`, if specified, login is allowed only for user names that match one of the patterns.
44
-
*`default['ssh']['deny_groups']` - `[]` to configure `DenyGroups`, if specified, login is disallowed for users whose primary group or supplementary group list matches one of the patterns.
45
-
*`default['ssh']['allow_groups']` - `[]` to configure `AllowGroups`, if specified, login is allowed only for users whose primary group or supplementary group list matches one of the patterns.
46
-
*`default['ssh']['use_dns']` - `nil` to configure if sshd should look up the remote host name and check that the resolved host name for the remote IP address maps back to the very same IP address.
42
+
*`['ssh']['deny_users']` - `[]` to configure `DenyUsers`, if specified login is disallowed for user names that match one of the patterns.
43
+
*`['ssh']['allow_users']` - `[]` to configure `AllowUsers`, if specified, login is allowed only for user names that match one of the patterns.
44
+
*`['ssh']['deny_groups']` - `[]` to configure `DenyGroups`, if specified, login is disallowed for users whose primary group or supplementary group list matches one of the patterns.
45
+
*`['ssh']['allow_groups']` - `[]` to configure `AllowGroups`, if specified, login is allowed only for users whose primary group or supplementary group list matches one of the patterns.
46
+
*`['ssh']['use_dns']` - `nil` to configure if sshd should look up the remote host name and check that the resolved host name for the remote IP address maps back to the very same IP address.
47
+
*`['ssh']['sftp']['enable']` - `false` to disable the SFTP feature of OpenSSHd. Set to `true` to enable SFTP.
48
+
*`['ssh']['sftp']['group']` - `sftponly` to configure the `Match Group` option of SFTP to allow SFTP only for dedicated users
49
+
*`['ssh']['sftp']['chroot']` - `/home/%u` to configure the directory where the SFTP user should be chrooted
47
50
48
51
## Data Bags
49
52
@@ -97,6 +100,26 @@ Configure attributes:
97
100
98
101
**The default value for `listen_to` is `0.0.0.0`. It is highly recommended to change the value.**
99
102
103
+
## SFTP
104
+
105
+
To enable the SFTP configuration add one of the following recipes to the run_list:
106
+
107
+
"recipe[ssh-hardening]"
108
+
or
109
+
"recipe[ssh-hardening::server]"
110
+
111
+
Configure attributes:
112
+
113
+
"ssh" : {
114
+
"sftp" : {
115
+
"enable" : true,
116
+
"chroot" : "/home/sftp/%u",
117
+
"group" : "sftusers"
118
+
}
119
+
}
120
+
121
+
This will enable the SFTP Server and chroot every user in the `sftpusers` group to the `/home/sftp/%u` directory.
122
+
100
123
## Local Testing
101
124
102
125
For local testing you can use vagrant and Virtualbox of VMWare to run tests locally. You will have to install Virtualbox and Vagrant on your system. See [Vagrant Downloads](http://downloads.vagrantup.com/) for a vagrant package suitable for your system. For all our tests we use `test-kitchen`. If you are not familiar with `test-kitchen` please have a look at [their guide](http://kitchen.ci/docs/getting-started).
@@ -154,6 +177,12 @@ We have seen some issues in applications (based on python and ruby) that are due
154
177
155
178
If you find this isn't enough, feel free to activate the attributes `cbc_requires` for ciphers, `weak_hmac` for MACs and `weak_kex`for KEX in the namespaces `['ssh']['client']` or `['ssh']['server']` based on where you want to support them.
156
179
180
+
**Why can't I log to the SFTP server after I added a user to my SFTP group?**
181
+
182
+
This is a ChrootDirectory ownership problem. sshd will reject SFTP connections to accounts that are set to chroot into any directory that has ownership/permissions that sshd considers insecure. sshd's strict ownership/permissions requirements dictate that every directory in the chroot path must be owned by root and only writable by the owner. So, for example, if the chroot environment is /home must be owned by root.
183
+
184
+
See [https://wiki.archlinux.org/index.php/SFTP_chroot](https://wiki.archlinux.org/index.php/SFTP_chroot)
185
+
157
186
## Deprecation Notices
158
187
159
188
*`node['ssh']['cbc_required']` has been deprecated in favour of `node['ssh']['client']['cbc_required']` and `node['ssh']['server']['cbc_required']`.
0 commit comments