転載・引用について

ユーザ用ツール

サイト用ツール


networkapp:waf:mod-security

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン前のリビジョン
次のリビジョン
前のリビジョン
networkapp:waf:mod-security [2018/10/30 19:32] – [NGINXをInstallする] seiriosnetworkapp:waf:mod-security [2018/11/14 17:00] (現在) – [MonitorModeWAF] seirios
行 3: 行 3:
 NGINXを利用して、Proxy/Signature型のWAFを構築する。 NGINXを利用して、Proxy/Signature型のWAFを構築する。
  
-{{ :construct.gif?400 |}} 
 ===== 構成 ===== ===== 構成 =====
  
行 89: 行 88:
 ### ARP cache timeout ### ARP cache timeout
 net.link.ether.inet.max_age=97 net.link.ether.inet.max_age=97
 +</code>
 +
 +セマフォの拡張はboot時に行う必要があるので、/boot/loader.confに記述
 +<code - /boot/loader.conf>
 +### for WAF
 +kern.ipc.semmsl=340 # 340 : max # of semaphores per id
 +kern.ipc.semmns=128000 # 340 : # of semaphores in system
 +kern.ipc.semopm=100 # 100 : max # of operations per semop call
 +kern.ipc.semmni=512 # 50  : # of semaphore identifiers
 +
 +kern.ipc.semaem=16384 # 16384 : adjust on exit max value
 +kern.ipc.semvmx=32767 # 32767 : semaphore maximum value
 +kern.ipc.semusz=632 # 632   : size in bytes of undo structure
 +kern.ipc.semume=50 # 50    : max # of undo entries per process
 +kern.ipc.semmnu=150 # 150   : # of undo structures in system
 </code> </code>
  
行 99: 行 113:
 </code> </code>
   * ''mount -a''を実行   * ''mount -a''を実行
- 
 ==== WAFのInstall ==== ==== WAFのInstall ====
  
行 206: 行 219:
 </code> </code>
  
-<WRAP tip>+<WRAP round tip>
 2018/10/26現在、Releaseされているmod_securityは、3.0.2だが、OWASP CRSのHEADは''v3.2/dev''であり、このCRSは、mod_security 3.1.0にて追加される機能を仮定している。\\ 2018/10/26現在、Releaseされているmod_securityは、3.0.2だが、OWASP CRSのHEADは''v3.2/dev''であり、このCRSは、mod_security 3.1.0にて追加される機能を仮定している。\\
 そのため、現在の段階では、以下の追加操作が必要になる。 そのため、現在の段階では、以下の追加操作が必要になる。
行 218: 行 231:
  
 この作業を行わないと、CRSの読み込みの段階で複数のエラーが発生して大ハマりすることになる。 この作業を行わないと、CRSの読み込みの段階で複数のエラーが発生して大ハマりすることになる。
 +
 +なお、現在利用しているBranchを確認するには、''git branch -v''を実行すること
 </WRAP> </WRAP>
  
行 586: 行 601:
                         +- nginx -+- ...                               : FreeBSD portsによって作成される                         +- nginx -+- ...                               : FreeBSD portsによって作成される
                                   +- modsec -+- MM-Base.conf           : MonitorMode用基本設定                                   +- modsec -+- MM-Base.conf           : MonitorMode用基本設定
-                                  |          +- MM.conf                : MonitorMode WAF設定 +                                  |          +- MM0.conf               : MonitorMode WAF#0 設定 
-                                  |          +- MM-preCRS.conf         : MonitorMode用OWASP CRS読み込み前設定 +                                  |          +- MM0-preLoad.conf       : MonitorMode WAF#0rule読み込み前設定 
-                                  |          +- MM-preLocal.conf       : MonitorMode用local signature読み込み前設定 +                                  |          +- MM0-postLoad.conf      : MonitorMode WAF#0rule読み込み後設定
-                                  |          +- MM-postCRS.conf        : MonitorMode用OWASP CRS読み込み後設定 +
-                                  |          +- MM-postLocal.conf      : MonitorMode用local signature読み込み後設定+
                                   |          +- DM-Base.conf           : DropMode用基本設定                                   |          +- DM-Base.conf           : DropMode用基本設定
-                                  |          +- DM.conf                : DropMode WAF設定 +                                  |          +- DM0.conf               : DropMode WAF#0 設定 
-                                  |          +- DM-preCRS.conf         : DropMode用OWASP CRS読み込み前設定 +                                  |          +- DM0-preLoad.conf       : DropMode WAF#0rule読み込み前設定 
-                                  |          +- DM-preLocal.conf       : DropMode用local signature読み込み前設定 +                                  |          +- DM0-postLoad.conf      : DropMode WAF$0rule読み込み後設定
-                                  |          +- DM-postCRS.conf        : DropMode用OWASP CRS読み込み後設定 +
-                                  |          +- DM-postLocal.conf      : DropMode用local signature読み込み後設定+
                                   +- conf.http                         : http configuration                                   +- conf.http                         : http configuration
                                   +- conf.http.d -+- ...               : server/location configuration                                   +- conf.http.d -+- ...               : server/location configuration
行 612: 行 623:
       * <code diff MonitorModeBase.conf.diff>       * <code diff MonitorModeBase.conf.diff>
 # diff -u ../../modsecurity/modsecurity.conf.sample MM-Base.conf # diff -u ../../modsecurity/modsecurity.conf.sample MM-Base.conf
---- ../../modsecurity/modsecurity.conf.sample   2018-10-03 16:25:08.000000000 +0900 +--- ../../modsecurity/modsecurity.conf.sample   2018-11-04 09:12:19.000000000 +0900 
-+++ MM-Base.conf        2018-10-26 14:40:57.052583000 +0900++++ MM-Base.conf        2018-11-14 16:54:42.293424000 +0900
 @@ -35,7 +35,8 @@ @@ -35,7 +35,8 @@
  # to the size of data, with files excluded. You want to keep that value as  # to the size of data, with files excluded. You want to keep that value as
行 680: 行 691:
 # #
  
-# ModSecurity configuration for DropMode.+# ModSecurity configuration for DetectMode.
 Include /usr/local/etc/nginx/modsec/MM-Base.conf Include /usr/local/etc/nginx/modsec/MM-Base.conf
  
-OWASP CRS configuration.+Load signature configuration
 Include /usr/local/waf/owasp-modsecurity-crs/crs-setup.conf Include /usr/local/waf/owasp-modsecurity-crs/crs-setup.conf
 Include /usr/local/waf/local-modsecurity-sigs/local-setup.conf Include /usr/local/waf/local-modsecurity-sigs/local-setup.conf
  
 # Preload of omitting signature # Preload of omitting signature
-Include /usr/local/etc/nginx/modsec/MM-preCRS.conf +Include /usr/local/etc/nginx/modsec/MM-preLoad.conf
-Include /usr/local/etc/nginx/modsec/MM-preLocal.conf+
  
