{"id":206188,"date":"2020-12-10T08:14:20","date_gmt":"2020-12-10T00:14:20","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=206188"},"modified":"2020-12-02T10:21:53","modified_gmt":"2020-12-02T02:21:53","slug":"delete-library","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/delete-library.html","title":{"rendered":"\u770b\u5b8c\u8fd9\u7bc7\u4e0d\u5728\u62c5\u5fc3\u5220\u5e93\u8dd1\u8def"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u5f00\u53d1\u4eba\u5458\u7ecf\u5e38\u9700\u8981\u8bbf\u95ee\u67d0\u4e9b\u670d\u52a1\u5668\uff0c\u505a\u4e00\u4e9b\u68c0\u67e5\u5e94\u7528\u7a0b\u5e8f\u65e5\u5fd7\u4e4b\u7c7b\u7684\u5de5\u4f5c\u3002\u5230\u76ee\u524d\u4e3a\u6b62\uff0c\u8fd9\u8fd8\u6ca1\u4ec0\u4e48\u95ee\u9898\u3002\u4f46\u662f\uff0c\u5f53\u4e00\u540d\u5f00\u53d1\u4eba\u5458\u79bb\u804c\u65f6\u53c8\u4f1a\u53d1\u751f\u4ec0\u4e48\u4e8b\u60c5\u5462\uff1f<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\u5f00\u53d1\u4eba\u5458\u7ecf\u5e38\u9700\u8981\u8bbf\u95ee\u67d0\u4e9b\u670d\u52a1\u5668\uff0c\u505a\u4e00\u4e9b\u68c0\u67e5\u5e94\u7528\u7a0b\u5e8f\u65e5\u5fd7\u4e4b\u7c7b\u7684\u5de5\u4f5c\u3002<\/p>\n

\u4e00\u822c\u6765\u8bf4\uff0c\u8bbf\u95ee\u8fc7\u7a0b\u662f\u4f7f\u7528\u516c\u79c1\u94a5\u52a0\u5bc6\u6765\u63a7\u5236\u7684\uff0c\u6bcf\u4f4d\u5f00\u53d1\u4eba\u5458\u90fd\u4f1a\u751f\u6210\u81ea\u5df1\u7684\u516c\u79c1\u94a5\u5bf9\u3002\u5e76\u4e14\uff0c\u6bcf\u4e2a\u5f00\u53d1\u4eba\u5458\u7684\u516c\u94a5\u90fd\u4f1a\u6dfb\u52a0\u5230\u4ed6\u4eec\u6709\u6743\u8bbf\u95ee\u7684\u6bcf\u53f0\u670d\u52a1\u5668\u4e0a\u7684 authorized_keys \u6587\u4ef6\u4e2d\u3002<\/p>\n

\"\"<\/p>\n

1. \u75db\u82e6\u7684\u624b\u52a8\u66f4\u6539<\/strong><\/span><\/div>\n

\u5230\u76ee\u524d\u4e3a\u6b62\uff0c\u8fd9\u8fd8\u6ca1\u4ec0\u4e48\u95ee\u9898\u3002\u4f46\u662f\uff0c\u5f53\u4e00\u540d\u5f00\u53d1\u4eba\u5458\u79bb\u804c\u65f6\u53c8\u4f1a\u53d1\u751f\u4ec0\u4e48\u4e8b\u60c5\u5462\uff1f<\/p>\n

\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u5e94\u8be5\u4ece\u6240\u6709\u670d\u52a1\u5668\u4e0a\u5220\u9664\u8fd9\u4f4d\u5f00\u53d1\u4eba\u5458\u7684\u516c\u94a5\u3002\u6839\u636e\u4ed6\u4eec\u6709\u6743\u8bbf\u95ee\u7684\u670d\u52a1\u5668\u6570\u91cf\uff0c\u8fd9\u53ef\u80fd\u4f1a\u6d89\u53ca\u5f88\u591a\u5de5\u4f5c\u3002<\/p>\n

\u66f4\u7cdf\u7cd5\u7684\u662f\uff0c\u5982\u679c\u8fd9\u4e2a\u73af\u8282\u90fd\u662f\u624b\u52a8\u64cd\u4f5c\u7684\uff0c\u90a3\u4e48\u64cd\u4f5c\u5458\u5f88\u6709\u53ef\u80fd\u4f1a\u5fd8\u4e86\u5220\u9664\u67d0\u4e9b\u670d\u52a1\u5668\u4e0a\u7684\u516c\u94a5\u3002\u4e5f\u5c31\u662f\u8bf4\uff0c\u79bb\u804c\u5458\u5de5\u7684\u8bbf\u95ee\u6743\u9650\u4ecd\u7136\u4fdd\u6301\u542f\u7528\u72b6\u6001\u3002<\/p>\n

2. \u66ff\u4ee3\u89e3\u51b3\u65b9\u6848<\/strong><\/span><\/div>\n

\u6709\u4e00\u4e9b\u5546\u4e1a\u548c\u5f00\u6e90\u89e3\u51b3\u65b9\u6848\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u89e3\u51b3\u8fd9\u4e00\u95ee\u9898\u3002\u8fd9\u91cc\u7684\u57fa\u672c\u601d\u60f3\u662f\uff0c\u4f60\u5728\u8fd9\u7c7b\u670d\u52a1\u4e0a\u6dfb\u52a0\u5e76\u7ef4\u62a4\u4e00\u4e2a\u5bc6\u94a5\u548c\u8bbf\u95ee\u6743\u9650\u5217\u8868\uff0c\u9700\u8981\u5220\u9664\u67d0\u4e2a\u5bc6\u94a5\u65f6\uff0c\u8be5\u5bc6\u94a5\u5c06\u4ece\u6240\u6709\u670d\u52a1\u5668\u4e2d\u5220\u9664\u3002<\/p>\n

\u8fd9\u542c\u8d77\u6765\u4e0d\u9519\uff0c\u4f46\u8fd9\u79cd\u65b9\u6848\u6709\u4e00\u4e2a\u5f88\u5927\u7684\u7f3a\u9677\uff1a\u5b83\u662f\u6f5c\u5728\u7684\u5355\u4e00\u6545\u969c\u6e90\u3002\u5982\u679c\u67d0\u4eba\u83b7\u53d6\u4e86\u5bf9\u8be5\u670d\u52a1\u7684\u8bbf\u95ee\u6743\u9650\uff0c\u90a3\u5c31\u610f\u5473\u7740\u4ed6\u53ef\u4ee5\u8bbf\u95ee\u4f60\u7684\u6240\u6709\u670d\u52a1\u5668\u3002\u800c\u4e14\uff0c\u5982\u679c\u4f60\u65e0\u6cd5\u8bbf\u95ee\u8fd9\u4e2a\u670d\u52a1\uff0c\u5728\u6700\u574f\u7684\u60c5\u51b5\u4e0b\uff0c\u751a\u81f3\u4f1a\u65e0\u6cd5\u8bbf\u95ee\u6240\u6709\u670d\u52a1\u5668\u3002<\/p>\n

\u89e3\u51b3\u65b9\u6848\uff1a\u7b7e\u540d\u5bc6\u94a5<\/strong><\/span><\/div>\n

\u5f53\u6211\u9047\u5230\u4e86\u8fd9\u4e2a\u95ee\u9898\u65f6\uff0c\u6211\u53bb HackerNews \u4e0a\u95ee\u4e86\u95ee\u5176\u4ed6\u4eba\u662f\u5982\u4f55\u89e3\u51b3\u5b83\u7684\u3002<\/p>\n

https:\/\/news.ycombinator.com\/item?id=24157180<\/p>\n

\u793e\u533a\u63d0\u4f9b\u4e86\u4e00\u4e9b\u5f88\u68d2\u7684\u5efa\u8bae\u548c\u89c1\u89e3\uff0c\u800c\u8fd9\u4e2a\u95ee\u9898\u7684\u6700\u4f73\u89e3\u51b3\u65b9\u6848\u4f3c\u4e4e\u662f\u5bf9\u5bc6\u94a5\u8fdb\u884c\u7b7e\u540d\uff0c\u672c\u6587\u4f1a\u8be6\u7ec6\u7ed9\u5927\u5bb6\u4ecb\u7ecd\u4e00\u4e0b\u3002<\/p>\n

\u57fa\u672c\u601d\u60f3<\/strong><\/span><\/div>\n

\u8fd9\u4e2a\u65b9\u6cd5\u7684\u57fa\u672c\u601d\u60f3\u662f\uff1a\u4f60\u8fd8\u662f\u8981\u4e3a\u6bcf\u4f4d\u5f00\u53d1\u4eba\u5458\u751f\u6210\u4e00\u4e2a\u516c\u94a5 - \u79c1\u94a5\u5bf9\u3002\u4f46\u662f\uff0c\u4e0d\u8981\u628a\u516c\u94a5\u4e0a\u8f7d\u5230\u670d\u52a1\u5668\u4e0a\u3002<\/p>\n

\u800c\u662f\u4f7f\u7528\u4e4b\u524d\u751f\u6210\u7684\uff0c\u6240\u8c13\u7684\u8bc1\u4e66\u9881\u53d1\u673a\u6784\uff08CA\uff09\u5bc6\u94a5\u5bf9\u516c\u5171\u5bc6\u94a5\u8fdb\u884c\u7b7e\u540d\u3002\u8fd9\u4e2a\u7b7e\u540d\u5c31\u662f\u751f\u6210\u4e86\u7b2c\u4e09\u4e2a\u8bc1\u4e66\u6587\u4ef6\uff0c\u4f60\u5c06\u5b83\u8fd8\u7ed9\u5f00\u53d1\u4eba\u5458\uff0c\u7136\u540e\u8ba9\u4ed6\u4eec\u653e\u5728.ssh\/\u6587\u4ef6\u5939\u4e2d\uff0c\u548c\u79c1\u94a5\u3001\u516c\u94a5\u653e\u5728\u4e00\u8d77\u3002<\/p>\n

\u5728\u670d\u52a1\u5668\u4e0a\uff0c\u4f60\u53ea\u9700\u544a\u8bc9\u670d\u52a1\u5668\u4f60\u7684 CA \u7684\u516c\u94a5\uff0c\u670d\u52a1\u5668\u5c31\u53ef\u4ee5\u68c0\u6d4b\u7528\u6237\u662f\u5426\u5177\u6709\u6b63\u786e\u7b7e\u540d\u7684\u8bc1\u4e66\uff0c\u5e76\u4e14\u4ec5\u5141\u8bb8\u62e5\u6709\u8fd9\u79cd\u7b7e\u540d\u8bc1\u4e66\u7684\u5f00\u53d1\u4eba\u5458\u8bbf\u95ee\u81ea\u5df1\u3002<\/p>\n

\u4f18\u70b9<\/strong><\/span><\/div>\n

\u7b7e\u7f72\u8bc1\u4e66\u65f6\uff0c\u53ef\u4ee5\u5b9a\u4e49\u8fd9\u6b21\u7b7e\u7f72\u6709\u6548\u7684\u65f6\u95f4\u3002\u56e0\u6b64\uff0c\u5982\u679c\u4f60\u7b7e\u7f72\u7684\u6709\u6548\u671f\u4e3a 3 \u4e2a\u6708\uff0c\u968f\u540e\u5f00\u53d1\u4eba\u5458\u79bb\u5f00\u4e86\u516c\u53f8\uff0c\u90a3\u4e48 3 \u4e2a\u6708\u540e\uff0c\u4ed6\u4eec\u80af\u5b9a\u5c06\u65e0\u6cd5\u8bbf\u95ee\u4efb\u4f55\u670d\u52a1\u5668\u3002<\/p>\n

\u73b0\u5728\u4f60\u4f1a\u8bf4\uff1a\u597d\u5427\uff0c\u4f46\u6211\u4e0d\u60f3\u6bcf 3 \u4e2a\u6708\u5c31\u5bf9\u6bcf\u4e2a\u4eba\u7684\u5bc6\u94a5\u7b7e\u4e00\u6b21\u540d\uff0c\u8fd9\u4e2a\u62b1\u6028\u5f88\u5408\u7406\u3002<\/p>\n

\u4e00\u79cd\u529e\u6cd5\u662f\u8ba9\u8fd9\u4e2a\u6d41\u7a0b\u81ea\u52a8\u5316\uff0c\u4f8b\u5982\uff0c\u4f60\u53ef\u4ee5\u6784\u5efa\u670d\u52a1\uff0c\u8ba9\u7528\u6237\u5728\u4f7f\u7528\u516c\u53f8\u7684\u7535\u5b50\u90ae\u4ef6\u548c\u5bc6\u7801\u6388\u6743\u65f6\u53ef\u4ee5\u81ea\u52a8\u83b7\u5f97\u7b7e\u540d\u8bc1\u4e66\uff0c\u4f46\u8fd9\u4e0d\u5728\u672c\u6587\u7684\u8ba8\u8bba\u8303\u56f4\u4e4b\u5185\u3002<\/p>\n

\u53e6\u4e00\u79cd\u7b80\u5355\u7684\u66ff\u4ee3\u65b9\u6cd5\u662f\uff0c\u4f60\u53ef\u4ee5\u9881\u53d1\u6709\u6548\u671f\u66f4\u957f\u7684\u8bc1\u4e66\u3002\u7136\u540e\uff0c\u5982\u679c\u6709\u4eba\u79bb\u5f00\u516c\u53f8\uff0c\u5c31\u53ef\u4ee5\u64a4\u6d88\u8fd9\u4e2a\u8bc1\u4e66\uff0c\u4e5f\u5c31\u662f\u4f7f\u5176\u5931\u6548\u3002\u4f60\u53ef\u4ee5\u5728\u670d\u52a1\u5668\u4e0a\u653e\u7f6e\u4e00\u4e2a\u65e0\u6548\u8bc1\u4e66\u5217\u8868\uff0c\u5b83\u4eec\u5c06\u4e0d\u518d\u63a5\u53d7\u7528\u6237\u8bbf\u95ee\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u901a\u8fc7 AWS S3 \u6216\u5176\u4ed6\u5b58\u50a8\u6765\u5b58\u653e\u8fd9\u4e2a\u5217\u8868\uff0c\u5e76\u5728\u6bcf\u53f0\u670d\u52a1\u5668\u4e0a\u5b9a\u671f\u521b\u5efa\u4e00\u4e2a cronjob \u6765\u5b8c\u6210\u8fd9\u4e00\u64cd\u4f5c\u3002<\/p>\n

\u8be5\u600e\u4e48\u505a\uff1f<\/strong><\/span><\/div>\n

\u4e86\u89e3\u4e86\u539f\u7406\u540e\uff0c\u5b9e\u9645\u4e0a\u505a\u8d77\u6765\u975e\u5e38\u7b80\u5355\u3002<\/p>\n

\u9996\u5148\uff0c\u4f60\u8981\u751f\u6210\u4e00\u4e2a\u8bc1\u4e66\u9881\u53d1\u673a\u6784\u7684\u516c\u94a5 - \u79c1\u94a5\u5bf9\uff0c\u4f60\u5e94\u8be5\u628a\u8fd9\u4e2a\u79c1\u94a5\u653e\u5728\u975e\u5e38\u5b89\u5168\u7684\u5730\u65b9\uff1a<\/p>\n

umask 77 # you want it to be private \r\n \r\nmkdir ~\/my-ca && cd ~\/my-ca \r\n \r\nssh-keygen -C CA -f ca -b 4096 # be sure to use a passphrase and store it securely \r\n<\/pre>\n

\u7136\u540e\u5728\u4f60\u7684\u670d\u52a1\u5668\u4e0a\uff0c\u8bbe\u7f6e\u4e3a\u5141\u8bb8\u7531\u4f60\u7684 CA \u7b7e\u540d\u7684\u6240\u6709\u7528\u6237\u8bbf\u95ee\u8be5\u670d\u52a1\u5668\uff1a<\/p>\n

\u5c06 CA \u7684\u516c\u94a5\u4e0a\u4f20\u5230\u670d\u52a1\u5668\u4e0a\uff0c\u4f8b\u5982\u653e\u5728\/etc\/ssh\/ca.pub<\/p>\n

\u5728\/etc\/ssh\/sshd_config\u4e2d\u6dfb\u52a0\u4e00\u884c\uff0c\u6307\u793a\u670d\u52a1\u5668\u5141\u8bb8\u8bbf\u95ee\u7531\u8be5\u8bc1\u4e66\u7b7e\u540d\u7684\u7528\u6237<\/p>\n

TrustedUserCAKeys \/etc\/ssh\/ca.pub # Trust all with a certificate signed by ca.pub \r\n<\/pre>\n

\u4e3a\u4e86\u4f7f\u66f4\u6539\u751f\u6548\uff0c\u4f60\u5e94\u8be5\u91cd\u65b0\u52a0\u8f7d ssh \u670d\u52a1\uff1asudo service ssh reload\u3002\u73b0\u5728\uff0c\u5982\u679c\u4e00\u4f4d\u5f00\u53d1\u4eba\u5458\u751f\u6210\u4e86\u4ed6\u7684\u516c\u94a5 - \u79c1\u94a5\u5bf9\uff08\u4f8b\u5982ssh-keygen -t ecdsa -b 521\uff09\uff0c\u4ed6\u4eec\u53ea\u9700\u5411\u4f60\u53d1\u9001\u4ed6\u4eec\u7684\u516c\u94a5\uff08\u8bf7\u6ce8\u610f\uff0c\u4f60\u6c38\u8fdc\u4e0d\u9700\u8981\u53d1\u9001\u4efb\u4f55\u79c1\u94a5\uff01\uff09\u3002\u7136\u540e\uff0c\u4f60\u53ea\u9700\u7b7e\u7f72\u4ed6\u4eec\u7684\u516c\u94a5\u5c31\u80fd\u751f\u6210\u4ed6\u4eec\u7684\u8bc1\u4e66\uff1a<\/p>\n

# Inside your ~\/my-ca folder, sign their public key (here: id_ecdsa.pub) \r\n \r\nssh-keygen -s ca -I USER_ID -V +12w -z 1 id_ecdsa.pub \r\n<\/pre>\n

\u5404\u4e2a\u90e8\u5206\u7684\u7b80\u8981\u8bf4\u660e\uff1a<\/p>\n

-s ca\uff1a\u4f60\u8981\u4f7f\u7528 CA \u8fdb\u884c\u7b7e\u540d
\n-I USER_ID\uff1a\u4f60\u7684\u7528\u6237 ID\/ \u7528\u6237\u540d
\n-V +12w\uff1a\u8bc1\u4e66\u8fc7\u671f\u524d\u7684\u6709\u6548\u65f6\u95f4\uff0c\u8fd9\u91cc\u6709\u6548\u671f\u4e3a 12 \u5468
\n-z 1\uff1a\u6b64\u8bc1\u4e66\u7684\u5e8f\u5217\u53f7\uff0c\u4ee5\u540e\u53ef\u7528\u5b83\u6765\u8ba9\u8fd9\u4e2a\u8bc1\u4e66\u65e0\u6548\uff0c\u5e8f\u5217\u53f7\u5e94\u552f\u4e00
\nid_ecdsa.pub\uff1a\u4f60\u8981\u7b7e\u540d\u7684\u5f00\u53d1\u4eba\u5458\u7684\u516c\u94a5
\n\u5b83\u5c06\u751f\u6210\u8bc1\u4e66id_ecdsa-cert.pub\uff0c\u4f60\u53ef\u4ee5\u5c06\u5176\u53d1\u9001\u7ed9\u5f00\u53d1\u4eba\u5458\uff0c\u7136\u540e\u5c06\u5176\u653e\u5728\u301c\/.ssh\u6587\u4ef6\u5939\u4e2d\u7684\u516c\u94a5 \/ \u79c1\u94a5\u5bf9\u65c1\u8fb9\u3002<\/p>\n

\u6539\u8fdb\u4e00\u4e0b<\/strong><\/span><\/div>\n

\u542c\u8d77\u6765\u4e0d\u9519\uff0c\u4f46\u662f\u4f60\u8fd8\u53ef\u4ee5\u505a\u5f97\u66f4\u597d\uff01<\/p>\n

\u4f60\u7684\u7ec4\u7ec7\u91cc\u53ef\u80fd\u6709\u5f88\u591a\u62e5\u6709\u4e0d\u540c\u7ecf\u9a8c\u6c34\u5e73\u3001\u8eab\u5904\u4e0d\u540c\u56e2\u961f\u3001\u627f\u62c5\u4e0d\u540c\u804c\u8d23\u7684\u5f00\u53d1\u4eba\u5458\uff0c\u5e76\u4e0d\u662f\u6bcf\u4e2a\u4eba\u90fd\u4f1a\u8bbf\u95ee\u76f8\u540c\u7684\u670d\u52a1\u5668\u3002<\/p>\n

\u8fd9\u6837\u7684\u8bdd\uff0c\u8ba9\u6211\u4eec\u5728\u7b7e\u540d\u6d41\u7a0b\u4e2d\u6dfb\u52a0\u89d2\u8272\u5427\u3002<\/p>\n

\u8fd9\u6837\uff0c\u4f60\u53ef\u4ee5\u5728\u670d\u52a1\u5668\u4e0a\u8bbe\u7f6e\u5141\u8bb8\u54ea\u4e9b\u89d2\u8272\u8bbf\u95ee\u670d\u52a1\u5668\uff0c\u5e76\u4e14\u5728\u7b7e\u540d\u8fc7\u7a0b\u4e2d\u53ef\u4ee5\u6307\u5b9a\u8981\u7b7e\u540d\u7684\u5f00\u53d1\u4eba\u5458\u7684\u89d2\u8272\u3002<\/p>\n

\u7136\u540e\uff0c\u8fd9\u4f4d\u5f00\u53d1\u4eba\u5458\u5c31\u80fd\u8bbf\u95ee\u4e0e\u5176\u89d2\u8272\u5339\u914d\u7684\u6240\u6709\u670d\u52a1\u5668\u3002<\/p>\n

\u5f53\u4f60\u6dfb\u52a0\u65b0\u7684\u5f00\u53d1\u4eba\u5458\u65f6\uff0c\u53ea\u9700\u751f\u6210\u4e00\u4e2a\u8bc1\u4e66\u5373\u53ef\u8ba9\u4ed6\u4eec\u83b7\u5f97\u6388\u6743\uff0c\u8bbf\u95ee\u6240\u6709\u76f8\u5173\u670d\u52a1\u5668\uff0c\u800c\u65e0\u9700\u5728\u8fd9\u4e9b\u670d\u52a1\u5668\u4e0a\u6dfb\u52a0\u4efb\u4f55\u5185\u5bb9\u3002<\/p>\n

\u5927\u81f4\u4e0a\u662f\u8fd9\u6837\u7684\uff1a<\/p>\n

\"\"<\/p>\n

\u5e26\u6709\u89d2\u8272\u7684 ssh \u8bc1\u4e66\u7b7e\u540d<\/p>\n

\u4e0b\u9762\u662f\u5728\u670d\u52a1\u5668\u4e0a\u914d\u7f6e\u89d2\u8272\u7684\u65b9\u5f0f\uff1a<\/p>\n

\u9996\u5148\uff0c\u521b\u5efa\u7528\u4e8e\u914d\u7f6e\u8bbf\u95ee\u6743\u9650\u7684\u6587\u4ef6\u5939\uff1asudo mkdir \/etc\/ssh\/auth_principals\u3002\u5728\u8be5\u6587\u4ef6\u5939\u4e2d\uff0c\u4f60\u53ef\u4ee5\u7528\u5141\u8bb8\u767b\u5f55\u670d\u52a1\u5668\u7684\u7528\u6237\u540d\u521b\u5efa\u6587\u4ef6\u3002\u4f8b\u5982\uff0c\u8981\u5bf9\u67d0\u4e9b\u89d2\u8272\u6388\u4e88 root \u8bbf\u95ee\u6743\u9650\uff0c\u8bf7\u6dfb\u52a0\u6587\u4ef6\/etc\/ssh\/auth_principals\/root\u3002<\/p>\n

\u5728\/etc\/ssh\/auth_principals\/root\u5185\u90e8\uff0c\u4f60\u53ea\u9700\u5217\u51fa\u6240\u6709\u53ef\u4ee5\u7528 root \u8eab\u4efd\u767b\u5f55\u7684\u89d2\u8272\uff0c\u6bcf\u884c\u4e00\u4e2a\u89d2\u8272\uff1a<\/p>\n

admin \r\n \r\nsenior-developer \r\n<\/pre>\n

\u6700\u540e\uff0c\u518d\u5728\/etc\/ssh\/sshd_config\u4e2d\u6dfb\u52a0\u4e00\u884c\uff0c\u5728\u670d\u52a1\u5668\u4e0a\u914d\u7f6e\u4e3a\u4f7f\u7528\u89d2\u8272\uff1a<\/p>\n

AuthorizedPrincipalsFile \/etc\/ssh\/auth_principals\/%u \r\n<\/pre>\n

\u4e3a\u4e86\u4f7f\u66f4\u6539\u751f\u6548\uff0c\u4f60\u5e94\u8be5\u91cd\u65b0\u52a0\u8f7d ssh \u670d\u52a1\uff1asudo service ssh reload\u3002
\n\u4e0b\u9762\u662f\u4f7f\u7528\u89d2\u8272\u7b7e\u7f72\u5bc6\u94a5\u7684\u65b9\u5f0f\uff08\u5b83\u4eec\u5df2\u6dfb\u52a0\u5230\u8bc1\u4e66\u4e2d\uff09\uff1a<\/p>\n

ssh-keygen -s ca -I USER_ID -n ROLE1,ROLE2 -V +12w -z 2 id_ecdsa.pub \r\n<\/pre>\n

\u8fd9\u91cc\u548c\u4e4b\u524d\u662f\u4e00\u6837\u7684\uff0c\u4f46\u5e26\u6709-n ROLE1,ROLE2\u6807\u5fd7\u3002\u91cd\u8981\u63d0\u793a\uff1a\u4e0d\u540c\u89d2\u8272\u7684\u9017\u53f7\u4e4b\u95f4\u4e0d\u80fd\u6709\u7a7a\u683c\uff01\u73b0\u5728\uff0c\u8fd9\u4f4d\u5f00\u53d1\u4eba\u5458\u53ef\u4ee5\u767b\u5f55 auth_principals \u6587\u4ef6\u4e2d\u6709ROLE1\u6216ROLE2\u7684\u4efb\u4f55\u670d\u52a1\u5668\uff0c\u4ee5\u83b7\u53d6\u4ed6\u4eec\u5c1d\u8bd5\u767b\u5f55\u65f6\u4f7f\u7528\u7684\u7528\u6237\u540d\u3002<\/p>\n

\u6ce8\u9500\u5bc6\u94a5<\/strong><\/span><\/div>\n

\u6700\u540e\uff0c\u5982\u679c\u8981\u4f7f\u8bc1\u4e66\u65e0\u6548\uff0c\u53ef\u4ee5\u901a\u8fc7\u7528\u6237\u540d\u6216\u8bc1\u4e66\u7684\u5e8f\u5217\u53f7\uff08-z\u6807\u5fd7\uff09\u6765\u5b9e\u73b0\u3002\u5efa\u8bae\u4f60\u5728 Excel \u7535\u5b50\u8868\u683c\u4e2d\u5217\u51fa\u751f\u6210\u7684\u8bc1\u4e66\u5217\u8868\uff0c\u6216\u8005\u6839\u636e\u4f60\u7684\u5177\u4f53\u60c5\u51b5\u6765\u5efa\u7acb\u6570\u636e\u5e93\u3002<\/p>\n

ssh-keygen -k -f revoked-keys -u -s ca list-to-revoke \r\n<\/pre>\n

\u5f53\u4f60\u5df2\u7ecf\u6709\u4e00\u4e2arevoked-keys\u5217\u8868\u5e76\u60f3\u8981\u66f4\u65b0\u5b83\u65f6\uff08-u\u6807\u5fd7\uff09\u5c31\u8fd9\u6837\u505a\u3002\u5bf9\u4e8e\u521d\u59cb\u751f\u6210\uff0c\u8bf7\u62ff\u6389\u66f4\u65b0\u6807\u5fd7\u3002list-to-revoke\u9700\u8981\u5305\u542b\u7528\u6237\u540d\uff08id\uff09\u6216\u5e8f\u5217\u53f7\uff08\u751f\u6210\u671f\u95f4\u4e3a-z\u6807\u5fd7\uff09\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n

serial: 1 \r\n \r\nid: test.user \r\n<\/pre>\n

\u8fd9\u5c06\u64a4\u6d88\u5bf9\u5e8f\u5217\u53f7\u4e3a 1 \u7684\u8bc1\u4e66\u4ee5\u53ca ID \u4e3atest.user\u7684\u6240\u6709\u8bc1\u4e66\u7684\u8bbf\u95ee\u6743\u9650\u3002<\/p>\n

\u4e3a\u4e86\u8ba9\u670d\u52a1\u5668\u77e5\u6653\u5df2\u6ce8\u9500\u7684\u5bc6\u94a5\uff0c\u4f60\u9700\u8981\u5c06\u751f\u6210\u7684 \/ \u66f4\u65b0\u7684revoked keys\u6587\u4ef6\u6dfb\u52a0\u5230\/etc\/ssh\/revoked-keys\uff0c\u5e76\u5728\/etc\/ssh\/sshd_config\u4e2d\u518d\u6b21\u914d\u7f6e\uff1a<\/p>\n

\u8b66\u544a\uff1a\u786e\u4fddrevoked-keys\u6587\u4ef6\u53ef\u8bbf\u95ee\u4e14\u53ef\u8bfb\uff0c\u5426\u5219\u4f60\u53ef\u80fd\u65e0\u6cd5\u8bbf\u95ee\u670d\u52a1\u5668<\/p>\n

RevokedKeys \/etc\/ssh\/revoked-keys\r\n<\/pre>\n
3. \u5c0f\u7ed3\uff1assh \u5bc6\u94a5\u7ba1\u7406\u7684\u597d\u65b9\u6cd5<\/strong><\/span><\/div>\n

\u6211\u8ba4\u4e3a\u8fd9\u79cd\u89e3\u51b3\u65b9\u6848\u662f\u6700\u597d\u7528\u7684\u3002\u4f60\u53ef\u4ee5\u9009\u62e9\u901a\u8fc7 ssh \u57fa\u4e8e\u89d2\u8272\u7ba1\u7406\u5bf9\u670d\u52a1\u5668\u7684\u8bbf\u95ee\u6743\u9650\u3002\u4f60\u53ea\u9700\u914d\u7f6e\u4e00\u6b21\u670d\u52a1\u5668\uff08\u5141\u8bb8\u54ea\u4e9b\u89d2\u8272\u8bbf\u95ee\u670d\u52a1\u5668\uff09\u5373\u53ef\u3002\u5bf9\u4e8e\u65b0\u52a0\u5165\u7684\u5f00\u53d1\u4eba\u5458\uff0c\u4f60\u53ea\u9700\u8981\u751f\u6210\u4e00\u4e2a\u7b7e\u540d\u8bc1\u4e66\uff0c\u4ed6\u4eec\u5c31\u80fd\u7acb\u5373\u8bbf\u95ee\u4e0e\u4ed6\u4eec\u7684\u89d2\u8272 \/ \u7ecf\u9a8c\u76f8\u5339\u914d\u7684\u6240\u6709\u76f8\u5173\u673a\u5668\u3002\u5f53\u4ed6\u4eec\u79bb\u5f00\u516c\u53f8\u65f6\uff0c\u4f60\u4e5f\u53ef\u4ee5\u901a\u8fc7\u4e00\u79cd\u7b80\u5355\u7684\u65b9\u5f0f\u64a4\u9500\u4ed6\u4eec\u7684\u8bbf\u95ee\u6743\u9650\u3002<\/p>\n

\u5373\u4f7f\u53d1\u751f\u4e0d\u5e78\u4e8b\u6545\uff0c\u5e76\u4e14\u5f00\u53d1\u4eba\u5458\u5728\u672a\u53d6\u6d88\u8bbf\u95ee\u6743\u9650\u7684\u60c5\u51b5\u4e0b\u79bb\u5f00\uff0c\u4ed6\u4eec\u7684\u8bc1\u4e66\u4e5f\u4f1a\u5728\u4e00\u6bb5\u65f6\u95f4\u540e\u8fc7\u671f\uff0c\u56e0\u6b64\u4ed6\u4eec\u4e5f\u5c06\u81ea\u52a8\u5931\u53bb\u8bbf\u95ee\u6743\u9650\u3002<\/p>\n

\u5bf9\u5c0f\u578b\u56e2\u961f\u6765\u8bf4\uff0c\u4f60\u53ef\u4ee5\u624b\u52a8\u6267\u884c\u8fd9\u4e9b\u6b65\u9aa4\uff0c\u56e0\u4e3a\u8fd9\u4e9b\u5de5\u4f5c\u505a\u8d77\u6765\u975e\u5e38\u5feb\uff1b\u7136\u540e\u968f\u7740\u4f60\u7684\u6210\u957f\uff0c\u53ef\u4ee5\u4f7f\u7528\u57fa\u4e8e\u516c\u53f8\u8eab\u4efd\u9a8c\u8bc1\u8be6\u7ec6\u4fe1\u606f\u7684\u767b\u5f55\u670d\u52a1\u6765\u81ea\u52a8\u8fdb\u884c\u8bc1\u4e66\u7b7e\u540d\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u5f00\u53d1\u4eba\u5458\u7ecf\u5e38\u9700\u8981\u8bbf\u95ee\u67d0\u4e9b\u670d\u52a1\u5668\uff0c\u505a\u4e00\u4e9b\u68c0\u67e5\u5e94\u7528\u7a0b\u5e8f\u65e5\u5fd7\u4e4b\u7c7b\u7684\u5de5\u4f5c\u3002 \u4e00\u822c\u6765\u8bf4\uff0c\u8bbf\u95ee\u8fc7\u7a0b\u662f\u4f7f\u7528\u516c\u79c1\u94a5\u52a0\u5bc6\u6765\u63a7\u5236\u7684 […]<\/p>\n","protected":false},"author":1898,"featured_media":206192,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[618],"class_list":["post-206188","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread","tag-618"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/206188","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\/1898"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=206188"}],"version-history":[{"count":4,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/206188\/revisions"}],"predecessor-version":[{"id":206195,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/206188\/revisions\/206195"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/206192"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=206188"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=206188"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=206188"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}