carbide-admin-cli is the command-line tool for managing a Carbide site. It communicates with
carbide-api over gRPC with mutual TLS (mTLS).
From the repository root:
The binary is written to:
target/debug/carbide-admin-cli (debug)target/release/carbide-admin-cli (release)The CLI needs three things to connect:
Instead of passing flags every time, create
$HOME/.config/carbide_api_cli.json:
If the CLI needs to reach carbide-api through a SOCKS5 proxy, set one
of: http_proxy, https_proxy, HTTP_PROXY, or HTTPS_PROXY. Only
the socks5:// scheme is supported.
carbide-api uses mTLS: the server verifies the client’s certificate against a trusted CA.
The following creates a self-contained CA and client certificate. In production you would typically use your organization’s existing PKI instead of a self-signed CA.
This produces:
The [auth.cli_certs] section in carbide-api-config.toml controls how
certificate fields are interpreted:
The available CertComponent values are:
IssuerO, IssuerOU, IssuerCN — from the certificate issuerSubjectO, SubjectOU, SubjectCN — from the certificate subjectThe [tls] section of carbide-api-config.toml tells carbide-api
where to find its own server certificate and which CAs to trust for
client authentication:
carbide-api loads both root_cafile_path and admin_root_cafile_path
into its TLS trust store. A client presenting a certificate signed by
either CA will pass the TLS handshake.
Authorization is configured in the [auth] section of
carbide-api-config.toml.
carbide-api uses Casbin with an RBAC model for authorization. The model is compiled into the binary and uses two rule types:
g (grouping) rules — map a principal identifier to a role namep (policy) rules — allow a principal or role to call a gRPC
method (glob matching is supported on the method name)The policy file is a CSV referenced by casbin_policy_file:
The <group> in external-role/<group> comes from the certificate
field specified by group_from in [auth.cli_certs].
Sample policy file:
The method names in the forge/<Method> column correspond to the gRPC
method names defined in the protobuf service definitions. Glob matching
(*) is supported.
With this configuration, a client certificate with subject
/O=ExampleCo/OU=site-admins/CN=jdoe and issuer
/O=ExampleCo/CN=ExampleCo Carbide Admin CA would:
required_equals check (IssuerO and IssuerCN match)site-admins (from SubjectOU)jdoe (from SubjectCN)external-role/site-adminsYou can see an example of a complete carbide-api configuration file here
Setting permissive_mode = true in the [auth] section causes the
authorization engine to allow all requests, even when the casbin
policy would deny them. Denied requests are logged with a warning
instead of being rejected:
When permissive mode is active, carbide-api logs messages like:
Use permissive mode only for:
Do not leave permissive mode enabled in production. It bypasses all authorization checks. Any client that can complete the TLS handshake (or any client at all, if TLS is also disabled) can call any API method.
You can also set permissive mode via environment variable without editing the config file: