⚓Harbor
Install P0 for your Harbor instances so people can request just-in-time roles on Harbor projects.
Use the Harbor integration to give people temporary roles on Harbor projects. A person requests a role on one project. When the request is approved, P0 makes their existing Harbor user a direct member of the project with that role, and when access ends, P0 puts back the lower role they had before or removes the membership.
People can also request Harbor's system administrator access on an instance for a bounded time. See System administrator access.
To learn more, see:
How it works
The connector runs in your cloud. You deploy P0's Harbor connector (see P0 connectors) on AWS Lambda or Google Cloud Run. P0 invokes the connector, and the connector calls your Harbor instances. One connector can serve several Harbor instances.
The connector signs in as an admin account you set up. Each instance has a dedicated user from your identity provider, made a Harbor system administrator. Every call P0 makes on the instance, project roles included, signs in as that account. See Step 1: Set up the admin account.
The admin account's credential stays in your secret manager. You store it in AWS Secrets Manager or Google Secret Manager, under a name you choose, one secret per instance. P0 stores only the secret's name and where it is, and never reads the secret. The connector does.
You decide which email domains can receive access. The connector's
ALLOWED_EMAIL_DOMAIN_PATTERNenvironment variable holds a regular expression for the allowed email domains. The connector refuses everyone else, and P0 can't change the pattern.P0 finds each person by email. P0 matches the requestor's P0 email to the Harbor user with the same email, and never creates Harbor users.
P0 changes direct roles only. P0 reads and changes a person's own membership of a project, and never a group's.
What P0 changes in Harbor
A request is approved
Adds the person to the project with the requested role, or raises their direct role to it
Access ends
Puts back the direct role they held before, if it's lower than the role they hold by then. Removes their membership if they weren't a direct member before
A grant only raises a role, and the end of access only lowers one. P0 refuses a request for a role the person already holds directly at an equal or higher level. For the details, see When your access ends.
System administrator access
A Harbor system administrator has full control of the instance: every project, user and robot account, and Harbor's own configuration. A person can request it on any installed instance, for a bounded time:
P0 refuses someone who is already a system administrator on the instance by Harbor's administrator flag. It would also refuse an administrator through your identity provider's Harbor admin group, but Harbor doesn't report that to P0. See Limitations.
When access ends, P0 clears the flag it set. P0 grants only to people who weren't administrators, so it always clears the flag when access ends, even if someone else set it by hand during the grant.
Harbor lets only a system administrator change another user's administrator flag, from 2.13.6, 2.14.5 and 2.15.3 (GHSA-w5fq-xrhj-j7g2). P0 changes it as the instance's admin account, which is one.
Access policies
In the Resource section of an access policy, Harbor is the service harbor. Its access types are project-role and system-admin.
Available filters
A rule can filter on these properties of a request, each with the key name. A system-admin request has an instance only, so a rule that filters on project or role doesn't match it.
instance
The Harbor instance's ID in P0, whichever way the requestor named it
prod
project
The project's name in Harbor
payments
Patterns are unanchored, case-sensitive regular expressions. Use ^ and $ to match a whole name.
Example access policy
These policies send requests for Limited Guest, Guest or Developer on the payments and web projects to your Security Reviewers, and deny Project Admin on every project:
System administrator gives full control of the instance, so give it its own policy. For example, to send every system-admin request on the instance prod to your Security Reviewers:
Error messages for admins
Requestors and approvers see these messages on a request when it needs an admin's attention. For the messages a requestor can fix themselves, see Troubleshooting.
The install
The Harbor connector for <instance> can't check email domains. Ask your P0 admin to check its setup.
The connector's ALLOWED_EMAIL_DOMAIN_PATTERN is unset, blank, or isn't a regular expression that compiles. Set it as in The email domain pattern. The connector's log says what's wrong with it.
The Harbor instance <instance> uses the connector <connector>, which isn't installed. Ask your P0 admin to install it.
Install a connector with that ID again, in the same place, as in Step 3: Install the connector.
P0 isn't installed on any Harbor instance yet. Ask your P0 admin to install one.
Add a Harbor instance, as in Step 4: Add the Harbor instance.
A message that starts P0 is not installed for the instance and names an instance
The request is for an instance that was removed from P0. See Remove or replace an instance.
The connector and the admin credential
P0 couldn't reach the Harbor connector. Ask your P0 admin to check its deployment.
Check that the connector's function or service exists where its hosting says, and that the connector's Terraform is applied: it gives P0 lambda:InvokeFunction on AWS, or roles/run.invoker and roles/run.viewer on Google Cloud. Check the connector's logs.
The Harbor connector couldn't read the instance's admin credential. Ask your P0 admin to check the Harbor install.
Check the secret's name, and its account and region or project, on the instance's page in P0. Check that the secret holds the admin credential's JSON, and that the instance's Terraform is applied. The connector's log records why the read failed.
A person's Harbor user or role
More than one Harbor user on <instance> has the email <email>. Ask a Harbor admin to remove the duplicate.
Two Harbor users have emails that differ only in capitalization. A Harbor admin removes or changes one.
P0 manages more than one role for you on <project>. Revoke your other requests for it and try again.
Two requests for the same person and project are open at once. Revoke all but one.
A message that contains holds role id <id> on project <project> on <host>, which isn't one of Harbor's project roles
The person's membership has a role that isn't one of Harbor's five. A Harbor admin sets their role on the project's Members tab. For a revoke, then click Retry revoke.
P0 got an invalid Harbor user id for <email> from <instance>. Contact P0 support. or P0 got an invalid role on <project> from the Harbor instance <instance>. Contact P0 support.
Contact P0 at support@p0.dev with the message.
P0 didn't record the role the Harbor user <user-id> held on <project> (instance <instance>) before this grant, so it won't change their role. A Harbor admin has to restore that role, or remove them from the project, by hand.
In Harbor, set the person's role on the project to what it should be, or remove them from the project. Retry revoke fails the same way for this message, so contact P0 at support@p0.dev to close the request.
When P0 can't revoke a role, the request shows as errored, and the role stays in place in Harbor. Except for the last row, fix the cause, then click Retry revoke on the request's page.
The admin account
The first three come from requests for either access, when the connector can't sign in as the instance's admin account. On a system administrator revoke, the message ends Until then, <email> stays a Harbor system administrator.: the person keeps the access until you fix the cause and click Retry revoke.
The Harbor admin account P0 uses on <instance> has to be signed in again: its identity provider no longer accepts its stored sign-in. Ask your P0 admin to sign the admin account in again and store its new refresh token in the admin credential's secret.
Get a new refresh token and store it, as in Sign the admin account in again.
Harbor on <instance> didn't accept the sign-in of the admin account P0 uses. Ask your P0 admin to check the instance's admin credential.
Check that clientId in the admin credential is Harbor's OIDC client ID, and that the admin account has signed in to Harbor and still exists there.
The admin account P0 uses on <instance> isn't a Harbor system administrator, so it can't change anyone's. Ask your P0 admin to make it one on Harbor's Users page.
In Harbor, under Administration, Users, set the admin account as an administrator. Membership of your identity provider's admin group isn't enough.
A message that starts The identity provider at <provider> rejected the client ID and secret in the Harbor admin credential's secret for <host>, followed by (invalid_client) or (unauthorized_client)
The client secret in the admin credential was revoked or rotated, or the client ID is wrong. Put a current secret of Harbor's OIDC client in the credential, as in Change the client secret. The refresh token keeps working, so you don't sign the admin account in again. This message comes from requests for either access. A system administrator revoke that fails with it leaves the person a system administrator until you fix it and click Retry revoke.
P0 didn't record whether the Harbor user <user-id> was a system administrator on <instance> before this grant, so it won't change their system administrator flag. A Harbor admin has to clear it by hand, if they weren't one before.
In Harbor, clear the person's administrator flag if they weren't an administrator before. Retry revoke fails the same way, so contact P0 at support@p0.dev to close the request.
P0 got an invalid system administrator state from the Harbor instance <instance>. Contact P0 support.
Contact P0 at support@p0.dev with the message.
Limitations
P0 grants roles only to Harbor users that already exist, and never creates one. A person has no Harbor user until they've signed in to Harbor once.
P0 matches people by email only. A Harbor user with no email, or with a different email from the person's P0 email, can't receive access.
P0 changes direct project membership only. A role that a person has through a group stays as it is, and P0 doesn't count it when it checks what the person already holds.
A Harbor user can have one open request per project at a time, whoever made it.
Harbor's audit log doesn't record project member changes, so P0's request history is the record of who was granted which role and when.
Removing a Harbor instance from P0 leaves the access P0 granted on it in place in Harbor, and P0 can't revoke it while the instance isn't installed. See Remove or replace an instance.
The instance must be reachable over the public internet at an
httpsaddress, with a certificate from a public certificate authority. Instances with a private or self-signed certificate aren't supported.The connector runs on AWS Lambda or Google Cloud Run, and reads each instance's secret from the secret manager of the same cloud.
Harbor must sign people in through OIDC. LDAP and database sign-in aren't supported.
P0 can't see administrators who get the role only through your identity provider's Harbor admin group. Harbor reports that only for the user who is signed in, and its user list always says no. So P0 doesn't refuse their request, and grants them the flag. When access ends, P0 clears the flag, and they stay administrators through the group.
Last updated