sektioneins / suhosin

SUHOSIN [수호신] for PHP 5.x - The PHP security extension.
https://www.suhosin.org
Other
471 stars 71 forks source link

Need to disable suhosin for one Directory ( live chat ) #99

Closed psalm23 closed 8 years ago

psalm23 commented 8 years ago

One of my application that has live chat create huge issues with suhosin I need to disable suhosin for let's say every thing in

mydomain.com/thisdirectory

Thanks for your help

bef commented 8 years ago

Most features can be toggled on a per-directory basis, e.g. with .htaccess. See *_INI_PERDIR in https://github.com/stefanesser/suhosin/blob/master/suhosin.c#L772 for a list of ini entries.

Also, please turn on logging to narrow down the "huge issue" to a specific configuration option, which can most certainly be set for that directory:

suhosin.log.file=255
suhosin.log.file.name=/tmp/suhosin-debug.log
psalm23 commented 8 years ago

I am sorry I am not expert in coding. Any easy way , configuration or some thing? I have a directory called www.mydomain.com/chat

If I could just disable it for chat folder I am fine

Thanks

bef commented 8 years ago
  1. Please check your suhosin version, e.g. php -v or with phpinfo();. The current version is 0.9.38.
  2. I'd be happy to assist in finding the correct configuration. Please enable logging as described before and paste the logfile.
  3. If you actually need to disable suhosin - or any PHP extension for that matter - for one directory, I suggest using a separate PHP instance, e.g. PHP-FPM, with a different configuration file and point the FastCGI handler from /chat to PHP-FPM.
psalm23 commented 8 years ago

Sorry ! I am without knowledge perhaps I need to get help from a server admin but until I find one I might just keep the suhosin simulation

OK I used csf system watch and I see logs like this

http://pastebin.com/raw.php?i=vVSbP7NQ

Not sure it can help

By the way I just installed cpanel on centos 6 a few days ago and suhosin was enabled so I think I have the latest?

psalm23 commented 8 years ago

No Idea?

bef commented 8 years ago

php -v or phpinfo() will show your Suhosin version. It should be 0.9.38.

Your logfile clearly states all violations, e.g. "configured GET variable total name length limit exceeded". Please have a look at https://suhosin.org/stories/configuration.html#suhosin-get-max-totalname-length and related options and set appropriate values until your logfiles shows no further rule violations.

psalm23 commented 8 years ago

The problem is that with the chat software I have always the name length is high and even if I put 2000 it goes higher than that , I contacted the vender he says they do not support suhosin and they do not recommend it as there will always be issues

bef commented 8 years ago

For additional help related to centos, cpanel, server administration or configuration issues in general, please refer to the rather helpful crowd driven support site http://stackoverflow.com/questions/tagged/suhosin

NewEraCracker commented 8 years ago

Hello,

I manage to work out any problems I find with Suhosin by changing the settings to something less agressive:

suhosin.get.max_name_length = 512
suhosin.get.max_totalname_length = 512
suhosin.get.max_value_length = 5120
suhosin.post.max_array_index_length = 256
suhosin.post.max_name_length = 512
suhosin.post.max_totalname_length = 8192
suhosin.post.max_vars = 5120
suhosin.request.max_array_index_length = 256
suhosin.request.max_totalname_length = 8192
suhosin.request.max_vars = 5120
suhosin.request.max_varname_length = 512

and in php.ini itself

max_input_vars = 5120

This should sort the problems you're having entirely.

If not, relax this three even further:

suhosin.get.max_name_length = 1024
suhosin.get.max_totalname_length = 1024
suhosin.request.max_varname_length = 1024
bef commented 8 years ago

@NewEraCracker: Thank you. This sums it up pretty well.