Re: Common way to store db-password of open session?

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

 



On Sun, 2011-12-04 at 17:59 +0100, Andreas wrote:

> Am 03.12.2011 23:54, schrieb Tamara Temple:
> > If you give every application user a unique set of database access 
> > permissions, that means that any one of those users can access your 
> > data base WITHOUT going through your application if they manage to get 
> > access to your data base server. Is that clearer? Your application's 
> > users should not be able to access the data base directly. The 
> > application should be the thing to manage the data base. You may want 
> > to have different data base credentials for different user *roles* 
> > (plain, privileged, admin roles, etc), but to give *every* application 
> > individual data base unique credentials is not only unnecessary, but 
> > also a security risk. 
> 
> OK, then where or how is the most advisable place to store the 
> application's credentials.
> 
> One way is to have it as constants in an seperate php-file somewhere 
> within the doc-root so php can easily access it as include.
> An application that is to be put on an outside hoster's server has to do 
> it like this, I guess.
> Mine will stay on a server within the LAN for now, so I've got root access.
> 
> This way the web-server could display it in the probaply unlikely case 
> someone guesses the url to it AND the php-interpreter fails to process 
> it first.
> 
> More likely a local user could read it, though.
> 
> So how would I store it and restrict access to it?
> 


No, you put the credentials in a file /outside/ of the document root so
that it cannot be accessed by someone randomly guessing the URL. As long
as the user that the server runs as (usually something like apache or
wwwrun) has read access to the file, you should be able to include it
with a PHP script but other users won't be able to assuming that you set
the permissions 700 on it, for example. I'd avoid putting this file on
another server entirely though, as that opens up a whole new set of
potential problems.

-- 
Thanks,
Ash
http://www.ashleysheridan.co.uk



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux