ModSecurity在Codeigniter环境中阻止TinyMCE上的Openmanager插件

时间:2016-11-12 07:51:59

标签: php codeigniter tinymce mod-security tinymce-plugins

我有一个托管在Hostgator Cloud上的网站(如果重要的话,运行Linux Cent OS),并使用Codeigniter构建。 我正在使用带Openmanager plugin的TinyMCE文本编辑器上传图片。

我的安装目录结构如下所示 -

.
├── application
|   ├── controllers
|   ├── models
|   └── views
|       └── desktop
|           └── add_question.php
├── editor
|   └── plugins
|       └── openmanager
|           ├── editor_plugin.js
|           ├── editor_plugin_src.js
|           ├── encodeexplorer.php
|           ├── index.php
|           ├── assets
|           ├── langs
|           └── php
└── upload
    ├── index.php
    ├── equations
    |   ├── imageCapture.php
    |   └── img
    └── images
        └── thumbs

application/views/desktop/add_question.php我用tinyMCE.init初始化了我的tinyMCE实例并配置了这样的openmanager -

open_manager_upload_path: '../../../upload/',

现在当我尝试使用该插件时,我会看到这个屏幕 -

enter image description here

在咨询Hostgator后,他们从他们这边向我展示了这个错误日志条目 -

[error] [client 64.233.173.158]
ModSecurity: Access denied with code 406 (phase 2).
Match of "rx (/products/index\\\\.php\\\\?gallery=|connector=\\\\.\\\\./\\\\.\\\\./connectors|/admin/(?:structure/views/|[a-z]+/(?:edit|add))|/phpthumb\\\\.php\\\\?((?:w|h)=[0-9]+&)?((?:w|h)=[0-9]+&)?src=\\\\.\\\\./.*(?:pics|uploads|images)|/site-(?:builder|content)/|/node/(?:[0-9]+/( ..."
against "REQUEST_URI" required.
[file "/opt/mod_security/10_asl_rules.conf"] [line "199"] [id "340007"] [rev "42"] [msg "Generic Path Recursion denied"] [data "/../"] [severity "CRITICAL"] [hostname "example.com"] [uri "/editor/plugins/openmanager/index.php"] [unique_id "WCSMh2yz9j4AAakC028AAAPw"]

我无法正确解读此错误。究竟是什么导致了这个错误?插件和整个应用程序在我的localhost和我拥有的另一个共享主机帐户上正常工作,但它在这个Hostgator上失败了!

1 个答案:

答案 0 :(得分:0)

制作包含以下内容的'.htaccess'文件并上传。

<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>

OR

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

根据您的要求调整重写规则。

可能会有所帮助。