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.

121 lines
2.9KB

  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. 'sshd_config_group': 'wheel',
  23. 'ssh_config_group': 'wheel',
  24. },
  25. 'OpenBSD': {
  26. 'service': 'sshd',
  27. 'sshd_config_group': 'wheel',
  28. 'ssh_config_group': 'wheel',
  29. },
  30. 'Gentoo': {
  31. 'server': 'net-misc/openssh',
  32. 'client': 'net-misc/openssh',
  33. 'service': 'sshd',
  34. 'dig_pkg': 'net-dns/bind-tools',
  35. },
  36. 'RedHat': {
  37. 'server': 'openssh-server',
  38. 'client': 'openssh-clients',
  39. 'service': 'sshd',
  40. 'dig_pkg': 'bind-utils',
  41. },
  42. 'Suse': {
  43. 'server': 'openssh',
  44. 'client': 'openssh',
  45. 'service': 'sshd',
  46. 'dig_pkg': 'bind-utils',
  47. },
  48. 'Solaris': {
  49. 'service': 'network/ssh',
  50. 'sshd_config_group': 'root',
  51. 'ssh_config_group': 'root',
  52. 'dig_pkg': 'bind',
  53. 'sshd_binary': '/usr/lib/ssh/sshd',
  54. },
  55. }
  56. , grain="os_family"
  57. , merge=salt['pillar.get']('openssh:lookup'))
  58. %}
  59. {## Merge the flavor_map to the default settings ##}
  60. {% do default_settings.openssh.update(os_family_map) %}
  61. {## Merge in openssh:lookup pillar ##}
  62. {% set openssh = salt['pillar.get'](
  63. 'openssh',
  64. default=default_settings.openssh,
  65. merge=True
  66. )
  67. %}
  68. {% set os_family_map = salt['grains.filter_by']({
  69. 'FreeBSD': {
  70. 'Subsystem': 'sftp /usr/libexec/sftp-server',
  71. },
  72. 'OpenBSD': {
  73. 'Subsystem': 'sftp /usr/libexec/sftp-server',
  74. },
  75. 'Suse': {
  76. 'Subsystem': 'sftp /usr/lib/ssh/sftp-server',
  77. },
  78. 'Arch': {
  79. 'Subsystem': 'sftp /usr/lib/ssh/sftp-server',
  80. },
  81. 'Debian': {
  82. 'Subsystem': 'sftp /usr/lib/openssh/sftp-server',
  83. },
  84. 'RedHat': {
  85. 'Subsystem': 'sftp /usr/libexec/openssh/sftp-server',
  86. },
  87. 'Solaris': {
  88. 'Subsystem': 'sftp internal-sftp',
  89. },
  90. 'default': {}
  91. }
  92. , grain="os_family"
  93. , merge=salt['pillar.get']('sshd_config:lookup'))
  94. %}
  95. {% set os_finger_map = salt['grains.filter_by']({
  96. 'CentOS-6': {
  97. },
  98. 'default': {}
  99. }
  100. , grain="osfinger"
  101. , merge=salt['pillar.get']('sshd_config:lookup'))
  102. %}
  103. {## Merge the flavor_map to the default settings ##}
  104. {% do default_settings.sshd_config.update(os_family_map) %}
  105. {% do default_settings.sshd_config.update(os_finger_map) %}
  106. {## Merge in sshd_config:lookup pillar ##}
  107. {% set sshd_config = salt['pillar.get'](
  108. 'sshd_config',
  109. default=default_settings.sshd_config,
  110. merge=True
  111. )
  112. %}