{"id":2331,"date":"2019-11-01T22:13:20","date_gmt":"2019-11-01T14:13:20","guid":{"rendered":"https:\/\/blog.pfchina.org\/?p=2331"},"modified":"2020-08-24T21:38:58","modified_gmt":"2020-08-24T13:38:58","slug":"%e5%a6%82%e4%bd%95%e5%9c%a8pfsense%e5%90%af%e5%8a%a8%e6%97%b6%e6%b7%bb%e5%8a%a0%e8%87%aa%e5%8a%a8%e6%89%a7%e8%a1%8c%e5%91%bd%e4%bb%a4","status":"publish","type":"post","link":"https:\/\/blog.pfchina.org\/?p=2331","title":{"rendered":"pfSense\u542f\u52a8\u65f6\u81ea\u52a8\u6267\u884c\u547d\u4ee4\u65b9\u6cd5"},"content":{"rendered":"<p style=\"text-align: justify;\">\u5728pfSense\u5f15\u5bfc\u65f6\u6267\u884c\u81ea\u5b9a\u4e49\u547d\u4ee4\uff0c\u6709\u4e09\u4e2a\u4e3b\u8981\u65b9\u6cd5\uff1ashellcmd\uff0cearlyshellcmd\u548cShell\u811a\u672c\u3002shellcmd\u63d2\u4ef6\u53ef\u4ee5\u5728GUI\u4e2d\u7ba1\u7406shellcmd\u548cearlyshellcmd\u6807\u8bb0\uff0c\u56e0\u6b64\u65e0\u9700\u624b\u52a8\u7f16\u8f91config.xml\u4e2d\u76f8\u5e94\u7684\u503c\u3002\u5728\u5f15\u5bfc\u65f6\uff0c\u5c06\u9996\u5148\u6267\u884cearlyshellcmd\u547d\u4ee4\uff0c\u7136\u540e\u518d\u6267\u884cshellcmd\uff0c\u6700\u540e\u5728\u521d\u59cb\u5316\u8f6f\u4ef6\u5305\u65f6\u6267\u884cshell\u811a\u672c\u3002<\/p>\n<div id=\"shellcmd-option\" class=\"section\" style=\"text-align: justify;\">\n<h1>\u4e00\u3001shellcmd\u65b9\u5f0f<\/h1>\n<p>config.xml\u4e2d\u7684\u9009\u9879&lt;shellcmd&gt;\u4f1a\u5728\u7cfb\u7edf\u5f15\u5bfc\u8fc7\u7a0b\u7ed3\u675f\u65f6\u8fd0\u884c\u6307\u5b9a\u7684\u547d\u4ee4\u3002<\/p>\n<p>\u8981\u5c06shellcmd\u6dfb\u52a0\u5230\u914d\u7f6e\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528shellcmd\u63d2\u4ef6\u914d\u7f6e\u547d\u4ee4\uff0c\u5982\u4e0b\u56fe\u6240\u793a\uff1a<\/p>\n<p><a href=\"https:\/\/blog.pfchina.org\/wp-content\/uploads\/2019\/11\/pfsense-shellcmd-07-800x297.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2333\" src=\"https:\/\/blog.pfchina.org\/wp-content\/uploads\/2019\/11\/pfsense-shellcmd-07-800x297.png\" alt=\"\" width=\"800\" height=\"297\" srcset=\"https:\/\/blog.pfchina.org\/wp-content\/uploads\/2019\/11\/pfsense-shellcmd-07-800x297.png 800w, https:\/\/blog.pfchina.org\/wp-content\/uploads\/2019\/11\/pfsense-shellcmd-07-800x297-300x111.png 300w, https:\/\/blog.pfchina.org\/wp-content\/uploads\/2019\/11\/pfsense-shellcmd-07-800x297-768x285.png 768w, https:\/\/blog.pfchina.org\/wp-content\/uploads\/2019\/11\/pfsense-shellcmd-07-800x297-500x186.png 500w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a><\/p>\n<p>\u4e5f\u53ef\u4ee5\u624b\u52a8\u7f16\u8f91\u914d\u7f6e\u3002\u901a\u8fc7\u201c \u7cfb\u7edf\u8bca\u65ad\u201d&gt;\u201c\u5907\u4efd\/\u8fd8\u539f\u201d\u5bf9\u7cfb\u7edf\u914d\u7f6e\u6587\u4ef6\u8fdb\u884c\u5907\u4efd\uff0c\u7136\u540e\u5728\u6587\u672c\u7f16\u8f91\u5668\uff08\u4e0d\u8981\u4f7f\u7528Windows\u8bb0\u4e8b\u672c\uff09\u4e2d\u6253\u5f00\u751f\u6210\u7684XML\u6587\u4ef6\u3002\u5728&lt;\/ system&gt;\u884c\u4e0a\u65b9\uff0c\u6dfb\u52a0\u4e00\u884c\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<div class=\"highlight-default notranslate\">\n<div class=\"highlight\">\n<pre><span class=\"o\">&lt;<\/span><span class=\"n\">shellcmd<\/span><span class=\"o\">&gt;<\/span><span class=\"n\">mycommand<\/span> <span class=\"o\">-<\/span><span class=\"n\">a<\/span> <span class=\"o\">-<\/span><span class=\"n\">b<\/span> <span class=\"o\">-<\/span><span class=\"n\">c<\/span> <span class=\"mi\">123<\/span><span class=\"o\">&lt;\/<\/span><span class=\"n\">shellcmd<\/span><span class=\"o\">&gt;<\/span>\r\n<\/pre>\n<\/div>\n<\/div>\n<p>\u53ef\u4ee5\u6dfb\u52a0\u591a\u884c\u6765\u6267\u884c\u591a\u4e2a\u547d\u4ee4\u3002\u4fdd\u5b58\u6587\u4ef6\u7684\u4fee\u6539\uff0c\u5e76\u5c06\u4fee\u6539\u7684\u914d\u7f6e\u6587\u4ef6\u6062\u590d\u5230\u7cfb\u7edf\u3002\u4e0b\u6b21\u7cfb\u7edf\u542f\u52a8\u65f6\uff0c\u5c06\u81ea\u52a8\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<p><code class=\"docutils literal notranslate\"><span class=\"pre\">mycommand<\/span>\u00a0<span class=\"pre\">-a<\/span>\u00a0<span class=\"pre\">-b<\/span>\u00a0<span class=\"pre\">-c<\/span>\u00a0<span class=\"pre\">123<\/span><\/code><\/p>\n<\/div>\n<div id=\"earlyshellcmd-option\" class=\"section\" style=\"text-align: justify;\">\n<h1>\u4e8c\u3001earlyshellcmd\u65b9\u5f0f<\/h1>\n<p>config.xml\u4e2d\u7684\u9009\u9879&lt;earlyshellcmd&gt;\u5c06\u8fd0\u884c\u5728\u5f15\u5bfc\u8fc7\u7a0b\u5f00\u59cb\u65f6\u6307\u5b9a\u7684\u547d\u4ee4\u3002\u4e00\u822c\u60c5\u51b5\u4e0b\u5e94\u8be5\u4f7f\u7528&lt;shellcmd&gt;\u6765\u4ee3\u66ff\u3002\u4e0e&lt;shellcmd&gt;\u76f8\u540c\uff0c\u8981\u6dfb\u52a0&lt;earlyshellcmd&gt;\u9009\u9879\uff0c\u8bf7\u4f7f\u7528shellcmd\u63d2\u4ef6\u6216\u624b\u52a8\u7f16\u8f91\u914d\u7f6e\u6587\u4ef6\u3002\u7528\u6587\u672c\u7f16\u8f91\u5668\u6253\u5f00\u5907\u4efd\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u7136\u540e\u6dfb\u52a0\u4e00\u884c\uff0c\u5982\u4e0a\u9762\u7684 &lt;\/ system&gt;\u6240\u793a\uff1a<\/p>\n<div class=\"highlight-default notranslate\">\n<div class=\"highlight\">\n<pre><span class=\"o\">&lt;<\/span><span class=\"n\">earlyshellcmd<\/span><span class=\"o\">&gt;<\/span><span class=\"n\">mycommand<\/span> <span class=\"o\">-<\/span><span class=\"n\">a<\/span> <span class=\"o\">-<\/span><span class=\"n\">b<\/span> <span class=\"o\">-<\/span><span class=\"n\">c<\/span> <span class=\"mi\">123<\/span><span class=\"o\">&lt;\/<\/span><span class=\"n\">earlyshellcmd<\/span><span class=\"o\">&gt;<\/span>\r\n<\/pre>\n<\/div>\n<\/div>\n<p>\u53ef\u4ee5\u6dfb\u52a0\u591a\u884c\u6765\u6267\u884c\u591a\u4e2a\u547d\u4ee4\u3002\u4fdd\u5b58\u6587\u4ef6\u7684\u4fee\u6539\uff0c\u5e76\u5c06\u4fee\u6539\u7684\u914d\u7f6e\u6587\u4ef6\u6062\u590d\u5230\u7cfb\u7edf\u3002\u4e0b\u6b21\u7cfb\u7edf\u542f\u52a8\u65f6\uff0c\u5c06\u81ea\u52a8\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<p><code class=\"docutils literal notranslate\"><span class=\"pre\">mycommand<\/span>\u00a0<span class=\"pre\">-a<\/span>\u00a0<span class=\"pre\">-b<\/span>\u00a0<span class=\"pre\">-c<\/span>\u00a0<span class=\"pre\">123<\/span><\/code><\/p>\n<\/div>\n<div id=\"shell-script-option\" class=\"section\">\n<h1 style=\"text-align: justify;\">\u4e09\u3001shell\u811a\u672c\u65b9\u5f0f<\/h1>\n<p style=\"text-align: justify;\">\u4efb\u4f55shell\u811a\u672c\u90fd\u53ef\u4ee5\u653e\u5728\/usr\/local\/etc\/rc.d\/\u76ee\u5f55\u4e2d\u3002\u6587\u4ef6\u540d\u5fc5\u987b\u4ee5.sh\u7ed3\u5c3e\uff0c\u5fc5\u987b\u6807\u8bb0\u4e3a\u53ef\u6267\u884c\u6587\u4ef6\uff08\uff09\u3002\u8be5\u76ee\u5f55\u4e2d\u6bcf\u4e2a\u4ee5.sh\u7ed3\u5c3e\u7684shell\u811a\u672c\u5c06\u5728\u5f15\u5bfc\u65f6\u6267\u884c\u3002\u7c7b\u4f3c\u4e8e\u5728shell\u754c\u9762\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<p style=\"text-align: justify;\"><code class=\"docutils literal notranslate\"><span class=\"pre\">chmod<\/span>\u00a0<span class=\"pre\">+x<\/span>\u00a0<span class=\"pre\">myscript.sh<\/span><\/code><\/p>\n<p style=\"text-align: justify;\">\u4e00\u822c\u60c5\u51b5\u4e0b\uff0c\u5c3d\u91cf\u4f7f\u7528\u524d\u9762\u4e24\u4e2a\u65b9\u5f0f\uff0c\u56e0\u4e3a\u5b83\u4eec\u4fdd\u7559\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\uff0c\u5982\u679c\u91cd\u65b0\u5b89\u88c5pfSense\u9632\u706b\u5899\uff0c\u53ea\u9700\u8981\u6062\u590d\u5907\u4efd\u7684\u914d\u7f6e\u6587\u4ef6\u5c31\u53ef\u4ee5\u4e86\u3002<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u5728pfSense\u5f15\u5bfc\u65f6\u6267\u884c\u81ea\u5b9a\u4e49\u547d\u4ee4\uff0c\u6709\u4e09\u4e2a\u4e3b\u8981\u65b9\u6cd5\uff1ashellcmd\uff0cearl &hellip; <a href=\"https:\/\/blog.pfchina.org\/?p=2331\">\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":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[28],"tags":[143],"class_list":["post-2331","post","type-post","status-publish","format-standard","hentry","category-pfsense","tag-command"],"_links":{"self":[{"href":"https:\/\/blog.pfchina.org\/index.php?rest_route=\/wp\/v2\/posts\/2331","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=2331"}],"version-history":[{"count":0,"href":"https:\/\/blog.pfchina.org\/index.php?rest_route=\/wp\/v2\/posts\/2331\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.pfchina.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2331"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.pfchina.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2331"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.pfchina.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2331"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}