rpk security acl
Manage Kafka ACLs (Access Control Lists) for authorization. ACLs control which principals can perform operations on resources.
|
To set multiple principals in a single comma-separated string, you must enclose the string with quotes. Otherwise, For example, use double quotes:
Alternatively, use single quotes:
|
Principals
All ACLs require a principal or a role. A principal is composed of a user and a type. Within Redpanda, only the "User" type is supported. Having prefixes for new types ensures that potential future authorizers can add authorization using other types, such as "Group".
When you create a user, you need to add ACLs for it before it can be used. You can create/delete/list ACLs for that user with either User:bar or bar in the --allow-principal and --deny-principal flags. This command will add the User: prefix for you if it is missing. The wildcard * matches any user. Creating an ACL with user * grants or denies the permission for all users.
Hosts
Hosts can be seen as an extension of the principal, and effectively gate where the principal can connect from. When creating ACLs, unless otherwise specified, the default host is the wildcard * which allows or denies the principal from all hosts (where allow & deny are based on whether --allow-principal or --deny-principal is used). If specifying hosts, you must pair the --allow-host flag with the --allow-principal flag, and the --deny-host flag with the --deny-principal flag.
Roles
You can bind ACLs to a role. A role has only one part: the name. In contrast to principals, there is no need to supply the type. If a type-like prefix is present, it is treated as text rather than as principal type information.
When you create a role, you must bind or associate ACLs to it before it can be used. You can create / delete / list ACLs for that role with "<name>" in the --allow-role and --deny-role flags. Note that the wildcard role name * is not permitted here.
Resources
A resource is what an ACL allows or denies access to. There are six resources within Redpanda: topics, groups, the cluster itself, transactional IDs, schema registry, and schema registry subjects. Names for each of these resources can be specified with their respective flags.
Resources combine with the operation that is allowed or denied on that resource. By default, resources are specified on an exact name match (a literal match). The --resource-pattern-type flag can be used to specify that a resource name is prefixed, meaning to allow anything with the given prefix. A literal name of foo will match only the topic foo, while the prefixed name of foo- will match both foo-bar and foo-baz. The special wildcard resource name * matches any name of the given resource type (--topic * matches all topics).
Operations
Pairing with resources, operations are the actions that are allowed or denied. Redpanda has the following operations:
| Operation | Description |
|---|---|
|
Allows all operations below. |
|
Allows reading a given resource. |
|
Allows writing to a given resource. |
|
Allows creating a given resource (except for Redpanda Schema Registry). |
|
Allows deleting a given resource. |
|
Allows altering non-configurations. |
|
Allows querying non-configurations. |
|
Allows describing configurations. |
|
Allows altering configurations. |
You can run rpk security acl --help-operations to see which operations are required for which requests. In flag form to set up a general producing/consuming client, you can invoke rpk security acl create three times with the following (including your --allow-principal):
rpk security acl create --operation write,read,describe --topic [topics]
rpk security acl create --operation describe,read --group [group.id]
rpk security acl create --operation describe,write --transactional-id [transactional.id]
Permissions
A client can be allowed access or denied access. By default, all permissions are denied. You only need to specifically deny a permission if you allow a wide set of permissions and then want to deny a specific permission in that set. You could allow all operations, and then specifically deny writing to topics.
Management
Creating ACLs works on a specific ACL basis, but listing and deleting ACLs works on filters. Filters allow matching many ACLs to be printed listed and deleted at once. Because this can be risky for deleting, the delete command prompts for confirmation by default. More details and examples for creating, listing, and deleting can be seen in each of the commands.
Using SASL requires setting enable_sasl: true in the redpanda section of your redpanda.yaml. User management is a separate, simpler concept that is described in the user command.
Subcommands
| Command | Description |
|---|---|
Create ACLs. Following the multiplying effect of combining flags, the create command works on a straightforward basis: every ACL combination is a created ACL. |
|
Delete ACLs. See the |
|
List ACLs. See the |
Global flags
| Value | Type | Description |
|---|---|---|
|
string |
Redpanda or |
|
stringArray |
Override |
|
bool |
Ignore |
|
string |
|
|
bool |
Enable verbose logging. |