Skip to content

Secrets engine resources · Kind catalogue · Examples

SSHRole

API version: secrets.openbaoconfig.io/v1alpha1
Scope: Namespaced
Resource: sshroles.secrets.openbaoconfig.io
Categories: openbao

SSHRole manages a role of an SSH secrets engine at `<mount>/roles/<name>`: a ca role signs SSH user or host certificates with the SSHCA, an otp role issues one-time SSH passwords. Use one role per access pattern.

Example:

spec:
  connectionRef:
    name: openbao
  mountPath: ssh-client-signer
  name: ops
  keyType: ca
  allowUserCertificates: true
  allowedUsers: [ubuntu]
  defaultExtensions: {permit-pty: ""}

Example

examples/secrets/sshrole.yaml
apiVersion: secrets.openbaoconfig.io/v1alpha1
kind: SSHRole
metadata:
  name: obco-ssh-users
  namespace: openbao-config
spec:
  connectionRef:
    kind: OpenBaoConnection
    name: openbao
  creationPolicy: CreateOrAdopt
  deletionPolicy: Delete
  driftDetection: Enabled
  mountPath: ssh
  name: obco-users
  keyType: ca
  defaultUser: ubuntu
  defaultUserTemplate: false
  allowedUsers:
    - ubuntu
    - "{{identity.entity.name}}"
  allowedUsersTemplate: true
  allowedDomains:
    - obco.example.com
  allowedDomainsTemplate: false
  ttl: 30m
  maxTTL: 8h
  allowedCriticalOptions:
    - force-command
  allowedExtensions:
    - permit-pty
    - permit-port-forwarding
  defaultCriticalOptions:
    force-command: /usr/bin/true
  defaultExtensions:
    permit-pty: ""
  defaultExtensionsTemplate: false
  allowUserCertificates: true
  allowHostCertificates: true
  allowBareDomains: false
  allowSubdomains: true
  allowUserKeyIDs: false
  allowEmptyPrincipals: false
  allowCommasInIdentityTemplates: false
  allowWildcardsInIdentityTemplates: false
  keyIDFormat: "{{role_name}}-{{token_display_name}}"
  allowedUserKeyLengths:
    rsa:
      - 3072
      - 4096
    ed25519:
      - 256
  algorithmSigner: default
  notBeforeDuration: 30s
  issuerRef: default
---
apiVersion: secrets.openbaoconfig.io/v1alpha1
kind: SSHRole
metadata:
  name: obco-ssh-otp
  namespace: openbao-config
spec:
  connectionRef:
    kind: OpenBaoConnection
    name: openbao
  mountPath: ssh
  keyType: otp
  defaultUser: ubuntu
  allowedUsers:
    - ubuntu
  cidrList:
    - 10.20.0.0/16
  excludeCIDRList:
    - 10.20.0.0/24
  port: 2222

On GitHub: sshrole.yaml, generated sample with every field.

Fields

Defaults below are CRD schema defaults. A blank cell does not imply zero, false or an empty value; see the field description for omission behaviour. Required fields inside an optional object apply only when that object is set.

