[{rabbit, [{loopback_users, []}]}].
How permissions work
權(quán)限控制方式
When an AMQP client establishes a connection to an AMQP server, it specifies a virtual host within which it intends to operate. A first level of access control is enforced at this point, with the server checking whether the user has any permissions to access the virtual hosts, and rejecting the connection attempt otherwise.
當(dāng)一個(gè) AMQP 客戶端建立了一條到 AMQP 服務(wù)器的連接時(shí),就已經(jīng)指定了其所使用的虛擬主機(jī)。而虛擬主機(jī)就是訪問權(quán)限控制的第一級(jí),因?yàn)榉?wù)器會(huì)校驗(yàn)當(dāng)前用戶是否擁有相關(guān)權(quán)限來訪問對(duì)應(yīng)的虛擬主機(jī),若沒有,則會(huì)拒絕連接。
Resources, i.e. exchanges and queues, are named entities inside a particular virtual host; the same name denotes a different resource in each virtual host. A second level of access control is enforced when certain operations are performed on resources.
而資源,也就是 exchange 和 queue ,實(shí)際是指位于特定虛擬主機(jī)內(nèi)容的命名實(shí)體;在不同虛擬主機(jī)上的同名實(shí)體屬于不同的資源。訪問權(quán)限控制的第二級(jí)就是針對(duì)資源進(jìn)行可操作性約束實(shí)現(xiàn)的。
RabbitMQ distinguishes between configure, write and read operations on a resource. The configure operations create or destroy resources, or alter their behaviour. The write operations inject messages into a resource. And the read operations retrieve messages from a resource.
RabbitMQ 針對(duì)資源的操作權(quán)限分為 configure 、write 和 read 。
configure 權(quán)限用于控制針對(duì)資源的創(chuàng)建和刪除,或者變更的能力;
write 權(quán)限用于限制向資源注入消息的能力;
read 權(quán)限用于限制從資源獲取消息的能力;
In order to perform an operation on a resource the user must have been granted the appropriate permissions for it. The following table shows what permissions on what type of resource are required for all the AMQP commands which perform permission checks.
為了能夠?qū)δ撤N資源進(jìn)行操作,用戶必須被授予相應(yīng)的權(quán)限。下面的表格顯示了針對(duì)不同類型資源進(jìn)行 AMQP 命令操作所需的各種權(quán)限。
AMQP command
configure
write
read
exchange.declare
(passive=false)
exchange
exchange.declare
(passive=true)
exchange.declare
(with AE)
exchange
exchange (AE)
exchange
exchange.delete
exchange
queue.declare
(passive=false)
queue
queue.declare
(passive=true)
queue.declare
(with DLX)
queue
exchange (DLX)
queue
queue.delete
queue
exchange.bind
exchange (destination)
exchange (source)
exchange.unbind
exchange (destination)
exchange (source)
queue.bind
queue
exchange
queue.unbind
queue
exchange
basic.publish
exchange
basic.get
queue
basic.consume
queue
queue.purge
queue
Permissions are expressed as a triple of regular expressions - one each for configure, write and read - on per-vhost basis. The user is granted the respective permission for operations on all resources with names matching the regular expressions. (Note: For convenience RabbitMQ maps AMQP\'s default exchange\'s blank name to \'amq.default\' when performing permission checks.)
權(quán)限通過三元的正則表達(dá)式進(jìn)行描述 - 分別對(duì)應(yīng) configure 、write 和 read - 以虛擬主機(jī)為單位進(jìn)行配置。用戶通過正則匹配決定被授予針對(duì)各種資源相應(yīng)何種權(quán)限(注意,為了方便起見,RabbitMQ 會(huì)在進(jìn)行權(quán)限檢查時(shí),將 AMQP 中的默認(rèn) exchange 名,即空字符串,映射為 \'amq.default\')。
The regular expression \'^$\', i.e. matching nothing but the empty string, covers all resources and effectively stops the user from performing any operation. Standard AMQP resource names are prefixed with amq. and server generated names are prefixed with amq.gen. For example, \'^(amq.gen.*|amq.default)$\' gives a user access to server-generated names and the default exchange. The empty string, \'\' is a synonym for \'^$\' and restricts permissions in the exact same way.
正則表達(dá)式 \'^$\',即僅對(duì)空字符串匹配,將對(duì)所有資源產(chǎn)生效果,可以阻止用戶執(zhí)行任何操作。
標(biāo)準(zhǔn) AMQP 資源名以 amq. 作為前綴;服務(wù)器自動(dòng)生成的名字以 amq.gen 作為前綴。例如,\'^(amq.gen.*|amq.default)$\'將允許用戶訪問服務(wù)器生成名字的資源,以及默認(rèn) exchange 。空字符串 \'\' 與 \'^$\' 是同義的。
RabbitMQ may cache the results of access control checks on a per-connection or per-channel basis. Hence changes to user permissions may only take effect when the user reconnects.
RabbitMQ 可以按照 Connection 或 channel 層次進(jìn)行權(quán)限控制檢查結(jié)果的緩存。如此的話,針對(duì)用戶權(quán)限的變更將在用戶重連后生效。
For details of how to set up access control, please see the Access Control section of the rabbitmqctl(1) man page.
當(dāng)前文章:【原創(chuàng)】RabbitMQ之AccessControl(翻譯)
文章網(wǎng)址:http://www.rwnh.cn/article28/cpcsjp.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供域名注冊(cè)、App設(shè)計(jì)、靜態(tài)網(wǎng)站、商城網(wǎng)站、服務(wù)器托管、自適應(yīng)網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容
移動(dòng)網(wǎng)站建設(shè)知識(shí)