{"id":7319,"date":"2022-01-07T15:44:32","date_gmt":"2022-01-07T06:44:32","guid":{"rendered":"https:\/\/www.stuffy.site\/computers\/?p=7319"},"modified":"2024-03-02T11:53:13","modified_gmt":"2024-03-02T02:53:13","slug":"apache%e5%af%be%e5%bf%9cwafmod_security%e3%81%ae%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab","status":"publish","type":"post","link":"https:\/\/www.stuffy.site\/computers\/archives\/7319","title":{"rendered":"Apache\u5bfe\u5fdcWAF(mod_security)\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb"},"content":{"rendered":"\n<p>Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u8106\u5f31\u6027\u3092\u885d\u304fSQL\u30a4\u30f3\u30b8\u30a7\u30af\u30b7\u30e7\u30f3\u3084\u30af\u30ed\u30b9\u30b5\u30a4\u30c8\u30b9\u30af\u30ea\u30d7\u30c6\u30a3\u30f3\u30b0\u3092\u9632\u3050\u30aa\u30fc\u30d7\u30f3\u30bd\u30fc\u30b9\u306eApache\u5bfe\u5fdcWAF(mod_security)\u3092\u81ea\u5b85Web\u30b5\u30fc\u30d0\u30fc\u306eCentOS7\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<!--more-->\n\n\n\n<p><a href=\"https:\/\/www.shadan-kun.com\/blog\/measure\/2939\/\">\u30aa\u30fc\u30d7\u30f3\u30bd\u30fc\u30b9\u306eWAF\u300cMod Security\u300d\u306e\u30e1\u30ea\u30c3\u30c8\u3068\u305d\u306e\u5c0e\u5165\u65b9\u6cd5\u306b\u3064\u3044\u3066<\/a><\/p>\n\n\n\n<p>\u307e\u305ayum \u304b\u3089mod_security \u672c\u4f53\u3001\u95a2\u9023\u30d5\u30a1\u30a4\u30eb\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066Apache \u3092\u518d\u8d77\u52d5\u3057\u307e\u3059\u3002<\/p>\n\n\n<pre># yum install mod_security mod_security_crs\n# systemctl restart httpd<\/pre>\n<p>\u3053\u308c\u3067\u3001\/etc\/httpd\/modsecurity.d\/activated_rules\/ \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u3042\u308b\u30eb\u30fc\u30eb\u304c\u4f5c\u52d5\u3057\u307e\u3059\u3002<\/p>\n<p>\u3057\u304b\u3057\u3053\u308c\u3067\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u30eb\u30fc\u30eb\u304c\u53b3\u3057\u304fCMS\u306e\u52d5\u4f5c\u306b\u5f71\u97ff\u304c\u5927\u304d\u3044\u306e\u3067\u3001\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u958b\u3044\u3066\u7de8\u96c6\u3057\u307e\u3059\u3002<\/p>\n<pre># vi \/etc\/httpd\/conf.d\/mod_security.conf\n<br>\u2193 \u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\n#IncludeOptional modsecurity.d\/activated_rules\/*.conf\n<br>\u2193 \u8ffd\u8a18\nInclude modsecurity.d\/activated_rules\/modsecurity_crs_41_xss_attacks.conf\nInclude modsecurity.d\/activated_rules\/modsecurity_crs_41_sql_injection_attacks.conf\n<br>httpd\u518d\u8d77\u52d5\n# systemctl restart httpd<\/pre>\n\n\n<p>\u30b5\u30a4\u30c8\u306b\u30ed\u30b0\u30a4\u30f3\u3059\u308b\u3068403&nbsp;Forbidden \u30a8\u30e9\u30fc\u304c\u8fd4\u3063\u3066\u304f\u308b\u306e\u3067\u3001\u507d\u967d\u6027\u306e\u30c6\u30b9\u30c8\u3092\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p>CMS\u306e\u500b\u5225\u64cd\u4f5c\u306b\u5bfe\u3057\u3066\u30a8\u30e9\u30fcID \u3092\u4f8b\u5916\u51e6\u7406\u3059\u308b\u305f\u3081\u3001SecRuleEngine On\u3092\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u3057\u3066SecRuleEngine DetectionOnly \u3092\u8ffd\u8a18\u3001httpd\u518d\u8d77\u52d5\u30fb\u30fb\u30fb\u3002<\/p>\n\n\n<pre># vi etc\/httpd\/conf.d\/mod_security.conf\n<br>\n#SecRuleEngine On\nSecRuleEngine DetectionOnly\n<br># systemctl restart httpd<\/pre>\n<p>\u30d6\u30ed\u30c3\u30af\u3057\u3066\u3044\u308bID\u3092\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb(\/var\/log\/httpd\/modsec_audit.log)\u304b\u3089\u63a2\u3057\u3066\u3001\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u306e\u6700\u4e0b\u884c\u306b<\/p>\n<p>SecRuleRemoveById 960008<\/p>\n<p>\u3068\u3044\u3046\u69d8\u306b\u8ffd\u8a18\u3057\u3066\u884c\u304d\u307e\u3059\u3002<\/p>\n\n\n<p>\/var\/log\/httpd\/modsec_audit.log<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2021\/04\/modsec_audit.png\"><img loading=\"lazy\" decoding=\"async\" width=\"659\" height=\"486\" src=\"https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2021\/04\/modsec_audit.png\" alt=\"\" class=\"wp-image-7326\" srcset=\"https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2021\/04\/modsec_audit.png 659w, https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2021\/04\/modsec_audit-300x221.png 300w\" sizes=\"auto, (max-width: 659px) 100vw, 659px\" \/><\/a><\/figure>\n\n\n\n<p>\/etc\/httpd\/conf.d\/mod_security.conf \u6700\u4e0b\u884c\u306bID\u3092\u8ffd\u8a18<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2021\/04\/SecRemoveById.png\"><img loading=\"lazy\" decoding=\"async\" width=\"587\" height=\"1024\" src=\"https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2021\/04\/SecRemoveById-587x1024.png\" alt=\"\" class=\"wp-image-7324\" srcset=\"https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2021\/04\/SecRemoveById-587x1024.png 587w, https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2021\/04\/SecRemoveById-172x300.png 172w, https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2021\/04\/SecRemoveById-768x1339.png 768w, https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2021\/04\/SecRemoveById-881x1536.png 881w, https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2021\/04\/SecRemoveById.png 1078w\" sizes=\"auto, (max-width: 587px) 100vw, 587px\" \/><\/a><\/figure><\/div>\n\n\n\n<p>SecRuleEngine On&nbsp;\u3057\u3066 httpd\u3092\u518d\u8d77\u52d5\u3057\u3066\u30a8\u30e9\u30fc\u304c\u51fa\u306a\u304f\u306a\u308c\u3070\u4f5c\u696d\u5b8c\u4e86\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u304a\u75b2\u308c\u3055\u307e\u3067\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u53c2\u8003URL:&nbsp;<a href=\"https:\/\/www.websec-room.com\/2013\/11\/17\/1019\">\u30aa\u30fc\u30d7\u30f3\u30bd\u30fc\u30b9\u306e WAF \u3067\u3042\u308b ModSecurity \u3092 CentOS \u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u8106\u5f31\u6027\u3092\u885d\u304fSQL\u30a4\u30f3\u30b8\u30a7\u30af\u30b7\u30e7\u30f3\u3084\u30af\u30ed\u30b9\u30b5\u30a4\u30c8\u30b9\u30af\u30ea\u30d7\u30c6\u30a3\u30f3\u30b0\u3092\u9632\u3050\u30aa\u30fc\u30d7\u30f3\u30bd\u30fc\u30b9\u306eApache\u5bfe\u5fdcWAF(mod_security)\u3092\u81ea\u5b85Web\u30b5\u30fc\u30d0\u30fc\u306eCentOS7\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u307f\u307e\u3057 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[44,5,34],"tags":[],"class_list":["post-7319","post","type-post","status-publish","format-standard","hentry","category-apache","category-centos7","category-waf"],"_links":{"self":[{"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/posts\/7319","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/comments?post=7319"}],"version-history":[{"count":16,"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/posts\/7319\/revisions"}],"predecessor-version":[{"id":11703,"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/posts\/7319\/revisions\/11703"}],"wp:attachment":[{"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/media?parent=7319"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/categories?post=7319"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/tags?post=7319"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}