FieldTypeRequiredDefaultDescriptionValidation
specobjectyesspec is the desired role of an SSH secrets engine at `<mountPath>/roles/<name>`. A ca role signs SSH certificates; an otp role issues one-time passwords for hosts that run the OpenBao SSH helper. Certificate fields apply only to ca roles; cidrList, excludeCIDRList and port only to otp roles.
ConstraintsCEL: has(self.mountPath) == has(oldSelf.mountPath) && (!has(self.mountPath) || self.mountPath == oldSelf.mountPath) (mountPath is immutable)
CEL: has(self.name) == has(oldSelf.name) && (!has(self.name) || self.name == oldSelf.name) (name is immutable)
CEL: self.keyType != 'ca' || (has(self.allowUserCertificates) && self.allowUserCertificates) || (has(self.allowHostCertificates) && self.allowHostCertificates) (a ca role needs allowUserCertificates or allowHostCertificates)
CEL: self.keyType != 'otp' || has(self.defaultUser) (an otp role needs defaultUser)
CEL: self.keyType == 'otp' || (!has(self.cidrList) && !has(self.excludeCIDRList) && !has(self.port)) (cidrList, excludeCIDRList and port apply only to otp roles)
CEL: self.keyType == 'ca' || (!has(self.defaultUserTemplate) && !has(self.allowedUsersTemplate) && !has(self.allowedDomains) && !has(self.allowedDomainsTemplate) && !has(self.ttl) && !has(self.maxTTL) && !has(self.allowedCriticalOptions) && !has(self.allowedExtensions) && !has(self.defaultCriticalOptions) && !has(self.defaultExtensions) && !has(self.defaultExtensionsTemplate) && !has(self.allowUserCertificates) && !has(self.allowHostCertificates) && !has(self.allowBareDomains) && !has(self.allowSubdomains) && !has(self.allowUserKeyIDs) && !has(self.allowEmptyPrincipals) && !has(self.allowCommasInIdentityTemplates) && !has(self.allowWildcardsInIdentityTemplates) && !has(self.keyIDFormat) && !has(self.allowedUserKeyLengths) && !has(self.algorithmSigner) && !has(self.notBeforeDuration) && !has(self.issuerRef)) (certificate fields apply only to ca roles)
CEL: !has(self.ttl) || !has(self.maxTTL) || duration(self.maxTTL) == duration('0s') || duration(self.ttl) <= duration(self.maxTTL) (ttl must not exceed maxTTL)
CEL: has(self.__namespace__) == has(oldSelf.__namespace__) && (!has(self.__namespace__) || self.__namespace__ == oldSelf.__namespace__) (namespace is immutable)
CEL: self.connectionRef == oldSelf.connectionRef (connectionRef is immutable)
spec.algorithmSignerstringnoalgorithmSigner is the signature algorithm for RSA CA keys (`algorithm_signer`). Allowed: default, ssh-rsa, rsa-sha2-256, rsa-sha2-512. Defaults to default.
Constraintsone of: default, ssh-rsa, rsa-sha2-256, rsa-sha2-512
spec.allowBareDomainsbooleannoallowBareDomains allows host certificates for the domains in allowedDomains themselves (`allow_bare_domains`). Defaults to false.
spec.allowCommasInIdentityTemplatesbooleannoallowCommasInIdentityTemplates allows commas in values substituted into identity templates. Defaults to false.
spec.allowEmptyPrincipalsbooleannoallowEmptyPrincipals allows certificates without valid principals (`allow_empty_principals`); leave it disabled. Defaults to false.
spec.allowHostCertificatesbooleannoallowHostCertificates allows signing host certificates (`allow_host_certificates`). Defaults to false.
spec.allowSubdomainsbooleannoallowSubdomains allows host certificates for subdomains of allowedDomains (`allow_subdomains`). Defaults to false.
spec.allowUserCertificatesbooleannoallowUserCertificates allows signing user certificates (`allow_user_certificates`). A ca role needs this or allowHostCertificates. Defaults to false.
spec.allowUserKeyIDsbooleannoallowUserKeyIDs lets the request choose the key ID of the certificate (`allow_user_key_ids`). Defaults to false.
spec.allowWildcardsInIdentityTemplatesbooleannoallowWildcardsInIdentityTemplates allows wildcards in values substituted into identity templates. Defaults to false.
spec.allowedCriticalOptions[]stringnoallowedCriticalOptions are the critical options a certificate request may set (`allowed_critical_options`); empty allows any. Up to 64. Example: `[force-command]`.
Constraintsitems: <=64
list type: atomic
each item: pattern: ^[^,]+$
each item: length: >=1, <=128
spec.allowedDomains[]stringnoallowedDomains are the domains host certificates may be signed for (`allowed_domains`). Up to 256. Example: `[example.com]`.
Constraintsitems: <=256
list type: atomic
each item: pattern: ^[^,]+$
each item: length: >=1, <=256
spec.allowedDomainsTemplatebooleannoallowedDomainsTemplate allows identity templates in allowedDomains (`allowed_domains_template`). Defaults to false.
spec.allowedExtensions[]stringnoallowedExtensions are the extensions a certificate request may set (`allowed_extensions`); `*` allows any, empty allows none. Up to 64. Example: `[permit-pty, permit-port-forwarding]`.
Constraintsitems: <=64
list type: atomic
each item: pattern: ^[^,]+$
each item: length: >=1, <=128
spec.allowedUserKeyLengthsmap[string][]integer (int32)noallowedUserKeyLengths maps a key type (rsa, ec, ed25519 or an OpenSSH type) to the allowed key lengths (`allowed_user_key_lengths`). Up to 16 types. Example: `{rsa: [3072, 4096]}`.
Constraintsproperties: <=16
spec.allowedUserKeyLengths.<key>[]integer (int32)no
spec.allowedUsers[]stringnoallowedUsers are the users a credential may be issued for (`allowed_users`); `*` allows any. For ca roles an empty list allows none. Up to 256. Example: `[ubuntu, ops]`.
Constraintsitems: <=256
list type: atomic
each item: pattern: ^[^,]+$
each item: length: >=1, <=256
spec.allowedUsersTemplatebooleannoallowedUsersTemplate allows identity templates in allowedUsers (`allowed_users_template`). Defaults to false.
spec.cidrList[]stringnocidrList are the CIDR blocks of the hosts an otp role applies to (`cidr_list`). Up to 256. Example: `[10.0.0.0/16]`.
Constraintsitems: <=256
list type: atomic
CEL: self.all(c, isCIDR(c)) (cidrList entries must be CIDR blocks)
each item: length: <=64
spec.connectionRefobjectyesConnection used to reach and log in to OpenBao. Immutable.
spec.connectionRef.kindstringno"OpenBaoConnection"Kind of the connection: OpenBaoConnection (in the same Kubernetes namespace as this resource) or ClusterOpenBaoConnection (cluster-scoped; its allowedNamespaces must select this namespace). Default: OpenBaoConnection.
Constraintsone of: OpenBaoConnection, ClusterOpenBaoConnection
spec.connectionRef.namestringyesName of the OpenBaoConnection or ClusterOpenBaoConnection. Example: openbao
Constraintslength: >=1, <=253
spec.creationPolicystringno"Create"How an object that already exists in OpenBao, and is not yet owned by this resource, is treated. Create (default): create the object; an existing one is refused with reason Conflict. Adopt: take over an existing object and never create one. CreateOrAdopt: create it, or take over an existing one. Settings that always exist in OpenBao (configuration singletons) need Adopt or CreateOrAdopt.
Constraintsone of: Create, Adopt, CreateOrAdopt
spec.defaultCriticalOptionsmap[string]stringnodefaultCriticalOptions are added to certificates whose request sets none (`default_critical_options`). Up to 64. Example: `{force-command: /usr/bin/uptime}`.
Constraintsproperties: <=64
spec.defaultExtensionsmap[string]stringnodefaultExtensions are added to certificates whose request sets none (`default_extensions`). Up to 64. Example: `{permit-pty: ""}`.
Constraintsproperties: <=64
spec.defaultExtensionsTemplatebooleannodefaultExtensionsTemplate allows identity templates in defaultExtensions values (`default_extensions_template`). Defaults to false.
spec.defaultUserstringnodefaultUser is the user a credential is issued for when the request names none (`default_user`). Required for otp roles. Example: `ubuntu`.
Constraintslength: <=256
spec.defaultUserTemplatebooleannodefaultUserTemplate allows identity templates in defaultUser (`default_user_template`). Defaults to false.
spec.deletionPolicystringno"Orphan"What happens in OpenBao when this resource is deleted. Orphan (default): the OpenBao object stays. Delete: the object is removed (a configuration singleton is reset to its defaults); data and key holders (mounts, namespaces, KV data, audit devices, endpoints, transit, PKI, SSH CA and TOTP keys, MFA methods, entities) are removed only while the resource carries the annotation openbaoconfig.io/allow-destructive-delete: "true". Kinds whose OpenBao object cannot be deleted reject Delete.
Constraintsone of: Delete, Orphan
spec.driftDetectionstringno"Enabled"Whether OpenBao is re-read periodically to detect and repair out-of-band changes. Enabled (default): re-read every driftInterval. Disabled: write only when the spec or a referenced Secret changes.
Constraintsone of: Enabled, Disabled
spec.driftIntervalstringnoHow often OpenBao is re-read for drift, as a duration of at least 30s. Default: the operator's interval for the kind (15m for kinds that grant access such as policies, auth mounts and roles, 1h for the rest), with jitter. Example: 30m
Constraintslength: <=32
CEL: duration(self) >= duration('30s') (driftInterval must be at least 30s)
spec.excludeCIDRList[]stringnoexcludeCIDRList are CIDR blocks excluded from cidrList (`exclude_cidr_list`). Up to 256. Example: `[10.0.5.0/24]`.
Constraintsitems: <=256
list type: atomic
CEL: self.all(c, isCIDR(c)) (excludeCIDRList entries must be CIDR blocks)
each item: length: <=64
spec.issuerRefstringnoissuerRef is the name or ID of the issuer that signs for this role (`issuer_ref`). Defaults to `default`. Example: `default`.
Constraintslength: <=128
spec.keyIDFormatstringnokeyIDFormat is the key ID format (`key_id_format`), with `{{token_display_name}}`, `{{role_name}}` and `{{public_key_hash}}`. Example: `vault-{{role_name}}-{{token_display_name}}`.
Constraintslength: <=512
spec.keyTypestringyeskeyType is `ca` for certificate signing or `otp` for one-time passwords (`key_type`). Required.
Constraintsone of: ca, otp
spec.managementPolicystringno"Manage"Whether the operator writes to OpenBao. Manage (default): converge OpenBao to the spec, create and delete as the policies say. Observe: only read the object and report drift in the conditions; never write or delete.
Constraintsone of: Manage, Observe
spec.maxTTLstringnomaxTTL is the maximum lifetime of signed certificates (`max_ttl`), a duration. Defaults to the mount's max lease TTL. Example: `24h`.
Constraintspattern: ^(0|([0-9]+(\.[0-9]+)?(ns|us|ms|s|m|h))+)$
spec.mountPathstringno"ssh"mountPath is the path of the SSH secrets engine mount. Defaults to `ssh`. Immutable. Example: `ssh-client-signer`.
Constraintspattern: ^[A-Za-z0-9_.-]+(/[A-Za-z0-9_.-]+)*$
length: <=128
spec.namestringnoname is the role name in OpenBao. Defaults to metadata.name. Immutable. Example: `ops`.
Constraintspattern: ^[A-Za-z0-9_.@-]+$
length: >=1, <=128
spec.namespacestringnoOpenBao namespace of the object, relative to the connection's base namespace; empty means the connection namespace itself. Segments are separated by "/", without leading or trailing slash. Immutable: it cannot be added, changed or removed after creation. Example: team-a/apps
Constraintspattern: ^[A-Za-z0-9_-][A-Za-z0-9._-]*(/[A-Za-z0-9_-][A-Za-z0-9._-]*)*$
length: <=256
spec.notBeforeDurationstringnonotBeforeDuration backdates certificates by this duration (`not_before_duration`). Defaults to `30s`.
Constraintspattern: ^(0|([0-9]+(\.[0-9]+)?(ns|us|ms|s|m|h))+)$
spec.portinteger (int32)noport is the SSH port returned to otp clients (`port`). 1-65535. Defaults to 22.
Constraintsvalue: >=1, <=65535
spec.ttlstringnottl is the default lifetime of signed certificates (`ttl`), a duration. Must not exceed maxTTL. Defaults to maxTTL. Example: `30m`.
Constraintspattern: ^(0|([0-9]+(\.[0-9]+)?(ns|us|ms|s|m|h))+)$
statusobjectnostatus is the observed state of the SSH role.
status.acquiredstringnoHow the operator came to own the object: Created (it created it) or Adopted (it took over an existing one). Empty until owned.
status.conditions[]objectnoCurrent state as conditions: Ready (the OpenBao object matches the spec) and Synced (the last reconcile succeeded), each with a reason such as Available, Drifted, Conflict, ConnectionNotReady or PermissionDenied, and the generation it describes.
Constraintslist type: map (keys: type)
status.conditions[]objectnoCondition contains details for one aspect of the current state of this API Resource.
status.conditions[].lastTransitionTimestring (date-time)yeslastTransitionTime is the last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
status.conditions[].messagestringyesmessage is a human readable message indicating details about the transition. This may be an empty string.
Constraintslength: <=32768
status.conditions[].observedGenerationinteger (int64)noobservedGeneration represents the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance.
Constraintsvalue: >=0
status.conditions[].reasonstringyesreason contains a programmatic identifier indicating the reason for the condition's last transition. Producers of specific condition types may define expected values and meanings for this field, and whether the values are considered a guaranteed API. The value should be a CamelCase string. This field may not be empty.
Constraintspattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
length: >=1, <=1024
status.conditions[].statusstringyesstatus of the condition, one of True, False, Unknown.
Constraintsone of: True, False, Unknown
status.conditions[].typestringyestype of condition in CamelCase or in foo.example.com/CamelCase.
Constraintspattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
length: <=316
status.idstringnoIdentifier OpenBao generated for the object (an entity, group or alias ID, or a mount accessor), for kinds that have one; other resources reference it. Example: 6c9f3e0a-1b2c-4d5e-8f90-123456789abc
status.namespacestringnoAbsolute OpenBao namespace the object was written in; empty means the root namespace. If it later differs from the spec, reconciling stops with reason NamespaceChanged. Example: team-a/apps
status.observedGenerationinteger (int64)noThe metadata.generation of this resource that the operator last reconciled.
status.pathstringnoFull OpenBao API path of the object, including its namespace, as last written; deletion uses it even after the spec changed. Example: team-a/sys/policies/acl/app-read
status.rotationNoncestringnoValue of the resource's rotation nonce when one-time inputs, such as a root credential that OpenBao rotates afterwards, were last sent; changing the nonce in the spec sends them again.
status.serverIDstringnoCluster ID of the OpenBao server the object was acquired on. If the connection later reaches another server, reconciling stops with reason ServerChanged and nothing is written or deleted. Example: 80f7de92-c12e-e960-4754-255c32fc6b53
status.writeOnlyHashstringnoKeyed hash (HMAC-SHA256) of the write-only inputs, such as passwords read from Secrets; a change forces a write. It never contains or reveals the values.