cattle_grid.account.rabbit
cattle_grid.account.rabbit
Implementation of a HTTP auth backend for rabbitmq.
A possible configuration of RabbitMQ is
/etc/rabbitmq/conf.d/03_http_auth.conf
auth_backends.1 = internal
auth_backends.2 = http
auth_http.http_method = post
auth_http.user_path = http://cattle_grid_app/rabbitmq/user
auth_http.vhost_path = http://cattle_grid_app/rabbitmq/vhost
auth_http.resource_path = http://cattle_grid_app/rabbitmq/resource
auth_http.topic_path = http://cattle_grid_app/rabbitmq/topic
Here, we use auth_backend = internal
for the user
corresponding to the cattle_grid
processes. As cattle_grid
connects to RabbitMQ on startup, it cannot authenticate
itself.
resource_auth
async
resource_auth() -> str
topic_auth
async
topic_auth(
username: Annotated[str, Form()],
name: Annotated[str, Form()],
routing_key: Annotated[str, Form()],
) -> str
Checks if topic is allowed. Currently allowed are
and the routing keys send.username
and receive.username
Source code in cattle_grid/account/rabbit.py
user_auth
async
Checks login with username/password
Source code in cattle_grid/account/rabbit.py
validate_routing_key
Rules for the routing key, e.g.
>>> validate_routing_key("alice", "send.alice.trigger")
True
>>> validate_routing_key("alice", "send.bob.trigger")
False
Source code in cattle_grid/account/rabbit.py
vhost_auth
async
Authentication for vhosts, currently only “/” is allowed