LinuxでWordPressクラスタ その4 (Pacemaker+corosync+DRBD+MySQL+Apache)

 
WAFの続きです。おそらく前回までの状態でWordpressの管理画面にログインするとエラーになるかと思います。これはSophosがSQLインジェクションと誤検知しているせいです。
WAFのログを見ればこんな感じのログが出ているかと思います。
 
 

2015:09:18-00:29:27 kokoro-nfe reverseproxy: [Fri Sep 18 00:29:27.008686 2015] [security2:error] [pid 32480:tid 3016153968] [client 175.177.16.70] ModSecurity: Warning. Pattern match "([\\\\~\\\\!\\\\@\\\\#\\\\$\\\\%\\\\^\\\\&\\\\*\\\\(\\\\)\\\\-\\\\+\\\\=\\\\{\\\\}\\\\[\\\\]\\\\|\\\\:\\\\;\\"\\\\'\\\\\\xc2\\xb4\\\\\\xe2\\x80\\x99\\\\\\xe2\\x80\\x98\\\\`\\\\<\\\\>].*?){8,}" at REQUEST_COOKIES:wp-settings-1. [file "/usr/apache/conf/waf/modsecurity_crs_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: mfold=o&editor=tinymce&dfw_width=496&libraryContent=browse&ed_size=567"] [ver "OWASP_CRS/2.2.7"] [maturity "9"] [accuracy "8"] [tag "OWASP_CRS/WEB_ATTACK/SQL_INJECTION"] [hostname "kokoro-nfe.ddns.net"] [uri "/wp-login.php"] [unique_id "VfrcV5noJkYAAH7gBnsAAAAF"]

 
 

 
Wordpress内で設定を更新したりすると、Generic Attackを検出してしまうので除外。
 
 

2015:09:20-16:24:16 kokoro-nfe reverseproxy: [Sun Sep 20 16:24:16.127388 2015] [security2:error] [pid 23625:tid 3048840048] [client 175.177.16.70] ModSecurity: Warning. Pattern match "\\\\W{4,}" at ARGS:submit. [file "/usr/apache/conf/waf/modsecurity_crs_generic_attacks.conf"] [line "37"] [id "960024"] [rev "2"] [msg "Meta-Character Anomaly Detection Alert - Repetative Non-Word Characters"] [data "Matched Data: \\xe5\\xa4\\x89\\xe6\\x9b\\xb4\\xe3\\x82\\x92\\xe4\\xbf\\x9d\\xe5\\xad\\x98 found within ARGS:submit: \\xe5\\xa4\\x89\\xe6\\x9b\\xb4\\xe3\\x82\\x92\\xe4\\xbf\\x9d\\xe5\\xad\\x98"] [ver "OWASP_CRS/2.2.7"] [maturity "9"] [accuracy "8"] [hostname "kokoro-nfe.ddns.net"] [uri "/wp-admin/options.php"] [unique_id "Vf5fIJnoKYkAAFxJ0c8AAABl"]

 
 
 

さらに記事の更新ボタンを押すとXSSで誤検知するのでこれも除外。
 

2015:09:20-16:51:21 kokoro-nfe reverseproxy: id="0299" srcip="175.177.16.70" localip="153.232.41.137" size="17" user="-" host="175.177.16.70" method="POST" statuscode="200" reason="-" extra="-" exceptions="SkipThreatsFilter_GenericAttacks, SkipThreatsFilter_SqlInjectionAttacks, SkipThreatsFilter_XssAttacks" time="256945" url="/wp-admin/admin-ajax.php" server="kokoro-nfe.ddns.net" referer="https://kokoro-nfe.ddns.net/wp-admin/options-general.php" cookie="wordpress_logged_in_42eca70d35747db29c643164445ec61a=mo-mo-tarou2001%7C1443943041%7C0280bf3d0953daeb57ed749af4d1ef3f; wordpress_sec_42eca70d35747db29c643164445ec61a=mo-mo-tarou2001%7C1443943041%7C50effe46af1dbc1e1dbeb08999046384; wp-settings-time-1=1442331043; wp-settings-time-2=1442735480; wordpress_test_cookie=WP+Cookie+check; wp-settings-1=mfold%3Do%26editor%3Dtinymce%26dfw_width%3D496%26libraryContent%3Dbrowse%26ed_size%3D567" set-cookie="-"

 
 
 

SophosのWAFの中身はOSSのmod_securityです。CUI上だとID単位で細かくdenyリストを設定できるみたいですが、無理やりCUIで設定するのもなぁ、ということでGUIから除外リストを設定します。
 
 
 

GW-20150920-024034
※写真はGeneric AttackとXSS外れてますが、実際は登録しています。正直このパスを除外してしまうと、WAFを有効にしている意味がないのですが、まぁいっか。
 
 
 

こまけぇこたぁいんだよ!
 
AA_140997043329322800

あと内部通信はHTTPのため、ブラウザで警告がでてCSSが読み込めなかったりします。ので、テーマファイルのfunction.phpの後ろのほうに相対パスを使うような記載を追記します。
 
 
WordPressで自ドメインのURLを相対パスに変換する方法
 
 
 
 
最終章へ続く
 
 
 

コメントを残す

One thought on “LinuxでWordPressクラスタ その4 (Pacemaker+corosync+DRBD+MySQL+Apache)”