init.sls 881 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #
  2. # SSH configuration
  3. #
  4. # Install ssh server
  5. ssh:
  6. pkg.installed:
  7. - name: 'openssh-server'
  8. service.running:
  9. - enable: True
  10. - reload: True
  11. # Enforce pubkey auth (disable password auth) and reload server on config change
  12. /etc/ssh/sshd_config:
  13. file.managed:
  14. - source:
  15. - salt://ssh/sshd_config.{{ grains.os }}.{{ grains.oscodename }}
  16. - salt://ssh/sshd_config
  17. - user: root
  18. - group: root
  19. - mode: 644
  20. - watch_in:
  21. - service: ssh
  22. # Create .ssh dir for user root and install authkeys
  23. /root/.ssh:
  24. file.directory:
  25. - user: root
  26. - group: root
  27. - mode: 700
  28. - makedirs: True
  29. # Create authorized_keys for root (MASTER + host specific)
  30. /root/.ssh/authorized_keys:
  31. file.managed:
  32. - source: salt://ssh/authorized_keys.tmpl
  33. - template: jinja
  34. username: root
  35. - user: root
  36. - group: root
  37. - mode: 644