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.

108 lines
2.6KB

  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. }
  49. , grain="os_family"
  50. , merge=salt['pillar.get']('openssh:lookup'))
  51. %}
  52. {## Merge the flavor_map to the default settings ##}
  53. {% do default_settings.openssh.update(os_family_map) %}
  54. {## Merge in openssh:lookup pillar ##}
  55. {% set openssh = salt['pillar.get'](
  56. 'openssh',
  57. default=default_settings.openssh,
  58. merge=True
  59. )
  60. %}
  61. {% set os_family_map = salt['grains.filter_by']({
  62. 'FreeBSD': {
  63. 'Subsystem': 'sftp /usr/libexec/sftp-server',
  64. },
  65. 'OpenBSD': {
  66. 'Subsystem': 'sftp /usr/libexec/sftp-server',
  67. },
  68. 'Suse': {
  69. 'Subsystem': 'sftp /usr/lib/ssh/sftp-server',
  70. },
  71. 'Arch': {
  72. 'Subsystem': 'sftp /usr/lib/ssh/sftp-server',
  73. },
  74. 'RedHat': {
  75. 'Subsystem': 'sftp /usr/libexec/openssh/sftp-server',
  76. },
  77. 'default': {}
  78. }
  79. , grain="os_family"
  80. , merge=salt['pillar.get']('sshd_config:lookup'))
  81. %}
  82. {% set os_finger_map = salt['grains.filter_by']({
  83. 'CentOS-6': {
  84. },
  85. 'default': {}
  86. }
  87. , grain="osfinger"
  88. , merge=salt['pillar.get']('sshd_config:lookup'))
  89. %}
  90. {## Merge the flavor_map to the default settings ##}
  91. {% do default_settings.sshd_config.update(os_family_map) %}
  92. {% do default_settings.sshd_config.update(os_finger_map) %}
  93. {## Merge in sshd_config:lookup pillar ##}
  94. {% set sshd_config = salt['pillar.get'](
  95. 'sshd_config',
  96. default=default_settings.sshd_config,
  97. merge=True
  98. )
  99. %}