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, rpk splits the string on commas and fails to read the option correctly.

For example, use double quotes:

rpk security acl create --allow-principal="\"C=UK,ST=London,L=London,O=Redpanda,OU=engineering,CN=__schema_registry\""

Alternatively, use single quotes:

rpk security acl create --allow-principal='"C=UK,ST=London,L=London,O=Redpanda,OU=engineering,CN=__schema_registry"'

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

all

Allows all operations below.

read

Allows reading a given resource.

write

Allows writing to a given resource.

create

Allows creating a given resource (except for Redpanda Schema Registry).

delete

Allows deleting a given resource.

alter

Allows altering non-configurations.

describe

Allows querying non-configurations.

describe_configs

Allows describing configurations.

alter_configs

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.

Usage

rpk security acl [flags]

Subcommands

Command Description

rpk security acl create

Create ACLs. Following the multiplying effect of combining flags, the create command works on a straightforward basis: every ACL combination is a created ACL.

rpk security acl delete

Delete ACLs. See the rpk security acl help text for a full write up on ACLs.

rpk security acl list

List ACLs. See the rpk security acl help text for a full write up on ACLs.

Flags

Value Type Description

--help-operations

bool

Print more help about ACL operations.

Global flags

Value Type Description

--config

string

Redpanda or rpk config file; default search paths are ~/.config/rpk/rpk.yaml, $PWD/redpanda.yaml, and /etc/redpanda/redpanda.yaml.

-X, --config-opt

stringArray

Override rpk configuration settings; -X help for detail or -X list for terser detail.

--ignore-profile

bool

Ignore rpk.yaml and redpanda.yaml; use default settings.

--profile

string

rpk profile to use.

-v, --verbose

bool

Enable verbose logging.