이 콘텐츠는 선택한 언어로 제공되지 않습니다.
Chapter 10. Configuring AWS STS for Red Hat Quay
Support for Amazon Web Services (AWS) Security Token Service (STS) is available for standalone Red Hat Quay deployments, Red Hat Quay on OpenShift Container Platform, and Red Hat OpenShift Service on AWS (ROSA). AWS STS is a web service for requesting temporary, limited-privilege credentials for AWS Identity and Access Management (IAM) users and for users that you authenticate, or federated users. This feature is useful for clusters using Amazon S3 as an object storage, allowing Red Hat Quay to use STS protocols to authenticate with Amazon S3, which can enhance the overall security of the cluster and help to ensure that access to sensitive data is properly authenticated and authorized.
Configuring AWS STS for OpenShift Container Platform or ROSA requires creating an AWS IAM user, creating an S3 role, and configuring your Red Hat Quay config.yaml
file to include the proper resources.
10.1. Creating an IAM user 링크 복사링크가 클립보드에 복사되었습니다!
Use the following procedure to create an Identity and Access Management (IAM) user.
Procedure
- Log in to the Amazon Web Services (AWS) console and navigate to the Identity and Access Management (IAM) console.
- In the navigation pane, under Access management click Users.
Click Create User and enter the following information:
-
Enter a valid username, for example,
quay-user
. - For Permissions options, click Add user to group.
-
Enter a valid username, for example,
- On the review and create page, click Create user. You are redirected to the Users page.
- Click the username, for example, quay-user.
-
Copy the ARN of the user, for example,
arn:aws:iam::123456:user/quay-user
. - On the same page, click the Security credentials tab.
- Navigate to Access keys.
- Click Create access key.
- On the Access key best practices & alternatives page, click Command Line Interface (CLI), then, check the confirmation box. Then click Next.
- Optional. On the Set description tag - optional page, enter a description.
- Click Create access key.
Copy and store the access key and the secret access key.
ImportantThis is the only time that the secret access key can be viewed or downloaded. You cannot recover it later. However, you can create a new access key any time.
- Click Done.
10.2. Creating an S3 role 링크 복사링크가 클립보드에 복사되었습니다!
Use the following procedure to create an S3 role for AWS STS.
Prerequisites
You have created an IAM user and stored the access key and the secret access key. .Procedure
- Navigate to the IAM dashboard.
- In the navigation pane, click Roles under Access management.
-
Click Create role
Custom Trust Policy. Under the
Principal
configuration field, add your AWS ARN information. For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Click Next.
-
On the Add permissions page, type
AmazonS3FullAccess
in the search box. Check the box to add that policy to the S3 role, then click Next. On the Name, review, and create page, enter the following information:
-
Enter a role name, for example,
example-role
. - Optional. Add a description.
-
Enter a role name, for example,
- Click the Create role button. You are navigated to the Roles page. Under Role name, the newly created S3 should be available.
10.3. Configuring Red Hat Quay on OpenShift Container Platform to use AWS STS 링크 복사링크가 클립보드에 복사되었습니다!
Use the following procedure to edit your Red Hat Quay on OpenShift Container Platform config.yaml
file to use AWS STS.
You can also edit and re-deploy your Red Hat Quay on OpenShift Container Platform config.yaml
file directly instead of using the OpenShift Container Platform UI.
Prerequisites
- You have configured a Role ARN.
- You have generated a User Access Key.
- You have generated a User Secret Key.
Procedure
-
On the Home page of your OpenShift Container Platform deployment, click Operators
Installed Operators. - Click Red Hat Quay.
- Click Quay Registry and then the name of your Red Hat Quay registry.
- Under Config Bundle Secret, click the name of your registry configuration bundle, for example, quay-registry-config-bundle-qet56.
- On the configuration bundle page, click Actions to reveal a drop-down menu. Then click Edit Secret.
Update your the
DISTRIBUTED_STORAGE_CONFIG
fields of yourconfig.yaml
file with the following information:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- The unique Amazon Resource Name (ARN) required when configuring AWS STS
- 2
- The name of your s3 bucket.
- 3
- The storage path for data. Usually
/datastorage
. - 4
- The Amazon Web Services region. Defaults to
us-east-1
. - 5
- The generated AWS S3 user access key required when configuring AWS STS.
- 6
- The generated AWS S3 user secret key required when configuring AWS STS.
- Click Save.
Verification
Tag a sample image, for example,
busybox
, that will be pushed to the repository. For example:podman tag docker.io/library/busybox <quay-server.example.com>/<organization_name>/busybox:test
$ podman tag docker.io/library/busybox <quay-server.example.com>/<organization_name>/busybox:test
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Push the sample image by running the following command:
podman push <quay-server.example.com>/<organization_name>/busybox:test
$ podman push <quay-server.example.com>/<organization_name>/busybox:test
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Verify that the push was successful by navigating to the Organization that you pushed the image to in your Red Hat Quay registry
Tags. - Navigate to the Amazon Web Services (AWS) console and locate your s3 bucket.
- Click the name of your s3 bucket.
- On the Objects page, click datastorage/.
On the datastorage/ page, the following resources should seen:
- sha256/
uploads/
These resources indicate that the push was successful, and that AWS STS is properly configured.
10.4. Configuring Red Hat Quay on Red Hat OpenShift Service on AWS to use AWS STS 링크 복사링크가 클립보드에 복사되었습니다!
Use the following procedure to configure Red Hat Quay to use AWS STS on Red Hat OpenShift Service on AWS platforms.
Prerequisites
- You have created an IAM user.
- You have created an s3 Role ARN.
- You have created a Custom Trust Policy that uses the Role ARN.
Procedure
Get the
serviceAccountIssuer
resource by entering the following command:oc get authentication.config.openshift.io cluster -o json | jq -r .spec.serviceAccountIssuer | sed -e "s/^https:\/\///"
$ oc get authentication.config.openshift.io cluster -o json | jq -r .spec.serviceAccountIssuer | sed -e "s/^https:\/\///"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
oidc.op1.openshiftapps.com/123456
oidc.op1.openshiftapps.com/123456
Copy to Clipboard Copied! Toggle word wrap Toggle overflow On the Identity and Access Management (IAM) console of the Amazon Web Services (AWS) console:
- Click Roles.
-
Click the name of the Role to be used with AWS STS, for example,
example-role
. Click the Trust relationships tab, which shows the JSON policy created during "Creating an S3 role". Update the JSON policy as follows:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Updates the
Principal
parameter of the JSON policy toFederated:<your_user_ARN>:<serviceAccountIssuer_domain_path>
- 2
- Updates the
Action
parameter of the JSON policy tosts:AssumeRoleWithWebIdentity
. - 3
- Updates the
Condition
parameter of the JSON policy toStringEquals”: “<serviceAccountIssuer>:sub”: “system:serviceAccount:<quay_namespace>:<quay_registry_using_serviceAccount>
- Verify that your User ARN is configured correct, then click Next.
- On the Add permissions page, select AmazonS3FullAccess, then click Next.
- On the Name, review, and create page, provide your role a name, a description, verify your configuration, add any optional tags. Then, click Create Role.
On the Roles page, click the new role and store the
Role ARN
resource. For example:arn:aws:iam::123456:role/test_s3_access
arn:aws:iam::123456:role/test_s3_access
Copy to Clipboard Copied! Toggle word wrap Toggle overflow On the Red Hat Quay web console:
-
Click Operators
Installed Operators. - Click Red Hat Quay.
- Click Quay Registry and then the name of your Red Hat Quay registry.
- Under Config Bundle Secret, click the name of your registry configuration bundle, for example, quay-registry-config-bundle-12345.
- On the configuration bundle page, click Actions to reveal a drop-down menu. Then click Edit Secret.
Update your the
DISTRIBUTED_STORAGE_CONFIG
fields of yourconfig.yaml
file with the following information:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
-
Click Operators
-
Click Save. Your
QuayRegistry
custom resource (CR) automatically restarts. Annotate the Service Account (SA) that executes pods with the EKS configuration values. For example:
oc annotate sa registry-quay-app "eks.amazonaws.com/role-arn"="arn:aws:iam::123456:role/test_s3_access" "eks.amazonaws.com/audience"="sts.amazonaws.com" "eks.amazonaws.com/sts-regional-endpoints"="true"
$ oc annotate sa registry-quay-app "eks.amazonaws.com/role-arn"="arn:aws:iam::123456:role/test_s3_access" "eks.amazonaws.com/audience"="sts.amazonaws.com" "eks.amazonaws.com/sts-regional-endpoints"="true"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
Tag a sample image, for example,
busybox
, that will be pushed to the repository. For example:podman tag docker.io/library/busybox <quay-server.example.com>/<organization_name>/busybox:test
$ podman tag docker.io/library/busybox <quay-server.example.com>/<organization_name>/busybox:test
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Push the sample image by running the following command:
podman push <quay-server.example.com>/<organization_name>/busybox:test
$ podman push <quay-server.example.com>/<organization_name>/busybox:test
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Verify that the push was successful by navigating to the Organization that you pushed the image to in your Red Hat Quay registry
Tags. - Navigate to the Amazon Web Services (AWS) console and locate your s3 bucket.
- Click the name of your s3 bucket.
- On the Objects page, click datastorage/.
On the datastorage/ page, the following resources should seen:
- sha256/
uploads/
These resources indicate that the push was successful, and that AWS STS is properly configured.