Saltstack Official OpenSSH Formula
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

239 lines
9.6KB

  1. # -*- coding: utf-8 -*-
  2. # vim: ft=yaml
  3. ---
  4. # yamllint disable rule:line-length
  5. # Using a stripped down version of both `sshd_config` and `ssh_config` here
  6. # The values introduced by the initial commit are taken from the Travis
  7. # instances themselves
  8. # Care must be taken when modifying this, not to lock out Travis before the
  9. # `kitchen verify` stage takes place, resulting in:
  10. # ```
  11. # $$$$$$ [SSH] connection failed, terminating (#<Net::SSH::AuthenticationFailed: Authentication failed for user kitchen@localhost>)
  12. # >>>>>> ------Exception-------
  13. # >>>>>> Class: Kitchen::ActionFailed
  14. # >>>>>> Message: 1 actions failed.
  15. # >>>>>> Failed to complete #verify action: [Transport error, can't connect to 'ssh' backend: SSH session could not be established] on ...
  16. # ```
  17. # yamllint enable rule:line-length
  18. sshd_config:
  19. ChallengeResponseAuthentication: 'no'
  20. X11Forwarding: 'yes'
  21. PrintMotd: 'no'
  22. AcceptEnv: "LANG LC_*"
  23. Subsystem: "sftp /usr/lib/openssh/sftp-server"
  24. {%- if grains.os != "OpenBSD" %}
  25. UsePAM: 'yes'
  26. {%- endif %}
  27. {#- Need this on various platforms to avoid the `kitchen verify` failure as mentioned above; see: #}
  28. {#- * https://gitlab.com/saltstack-formulas/infrastructure/salt-image-builder/-/commit/cb6781a2bba9 #}
  29. {%- if grains.os in ["Arch", "OpenBSD", "Gentoo"]
  30. or grains.get("oscodename", "") in ["openSUSE Tumbleweed"]
  31. or grains.get("osfinger", "") in ["Fedora Linux-36", "Ubuntu-22.04"] %}
  32. PubkeyAcceptedAlgorithms: "+ssh-rsa"
  33. {%- endif %}
  34. ssh_config:
  35. Hosts:
  36. '*':
  37. GSSAPIAuthentication: 'yes'
  38. HashKnownHosts: 'yes'
  39. SendEnv: 'LANG LC_*'
  40. openssh:
  41. # Instead of adding a custom banner file you can set it in pillar
  42. banner_string: |
  43. Welcome to {{ grains['id'] }}!
  44. # Set installed package version
  45. server_version: latest
  46. client_version: latest
  47. # Controls if SSHD should be enabled/started
  48. sshd_enable: true
  49. auth:
  50. joe-valid-ssh-key-desktop:
  51. - user: joe
  52. present: true
  53. enc: ssh-rsa
  54. comment: main key - desktop
  55. source: salt://ssh_keys/joe.desktop.pub
  56. joe-valid-ssh-key-notebook:
  57. - user: joe
  58. present: true
  59. enc: ssh-rsa
  60. comment: main key - notebook
  61. source: salt://ssh_keys/joe.netbook.pub
  62. joe-non-valid-ssh-key:
  63. - user: joe
  64. present: false
  65. enc: ssh-rsa
  66. comment: obsolete key - removed
  67. source: salt://ssh_keys/joe.no-valid.pub
  68. # Maps users to source files
  69. # Designed to play nice with ext_pillar
  70. # salt.states.ssh_auth: If source is set, comment and enc will be ignored
  71. auth_map:
  72. personal_keys: # store name
  73. source: salt://ssh_keys
  74. users:
  75. joe:
  76. joe.desktop: {}
  77. joe.netbook:
  78. options: [] # see salt.states.ssh_auth.present
  79. joe.no-valid:
  80. present: false
  81. generate_dsa_keys: false
  82. absent_dsa_keys: false
  83. provide_dsa_keys: false
  84. dsa:
  85. private_key: |
  86. -----BEGIN DSA PRIVATE KEY-----
  87. NOT_DEFINED
  88. -----END DSA PRIVATE KEY-----
  89. public_key: |
  90. ssh-dss NOT_DEFINED
  91. generate_ecdsa_keys: false
  92. absent_ecdsa_keys: false
  93. provide_ecdsa_keys: false
  94. ecdsa:
  95. private_key: |
  96. -----BEGIN EC PRIVATE KEY-----
  97. NOT_DEFINED
  98. -----END EC PRIVATE KEY-----
  99. public_key: |
  100. ecdsa-sha2-nistp256 NOT_DEFINED
  101. generate_rsa_keys: false
  102. generate_rsa_size: 4096
  103. # Will remove the old key if it is to short and generate a new one.
  104. enforce_rsa_size: false
  105. absent_rsa_keys: false
  106. provide_rsa_keys: false
  107. rsa:
  108. private_key: |
  109. -----BEGIN RSA PRIVATE KEY-----
  110. NOT_DEFINED
  111. -----END RSA PRIVATE KEY-----
  112. public_key: |
  113. ssh-rsa NOT_DEFINED
  114. generate_ed25519_keys: false
  115. absent_ed25519_keys: false
  116. provide_ed25519_keys: false
  117. ed25519:
  118. private_key: |
  119. -----BEGIN OPENSSH PRIVATE KEY-----
  120. NOT_DEFINED
  121. -----END OPENSSH PRIVATE KEY-----
  122. public_key: |
  123. ssh-ed25519 NOT_DEFINED
  124. known_hosts:
  125. # The next 2 settings restrict the set of minions that will be added in
  126. # the generated ssh_known_hosts files (the default is to match all minions)
  127. target: '*'
  128. tgt_type: 'glob'
  129. # Name of mining functions used to gather public keys and hostnames
  130. # (the default values are shown here)
  131. mine_keys_function: public_ssh_host_keys
  132. mine_hostname_function: public_ssh_hostname
  133. # List of DNS entries also pointing to our managed machines and that we want
  134. # to inject in our generated ssh_known_hosts file
  135. aliases:
  136. - cname-to-minion.example.org
  137. - alias.example.org
  138. # Includes short hostnames derived from the FQDN
  139. # (host.example.test -> host)
  140. # (Deactivated by default, because there can be collisions!)
  141. hostnames: false
  142. # hostnames:
  143. # Restrict wich hosts you want to use via their hostname
  144. # (i.e. ssh user@host instead of ssh user@host.example.com)
  145. # target: '*' # Defaults to "*.{{ grains['domain']}}"
  146. # tgt_type: 'glob'
  147. # To activate the defaults you can just set an empty dict.
  148. # hostnames: {}
  149. # Include localhost, 127.0.0.1 and ::1 (default: false)
  150. include_localhost: false
  151. # Host keys fetched via salt-ssh
  152. salt_ssh:
  153. # The salt-ssh user
  154. user: salt-master
  155. # specify public host names of a minion
  156. public_ssh_host_names:
  157. minion.id:
  158. - minion.id
  159. - alias.of.minion.id
  160. # specify public host keys of a minion
  161. public_ssh_host_keys:
  162. minion.id: |
  163. ssh-rsa [...]
  164. ssh-ed25519 [...]
  165. # Here you can list keys for hosts which are not among your minions:
  166. static:
  167. github.com: 'ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGm[...]'
  168. gitlab.com: 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCsj2bN[...]'
  169. omit_ip_address:
  170. - github.com
  171. # specify DH parameters (see /etc/ssh/moduli)
  172. # yamllint disable rule:line-length
  173. moduli: |
  174. # Time Type Tests Tries Size Generator Modulus
  175. 20120821045639 2 6 100 2047 2 DD2047CBDBB6F8E919BC63DE885B34D0FD6E3DB2887D8B46FE249886ACED6B46DFCD5553168185FD376122171CD8927E60120FA8D01F01D03E58281FEA9A1ABE97631C828E41815F34FDCDF787419FE13A3137649AA93D2584230DF5F24B5C00C88B7D7DE4367693428C730376F218A53E853B0851BAB7C53C15DA7839CBE1285DB63F6FA45C1BB59FE1C5BB918F0F8459D7EF60ACFF5C0FA0F3FCAD1C5F4CE4416D4F4B36B05CDCEBE4FB879E95847EFBC6449CD190248843BC7EDB145FBFC4EDBB1A3C959298F08F3BA2CFBE231BBE204BE6F906209D28BD4820AB3E7BE96C26AE8A809ADD8D1A5A0B008E9570FA4C4697E116B8119892C604293680B09D63
  176. 20120821045830 2 6 100 2047 2 DD2047CBDBB6F8E919BC63DE885B34D0FD6E3DB2887D8B46FE249886ACED6B46DFCD5553168185FD376122171CD8927E60120FA8D01F01D03E58281FEA9A1ABE97631C828E41815F34FDCDF787419FE13A3137649AA93D2584230DF5F24B5C00C88B7D7DE4367693428C730376F218A53E853B0851BAB7C53C15DA7839CBE1285DB63F6FA45C1BB59FE1C5BB918F0F8459D7EF60ACFF5C0FA0F3FCAD1C5F4CE4416D4F4B36B05CDCEBE4FB879E95847EFBC6449CD190248843BC7EDB145FBFC4EDBB1A3C959298F08F3BA2CFBE231BBE204BE6F906209D28BD4820AB3E7BE96C26AE8A809ADD8D1A5A0B008E9570FA4C4697E116B8119892C6042936814C2FFB
  177. 20120821050046 2 6 100 2047 2 DD2047CBDBB6F8E919BC63DE885B34D0FD6E3DB2887D8B46FE249886ACED6B46DFCD5553168185FD376122171CD8927E60120FA8D01F01D03E58281FEA9A1ABE97631C828E41815F34FDCDF787419FE13A3137649AA93D2584230DF5F24B5C00C88B7D7DE4367693428C730376F218A53E853B0851BAB7C53C15DA7839CBE1285DB63F6FA45C1BB59FE1C5BB918F0F8459D7EF60ACFF5C0FA0F3FCAD1C5F4CE4416D4F4B36B05CDCEBE4FB879E95847EFBC6449CD190248843BC7EDB145FBFC4EDBB1A3C959298F08F3BA2CFBE231BBE204BE6F906209D28BD4820AB3E7BE96C26AE8A809ADD8D1A5A0B008E9570FA4C4697E116B8119892C60429368214FC53
  178. 20120821050054 2 6 100 2047 5 DD2047CBDBB6F8E919BC63DE885B34D0FD6E3DB2887D8B46FE249886ACED6B46DFCD5553168185FD376122171CD8927E60120FA8D01F01D03E58281FEA9A1ABE97631C828E41815F34FDCDF787419FE13A3137649AA93D2584230DF5F24B5C00C88B7D7DE4367693428C730376F218A53E853B0851BAB7C53C15DA7839CBE1285DB63F6FA45C1BB59FE1C5BB918F0F8459D7EF60ACFF5C0FA0F3FCAD1C5F4CE4416D4F4B36B05CDCEBE4FB879E95847EFBC6449CD190248843BC7EDB145FBFC4EDBB1A3C959298F08F3BA2CFBE231BBE204BE6F906209D28BD4820AB3E7BE96C26AE8A809ADD8D1A5A0B008E9570FA4C4697E116B8119892C60429368218E83F
  179. # yamllint enable rule:line-length
  180. # ALTERNATIVELY, specify the location of the moduli file. Examples:
  181. # moduli_source: http://some.server.somewhere/salt/moduli
  182. # moduli_source: salt://files/ssh/moduli
  183. # If moduli is specified, moduli_source will be ignored.
  184. # Also, a proper hash file *must* be included in the same path. E.g.:
  185. # http://some.server.somewhere/salt/moduli.hash
  186. # salt://files/ssh/moduli.hash
  187. # These will be automatically referenced to by the ssh_moduli state.
  188. tofs:
  189. # The files_switch key serves as a selector for alternative
  190. # directories under the formula files directory. See TOFS pattern
  191. # doc for more info.
  192. # Note: Any value not evaluated by `config.get` will be used literally.
  193. # This can be used to set custom paths, as many levels deep as required.
  194. # files_switch:
  195. # - any/path/can/be/used/here
  196. # - id
  197. # - role
  198. # - osfinger
  199. # - os
  200. # - os_family
  201. # All aspects of path/file resolution are customisable using the options below.
  202. # This is unnecessary in most cases; there are sensible defaults.
  203. # path_prefix: template_alt
  204. # dirs:
  205. # files: files_alt
  206. # default: default_alt
  207. source_files:
  208. manage ssh_known_hosts file:
  209. - alt_ssh_known_hosts
  210. sshd_config:
  211. - alt_sshd_config
  212. ssh_config:
  213. - alt_ssh_config
  214. sshd_banner:
  215. - fire_banner
  216. # Required for openssh.known_hosts
  217. mine_functions:
  218. public_ssh_host_keys:
  219. mine_function: cmd.run
  220. cmd: cat /etc/ssh/ssh_host_*_key.pub
  221. python_shell: true
  222. public_ssh_hostname:
  223. mine_function: grains.get
  224. key: id