# Cassandra temporary access

Issue temporary login roles for Apache Cassandra 4.1 and later using the existing
[customer provisioner](/docs/guides/provisioner). Both push and outbound-only polling
use the same connection token and customer authorization flow.

## Connect a cluster

Choose **Cassandra** in **Temporary access → Add target**. Select your provisioner,
enter the cluster contact host, TLS native-protocol port, and existing roles to grant.
Paste your cluster CA certificate if it uses a private CA. The driver discovers peers;
all contacted nodes must present a trusted certificate valid for the configured host.
TLS verification cannot be disabled.

Supply JSON with `username` and `password` for the management account. It needs to
create, alter, grant and drop roles, and read `system_auth.roles` for ownership checks.
Use Cassandra's `PasswordAuthenticator`, `CassandraRoleManager`, and an enabled
authorizer. Custom role managers and external authentication are not supported.
Grant application access through the selected roles; do not grant administrative
role-management permissions to temporary users.

The browser encrypts this configuration and login to the provisioner. No CQL tools,
Java runtime, extra environment variables, or target files are needed in the deployment.

## Lease lifecycle

Each lease creates a non-login marker role and a disabled login role. It connects
them, grants the requested roles through the marker, then enables login. Passwords
are generated inside the provisioner and installed using Cassandra's client-side
bcrypt hashing support. The result is encrypted directly to the requester.

Cleanup validates the marker before disabling and deleting both roles. The membership
marker survives password changes. A lease-specific bcrypt salt also identifies a
partially created role before login is enabled, allowing restart recovery without
local state. Existing roles are never overwritten.

Cassandra has no native deadline for these roles. Keep the provisioner connected for
scheduled cleanup. Authentication/permission caches and existing sessions can delay
the effect of revocation according to your cluster settings.

## CLI and API

Register with `seekrit dynamic target add --name events --config target.json`,
piping the management login JSON on stdin:

```json
{
  "provider": "cassandra",
  "executor": "remote",
  "provisionerId": "prv_REPLACE_WITH_REGISTERED_ID",
  "settings": {"host": "cassandra.internal", "port": 9042, "roles": ["events_reader"]},
  "maxTtlSeconds": 3600
}
```

Use `seekrit dynamic lease <target-id> --ttl 1h` to request access. The lease API
accepts `provider: "cassandra"`. Existing member and service-token grants apply
without changing the provisioner configuration.

See Apache Cassandra's [role management reference](https://cassandra.apache.org/doc/latest/cassandra/developing/cql/security.html)
and [client-side password hashing](https://cassandra.apache.org/_/blog/Apache-Cassandra-4.1-Features-Client-side-Password-Hashing.html).
