Skip to content

Instantly share code, notes, and snippets.

@boxrick
Created February 15, 2018 00:54
Show Gist options
  • Save boxrick/2045843f4775cadba54f13101c58233c to your computer and use it in GitHub Desktop.
Save boxrick/2045843f4775cadba54f13101c58233c to your computer and use it in GitHub Desktop.
Open SSL smime Cert
Generating a pub cert from your private key ( This is going to be stored inside Ansible mist under each user )
openssl req -x509 -new -key ~/.ssh/id_rsa -nodes -subj "/C=GB/ST=*/L=*/O=*/OU=*/CN=NAMEHERE/"
Encrypting some data against the above key(s)
echo STRINGTOENCRYPT | openssl smime -encrypt -aes256 -outform PEM /tmp/rick.CERT /tmp/james.CERT /tmp/stuartgr.CERT
Decrypting data
openssl smime -decrypt -in /tmp/ONDISKENCRYPTEDSTRINGFILE -inform PEM -inkey ~/.ssh/id_rsa
^^ can also be fed from stdin as per encrypting line
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment