1
0

hardening.rst 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. .. _hardening-salt:
  2. ==============
  3. Hardening Salt
  4. ==============
  5. This topic contains tips you can use to secure and harden your Salt
  6. environment. How you best secure and harden your Salt environment depends
  7. heavily on how you use Salt, where you use Salt, how your team is structured,
  8. where you get data from, and what kinds of access (internal and external) you
  9. require.
  10. .. important::
  11. Refer to the :ref:`saltstack_security_announcements` documentation in order to stay updated
  12. and secure.
  13. .. warning::
  14. For historical reasons, Salt requires PyCrypto as a "lowest common
  15. denominator". However, `PyCrypto is unmaintained`_ and best practice is to
  16. manually upgrade to use a more maintained library such as `PyCryptodome`_. See
  17. `Issue #52674`_ and `Issue #54115`_ for more info
  18. .. _PyCrypto is unmaintained: https://github.com/dlitz/pycrypto/issues/301#issue-551975699
  19. .. _PyCryptodome: https://pypi.org/project/pycryptodome/
  20. .. _Issue #52674: https://github.com/saltstack/salt/issues/52674
  21. .. _Issue #54115: https://github.com/saltstack/salt/issues/54115
  22. General hardening tips
  23. ======================
  24. - Restrict who can directly log into your Salt master system.
  25. - Use SSH keys secured with a passphrase to gain access to the Salt master system.
  26. - Track and secure SSH keys and any other login credentials you and your team
  27. need to gain access to the Salt master system.
  28. - Use a hardened bastion server or a VPN to restrict direct access to the Salt
  29. master from the internet.
  30. - Don't expose the Salt master any more than what is required.
  31. - Harden the system as you would with any high-priority target.
  32. - Keep the system patched and up-to-date.
  33. - Use tight firewall rules. Pay particular attention to TCP/4505 and TCP/4506
  34. on the salt master and avoid exposing these ports unnecessarily.
  35. Salt hardening tips
  36. ===================
  37. - Subscribe to `salt-users`_ or `salt-announce`_ so you know when new Salt
  38. releases are available.
  39. - Keep your systems up-to-date with the latest patches.
  40. - Use Salt's Client :ref:`ACL system <acl>` to avoid having to give out root
  41. access in order to run Salt commands.
  42. - Use Salt's Client :ref:`ACL system <acl>` to restrict which users can run what commands.
  43. - Use :ref:`external Pillar <all-salt.pillars>` to pull data into Salt from
  44. external sources so that non-sysadmins (other teams, junior admins,
  45. developers, etc) can provide configuration data without needing access to the
  46. Salt master.
  47. - Make heavy use of SLS files that are version-controlled and go through
  48. a peer-review/code-review process before they're deployed and run in
  49. production. This is good advice even for "one-off" CLI commands because it
  50. helps mitigate typos and mistakes.
  51. - Use salt-api, SSL, and restrict authentication with the :ref:`external auth
  52. <acl-eauth>` system if you need to expose your Salt master to external
  53. services.
  54. - Make use of Salt's event system and :ref:`reactor <reactor>` to allow minions
  55. to signal the Salt master without requiring direct access.
  56. - Run the ``salt-master`` daemon as non-root.
  57. - Disable which modules are loaded onto minions with the
  58. :conf_minion:`disable_modules` setting. (for example, disable the ``cmd``
  59. module if it makes sense in your environment.)
  60. - Look through the fully-commented sample :ref:`master
  61. <configuration-examples-master>` and :ref:`minion
  62. <configuration-examples-minion>` config files. There are many options for
  63. securing an installation.
  64. - Run :ref:`masterless-mode <tutorial-standalone-minion>` minions on
  65. particularly sensitive minions. There is also :ref:`salt-ssh` or the
  66. :mod:`modules.sudo <salt.modules.sudo>` if you need to further restrict
  67. a minion.
  68. - Monitor specific security related log messages. Salt ``salt-master`` logs
  69. attempts to access methods which are not exposed to network clients. These log
  70. messages are logged at the ``error`` log level and start with ``Requested
  71. method not exposed``.
  72. .. _salt-users: https://groups.google.com/forum/#!forum/salt-users
  73. .. _salt-announce: https://groups.google.com/forum/#!forum/salt-announce