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.

73 lines
1.7KB

  1. openssh:
  2. pkg:
  3. - installed
  4. {% if grains['os_family'] == 'Debian' %}
  5. - name: openssh-server
  6. {% endif %}
  7. service.running:
  8. - enable: True
  9. {% if grains['os_family'] == 'RedHat' %}
  10. - name: sshd
  11. {% else %}
  12. - name: ssh
  13. {% endif %}
  14. - require:
  15. - pkg: openssh
  16. - file: sshd_banner
  17. - watch:
  18. - file: sshd_config
  19. {% if salt['pillar.get']('openssh:provide_dsa_keys', False) %}
  20. - file: /etc/ssh/ssh_host_dsa_key
  21. - file: /etc/ssh/ssh_host_dsa_key.pub
  22. {% endif %}
  23. {% if salt['pillar.get']('openssh:provide_rsa_keys', False) %}
  24. - file: /etc/ssh/ssh_host_rsa_key
  25. - file: /etc/ssh/ssh_host_rsa_key.pub
  26. {% endif %}
  27. sshd_config:
  28. file.managed:
  29. - name: /etc/ssh/sshd_config
  30. - source: salt://openssh/files/sshd_config
  31. - template: jinja
  32. - user: root
  33. - mode: 600
  34. sshd_banner:
  35. file.managed:
  36. - name: /etc/ssh/banner
  37. - source: salt://openssh/files/banner
  38. - template: jinja
  39. {% if salt['pillar.get']('openssh:provide_dsa_keys', False) %}
  40. ssh_host_dsa_key:
  41. file.managed:
  42. - name: /etc/ssh/ssh_host_dsa_key
  43. - contents_pillar: 'openssh:dsa:private_key'
  44. - user: root
  45. - mode: 600
  46. ssh_host_dsa_key.pub:
  47. file.managed:
  48. - name: /etc/ssh/ssh_host_dsa_key.pub
  49. - contents_pillar: 'openssh:dsa:public_key'
  50. - user: root
  51. - mode: 600
  52. {% endif %}
  53. {% if salt['pillar.get']('openssh:provide_rsa_keys', False) %}
  54. ssh_host_rsa_key:
  55. file.managed:
  56. - name: /etc/ssh/ssh_host_rsa_key
  57. - contents_pillar: 'openssh:rsa:private_key'
  58. - user: root
  59. - mode: 600
  60. ssh_host_rsa_key.pub:
  61. file.managed:
  62. - name: /etc/ssh/ssh_host_rsa_key.pub
  63. - contents_pillar: 'openssh:rsa:public_key'
  64. - user: root
  65. - mode: 600
  66. {% endif %}