Re: password in md5 to connect to mysql instead of clear password

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sunday 27 February 2005 20:53, Micah Stevens wrote:
> I think about as safe as you can get is by putting the connection data
> out of the served directory, somewhere that's not directly accessable,
> and concentrate on system integrity. (security wise) 

A refinement of this technique is available on Unix boxes to which you have 
root access. 
Create a simple program that can read data about passwords etc. from a file.
Create a file that can be read by the program you've written with the 
'secrets' you want to keep secure in it. Make this file owned and readable 
only by root.
Set the program owned by root, executable by everyone and suid.

This will allow any user that can execute programs on the machine to obtain 
the password. Attackers who have just 'escaped' the web server root, say by 
taking advantage of a coding flaw, will not be able to read the password 
file. You can use groups to give finer grained access by making the program 
executable by a specific group only. However if an attacker has managed to 
obtain an account on your box they could probably just use a rootkit.

In practice I use a simple c program (for speed) to read the password file 
and a system call in my php script to call the c program. A PHP program 
could be used for reading the password file but will need to be executed by 
a shebang rather than as a parameter to php.

I can post further details if anyone is interested.

cheers Simon

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Simon Rees  |  tech-lists@xxxxxxxxxxxxxxxx  |
ORA-03113: end-of-file on communication channel
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux