# Secret variables / data: encryption

**URL:** <https://forum.ansible.com/t/secret-variables-data-encryption/13042>\
**Category:** Ansible Project\
**Created:** [June 29, 2013, 10:18pm UTC](https://forum.ansible.com/t/secret-variables-data-encryption/13042 "2013-06-29T22:18:30Z")\
**Posts on this page:** 6\
**Page:** 4

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [July 4, 2013, 4:06pm UTC](https://forum.ansible.com/t/secret-variables-data-encryption/13042/61 "2013-07-04T16:06:26Z")

</div>

Yep, there’s nothing to say a YAML encryptor algorithm could not just encrypt the “leaf” values of every YAML data structure, and also insert some code in the top to indicate it is “vaulted”, even if something is as simple as a top level YAML hash element called “vault”.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca1](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Brian\_Coca1](https://forum.ansible.com/u/Brian_Coca1)\
**Post date:** [July 4, 2013, 4:26pm UTC](https://forum.ansible.com/t/secret-variables-data-encryption/13042/62 "2013-07-04T16:26:46Z")

</div>

what about a yaml interpreter hook like:

var: !!encrypted $6$ASDFSDH$%^DFF#$@E23435fSFWEFsd

I would put key location, method and salt in ansible.cfg/env vars.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [July 4, 2013, 4:45pm UTC](https://forum.ansible.com/t/secret-variables-data-encryption/13042/63 "2013-07-04T16:45:12Z")

</div>

We don’t want to do anything that uses more YAML arcanery. I want to keep us free to represent things in other data structures, so things should be done at the datastructure level.

Also any vault metadata stuff it should have to save, which should be basically nothing, should be in each file if possible.

---

<div class="post-metadata">

**Author:** ![GW1](https://avatars.discourse-cdn.com/v4/letter/g/c89c15/32.png) [@GW1](https://forum.ansible.com/u/GW1)\
**Post date:** [July 4, 2013, 11:01pm UTC](https://forum.ansible.com/t/secret-variables-data-encryption/13042/64 "2013-07-04T23:01:17Z")

</div>

I would recommend that before a solution is prepared:

- most common usage scenarios of such a feature are known

- exactly against which security attacks the solution should protect you against

I also like the idea of not reinventing the wheel and using GPG agent (most OS have support for its keys) or something that is known to work and be secure. Imho those who want to use this advanced features should know how to set up and work with GPG keys.

Greetings,  
gw

---

<div class="post-metadata">

**Author:** ![Dylan\_Martin1](https://avatars.discourse-cdn.com/v4/letter/d/ed655f/32.png) [@Dylan\_Martin1](https://forum.ansible.com/u/Dylan_Martin1)\
**Post date:** [July 4, 2013, 11:32pm UTC](https://forum.ansible.com/t/secret-variables-data-encryption/13042/65 "2013-07-04T23:32:45Z")

</div>

You know, you could probably do this right now, today, with a combination of gpg & shell/command/raw

Playbook contains crypted text. Shell module calls out to gpg/agent/whatever and you register the decrypted result. (Does that make a secret show up in ps?)

Remember, keys are only for public key crypto. Symmetric crypto doesn’t need 'em.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [July 4, 2013, 11:59pm UTC](https://forum.ansible.com/t/secret-variables-data-encryption/13042/66 "2013-07-04T23:59:18Z")

</div>

Yeah, we’re not going to have playbook commands be part of that interface.

Want something a lot smoother than that 🙂

[Previous page](https://forum.ansible.com/t/secret-variables-data-encryption/13042.md?page=3)
