I recently saw the following construction in a salt pillar in a thread here
/srv/pillar/ssh.sls:
ssh_certs:
{% if grains['fqdn'] == 'server1.example.com' %}
dsa: |
-----BEGIN DSA PRIVATE KEY-----
{# key text goes here with consistant indentation... #}
-----END DSA PRIVATE KEY-----
ecdsa: |
-----BEGIN ECDSA PRIVATE KEY-----
{# key text goes here with consistant indentation... #}
-----END ECDSA PRIVATE KEY-----
rsa: |
-----BEGIN RSA PRIVATE KEY-----
{# key text goes here with consistant indentation... #}
-----END RSA PRIVATE KEY-----
{% elif grains['fqdn'] == 'server2.example.com' %}
# same as above but with different key texts of course....
{% endif %}
This pillar was then distributed in the top file via the *
glob to all nodes in the cluster.
Question:
Since our unevaluated template contains all of the private keys for our entire cluster, how secure is this?
I believe that the minions evaluate their own salt formulae. If they evaluate their own pillars as well, then they would temporarily be given the private keys for every node in the cluster!
If I somehow gained access to server2.example.com
, would I be able to dig up the uncompiled template?
Another way to ask this question would be: where does pillar template evaluation take place?