Security – Authentication of saltmaster against salt minions

authenticationman-in-the-middlesaltstackSecurity

I am just getting started with salt and I am wondering how the saltmaster is being authenticated against the clients. I know that when connecting a minion the master has to accept the public key of the minion and therefore no unauthorized minions can connect. But what keeps someone from pretending to be the saltmaster, have all minions connecting to the wrong server and happily executing code and giving full access to an attacker?

Of course the minion connects to a given IP Address or hostname but it should be quite easy to hijack that…

Best Answer

Without extra effort nothing is preventing a (dubiously determined) attacker from initiating a man-in-the-middle attack during the first key exchange and all subsequent connections. This is the same risk inherent in any key exchange over the internet.

You can verify the fingerprints of both the master and the minion.

On master: sudo salt-key -F

On minion: sudo salt-call --local key.finger

But then you would have to trust that there isn't also an (elaborate) (sustained) man in the middle attack between you and the machine in question when you ssh into it. It is turtles all the way down.

The truly paranoid would have to pre-generate the keys offline (master and all minions) and hope along with the rest of us that their CPU's aren't somehow compromised in subtle ways we haven't yet discovered.

You can verify that the minion does refuse connecting to the master if the key doesn't later match up. Shutdown salt-minion, backup /etc/salt/pki/minion/minion_master.pub, alter it, and then start salt-minion in debug mode: sudo salt-minion -l debug