This topic contains tips you can use to secure and harden your Salt environment. How you best secure and harden your Salt environment depends heavily on how you use Salt, where you use Salt, how your team is structured, where you get data from, and what kinds of access (internal and external) you require.
Important
The guidance here should be taken in combination with Salt Best Practices.
Important
Refer to the Receiving security announcements documentation in order to stay updated and secure.
Warning
For historical reasons, Salt requires PyCrypto as a "lowest common denominator". However, PyCrypto is unmaintained and best practice is to manually upgrade to use a more maintained library such as PyCryptodome. See Issue #52674 and Issue #54115 for more info
Warning
Grains can be set by users that have access to the minion configuration files on the local system, making them less secure than other identifiers in Salt. Avoid storing sensitive data, such as passwords or keys, on minions. Instead, make use of Storing Static Data in the Pillar and/or Storing Data in Other Databases.
Important
Jinja supports a secure, sandboxed template execution environment that Salt
takes advantage of. Other text Renderers do not support this
functionality, so Salt highly recommends usage of jinja / jinja|yaml.
salt-master daemon as non-root.disable_modules setting. (for example, disable the cmd
module if it makes sense in your environment.)modules.sudo if you need to further restrict
a minion.salt-master logs
attempts to access methods which are not exposed to network clients. These log
messages are logged at the error log level and start with Requested
method not exposed.There are several reasons to rotate keys. One example is exposure or a
compromised key. An easy way to rotate a key is to remove the existing keys and
let the salt-master or salt-minion process generate new keys on
restart.
Run the following on the Salt minion:
salt-call saltutil.regen_keys
systemctl stop salt-minion
Run the following on the Salt master:
salt-key -d <minion-id>
Run the following on the Salt minion:
systemctl start salt-minion
Run the following on the Salt master:
salt-key -a <minion-id>
Run the following on the Salt master:
systemctl stop salt-master
rm <pki_dir>/master.{pem,pub}
systemctl start salt-master
Run the following on the Salt minion:
systemctl stop salt-minion
rm <pki_dir>/minion_master.pub
systemctl start salt-minion