DEV Community

Discussion on: How to securely store API keys

Collapse
 
erebos-manannan profile image
Erebos Manannán

Salt Stack - a better alternative to Puppet, Chef, etc. - also comes with built-in support for encrypting secrets while you store them in your version control. Basic idea is simple:

  • You generate the public & private GPG keys on your Salt "master" -server
  • Those keys can be used to encrypt any values in Salt configuration (works on value-level, not just file-level)
  • You encrypt the environment's configuration with the environment's GPG keys
  • You store the encrypted secrets in version control
  • Only the Salt "master" server can decrypt them and release the values to various states and templates that you use to configure your servers

If not using something like Docker, then Salt is one of the best options out there for managing your server configuration (though in my opinion THE best), and supports this out of the box.

docs.saltstack.com/en/latest/ref/r...

Collapse
 
bpedro profile image
Bruno Pedro 💡

Hi Duke. Salt Stack looks very interesting. Thanks for sharing it—I'll add it to my list of alternatives.

Collapse
 
erebos-manannan profile image
Erebos Manannán

Yea it does a lot of things very well, and is built with components that you can take into use separately.

Some examples of things you can do with Salt Stack:

  • Configure your servers (install software, setup config files, restart services, yadi yadi yada)
  • Automate actions throughout your infrastructure based on events, e.g. when a new API server boots up it gets added to the load balancer
  • Orchestrate your cloud infrastructure - you configure the number of each type of server you need and Salt takes care of the rest
  • Remotely run shell commands on multiple servers simultaneously with filters
  • Do various rolling release fashion operations

Basically Salt Stack can take care of most of your server management needs.