Aloha,
I'd like to see a fork of the mysql extensions and perhaps other
databases (I'm actually a little partial to postgres), that allows mysql
to authenticate php scripts based on their file contents, or hash, or inode
modification time. Basically during mysql_[p]connect() calls,
1. checks if feature is enabled,
2. gathers additional data
script path and name hash,
script file contents hash (only computed if mtime changed),
script file inode mtime,
desired database name,
3. then uses this data as a key to a flat file berkeley db in
/etc/php5/
4. where it could be returned a data record containing
mysql hostname,
real database name,
real username,
real password,
5. and then transparently continues it's connection to mysql,
6. and upon success returns the connection to the php script, which
never knew the difference.
I'm almost done coding this idea into the old mysql extension for a proof
of concept and assuming it received positive feedback would enjoy coding it
into mysqli or mysqlnd, or others. I also coded up a little helper program
for managing the bdb table, to create, add, update, and remove records
from the /etc/php5/mysql_auth.db database, that the extension consults
upon page requests.
I'm doing this for a school project, for extra credit in my Software
Engineering class.
It'd be great if this idea really worked, and if there was not some huge
hole in my thinking on this subject. In any case I welcome opinions on it.
I'm particularly interested in knowing what fields would be useful in the
key and data.
thank you.
/juan
--
"only during tornadoes do apples fall far from the tree." Juan Velasquez
"there's reasons for everything, though it's too bad too often a no good
reason." Juan Velasquez
Aloha,
I'd like to see a fork of the mysql extensions and perhaps other
databases (I'm actually a little partial to postgres), that allows mysql
to authenticate php scripts based on their file contents, or hash, or inode
modification time. Basically during mysql_[p]connect() calls,
You can do this from a mysqlnd plugin, see
http://schlueters.de/blog/index.php/blog/archives/146-mysqlnd-plugins-for-PHP-in-practice.html (sorry, layout seems to be broken on the site, but content is there, it is also slightly outdated but should help to get started)
More verbose documentation is on http://php.net/mysqlnd.plugin in PECL
search for mysqlnd to find other plugins you can use as examples.
We won't add that specific feature as you describe it as it seems to be
very environment specific.
johannes
ORACLE Deutschland B.V. & Co. KG, Riesstr. 25, D-80992 München
Amtsgericht München, HRA 95603 Geschäftsführer: Jürgen Kunz
Komplementärin: ORACLE Deutschland Verwaltung B.V.
Hertogswetering 163/167, 3543 AS Utrecht, Niederlande
Handelsregister der Handelskammer Midden-Niederlande, Nr. 30143697
Geschäftsführer: Alexander van der Ven, Astrid Kepper, Val Maher