{"id":203849,"date":"2020-11-02T10:12:47","date_gmt":"2020-11-02T02:12:47","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=203849"},"modified":"2020-10-26T19:13:44","modified_gmt":"2020-10-26T11:13:44","slug":"zookeeper-permission-control","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/zookeeper-permission-control.html","title":{"rendered":"Zookeeper \u6743\u9650\u63a7\u5236 ACL\u4ecb\u7ecd"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\nzookeeper \u7684 ACL\uff08Access Control List\uff0c\u8bbf\u95ee\u63a7\u5236\u8868\uff09\u6743\u9650\u5728\u751f\u4ea7\u73af\u5883\u662f\u7279\u522b\u91cd\u8981\u7684\u3002ACL \u6743\u9650\u53ef\u4ee5\u9488\u5bf9\u8282\u70b9\u8bbe\u7f6e\u76f8\u5173\u8bfb\u5199\u7b49\u6743\u9650\uff0c\u4fdd\u969c\u6570\u636e\u5b89\u5168\u6027\u3002permissions \u53ef\u4ee5\u6307\u5b9a\u4e0d\u540c\u7684\u6743\u9650\u8303\u56f4\u53ca\u89d2\u8272\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
ACL \u547d\u4ee4\u884c<\/strong><\/div>\n
    \n
  1. getAcl \u547d\u4ee4\uff1a\u83b7\u53d6\u67d0\u4e2a\u8282\u70b9\u7684 acl \u6743\u9650\u4fe1\u606f\u3002<\/li>\n
  2. setAcl \u547d\u4ee4\uff1a\u8bbe\u7f6e\u67d0\u4e2a\u8282\u70b9\u7684 acl \u6743\u9650\u4fe1\u606f\u3002<\/li>\n
  3. addauth \u547d\u4ee4\uff1a\u8f93\u5165\u8ba4\u8bc1\u6388\u6743\u4fe1\u606f\uff0c\u6ce8\u518c\u65f6\u8f93\u5165\u660e\u6587\u5bc6\u7801\uff0c\u52a0\u5bc6\u5f62\u5f0f\u4fdd\u5b58\u3002<\/li>\n<\/ol>\n
    ACL \u6784\u6210<\/strong><\/div>\n

    zookeeper \u7684 acl \u901a\u8fc7 [scheme:id:permissions] \u6765\u6784\u6210\u6743\u9650\u5217\u8868\u3002<\/p>\n

      \n
    1. scheme\uff1a\u4ee3\u8868\u91c7\u7528\u7684\u67d0\u79cd\u6743\u9650\u673a\u5236\uff0c\u5305\u62ec world\u3001auth\u3001digest\u3001ip\u3001super \u51e0\u79cd\u3002<\/li>\n
    2. id\uff1a\u4ee3\u8868\u5141\u8bb8\u8bbf\u95ee\u7684\u7528\u6237\u3002<\/li>\n
    3. permissions\uff1a\u6743\u9650\u7ec4\u5408\u5b57\u7b26\u4e32\uff0c\u7531 cdrwa \u7ec4\u6210\uff0c\u5176\u4e2d\u6bcf\u4e2a\u5b57\u6bcd\u4ee3\u8868\u652f\u6301\u4e0d\u540c\u6743\u9650\uff0c \u521b\u5efa\u6743\u9650 create(c)\u3001\u5220\u9664\u6743\u9650 delete(d)\u3001\u8bfb\u6743\u9650 read(r)\u3001\u5199\u6743\u9650 write(w)\u3001\u7ba1\u7406\u6743\u9650admin(a)\u3002<\/li>\n<\/ol>\n
      world \u5b9e\u4f8b<\/strong><\/div>\n

      \u67e5\u770b\u9ed8\u8ba4\u8282\u70b9\u6743\u9650\uff0c\u518d\u66f4\u65b0\u8282\u70b9 permissions \u6743\u9650\u90e8\u5206\u4e3a crwa\uff0c\u7ed3\u679c\u5220\u9664\u8282\u70b9\u5931\u8d25\u3002\u5176\u4e2d world \u4ee3\u8868\u5f00\u653e\u5f0f\u6743\u9650\u3002<\/p>\n

      $ getAcl \/runoob\/child\r\n$ setAcl \/runoob\/child world:anyone:crwa\r\n$ delete \/runoob\/child<\/pre>\n

      \"\"<\/p>\n

      auth \u5b9e\u4f8b<\/strong><\/div>\n

      auth \u7528\u4e8e\u6388\u4e88\u6743\u9650\uff0c\u6ce8\u610f\u9700\u8981\u5148\u521b\u5efa\u7528\u6237\u3002<\/p>\n

      $ setAcl \/runoob\/child auth:user1:123456:cdrwa\r\n$ addauth digest user1:123456\r\n$ setAcl \/runoob\/child auth:user1:123456:cdrwa\r\n$ getAcl \/runoob\/child<\/pre>\n

      \"\"<\/p>\n

      digest \u5b9e\u4f8b<\/strong><\/div>\n

      \u9000\u51fa\u5f53\u524d\u7528\u6237\uff0c\u91cd\u65b0\u8fde\u63a5\u7ec8\u7aef\uff0cdigest \u53ef\u7528\u4e8e\u8d26\u53f7\u5bc6\u7801\u767b\u5f55\u548c\u9a8c\u8bc1\u3002\u3002<\/p>\n

      $ ls \/runoob\r\n$ create \/runoob\/child01 runoob\r\n$ getAcl \/runoob\/child01\r\n$ setAcl \/runoob\/child01 digest:user1:HYGa7IZRm2PUBFiFFu8xY2pPP\/s=:cdra\r\n$ getAcl \/runoob\/child01\r\n$ addauth digest user1:123456\r\n$ getAcl \/runoob\/child01<\/pre>\n

      \u63d0\u793a\uff1a\u52a0\u5bc6\u5bc6\u7801\u662f\u4e0a\u4e00\u6b65\u521b\u5efa\u7684\u3002
      \n\"\"<\/p>\n

      IP \u5b9e\u4f8b<\/strong><\/div>\n

      \u9650\u5236 IP \u5730\u5740\u7684\u8bbf\u95ee\u6743\u9650\uff0c\u628a\u6743\u9650\u8bbe\u7f6e\u7ed9 IP \u5730\u5740\u4e3a 192.168.3.7 \u540e\uff0cIP \u4e3a 192.168.3.38 \u5df2\u7ecf\u6ca1\u6709\u8bbf\u95ee\u6743\u9650\u3002<\/p>\n

      $ create \/runoob\/ip 0\r\n$ getAcl \/runoob\/ip\r\n$ setAcl \/runoob\/ip ip:192.168.3.7:cdrwa\r\n$ get \/runoob\/ip<\/pre>\n","protected":false},"excerpt":{"rendered":"

      getAcl \u547d\u4ee4\uff1a\u83b7\u53d6\u67d0\u4e2a\u8282\u70b9\u7684 acl \u6743\u9650\u4fe1\u606f\u3002 setAcl \u547d\u4ee4\uff1a\u8bbe\u7f6e\u67d0\u4e2a\u8282\u70b9\u7684 acl \u6743\u9650\u4fe1\u606f\u3002 […]<\/p>\n","protected":false},"author":1470,"featured_media":203853,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-203849","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/203849","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\/1470"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=203849"}],"version-history":[{"count":2,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/203849\/revisions"}],"predecessor-version":[{"id":203855,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/203849\/revisions\/203855"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/203853"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=203849"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=203849"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=203849"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}