cahrehn Posted September 23, 2009 Share Posted September 23, 2009 I'd like to beef up the security of an app by keeping the mysql password out of any files anywhere. I'd like to input it through the command line once I start up the app and have it read from memory anytime a mysql request is going to be made. Is there a way to do this? Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/175227-how-to-store-mysql-password-in-memory-outside-of-a-file/ Share on other sites More sharing options...
Mark Baker Posted September 23, 2009 Share Posted September 23, 2009 Not particularly practical.... what happens if you have to restart the server? Quote Link to comment https://forums.phpfreaks.com/topic/175227-how-to-store-mysql-password-in-memory-outside-of-a-file/#findComment-923552 Share on other sites More sharing options...
PFMaBiSmAd Posted September 23, 2009 Share Posted September 23, 2009 What makes you think that your mysql password stored in a .php is not secure? Quote Link to comment https://forums.phpfreaks.com/topic/175227-how-to-store-mysql-password-in-memory-outside-of-a-file/#findComment-923555 Share on other sites More sharing options...
cahrehn Posted September 23, 2009 Author Share Posted September 23, 2009 @Mark: I agree that it's not practical, but in this case security is a bigger concern for me. I don't see any other way of securing the app in the case that someone gets physical access to the machine, or even command line access outside of the web directory. @PFMaBiSmAd: It's not secure in the case that someone gets physical and/or command line access to the machine. It would be sitting right there in plain-text. Quote Link to comment https://forums.phpfreaks.com/topic/175227-how-to-store-mysql-password-in-memory-outside-of-a-file/#findComment-923561 Share on other sites More sharing options...
Mark Baker Posted September 23, 2009 Share Posted September 23, 2009 @Mark: I agree that it's not practical, but in this case security is a bigger concern for me. I don't see any other way of securing the app in the case that someone gets physical access to the machine, or even command line access outside of the web directory. APC is a possible if you really want to try this approach, or memcache; though if your code can read it from memory, then so can Hackers Inc. Either you'd need a script to set the password into memory whenever you restarted your server, or you'd need it in a file. @PFMaBiSmAd: It's not secure in the case that someone gets physical and/or command line access to the machine. It would be sitting right there in plain-text.If somebody has got physical or command line access to your machine, you probably have very real problems anyway, irrespective of whether passwords are held in memory or not. You can always encrypt passwords. If you're that paranoid, I assume you have a valid ssl certificate, in which case, use that to encrypt your password in a file. Quote Link to comment https://forums.phpfreaks.com/topic/175227-how-to-store-mysql-password-in-memory-outside-of-a-file/#findComment-923568 Share on other sites More sharing options...
PFMaBiSmAd Posted September 23, 2009 Share Posted September 23, 2009 The mysql username and password is only used to secure the connection to the database server and limit what can be done over that connection. If someone has physical access to your server, they HAVE your actual database data files and can read any of the information in them. Quote Link to comment https://forums.phpfreaks.com/topic/175227-how-to-store-mysql-password-in-memory-outside-of-a-file/#findComment-923573 Share on other sites More sharing options...
cahrehn Posted September 24, 2009 Author Share Posted September 24, 2009 @Mark: Thanks, I'll look into APC and ssl encryption to see if either will do what I want. @PFMaBiSmAd: The database will be on a separate machine, so having the password absent in plain text will offer an added layer of security, especially in the case that someone without physical access gets control of the web server. They can break the app (easy to fix/restore), but they can't get to the data behind it as easily. Quote Link to comment https://forums.phpfreaks.com/topic/175227-how-to-store-mysql-password-in-memory-outside-of-a-file/#findComment-924390 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.