{"id":11560,"date":"2023-11-24T09:51:41","date_gmt":"2023-11-24T01:51:41","guid":{"rendered":"https:\/\/blog.pfchina.org\/?p=11560"},"modified":"2024-02-29T09:24:07","modified_gmt":"2024-02-29T01:24:07","slug":"pfsense%e4%b8%8a%e7%9a%84crowdsec%e5%ae%89%e8%a3%85%e5%8c%85","status":"publish","type":"post","link":"https:\/\/blog.pfchina.org\/?p=11560","title":{"rendered":"pfSense\u5b89\u88c5CrowdSec\u63d2\u4ef6"},"content":{"rendered":"<div>\n<header><a href=\"https:\/\/doc.crowdsec.net\/docs\/next\/intro\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blog.pfchina.org\/wp-content\/uploads\/2023\/11\/crowdsec_logo.png\" alt=\"\" width=\"144\" height=\"98\" \/><\/a>CrowdSec\u662f\u4e00\u6b3e\u5f00\u6e90\u7684\u8f7b\u91cf\u7ea7\u5b89\u5168\u5f15\u64ce\u8f6f\u4ef6\uff0c\u4f7f\u7528\u65e5\u5fd7\u5206\u6790\u548c\u79f0\u4e3a\u573a\u666f\u7684\u5a01\u80c1\u6a21\u5f0f\u6765\u68c0\u6d4b\u5e76\u963b\u6b62\u6076\u610f\u884c\u4e3a\u3002\u91c7\u7528\u6a21\u5757\u5316\u6846\u67b6\uff0c\u63d0\u4f9b\u5404\u79cd\u6d41\u884c\u7684\u573a\u666f\u3002\u7528\u6237\u53ef\u4ee5\u9009\u62e9\u81ea\u5df1\u7684\u4fdd\u62a4\u65b9\u6848\u5e76\u90e8\u7f72\u4fee\u590d\u7ec4\u4ef6\u6765\u963b\u6b62\u6076\u610f\u8bbf\u95ee\u3002\u6700\u8fd1\u4ed6\u4eec\u4e3apfSense\u521b\u5efa\u4e86\u4e00\u4e2a\u5e26\u6709\u7b80\u5355UI\u754c\u9762\u7684\u63d2\u4ef6\u6765\u914d\u7f6e\u5b89\u5168\u5f15\u64ce\u548c\u9632\u706b\u5899\u4fee\u590d\u7ec4\u4ef6\u3002<\/header>\n<h2>\u8bbe\u7f6e\u7c7b\u578b<\/h2>\n<p>\u63d2\u4ef6\u5305\u542b\u4ee5\u4e0b\u4e09\u79cd\u8fd0\u884c\u7c7b\u578b\uff1a<\/p>\n<p>\u5c0f\u578b\uff08\u4ec5\u9650\u4fee\u590d\uff09- pfSense\u9632\u706b\u5899\u4ece\u60a8\u5728\u53e6\u4e00\u53f0\u8ba1\u7b97\u673a\u4e0a\u8fd0\u884c\u7684 CrowdSec \u5b89\u5168\u5f15\u64ce\u63a5\u6536\u963b\u6b62\u5217\u8868\u3002\u5165\u7ad9\u8fde\u63a5\u4f1a\u88ab\uff08\u53ef\u914d\u7f6e\u7684\uff09pfSense \u89c4\u5219\u5728\u9632\u706b\u5899\u5904\u963b\u6b62\u3002<\/p>\n<p>\u4e2d\u578b\uff08\u5c0f\u578b+\u65e5\u5fd7\u5904\u7406\u5668\uff09- \u9664\u4e86\u5f3a\u5236\u6267\u884c\u963b\u6b62\u5217\u8868\u4e4b\u5916\uff0cpfSense\u9632\u706b\u5899\u8fd8\u53ef\u4ee5\u68c0\u6d4b\u9488\u5bf9\u9632\u706b\u5899\u672c\u8eab\u7684\u653b\u51fb\uff0c\u4f8b\u5982\u7aef\u53e3\u626b\u63cf\u3002\u6709\u5173\u653b\u51fb\u7684\u6570\u636e\u5c06\u53d1\u9001\uff08\u7528\u4e8e\u5206\u6790\u548c\u53ef\u80fd\u5171\u4eab\uff09\u5230\u60a8\u5728\u53e6\u4e00\u53f0\u8ba1\u7b97\u673a\u4e0a\u8fd0\u884c\u7684\u5b89\u5168\u5f15\u64ce\u3002<\/p>\n<p>\u5927\u578b\uff08\u4e2d\u578b+LAPI\uff09- \u5728\u9632\u706b\u5899\u7cfb\u7edf\u4e0a\u90e8\u7f72\u5b8c\u5168\u81ea\u4e3b\u7684\u5b89\u5168\u5f15\u64ce\uff0c\u5e76\u5141\u8bb8\u5176\u4ed6\u65e5\u5fd7\u5904\u7406\u5668\u8fde\u63a5\u5230\u5b83\u3002\u9700\u8981\u4e00\u4e2a\u6301\u4e45\/var \u76ee\u5f55\uff08\u65e0 RAM \u78c1\u76d8\uff09\uff0c\u5bf9\u9632\u706b\u5899\u7684\u6027\u80fd\u4e5f\u6709\u4e00\u5b9a\u7684\u8981\u6c42\uff0c\u5177\u4f53\u53d6\u51b3\u4e8e\u8981\u5904\u7406\u7684\u6570\u636e\u91cf\u3002<\/p>\n<p>\u5bf9\u975eCrowdSec\u7528\u6237\uff0c\u5927\u578b\u8bbe\u7f6e\u6700\u7b80\u5355\u7684\uff1a\u53ea\u9700\u4fdd\u7559\u9ed8\u8ba4\u503c\u5373\u53ef\u542f\u7528\u4fee\u590d\u3001\u65e5\u5fd7\u5904\u7406\u5668\u548c\u672c\u5730 API\u3002\u6ce8\u610f\uff0c\u6062\u590dpfSense\u5907\u4efd\u65f6\uff0cCrowdSec\u7684\u914d\u7f6e\u4e0d\u4f1a\u4fdd\u7559\uff0c\u9700\u8981\u91cd\u65b0\u914d\u7f6e\u6216\u5355\u72ec\u5907\u4efd\u3002<\/p>\n<div>\n<h2>\u5b89\u88c5<\/h2>\n<\/div>\n<p>\u63d2\u4ef6\u5df2\u63d0\u4ea4\u7ed9pfSense\u5f00\u53d1\u4eba\u5458\u8fdb\u884c\u5ba1\u6838\uff0c\u53ef\u80fd\u5373\u5c06\u5305\u542b\u5728\u5b98\u65b9\u5b58\u50a8\u5e93\u4e2d\u3002\u622a\u6b62\u672c\u535a\u5ba2\u53d1\u8868\u65f6\uff0c\u8fd8\u672a\u51fa\u73b0\u5728\u5b98\u65b9\u5b58\u50a8\u5e93\u4e2d\u3002<\/p>\n<p>\u5982\u679c\u60f3\u63d0\u524d\u4f53\u9a8cCrowdSec\u7684\u5b89\u5168\u529f\u80fd\uff0c\u53ef\u4ee5\u9009\u62e9\u624b\u52a8\u5b89\u88c5\u3002<\/p>\n<ul>\n<li>\u9009\u62e9\u8981\u5b89\u88c5\u7684<a href=\"https:\/\/github.com\/crowdsecurity\/pfSense-pkg-crowdsec\/releases\" target=\"_blank\" rel=\"noopener noreferrer\">\u7248\u672c<\/a>\uff0c\u5355\u51fbAssets\u83b7\u53d6\u8981\u5b89\u88c5\u7684\u63d2\u4ef6\u5217\u8868\u5e76\u4e0b\u8f7d\u3002<\/li>\n<li>\u4f7f\u7528finalshell\u8f6f\u4ef6\u8fde\u63a5pfSense\u9632\u706b\u5899\uff0c\u4e0a\u4f20\u6587\u4ef6\uff0c\u5e76\u6309\u987a\u5e8f\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u3002<\/li>\n<\/ul>\n<div>\n<div>\n<pre tabindex=\"0\"># setenv IGNORE_OSVERSION yes\r\n# pkg add &lt;link to abseil&gt;\r\n# pkg add &lt;link to re2&gt;\r\n# pkg add &lt;link to crowdsec-firewall-bouncer&gt;\r\n# pkg add &lt;link to crowdsec&gt;\r\n# pkg add &lt;link to pfSense-pkg-crowdsec&gt;\r\n<\/pre>\n<h2>\u914d\u7f6e<\/h2>\n<\/div>\n<\/div>\n<p>\u5b89\u88c5\u5b8c\u6210\u4ee5\u540e\uff0c\u8f6c\u5230\u670d\u52a1&gt;CrowdSec\uff0c\u542f\u7528Remediation Component\u3001\u00a0Log Processor\u548cLocal API \u9009\u9879\u3002\u5355\u51fb\u201c\u4fdd\u5b58\u201d\u3002<\/p>\n<p>\u9ed8\u8ba4\u662f\u201c\u5927\u578b\u201d\u81ea\u4e3b\u5b89\u88c5\u3002\u5bf9\u4e8e\u201c\u4e2d\u578b\u201d\u5b89\u88c5\uff0c\u5c06\u7981\u7528\u672c\u5730 API\u5e76\u586b\u5199\u8fdc\u7a0b LAPI\u90e8\u5206\u4e2d\u7684\u5b57\u6bb5\u3002\u5bf9\u4e8e\u201c\u5c0f\u578b\u201d\u5b89\u88c5\uff0c\u8fd8\u5c06\u7981\u7528\u65e5\u5fd7\u5904\u7406\u5668\u3002<\/p>\n<p>pfSense\u4e0a\u7684CrowdSec\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u5b9e\u73b0\u5b8c\u6574\u529f\u80fd\uff0c\u5927\u591a\u6570\u64cd\u4f5c\u90fd\u9700\u8981\u5728shell\u6216<a href=\"https:\/\/app.crowdsec.net\/\" target=\"_blank\" rel=\"noopener noreferrer\">CrowdSec \u63a7\u5236\u53f0<\/a>\u4e0a\u5b8c\u6210\u3002\u4e5f\u53ef\u4ee5\u76f4\u63a5\u7f16\u8f91\u6587\u4ef6\/usr\/local\/etc\/crowdsec\uff0c\u4f46\u67d0\u4e9b\u8bbe\u7f6e\u53ef\u80fd\u4f1a\u88abpfSense\u7684\u8bbe\u7f6e\u8986\u76d6\u3002\u6ce8\u610f\uff1a\u9664\u975e\u7981\u7528\u672c\u5730API\uff0c\u5426\u5219\u8bf7\u786e\u4fdd\/var\u76ee\u5f55\u6ca1\u6709\u4f7f\u7528RAM \u78c1\u76d8\u3002CrowdSec\u6570\u636e\u5e93\u548cGeoIP\u8868\u90fd\u4f4d\u4e8e\u6301\u4e45\u4fdd\u5b58\u7684\/var\/db\u4e0b\u3002<\/p>\n<div>\n<h2>\u670d\u52a1<\/h2>\n<\/div>\n<p>\u8f6c\u5230\u72b6\u6001\/CrowdSec\u83dc\u5355\uff0c\u53ef\u4ee5\u67e5\u770b\uff1a<\/p>\n<ul>\n<li>\u6ce8\u518c\u7684\u65e5\u5fd7\u5904\u7406\u5668\u548c\u4fdd\u9556<\/li>\n<li>\u5b89\u88c5\u7684\u4e2d\u5fc3\u9879\u76ee\uff08\u96c6\u5408\u3001\u573a\u666f\u3001\u89e3\u6790\u5668\u3001\u540e\u6ea2\u51fa\uff09<\/li>\n<li>\u8b66\u62a5\u548c\u672c\u5730\u7b56\u7565<\/li>\n<\/ul>\n<h2 id=\"detecting-attacks\">\u68c0\u6d4b<\/h2>\n<p>\u5982\u679c\u65e5\u5fd7\u5904\u7406\u5668\u6b63\u5728\u8fd0\u884c\uff0c\u5219\u9ed8\u8ba4\u542f\u7528\u4ee5\u4e0b\u9632\u5fa1\uff1a<\/p>\n<ul>\n<li>\u7aef\u53e3\u626b\u63cf<\/li>\n<li>ssh\u66b4\u529b\u7834\u89e3<\/li>\n<li>pfSense\u7ba1\u7406UI\u66b4\u529b\u7834\u89e3<\/li>\n<li>HTTP\u6f0f\u6d1e\u63a2\u6d4b<\/li>\n<\/ul>\n<p>\u8be6\u7ec6\u914d\u7f6e\u548c\u4f7f\u7528\u65b9\u6cd5\u8bf7\u53c2\u9605<a href=\"https:\/\/doc.crowdsec.net\/docs\/next\/getting_started\/install_crowdsec_pfsense\/?utm_campaign=Product%20Monthly%20Digest&amp;utm_medium=email&amp;_hsmi=283749925&amp;_hsenc=p2ANqtz-93_50ELAR-3_4WHaJGQ7c9IFC8Yn_e2unsiFs5eYYRRn956xhoxPAc8w__AkJogwqsNruNXesm8B9kw6I-rIOJOgVz5ELi1MDHC5TqO8X7Isna21A&amp;utm_content=283749925&amp;utm_source=hs_email\">\u5b98\u65b9\u6587\u6863<\/a>\u3002<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>CrowdSec\u662f\u4e00\u6b3e\u5f00\u6e90\u7684\u8f7b\u91cf\u7ea7\u5b89\u5168\u5f15\u64ce\u8f6f\u4ef6\uff0c\u4f7f\u7528\u65e5\u5fd7\u5206\u6790\u548c\u79f0\u4e3a\u573a\u666f\u7684\u5a01\u80c1\u6a21\u5f0f &hellip; <a href=\"https:\/\/blog.pfchina.org\/?p=11560\">\u7ee7\u7eed\u9605\u8bfb <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[28],"tags":[365],"class_list":["post-11560","post","type-post","status-publish","format-standard","hentry","category-pfsense","tag-crowdsec"],"_links":{"self":[{"href":"https:\/\/blog.pfchina.org\/index.php?rest_route=\/wp\/v2\/posts\/11560","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.pfchina.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.pfchina.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.pfchina.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.pfchina.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=11560"}],"version-history":[{"count":6,"href":"https:\/\/blog.pfchina.org\/index.php?rest_route=\/wp\/v2\/posts\/11560\/revisions"}],"predecessor-version":[{"id":12132,"href":"https:\/\/blog.pfchina.org\/index.php?rest_route=\/wp\/v2\/posts\/11560\/revisions\/12132"}],"wp:attachment":[{"href":"https:\/\/blog.pfchina.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=11560"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.pfchina.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=11560"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.pfchina.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=11560"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}