Skip to content

Access rules

The access rules decide who may get what after a login, with OIDC or LDAP. Both logins share them.

access:
  # Everyone in linux-users may log in to servers as themselves.
  - groups: [linux-users]
    ssh_principals: ["{short_username}"]
  # DBAs also as postgres.
  - groups: [dba]
    ssh_principals: [postgres]
  # CA admins may hand out any certificate.
  - groups: [ca-admins]
    admin: true
  # Rules by person work too, for the exceptions.
  - users: [[email protected]]
    ssh_principals: [deploy]

Fields

Field Meaning
users People, by the name the provider or directory reports ([email protected]).
groups Groups, as the provider sends them (names or IDs; with LDAP, names or full DNs).
ssh_principals Login names for SSH user certificates.
admin true: may create one-time tokens for anything, and request any certificate.

Each rule needs users or groups (or both), and ssh_principals or admin: true.

How they apply

  • A person matches a rule if their name is in users or one of their groups is in groups. They get the principals of all the rules they match.
  • Placeholders in ssh_principals:

    Placeholder Becomes Example
    {username} the person's name, in lower case [email protected]
    {short_username} the part before the @ alice
  • Groups are read at every login. Someone added to dba at the provider gets postgres at their next login; someone removed loses it. BastionXP CA's configuration does not change.

  • Removing someone from the rules, or from their group, takes their access away at their next login. Nothing is kept between two requests.
  • A person who matches no rule cannot log in (login refused: no rule for this person in the log).
  • Rules are reloadable: systemctl reload bastionxp-ca applies changes at once.

What people get

Person May get
Matches rules with ssh_principals For themselves: an SSH certificate for exactly those principals (fewer with --principal), and a TLS client certificate for their own name. The profiles are the verifier's ssh.cert_profile and x509.cert_profile (see Each verifier's profile).
Matches a rule with admin: true Any certificate, with any profile and names; one-time tokens for anything, from their own machine.
Matches no rule Nothing.

The name in a person's own TLS certificate is decided by the CA: their name as the login reports it ([email protected]). They cannot ask for another. Non-admins get an error for anything else.

The principal must match the login name on the servers

On servers joined to Active Directory with SSSD, the login name is often the full name ([email protected]: use {username}), or the short one with use_fully_qualified_names = False (use {short_username}). See Hosts in Active Directory.

Admins by name

Without a group for admins, list them by name:

access:
  - users: [[email protected], [email protected]]
    admin: true

Check a person against the rules

bxp access check shows which rules match a person with given groups, and what they get. It reads only the configuration, so it also answers "what if" before a change goes live. Give the groups as they arrive at login (OIDC: the groups claim, e.g. Entra group IDs; LDAP: the group's name or its DN):

$ bxp access check --user [email protected] --group linux-users --group dba
User:    [email protected]
Groups:  linux-users, dba
Login:   oidc

Matching rules (of 3 in "access:"):
  #1  by group linux-users: ssh_principals: {short_username}
  #2  by group dba: ssh_principals: postgres

What they get:
  SSH certificate:  ssh-user, for themselves, as alice, postgres
  TLS certificate:  tls-client, for [email protected]

With both OIDC and LDAP set up, say which with --login oidc or --login ldap: each has its own profiles. --format json gives the same for scripts.

Validation

The server refuses to start (and a reload is ignored) when:

  • access is given without oidc or ldap, or a login is configured with no rules (nobody could log in);
  • a rule names nobody, or gives nothing;
  • a principal contains an unknown placeholder.