Saltstack Official OpenSSH Formula
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

391 lines
15KB

  1. sshd_config:
  2. # This keyword is totally optional
  3. ConfigBanner: |
  4. # Alternative banner for the config file
  5. # (Indented) hash signs lose their special meaning here
  6. # and the lines will be written as-is.
  7. Port: 22
  8. Protocol: 2
  9. HostKey:
  10. - /etc/ssh/ssh_host_rsa_key
  11. - /etc/ssh/ssh_host_dsa_key
  12. - /etc/ssh/ssh_host_ecdsa_key
  13. - /etc/ssh/ssh_host_ed25519_key
  14. UsePrivilegeSeparation: 'sandbox'
  15. SyslogFacility: AUTH
  16. LogLevel: INFO
  17. ClientAliveInterval: 0
  18. ClientAliveCountMax: 3
  19. LoginGraceTime: 120
  20. PermitRootLogin: 'yes'
  21. PasswordAuthentication: 'no'
  22. StrictModes: 'yes'
  23. MaxAuthTries: 6
  24. MaxSessions: 10
  25. PubkeyAuthentication: 'yes'
  26. AuthorizedKeysCommand: '/usr/bin/sss_ssh_authorizedkeys'
  27. AuthorizedKeysCommandUser: 'nobody'
  28. IgnoreRhosts: 'yes'
  29. HostbasedAuthentication: 'no'
  30. PermitEmptyPasswords: 'no'
  31. ChallengeResponseAuthentication: 'no'
  32. AuthenticationMethods: 'publickey,keyboard-interactive'
  33. AuthorizedKeysFile: '%h/.ssh/authorized_keys'
  34. X11Forwarding: 'no'
  35. X11DisplayOffset: 10
  36. PrintMotd: 'yes'
  37. PrintLastLog: 'yes'
  38. TCPKeepAlive: 'yes'
  39. AcceptEnv: "LANG LC_*"
  40. Subsystem: "sftp /usr/lib/openssh/sftp-server"
  41. UsePAM: 'yes'
  42. UseDNS: 'yes'
  43. # set as string
  44. AllowUsers: 'vader@10.0.0.1 maul@evil.com sidious luke'
  45. # or set as list
  46. AllowUsers:
  47. - vader@10.0.0.1
  48. - maul@evil.com
  49. - sidious
  50. - luke
  51. # set as string
  52. DenyUsers: 'yoda chewbaca@112.10.21.1'
  53. # or set as list
  54. DenyUsers:
  55. - yoda
  56. - chewbaca@112.10.21.1
  57. # set as string
  58. AllowGroups: 'wheel staff imperial'
  59. # or set as list
  60. AllowGroups:
  61. - wheel
  62. - staff
  63. - imperial
  64. # set as string
  65. DenyGroups: 'rebel'
  66. # or set as list
  67. DenyGroups:
  68. - rebel
  69. - badcompany
  70. matches:
  71. sftp_chroot:
  72. type:
  73. Group: sftpusers
  74. options:
  75. ChrootDirectory: /sftp-chroot/%u
  76. X11Forwarding: no
  77. AllowTcpForwarding: no
  78. ForceCommand: internal-sftp
  79. # Supports complex compound matches in Match criteria. For example, be able
  80. # to match against multiple Users for a given Match, or be able to match
  81. # against address ranges. Or Groups. Or any combination thereof.
  82. #
  83. # Support for matching users can take one of several different appearances
  84. # in pillar data:
  85. match_1:
  86. type:
  87. User: one_user
  88. options:
  89. ChrootDirectory: /ex/%u
  90. match_2:
  91. type:
  92. User:
  93. - jim
  94. - bob
  95. - sally
  96. options:
  97. ChrootDirectory: /ex/%u
  98. # Note the syntax of match_3. By using empty dicts for each user, we can
  99. # leverage Salt's pillar mergine. If we use simple lists, we cannot do
  100. # this; Salt can't merge simple lists, because it doesn't know what order
  101. # they ought to be in.
  102. match_3:
  103. type:
  104. User:
  105. jim: ~
  106. bob: ~
  107. sally: ~
  108. options:
  109. ChrootDirectory: /ex/%u
  110. # Check `man sshd_config` for supported KexAlgorithms, Ciphers and MACs first.
  111. # You can specify KexAlgorithms, Ciphers and MACs as both key or a list.
  112. # The configuration given in the example below is based on:
  113. # https://stribika.github.io/2015/01/04/secure-secure-shell.html
  114. #KexAlgorithms: 'curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256'
  115. #Ciphers: 'chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr'
  116. #MACs: 'hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,umac-128@openssh.com'
  117. KexAlgorithms:
  118. - 'curve25519-sha256@libssh.org'
  119. - 'diffie-hellman-group-exchange-sha256'
  120. Ciphers:
  121. - 'chacha20-poly1305@openssh.com'
  122. - 'aes256-gcm@openssh.com'
  123. - 'aes128-gcm@openssh.com'
  124. - 'aes256-ctr'
  125. - 'aes192-ctr'
  126. - 'aes128-ctr'
  127. MACs:
  128. - 'hmac-sha2-512-etm@openssh.com'
  129. - 'hmac-sha2-256-etm@openssh.com'
  130. - 'umac-128-etm@openssh.com'
  131. - 'hmac-sha2-512'
  132. - 'hmac-sha2-256'
  133. - 'umac-128@openssh.com'
  134. # Warning! You should generally NOT NEED to set ssh_config. Setting ssh_config
  135. # pillar will overwrite the defaults of your distribution's SSH client. This
  136. # will also force the default configuration for all the SSH clients on the
  137. # machine. This can break SSH connections with servers using older versions of
  138. # openssh. Please make sure you understand the implication of different settings
  139. ssh_config:
  140. Hosts:
  141. '*':
  142. StrictHostKeyChecking: no
  143. ForwardAgent: no
  144. ForwardX11: no
  145. RhostsRSAAuthentication: no
  146. RSAAuthentication: yes
  147. PasswordAuthentication: yes
  148. HostbasedAuthentication: no
  149. GSSAPIAuthentication: no
  150. GSSAPIDelegateCredentials: no
  151. BatchMode: 'yes'
  152. CheckHostIP: 'yes'
  153. AddressFamily: 'any'
  154. ConnectTimeout: 0
  155. IdentityFile: '~/.ssh/id_rsa'
  156. Port: 22
  157. Protocol: 2
  158. Cipher: '3des'
  159. Tunnel: 'no'
  160. TunnelDevice: 'any:any'
  161. PermitLocalCommand: 'no'
  162. VisualHostKey: 'no'
  163. # Check `man ssh_config` for supported KexAlgorithms, Ciphers and MACs first.
  164. # WARNING! Please make sure you understand the implications of the below
  165. # settings. The examples provided below might break your connection to older /
  166. # legacy openssh servers.
  167. # The configuration given in the example below is based on:
  168. # https://stribika.github.io/2015/01/04/secure-secure-shell.html
  169. # You can specify KexAlgorithms, Ciphers and MACs as both key or a list.
  170. #KexAlgorithms: 'curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1'
  171. #Ciphers: 'chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr'
  172. #MACs: 'hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,umac-128@openssh.com'
  173. KexAlgorithms:
  174. - 'curve25519-sha256@libssh.org'
  175. - 'diffie-hellman-group-exchange-sha256'
  176. - 'diffie-hellman-group-exchange-sha1'
  177. - 'diffie-hellman-group14-sha1'
  178. Ciphers:
  179. - 'chacha20-poly1305@openssh.com'
  180. - 'aes256-gcm@openssh.com'
  181. - 'aes128-gcm@openssh.com'
  182. - 'aes256-ctr'
  183. - 'aes192-ctr'
  184. - 'aes128-ctr'
  185. MACs:
  186. - 'hmac-sha2-512-etm@openssh.com'
  187. - 'hmac-sha2-256-etm@openssh.com'
  188. - 'umac-128-etm@openssh.com'
  189. - 'hmac-sha2-512'
  190. - 'hmac-sha2-256'
  191. - 'umac-128@openssh.com'
  192. openssh:
  193. # Banner file can be retrieved either by TOFS or by url
  194. banner_src: banner_fire
  195. # banner_src: salt://ssh/files/banner_src # <- old style
  196. # Instead of adding a custom banner file you can set it in pillar
  197. banner_string: |
  198. Welcome to {{ grains['id'] }}!
  199. # Set installed package version
  200. server_version: latest
  201. client_version: latest
  202. # Controls if SSHD should be enabled/started
  203. sshd_enable: true
  204. auth:
  205. joe-valid-ssh-key-desktop:
  206. - user: joe
  207. present: True
  208. enc: ssh-rsa
  209. comment: main key - desktop
  210. source: salt://ssh_keys/joe.desktop.pub
  211. joe-valid-ssh-key-notebook:
  212. - user: joe
  213. present: True
  214. enc: ssh-rsa
  215. comment: main key - notebook
  216. source: salt://ssh_keys/joe.netbook.pub
  217. joe-non-valid-ssh-key:
  218. - user: joe
  219. present: False
  220. enc: ssh-rsa
  221. comment: obsolete key - removed
  222. source: salt://ssh_keys/joe.no-valid.pub
  223. # Maps users to source files
  224. # Designed to play nice with ext_pillar
  225. # salt.states.ssh_auth: If source is set, comment and enc will be ignored
  226. auth_map:
  227. personal_keys: # store name
  228. source: salt://ssh_keys
  229. users:
  230. joe:
  231. joe.desktop: {}
  232. joe.netbook:
  233. options: [] # see salt.states.ssh_auth.present
  234. joe.no-valid:
  235. present: False
  236. generate_dsa_keys: False
  237. absent_dsa_keys: False
  238. provide_dsa_keys: False
  239. dsa:
  240. private_key: |
  241. -----BEGIN DSA PRIVATE KEY-----
  242. NOT_DEFINED
  243. -----END DSA PRIVATE KEY-----
  244. public_key: |
  245. ssh-dss NOT_DEFINED
  246. generate_ecdsa_keys: False
  247. absent_ecdsa_keys: False
  248. provide_ecdsa_keys: False
  249. ecdsa:
  250. private_key: |
  251. -----BEGIN EC PRIVATE KEY-----
  252. NOT_DEFINED
  253. -----END EC PRIVATE KEY-----
  254. public_key: |
  255. ecdsa-sha2-nistp256 NOT_DEFINED
  256. generate_rsa_keys: False
  257. generate_rsa_size: 4096
  258. # Will remove the old key if it is to short and generate a new one.
  259. enforce_rsa_size: False
  260. absent_rsa_keys: False
  261. provide_rsa_keys: False
  262. rsa:
  263. private_key: |
  264. -----BEGIN RSA PRIVATE KEY-----
  265. NOT_DEFINED
  266. -----END RSA PRIVATE KEY-----
  267. public_key: |
  268. ssh-rsa NOT_DEFINED
  269. generate_ed25519_keys: False
  270. absent_ed25519_keys: False
  271. provide_ed25519_keys: False
  272. ed25519:
  273. private_key: |
  274. -----BEGIN OPENSSH PRIVATE KEY-----
  275. NOT_DEFINED
  276. -----END OPENSSH PRIVATE KEY-----
  277. public_key: |
  278. ssh-ed25519 NOT_DEFINED
  279. known_hosts:
  280. # The next 2 settings restrict the set of minions that will be added in
  281. # the generated ssh_known_hosts files (the default is to match all minions)
  282. target: '*'
  283. tgt_type: 'glob'
  284. # Name of mining functions used to gather public keys and hostnames
  285. # (the default values are shown here)
  286. mine_keys_function: public_ssh_host_keys
  287. mine_hostname_function: public_ssh_hostname
  288. # List of DNS entries also pointing to our managed machines and that we want
  289. # to inject in our generated ssh_known_hosts file
  290. aliases:
  291. - cname-to-minion.example.org
  292. - alias.example.org
  293. # Includes short hostnames derived from the FQDN
  294. # (host.example.test -> host)
  295. # (Deactivated by default, because there can be collisions!)
  296. hostnames: False
  297. #hostnames:
  298. # Restrict wich hosts you want to use via their hostname
  299. # (i.e. ssh user@host instead of ssh user@host.example.com)
  300. # target: '*' # Defaults to "*.{{ grains['domain']}}"
  301. # tgt_type: 'glob'
  302. # To activate the defaults you can just set an empty dict.
  303. #hostnames: {}
  304. # Include localhost, 127.0.0.1 and ::1 (default: False)
  305. include_localhost: False
  306. # Host keys fetched via salt-ssh
  307. salt_ssh:
  308. # The salt-ssh user
  309. user: salt-master
  310. # specify public host names of a minion
  311. public_ssh_host_names:
  312. minion.id:
  313. - minion.id
  314. - alias.of.minion.id
  315. # specify public host keys of a minion
  316. public_ssh_host_keys:
  317. minion.id: |
  318. ssh-rsa [...]
  319. ssh-ed25519 [...]
  320. # Here you can list keys for hosts which are not among your minions:
  321. static:
  322. github.com: 'ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGm[...]'
  323. gitlab.com: 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCsj2bN[...]'
  324. # The template of ssh_know_host file can be overriden thanks to TOFS
  325. # specify DH parameters (see /etc/ssh/moduli)
  326. moduli: |
  327. # Time Type Tests Tries Size Generator Modulus
  328. 20120821045639 2 6 100 2047 2 DD2047CBDBB6F8E919BC63DE885B34D0FD6E3DB2887D8B46FE249886ACED6B46DFCD5553168185FD376122171CD8927E60120FA8D01F01D03E58281FEA9A1ABE97631C828E41815F34FDCDF787419FE13A3137649AA93D2584230DF5F24B5C00C88B7D7DE4367693428C730376F218A53E853B0851BAB7C53C15DA7839CBE1285DB63F6FA45C1BB59FE1C5BB918F0F8459D7EF60ACFF5C0FA0F3FCAD1C5F4CE4416D4F4B36B05CDCEBE4FB879E95847EFBC6449CD190248843BC7EDB145FBFC4EDBB1A3C959298F08F3BA2CFBE231BBE204BE6F906209D28BD4820AB3E7BE96C26AE8A809ADD8D1A5A0B008E9570FA4C4697E116B8119892C604293680B09D63
  329. 20120821045830 2 6 100 2047 2 DD2047CBDBB6F8E919BC63DE885B34D0FD6E3DB2887D8B46FE249886ACED6B46DFCD5553168185FD376122171CD8927E60120FA8D01F01D03E58281FEA9A1ABE97631C828E41815F34FDCDF787419FE13A3137649AA93D2584230DF5F24B5C00C88B7D7DE4367693428C730376F218A53E853B0851BAB7C53C15DA7839CBE1285DB63F6FA45C1BB59FE1C5BB918F0F8459D7EF60ACFF5C0FA0F3FCAD1C5F4CE4416D4F4B36B05CDCEBE4FB879E95847EFBC6449CD190248843BC7EDB145FBFC4EDBB1A3C959298F08F3BA2CFBE231BBE204BE6F906209D28BD4820AB3E7BE96C26AE8A809ADD8D1A5A0B008E9570FA4C4697E116B8119892C6042936814C2FFB
  330. 20120821050046 2 6 100 2047 2 DD2047CBDBB6F8E919BC63DE885B34D0FD6E3DB2887D8B46FE249886ACED6B46DFCD5553168185FD376122171CD8927E60120FA8D01F01D03E58281FEA9A1ABE97631C828E41815F34FDCDF787419FE13A3137649AA93D2584230DF5F24B5C00C88B7D7DE4367693428C730376F218A53E853B0851BAB7C53C15DA7839CBE1285DB63F6FA45C1BB59FE1C5BB918F0F8459D7EF60ACFF5C0FA0F3FCAD1C5F4CE4416D4F4B36B05CDCEBE4FB879E95847EFBC6449CD190248843BC7EDB145FBFC4EDBB1A3C959298F08F3BA2CFBE231BBE204BE6F906209D28BD4820AB3E7BE96C26AE8A809ADD8D1A5A0B008E9570FA4C4697E116B8119892C60429368214FC53
  331. 20120821050054 2 6 100 2047 5 DD2047CBDBB6F8E919BC63DE885B34D0FD6E3DB2887D8B46FE249886ACED6B46DFCD5553168185FD376122171CD8927E60120FA8D01F01D03E58281FEA9A1ABE97631C828E41815F34FDCDF787419FE13A3137649AA93D2584230DF5F24B5C00C88B7D7DE4367693428C730376F218A53E853B0851BAB7C53C15DA7839CBE1285DB63F6FA45C1BB59FE1C5BB918F0F8459D7EF60ACFF5C0FA0F3FCAD1C5F4CE4416D4F4B36B05CDCEBE4FB879E95847EFBC6449CD190248843BC7EDB145FBFC4EDBB1A3C959298F08F3BA2CFBE231BBE204BE6F906209D28BD4820AB3E7BE96C26AE8A809ADD8D1A5A0B008E9570FA4C4697E116B8119892C60429368218E83F
  332. # ALTERNATIVELY, specify the location of the moduli file. Examples:
  333. #moduli_source: http://some.server.somewhere/salt/moduli
  334. #moduli_source: salt://files/ssh/moduli
  335. # If moduli is specified, moduli_source will be ignored.
  336. # Also, a proper hash file *must* be included in the same path. E.g.:
  337. # http://some.server.somewhere/salt/moduli.hash
  338. # salt://files/ssh/moduli.hash
  339. # These will be automatically referenced to by the ssh_moduli state.
  340. # Required for openssh.known_hosts
  341. mine_functions:
  342. public_ssh_host_keys:
  343. mine_function: cmd.run
  344. cmd: cat /etc/ssh/ssh_host_*_key.pub
  345. python_shell: True
  346. public_ssh_hostname:
  347. mine_function: grains.get
  348. key: id
  349. tofs:
  350. # The files_switch key serves as a selector for alternative
  351. # directories under the formula files directory. See TOFS pattern
  352. # doc for more info.
  353. # Note: Any value not evaluated by `config.get` will be used literally.
  354. # This can be used to set custom paths, as many levels deep as required.
  355. # files_switch:
  356. # - any/path/can/be/used/here
  357. # - id
  358. # - role
  359. # - osfinger
  360. # - os
  361. # - os_family
  362. # All aspects of path/file resolution are customisable using the options below.
  363. # This is unnecessary in most cases; there are sensible defaults.
  364. # path_prefix: template_alt
  365. # dirs:
  366. # files: files_alt
  367. # default: default_alt
  368. source_files:
  369. ssh_known_hosts_file_managed:
  370. - alt_known_hosts
  371. sshd_config_file_managed:
  372. - alt_sshd_config
  373. ssh_config_file_managed:
  374. - alt_ssh_config
  375. sshd_banner_file_managed:
  376. - alt_banner_src