-Include OWASP CRS Configurations and Signature Rules.+Load Signature Rules.
 Include /usr/local/waf/owasp-modsecurity-crs/rules/*.conf Include /usr/local/waf/owasp-modsecurity-crs/rules/*.conf
 Include /usr/local/waf/local-modsecurity-sigs/rules/*.conf Include /usr/local/waf/local-modsecurity-sigs/rules/*.conf
  
 # Postload of omitting signature # Postload of omitting signature
-Include /usr/local/etc/nginx/modsec/MM-postCRS.conf +Include /usr/local/etc/nginx/modsec/MM-postLoad.conf
-Include /usr/local/etc/nginx/modsec/MM-postLocal.conf+
 </code> </code>
-  - 以下、MM-(pre|post)(CRS|Local).confを作成する +  - 以下、MM-(pre|post)Load.confを作成する 
-    - <code - MM-preCRS.conf>+    - <code - MM-preLoad.conf>
 # #
-# ModSecurity preload omitting signatures for OWASP CRS+# ModSecurity preload configuration.
 # #
-# id: 1000 - 2999+# id: 1000 - 1999 : for OWASP CRS 
 +# id: 2000 - 2999 : Reserve 
 +# id: 3000 - 4999 : for local Sigs
  
 #SecAction "id:'1000',phase:1,t:none,pass,nolog,ctl:ruleRemoveById=900000" #SecAction "id:'1000',phase:1,t:none,pass,nolog,ctl:ruleRemoveById=900000"
- 
-# ModSecurity BUG. fixed at 3.1.0. 
-#SecAction "id:'1001',phase:1,t:none,pass,nolog,ctl:ruleRemoveById=901350" 
 </code> </code>
-    - <code - MM-preLocal.conf>+    - <code - MM-postLoad.conf>
 # #
-# ModSecurity preload omitting signatures for Local signatures.+# ModSecurity postload configuration.
 # #
-# id: 3000 4999+# id: 5000 5999 : for OWASP CRS 
 +# id: 6000 - 6999 : Reserve 
 +# id: 7000 - 8999 : for local Sigs
  
-#SecAction "id:'3000',phase:1,t:none,pass,nolog,ctl:ruleRemoveById=10000" +#SecRuleRemoveById 900000
-</code> +
-    - <code - MM-postCRS.conf> +
-+
-# ModSecurity postload omitting signatures for OWASP CRS +
-+
-# id: 5000 - 6999 +
- +
-#SecAction "id:'5000',phase:1,t:none,pass,nolog,ctl:ruleRemoveById=900000+
-</code> +
-    - <code - MM-postLocal.conf> +
-+
-# ModSecurity postload omitting signatures for OWASP CRS +
-+
-# id: 7000 - 8999 +
- +
-#SecAction "id:'7000',phase:1,t:none,pass,nolog,ctl:ruleRemoveById=10000"+
 </code> </code>
  
 これで、MonitorMode WAFの設定ファイルが完成。 これで、MonitorMode WAFの設定ファイルが完成。
- 
 === DropModeWAF === === DropModeWAF ===
   - 次にDropMode WAFを構築する。   - 次にDropMode WAFを構築する。
行 759: 行 752:
 これで、DropMode WAFの構築も終了。 これで、DropMode WAFの構築も終了。
  
-<WRAP info>+<WRAP round info>
 なお、実際には、MonitorModeは検出のみだから全Signatureを利用していても性能が劣化する程度で済むことが多いが、DropModeの場合は、preLoadやPostloadの設定で、不要なSignatureをOffにする、もしくは重みつけを0にする必要があることに注意。 なお、実際には、MonitorModeは検出のみだから全Signatureを利用していても性能が劣化する程度で済むことが多いが、DropModeの場合は、preLoadやPostloadの設定で、不要なSignatureをOffにする、もしくは重みつけを0にする必要があることに注意。
  
-preCRSPostCRSを作成してあるのはそのため。+preLoadPostLoadを作成してあるのはそのため。
 </WRAP> </WRAP>
  
行 887: 行 880:
  
 # ID # ID
-# 1000-2999: Preload ommiting signature list of OWASP CRS +# 1000-1999: Preload for OWASP CRS 
-3000-4999: Preload ommiting signature list of LOCAL SIGNATURES +2000-3999: Reserve 
-# 5000-6999Postload ommiting signature list of OWASP CRS +# 4000-4999: Preload for local Sigs. 
-7000-8999: Postload ommiting signature list of LOCAL SIGNATURES+# 5000-5999Preload for OWASP CRS 
 +6000-7999: Reserve 
 +# 8000-8999: Preload for local Sigs.
 # 10000-10999: local signatures part 1 # 10000-10999: local signatures part 1
 # 11000-11999: local signatures part 2 (Reserved) # 11000-11999: local signatures part 2 (Reserved)
networkapp/waf/mod-security.1540895558.txt.gz · 最終更新: 2018/10/30 19:32 by seirios

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki