Jump to content

Recommended Posts

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

cat /etc/debian_version
8.6

 

Отключив 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
</IfModule>
</Directory>

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

/etc/apache2/sites-available/000-default.conf

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

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

Link to post
Share on other sites

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

[Thu Sep 26 13:03:44.666135 2019] [:error] [pid 125540] [client 185.220.101.48] 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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...