OlgaGusarenko | 8155e1a | 2018-06-19 15:35:42 +0300 | [diff] [blame] | 1 | ===== |
| 2 | Usage |
| 3 | ===== |
Filip Pytloun | a6d4a78 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 4 | |
OlgaGusarenko | 8155e1a | 2018-06-19 15:35:42 +0300 | [diff] [blame] | 5 | OpenSSH is a free version of the SSH connectivity tools that technical users |
| 6 | of the Internet rely on. The passwords of Telnet, remote login (rlogin), and |
| 7 | File Transfer Protocol (FTP) users are transmitted across the Internet |
| 8 | unencrypted. OpenSSH encrypts all traffic, including passwords, to effectively |
| 9 | eliminate eavesdropping, connection hijacking, and other attacks. Additionally, |
| 10 | OpenSSH provides secure tunneling capabilities and several authentication |
| 11 | methods, and supports all SSH protocol versions. |
Filip Pytloun | a6d4a78 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 12 | |
OlgaGusarenko | 8155e1a | 2018-06-19 15:35:42 +0300 | [diff] [blame] | 13 | This file provides the sample pillars configurations for different use cases. |
Filip Pytloun | a6d4a78 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 14 | |
OlgaGusarenko | 8155e1a | 2018-06-19 15:35:42 +0300 | [diff] [blame] | 15 | **OpenSSH client** |
Filip Pytloun | a6d4a78 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 16 | |
OlgaGusarenko | 8155e1a | 2018-06-19 15:35:42 +0300 | [diff] [blame] | 17 | * The OpenSSH client configuration with a shared private key: |
Filip Pytloun | a6d4a78 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 18 | |
OlgaGusarenko | 8155e1a | 2018-06-19 15:35:42 +0300 | [diff] [blame] | 19 | .. code-block:: yaml |
Filip Pytloun | a6d4a78 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 20 | |
OlgaGusarenko | 8155e1a | 2018-06-19 15:35:42 +0300 | [diff] [blame] | 21 | 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 Pytloun | a6d4a78 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 32 | |
OlgaGusarenko | 8155e1a | 2018-06-19 15:35:42 +0300 | [diff] [blame] | 33 | * The OpenSSH client configuration with an individual private key and known |
| 34 | host: |
Filip Pytloun | a6d4a78 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 35 | |
OlgaGusarenko | 8155e1a | 2018-06-19 15:35:42 +0300 | [diff] [blame] | 36 | .. code-block:: yaml |
Filip Pytloun | a6d4a78 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 37 | |
OlgaGusarenko | 8155e1a | 2018-06-19 15:35:42 +0300 | [diff] [blame] | 38 | 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 Pytloun | a6d4a78 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 50 | |
OlgaGusarenko | 8155e1a | 2018-06-19 15:35:42 +0300 | [diff] [blame] | 51 | * The OpenSSH client configuration with keep alive settings: |
Petr Michalec | 244a642 | 2017-08-10 09:43:53 +0200 | [diff] [blame] | 52 | |
OlgaGusarenko | 8155e1a | 2018-06-19 15:35:42 +0300 | [diff] [blame] | 53 | .. code-block:: yaml |
Petr Michalec | 244a642 | 2017-08-10 09:43:53 +0200 | [diff] [blame] | 54 | |
OlgaGusarenko | 8155e1a | 2018-06-19 15:35:42 +0300 | [diff] [blame] | 55 | openssh: |
| 56 | client: |
| 57 | alive: |
| 58 | interval: 600 |
| 59 | count: 3 |
Petr Michalec | 244a642 | 2017-08-10 09:43:53 +0200 | [diff] [blame] | 60 | |
OlgaGusarenko | 8155e1a | 2018-06-19 15:35:42 +0300 | [diff] [blame] | 61 | **OpenSSH server** |
Filip Pytloun | a6d4a78 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 62 | |
OlgaGusarenko | 8155e1a | 2018-06-19 15:35:42 +0300 | [diff] [blame] | 63 | * The OpenSSH server simple configuration: |
Filip Pytloun | a6d4a78 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 64 | |
OlgaGusarenko | 8155e1a | 2018-06-19 15:35:42 +0300 | [diff] [blame] | 65 | .. code-block:: yaml |
Filip Pytloun | a6d4a78 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 66 | |
| 67 | openssh: |
| 68 | server: |
| 69 | enabled: true |
| 70 | permit_root_login: true |
| 71 | public_key_auth: true |
| 72 | password_auth: true |
| 73 | host_auth: true |
| 74 | banner: Welcome to server! |
Jiri Konecny | 2a27423 | 2016-02-16 15:49:35 +0100 | [diff] [blame] | 75 | bind: |
| 76 | address: 0.0.0.0 |
Jiri Konecny | df55053 | 2016-02-17 11:48:47 +0100 | [diff] [blame] | 77 | port: 22 |
Filip Pytloun | a6d4a78 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 78 | |
OlgaGusarenko | 8155e1a | 2018-06-19 15:35:42 +0300 | [diff] [blame] | 79 | * The OpenSSH server configuration with auth keys for users: |
Filip Pytloun | a6d4a78 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 80 | |
OlgaGusarenko | 8155e1a | 2018-06-19 15:35:42 +0300 | [diff] [blame] | 81 | .. code-block:: yaml |
Filip Pytloun | a6d4a78 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 82 | |
| 83 | openssh: |
| 84 | server: |
| 85 | enabled: true |
Jiri Konecny | 2a27423 | 2016-02-16 15:49:35 +0100 | [diff] [blame] | 86 | bind: |
| 87 | address: 0.0.0.0 |
Jiri Konecny | df55053 | 2016-02-17 11:48:47 +0100 | [diff] [blame] | 88 | port: 22 |
Filip Pytloun | a6d4a78 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 89 | ... |
| 90 | user: |
| 91 | newt: |
| 92 | enabled: true |
| 93 | user: ${linux:system:user:newt} |
| 94 | public_keys: |
| 95 | - ${public_keys:newt} |
| 96 | root: |
| 97 | enabled: true |
Filip Pytloun | 2d3c803 | 2016-03-11 16:40:20 +0100 | [diff] [blame] | 98 | purge: true |
Filip Pytloun | a6d4a78 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 99 | user: ${linux:system:user:root} |
| 100 | public_keys: |
| 101 | - ${public_keys:newt} |
| 102 | |
OlgaGusarenko | 8155e1a | 2018-06-19 15:35:42 +0300 | [diff] [blame] | 103 | .. note:: Setting the ``purge`` parameter to ``true`` ensures that the exact |
| 104 | ``authorized_keys`` contents will be filled explicitly from the model and |
| 105 | undefined keys will be removed. |
Filip Pytloun | a12db4a | 2016-12-02 13:21:02 +0100 | [diff] [blame] | 106 | |
OlgaGusarenko | 8155e1a | 2018-06-19 15:35:42 +0300 | [diff] [blame] | 107 | * The OpenSSH server configuration that binds OpenSSH on multiple addresses |
| 108 | and ports: |
| 109 | |
| 110 | .. code-block:: yaml |
Filip Pytloun | a12db4a | 2016-12-02 13:21:02 +0100 | [diff] [blame] | 111 | |
| 112 | openssh: |
| 113 | server: |
| 114 | enabled: true |
| 115 | binds: |
| 116 | - address: 127.0.0.1 |
| 117 | port: 22 |
| 118 | - address: 192.168.1.1 |
| 119 | port: 2222 |
| 120 | |
OlgaGusarenko | 8155e1a | 2018-06-19 15:35:42 +0300 | [diff] [blame] | 121 | * The OpenSSH server with FreeIPA configuration: |
Filip Pytloun | daf8f98 | 2015-12-16 11:55:34 +0100 | [diff] [blame] | 122 | |
OlgaGusarenko | 8155e1a | 2018-06-19 15:35:42 +0300 | [diff] [blame] | 123 | .. code-block:: yaml |
Filip Pytloun | daf8f98 | 2015-12-16 11:55:34 +0100 | [diff] [blame] | 124 | |
| 125 | openssh: |
| 126 | server: |
| 127 | enabled: true |
Jiri Konecny | 2a27423 | 2016-02-16 15:49:35 +0100 | [diff] [blame] | 128 | bind: |
| 129 | address: 0.0.0.0 |
Jiri Konecny | df55053 | 2016-02-17 11:48:47 +0100 | [diff] [blame] | 130 | port: 22 |
Filip Pytloun | daf8f98 | 2015-12-16 11:55:34 +0100 | [diff] [blame] | 131 | public_key_auth: true |
| 132 | authorized_keys_command: |
| 133 | command: /usr/bin/sss_ssh_authorizedkeys |
| 134 | user: nobody |
| 135 | |
OlgaGusarenko | 8155e1a | 2018-06-19 15:35:42 +0300 | [diff] [blame] | 136 | * The OpenSSH server configuration with keep alive settings: |
Petr Michalec | 244a642 | 2017-08-10 09:43:53 +0200 | [diff] [blame] | 137 | |
OlgaGusarenko | 8155e1a | 2018-06-19 15:35:42 +0300 | [diff] [blame] | 138 | .. code-block:: yaml |
Petr Michalec | 244a642 | 2017-08-10 09:43:53 +0200 | [diff] [blame] | 139 | |
| 140 | openssh: |
| 141 | server: |
| 142 | alive: |
| 143 | keep: yes |
| 144 | interval: 600 |
| 145 | count: 3 |
| 146 | # |
| 147 | # will give you an timeout of 30 minutes (600 sec x 3) |
| 148 | |
OlgaGusarenko | 8155e1a | 2018-06-19 15:35:42 +0300 | [diff] [blame] | 149 | * The OpenSSH server configuration with the DSA legacy keys enabled: |
Marek Celoud | 7f50705 | 2017-11-06 15:50:23 +0100 | [diff] [blame] | 150 | |
OlgaGusarenko | 8155e1a | 2018-06-19 15:35:42 +0300 | [diff] [blame] | 151 | .. code-block:: yaml |
Marek Celoud | 7f50705 | 2017-11-06 15:50:23 +0100 | [diff] [blame] | 152 | |
| 153 | openssh: |
| 154 | server: |
| 155 | dss_enabled: true |
| 156 | |
Gleb Galkin | f6be3cf | 2018-10-17 17:39:24 +0300 | [diff] [blame] | 157 | * The OpenSSH server configuration with the duo 2FA |
| 158 | https://duo.com/docs/duounix |
| 159 | with Match User 2FA can be bypassed for some accounts |
| 160 | |
| 161 | .. code-block:: yaml |
| 162 | |
| 163 | openssh: |
| 164 | server: |
| 165 | use_dns: false |
| 166 | password_auth: false |
| 167 | challenge_response_auth: true |
| 168 | ciphers: |
| 169 | aes256-ctr: |
| 170 | enabled: true |
| 171 | aes192-ctr: |
| 172 | enabled: true |
| 173 | aes128-ctr: |
| 174 | enabled: true |
| 175 | authentication_methods: |
| 176 | publickey: |
| 177 | enabled: true |
| 178 | keyboard-interactive: |
| 179 | enabled: true |
| 180 | match_user: |
| 181 | jenkins: |
| 182 | authentication_methods: |
| 183 | publickey: |
| 184 | enabled: true |
| 185 | |
| 186 | |
| 187 | |
Dmitry Teselkin | a6194b5 | 2018-08-24 10:56:36 +0300 | [diff] [blame] | 188 | * OpenSSH server configuration supports AllowUsers, DenyUsers, AllowGroup, |
| 189 | DenyGroups via allow_users, deny_users, allow_groups, deny_groups keys respectively. |
| 190 | |
| 191 | For example, here is how to manage AllowUsers configuration item: |
| 192 | |
| 193 | .. code-block:: yaml |
| 194 | |
| 195 | openssh: |
| 196 | server: |
| 197 | allow_users: |
| 198 | <user_name>: |
| 199 | enabled: true |
| 200 | <pattern_list_name>: |
| 201 | enabled: true |
| 202 | pattern: <pattern> |
| 203 | |
| 204 | Elements of allow_users are either user names or pattern list names: |
| 205 | * <user name> goes to configurational file as is. |
| 206 | * <pattern list name> is not used directly - its main purpose is to provide a |
| 207 | meaningfull name for a pattern specified in 'pattern' key. Another advantage |
| 208 | is that pattern can be overriden. |
| 209 | |
| 210 | <enabled> by default is 'true'. |
| 211 | |
| 212 | See PATTERNS in ssh_config(5) for more information on what <pattern> is. |
| 213 | |
OlgaGusarenko | 8155e1a | 2018-06-19 15:35:42 +0300 | [diff] [blame] | 214 | **CIS Compliance** |
Dmitry Teselkin | e9420e7 | 2018-04-03 13:49:39 +0300 | [diff] [blame] | 215 | |
OlgaGusarenko | 8155e1a | 2018-06-19 15:35:42 +0300 | [diff] [blame] | 216 | There is a number of configuration options that make the OpenSSH service |
| 217 | compliant with CIS Benchmark. These options can be found under |
| 218 | ``metadata/service/server/cis``, and are not enabled by default. For each CIS |
| 219 | item a comprehensive description is provided with the pillar data. |
Dmitry Teselkin | e9420e7 | 2018-04-03 13:49:39 +0300 | [diff] [blame] | 220 | |
OlgaGusarenko | 8155e1a | 2018-06-19 15:35:42 +0300 | [diff] [blame] | 221 | See also https://www.cisecurity.org/cis-benchmarks/ for the details abouth |
| 222 | CIS Benchmark. |
Dmitry Teselkin | e9420e7 | 2018-04-03 13:49:39 +0300 | [diff] [blame] | 223 | |
OlgaGusarenko | 8155e1a | 2018-06-19 15:35:42 +0300 | [diff] [blame] | 224 | **Read more** |
Filip Pytloun | a6d4a78 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 225 | |
| 226 | * http://www.openssh.org/manual.html |
| 227 | * https://help.ubuntu.com/community/SSH/OpenSSH/Configuring |
| 228 | * http://www.cyberciti.biz/tips/linux-unix-bsd-openssh-server-best-practices.html |
| 229 | * http://www.zeitoun.net/articles/ssh-through-http-proxy/start |
Filip Pytloun | 0e13906 | 2017-02-02 13:02:03 +0100 | [diff] [blame] | 230 | |
OlgaGusarenko | 8155e1a | 2018-06-19 15:35:42 +0300 | [diff] [blame] | 231 | **Documentation and bugs** |
Filip Pytloun | 0e13906 | 2017-02-02 13:02:03 +0100 | [diff] [blame] | 232 | |
OlgaGusarenko | 8155e1a | 2018-06-19 15:35:42 +0300 | [diff] [blame] | 233 | * http://salt-formulas.readthedocs.io/ |
| 234 | Learn how to install and update salt-formulas |
Filip Pytloun | 0e13906 | 2017-02-02 13:02:03 +0100 | [diff] [blame] | 235 | |
OlgaGusarenko | 8155e1a | 2018-06-19 15:35:42 +0300 | [diff] [blame] | 236 | * https://github.com/salt-formulas/salt-formula-openssh/issues |
| 237 | In the unfortunate event that bugs are discovered, report the issue to the |
| 238 | appropriate issue tracker. Use the Github issue tracker for a specific salt |
| 239 | formula |
Filip Pytloun | 0e13906 | 2017-02-02 13:02:03 +0100 | [diff] [blame] | 240 | |
OlgaGusarenko | 8155e1a | 2018-06-19 15:35:42 +0300 | [diff] [blame] | 241 | * https://launchpad.net/salt-formulas |
| 242 | For feature requests, bug reports, or blueprints affecting the entire |
| 243 | ecosystem, use the Launchpad salt-formulas project |
Filip Pytloun | 0e13906 | 2017-02-02 13:02:03 +0100 | [diff] [blame] | 244 | |
OlgaGusarenko | 8155e1a | 2018-06-19 15:35:42 +0300 | [diff] [blame] | 245 | * https://launchpad.net/~salt-formulas-users |
| 246 | Join the salt-formulas-users team and subscribe to mailing list if required |
Filip Pytloun | 0e13906 | 2017-02-02 13:02:03 +0100 | [diff] [blame] | 247 | |
OlgaGusarenko | 8155e1a | 2018-06-19 15:35:42 +0300 | [diff] [blame] | 248 | * https://github.com/salt-formulas/salt-formula-openssh |
| 249 | Develop the salt-formulas projects in the master branch and then submit pull |
| 250 | requests against a specific formula |
Filip Pytloun | 0e13906 | 2017-02-02 13:02:03 +0100 | [diff] [blame] | 251 | |
OlgaGusarenko | 8155e1a | 2018-06-19 15:35:42 +0300 | [diff] [blame] | 252 | * #salt-formulas @ irc.freenode.net |
| 253 | Use this IRC channel in case of any questions or feedback which is always |
| 254 | welcome |