Saltstack Official OpenSSH Formula
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

302 rindas
12KB

  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: 'yes'
  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. AllowUsers: 'vader@10.0.0.1 maul@evil.com sidious luke'
  48. DenyUsers: 'yoda chewbaca@112.10.21.1'
  49. AllowGroups: 'wheel staff imperial'
  50. DenyGroups: 'rebel'
  51. matches:
  52. sftp_chroot:
  53. type:
  54. Group: sftpusers
  55. options:
  56. ChrootDirectory: /sftp-chroot/%u
  57. X11Forwarding: no
  58. AllowTcpForwarding: no
  59. ForceCommand: internal-sftp
  60. # Supports complex compound matches in Match criteria. For example, be able
  61. # to match against multiple Users for a given Match, or be able to match
  62. # against address ranges. Or Groups. Or any combination thereof.
  63. #
  64. # Support for matching users can take one of several different appearances
  65. # in pillar data:
  66. match_1:
  67. type:
  68. User: one_user
  69. options:
  70. ChrootDirectory: /ex/%u
  71. match_2:
  72. type:
  73. User:
  74. - jim
  75. - bob
  76. - sally
  77. options:
  78. ChrootDirectory: /ex/%u
  79. # Note the syntax of match_3. By using empty dicts for each user, we can
  80. # leverage Salt's pillar mergine. If we use simple lists, we cannot do
  81. # this; Salt can't merge simple lists, because it doesn't know what order
  82. # they ought to be in.
  83. match_3:
  84. type:
  85. User:
  86. jim: ~
  87. bob: ~
  88. sally: ~
  89. options:
  90. ChrootDirectory: /ex/%u
  91. # Check `man sshd_config` for supported KexAlgorithms, Ciphers and MACs first.
  92. # You can specify KexAlgorithms, Ciphers and MACs as both key or a list.
  93. # The configuration given in the example below is based on:
  94. # https://stribika.github.io/2015/01/04/secure-secure-shell.html
  95. #KexAlgorithms: 'curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256'
  96. #Ciphers: 'chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr'
  97. #MACs: 'hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-ripemd160-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-ripemd160,umac-128@openssh.com'
  98. KexAlgorithms:
  99. - 'curve25519-sha256@libssh.org'
  100. - 'diffie-hellman-group-exchange-sha256'
  101. Ciphers:
  102. - 'chacha20-poly1305@openssh.com'
  103. - 'aes256-gcm@openssh.com'
  104. - 'aes128-gcm@openssh.com'
  105. - 'aes256-ctr'
  106. - 'aes192-ctr'
  107. - 'aes128-ctr'
  108. MACs:
  109. - 'hmac-sha2-512-etm@openssh.com'
  110. - 'hmac-sha2-256-etm@openssh.com'
  111. - 'hmac-ripemd160-etm@openssh.com'
  112. - 'umac-128-etm@openssh.com'
  113. - 'hmac-sha2-512'
  114. - 'hmac-sha2-256'
  115. - 'hmac-ripemd160'
  116. - 'umac-128@openssh.com'
  117. # Warning! You should generally NOT NEED to set ssh_config. Setting ssh_config
  118. # pillar will overwrite the defaults of your distribution's SSH client. This
  119. # will also force the default configuration for all the SSH clients on the
  120. # machine. This can break SSH connections with servers using older versions of
  121. # openssh. Please make sure you understand the implication of different settings
  122. ssh_config:
  123. StrictHostKeyChecking: no
  124. ForwardAgent: no
  125. ForwardX11: no
  126. RhostsRSAAuthentication: no
  127. RSAAuthentication: yes
  128. PasswordAuthentication: yes
  129. HostbasedAuthentication: no
  130. GSSAPIAuthentication: no
  131. GSSAPIDelegateCredentials: no
  132. BatchMode: 'yes'
  133. CheckHostIP: 'yes'
  134. AddressFamily: 'any'
  135. ConnectTimeout: 0
  136. IdentityFile: '~/.ssh/id_rsa'
  137. Port: 22
  138. Protocol: 2
  139. Cipher: '3des'
  140. Tunnel: 'no'
  141. TunnelDevice: 'any:any'
  142. PermitLocalCommand: 'no'
  143. VisualHostKey: 'no'
  144. # Check `man ssh_config` for supported KexAlgorithms, Ciphers and MACs first.
  145. # WARNING! Please make sure you understand the implications of the below
  146. # settings. The examples provided below might break your connection to older /
  147. # legacy openssh servers.
  148. # The configuration given in the example below is based on:
  149. # https://stribika.github.io/2015/01/04/secure-secure-shell.html
  150. # You can specify KexAlgorithms, Ciphers and MACs as both key or a list.
  151. #KexAlgorithms: 'curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1'
  152. #Ciphers: 'chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr'
  153. #MACs: 'hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-ripemd160-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-ripemd160,umac-128@openssh.com'
  154. KexAlgorithms:
  155. - 'curve25519-sha256@libssh.org'
  156. - 'diffie-hellman-group-exchange-sha256'
  157. - 'diffie-hellman-group-exchange-sha1'
  158. - 'diffie-hellman-group14-sha1'
  159. Ciphers:
  160. - 'chacha20-poly1305@openssh.com'
  161. - 'aes256-gcm@openssh.com'
  162. - 'aes128-gcm@openssh.com'
  163. - 'aes256-ctr'
  164. - 'aes192-ctr'
  165. - 'aes128-ctr'
  166. MACs:
  167. - 'hmac-sha2-512-etm@openssh.com'
  168. - 'hmac-sha2-256-etm@openssh.com'
  169. - 'hmac-ripemd160-etm@openssh.com'
  170. - 'umac-128-etm@openssh.com'
  171. - 'hmac-sha2-512'
  172. - 'hmac-sha2-256'
  173. - 'hmac-ripemd160'
  174. - 'umac-128@openssh.com'
  175. openssh:
  176. # Controls if SSHD should be enabled/started
  177. sshd_enable: true
  178. auth:
  179. joe-valid-ssh-key-desktop:
  180. - user: joe
  181. present: True
  182. enc: ssh-rsa
  183. comment: main key - desktop
  184. source: salt://ssh_keys/joe.desktop.pub
  185. joe-valid-ssh-key-notebook:
  186. - user: joe
  187. present: True
  188. enc: ssh-rsa
  189. comment: main key - notebook
  190. source: salt://ssh_keys/joe.netbook.pub
  191. joe-non-valid-ssh-key:
  192. - user: joe
  193. present: False
  194. enc: ssh-rsa
  195. comment: obsolete key - removed
  196. source: salt://ssh_keys/joe.no-valid.pub
  197. # Maps users to source files
  198. # Designed to play nice with ext_pillar
  199. # salt.states.ssh_auth: If source is set, comment and enc will be ignored
  200. auth_map:
  201. personal_keys: # store name
  202. source: salt://ssh_keys
  203. users:
  204. joe:
  205. joe.desktop: {}
  206. joe.netbook:
  207. options: [] # see salt.states.ssh_auth.present
  208. joe.no-valid:
  209. present: False
  210. generate_dsa_keys: False
  211. absent_dsa_keys: False
  212. provide_dsa_keys: False
  213. dsa:
  214. private_key: |
  215. -----BEGIN DSA PRIVATE KEY-----
  216. NOT_DEFINED
  217. -----END DSA PRIVATE KEY-----
  218. public_key: |
  219. ssh-dss NOT_DEFINED
  220. generate_ecdsa_keys: False
  221. absent_ecdsa_keys: False
  222. provide_ecdsa_keys: False
  223. ecdsa:
  224. private_key: |
  225. -----BEGIN EC PRIVATE KEY-----
  226. NOT_DEFINED
  227. -----END EC PRIVATE KEY-----
  228. public_key: |
  229. ecdsa-sha2-nistp256 NOT_DEFINED
  230. generate_rsa_keys: False
  231. generate_rsa_size: 4096
  232. # Will remove the old key if it is to short and generate a new one.
  233. enforce_rsa_size: False
  234. absent_rsa_keys: False
  235. provide_rsa_keys: False
  236. rsa:
  237. private_key: |
  238. -----BEGIN RSA PRIVATE KEY-----
  239. NOT_DEFINED
  240. -----END RSA PRIVATE KEY-----
  241. public_key: |
  242. ssh-rsa NOT_DEFINED
  243. generate_ed25519_keys: False
  244. absent_ed25519_keys: False
  245. provide_ed25519_keys: False
  246. ed25519:
  247. private_key: |
  248. -----BEGIN OPENSSH PRIVATE KEY-----
  249. NOT_DEFINED
  250. -----END OPENSSH PRIVATE KEY-----
  251. public_key: |
  252. ssh-ed25519 NOT_DEFINED
  253. known_hosts:
  254. # The next 2 settings restrict the set of minions that will be added in
  255. # the generated ssh_known_hosts files (the default is to match all minions)
  256. target: '*'
  257. expr_form: 'glob'
  258. # Name of mining functions used to gather public keys and hostnames
  259. # (the default values are shown here)
  260. mine_keys_function: public_ssh_host_keys
  261. mine_hostname_function: public_ssh_hostname
  262. # List of DNS entries also pointing to our managed machines and that we want
  263. # to inject in our generated ssh_known_hosts file
  264. aliases:
  265. - cname-to-minion.example.org
  266. - alias.example.org
  267. # specify DH parameters (see /etc/ssh/moduli)
  268. moduli: |
  269. # Time Type Tests Tries Size Generator Modulus
  270. 20120821045639 2 6 100 2047 2 DD2047CBDBB6F8E919BC63DE885B34D0FD6E3DB2887D8B46FE249886ACED6B46DFCD5553168185FD376122171CD8927E60120FA8D01F01D03E58281FEA9A1ABE97631C828E41815F34FDCDF787419FE13A3137649AA93D2584230DF5F24B5C00C88B7D7DE4367693428C730376F218A53E853B0851BAB7C53C15DA7839CBE1285DB63F6FA45C1BB59FE1C5BB918F0F8459D7EF60ACFF5C0FA0F3FCAD1C5F4CE4416D4F4B36B05CDCEBE4FB879E95847EFBC6449CD190248843BC7EDB145FBFC4EDBB1A3C959298F08F3BA2CFBE231BBE204BE6F906209D28BD4820AB3E7BE96C26AE8A809ADD8D1A5A0B008E9570FA4C4697E116B8119892C604293680B09D63
  271. 20120821045830 2 6 100 2047 2 DD2047CBDBB6F8E919BC63DE885B34D0FD6E3DB2887D8B46FE249886ACED6B46DFCD5553168185FD376122171CD8927E60120FA8D01F01D03E58281FEA9A1ABE97631C828E41815F34FDCDF787419FE13A3137649AA93D2584230DF5F24B5C00C88B7D7DE4367693428C730376F218A53E853B0851BAB7C53C15DA7839CBE1285DB63F6FA45C1BB59FE1C5BB918F0F8459D7EF60ACFF5C0FA0F3FCAD1C5F4CE4416D4F4B36B05CDCEBE4FB879E95847EFBC6449CD190248843BC7EDB145FBFC4EDBB1A3C959298F08F3BA2CFBE231BBE204BE6F906209D28BD4820AB3E7BE96C26AE8A809ADD8D1A5A0B008E9570FA4C4697E116B8119892C6042936814C2FFB
  272. 20120821050046 2 6 100 2047 2 DD2047CBDBB6F8E919BC63DE885B34D0FD6E3DB2887D8B46FE249886ACED6B46DFCD5553168185FD376122171CD8927E60120FA8D01F01D03E58281FEA9A1ABE97631C828E41815F34FDCDF787419FE13A3137649AA93D2584230DF5F24B5C00C88B7D7DE4367693428C730376F218A53E853B0851BAB7C53C15DA7839CBE1285DB63F6FA45C1BB59FE1C5BB918F0F8459D7EF60ACFF5C0FA0F3FCAD1C5F4CE4416D4F4B36B05CDCEBE4FB879E95847EFBC6449CD190248843BC7EDB145FBFC4EDBB1A3C959298F08F3BA2CFBE231BBE204BE6F906209D28BD4820AB3E7BE96C26AE8A809ADD8D1A5A0B008E9570FA4C4697E116B8119892C60429368214FC53
  273. 20120821050054 2 6 100 2047 5 DD2047CBDBB6F8E919BC63DE885B34D0FD6E3DB2887D8B46FE249886ACED6B46DFCD5553168185FD376122171CD8927E60120FA8D01F01D03E58281FEA9A1ABE97631C828E41815F34FDCDF787419FE13A3137649AA93D2584230DF5F24B5C00C88B7D7DE4367693428C730376F218A53E853B0851BAB7C53C15DA7839CBE1285DB63F6FA45C1BB59FE1C5BB918F0F8459D7EF60ACFF5C0FA0F3FCAD1C5F4CE4416D4F4B36B05CDCEBE4FB879E95847EFBC6449CD190248843BC7EDB145FBFC4EDBB1A3C959298F08F3BA2CFBE231BBE204BE6F906209D28BD4820AB3E7BE96C26AE8A809ADD8D1A5A0B008E9570FA4C4697E116B8119892C60429368218E83F
  274. # ALTERNATIVELY, specify the location of the moduli file. Examples:
  275. #moduli_source: http://some.server.somewhere/salt/moduli
  276. #moduli_source: salt://files/ssh/moduli
  277. # If moduli is specified, moduli_source will be ignored.
  278. # Also, a proper hash file *must* be included in the same path. E.g.:
  279. # http://some.server.somewhere/salt/moduli.hash
  280. # salt://files/ssh/moduli.hash
  281. # These will be automatically referenced to by the ssh_moduli state.
  282. # Required for openssh.known_hosts
  283. mine_functions:
  284. public_ssh_host_keys:
  285. mine_function: cmd.run
  286. cmd: cat /etc/ssh/ssh_host_*_key.pub
  287. python_shell: True
  288. public_ssh_hostname:
  289. mine_function: grains.get
  290. key: id