Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: encrypt passwords

by mr_mischief (Monsignor)
on Apr 17, 2015 at 18:18 UTC ( [id://1123808]=note: print w/replies, xml ) Need Help??


in reply to encrypt passwords

TL;DR :: OP should use Kerberos or PAM or some other pluggable authentication method on the MySQL end.

I think the discussion is about the particular case in the thread. It's absolutely true that the authentication system should have one-way hashed passwords. However, the OP appears to be wanting to store actual decryptable, non-hashed credentials used to connect to another system.

Now there are reasons this is a bad idea, and that's what people are asserting. In the OP's case, something needs to decrypt these passwords to achieve what OP is trying to do. Therefore anyone who can access these non-hashed encrypted passwords is likely to also have access to the decryption routine, rendering encryption mostly moot. That's why it's a bad idea.

There are ways to set up a password vault that addresses some of these concerns, but anything that must run from cron is going to have a weak link in security somewhere. The cron system would need access to the vault in this case, so it's still basically plaintext passwords. The only real fix is to use something like public key cryptography.

Thankfully, database software tends to have lots of ways to authenticate. MySQL has pluggable authentication which support Kerberos, PAM, etc. Postgres has its own auth methods including GSSAPI with Kerberos.

Since this is running under cron, there's still going to be a bit of a weak link in that some likely unmanned and unwatched user account will house the private keys, but it's still a lot better than depending on plaintext passwords on disk.

Edit: changed version-specific URL to track current version for Postgresql after a suggestion from erix

Replies are listed 'Best First'.
Re^2: encrypt passwords
by sundialsvc4 (Abbot) on Apr 17, 2015 at 23:28 UTC

    In the Linux environment, PAM is usually the “glue” that is ordinarily used, as it was designed and intended to be, although implementations vary.     “Password” authentication is commonly superseded, and even disallowed.   Thus, the corporate security team has definitive and exclusive control.   (A “password” alternative would be tantamount to a “back door,” from their very-sensible point of view.)

      PAM is the default for system accounts. I assure you I've very rarely seen it deployed in the wild for authentication of database connections, which is the topic in the context of this thread.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1123808]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (8)
As of 2024-04-19 12:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found