Simplify secret sending procedure with a simple python script

Adrian Angel Sanz Melchor
1 min readSep 23, 2022

We recently added some services that requires me, to generate and send accesses to users. I’m a lonely DevOps doing this, so I lose quite some time every week with these access requests. I cannot automate generating some of the secrets, because it requires human interaction or 2FA, but I can automate this:

  • Secret Gather (after the info has been created)
  • Secret creation on OTS
  • Secret sending via slack

So I started working on in and I came with this:

This script will basically:

  • Gather a secret from AWS, a file, or the command line
  • Generate the secret via onetimesecret API
  • Send it via slack, optionally, if you don’t specify an email, no slack message will be sent.

Now I just have to press enter, in what took me 5 minutes per user.

--

--

Adrian Angel Sanz Melchor

Just a spanish DevOps who likes sharing useful knowledge, working proudly @ Cipher