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.

362 lines
14KB

  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. KeyRegenerationInterval: 3600
  16. ServerKeyBits: 1024
  17. SyslogFacility: AUTH
  18. LogLevel: INFO
  19. ClientAliveInterval: 0
  20. ClientAliveCountMax: 3
  21. LoginGraceTime: 120
  22. PermitRootLogin: 'yes'
  23. PasswordAuthentication: 'no'
  24. StrictModes: 'yes'
  25. MaxAuthTries: 6
  26. MaxSessions: 10
  27. RSAAuthentication: 'yes'
  28. PubkeyAuthentication: 'yes'
  29. AuthorizedKeysCommand: '/usr/bin/sss_ssh_authorizedkeys'
  30. AuthorizedKeysCommandUser: 'nobody'
  31. IgnoreRhosts: 'yes'
  32. RhostsRSAAuthentication: 'no'
  33. HostbasedAuthentication: 'no'
  34. PermitEmptyPasswords: 'no'
  35. ChallengeResponseAuthentication: 'no'
  36. AuthenticationMethods: 'publickey,keyboard-interactive'
  37. AuthorizedKeysFile: '%h/.ssh/authorized_keys'
  38. X11Forwarding: 'no'
  39. X11DisplayOffset: 10
  40. PrintMotd: 'yes'
  41. PrintLastLog: 'yes'
  42. TCPKeepAlive: 'yes'
  43. AcceptEnv: "LANG LC_*"
  44. Subsystem: "sftp /usr/lib/openssh/sftp-server"
  45. UsePAM: 'yes'
  46. UseDNS: 'yes'
  47. # set as string
  48. AllowUsers: 'vader@10.0.0.1 maul@evil.com sidious luke'
  49. # or set as list
  50. AllowUsers:
  51. - vader@10.0.0.1
  52. - maul@evil.com
  53. - sidious
  54. - luke
  55. # set as string
  56. DenyUsers: 'yoda chewbaca@112.10.21.1'
  57. # or set as list
  58. DenyUsers:
  59. - yoda
  60. - chewbaca@112.10.21.1
  61. # set as string
  62. AllowGroups: 'wheel staff imperial'
  63. # or set as list
  64. AllowGroups:
  65. - wheel
  66. - staff
  67. - imperial
  68. # set as string
  69. DenyGroups: 'rebel'
  70. # or set as list
  71. DenyGroups:
  72. - rebel
  73. - badcompany
  74. matches:
  75. sftp_chroot:
  76. type:
  77. Group: sftpusers
  78. options:
  79. ChrootDirectory: /sftp-chroot/%u
  80. X11Forwarding: no
  81. AllowTcpForwarding: no
  82. ForceCommand: internal-sftp
  83. # Supports complex compound matches in Match criteria. For example, be able
  84. # to match against multiple Users for a given Match, or be able to match
  85. # against address ranges. Or Groups. Or any combination thereof.
  86. #
  87. # Support for matching users can take one of several different appearances
  88. # in pillar data:
  89. match_1:
  90. type:
  91. User: one_user
  92. options:
  93. ChrootDirectory: /ex/%u
  94. match_2:
  95. type:
  96. User:
  97. - jim
  98. - bob
  99. - sally
  100. options:
  101. ChrootDirectory: /ex/%u
  102. # Note the syntax of match_3. By using empty dicts for each user, we can
  103. # leverage Salt's pillar mergine. If we use simple lists, we cannot do
  104. # this; Salt can't merge simple lists, because it doesn't know what order
  105. # they ought to be in.
  106. match_3:
  107. type:
  108. User:
  109. jim: ~
  110. bob: ~
  111. sally: ~
  112. options:
  113. ChrootDirectory: /ex/%u
  114. # Check `man sshd_config` for supported KexAlgorithms, Ciphers and MACs first.
  115. # You can specify KexAlgorithms, Ciphers and MACs as both key or a list.
  116. # The configuration given in the example below is based on:
  117. # https://stribika.github.io/2015/01/04/secure-secure-shell.html
  118. #KexAlgorithms: 'curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256'
  119. #Ciphers: 'chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr'
  120. #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'
  121. KexAlgorithms:
  122. - 'curve25519-sha256@libssh.org'
  123. - 'diffie-hellman-group-exchange-sha256'
  124. Ciphers:
  125. - 'chacha20-poly1305@openssh.com'
  126. - 'aes256-gcm@openssh.com'
  127. - 'aes128-gcm@openssh.com'
  128. - 'aes256-ctr'
  129. - 'aes192-ctr'
  130. - 'aes128-ctr'
  131. MACs:
  132. - 'hmac-sha2-512-etm@openssh.com'
  133. - 'hmac-sha2-256-etm@openssh.com'
  134. - 'umac-128-etm@openssh.com'
  135. - 'hmac-sha2-512'
  136. - 'hmac-sha2-256'
  137. - 'umac-128@openssh.com'
  138. # Warning! You should generally NOT NEED to set ssh_config. Setting ssh_config
  139. # pillar will overwrite the defaults of your distribution's SSH client. This
  140. # will also force the default configuration for all the SSH clients on the
  141. # machine. This can break SSH connections with servers using older versions of
  142. # openssh. Please make sure you understand the implication of different settings
  143. ssh_config:
  144. Hosts:
  145. '*':
  146. StrictHostKeyChecking: no
  147. ForwardAgent: no
  148. ForwardX11: no
  149. RhostsRSAAuthentication: no
  150. RSAAuthentication: yes
  151. PasswordAuthentication: yes
  152. HostbasedAuthentication: no
  153. GSSAPIAuthentication: no
  154. GSSAPIDelegateCredentials: no
  155. BatchMode: 'yes'
  156. CheckHostIP: 'yes'
  157. AddressFamily: 'any'
  158. ConnectTimeout: 0
  159. IdentityFile: '~/.ssh/id_rsa'
  160. Port: 22
  161. Protocol: 2
  162. Cipher: '3des'
  163. Tunnel: 'no'
  164. TunnelDevice: 'any:any'
  165. PermitLocalCommand: 'no'
  166. VisualHostKey: 'no'
  167. # Check `man ssh_config` for supported KexAlgorithms, Ciphers and MACs first.
  168. # WARNING! Please make sure you understand the implications of the below
  169. # settings. The examples provided below might break your connection to older /
  170. # legacy openssh servers.
  171. # The configuration given in the example below is based on:
  172. # https://stribika.github.io/2015/01/04/secure-secure-shell.html
  173. # You can specify KexAlgorithms, Ciphers and MACs as both key or a list.
  174. #KexAlgorithms: 'curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1'
  175. #Ciphers: 'chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr'
  176. #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'
  177. KexAlgorithms:
  178. - 'curve25519-sha256@libssh.org'
  179. - 'diffie-hellman-group-exchange-sha256'
  180. - 'diffie-hellman-group-exchange-sha1'
  181. - 'diffie-hellman-group14-sha1'
  182. Ciphers:
  183. - 'chacha20-poly1305@openssh.com'
  184. - 'aes256-gcm@openssh.com'
  185. - 'aes128-gcm@openssh.com'
  186. - 'aes256-ctr'
  187. - 'aes192-ctr'
  188. - 'aes128-ctr'
  189. MACs:
  190. - 'hmac-sha2-512-etm@openssh.com'
  191. - 'hmac-sha2-256-etm@openssh.com'
  192. - 'umac-128-etm@openssh.com'
  193. - 'hmac-sha2-512'
  194. - 'hmac-sha2-256'
  195. - 'umac-128@openssh.com'
  196. openssh:
  197. # Instead of adding a custom banner file you can set it in pillar
  198. banner_string: |
  199. Welcome to {{ grains['id'] }}!
  200. # Set installed package version
  201. server_version: latest
  202. client_version: latest
  203. # Controls if SSHD should be enabled/started
  204. sshd_enable: true
  205. auth:
  206. joe-valid-ssh-key-desktop:
  207. - user: joe
  208. present: True
  209. enc: ssh-rsa
  210. comment: main key - desktop
  211. source: salt://ssh_keys/joe.desktop.pub
  212. joe-valid-ssh-key-notebook:
  213. - user: joe
  214. present: True
  215. enc: ssh-rsa
  216. comment: main key - notebook
  217. source: salt://ssh_keys/joe.netbook.pub
  218. joe-non-valid-ssh-key:
  219. - user: joe
  220. present: False
  221. enc: ssh-rsa
  222. comment: obsolete key - removed
  223. source: salt://ssh_keys/joe.no-valid.pub
  224. # Maps users to source files
  225. # Designed to play nice with ext_pillar
  226. # salt.states.ssh_auth: If source is set, comment and enc will be ignored
  227. auth_map:
  228. personal_keys: # store name
  229. source: salt://ssh_keys
  230. users:
  231. joe:
  232. joe.desktop: {}
  233. joe.netbook:
  234. options: [] # see salt.states.ssh_auth.present
  235. joe.no-valid:
  236. present: False
  237. generate_dsa_keys: False
  238. absent_dsa_keys: False
  239. provide_dsa_keys: False
  240. dsa:
  241. private_key: |
  242. -----BEGIN DSA PRIVATE KEY-----
  243. NOT_DEFINED
  244. -----END DSA PRIVATE KEY-----
  245. public_key: |
  246. ssh-dss NOT_DEFINED
  247. generate_ecdsa_keys: False
  248. absent_ecdsa_keys: False
  249. provide_ecdsa_keys: False
  250. ecdsa:
  251. private_key: |
  252. -----BEGIN EC PRIVATE KEY-----
  253. NOT_DEFINED
  254. -----END EC PRIVATE KEY-----
  255. public_key: |
  256. ecdsa-sha2-nistp256 NOT_DEFINED
  257. generate_rsa_keys: False
  258. generate_rsa_size: 4096
  259. # Will remove the old key if it is to short and generate a new one.
  260. enforce_rsa_size: False
  261. absent_rsa_keys: False
  262. provide_rsa_keys: False
  263. rsa:
  264. private_key: |
  265. -----BEGIN RSA PRIVATE KEY-----
  266. NOT_DEFINED
  267. -----END RSA PRIVATE KEY-----
  268. public_key: |
  269. ssh-rsa NOT_DEFINED
  270. generate_ed25519_keys: False
  271. absent_ed25519_keys: False
  272. provide_ed25519_keys: False
  273. ed25519:
  274. private_key: |
  275. -----BEGIN OPENSSH PRIVATE KEY-----
  276. NOT_DEFINED
  277. -----END OPENSSH PRIVATE KEY-----
  278. public_key: |
  279. ssh-ed25519 NOT_DEFINED
  280. known_hosts:
  281. # The next 2 settings restrict the set of minions that will be added in
  282. # the generated ssh_known_hosts files (the default is to match all minions)
  283. target: '*'
  284. tgt_type: 'glob'
  285. # Name of mining functions used to gather public keys and hostnames
  286. # (the default values are shown here)
  287. mine_keys_function: public_ssh_host_keys
  288. mine_hostname_function: public_ssh_hostname
  289. # List of DNS entries also pointing to our managed machines and that we want
  290. # to inject in our generated ssh_known_hosts file
  291. aliases:
  292. - cname-to-minion.example.org
  293. - alias.example.org
  294. # Includes short hostnames derived from the FQDN
  295. # (host.example.test -> host)
  296. # (Deactivated by default, because there can be collisions!)
  297. hostnames: False
  298. #hostnames:
  299. # Restrict wich hosts you want to use via their hostname
  300. # (i.e. ssh user@host instead of ssh user@host.example.com)
  301. # target: '*' # Defaults to "*.{{ grains['domain']}}"
  302. # tgt_type: 'glob'
  303. # To activate the defaults you can just set an empty dict.
  304. #hostnames: {}
  305. # Include localhost, 127.0.0.1 and ::1 (default: False)
  306. include_localhost: False
  307. # Host keys fetched via salt-ssh
  308. salt_ssh:
  309. # The salt-ssh user
  310. user: salt-master
  311. # specify public host names of a minion
  312. public_ssh_host_names:
  313. minion.id:
  314. - minion.id
  315. - alias.of.minion.id
  316. # specify public host keys of a minion
  317. public_ssh_host_keys:
  318. minion.id: |
  319. ssh-rsa [...]
  320. ssh-ed25519 [...]
  321. # Here you can list keys for hosts which are not among your minions:
  322. static:
  323. github.com: 'ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGm[...]'
  324. gitlab.com: 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCsj2bN[...]'
  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