Re: Password in connection string
| From: | Richard Lynch | Date: | Mon, 12 May 2003 08:21:30 +0000 |
| Subject: | Re: Password in connection string | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-147269@lists.php.net to get a copy of this message | ||
[various solutions, and lack thereof, to keeping prying eyes away from MySQL passwords deleted]
One possiblity which I may have missed in this thread (sorry!) is:
Make sure your httpd.conf is root owned and only root-readable.
Put in directives to set the password as an environment variable, but ONLY in the host/directory that *need* it.
Make sure that the average scripter can't put scripts into any directory where that environment variable is available.
Things to understand about this approach:
A) Apache starts up as root, but chroots quickly.
B) If httpd.conf can only be read by root, users can't peek.
C) If the env variable is available only to a restricted directory, scripts can't "echo" it out.
D) It requires severe restrictions on who can update that database applications directory, which may not be practical in your (or my) real-world situation.
This is probably really only practical on a dedicated server with real-world policies and procedures for allowing limited database functionality, and having a very very small set of people who can "write" new scripts in the database application.
I'm no expert, and am merely describing what has been described to me as "a good way to do it in some circumstances". If those circumstances match yours, great. If not, this info is probably as useless to you as it was to me. Sorry.
Apologies also if I've missed something in a procedure that I've only heard described, never seen implemented, and certainly can't do myself. :-)