{"id":284251,"date":"2023-10-02T04:03:30","date_gmt":"2023-10-01T20:03:30","guid":{"rendered":"https:\/\/lrxjmw.cn\/xdctbjzcdlff.html"},"modified":"2023-10-02T04:03:30","modified_gmt":"2023-10-01T20:03:30","slug":"xdctbjzcdlff","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/xdctbjzcdlff.html","title":{"rendered":"0x00\u591a\u5c42\u8df3\u677f\u673a\u6b63\u5e38\u767b\u9646\u65b9\u6cd5\u5f88\u591a\u73af\u5883\u90fd\u6709\u4e00\u53f0\u7edf\u4e00\u767b\u5f55\u65b9\u6cd5"},"content":{"rendered":"

0x00\u591a\u5c42\u8df3\u677f\u673a\u6b63\u5e38\u767b\u5f55\u65b9\u5f0f<\/p>\n

\u597d\u591a\u73af\u5883\u90fd\u6709\u4e00\u53f0\u7edf\u4e00\u767b\u9646\u8df3\u677f\u673a,\u6211\u4eec\u987b\u8981\u5148\u767b\u9646\u8df3\u677f\u673a,\u4e4b\u540e\u518d\u767b\u9646\u81ea\u5df1\u7684\u76ee\u6807\u673a\u5668.\u767b\u9646\u6d41\u7a0b\u5982\u4e0b<\/p>\n

\n

ssh<\/a> root@\u8df3\u677f\u673aip \nssh root@\u81ea\u5df1\u7684\u76ee\u6807\u673a\u5668ip\n<\/pre>\n<\/p>\n

\u4f8b\u5982\u4e0b\u8fb9\u7684\u767b\u9646\u5f62\u5f0f<\/p>\n

\u6bcf\u6b21\u8fd9\u6837\u767b\u9646\u4f1a\u5f88\u5197\u957f,openssh\u6709\u4e00\u4e2aProxyCommand\u7684\u914d\u7f6e\u53ef\u4ee5\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898.<\/p>\n

0x01\u4f7f\u7528ProxyCommand\u6765\u900f\u8fc7\u8df3\u677f\u673a<\/p>\n

ProxyCommand\u662fopenssh\u7684\u7279\u70b9,\u5047\u5982\u4f7f\u7528putty,xshell,\u8fd9\u4e48\u662f\u6ca1\u6709\u8fd9\u4e2a\u529f\u80fd\u7684.\u5728windows\u4e0b\u8fb9linux\u8bba\u575b,\u63a8\u8350\u4f7f\u7528mobaxterm,\u5176\u57fa\u4e8ecgywin,\u4e0a\u9762\u79fb\u690d\u4e86\u4e00\u4e2a\u5b8c\u6574\u7248\u672c\u7684openssh\u5b9e\u73b0,\u5728linux\u548cmacos\u4e0a\u9762\u76f4\u63a5\u5c31\u662fopenssh\u4e86.<\/p>\n

\u6211\u4eec\u7b80\u5355\u770b\u4e0bProxyCommand\u6587\u6863\u8bf4\u660e<\/p>\n

manssh_config<\/p>\n

ProxyCommand\u62ff\u6765\u6307\u5b9a\u8054\u63a5\u5230\u670d\u52a1\u5668\u7684\u547d\u4ee4<\/a>.\u5176\u53ef\u4ee5\u662f\u4efb\u4f55\u7684\u547d\u4ee4,\u53ea\u8981\u80fd\u4ece\u5176\u6807\u51c6\u8f93\u5165\u8bfb\u5165\u6570\u636e,\u4e4b\u540e\u5199\u51fa\u5230\u6807\u51c6\u8f93\u51fa\u5373\u53ef.\u8fd9\u6761\u547d\u4ee4\u987b\u8981\u8054\u63a5\u5230sshd\u670d\u52a1\u5668\u4e0a.<\/p>\n

\u4e5f\u5c31\u662f\u8bf4,\u5728\u4e0d\u4f7f\u7528ProxyCommand\u7684\u60c5\u51b5\u4e0blinux\u8df3\u677f\u673a<\/strong>,ssh\u4f1a\u81ea\u5df1\u5b8c\u5584\u5230\u76ee\u6807\u673a\u566822\u7aef\u53e3\u7684\u8054\u63a5.\u4f7f\u7528\u4e86ProxyCommand,\u8fd9\u4e48\u4f7f\u7528\u6307\u5b9a\u547d\u4ee4\u6765\u6784\u5efa\u5230\u76ee\u6807\u673a\u7684\u8054\u63a5,ssh\u76f4\u63a5\u4f7f\u7528\u65e9\u5df2\u6784\u5efa\u7684\u8054\u63a5.\u5728\u6587\u6863\u4e0a\u9762\u4f7f\u7528\u4e86nc\u547d\u4ee4\u6765\u6784\u5efa\u8054\u63a5.<\/p>\n

nc\u662f\u5916\u90e8\u547d\u4ee4,\u53ef\u80fd\u6709\u4e9b\u673a\u5668\u4e0a\u6ca1\u6709\u5b89\u88c5.\u5b9e\u9645\u4e0a,ssh\u547d\u4ee4\u7684-W\u9009\u9879\u53ef\u4ee5\u5b8c\u6210\u8fd9\u4e2a\u4e8b\u60c5<\/p>\n

manssh<\/p>\n

-Whost:port\u5c06client\u8fc7\u6765\u7684\u6807\u51c6\u8f93\u5165\u548c\u8f93\u51faforward\u5230host\u548cport\u6307\u5b9a\u7684\u5730\u65b9.\u53ef\u4ee5\u770b\u89c1,\u8fd9\u4e2a\u9009\u9879\u76f4\u63a5\u5c31\u53ef\u4ee5\u642d\u914d\u4e0aProxyCommand\u7684\u9700\u6c42.<\/p>\n

\u6709\u4e86\u8fd9\u79cd\u6253\u7b97\u77e5\u8bc6,\u6211\u4eec\u5c31\u53ef\u4ee5\u7f16\u64b0ssh\u7684\u914d\u7f6e\u6587\u4ef6\u4e86.\u987b\u8981\u5c06\u4e0b\u8fb9\u7684\u5185\u5bb9\u6dfb\u52a0\u5230\u81ea\u5df1\u7684~\/.ssh\/config\u6587\u4ef6\u4e2d(~\u662f\u81ea\u5df1\u7684\u5bb6\u547d\u4ee4,\u5047\u5982\u662froot\u7528\u6237\u5c31\u662f\/root,\u5018\u82e5\u662f\u975eroot\u7528\u6237\u5c31\u662f\/home\/\u7528\u6237\u540d,\u8fd9\u4e2a\u6587\u4ef6\u5047\u5982\u4e0d\u5b58\u5728\u5c31\u81ea\u5df1\u65b0\u5efa\u4e0b\u6765.)<\/p>\n

\n

Host tiaoban\n Hostname \u8df3\u677f\u673a\u7684ip\n Port \u8df3\u677f\u673a\u7684\u7aef\u53e3(\u5982\u679c\u662f\u975e22\u7684\u9700\u8981\u586b\u5199)\n User root(\u5982\u679c\u975eroot,\u6362\u6210\u8df3\u677f\u673a\u7684\u7528\u6237)\nHost mubiaoji\n Hostname \u76ee\u6807\u673a\u7684IP\n Port \u8df3\u677f\u673a\u7684\u7aef\u53e3(\u5982\u679c\u662f\u975e22\u7684\u9700\u8981\u586b\u5199)\n User root(\u5982\u679c\u975eroot,\u6362\u6210\u8df3\u677f\u673a\u7684\u7528\u6237)\n ProxyCommand ssh -q -x -W %h:%p tiaoban\n<\/pre>\n<\/p>\n

\u8fd9\u91cc\u7684%h\u8868\u793a\u8981\u8054\u63a5\u7684\u76ee\u6807\u673alinux\u5b66\u4e60\u8bba\u575b,\u4e5f\u5c31\u662fHostname\u6307\u5b9a\u7684ip\u6216\u5219\u4e3b\u673a\u540d,%p\u8868\u793a\u8981\u8054\u63a5\u5230\u76ee\u6807\u673a\u7684\u7aef\u53e3.\u8fd9\u91cc\u53ef\u4ee5\u76f4\u63a5\u5199\u6b7b\u56fa\u5b9a\u503c,\u5e76\u4e14\u4f7f\u7528%h\u548c%p\u53ef\u4ee5\u4fdd\u8bc1\u5728Hostname\u548cPort\u53d8\u5316\u7684\u60c5\u51b5\u4e0bProxyCommand\u8fd9\u884c\u4e0d\u7528\u8ddf\u968f\u53d8\u5316.<\/p>\n

linux\u8df3\u677f\u673a_\u8df3\u677f\u673a\u767b\u5f55\u670d\u52a1\u5668_\u8df3\u677f\u673a\u82f1\u6587<\/p>\n

\u4e4b\u540e\u6211\u4eec\u76f4\u63a5sshmubiaoji,\u53ef\u4ee5\u770b\u89c1\u76f4\u63a5\u5c31\u8054\u63a5\u4e0a\u4e86.<\/p>\n

linux\u8df3\u677f\u673a_\u8df3\u677f\u673a\u82f1\u6587_\u8df3\u677f\u673a\u767b\u5f55\u670d\u52a1\u5668<\/p>\n

\u5047\u5982\u4f7f\u7528\u7684\u5de5\u5177\u6ca1\u6709\u5bc6\u7801\u8bb0\u4f4f\u7684\u529f\u80fd(\u6211\u4f7f\u7528\u7684mobaxterm\u6709\u624b\u52a8\u8bb0\u4f4f\u5bc6\u7801\u7684\u529f\u80fdlinux\u8df3\u677f\u673a<\/strong>,linux\u81ea\u5e26\u7684\u6ca1\u6709\u8bb0\u4f4f\u5bc6\u7801\u7684\u529f\u80fd,mac\u7684Iterm2\u53ef\u4ee5\u627e\u4e00\u4e0b\u76f8\u5e94\u7684\u914d\u7f6e),\u8fd9\u4e48\u8fd9\u91cc\u4f1a\u8ba9\u8f93\u5165\u4e24\u6b21\u5bc6\u7801,\u7b2c\u4e00\u6b21\u662f\u8df3\u677f\u673a\u7684\u5bc6\u7801,\u7b2c\u4e8c\u6b21\u662f\u76ee\u6807\u673a\u7684\u5bc6\u7801,\u867d\u7136\u8f93\u5165\u5bc6\u7801\u7684\u65f6\u4faf\u4f1a\u63d0\u793a\u8981\u8f93\u5165\u5bc6\u7801\u7684\u673a\u5668\u7684IP,\u81ea\u5df1\u4e5f\u53ef\u4ee5\u5224\u522b.<\/p>\n

\u6b64\u65f6\u6574\u4e2a\u94fe\u8def\u662f\u5982\u4e0b\u7684:<\/p>\n

linux\u8df3\u677f\u673a_\u8df3\u677f\u673a\u82f1\u6587_\u8df3\u677f\u673a\u767b\u5f55\u670d\u52a1\u5668<\/p>\n

\u672c\u673a\u4f1assh\u5230\u8df3\u677f\u673a,\u6784\u5efa\u4e00\u6761\u8054\u63a5,\u4e4b\u540e-W\u547d\u4ee4\u4f1a\u4ece\u8df3\u677f\u673a\u53d1\u8d77\u8054\u63a5\u5230\u76ee\u6807\u673a.\u8df3\u677f\u673a\u76f4\u63a5\u5c06\u672c\u673a\u5230\u76ee\u6807\u673a\u548c\u76ee\u6807\u673a\u5230\u672c\u673a\u7684\u6570\u636e\u900f\u4f20,\u6700\u540e\u7684\u7597\u6548\u5c31\u76f8\u5f53\u4e8e\u4ece\u672c\u673a\u76f4\u63a5\u5230\u76ee\u6807\u673a\u4e86.<\/p>\n

0xff\u603b\u7ed3<\/p>\n

\u4f7f\u7528ssh\u7684ProxyCommand,\u6211\u4eec\u53ef\u4ee5\u4fbf\u6377\u7684\u900f\u8fc7\u8df3\u677f\u673a\u6b65\u5165\u5230\u73af\u5883\u4e0a\u9762\u7684\u673a\u5668.\u5b9e\u9645\u4e0a,\u6211\u4eec\u53ef\u4ee5\u4e0d\u6b62\u8df3\u8fc7\u4e00\u5c42\u8df3\u677f\u673a,\u901a\u8fc7\u4e0d\u65ad\u7684\u7d2f\u52a0\u8df3\u677f\u673a\u548cProxyCommand,\u7406\u8bba\u4e0a\u6211\u4eec\u53ef\u4ee5\u900f\u8fc7\u4efb\u610f\u5c42\u6570\u7684\u8df3\u677f\u673a.\u5982\u4e0b\u5c31\u662f\u4e24\u5c42\u8df3\u677f\u673a\u7684\u914d\u7f6e.<\/p>\n

\n

Host tiaoban1\n Hostname \u8df3\u677f\u673a\u7684ip\n Port \u8df3\u677f\u673a\u7684\u7aef\u53e3(\u5982\u679c\u662f\u975e22\u7684\u9700\u8981\u586b\u5199)\n User root(\u5982\u679c\u975eroot,\u6362\u6210\u8df3\u677f\u673a\u7684\u7528\u6237)\nHost tiaoban2\n Hostname \u8df3\u677f\u673a\u7684ip\n Port \u8df3\u677f\u673a\u7684\u7aef\u53e3(\u5982\u679c\u662f\u975e22\u7684\u9700\u8981\u586b\u5199)\n User root(\u5982\u679c\u975eroot,\u6362\u6210\u8df3\u677f\u673a\u7684\u7528\u6237)\n ProxyCommand ssh -q -x -W %h:%p tiaoban1\nHost mubiaoji\n Hostname \u76ee\u6807\u673a\u7684IP\n Port \u8df3\u677f\u673a\u7684\u7aef\u53e3(\u5982\u679c\u662f\u975e22\u7684\u9700\u8981\u586b\u5199)\n User root(\u5982\u679c\u975eroot,\u6362\u6210\u8df3\u677f\u673a\u7684\u7528\u6237)\n ProxyCommand ssh -q -x -W %h:%p tiaoban2\n<\/pre>\n<\/p>\n

\u5f53\u6211\u4eec\u53ef\u4ee5\u767b\u5165\u5230\u73af\u5883\u4ee5\u540e,\u6211\u4eec\u5c31\u53ef\u4ee5\u642d\u914d\u4e0a-L(\u672c\u5730\u8f6c\u53d1),-R(\u8fdc\u7a0b\u8f6c\u53d1),-D(\u52a8\u6001\u8f6c\u53d1)\u4fbf\u6377\u4ece\u73af\u5883\u4e0a\u9762\u8fdb\u51fa\u4ee5\u53ca\u767b\u9646\u73af\u5883\u4e0a\u9762\u7684\u5404\u7c7bWEB\u754c\u9762\u4e86.<\/p>\n","protected":false},"excerpt":{"rendered":"

\u591a\u5c42\u8df3\u677f\u673a\u6b63\u5e38\u767b\u9646\u65b9\u6cd5\u4f7f\u7528ProxyCommand\u6765\u900f\u8fc7\u8df3\u677f\u673aProxyCommand\u662fopenssh\u7684\u7279\u6027,\u5982\u679c\u4f7f\u7528putty,xshell,\u90a3\u4e48\u662f\u6ca1\u6709\u8fd9\u4e2a\u529f\u80fd\u7684.\u8fd9\u6761\u547d\u4ee4\u9700\u8981\u8fde\u63a5\u5230sshd\u670d\u52a1\u5668\u4e0a.\u5728\u6587\u6863\u91cc\u9762\u4f7f\u7528\u4e86nc\u547d\u4ee4\u6765\u5efa\u7acb\u8fde\u63a5.\u6709\u4e86\u8fd9\u4e9b\u51c6\u5907\u77e5\u8bc6,\u6211\u4eec\u5c31\u53ef\u4ee5\u7f16\u5199ssh\u7684\u914d\u7f6e\u6587\u4ef6\u4e86.\u4f7f\u7528ssh\u7684ProxyCommand,\u6211\u4eec\u53ef\u4ee5\u65b9\u4fbf\u7684\u900f\u8fc7\u8df3\u677f\u673a\u8fdb\u5165\u5230\u73af\u5883\u91cc\u9762\u7684\u673a\u5668.<\/p>\n","protected":false},"author":1,"featured_media":284252,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[988],"tags":[999],"class_list":["post-284251","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tougao","tag-999"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/284251","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=284251"}],"version-history":[{"count":0,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/284251\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/284252"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=284251"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=284251"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=284251"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}