Deployment Guide
Installing and configuring the Trusted Artifact Signer service for Red Hat platforms
Abstract
Preface Copy linkLink copied to clipboard!
Welcome to the Red Hat Trusted Artifact Signer Deployment Guide.
These procedures can help guide you on deploying the full Trusted Artifact Signer (RHTAS) software stack, and verifying that deployment. Content organized by your installation platform:
You can view the official RHTAS Release Notes here.
Chapter 1. Red Hat OpenShift Container Platform Copy linkLink copied to clipboard!
1.1. Resource recommendations for deploying on OpenShift Copy linkLink copied to clipboard!
Understanding how to size the infrastructure resources before deploying Red Hat Trusted Artifact Signer (RHTAS) on Red Hat OpenShift is important for optimizing your workloads. The key infrastructure piece for consideration is the number of CPUs and the memory available for the Trillian database. As the number of signing and verifying requests increases, this adds more load to the CPU, and increases the memory usage of the Trillian database.
You have two options for implementing the Trillian database used with RHTAS: a dedicated database, or a managed database. Red Hat recommends a dedicated database for production workloads, and a managed database for non-production workloads. Here are the baseline CPU and memory resources you can start with.
- Dedicated
- 2 CPU cores
- 1 GB of RAM
- 5 GB of storage
- Managed
- 4 CPU cores
- 2 GB of RAM
- 10 GB of storage
1.2. Installing Trusted Artifact Signer using the Operator Lifecycle Manager Copy linkLink copied to clipboard!
You can install the Red Hat Trusted Artifact Signer (RHTAS) Operator, and deploy the RHTAS service by using OpenShift’s Operator Lifecycle Manager (OLM). This deployment gives you a basic signing framework with your choice of an OpenID Connect (OIDC) provider. You must configure at least one of the following OIDC providers: Red Hat Single Sign-on (SSO), Google, Amazon Secure Token Service (STS), or GitHub. You can also optionally customize your database solution, if you do not want to use the default.
Prerequisites
- Red Hat OpenShift Container Platform 4.15 or later.
-
Access to the OpenShift web console with the
cluster-admin
role. - An OIDC provider configured for signing artifacts.
-
A workstation with the
oc
binary installed.
Procedure
-
Log in to the OpenShift web console with a user that has the
cluster-admin
role. - From the Administrator perspective, expand the Operators navigation menu, and click OperatorHub.
- In the search field, type trusted, and click the Red Hat Trusted Artifact Signer tile.
- Click the Install button to show the operator details.
Accept the default values, click Install on the Install Operator page, and wait for the installation to finish.
ImportantOnce the installation finishes, a new project is automatically created for you. The new project name is
trusted-artifact-signer
.NoteThe Trusted Artifact Signer operator installs into the
openshift-operators
namespace, and all dependencies are automatically installed.- Optional. Instead of the default database, you can use an alternative database provider for the Trusted Artifact Signer service. If you want to use Amazon’s Relational Database Service (RDS), or a self-managed database on OpenShift, then follow one of those procedures first before continuing on with this installation. Once done configuring one of these other database providers, you can continue onto the next step of this procedure.
To deploy the Trusted Artifact Signer service.
- Within the OpenShift web console, expand Operators from the navigation menu, click Installed Operators.
-
Select
trusted-artifact-signer
from the project drop-down box. - Click Red Hat Trusted Artifact Signer.
- Click the Securesign tab, and click the Create Securesign button.
- On the Create Securesign page, select YAML view.
You can configure different OIDC providers, such as, Red Hat build of Keycloak, Google OAuth, Amazon STS, Microsoft’s Entra ID or GitHub OAuth as the initial OIDC provider for this deployment. Under the
spec.fulcio.config.OIDCIssuers
section, edit the following three lines with the OIDC provider URL, and set theClientID
appropriately.Copy to Clipboard Copied! Toggle word wrap Toggle overflow ImportantYou can define several different OIDC providers in the same configuration.
Optional. If you chosen to use a different database other than the default, then under the
spec.trillian
section, setcreate
tofalse
, and give the name of the database secret object.Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Click the Create button.
Click All instances tab to watch the deployment status until the CTlog, Fulcio, Rekor, Trillian, and TUF instances are ready.
NoteThe Securesign instance does not give a status.
- You can check on the health of the new Trusted Artifact Signer service by using Prometheus in the OpenShift console. From the navigation menu, expand Observe, and click Dashboards.
- Verify the installation by signing a container image, or a Git commit.
1.3. Verify the Trusted Artifact Signer installation Copy linkLink copied to clipboard!
As as systems administrator, you can verify if the deployment of Red Hat Trusted Artifact Signer (RHTAS) running on Red Hat OpenShift Container Platform was successful.
You can sign a test container image, and verify the authenticity of that signature to validate the deployment of RHTAS in your environment.
There are two ways to sign and three ways to verify build artifacts from your code pipeline. You can sign and verify with cosign
and gitsign
, but can only verify with Enterprise Contract.
1.3.1. Signing and verifying containers by using Cosign from the command-line interface Copy linkLink copied to clipboard!
The cosign
tool gives you the capability to sign and verify Open Container Initiative (OCI) container images, along with other build artifacts by using Red Hat’s Trusted Artifact Signer (RHTAS) service.
For RHTAS, you must use cosign
version 2.2 or later.
Prerequisites
- Installation of RHTAS running on Red Hat OpenShift Container Platform 4.15 or later.
- Access to the OpenShift web console.
-
A workstation with the
oc
, andpodman
binaries installed.
Procedure
Download the
cosign
binary from the OpenShift cluster to your workstation.- Login to the OpenShift web console. From the home page, click the ? icon, click Command line tools, go to the cosign download section, and click the link for your platform.
Open a terminal on your workstation, decompress the binary
.gz
file, and set the execution bit:gunzip cosign-amd64.gz chmod +x cosign-amd64
$ gunzip cosign-amd64.gz $ chmod +x cosign-amd64
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Move and rename the binary to a location within your
$PATH
environment:sudo mv cosign-amd64 /usr/local/bin/cosign
$ sudo mv cosign-amd64 /usr/local/bin/cosign
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Log in to the OpenShift cluster:
oc login --token=TOKEN --server=SERVER_URL_AND_PORT
oc login --token=TOKEN --server=SERVER_URL_AND_PORT
Copy to Clipboard Copied! Toggle word wrap Toggle overflow oc login --token=sha256~ZvFDBvoIYAbVECixS4-WmkN4RfnNd8Neh3y1WuiFPXC --server=https://example.com:6443
$ oc login --token=sha256~ZvFDBvoIYAbVECixS4-WmkN4RfnNd8Neh3y1WuiFPXC --server=https://example.com:6443
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteYou can find your login token and URL to use on the command line from the OpenShift web console. Log in to the OpenShift web console. Click your user name, and click Copy login command. Offer your user name and password again, if asked, and click Display Token to view the command.
Switch to the RHTAS project:
oc project PROJECT_NAME
oc project PROJECT_NAME
Copy to Clipboard Copied! Toggle word wrap Toggle overflow oc project trusted-artifact-signer
$ oc project trusted-artifact-signer
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteUse the project name for the RHTAS installation.
Configure your shell environment for doing container image signing and verifying.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteIf you are using the Ingress Operator to auto-generate route names, then you must update the
oc get route …
command by replacingkeycloak
with the auto-generated route name.Initialize The Update Framework (TUF) system:
cosign initialize
$ cosign initialize
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Sign a test container image.
Create an empty container image:
echo "FROM scratch" > ./tmp.Dockerfile podman build . -f ./tmp.Dockerfile -t ttl.sh/rhtas/test-image:1h
$ echo "FROM scratch" > ./tmp.Dockerfile $ podman build . -f ./tmp.Dockerfile -t ttl.sh/rhtas/test-image:1h
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Push the empty container image to the
ttl.sh
ephemeral registry:podman push ttl.sh/rhtas/test-image:1h
$ podman push ttl.sh/rhtas/test-image:1h
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Sign the container image:
cosign sign -y IMAGE_NAME:TAG
cosign sign -y IMAGE_NAME:TAG
Copy to Clipboard Copied! Toggle word wrap Toggle overflow cosign sign -y ttl.sh/rhtas/test-image:1h
$ cosign sign -y ttl.sh/rhtas/test-image:1h
Copy to Clipboard Copied! Toggle word wrap Toggle overflow A web browser opens allowing you to sign the container image with an email address.
Remove the temporary Docker file:
rm ./tmp.Dockerfile
$ rm ./tmp.Dockerfile
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verify a signed container image by using a certificate identity and issuer:
cosign verify --certificate-identity=SIGNING_EMAIL_ADDR IMAGE_NAME:TAG
cosign verify --certificate-identity=SIGNING_EMAIL_ADDR IMAGE_NAME:TAG
Copy to Clipboard Copied! Toggle word wrap Toggle overflow cosign verify --certificate-identity=jdoe@redhat.com ttl.sh/rhtas/test-image:1h
$ cosign verify --certificate-identity=jdoe@redhat.com ttl.sh/rhtas/test-image:1h
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteYou can also use regular expressions for the certificate identity and issuer by using the following options to the
cosign
command,--certificate-identity-regexp
and--certificate-oidc-issuer-regexp
.Download the
rekor-cli
binary from the OpenShift cluster to your workstation.- Login to the OpenShift web console. From the home page, click the ? icon, click Command line tools, go to the rekor-cli download section, and click the link for your platform.
Open a terminal on your workstation, decompress the binary
.gz
file, and set the execution bit:gunzip rekor-cli-amd64.gz chmod +x rekor-cli-amd64
$ gunzip rekor-cli-amd64.gz $ chmod +x rekor-cli-amd64
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Move and rename the binary to a location within your
$PATH
environment:sudo mv rekor-cli-amd64 /usr/local/bin/rekor-cli
$ sudo mv rekor-cli-amd64 /usr/local/bin/rekor-cli
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Query the transparency log by using the Rekor command-line interface.
Search based on the log index:
rekor-cli get --log-index 0 --rekor_server $COSIGN_REKOR_URL --format json | jq
$ rekor-cli get --log-index 0 --rekor_server $COSIGN_REKOR_URL --format json | jq
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Search for an email address to get the universal unique identifier (UUID):
rekor-cli search --email SIGNING_EMAIL_ADDR --rekor_server $COSIGN_REKOR_URL --format json | jq
rekor-cli search --email SIGNING_EMAIL_ADDR --rekor_server $COSIGN_REKOR_URL --format json | jq
Copy to Clipboard Copied! Toggle word wrap Toggle overflow rekor-cli search --email jdoe@redhat.com --rekor_server $COSIGN_REKOR_URL --format json | jq
$ rekor-cli search --email jdoe@redhat.com --rekor_server $COSIGN_REKOR_URL --format json | jq
Copy to Clipboard Copied! Toggle word wrap Toggle overflow This command returns the UUID for use with the next step.
Use the UUID to get the transaction details:
rekor-cli get --uuid UUID --rekor_server $COSIGN_REKOR_URL --format json | jq
rekor-cli get --uuid UUID --rekor_server $COSIGN_REKOR_URL --format json | jq
Copy to Clipboard Copied! Toggle word wrap Toggle overflow rekor-cli get --uuid 24296fb24b8ad77a71b9c1374e207537bafdd75b4f591dcee10f3f697f150d7cc5d0b725eea641e7 --rekor_server $COSIGN_REKOR_URL --format json | jq
$ rekor-cli get --uuid 24296fb24b8ad77a71b9c1374e207537bafdd75b4f591dcee10f3f697f150d7cc5d0b725eea641e7 --rekor_server $COSIGN_REKOR_URL --format json | jq
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
1.3.2. Signing and verifying commits by using Gitsign from the command-line interface Copy linkLink copied to clipboard!
The gitsign
tool gives you the ability to sign and verify Git repository commits by using Red Hat’s Trusted Artifact Signer (RHTAS) service.
Prerequisites
- A RHTAS installation on Red Hat OpenShift Container Platform 4.15 or later.
- Access to the OpenShift web console.
A workstation with the
oc
,git
, andcosign
binaries installed.-
You must use
cosign
version 2.2 or later.
-
You must use
- A locally cloned Git repository.
Procedure
Download the
gitsign
binary from the OpenShift cluster to your workstation.- Login to the OpenShift web console. From the home page, click the ? icon, click Command line tools, go to the gitsign download section, and click the link for your platform.
Open a terminal on your workstation, decompress the .gz file, and set the execution bit:
gunzip gitsign-amd64.gz chmod +x gitsign-amd64
$ gunzip gitsign-amd64.gz $ chmod +x gitsign-amd64
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Move and rename the binary to a location within your
$PATH
environment:sudo mv gitsign-amd64 /usr/local/bin/gitsign
$ sudo mv gitsign-amd64 /usr/local/bin/gitsign
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Log in to the OpenShift cluster:
oc login --token=TOKEN --server=SERVER_URL_AND_PORT
oc login --token=TOKEN --server=SERVER_URL_AND_PORT
Copy to Clipboard Copied! Toggle word wrap Toggle overflow oc login --token=sha256~ZvFDBvoIYAbVECixS4-WmkN4RfnNd8Neh3y1WuiFPXC --server=https://example.com:6443
$ oc login --token=sha256~ZvFDBvoIYAbVECixS4-WmkN4RfnNd8Neh3y1WuiFPXC --server=https://example.com:6443
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteYou can find your login token and URL to use on the command line from the OpenShift web console. Log in to the OpenShift web console. Click your user name, and click Copy login command. Offer your user name and password again, if asked, and click Display Token to view the command.
Switch to the RHTAS project:
oc project PROJECT_NAME
oc project PROJECT_NAME
Copy to Clipboard Copied! Toggle word wrap Toggle overflow oc project trusted-artifact-signer
$ oc project trusted-artifact-signer
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteUse the project name for the RHTAS installation.
Configure your shell environment for doing commit signing and verifying:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Change directory (
cd
) to the local Git repository directory. Configure the local repository configuration to sign your commits by using the RHTAS service:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Make a commit to the local repository:
git commit --allow-empty -S -m "Test of a signed commit"
$ git commit --allow-empty -S -m "Test of a signed commit"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow A web browser opens allowing you to sign the commit with an email address.
Initialize The Update Framework (TUF) system:
cosign initialize
$ cosign initialize
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify the commit:
gitsign verify --certificate-identity=SIGNING_EMAIL --certificate-oidc-issuer=$SIGSTORE_OIDC_ISSUER HEAD
gitsign verify --certificate-identity=SIGNING_EMAIL --certificate-oidc-issuer=$SIGSTORE_OIDC_ISSUER HEAD
Copy to Clipboard Copied! Toggle word wrap Toggle overflow gitsign verify --certificate-identity=jdoe@redhat.com --certificate-oidc-issuer=$SIGSTORE_OIDC_ISSUER HEAD
$ gitsign verify --certificate-identity=jdoe@redhat.com --certificate-oidc-issuer=$SIGSTORE_OIDC_ISSUER HEAD
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
1.3.3. Verifying signatures on container images with Conforma Copy linkLink copied to clipboard!
Conforma, formally known as Enterprise Contract (EC), is a tool for maintaining the security of software supply chains, and you can use it to define and enforce policies for container images. You can use the ec
binary to verify the attestation and signature of container images that use Red Hat’s Trusted Artifact Signer (RHTAS) signing framework.
Prerequisites
- A RHTAS installation on Red Hat OpenShift Container Platform 4.15 or later.
- Access to the OpenShift web console.
A workstation with the
oc
,cosign
, andpodman
binaries installed.-
You must use
cosign
version 2.2 or later.
-
You must use
Procedure
Download the
ec
binary from the OpenShift cluster.- Log in to the OpenShift web console. From the home page, click the ? icon, click Command line tools, go to the ec download section, then click the link for your platform.
Open a terminal on your workstation, decompress the binary .gz file, and set the execution bit:
gunzip ec-amd64.gz chmod +x ec-amd64
$ gunzip ec-amd64.gz $ chmod +x ec-amd64
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Move and rename the binary to a location within your
$PATH
environment:sudo mv ec-amd64 /usr/local/bin/ec
$ sudo mv ec-amd64 /usr/local/bin/ec
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Log in to the OpenShift cluster:
oc login --token=TOKEN --server=SERVER_URL_AND_PORT
oc login --token=TOKEN --server=SERVER_URL_AND_PORT
Copy to Clipboard Copied! Toggle word wrap Toggle overflow oc login --token=sha256~ZvFDBvoIYAbVECixS4-WmkN4RfnNd8Neh3y1WuiFPXC --server=https://example.com:6443
$ oc login --token=sha256~ZvFDBvoIYAbVECixS4-WmkN4RfnNd8Neh3y1WuiFPXC --server=https://example.com:6443
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteYou can find your login token and URL to use on the command line from the OpenShift web console. Log in to the OpenShift web console. Click your user name, and click Copy login command. Offer your user name and password again, if asked, and click Display Token to view the command.
Switch to the RHTAS project:
oc project PROJECT_NAME
oc project PROJECT_NAME
Copy to Clipboard Copied! Toggle word wrap Toggle overflow oc project trusted-artifact-signer
$ oc project trusted-artifact-signer
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteUse the project name for the RHTAS installation.
Configure your shell environment for doing container image signing and verifying.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Initialize The Update Framework (TUF) system:
cosign initialize
$ cosign initialize
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Sign a test container image.
Create an empty container image:
echo "FROM scratch" > ./tmp.Dockerfile podman build . -f ./tmp.Dockerfile -t ttl.sh/rhtas/test-image:1h
$ echo "FROM scratch" > ./tmp.Dockerfile $ podman build . -f ./tmp.Dockerfile -t ttl.sh/rhtas/test-image:1h
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Push the empty container image to the
ttl.sh
ephemeral registry:podman push ttl.sh/rhtas/test-image:1h
$ podman push ttl.sh/rhtas/test-image:1h
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Sign the container image:
cosign sign -y IMAGE_NAME:TAG
cosign sign -y IMAGE_NAME:TAG
Copy to Clipboard Copied! Toggle word wrap Toggle overflow cosign sign -y ttl.sh/rhtas/test-image:1h
$ cosign sign -y ttl.sh/rhtas/test-image:1h
Copy to Clipboard Copied! Toggle word wrap Toggle overflow A web browser opens allowing you to sign the container image with an email address.
Remove the temporary Docker file:
rm ./tmp.Dockerfile
$ rm ./tmp.Dockerfile
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Create a
predicate.json
file:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Refer to the SLSA provenance predicate specifications for more information about the schema layout.
Associate the
predicate.json
file with the container image:cosign attest -y --predicate ./predicate.json --type slsaprovenance IMAGE_NAME:TAG
cosign attest -y --predicate ./predicate.json --type slsaprovenance IMAGE_NAME:TAG
Copy to Clipboard Copied! Toggle word wrap Toggle overflow cosign attest -y --predicate ./predicate.json --type slsaprovenance ttl.sh/rhtas/test-image:1h
$ cosign attest -y --predicate ./predicate.json --type slsaprovenance ttl.sh/rhtas/test-image:1h
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify that the container image has at least one attestation and signature:
cosign tree IMAGE_NAME:TAG
cosign tree IMAGE_NAME:TAG
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify the container image by using Conforma:
ec validate image --image IMAGE_NAME:TAG --certificate-identity-regexp 'SIGNER_EMAIL_ADDR' --certificate-oidc-issuer-regexp 'keycloak-system' --output yaml --show-successes
ec validate image --image IMAGE_NAME:TAG --certificate-identity-regexp 'SIGNER_EMAIL_ADDR' --certificate-oidc-issuer-regexp 'keycloak-system' --output yaml --show-successes
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Copy to Clipboard Copied! Toggle word wrap Toggle overflow Enterprise Contract generates a pass-fail report with details on any security violations. When you add the
--info
flag, the report includes more details and possible solutions for any violations found.
1.4. Configure additional OpenID Connect providers Copy linkLink copied to clipboard!
As as systems administrator, you can configure many different OpenID Connect (OIDC) providers for use with Red Hat’s Trusted Artifact Signer service. You can configure the following OIDC providers for authenticating users:
- Red Hat build of Keycloak
- Red Hat Single Sign-on (SSO)
- Amazon Security Token Service (STS)
- Microsoft Entra ID
- GitHub
1.4.1. Configuring Google as an OpenID Connect provider for Trusted Artifact Signer Copy linkLink copied to clipboard!
You can use Google OAuth 2.0 as your OpenID Connect (OIDC) provider for Red Hat’s Trusted Artifact Signer (RHTAS) service. You can decide to configure Google OAuth during the deployment of RHTAS, or at a later time.
You can define several different OIDC providers in the same configuration.
Prerequisites
- Red Hat OpenShift Container Platform 4.15 or later.
-
Access to the OpenShift web console with the
cluster-admin
role. -
A workstation with the
oc
, andpodman
binaries installed. From the Google Cloud Console, create an OAuth client ID with the following settings:
- Set the application type to “Web Application”.
- Authorized redirect URIs must include: http://localhost/auth/callback .
Procedure
Open a terminal on your workstation, and log in to OpenShift:
oc login --token=TOKEN --server=SERVER_URL_AND_PORT
oc login --token=TOKEN --server=SERVER_URL_AND_PORT
Copy to Clipboard Copied! Toggle word wrap Toggle overflow oc login --token=sha256~ZvFDBvoIYAbVECixS4-WmkN4RfnNd8Neh3y1WuiFPXC --server=https://example.com:6443
$ oc login --token=sha256~ZvFDBvoIYAbVECixS4-WmkN4RfnNd8Neh3y1WuiFPXC --server=https://example.com:6443
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteYou can find your login token and URL for use on the command line from the OpenShift web console. Log in to the OpenShift web console. Click your user name, and click Copy login command. Offer your user name and password again, if asked, and click Display Token to view the command.
Update the RHTAS configuration.
Open for editing the
Securesign
resource:oc edit Securesign NAME -n NAMESPACE
oc edit Securesign NAME -n NAMESPACE
Copy to Clipboard Copied! Toggle word wrap Toggle overflow oc edit Securesign securesign-sample -n trusted-artifact-signer
$ oc edit Securesign securesign-sample -n trusted-artifact-signer
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteYou must use the project name created for the RHTAS installation as the namespace.
Under the
OIDCIssuers
section, add a new subsection with your Google client identifier, issuer’s URL, and set theType
value toemail
:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add you Google client identifier to the
ClientID
field.- Save your changes, and quit the editor. After a few seconds the operator automatically reconfigures the RHTAS software stack.
Change the OIDC issuer, and client id environment variables to use Google:
export OIDC_ISSUER_URL=https://accounts.google.com export COSIGN_OIDC_CLIENT_ID="314919563931-35zke44ouf2oiztjg7v8o8c2ge9usnd1.apps.googleexample.com"
$ export OIDC_ISSUER_URL=https://accounts.google.com $ export COSIGN_OIDC_CLIENT_ID="314919563931-35zke44ouf2oiztjg7v8o8c2ge9usnd1.apps.googleexample.com"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Copy and paste your secret from the Google Console to a plain text file:
echo SECRET > my-google-client-secret
echo SECRET > my-google-client-secret
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If you already have the RHTAS service running, you can verify the updated configuration by signing a test container image.
Create an empty container image:
echo "FROM scratch" > ./tmp.Dockerfile podman build . -f ./tmp.Dockerfile -t ttl.sh/rhtas/test-image:1h
$ echo "FROM scratch" > ./tmp.Dockerfile $ podman build . -f ./tmp.Dockerfile -t ttl.sh/rhtas/test-image:1h
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Push the empty container image to the
ttl.sh
ephemeral registry:podman push ttl.sh/rhtas/test-image:1h
$ podman push ttl.sh/rhtas/test-image:1h
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Remove the temporary Docker file:
rm ./tmp.Dockerfile
$ rm ./tmp.Dockerfile
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Sign the container image:
cosign sign -y --oidc-client-secret-file=SECRET_FILE IMAGE_NAME:TAG
cosign sign -y --oidc-client-secret-file=SECRET_FILE IMAGE_NAME:TAG
Copy to Clipboard Copied! Toggle word wrap Toggle overflow cosign sign -y --oidc-client-secret-file=my-google-client-secret ttl.sh/rhtas/test-image:1h
$ cosign sign -y --oidc-client-secret-file=my-google-client-secret ttl.sh/rhtas/test-image:1h
Copy to Clipboard Copied! Toggle word wrap Toggle overflow A web browser opens allowing you to sign the container image with an email address.
1.4.2. Configuring Red Hat SSO as an OpenID Connect provider for Trusted Artifact Signer Copy linkLink copied to clipboard!
You can use Red Hat Single Sign-On (SSO) as your OpenID Connect provider for Red Hat’s Trusted Artifact Signer (RHTAS) service. This gives you a Keycloak authentication environment for applications and secure services.
Prerequisites
- Red Hat OpenShift Container Platform 4.15 or later.
-
Access to the OpenShift web console with the
cluster-admin
role. - Have 1 GB of container storage available for the Keycloak PostgreSQL database.
-
A workstation with the
oc
binary installed.
Procedure
-
Log in to the OpenShift web console with a user that has the
cluster-admin
role. Create a new project to deploy the Keycloak service.
- From the Administrator perspective, expand Home from the navigation menu, and click Projects.
- Click the Create Project button.
-
The new project name is
keycloak-system
, and click the Create button.
- Expand Operators from the navigation menu, and click OperatorHub.
- In the search field, type sso, and click the Red Hat Single Sign-on tile.
- Click the Install button to show the operator details.
-
If not already set, select
keycloak-system
from the Installed Namespace drop-down menu. - Click Install on the Install Operator page, and wait for the installation to finish.
- After the installation finishes, click View Operator.
From your workstation terminal, log in to the OpenShift cluster:
oc login --token=TOKEN --server=SERVER_URL_AND_PORT
oc login --token=TOKEN --server=SERVER_URL_AND_PORT
Copy to Clipboard Copied! Toggle word wrap Toggle overflow oc login --token=sha256~ZvFDBvoIYAbVECixS4-WmkN4RfnNd8Neh3y1WuiFPXC --server=https://example.com:6443
$ oc login --token=sha256~ZvFDBvoIYAbVECixS4-WmkN4RfnNd8Neh3y1WuiFPXC --server=https://example.com:6443
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteYou can find your login token and URL to use on the command line from the OpenShift web console. Log in to the OpenShift web console. Click your user name, and click Copy login command. Offer your user name and password again, if asked, and click Display Token to view the command.
Switch to the Keycloak project:
oc project keycloak-system
$ oc project keycloak-system
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a Keycloak instance:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a Keycloak realm:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a Keycloak client:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a Keycloak user:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set a user name, the user’s email address, and a password or reference a secret object.
- Go back to the OpenShift web console, click the All instances tab to watch and wait until the Keycloak system initializes successfully.
1.4.3. Configuring Red Hat build of Keycloak as an OpenID Connect provider for Trusted Artifact Signer Copy linkLink copied to clipboard!
You can configure Red Hat’s build of Keycloak (RHBK) as an OpenID Connect (OIDC) provider for Red Hat’s Trusted Artifact Signer (RHTAS) service. This procedure guides you on integrating RHBK with RHTAS.
You can define several different OIDC providers for Fulcio in the same SecureSign configuration.
Prerequisites
- A RHTAS installation on OpenShift Container Platform 4.15 or later.
-
Access to the OpenShift web console with the
cluster-admin
role. -
A workstation with the
oc
binary installed. - Have 1 GB of persistent storage available for the Keycloak PostgreSQL database.
- A TLS certificate and key.
Procedure
-
Log in to the OpenShift web console with a user that has the
cluster-admin
role. Create a new project to deploy the Keycloak service.
- From the Administrator perspective, expand Home from the navigation menu, and click Projects.
- Click the Create Project button.
-
The new project name is
keycloak-system
, and click the Create button.
Deploy an instance of PostgreSQL for use by Keycloak to store persistent data.
ImportantIf a database already exists for use by Keycloak, replace the
username
,password
anddatabase
name values for theSecret
resource that corresponds with your database instance. You can skip the creation of the PostgreSQL Service and StatefulSet steps, and move ahead to the next step.Create a
Secret
resource to store the database information.- Expand Workloads from the navigation menu, and click Secrets.
-
Select the
keycloak-system
from the Project drop-down menu. - Click the Create drop-down menu, and select Key/Value secret.
-
Enter
postgresql-db
in the Secret name field. -
Enter
username
in the Key field. -
Enter
keycloak
in the free-form field for the Value. This is the user name Keycloak uses to authenticate to the PostgreSQL database instance. - Click the Add key/value link to add another key-value pair.
-
Enter
password
in the Key field. - Enter a password of your choice in the free-form field for the Value. This is the password Keycloak uses to authenticate to the PostgreSQL database instance.
- Click the Add key/value link to add another key-value pair.
-
Enter
database
in the Key field. -
Enter
keycloak
in the free-form field for the Value. This is the name of the database for storing Keycloak data within the PostgreSQL database instance. - Click the Create button.
Create the PostgreSQL Service and StatefulSet.
- Click the + icon.
- Copy the Service and StatefulSet YAML configuration text, and on the Import YAML page, paste the text into the text editor box.
-
Click the Create button to add the Service and StatefulSet to the
keycloak-system
project.
- Expand Operators from the navigation menu, and click OperatorHub.
- In the search field, type keycloak, and click the Red Hat build of Keycloak Operator tile from the certified Red Hat catalog.
- Click the Install button to show the operator details.
-
On the Install Operator page, select
keycloak-system
from the Installed Namespace drop-down menu, and click the Install button. Wait for the installation to finish. Open a terminal from your workstation, and log in to the OpenShift cluster:
oc login --token=TOKEN --server=SERVER_URL_AND_PORT
oc login --token=TOKEN --server=SERVER_URL_AND_PORT
Copy to Clipboard Copied! Toggle word wrap Toggle overflow oc login --token=sha256~ZvFDBvoIYAbVECixS4-WmkN4RfnNd8Neh3y1WuiFPXC --server=https://example.com:6443
$ oc login --token=sha256~ZvFDBvoIYAbVECixS4-WmkN4RfnNd8Neh3y1WuiFPXC --server=https://example.com:6443
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteYou can find your login token and URL to use on the command line from the OpenShift web console. Log in to the OpenShift web console. Click your user name, and click Copy login command. Offer your user name and password again, if asked, and click Display Token to view the command.
Create a new
Secret
resource to contain the Transport Layer Security (TLS) certificate and the corresponding private key:oc create secret tls SECRET_NAME -n NAMESPACE --cert CERTIFICATE_FILE_NAME --key PRIVATE_KEY_FILE_NAME
oc create secret tls SECRET_NAME -n NAMESPACE --cert CERTIFICATE_FILE_NAME --key PRIVATE_KEY_FILE_NAME
Copy to Clipboard Copied! Toggle word wrap Toggle overflow oc create secret tls keycloak-tls -n keycloak-system --cert certificate.pem --key key.pem
$ oc create secret tls keycloak-tls -n keycloak-system --cert certificate.pem --key key.pem
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteThe OpenShift’s service serving certificate can automate the generation and management of a TLS certificates for use by Keycloak. See Configuring OpenShift service serving certificates to generate TLS certificates for Keycloak for more information.
- In OpenShift web console, after the installation finishes, click the View Operator button.
- Click Create instance on the Keycloak tile.
On the Create Keycloak page, select YAML view.
-
On the
name
line, replaceexample-keycloak
with your custom name, for example,keycloak
. The hostname can either be explicitly specified within the
hostname
property or automatically generated similar to other routes. On thehostname
line, replaceexample.org
with your custom hostname.NoteSee Generating Keycloak host names automatically for the steps necessary to have OpenShift generate the hostname for the Keycloak instance.
Under the
spec
section, add your database details:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Also, under the
spec
section, for thehttp
property, specify the name of theSecret
resource containing the TLS certificates.spec: ... http: tlsSecret: keycloak-tls ...
spec: ... http: tlsSecret: keycloak-tls ...
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Click the Create button.
-
On the
- Expand the Networking navigation menu, and click Routes.
- To open the Keycloak Administration Console, click the link to the route associated with the Keycloak instance.
-
The default credentials for the
admin
user are stored in a Secret called keycloak-initial-admin. To locate the password, expand the Workloads navigation menu, and click Secrets. - Select the keycloak-initial-admin Secret.
- Under the Data section, locate the password key, and click the copy icon.
-
On the Keycloak Administration Console log in page, enter
temp-admin
as the username, and paste the contents of the previous step as the password. Create a new realm called
trusted-artifact-signer
.- On the navigation menu, select the Red Hat Build of Keycloak drop-down menu.
- Select Create Realm.
-
Enter
trusted-artifact-signer
as the Resource name. - Click Create to create the new realm.
Create a new client.
- On the navigation menu, under the Manage section, and select Clients.
- Click the Create Client button
-
In the Client Id field, enter
trusted-artifact-signer
. - Optionally, you can enter a Name and Description into the corresponding fields.
- Click Next.
- Accept the default options for the Capability Config step of the new client creation process.
- Click Next.
-
In the Valid redirect URIs field, enter
*
. - Click Save to create the client.
-
On the navigation menu, under the Configure section, select Realm Settings to locate the Issuer URL for the
trusted-artifact-signer
realm. - Next to Endpoints, click the OpenID Endpoint Configuration link.
-
Copy the URL from the
issuer
property. Under the
.spec.fulcio.config.OIDCIssuers
section of theSecureSign
resource for RHTAS, replace CLIENT_ID withtrusted-artifact-signer
, and paste the URL content to replace RHBK_REALM_ISSUER_URL:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Copy to Clipboard Copied! Toggle word wrap Toggle overflow
1.4.4. Configuring Amazon STS as an OpenID Connect provider for Trusted Artifact Signer Copy linkLink copied to clipboard!
You can use Amazon’s Security Token Service (STS) as your OpenID Connect (OIDC) provider for Red Hat’s Trusted Artifact Signer (RHTAS) service. You can decide to configure Amazon STS during the deployment of RHTAS, or at a later time.
You can define several different OIDC providers in the same configuration.
Prerequisites
- Red Hat OpenShift Container Platform 4.15 or later.
-
Access to the OpenShift web console with the
cluster-admin
role. -
A workstation with the
oc
,podman
, andaws
binaries installed. - Enable managed Amazon Web Service (AWS) Resources for OpenShift environments.
A created Amazon Identity and Access Management (IAM) user with full permissions. This allows access to run IAM operations.
- Created access keys for this user.
Procedure
Open a terminal on your workstation, and log in to OpenShift:
oc login --token=TOKEN --server=SERVER_URL_AND_PORT
oc login --token=TOKEN --server=SERVER_URL_AND_PORT
Copy to Clipboard Copied! Toggle word wrap Toggle overflow oc login --token=sha256~ZvFDBvoIYAbVECixS4-WmkN4RfnNd8Neh3y1WuiFPXC --server=https://example.com:6443
$ oc login --token=sha256~ZvFDBvoIYAbVECixS4-WmkN4RfnNd8Neh3y1WuiFPXC --server=https://example.com:6443
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteYou can find your login token and URL for use on the command line from the OpenShift web console. Log in to the OpenShift web console. Click your user name, and click Copy login command. Offer your user name and password again, if asked, and click Display Token to view the command.
Find the AWS OIDC provider URL:
oc get authentication cluster -o jsonpath='{.spec.serviceAccountIssuer}'
$ oc get authentication cluster -o jsonpath='{.spec.serviceAccountIssuer}'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Update RHTAS the configuration.
Open for editing the
Securesign
resource:oc edit Securesign NAME -n NAMESPACE
oc edit Securesign NAME -n NAMESPACE
Copy to Clipboard Copied! Toggle word wrap Toggle overflow oc edit Securesign securesign-sample -n trusted-artifact-signer
$ oc edit Securesign securesign-sample -n trusted-artifact-signer
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteYou must use the project name created for the RHTAS installation as the namespace.
Under the
OIDCIssuers
section, add a new subsection with your AWS STS client identifier, issuer’s URL, and set theType
value tokubernetes
:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Save your changes, and quit the editor. After a few seconds the operator automatically reconfigures the RHTAS software stack.
Configure the AWS command-line tool by entering your access key, secret key, default region, and output format:
aws configure
$ aws configure
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set the following environment variables:
export account_id=$(aws sts get-caller-identity --query "Account" --output text) export oidc_provider="$(oc get authentication cluster -o jsonpath='{.spec.serviceAccountIssuer}' | cut -d '/' -f3-)" export role_name=rhtas-sts export namespace=rhtas-sts export service_account=cosign-sts
$ export account_id=$(aws sts get-caller-identity --query "Account" --output text) $ export oidc_provider="$(oc get authentication cluster -o jsonpath='{.spec.serviceAccountIssuer}' | cut -d '/' -f3-)" $ export role_name=rhtas-sts $ export namespace=rhtas-sts $ export service_account=cosign-sts
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a Trust Policy that gets associated with newly created IAM roles:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a new IAM role for the RHTAS service by using the trust policy:
aws iam create-role --role-name rhtas-sts --assume-role-policy-document file://trust-relationship.json --description "Red Hat Trusted Artifact Signer STS Role"
$ aws iam create-role --role-name rhtas-sts --assume-role-policy-document file://trust-relationship.json --description "Red Hat Trusted Artifact Signer STS Role"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow On the OpenShift cluster with STS enabled, create a new project namespace:
oc new-project NAMESPACE
oc new-project NAMESPACE
Copy to Clipboard Copied! Toggle word wrap Toggle overflow oc new-project rhtas-sts
$ oc new-project rhtas-sts
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a service account for assuming an IAM role, and running a workload within the OpenShift project namespace.
Create the service account manifest:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Apply the service account manifest to OpenShift:
oc apply -f service_account.yaml
$ oc apply -f service_account.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Create a new deployment workload for signing container images within a image registry.
Create the deployment manifest:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Apply the deployment manifest to OpenShift:
oc apply -f deployment.yaml
$ oc apply -f deployment.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Create a test container image to sign.
Create an empty container image:
echo "FROM scratch" > ./tmp.Dockerfile podman build . -f ./tmp.Dockerfile -t ttl.sh/rhtas/test-image:1h
$ echo "FROM scratch" > ./tmp.Dockerfile $ podman build . -f ./tmp.Dockerfile -t ttl.sh/rhtas/test-image:1h
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Push the empty container image to the
ttl.sh
ephemeral registry:podman push ttl.sh/rhtas/test-image:1h
$ podman push ttl.sh/rhtas/test-image:1h
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Remove the temporary Docker file:
rm ./tmp.Dockerfile
$ rm ./tmp.Dockerfile
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Validate the configuration by signing and verifying the test container image.
Open a remote shell session within a running pod:
oc rsh -n NAMESPACE deployment/cosign-sts env IMAGE=IMAGE_NAME:TAG /bin/sh
oc rsh -n NAMESPACE deployment/cosign-sts env IMAGE=IMAGE_NAME:TAG /bin/sh
Copy to Clipboard Copied! Toggle word wrap Toggle overflow oc rsh -n rhtas-sts deployment/cosign-sts env IMAGE=ttl.sh/rhtas/test-image:1h /bin/sh
$ oc rsh -n rhtas-sts deployment/cosign-sts env IMAGE=ttl.sh/rhtas/test-image:1h /bin/sh
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Sign the container image:
cosign sign -y --identity-token=$(cat $AWS_WEB_IDENTITY_TOKEN_FILE) ttl.sh/rhtas/test-image:1h
$ cosign sign -y --identity-token=$(cat $AWS_WEB_IDENTITY_TOKEN_FILE) ttl.sh/rhtas/test-image:1h
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify the signed container image:
cosign verify --certificate-identity=https://kubernetes.io/namespaces/$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace)/serviceaccounts/cosign-sts --certificate-oidc-issuer=$COSIGN_CERTIFICATE_OIDC_ISSUER ttl.sh/rhtas/test-image:1h
$ cosign verify --certificate-identity=https://kubernetes.io/namespaces/$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace)/serviceaccounts/cosign-sts --certificate-oidc-issuer=$COSIGN_CERTIFICATE_OIDC_ISSUER ttl.sh/rhtas/test-image:1h
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
1.4.5. Configuring GitHub as an OpenID Connect provider for Trusted Artifact Signer Copy linkLink copied to clipboard!
You can use GitHub OAuth 2.0 when federating it with Red Hat’s Single Sign-On (SSO) service as an OpenID Connect (OIDC) provider for the Red Hat Trusted Artifact Signer (RHTAS) service. This procedure guides you on integrating GitHub OAuth with an existing Red Hat SSO deployment on OpenShift.
You can define several different OIDC providers in the same configuration.
Prerequisites
- Red Hat OpenShift Container Platform 4.15 or later.
- A running Red Hat SSO instance.
-
A workstation with the
oc
binary installed. Create a GitHub OAuth app, and after registering the application, make note of the client identifier and secret values.
ImportantWhen registering your new GitHub OAuth app, you must specify the Homepage URL, and the Authorization callback URL. Enter placeholder values for both of these fields, for example,
https://localhost:8080
. Later in this procedure you will modify your GitHub OAuth app with the intended values for these fields.
Procedure
Open a terminal on your workstation, and log in to OpenShift:
oc login --token=TOKEN --server=SERVER_URL_AND_PORT
oc login --token=TOKEN --server=SERVER_URL_AND_PORT
Copy to Clipboard Copied! Toggle word wrap Toggle overflow oc login --token=sha256~ZvFDBvoIYAbVECixS4-WmkN4RfnNd8Neh3y1WuiFPXC --server=https://example.com:6443
$ oc login --token=sha256~ZvFDBvoIYAbVECixS4-WmkN4RfnNd8Neh3y1WuiFPXC --server=https://example.com:6443
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteYou can find your login token and URL for use on the command line from the OpenShift web console. Log in to the OpenShift web console. Click your user name, and click Copy login command. Offer your user name and password again, if asked, and click Display Token to view the command.
Log in to the Red Hat SSO console.
Find the Red Hat SSO console URL from the command line:
oc get routes -n keycloak-system keycloak -o jsonpath='https://{.spec.host}'
$ oc get routes -n keycloak-system keycloak -o jsonpath='https://{.spec.host}'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Copy and paste the Red Hat SSO console URL into your web browser.
- Click Administration Console.
Retrieve the
admin
password from the command line:oc get secret/credential-keycloak -n keycloak-system -o jsonpath='{ .data.ADMIN_PASSWORD }' | base64 -d
$ oc get secret/credential-keycloak -n keycloak-system -o jsonpath='{ .data.ADMIN_PASSWORD }' | base64 -d
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Copy the output from this command.
-
From your web browser, log in as the
admin
user, and paste the password in the corresponding field. Click the Sign In button.
- Select your realm from the dropdown on the navigation menu.
Add the GitHub identity provider.
- From the navigational menu, click Identity Providers.
- From the Add provider… drop-down menu, select GitHub.
- Add your GitHub OAuth client identifier to the Client ID field.
- Add your GitHub OAuth client secret to the Client Secret field.
- Turn on the Trust Email option.
- Click the Save button.
Add the identity provider mapper to the newly created identity provider.
- Click the Mapper tab.
- Click the Create button.
- Give a Name to the new mapper.
- Change the Mapper Type to Hardcoded Attribute.
-
Set the User Attribute field to
emailVerified
. -
Set the User Attribute Value field to
true
. - Click the Save button.
-
From the GitHub Identity Provider Settings page, copy the Redirect URI value and paste it to your GitHub OAuth app Authorization Callback URL field. Also, paste this same value into the Homepage URL field, but remove the
broker/github/endpoint
part of the URL string. - Click Update Application. You can now sign commits, and containers by using GitHub as your OIDC provider.
- When signing artifacts, a web browser opens and prompts you to sign in to your Red Hat SSO account. Click the GitHub button to sign in with your credentials.
- Click the Authorize button to enable GitHub user details to be accessible by Red Hat SSO.
1.4.6. Configuring Microsoft Entra ID as an OpenID Connect provider for Trusted Artifact Signer Copy linkLink copied to clipboard!
You can use Microsoft Entra ID as your OpenID Connect (OIDC) provider for Red Hat’s Trusted Artifact Signer (RHTAS) service. You can decide to configure Microsoft Entra ID during the deployment of RHTAS, or at a later time.
Integrating Microsoft Entra ID into RHTAS requires no subscriptions.
You can define several different OIDC providers in the same configuration.
Prerequisites
- Red Hat OpenShift Container Platform 4.15 or later.
- A Microsoft Azure account with permissions to create resources.
- An Azure verified email address for users signing artifacts.
- Access to the Microsoft Azure command-line interface.
-
A workstation with the
oc
,cosign
,podman
, andaz
binaries installed.
Procedure
- Open a terminal on your workstation.
Create an App Registration within Microsoft Entra ID representing a client:
export RHTAS_APP_REGISTRATION=$(az ad app create --display-name=rhtas --web-redirect-uris=http://localhost:0/auth/callback --enable-id-token-issuance --query appId -o tsv)
$ export RHTAS_APP_REGISTRATION=$(az ad app create --display-name=rhtas --web-redirect-uris=http://localhost:0/auth/callback --enable-id-token-issuance --query appId -o tsv)
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a new client secret that allows user to use the App Registration to get a ID token:
export RHTAS_APP_REGISTRATION_CLIENT_SECRET=$(az ad app credential reset --id=$RHTAS_APP_REGISTRATION --display-name="RHTAS Client Secret" -o tsv --query 'password')
$ export RHTAS_APP_REGISTRATION_CLIENT_SECRET=$(az ad app credential reset --id=$RHTAS_APP_REGISTRATION --display-name="RHTAS Client Secret" -o tsv --query 'password')
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteBy default, client secrets are only valid for one year. You can customize this value by using the
--years
or--end-date
flags.Create a new Claim Mapping Policy to define a new JWT claim called
email_verified
, use a static value oftrue
:az rest -m post --headers Content-Type=application/json --uri https://graph.microsoft.com/v1.0/policies/claimsMappingPolicies --body '{"definition": ["{\"ClaimsMappingPolicy\":{\"Version\":1,\"IncludeBasicClaimSet\":\"true\", \"ClaimsSchema\":[{\"value\":\"true\",\"JwtClaimType\":\"email_verified\"}]}}"],"displayName": "EmailVerified"}'
$ az rest -m post --headers Content-Type=application/json --uri https://graph.microsoft.com/v1.0/policies/claimsMappingPolicies --body '{"definition": ["{\"ClaimsMappingPolicy\":{\"Version\":1,\"IncludeBasicClaimSet\":\"true\", \"ClaimsSchema\":[{\"value\":\"true\",\"JwtClaimType\":\"email_verified\"}]}}"],"displayName": "EmailVerified"}'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Get the App Registration object identifier:
export RHTAS_APP_REGISTRATION_OBJ_ID=$(az ad app show --id $RHTAS_APP_REGISTRATION --output tsv --query id)
$ export RHTAS_APP_REGISTRATION_OBJ_ID=$(az ad app show --id $RHTAS_APP_REGISTRATION --output tsv --query id)
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Update the App Registration manifest:
az rest --method PATCH --uri https://graph.microsoft.com/v1.0/applications/${RHTAS_APP_REGISTRATION_OBJ_ID} --headers 'Content-Type=application/json' --body "{\"api\":{\"acceptMappedClaims\":true}}"
$ az rest --method PATCH --uri https://graph.microsoft.com/v1.0/applications/${RHTAS_APP_REGISTRATION_OBJ_ID} --headers 'Content-Type=application/json' --body "{\"api\":{\"acceptMappedClaims\":true}}"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a new Service Principal and associate it with the App Registration:
export SERVICE_PRINCIPAL_ID=$(az ad sp create --id=${RHTAS_APP_REGISTRATION} -o tsv --query 'id')
$ export SERVICE_PRINCIPAL_ID=$(az ad sp create --id=${RHTAS_APP_REGISTRATION} -o tsv --query 'id')
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Get the Claim Mapping Policy identifier:
export CLAIM_MAPPING_POLICY_ID=$(az rest --uri https://graph.microsoft.com/v1.0/policies/claimsMappingPolicies -o tsv --query "value[?displayName=='EmailVerified'] | [0].id")
$ export CLAIM_MAPPING_POLICY_ID=$(az rest --uri https://graph.microsoft.com/v1.0/policies/claimsMappingPolicies -o tsv --query "value[?displayName=='EmailVerified'] | [0].id")
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Associate the Claim Mapping Policy with the Service Principal:
az rest -m post --headers Content-Type=application/json --uri "https://graph.microsoft.com/v1.0/servicePrincipals/${SERVICE_PRINCIPAL_ID}/claimsMappingPolicies/\$ref" --body "{\"@odata.id\": \"https://graph.microsoft.com/v1.0/policies/claimsMappingPolicies/${CLAIM_MAPPING_POLICY_ID}\"}"
$ az rest -m post --headers Content-Type=application/json --uri "https://graph.microsoft.com/v1.0/servicePrincipals/${SERVICE_PRINCIPAL_ID}/claimsMappingPolicies/\$ref" --body "{\"@odata.id\": \"https://graph.microsoft.com/v1.0/policies/claimsMappingPolicies/${CLAIM_MAPPING_POLICY_ID}\"}"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Get the tenant identifier:
export TENANT_ID=$(az account show -o tsv --query tenantId)
$ export TENANT_ID=$(az account show -o tsv --query tenantId)
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Get OIDC endpoint:
export ENTRA_ID_OIDC_ENDPOINT=$(echo https://login.microsoftonline.com/${TENANT_ID}/v2.0)
$ export ENTRA_ID_OIDC_ENDPOINT=$(echo https://login.microsoftonline.com/${TENANT_ID}/v2.0)
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Update the RHTAS configuration.
Open for editing the
Securesign
resource:oc edit Securesign NAME -n NAMESPACE
oc edit Securesign NAME -n NAMESPACE
Copy to Clipboard Copied! Toggle word wrap Toggle overflow oc edit Securesign securesign-sample -n trusted-artifact-signer
$ oc edit Securesign securesign-sample -n trusted-artifact-signer
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteYou must use the project name created for the RHTAS installation as the namespace.
Under the
OIDCIssuers
section, add a new subsection with the client identifier, issuer’s URL, and set theType
value toemail
:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Save your changes, and quit the editor. After a few seconds the operator automatically reconfigures the RHTAS software stack.
Create a local client secret file:
echo $RHTAS_APP_REGISTRATION_CLIENT_SECRET > rhtas-entra-id-client-secret
$ echo $RHTAS_APP_REGISTRATION_CLIENT_SECRET > rhtas-entra-id-client-secret
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Configure your shell environment for signing artifacts:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Initialize the local machine for signing:
cosign initialize
$ cosign initialize
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify the updated configuration by signing a test container image.
Create an empty container image:
echo "FROM scratch" > ./tmp.Dockerfile podman build . -f ./tmp.Dockerfile -t ttl.sh/rhtas/test-image:1h
$ echo "FROM scratch" > ./tmp.Dockerfile $ podman build . -f ./tmp.Dockerfile -t ttl.sh/rhtas/test-image:1h
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Push the empty container image to the
ttl.sh
ephemeral registry:podman push ttl.sh/rhtas/test-image:1h
$ podman push ttl.sh/rhtas/test-image:1h
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Remove the temporary Docker file:
rm ./tmp.Dockerfile
$ rm ./tmp.Dockerfile
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Sign the container image:
cosign sign -y --oidc-client-secret-file=SECRET_FILE IMAGE_NAME:TAG
cosign sign -y --oidc-client-secret-file=SECRET_FILE IMAGE_NAME:TAG
Copy to Clipboard Copied! Toggle word wrap Toggle overflow cosign sign -y --oidc-client-secret-file=rhtas-entra-id-client-secret ttl.sh/rhtas/test-image:1h
$ cosign sign -y --oidc-client-secret-file=rhtas-entra-id-client-secret ttl.sh/rhtas/test-image:1h
Copy to Clipboard Copied! Toggle word wrap Toggle overflow A web browser opens allowing you to sign the container image with an email address.
1.5. Configure an alternative database for Trusted Artifact Signer Copy linkLink copied to clipboard!
You can replace the Red Hat Trusted Artifact Signer (RHTAS) default database for Trillian with an externally managed MariaDB database instance. The database instance can be a cloud-hosted database provider, such as Amazon’s Relational Database Service (RDS), or your own database deployment in OpenShift.
1.5.1. Prerequisites Copy linkLink copied to clipboard!
- Red Hat OpenShift Container Platform version 4.13, 4.14, or 4.15.
1.5.2. Configuring Amazon RDS for Trusted Artifact Signer Copy linkLink copied to clipboard!
With this procedure, you can replace Red Hat’s Trusted Artifact Signer (RHTAS) default database for Trillian with a MariaDB instance managed by Amazon’s Relational Database Service (RDS).
Red Hat recommends using a highly available MariaDB database for production workloads.
Prerequisites
- An Amazon Web Service (AWS) account with access to the Amazon RDS console.
-
Access to the OpenShift web console with the
cluster-admin
role. -
A workstation with the
oc
,curl
, and themysql
binaries installed. - Command-line access with privileges to create a database and populate the MariaDB instance.
Procedure
Open the Amazon RDS console, and create a new MariaDB instance.
- Wait for the MariaDB instance to be deployed, and is available.
From your workstation, log in to the new database by providing the regional endpoint, the port, and the user credentials:
mysql -h REGIONAL_ENDPOINT -P 3306 -u USER_NAME -p
mysql -h REGIONAL_ENDPOINT -P 3306 -u USER_NAME -p
Copy to Clipboard Copied! Toggle word wrap Toggle overflow mysql -h exampledb.1234.us-east-1.rds.amazonaws.com -P 3306 -u admin -p
$ mysql -h exampledb.1234.us-east-1.rds.amazonaws.com -P 3306 -u admin -p
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a new database named
trillian
:create database trillian;
create database trillian;
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Switch to the newly created database:
use trillian;
use trillian;
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a new database user named
trillian
, and set a PASSWORD for the newly created user:CREATE USER trillian@'%' IDENTIFIED BY 'PASSWORD'; GRANT ALL PRIVILEGES ON trillian.* TO 'trillian'@'%'; FLUSH PRIVILEGES;
CREATE USER trillian@'%' IDENTIFIED BY 'PASSWORD'; GRANT ALL PRIVILEGES ON trillian.* TO 'trillian'@'%'; FLUSH PRIVILEGES;
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Disconnect from the database:
EXIT
EXIT
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Download the database configuration file:
curl -o dbconfig.sql https://raw.githubusercontent.com/securesign/trillian/main/storage/mysql/schema/storage.sql
$ curl -o dbconfig.sql https://raw.githubusercontent.com/securesign/trillian/main/storage/mysql/schema/storage.sql
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Apply the database configuration to the new database:
mysql -h FQDN_or_SERVICE_ADDR -P 3306 -u USER_NAME -p PASSWORD -D DB_NAME < PATH_TO_CONFIG_FILE
mysql -h FQDN_or_SERVICE_ADDR -P 3306 -u USER_NAME -p PASSWORD -D DB_NAME < PATH_TO_CONFIG_FILE
Copy to Clipboard Copied! Toggle word wrap Toggle overflow mysql -h rhtasdb.example.com -P 3306 -u trillian -p mypassword123 -D trillian < dbconfig.sql
$ mysql -h rhtasdb.example.com -P 3306 -u trillian -p mypassword123 -D trillian < dbconfig.sql
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Open a terminal on your workstation, and log in to OpenShift:
oc login --token=TOKEN --server=SERVER_URL_AND_PORT
oc login --token=TOKEN --server=SERVER_URL_AND_PORT
Copy to Clipboard Copied! Toggle word wrap Toggle overflow oc login --token=sha256~ZvFDBvoIYAbVECixS4-WmkN4RfnNd8Neh3y1WuiFPXC --server=https://example.com:6443
$ oc login --token=sha256~ZvFDBvoIYAbVECixS4-WmkN4RfnNd8Neh3y1WuiFPXC --server=https://example.com:6443
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteYou can find your login token and URL for use on the command line from the OpenShift web console. Log in to the OpenShift web console. Click your user name, and click Copy login command. Offer your user name and password again, if asked, and click Display Token to view the command.
Create a new Secret containing the credentials for the Trillian database within the MariaDB instance which was created previously:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Copy to Clipboard Copied! Toggle word wrap Toggle overflow You can use an OpenShift internal service name for the MariaDB instance.
- You can now deploy the Trusted Artifact Signer service to use this database. If you were following the Trusted Artifact Signer installation procedure, then you can proceed to the next step.
1.5.3. Configuring a database in OpenShift for Trusted Artifact Signer Copy linkLink copied to clipboard!
With this procedure, you can replace Red Hat’s Trusted Artifact Signer (RHTAS) default database for Trillian with a MariaDB instance managed by Amazon’s Relational Database Service (RDS).
Red Hat recommends using a highly available MariaDB database for production workloads.
Prerequisites
- Permissions to create an OpenShift project, and deploy a database instance from the OpenShift samples catalog.
-
Access to the OpenShift web console with the
cluster-admin
role. -
A workstation with the
oc
,curl
, and themysql
binaries installed. - Command-line access with privileges to create a database and populate the MariaDB instance.
Procedure
- Log in to the OpenShift web console where you are deploying the RHTAS service:
- Change to the Developer perspective.
Select the
trusted-artifact-signer
project, if the project already exists, else create a new project for the database:- To create a new project, click the drop-down project menu, and click the Create Project button.
-
Name the new project
trusted-artifact-signer
, and click the Create button.
- On the Developer Catalog card, click Database.
Select MariaDB, and click the Instantiate Template button.
ImportantDo not select MariaDB (Ephemeral).
On the Instantiate Template page, configure the following fields:
-
In the MariaDB Database Name field, enter
trillian
. -
In the Volume Capacity field, enter
5Gi
. - Click the Create button.
-
In the MariaDB Database Name field, enter
Begin a remote shell session:
- On the Topology page, selecting the MariaDB pod brings up a side panel, click the Resources tab.
- Under the Pods section, click on the MariaDB pod name.
- Click the Terminal tab to start a remote shell session to the MariaDB pod.
In the remote shell session, verify that you can connect to the Trillian database:
mysql -u $MYSQL_USER -p$MYSQL_PASSWORD -D$MYSQL_DATABASE
$ mysql -u $MYSQL_USER -p$MYSQL_PASSWORD -D$MYSQL_DATABASE
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteCredentials are stored in a secret object with the service name (
mariadb
), and contains the name of the database, and user name, along with the database root password. Make a note of these credentials as they will be used later on when creating the database secret object.Disconnect from the database:
EXIT
EXIT
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Download the database configuration file:
curl -o dbconfig.sql https://raw.githubusercontent.com/securesign/trillian/main/storage/mysql/schema/storage.sql
$ curl -o dbconfig.sql https://raw.githubusercontent.com/securesign/trillian/main/storage/mysql/schema/storage.sql
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Apply the database configuration to the new database:
mysql -h FQDN_or_SERVICE_ADDR -P 3306 -u USER_NAME -p PASSWORD -D DB_NAME < PATH_TO_CONFIG_FILE
mysql -h FQDN_or_SERVICE_ADDR -P 3306 -u USER_NAME -p PASSWORD -D DB_NAME < PATH_TO_CONFIG_FILE
Copy to Clipboard Copied! Toggle word wrap Toggle overflow mysql -h rhtasdb.example.com -P 3306 -u trillian -p mypassword123 -D trillian < dbconfig.sql
$ mysql -h rhtasdb.example.com -P 3306 -u trillian -p mypassword123 -D trillian < dbconfig.sql
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Open a terminal on your workstation, and log in to OpenShift:
oc login --token=TOKEN --server=SERVER_URL_AND_PORT
oc login --token=TOKEN --server=SERVER_URL_AND_PORT
Copy to Clipboard Copied! Toggle word wrap Toggle overflow oc login --token=sha256~ZvFDBvoIYAbVECixS4-WmkN4RfnNd8Neh3y1WuiFPXC --server=https://example.com:6443
$ oc login --token=sha256~ZvFDBvoIYAbVECixS4-WmkN4RfnNd8Neh3y1WuiFPXC --server=https://example.com:6443
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteYou can find your login token and URL for use on the command line from the OpenShift web console. Log in to the OpenShift web console. Click your user name, and click Copy login command. Offer your user name and password again, if asked, and click Display Token to view the command.
Create a new Secret containing the credentials for the Trillian database within the MariaDB instance which was created previously:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Copy to Clipboard Copied! Toggle word wrap Toggle overflow You can use an OpenShift internal service name for the MariaDB instance.
- You can now deploy the Trusted Artifact Signer service to use this database. If you were following the Trusted Artifact Signer installation procedure, then you can proceed to the next step.
1.6. Configuring OpenShift service serving certificates to generate TLS certificates for Keycloak Copy linkLink copied to clipboard!
OpenShift’s service serving certificate can automate the generation and management of Transport Layer Security (TLS) certificates for use by Keycloak. Infrastructure components, such as the Ingress Controller, within an OpenShift cluster will trust these TLS certificates.
Prerequisites
- Red Hat OpenShift Container Platform 4.15 or later.
- Installation of the Red Hat build of Keycloak (RHBK) Operator.
-
Access to the OpenShift web console with the
cluster-admin
role.
Procedure
- In OpenShift web console, from the Administrator perspective, expand Home from the navigation menu, and click Projects.
-
Search for
keycloak
, and select thekeycloak-system
namespace. Create a new service.
- Click the + icon.
In the Import YAML text box, copy the example, and paste it into the text box.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Click the Create button.
- Expand Operators from the navigation menu, click Installed Operators, and click the Red Hat build of Keycloak Operator tile.
In the YAML view of the
Keycloak
resource, under thespec
section, add theingress
property:Copy to Clipboard Copied! Toggle word wrap Toggle overflow By default, the Keycloak Operator creates Ingress resources instead of routes. OpenShift automatically creates a route based on the Ingress definition.
Specify the name of the secret containing the TLS certificate, under the
spec
section:spec: ... http: tlsSecret: keycloak-tls ...
spec: ... http: tlsSecret: keycloak-tls ...
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Once Keycloak starts, OpenShift’s service serving certificate starts generating TLS certificates for Keycloak.
1.7. Generating Keycloak host names automatically Copy linkLink copied to clipboard!
OpenShift routes has support for automatically generating host names by using a set pattern. This feature can integrate with Red Hat’s build of Keycloak (RHBK) operator running on OpenShift.
Prerequisites
- Red Hat OpenShift Container Platform 4.15 or later.
- Installation of the RHBK operator.
-
Access to the OpenShift web console with the
cluster-admin
role. -
A workstation with the
oc
binary installed.
Procedure
Enable the automatically generated route hostname feature.
Under the
.spec
section, remove the entirehostname
section, and replace it with theingress
section andclassName
property within theKeycloak
resource:spec: ... [.line-through]#hostname:# [.line-through]#hostname: example.com# ...
spec: ... [.line-through]#hostname:# [.line-through]#hostname: example.com# ...
Copy to Clipboard Copied! Toggle word wrap Toggle overflow spec: ... ingress: className: openshift-default ...
spec: ... ingress: className: openshift-default ...
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteTo view all of the available Ingress classes, run the following command:
oc get ingressclass
$ oc get ingressclass
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Click the Save button.
Verify the automatically generated
hostname
by clicking the Reload button to view the latest configuration:spec: ... hostname: hostname: example-keycloak-ingress-keycloak-system.apps.rhtas.example.com ...
spec: ... hostname: hostname: example-keycloak-ingress-keycloak-system.apps.rhtas.example.com ...
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Chapter 2. Red Hat Enterprise Linux Copy linkLink copied to clipboard!
2.1. Installing Trusted Artifact Signer using Ansible Copy linkLink copied to clipboard!
You can install the Red Hat Trusted Artifact Signer (RHTAS) on Red Hat Enterprise Linux by using a Red Hat provided Ansible Playbook. This deployment gives you a basic signing framework with Keycloak as the OpenID Connect (OIDC) provider.
Red Hat recommends not to use Ansible logging in verbose or debugging mode for production environments.
For more information, see the Ansible documentation.
Prerequisites
- Red Hat Enterprise Linux version 9.4 or later.
- A Red Hat user account to access the Red Hat Hybrid Cloud Console.
Procedure
- Log in to the Red Hat Hybrid Cloud Console with your Red Hat credentials.
- From the home page, click the Services drop-down menu, and click Red Hat Ansible Automation Platform.
- From the navigational menu, expand Automation Hub, and click Collections.
- In the search field type rhtas and press enter.
- Click the artifact_signer link on the Red Hat Trusted Artifact Signer tile.
Click the Documentation tab, and follow the steps there to complete the installation of RHTAS on Red Hat Enterprise Linux.
NoteFor a detailed overview of all the configuration parameters, click the tas_single_node link under the Roles section.
2.2. Verify the Trusted Artifact Signer installation Copy linkLink copied to clipboard!
As as systems administrator, you can verify if the deployment of Red Hat Trusted Artifact Signer (RHTAS) running on Red Hat Enterprise Linux was successful.
You can sign a test container image, and verify the authenticity of that signature to validate the deployment of RHTAS in your environment.
There are two ways to sign and three ways to verify build artifacts from your code pipeline. You can sign and verify with cosign
and gitsign
, but can only verify with Enterprise Contract.
2.2.1. Signing and verifying containers by using Cosign from the command-line interface Copy linkLink copied to clipboard!
The cosign
tool gives you the capability to sign and verify Open Container Initiative (OCI) container images, along with other build artifacts by using Red Hat’s Trusted Artifact Signer (RHTAS) service.
For RHTAS, you must use cosign
version 2.2 or later.
Prerequisites
- Installation of RHTAS running on Red Hat Enterprise Linux 9.4 or later managed by Ansible.
-
A workstation with the
podman
binary installed.
Procedure
Download the
cosign
binary from the local command-line interface (CLI) tool download page to your workstation.NoteThe URL address is the configured node as defined by the
tas_single_node_base_hostname
variable. An example URL address would be,https://cli-server.example.com
, given thetas_single_node_base_hostname
value asexample.com
.- From the download page, go to the cosign download section, and click the link for your platform.
Open a terminal on your workstation, decompress the binary
.gz
file, and set the execution bit:gunzip cosign-amd64.gz chmod +x cosign-amd64
$ gunzip cosign-amd64.gz $ chmod +x cosign-amd64
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Move and rename the binary to a location within your
$PATH
environment:sudo mv cosign-amd64 /usr/local/bin/cosign
$ sudo mv cosign-amd64 /usr/local/bin/cosign
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Configure your shell environment for doing container image signing and verifying.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Replace BASE_HOSTNAME_OF_RHTAS_SERVICE with the value of the
tas_single_node_base_hostname`
variable, and replace OIDC_ISSUER_URL with your OpenID Connect (OIDC) provider’s URL string.Initialize The Update Framework (TUF) system:
cosign initialize
$ cosign initialize
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Sign a test container image.
Create an empty container image:
echo "FROM scratch" > ./tmp.Dockerfile podman build . -f ./tmp.Dockerfile -t ttl.sh/rhtas/test-image:1h
$ echo "FROM scratch" > ./tmp.Dockerfile $ podman build . -f ./tmp.Dockerfile -t ttl.sh/rhtas/test-image:1h
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Push the empty container image to the
ttl.sh
ephemeral registry:podman push ttl.sh/rhtas/test-image:1h
$ podman push ttl.sh/rhtas/test-image:1h
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Sign the container image:
cosign sign -y IMAGE_NAME:TAG
cosign sign -y IMAGE_NAME:TAG
Copy to Clipboard Copied! Toggle word wrap Toggle overflow cosign sign -y ttl.sh/rhtas/test-image:1h
$ cosign sign -y ttl.sh/rhtas/test-image:1h
Copy to Clipboard Copied! Toggle word wrap Toggle overflow A web browser opens allowing you to sign the container image with an email address.
Remove the temporary Docker file:
rm ./tmp.Dockerfile
$ rm ./tmp.Dockerfile
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verify a signed container image by using a certificate identity and issuer:
cosign verify --certificate-identity=SIGNING_EMAIL_ADDR IMAGE_NAME:TAG
cosign verify --certificate-identity=SIGNING_EMAIL_ADDR IMAGE_NAME:TAG
Copy to Clipboard Copied! Toggle word wrap Toggle overflow cosign verify --certificate-identity=jdoe@redhat.com ttl.sh/rhtas/test-image:1h
$ cosign verify --certificate-identity=jdoe@redhat.com ttl.sh/rhtas/test-image:1h
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteYou can also use regular expressions for the certificate identity and issuer by using the following options to the
cosign
command,--certificate-identity-regexp
and--certificate-oidc-issuer-regexp
.Download the
rekor-cli
binary from the local command-line interface (CLI) tool download page to your workstation.Open a web browser, and go to the CLI server web page.
NoteThe URL address is the configured node as defined by the
tas_single_node_base_hostname
variable. An example URL address would be,https://cli-server.example.com
, given that the value oftas_single_node_base_hostname
isexample.com
.- From the download page, go to the rekor-cli download section, and click the link for your platform.
Open a terminal on your workstation, decompress the binary
.gz
file, and set the execution bit:gunzip rekor-cli-amd64.gz chmod +x rekor-cli-amd64
$ gunzip rekor-cli-amd64.gz $ chmod +x rekor-cli-amd64
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Move and rename the binary to a location within your
$PATH
environment:sudo mv rekor-cli-amd64 /usr/local/bin/rekor-cli
$ sudo mv rekor-cli-amd64 /usr/local/bin/rekor-cli
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Query the transparency log by using the Rekor command-line interface.
Search based on the log index:
rekor-cli get --log-index 0 --rekor_server $COSIGN_REKOR_URL --format json | jq
$ rekor-cli get --log-index 0 --rekor_server $COSIGN_REKOR_URL --format json | jq
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Search for an email address to get the universal unique identifier (UUID):
rekor-cli search --email SIGNING_EMAIL_ADDR --rekor_server $COSIGN_REKOR_URL --format json | jq
rekor-cli search --email SIGNING_EMAIL_ADDR --rekor_server $COSIGN_REKOR_URL --format json | jq
Copy to Clipboard Copied! Toggle word wrap Toggle overflow rekor-cli search --email jdoe@redhat.com --rekor_server $COSIGN_REKOR_URL --format json | jq
$ rekor-cli search --email jdoe@redhat.com --rekor_server $COSIGN_REKOR_URL --format json | jq
Copy to Clipboard Copied! Toggle word wrap Toggle overflow This command returns the UUID for use with the next step.
Use the UUID to get the transaction details:
rekor-cli get --uuid UUID --rekor_server $COSIGN_REKOR_URL --format json | jq
rekor-cli get --uuid UUID --rekor_server $COSIGN_REKOR_URL --format json | jq
Copy to Clipboard Copied! Toggle word wrap Toggle overflow rekor-cli get --uuid 24296fb24b8ad77a71b9c1374e207537bafdd75b4f591dcee10f3f697f150d7cc5d0b725eea641e7 --rekor_server $COSIGN_REKOR_URL --format json | jq
$ rekor-cli get --uuid 24296fb24b8ad77a71b9c1374e207537bafdd75b4f591dcee10f3f697f150d7cc5d0b725eea641e7 --rekor_server $COSIGN_REKOR_URL --format json | jq
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
2.2.2. Signing and verifying commits by using Gitsign from the command-line interface Copy linkLink copied to clipboard!
The gitsign
tool gives you the ability to sign and verify Git repository commits by using Red Hat’s Trusted Artifact Signer (RHTAS) service.
Prerequisites
- Installation of RHTAS running on Red Hat Enterprise Linux 9.4 or later managed by Ansible.
A workstation with the
git
, andcosign
binaries installed.-
You must use
cosign
version 2.2 or later.
-
You must use
- A locally cloned Git repository.
Procedure
Download the
gitsign
binary from the local command-line interface (CLI) tool download page to your workstation.NoteThe URL address is the configured node as defined by the
tas_single_node_base_hostname
variable. An example URL address would be,https://cli-server.example.com
, given thetas_single_node_base_hostname
value asexample.com
.- From the download page, go to the gitsign download section, and click the link for your platform.
Open a terminal on your workstation, decompress the .gz file, and set the execution bit:
gunzip gitsign-amd64.gz chmod +x gitsign-amd64
$ gunzip gitsign-amd64.gz $ chmod +x gitsign-amd64
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Move and rename the binary to a location within your
$PATH
environment:sudo mv gitsign-amd64 /usr/local/bin/gitsign
$ sudo mv gitsign-amd64 /usr/local/bin/gitsign
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Configure your shell environment for doing commit signing and verifying.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Replace BASE_HOSTNAME_OF_RHTAS_SERVICE with the value of the
tas_single_node_base_hostname`
variable, and replace OIDC_ISSUER_URL with your OpenID Connect (OIDC) provider’s URL string.-
Change directory (
cd
) to the local Git repository directory. Configure the local repository configuration to sign your commits by using the RHTAS service:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Make a commit to the local repository:
git commit --allow-empty -S -m "Test of a signed commit"
$ git commit --allow-empty -S -m "Test of a signed commit"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow A web browser opens allowing you to sign the commit with an email address.
Initialize The Update Framework (TUF) system:
cosign initialize
$ cosign initialize
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify the commit:
gitsign verify --certificate-identity=SIGNING_EMAIL --certificate-oidc-issuer=$SIGSTORE_OIDC_ISSUER HEAD
gitsign verify --certificate-identity=SIGNING_EMAIL --certificate-oidc-issuer=$SIGSTORE_OIDC_ISSUER HEAD
Copy to Clipboard Copied! Toggle word wrap Toggle overflow gitsign verify --certificate-identity=jdoe@redhat.com --certificate-oidc-issuer=$SIGSTORE_OIDC_ISSUER HEAD
$ gitsign verify --certificate-identity=jdoe@redhat.com --certificate-oidc-issuer=$SIGSTORE_OIDC_ISSUER HEAD
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
2.2.3. Verifying signatures on container images with Conforma Copy linkLink copied to clipboard!
Conforma, formally known as Enterprise Contract (EC), is a tool for maintaining the security of software supply chains, and you can use it to define and enforce policies for container images. You can use the ec
binary to verify the attestation and signature of container images that use Red Hat’s Trusted Artifact Signer (RHTAS) signing framework.
Prerequisites
- Installation of RHTAS running on Red Hat Enterprise Linux 9.4 or later managed by Ansible.
A workstation with the
cosign
, andpodman
binaries installed.-
You must use
cosign
version 2.2 or later.
-
You must use
Procedure
Download the
ec
binary from the local command-line interface (CLI) tool download page to your workstation.NoteThe URL address is the configured node as defined by the
tas_single_node_base_hostname
variable. An example URL address would be,https://cli-server.example.com
, given thetas_single_node_base_hostname
value asexample.com
.- From the download page, go to the ec download section, and click the link for your platform.
Open a terminal on your workstation, decompress the binary .gz file, and set the execution bit:
gunzip ec-amd64.gz chmod +x ec-amd64
$ gunzip ec-amd64.gz $ chmod +x ec-amd64
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Move and rename the binary to a location within your
$PATH
environment:sudo mv ec-amd64 /usr/local/bin/ec
$ sudo mv ec-amd64 /usr/local/bin/ec
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Configure your shell environment for doing container image signing and verifying.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Replace BASE_HOSTNAME_OF_RHTAS_SERVICE with the value of the
tas_single_node_base_hostname`
variable, and replace OIDC_ISSUER_URL with your OpenID Connect (OIDC) provider’s URL string.Initialize The Update Framework (TUF) system:
cosign initialize
$ cosign initialize
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Sign a test container image.
Create an empty container image:
echo "FROM scratch" > ./tmp.Dockerfile podman build . -f ./tmp.Dockerfile -t ttl.sh/rhtas/test-image:1h
$ echo "FROM scratch" > ./tmp.Dockerfile $ podman build . -f ./tmp.Dockerfile -t ttl.sh/rhtas/test-image:1h
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Push the empty container image to the
ttl.sh
ephemeral registry:podman push ttl.sh/rhtas/test-image:1h
$ podman push ttl.sh/rhtas/test-image:1h
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Sign the container image:
cosign sign -y IMAGE_NAME:TAG
cosign sign -y IMAGE_NAME:TAG
Copy to Clipboard Copied! Toggle word wrap Toggle overflow cosign sign -y ttl.sh/rhtas/test-image:1h
$ cosign sign -y ttl.sh/rhtas/test-image:1h
Copy to Clipboard Copied! Toggle word wrap Toggle overflow A web browser opens allowing you to sign the container image with an email address.
Remove the temporary Docker file:
rm ./tmp.Dockerfile
$ rm ./tmp.Dockerfile
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Create a
predicate.json
file:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Refer to the SLSA provenance predicate specifications for more information about the schema layout.
Associate the
predicate.json
file with the container image:cosign attest -y --predicate ./predicate.json --type slsaprovenance IMAGE_NAME:TAG
cosign attest -y --predicate ./predicate.json --type slsaprovenance IMAGE_NAME:TAG
Copy to Clipboard Copied! Toggle word wrap Toggle overflow cosign attest -y --predicate ./predicate.json --type slsaprovenance ttl.sh/rhtas/test-image:1h
$ cosign attest -y --predicate ./predicate.json --type slsaprovenance ttl.sh/rhtas/test-image:1h
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify that the container image has at least one attestation and signature:
cosign tree IMAGE_NAME:TAG
cosign tree IMAGE_NAME:TAG
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify the container image by using Conforma:
ec validate image --image IMAGE_NAME:TAG --certificate-identity-regexp 'SIGNER_EMAIL_ADDR' --certificate-oidc-issuer-regexp 'keycloak-system' --output yaml --show-successes
ec validate image --image IMAGE_NAME:TAG --certificate-identity-regexp 'SIGNER_EMAIL_ADDR' --certificate-oidc-issuer-regexp 'keycloak-system' --output yaml --show-successes
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Copy to Clipboard Copied! Toggle word wrap Toggle overflow Enterprise Contract generates a pass-fail report with details on any security violations. When you add the
--info
flag, the report includes more details and possible solutions for any violations found.
Appendix A. Service and StatefulSet YAML configuration for Red Hat build of Keycloak Copy linkLink copied to clipboard!
The Service and StatefulSet YAML resource configuration used when configuring Red Hat’s build of Keycloak (RHBK) for Red Hat’s Trusted Artifact Signer (RHTAS) service.
Appendix B. Trusted Artifact Signer components and version numbers Copy linkLink copied to clipboard!
The following tables list Red Hat’s Trusted Artifact Signer (RHTAS) software components and their corresponding version numbers for the 1.2.1 release.
Binary | Version |
---|---|
| 2.4.3 |
| 0.12.0 |
| 1.3.9 |
| 0.6 |
| 1.7.1 |
| 1.7.1 |
| 0.12.0 |
| 0.17.1 |
| 1.2.4 |
Component | Version |
---|---|
logserver | 1.7.1 |
logsigner | 1.7.1 |
database | 1.7.1 |
redis | 1.7.1 |
Component | Version |
---|---|
rekor-server | 1.3.9 |
backfill-redis | 1.3.9 |
rekor-search-ui | 1.3.9 |
Component | Version |
---|---|
fulcio-server | 1.6.6 |
Component | Version |
---|---|
certificate-transparency-go | 1.3.1 |
Component | Version |
---|---|
timestamp-authority | 1.2.4 |