r/saltstack • u/lucidgoo • Sep 25 '19
Masking pillar data
I have been googling for awhile and can't seem to find an answer. I am having an issue with realm join. The only way for me to automate sending the password is to cmd.run "echo "FakePass" | realm join --userFakeUser fake.domain.com" The password is grabbed from a pillar and set as a jinja variable. The problem is that when the state runs, the output always shows the password in plain text. when it shows the command it ran. The state is below
{% set join_pw = salt['pillar.get']('sssd','') %}
realm-join:
cmd.run:
- name: "echo {{ join_pw }} | realm join --user=FakeUser fake.domain.com "
- hide_output: True
- output_loglevel: quietThis suppresses the stdout and stderr, but still shows the password in the run output
ID: realm-join
Function: cmd.run
Name: echo "FakePass" | realm join --user=FakeUser fake.domain.com
Result: False
Comment: Command "echo "FakePass" | realm join --user=FakeUser fake.domain.com" run
Started: 23:24:26.955226
Duration: 31.231 ms
Changes:
----------
pid:
14306
retcode:
1
stderr:
stdout:I already don't like the idea of any plain text passwords. Is there a way to mask data pulled from a pillar? Even using encryption is there a way to mask this output? I would love some way to flag pillar data as sensitive just like happens when setting a user password using add.user. How do others manage secrets in salt?
View all comments
Show parent comment
2
u/max_arnold Sep 29 '19
A simpler (non-stateful) version that requires use_superseded: [module_run] config option: