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.

96 rindas
2.3KB

  1. {## Start with defaults from defaults.yaml ##}
  2. {% import_yaml "openssh/defaults.yaml" as default_settings %}
  3. {##
  4. Setup variable using grains['os_family'] based logic, only add key:values here
  5. that differ from whats in defaults.yaml
  6. ##}
  7. {% set os_family_map = salt['grains.filter_by']({
  8. 'Arch': {
  9. 'server': 'openssh',
  10. 'client': 'openssh',
  11. 'service': 'sshd',
  12. 'dig_pkg': 'bind-tools',
  13. },
  14. 'Debian': {
  15. 'server': 'openssh-server',
  16. 'client': 'openssh-client',
  17. 'service': 'ssh',
  18. },
  19. 'FreeBSD': {
  20. 'service': 'sshd',
  21. 'dig_pkg': 'bind-tools',
  22. 'root_group': 'wheel',
  23. },
  24. 'OpenBSD': {
  25. 'service': 'sshd',
  26. 'root_group': 'wheel',
  27. },
  28. 'Gentoo': {
  29. 'server': 'net-misc/openssh',
  30. 'client': 'net-misc/openssh',
  31. 'service': 'sshd',
  32. 'dig_pkg': 'net-dns/bind-tools',
  33. },
  34. 'RedHat': {
  35. 'server': 'openssh-server',
  36. 'client': 'openssh-clients',
  37. 'service': 'sshd',
  38. 'dig_pkg': 'bind-utils',
  39. },
  40. 'Suse': {
  41. 'server': 'openssh',
  42. 'client': 'openssh',
  43. 'service': 'sshd',
  44. 'dig_pkg': 'bind-utils',
  45. },
  46. }
  47. , grain="os_family"
  48. , merge=salt['pillar.get']('openssh:lookup'))
  49. %}
  50. {## Merge the flavor_map to the default settings ##}
  51. {% do default_settings.openssh.update(os_family_map) %}
  52. {## Merge in openssh:lookup pillar ##}
  53. {% set openssh = salt['pillar.get'](
  54. 'openssh',
  55. default=default_settings.openssh,
  56. merge=True
  57. )
  58. %}
  59. {% set os_family_map = salt['grains.filter_by']({
  60. 'FreeBSD': {
  61. 'Subsystem': 'sftp /usr/libexec/sftp-server',
  62. },
  63. 'OpenBSD': {
  64. 'Subsystem': 'sftp /usr/libexec/sftp-server',
  65. },
  66. 'Suse': {
  67. 'Subsystem': 'sftp /usr/lib/ssh/sftp-server',
  68. },
  69. 'Arch': {
  70. 'Subsystem': 'sftp /usr/lib/ssh/sftp-server',
  71. },
  72. 'RedHat': {
  73. 'Subsystem': 'sftp /usr/libexec/openssh/sftp-server',
  74. },
  75. 'default': {}
  76. }
  77. , grain="os_family"
  78. , merge=salt['pillar.get']('sshd_config:lookup'))
  79. %}
  80. {## Merge the flavor_map to the default settings ##}
  81. {% do default_settings.sshd_config.update(os_family_map) %}
  82. {## Merge in sshd_config:lookup pillar ##}
  83. {% set sshd_config = salt['pillar.get'](
  84. 'sshd_config',
  85. default=default_settings.sshd_config,
  86. merge=True
  87. )
  88. %}