I just tried denying access to config.php using .htaccess. It works and doesn't appear to break anything. So if someone requests that file directly they'll get a 403 error, but Apache and PHP can still read it to get the info out of it they need.
# Deny access to config.php
order allow,deny
deny from all
EDIT: FIXED so it shouldn't break TinyMCE anymore.... Don't use a tilde, otherwise it'll break TinyMCE. Note I do not know if this will break other functions of CMSms. I found a few other files named config.php If you want to use this hack to "protect" config.php you may need to go into the other directories where there is a config.php file and specifically allow that file.
The reason this broke TinyMCE was because that tinyconfig.php gets loaded as javascript and wasn't getting loaded.
config.php security?
Re: config.php security?
Last edited by nivekiam on Tue Jan 22, 2008 5:18 am, edited 1 time in total.
Re: config.php security?
Thanks a bunch...will try that out!
UPDATE: that' seem to have worked when I tried disabling php on another server. It gives a "forbidden" instead of downloading the file. I think this should be added to the default cmsms htaccess.
Does anyone know what the difference is:
Order allow,deny
Deny from all
Order deny,allow
Deny from all
UPDATE: that' seem to have worked when I tried disabling php on another server. It gives a "forbidden" instead of downloading the file. I think this should be added to the default cmsms htaccess.
Does anyone know what the difference is:
Order allow,deny
Deny from all
Order deny,allow
Deny from all
Last edited by giggler on Fri Jan 18, 2008 7:59 pm, edited 1 time in total.
Re: config.php security?
I don't do regex (regular expressions) only because I haven't been able to wrap my head around them yet.
But one looks it's denying files named .ht Your host must be using .ht for the AccessFileName directive in httpd.conf
The other one is denying any file that end with .inc
There is a way to actually combine those into one statement, but I know I would get the syntax wrong.
But one looks it's denying files named .ht Your host must be using .ht for the AccessFileName directive in httpd.conf
The other one is denying any file that end with .inc
There is a way to actually combine those into one statement, but I know I would get the syntax wrong.
Re: config.php security?
Hello nivekiam,
feel free to add your config.php protection tip in the documentation. May be some commented lines in the URL filtering .htaccess example of the "optional settings".
Pierre M.
feel free to add your config.php protection tip in the documentation. May be some commented lines in the URL filtering .htaccess example of the "optional settings".
Pierre M.
Re: config.php security?
I've been using Allow from env=REDIRECT_STATUS inside this snippet to secure config.php:
Seems to be ok.
Code: Select all
<Files "config.php">
order allow,deny
deny from all
Allow from env=REDIRECT_STATUS
</Files>
"The art of life lies in a constant readjustment to our surroundings." -Okakura Kakuzo
--
LinkedIn profile
--
I only speak/write in English so I may not translate well on International posts.
--
--
LinkedIn profile
--
I only speak/write in English so I may not translate well on International posts.
--