security - Securely Storing SMTP Credentials in Java EE -
I have a Java EE application running on Glassfish 4 / Java 8 (x64). Development is on a Windows machine, but it will eventually be ported to Linux (either Red Hat or Ubuntu). In that application I need to send an email message from an SMTP server for which user authentication is required and I am using JavaMail
to make connections and send an email message. These emails are sent from the system during successful user registration, password reset request etc. Users who initiate the action will not be credentials for sending email. Similar email credentials are used for those tasks, and the email account in question is dedicated to this use.
The approach that comes to mind instantly send the email account user name and plain text password to the database or some other data store, or hard code username and plain text password in the Java EE application. There is clearly a clear security risk related to the password of storage.
There are variations on this, where I can hardly store any encrypted version of the password in the database or in the application. At that time, I am searching for a method to store the key to decrypt the password.
What methods exist in Java EE to safely manage such credentials? Am I ready to store it in plain text?
First, you mean "Java EE".
A typical way to do this is to configure a javamail session in the application server as an administered object (in this case glassfish), and look at that session in your application or configure the inject session. The username and password will include this password out of your application, but it will be accessible to all those people who can read GlassFish files on the server. To make it more secure, you can store the password in keystore, by setting a password align with password configuration, and setting a master password for GlassFish to protect Keystore. I'm sure you'll find more details in GlassFish documentation; Sorry, I do not have any links.
Comments
Post a Comment