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.

232 lines
9.2KB

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