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.

90 lines
2.1KB

  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-utils',
  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. 'default': {}
  70. }
  71. , grain="os_family"
  72. , merge=salt['pillar.get']('sshd_config:lookup'))
  73. %}
  74. {## Merge the flavor_map to the default settings ##}
  75. {% do default_settings.sshd_config.update(os_family_map) %}
  76. {## Merge in sshd_config:lookup pillar ##}
  77. {% set sshd_config = salt['pillar.get'](
  78. 'sshd_config',
  79. default=default_settings.sshd_config,
  80. merge=True
  81. )
  82. %}