{"id":804,"date":"2020-06-27T16:25:53","date_gmt":"2020-06-27T08:25:53","guid":{"rendered":"https:\/\/blog.kingsbestone.com\/?p=804"},"modified":"2020-06-29T15:02:34","modified_gmt":"2020-06-29T07:02:34","slug":"%e9%98%bf%e9%87%8c%e4%ba%91%e5%9b%bd%e9%99%85%e8%bd%bb%e9%87%8f%e5%ba%94%e7%94%a8%e6%9c%8d%e5%8a%a1%e5%99%a8centos7%e7%b3%bb%e7%bb%9f%e4%ba%91%e7%9b%be%e5%85%b3%e9%97%ad%e6%96%b9","status":"publish","type":"post","link":"https:\/\/blog.kingsbestone.com\/?p=804","title":{"rendered":"\u963f\u91cc\u4e91\u56fd\u9645\u201c\u8f7b\u91cf\u5e94\u7528\u670d\u52a1\u5668\u201dCentos7\u7cfb\u7edf\u4e91\u76fe\u5173\u95ed\u65b9\u6cd5"},"content":{"rendered":"<h1><span style=\"font-family: 'comic sans ms', sans-serif;\">\u524d\u8a00\uff1a<\/span><\/h1>\n<p><span style=\"font-family: 'comic sans ms', sans-serif;\">\u963f\u91cc\u4e91\u4e91\u76fe\u4f1a\u6cc4\u9732\u9690\u79c1\uff0c\u4ee5\u53ca\u4f1a\u9650\u5236\u4e00\u4e9b\u5e94\u7528\u7684\u8fd0\u884c\uff0c\u4e3a\u4e86\u907f\u514d\u4e0d\u5fc5\u8981\u7684\u635f\u5931\u4e0e\u9ebb\u70e6\uff0c\u6211\u5c06\u4f1a\u5378\u8f7d\u6389\u4e91\u76fe\uff0c\u4e0b\u9762\u8bb0\u5f55\u4e00\u4e0b\u65b9\u6cd5\u3002<\/span><\/p>\n<p>\u5982\u679c\u5b89\u88c5\u4e86\u5b9d\u5854\uff0c\u8bf7\u6267\u884c\u6807\u9898\u4e00\u548c\u6807\u9898\u4e8c\u7684\u5185\u5bb9\u7684\uff0c\u6807\u9898\u4e09\u91cc\u9762\u7684\u5185\u5bb9\u6267\u884c\u4e86\uff0c\u4f1a\u5bfc\u81f4\u4f60\u7684\u7ad9\u70b9\u4e0e\u5b9d\u5854\u4e0d\u6b63\u5e38\uff0c\u98ce\u9669\u63d0\u793a\uff01\u64cd\u4f5c\u524d\u8bf7\u505a\u597d\u5feb\u7167\u548c\u5907\u4efd\u3002<\/p>\n<h1><span style=\"font-family: 'comic sans ms', sans-serif;\">\u6b63\u6587\uff1a<\/span><\/h1>\n<h2 id=\"title-1\"><span style=\"font-family: 'comic sans ms', sans-serif;\"><strong>\u4e00\u3001SSH\u767b\u5f55\u754c\u9762\u6b22\u8fce\u4fe1\u606f\u5220\u9664\uff1a<\/strong><\/span><\/h2>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">vim \/etc\/motd<\/pre>\n<p><span style=\"font-family: 'comic sans ms', sans-serif;\">Tip\uff1a\u53ef\u4ee5\u76f4\u63a5\u5220\u9664\u91cc\u9762\u5168\u90e8\u5185\u5bb9\u6216\u8005\u81ea\u5b9a\u4e49\u5185\u5bb9\uff0c\u5982\u679c\u5220\u9664\u5b8c\u6bd5\u5185\u5bb9\u540e\uff0c\u767b\u5f55VPS\u540e\u5c31\u4e0d\u4f1a\u6709\u6b22\u8fce\u4fe1\u606f\u4e86\uff0c\u5982\u679c\u81ea\u5b9a\u4e49\u4e86SSH\u767b\u5f55\u5185\u5bb9\uff0c\u90a3\u4e48\u4e0b\u4e00\u6b21\u663e\u793a\u7684\u5c31\u662f\u81ea\u5df1\u81ea\u5b9a\u4e49\u7684\u5185\u5bb9\u3002<\/span><\/p>\n<h2 id=\"title-1\"><span style=\"font-family: 'comic sans ms', sans-serif;\"><strong>\u4e8c\u3001\u4e91\u76fe\u76d1\u63a7\u5378\u8f7d\uff1a<\/strong><\/span><\/h2>\n<p><span style=\"font-family: 'comic sans ms', sans-serif;\">2-1.\u5378\u8f7d\u547d\u4ee4\uff08\u6574\u5408\u547d\u4ee4\uff09\uff1a<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">wget http:\/\/update.aegis.aliyun.com\/download\/uninstall.sh &amp;&amp; sh uninstall.sh &amp;&amp; wget http:\/\/update.aegis.aliyun.com\/download\/quartz_uninstall.sh &amp;&amp; sh quartz_uninstall.sh<\/pre>\n<p><span style=\"font-family: 'comic sans ms', sans-serif;\">2-2.\u5220\u9664\u6b8b\u7559\uff1a<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">pkill aliyun-service &amp;&amp; rm -fr \/etc\/init.d\/agentwatch \/usr\/sbin\/aliyun-service &amp;&amp; rm -rf \/usr\/local\/aegis*<\/pre>\n<h2><span style=\"font-family: 'comic sans ms', sans-serif;\">\u4e09\u3001\u5c4f\u853d\u5916\u90e8\u4e91\u76feIP\uff1a<\/span><\/h2>\n<p><span style=\"font-family: 'comic sans ms', sans-serif;\">3-1.\u5b89\u88c5iptables-services<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">yum install -y iptables-services<\/pre>\n<p><span style=\"font-family: 'comic sans ms', sans-serif;\">3-2.\u505c\u6b62\u9632\u706b\u5899\u548c\u5c4f\u853d\u9632\u706b\u5899<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">systemctl\u00a0stop\u00a0firewalld\u00a0&amp;&amp;\u00a0systemctl\u00a0mask\u00a0firewalld<\/pre>\n<p><span style=\"font-family: 'comic sans ms', sans-serif;\">3-3.\u8bbe\u7f6e\u5f00\u673a\u542f\u52a8\u9632\u706b\u5899<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">systemctl enable iptables<\/pre>\n<p><span style=\"font-family: 'comic sans ms', sans-serif;\">3-4.\u91cd\u65b0\u542f\u52a8\u9632\u706b\u5899\u670d\u52a1\u5e76\u67e5\u770b\u72b6\u6001<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">systemctl stop iptables &amp;&amp; systemctl start iptables &amp;&amp; systemctl status iptables<\/pre>\n<p><span style=\"font-family: 'comic sans ms', sans-serif;\">3-5.\u65b0\u5efa\u4e00\u4e2a\u6587\u672c\u6587\u4ef6<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">touch ip.sh &amp;&amp; chmod +x ip.sh &amp;&amp; vim ip.sh<\/pre>\n<p><span style=\"font-family: 'comic sans ms', sans-serif;\">3-6.\u590d\u5236\u4ee5\u4e0b\u6587\u4ef6\u8fdb\u53bb<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">#!\/bin\/bash\r\necho \u201c\u5c4f\u853d\u963f\u91cc\u4e91\u76fe\u6076\u610f IP\u2026\u2026.\u201d\r\niptables -I INPUT -s 140.205.201.0\/28 -j DROP\r\niptables -I INPUT -s 140.205.201.16\/29 -j DROP\r\niptables -I INPUT -s 140.205.201.32\/28 -j DROP\r\niptables -I INPUT -s 140.205.225.192\/29 -j DROP\r\niptables -I INPUT -s 140.205.225.200\/30 -j DROP\r\niptables -I INPUT -s 140.205.225.184\/29 -j DROP\r\niptables -I INPUT -s 140.205.225.183\/32 -j DROP\r\niptables -I INPUT -s 140.205.225.206\/32 -j DROP\r\niptables -I INPUT -s 140.205.225.205\/32 -j DROP\r\niptables -I INPUT -s 140.205.225.195\/32 -j DROP\r\niptables -I INPUT -s 140.205.225.204\/32 -j DROP\r\niptables -I INPUT -s 106.11.224.0\/26 -j DROP\r\niptables -I INPUT -s 106.11.224.64\/26 -j DROP\r\niptables -I INPUT -s 106.11.224.128\/26 -j DROP\r\niptables -I INPUT -s 106.11.224.192\/26 -j DROP\r\niptables -I INPUT -s 106.11.222.64\/26 -j DROP\r\niptables -I INPUT -s 106.11.222.128\/26 -j DROP\r\niptables -I INPUT -s 106.11.222.192\/26 -j DROP\r\niptables -I INPUT -s 106.11.223.0\/26 -j DROP\r\necho \u201c\u5df2\u7ecf\u5c4f\u853d\u4e86\u963f\u91cc\u4e91\u76fe\u6076\u610f IP\u201d<\/pre>\n<p><span style=\"font-family: 'comic sans ms', sans-serif;\">3-7.\u8fd0\u884c\u811a\u672c\uff1a<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">sh ip.sh<\/pre>\n<p><span style=\"font-family: 'comic sans ms', sans-serif;\">3-8.\u4fdd\u5b58\u9632\u706b\u5899\u89c4\u5219<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">service iptables save<\/pre>\n<p><span style=\"font-family: 'comic sans ms', sans-serif;\">3-9.\u91cd\u542f\u670d\u52a1\u5668<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">reboot<\/pre>\n<h1><span style=\"font-family: 'comic sans ms', sans-serif;\">\u7ed3\u5c3e\uff1a<\/span><\/h1>\n<p>\u81f3\u6b64\u4e91\u76fe\u5168\u90e8\u6e05\u7406\u5b8c\u6bd5\u4e86\uff01\u5e76\u4e14\u6dfb\u52a0\u4e86\u5c4f\u853d\u5217\u8868\uff0c\u53ef\u4ee5\u5f00\u59cb\u5b89\u88c5\u81ea\u5df1\u6240\u9700\u8981\u7684\u670d\u52a1\u4e86\uff01<\/p>\n<h1 style=\"text-align: center;\"><span style=\"font-family: 'comic sans ms', sans-serif;\">\u539f\u521b\u6587\u7ae0<\/span><\/h1>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u8a00\uff1a \u963f\u91cc\u4e91\u4e91\u76fe\u4f1a\u6cc4\u9732\u9690\u79c1\uff0c\u4ee5\u53ca\u4f1a\u9650\u5236\u4e00\u4e9b\u5e94\u7528\u7684\u8fd0\u884c\uff0c\u4e3a\u4e86\u907f\u514d\u4e0d\u5fc5\u8981\u7684\u635f\u5931\u4e0e\u9ebb\u70e6\uff0c\u6211\u5c06\u4f1a\u5378\u8f7d\u6389\u4e91\u76fe\uff0c\u4e0b\u9762\u8bb0\u5f55\u4e00\u4e0b\u65b9\u6cd5\u3002 \u5982\u679c\u5b89\u88c5\u4e86\u5b9d\u5854\uff0c\u8bf7\u6267\u884c\u6807\u9898\u4e00\u548c\u6807\u9898\u4e8c\u7684\u5185\u5bb9\u7684\uff0c\u6807\u9898\u4e09\u91cc\u9762\u7684\u5185\u5bb9\u6267\u884c\u4e86\uff0c\u4f1a\u5bfc\u81f4\u4f60\u7684\u7ad9\u70b9\u4e0e\u5b9d\u5854\u4e0d\u6b63\u5e38\uff0c\u98ce\u9669\u63d0\u793a\uff01\u64cd\u4f5c\u524d\u8bf7\u505a\u597d\u5feb\u7167\u548c\u5907\u4efd\u3002 \u6b63\u6587\uff1a \u4e00\u3001SSH\u767b\u5f55\u754c\u9762\u6b22\u8fce\u4fe1\u606f\u5220\u9664\uff1a vim \/etc\/mo &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"\u963f\u91cc\u4e91\u56fd\u9645\u201c\u8f7b\u91cf\u5e94\u7528\u670d\u52a1\u5668\u201dCentos7\u7cfb\u7edf\u4e91\u76fe\u5173\u95ed\u65b9\u6cd5\" class=\"read-more button\" href=\"https:\/\/blog.kingsbestone.com\/?p=804#more-804\" aria-label=\"\u66f4\u591a \u963f\u91cc\u4e91\u56fd\u9645\u201c\u8f7b\u91cf\u5e94\u7528\u670d\u52a1\u5668\u201dCentos7\u7cfb\u7edf\u4e91\u76fe\u5173\u95ed\u65b9\u6cd5\">\u67e5\u770b\u66f4\u591a<\/a><\/p>\n","protected":false},"author":1,"featured_media":212,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5,4],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.kingsbestone.com\/index.php?rest_route=\/wp\/v2\/posts\/804"}],"collection":[{"href":"https:\/\/blog.kingsbestone.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.kingsbestone.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.kingsbestone.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.kingsbestone.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=804"}],"version-history":[{"count":15,"href":"https:\/\/blog.kingsbestone.com\/index.php?rest_route=\/wp\/v2\/posts\/804\/revisions"}],"predecessor-version":[{"id":969,"href":"https:\/\/blog.kingsbestone.com\/index.php?rest_route=\/wp\/v2\/posts\/804\/revisions\/969"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.kingsbestone.com\/index.php?rest_route=\/wp\/v2\/media\/212"}],"wp:attachment":[{"href":"https:\/\/blog.kingsbestone.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=804"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.kingsbestone.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=804"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.kingsbestone.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=804"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}