Jump to content

Recommended Posts

Установил на сервер mod_secyrity2 с набором правил от OWASP для безопасности. Почему-то он блокирует админку Wordpress и часто выдаёт ошибку Access Denied в Phpmyadmin при запросах к БД. Система:

cat /etc/debian_version


Отключив mod_secyrity2

a2dismod secyrity2
и закоментировав строки
Include /usr/share/modsecurity-crs/*.conf
Include /usr/share/modsecurity-crs/base_rules/*.conf
в файле /etc/apache2/mods-enabled/mod-security.conf

я убедился что блокирует именно этот модуль.

В Яндексе есть такое решение.

Для ВП в VirtualHost (файл /etc/apache2/sites-available/site.ru.conf) добавить

<Directory "/var/www/site.ru/wp-admin">
<IfModule security2_module>
SecRuleEngine Off

Для Phpmyadmin нужно добавить в файл 


<Directory "/usr/share/phpmyadmin">
<IfModule security2_module>
SecRuleEngine Off

Теперь работает! Если кто знает более верное решение, поделитесь пожалуйста! 

Link to post
Share on other sites

В логах /var/log/apache2/error.log такие ошибки:

[Thu Sep 26 13:03:44.666135 2019] [:error] [pid 125540] [client] ModSecurity: Access denied with code 403 (phase 2). Pattern match "([\\\\~\\\\!\\\\@\\\\#\\\\$\\\\%\\\\^\\\\&\\\\*\\\\(\\\\)\\\\-\\\\+\\\\=\\\\{\\\\}\\\\[\\\\]\\\\|\\\\:\\\\;\\"\\\\'\\\\\\xc2\\xb4\\\\\\xe2\\x80\\x99\\\\\\xe2\\x80\\x98\\\\`\\\\<\\\\>].*?){8,}" at REQUEST_COOKIES:wp-settings-1. [file "/usr/share/modsecurity-crs/base_rules/modsecurity_crs_41_sql_injection_attacks.conf"] [line "157"] [id "981172"] [rev "2"] [msg "Restricted SQL Character Anomaly Detection Alert - Total # of special characters exceeded"] [data "Matched Data: & found within REQUEST_COOKIES:wp-settings-1: widgets_access=off&editor=html&hidetb=1&posts_list_mode=list&libraryContent=upload&wplink=1&mfold=o"] [ver "OWASP_CRS/2.2.9"] [maturity "9"] [accuracy "8"] [tag "OWASP_CRS/WEB_ATTACK/SQL_INJECTION"] [hostname "site.ru"] [uri "/site/ochistka-pitevoj-vody-v-domashnih-uslo/"] [unique_id "XYy3MH8AAAEAAepknz4AAAAA"]


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...