{"id":229,"date":"2017-10-29T12:51:24","date_gmt":"2017-10-29T04:51:24","guid":{"rendered":"http:\/\/www.mushroom.ren\/?p=229"},"modified":"2017-11-11T15:40:49","modified_gmt":"2017-11-11T07:40:49","slug":"%e7%bb%99openwrt%e7%9a%84wan%e5%8f%a3%e5%85%81%e8%ae%b8ssh%e5%92%8cweb%e7%99%bb%e9%99%86","status":"publish","type":"post","link":"http:\/\/www.mushroom.ren\/?p=229","title":{"rendered":"\u7ed9openwrt\u7684wan\u53e3\u5141\u8bb8SSH\u548cweb\u767b\u9646"},"content":{"rendered":"<p>\u8fd9\u4e2a\u9700\u6c42\u5f88\u5947\u602a\u3002\u4e5f\u4e0d\u7b97\u592a\u5371\u9669\u3002<\/p>\n<p>\u9664\u4e86\u5728luci\u754c\u9762\u4e0a\uff0c\u7cfb\u7edf&#8211;&gt;\u7ba1\u7406\u6743&#8211;&gt;Dropbear\u8bbe\u7f6e\u2014\u2014&gt;\u7f51\u5173\u7aef\u53e3\uff08\u5141\u8bb8\u8fdc\u7a0b\u4e3b\u673a\u8fde\u63a5\u5230\u672c\u5730SSH\u8f6c\u53d1\u7aef\u53e3\uff09\u6253\u52fe\u4e4b\u5916\u3002\u8fd8\u8981\u5728\u9632\u706b\u5899\u6253\u5f00\u7aef\u53e3\u3002<\/p>\n<p>\u4e3a\u4e86\u7b80\u5316\u64cd\u4f5c\uff0c\u6545\u5199shell\u811a\u672c\u5982\u4e0b\u3002<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\">\r\n#!\/bin\/sh\r\nFILE=\"\/etc\/config\/firewall\"\r\nif\r\necho -e \"config rule\" &gt;&gt;$FILE\r\necho -e \"\\toption target 'ACCEPT'\" &gt;&gt;$FILE\r\necho -e \"\\toption src 'wan'\" &gt;&gt;$FILE\r\necho -e \"\\toption proto 'tcp'\" &gt;&gt;$FILE\r\necho -e \"\\toption dest_port '22'\" &gt;&gt;$FILE\r\necho -e \"\\toption name 'SSH'\\n\" &gt;&gt;$FILE\r\nthen\r\necho \"firewall has been modified(SSH)\"\r\nfi\r\n\r\nif\r\necho -e \"config rule\" &gt;&gt;$FILE\r\necho -e \"\\toption target 'ACCEPT'\" &gt;&gt;$FILE\r\necho -e \"\\toption src 'wan'\" &gt;&gt;$FILE\r\necho -e \"\\toption proto 'tcp'\" &gt;&gt;$FILE\r\necho -e \"\\toption dest_port '80'\" &gt;&gt;$FILE\r\necho -e \"\\toption name 'wanuhttpd'\" &gt;&gt;$FILE\r\nthen\r\necho \"firewall has been modified(web)\"\r\nfi\r\n\r\nif\r\n\/etc\/rc.d\/S19firewall restart\r\nthen\r\necho \"firewall has been restart\"\r\nfi<\/code><\/pre>\n<p>&nbsp;<\/p>\n<p>\u590d\u5236\u8fd9\u6bb5\u4fdd\u5b58\u8fdb\u4e00\u4e2a\u65b0\u7684\u6587\u4ef6\u3002<\/p>\n<p>chmod +x \u8d4b\u4e88\u6743\u9650\u8fd0\u884c\u5373\u53ef\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8fd9\u4e2a\u9700\u6c42\u5f88\u5947\u602a\u3002\u4e5f\u4e0d\u7b97\u592a\u5371\u9669\u3002 \u9664\u4e86\u5728luci\u754c\u9762\u4e0a\uff0c\u7cfb\u7edf&#8211;&gt;\u7ba1\u7406\u6743&#8211;&gt;D [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/www.mushroom.ren\/index.php?rest_route=\/wp\/v2\/posts\/229"}],"collection":[{"href":"http:\/\/www.mushroom.ren\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.mushroom.ren\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.mushroom.ren\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.mushroom.ren\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=229"}],"version-history":[{"count":6,"href":"http:\/\/www.mushroom.ren\/index.php?rest_route=\/wp\/v2\/posts\/229\/revisions"}],"predecessor-version":[{"id":261,"href":"http:\/\/www.mushroom.ren\/index.php?rest_route=\/wp\/v2\/posts\/229\/revisions\/261"}],"wp:attachment":[{"href":"http:\/\/www.mushroom.ren\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=229"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.mushroom.ren\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=229"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.mushroom.ren\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=229"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}