Scheduled process - providing key for encrypted config

jim

I have developed a tool that loads in an configuration file at runtime. Some of the values are encrypted with an AES key.

The tool will be scheduled to run on a regular basis from a remote machine. What is an acceptable way to provide the decryption key to the program. It has a command line interface which I can pass it through. I can currently see three options

  1. Provide the full key via CLI, meaning the key is available in the clear at OS config level (i.e. CronJob)
  2. Hardcode the key into the binary via source code. Not a good idea for a number of reasons. (Decompiling and less portable)
  3. Use a combination of 1 and 2 i.e. Have a base key in exe and then accept partial key via CLI. This way I can use the same build for multiple machines, but it doesn't solve the problem of decompiling the exe.

It is worth noting that I am not too worried about decompiling the exe to get key. If i'm sure there are ways I could address via obfuscation etc.

Ultimately if I was really conscious I wouldn't be storing the password anywhere.

I'd like to hear what is considered best practice. Thanks.

I have added the Go tag because the tool is written in Go, just in case there is a magical Go package that might help, other than that, this question is not specific to a technology really.

UPDATE:: I am trying to protect the key from external attackers. Not the regular physical user of the machine.

Rob Napier

Best practice for this kind of system is one of two things:

  • A sysadmin authenticates during startup, providing a password at the console. This is often extremely inconvenient, but is pretty easy to implement.

  • A hardware device is used to hold the credential. The most common and effective are called HSMs (Hardware Security Modules). They come in all kinds of formats, from USB keys to plug-in boards to external rack-mounted devices. HSMs come with their own API that you would need to interface with. The main feature of an HSM is that it never divulges its key, and it has physical safeguards to protect against it being extracted. Your app sends it some data and it signs the data and returns it. That proves that that the hardware module was connected to this machine.

For specific OSes, you can make use of the local secure credential storage, which can provide some reasonable protection. Windows and OS X in particular have these, generally keyed to some credential the admin is required to type at startup. I'm not aware of a particularly effective one for Linux, and in general this is pretty inconvenient in a server setting (because of manual sysadmin intervention).

In every case that I've worked on, an HSM was the best solution in the end. For simple uses (like starting an application), you can get them for a few hundred bucks. For a little more "roll-your-own," I've seen them as cheap as $50. (I'm not reviewing these particularly. I've mostly worked with a bit more expensive ones, but the basic idea is the same.)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Method to add to an encrypted file without providing a password

From Dev

Changing AuthorizedKeysFile in `sshd_config` not solving public key auth failure with encrypted home

From Dev

knife with encrypted client key?

From Dev

Providing a customized config file for another package

From Dev

Is my drive encrypted? I can read encrypted partition without providing password

From Dev

Providing decryption key with gcloud jobs submit training

From Dev

One python process providing information for another python process

From Dev

Spring xml config enable @Async without @Scheduled

From Dev

Scheduled SSIS task hanging on execute process task

From Dev

Encrypted key unauthorized for continuous deployment Travis → Heroku

From Dev

How to use encrypted RSA private key with PyCrypto?

From Dev

Signing with encrypted RSA key fails using jsrsasign

From Dev

AES key generation for already encrypted data

From Dev

How to use encrypted RSA private key with PyCrypto?

From Dev

Can you send an API secret key if it is encrypted?

From Dev

How to decrypt an encrypted private key using the OpenSSL?

From Dev

Can't add LUKS key to encrypted swap

From Dev

SQLCipher Android, set key for not encrypted DB

From Dev

Always Encrypted How is Column Encryption Key cached?

From Dev

Generate private key encrypted with password using openssl

From Dev

Providing a generic key comparison based on a collection of a generic type

From Dev

Django Rest Framework - Create without providing a foreign key value

From Dev

Django 3 - Model.save() when providing a default for the primary key

From Dev

How do I get a key from a HashMap by providing the value?

From Dev

Postgres requires providing Primary key explicitly though the type is serial

From Dev

How to insert data inside SQlite without providing the primary key?

From Dev

Spring SAML: Error decrypting encrypted key, No installed provider supports this key

From Dev

Rails, Rake scheduled tasks and DateTime with config.time_zone on Heroku

From Dev

Grails - using config value for cron expression in scheduled jobs

Related Related

  1. 1

    Method to add to an encrypted file without providing a password

  2. 2

    Changing AuthorizedKeysFile in `sshd_config` not solving public key auth failure with encrypted home

  3. 3

    knife with encrypted client key?

  4. 4

    Providing a customized config file for another package

  5. 5

    Is my drive encrypted? I can read encrypted partition without providing password

  6. 6

    Providing decryption key with gcloud jobs submit training

  7. 7

    One python process providing information for another python process

  8. 8

    Spring xml config enable @Async without @Scheduled

  9. 9

    Scheduled SSIS task hanging on execute process task

  10. 10

    Encrypted key unauthorized for continuous deployment Travis → Heroku

  11. 11

    How to use encrypted RSA private key with PyCrypto?

  12. 12

    Signing with encrypted RSA key fails using jsrsasign

  13. 13

    AES key generation for already encrypted data

  14. 14

    How to use encrypted RSA private key with PyCrypto?

  15. 15

    Can you send an API secret key if it is encrypted?

  16. 16

    How to decrypt an encrypted private key using the OpenSSL?

  17. 17

    Can't add LUKS key to encrypted swap

  18. 18

    SQLCipher Android, set key for not encrypted DB

  19. 19

    Always Encrypted How is Column Encryption Key cached?

  20. 20

    Generate private key encrypted with password using openssl

  21. 21

    Providing a generic key comparison based on a collection of a generic type

  22. 22

    Django Rest Framework - Create without providing a foreign key value

  23. 23

    Django 3 - Model.save() when providing a default for the primary key

  24. 24

    How do I get a key from a HashMap by providing the value?

  25. 25

    Postgres requires providing Primary key explicitly though the type is serial

  26. 26

    How to insert data inside SQlite without providing the primary key?

  27. 27

    Spring SAML: Error decrypting encrypted key, No installed provider supports this key

  28. 28

    Rails, Rake scheduled tasks and DateTime with config.time_zone on Heroku

  29. 29

    Grails - using config value for cron expression in scheduled jobs

HotTag

Archive