Load Aegir's site credentials from a php function
Installing sites in sub-directories is supported in Aegir 2+ without any such hacking. Just enable the "Site subdirectories" feature, under the 'experimental' group at admin/hosting/features.

That said, to answer your question, DB credentials are available via drush_get_context('site').