blob: ed5cb0f9cfee5eb2de657dbcfa32397eef0e5cee [file] [log] [blame]
OlgaGusarenko8155e1a2018-06-19 15:35:42 +03001=====
2Usage
3=====
Filip Pytlouna6d4a782015-10-06 16:28:32 +02004
OlgaGusarenko8155e1a2018-06-19 15:35:42 +03005OpenSSH is a free version of the SSH connectivity tools that technical users
6of the Internet rely on. The passwords of Telnet, remote login (rlogin), and
7File Transfer Protocol (FTP) users are transmitted across the Internet
8unencrypted. OpenSSH encrypts all traffic, including passwords, to effectively
9eliminate eavesdropping, connection hijacking, and other attacks. Additionally,
10OpenSSH provides secure tunneling capabilities and several authentication
11methods, and supports all SSH protocol versions.
Filip Pytlouna6d4a782015-10-06 16:28:32 +020012
OlgaGusarenko8155e1a2018-06-19 15:35:42 +030013This file provides the sample pillars configurations for different use cases.
Filip Pytlouna6d4a782015-10-06 16:28:32 +020014
OlgaGusarenko8155e1a2018-06-19 15:35:42 +030015**OpenSSH client**
Filip Pytlouna6d4a782015-10-06 16:28:32 +020016
OlgaGusarenko8155e1a2018-06-19 15:35:42 +030017* The OpenSSH client configuration with a shared private key:
Filip Pytlouna6d4a782015-10-06 16:28:32 +020018
OlgaGusarenko8155e1a2018-06-19 15:35:42 +030019 .. code-block:: yaml
Filip Pytlouna6d4a782015-10-06 16:28:32 +020020
OlgaGusarenko8155e1a2018-06-19 15:35:42 +030021 openssh:
22 client:
23 enabled: true
24 use_dns: False
25 user:
26 root:
27 enabled: true
28 private_key:
29 type: rsa
30 key: ${_param:root_private_key}
31 user: ${linux:system:user:root}
Filip Pytlouna6d4a782015-10-06 16:28:32 +020032
OlgaGusarenko8155e1a2018-06-19 15:35:42 +030033* The OpenSSH client configuration with an individual private key and known
34 host:
Filip Pytlouna6d4a782015-10-06 16:28:32 +020035
OlgaGusarenko8155e1a2018-06-19 15:35:42 +030036 .. code-block:: yaml
Filip Pytlouna6d4a782015-10-06 16:28:32 +020037
OlgaGusarenko8155e1a2018-06-19 15:35:42 +030038 openssh:
39 client:
40 enabled: true
41 user:
42 root:
43 enabled: true
44 user: ${linux:system:user:root}
45 known_hosts:
46 - name: repo.domain.com
47 type: rsa
48 fingerprint: dd:fa:e8:68:b1:ea:ea:a0:63:f1:5a:55:48:e1:7e:37
49 fingerprint_hash_type: sha256|md5
Filip Pytlouna6d4a782015-10-06 16:28:32 +020050
Martin Polreich186b01f2019-08-19 08:29:27 +020051* The OpenSSH client configuration with definition of known_hosts using
52public key instead of fingerprint
53
54 - If `purge_defined` is set to `true` it will remove old known_hosts file
55 and start with a fresh one causing that known_host undefined in the pillar
56 will not be included.
57
58 .. code-block:: yaml
59
60 openssh:
61 client:
62 enabled: true
63 user:
64 root:
65 enabled: true
66 purge_undefined: false
67 user:
68 name: 'root'
69 home: '/root'
70 known_hosts:
71 - name: 10.11.1.50
72 port: 22
73 type: ssh-rsa
74 host_public_key: AAA...fkP
75
OlgaGusarenko8155e1a2018-06-19 15:35:42 +030076* The OpenSSH client configuration with keep alive settings:
Petr Michalec244a6422017-08-10 09:43:53 +020077
OlgaGusarenko8155e1a2018-06-19 15:35:42 +030078 .. code-block:: yaml
Petr Michalec244a6422017-08-10 09:43:53 +020079
OlgaGusarenko8155e1a2018-06-19 15:35:42 +030080 openssh:
81 client:
82 alive:
83 interval: 600
84 count: 3
Petr Michalec244a6422017-08-10 09:43:53 +020085
OlgaGusarenko8155e1a2018-06-19 15:35:42 +030086**OpenSSH server**
Filip Pytlouna6d4a782015-10-06 16:28:32 +020087
OlgaGusarenko8155e1a2018-06-19 15:35:42 +030088* The OpenSSH server simple configuration:
Filip Pytlouna6d4a782015-10-06 16:28:32 +020089
OlgaGusarenko8155e1a2018-06-19 15:35:42 +030090 .. code-block:: yaml
Filip Pytlouna6d4a782015-10-06 16:28:32 +020091
92 openssh:
93 server:
94 enabled: true
95 permit_root_login: true
96 public_key_auth: true
97 password_auth: true
98 host_auth: true
99 banner: Welcome to server!
Jiri Konecny2a274232016-02-16 15:49:35 +0100100 bind:
101 address: 0.0.0.0
Jiri Konecnydf550532016-02-17 11:48:47 +0100102 port: 22
Filip Pytlouna6d4a782015-10-06 16:28:32 +0200103
OlgaGusarenko8155e1a2018-06-19 15:35:42 +0300104* The OpenSSH server configuration with auth keys for users:
Filip Pytlouna6d4a782015-10-06 16:28:32 +0200105
OlgaGusarenko8155e1a2018-06-19 15:35:42 +0300106 .. code-block:: yaml
Filip Pytlouna6d4a782015-10-06 16:28:32 +0200107
108 openssh:
109 server:
110 enabled: true
Jiri Konecny2a274232016-02-16 15:49:35 +0100111 bind:
112 address: 0.0.0.0
Jiri Konecnydf550532016-02-17 11:48:47 +0100113 port: 22
Filip Pytlouna6d4a782015-10-06 16:28:32 +0200114 ...
115 user:
116 newt:
117 enabled: true
118 user: ${linux:system:user:newt}
119 public_keys:
120 - ${public_keys:newt}
121 root:
122 enabled: true
Filip Pytloun2d3c8032016-03-11 16:40:20 +0100123 purge: true
Filip Pytlouna6d4a782015-10-06 16:28:32 +0200124 user: ${linux:system:user:root}
125 public_keys:
126 - ${public_keys:newt}
127
OlgaGusarenko8155e1a2018-06-19 15:35:42 +0300128 .. note:: Setting the ``purge`` parameter to ``true`` ensures that the exact
129 ``authorized_keys`` contents will be filled explicitly from the model and
130 undefined keys will be removed.
Filip Pytlouna12db4a2016-12-02 13:21:02 +0100131
OlgaGusarenko8155e1a2018-06-19 15:35:42 +0300132* The OpenSSH server configuration that binds OpenSSH on multiple addresses
133 and ports:
134
135 .. code-block:: yaml
Filip Pytlouna12db4a2016-12-02 13:21:02 +0100136
137 openssh:
138 server:
139 enabled: true
140 binds:
141 - address: 127.0.0.1
142 port: 22
143 - address: 192.168.1.1
144 port: 2222
145
OlgaGusarenko8155e1a2018-06-19 15:35:42 +0300146* The OpenSSH server with FreeIPA configuration:
Filip Pytloundaf8f982015-12-16 11:55:34 +0100147
OlgaGusarenko8155e1a2018-06-19 15:35:42 +0300148 .. code-block:: yaml
Filip Pytloundaf8f982015-12-16 11:55:34 +0100149
150 openssh:
151 server:
152 enabled: true
Jiri Konecny2a274232016-02-16 15:49:35 +0100153 bind:
154 address: 0.0.0.0
Jiri Konecnydf550532016-02-17 11:48:47 +0100155 port: 22
Filip Pytloundaf8f982015-12-16 11:55:34 +0100156 public_key_auth: true
157 authorized_keys_command:
158 command: /usr/bin/sss_ssh_authorizedkeys
159 user: nobody
160
OlgaGusarenko8155e1a2018-06-19 15:35:42 +0300161* The OpenSSH server configuration with keep alive settings:
Petr Michalec244a6422017-08-10 09:43:53 +0200162
OlgaGusarenko8155e1a2018-06-19 15:35:42 +0300163 .. code-block:: yaml
Petr Michalec244a6422017-08-10 09:43:53 +0200164
165 openssh:
166 server:
167 alive:
168 keep: yes
169 interval: 600
170 count: 3
171 #
172 # will give you an timeout of 30 minutes (600 sec x 3)
173
OlgaGusarenko8155e1a2018-06-19 15:35:42 +0300174* The OpenSSH server configuration with the DSA legacy keys enabled:
Marek Celoud7f507052017-11-06 15:50:23 +0100175
OlgaGusarenko8155e1a2018-06-19 15:35:42 +0300176 .. code-block:: yaml
Marek Celoud7f507052017-11-06 15:50:23 +0100177
178 openssh:
179 server:
180 dss_enabled: true
181
Gleb Galkinf6be3cf2018-10-17 17:39:24 +0300182* The OpenSSH server configuration with the duo 2FA
183https://duo.com/docs/duounix
184with Match User 2FA can be bypassed for some accounts
185
186 .. code-block:: yaml
187
188 openssh:
189 server:
190 use_dns: false
191 password_auth: false
192 challenge_response_auth: true
193 ciphers:
194 aes256-ctr:
195 enabled: true
196 aes192-ctr:
197 enabled: true
198 aes128-ctr:
199 enabled: true
200 authentication_methods:
201 publickey:
202 enabled: true
203 keyboard-interactive:
204 enabled: true
205 match_user:
206 jenkins:
207 authentication_methods:
208 publickey:
209 enabled: true
210
211
212
Dmitry Teselkina6194b52018-08-24 10:56:36 +0300213* OpenSSH server configuration supports AllowUsers, DenyUsers, AllowGroup,
214DenyGroups via allow_users, deny_users, allow_groups, deny_groups keys respectively.
215
216For example, here is how to manage AllowUsers configuration item:
217
218 .. code-block:: yaml
219
220 openssh:
221 server:
222 allow_users:
223 <user_name>:
224 enabled: true
225 <pattern_list_name>:
226 enabled: true
227 pattern: <pattern>
228
229Elements of allow_users are either user names or pattern list names:
230* <user name> goes to configurational file as is.
231* <pattern list name> is not used directly - its main purpose is to provide a
232 meaningfull name for a pattern specified in 'pattern' key. Another advantage
233 is that pattern can be overriden.
234
235<enabled> by default is 'true'.
236
237See PATTERNS in ssh_config(5) for more information on what <pattern> is.
238
OlgaGusarenko8155e1a2018-06-19 15:35:42 +0300239**CIS Compliance**
Dmitry Teselkine9420e72018-04-03 13:49:39 +0300240
OlgaGusarenko8155e1a2018-06-19 15:35:42 +0300241There is a number of configuration options that make the OpenSSH service
242compliant with CIS Benchmark. These options can be found under
243``metadata/service/server/cis``, and are not enabled by default. For each CIS
244item a comprehensive description is provided with the pillar data.
Dmitry Teselkine9420e72018-04-03 13:49:39 +0300245
OlgaGusarenko8155e1a2018-06-19 15:35:42 +0300246See also https://www.cisecurity.org/cis-benchmarks/ for the details abouth
247CIS Benchmark.
Dmitry Teselkine9420e72018-04-03 13:49:39 +0300248
OlgaGusarenko8155e1a2018-06-19 15:35:42 +0300249**Read more**
Filip Pytlouna6d4a782015-10-06 16:28:32 +0200250
251* http://www.openssh.org/manual.html
252* https://help.ubuntu.com/community/SSH/OpenSSH/Configuring
253* http://www.cyberciti.biz/tips/linux-unix-bsd-openssh-server-best-practices.html
254* http://www.zeitoun.net/articles/ssh-through-http-proxy/start