Use Step CLI with AWS IAM Roles Anywhere
Maintainer thường phản hồi trong vòng 1 ngày
@hslatman đang làm issue này rồi.
Từ ngày 25/2/2025.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
As someone who isn't super familiar with the peculiars of openssl I was looking for something easier. I'm glad I found Step CLI.
My use-case was to setup a lot of instances of IAM Roles Anywhere.
Figured I would share what I did so that maybe someone else can spared the pain.
This is by no means a perfect solution, but should be sufficient to get you started.
There are three main components to IAM Roles Anywhere:
- Trust Anchors
- Profiles
- IAM Roles
I'm not going into details here, as there's plenty of information about it on teh interwebz.
You need a Certificate Authority (Root CA) and it's also recommended to have a Intermediate CA to sign application certificates with.
To create the Root and Intermediate:
create-ca.sh
#!/bin/bash
root_name="${1}"
intermediate_name="${2}"
environment="${3}"
root_ca="root_ca_${environment}.crt"
root_ca_key="root_ca_${environment}.key"
intermediate_ca="intermediate_ca_${environment}.crt"
intermediate_ca_key="intermediate_ca_${environment}.key"
openssl rand -base64 32 > root.txt
openssl rand -base64 32 > intermediate.txt
step certificate create "${root_name}" "${root_ca}" "${root_ca_key}" \
--kty EC \
--curve P-384 \
--profile root-ca \
--not-after 8760h \
--password-file ./root.txt
step certificate create "${intermediate_name}" "${intermediate_ca}" "${intermediate_ca_key}" \
--kty EC \
--curve P-384 \
--profile intermediate-ca \
--not-after 8760h \
--ca "./${root_ca}" \
--ca-key "./${root_ca_key}" \
--password-file ./intermediate.txt
cat "${intermediate_ca}" "${root_ca}" > "ca_${environment}.pem"
Make sure you store the keys very securely!
The resulting .pem files is what you store as the "Certificate bundle" in the Trust Anchor.
Then, for each application (or however you want to slice it) you create the client certificates (role certificate):
create-cert-sh
#!/bin/bash
name="${1}"
environment="${2}"
intermediate_ca="intermediate_ca_${environment}.crt"
intermediate_ca_key="intermediate_ca_${environment}.key"
cert_ca="role_cert_${environment}.pem"
cert_ca_key="role_cert_${environment}.key"
#openssl rand -base64 32 > cert.txt
step certificate create "${name}" "${cert_ca}" "${cert_ca_key}" \
--kty EC \
--curve P-384 \
--profile leaf \
--not-after 8760h \
--ca "./${intermediate_ca}" \
--ca-key "./${intermediate_ca_key}" \
--no-password \
--insecure \
--bundle
Then you can test with:
#!/bin/bash
result=$(./aws_signing_helper credential-process \
--certificate "./role_cert_dev.pem" \
--private-key "./role_cert_dev.key" \
--trust-anchor-arn "<Trust Anchor ARN>" \
--profile-arn "<Profile ARN>" \
--role-arn "<Role ARN>")
export AWS_ACCESS_KEY_ID=$(echo "${result}" | jq -r '.AccessKeyId')
export AWS_SECRET_ACCESS_KEY=$(echo "${result}" | jq -r '.SecretAccessKey')
export AWS_SESSION_TOKEN=$(echo "${result}" | jq -r '.SessionToken')
# depending on the permissions you given the IAM Role you can test it with the AWS CLI here
Note that all certs are valid for 1 year, make sure you change this to be compliant with your company's rules. Usually the client certs should have a shorter TTL.
Hope this helps someone!
Feel free to close this whenever. :)
- Ngôn ngữ chính
- Go
- Star
- 4.3k
- Fork
- 320
- Merge trung bình
- 2 ngày 3 giờ
- Pull request đã merge (30 ngày)
- 11
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của smallstep/cli
-
[Bug]: `Match exec "step ssh check-host %h"` causes SSH connections through ProxyJump to hangĐang mởbug needs triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement needs triage
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 32/100
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement needs triage
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 57/100
smallstep/cli#1713 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
build s390x and riscv64 binariesĐang mởenhancement needs triage
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
smallstep/cli#1710 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: `step ca provisioner add --ca-config` requires `--ca-url`/`--root` even for purely local/offline editsCó thể đã có người làm @vulragrag-star đã nhận 51 ngày trước. Đang mởbug needs triage
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 20/100
smallstep/cli#1705 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của smallstep/cli
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
[FEATURE]: Set fieldPath and reason on the CEL validation rulesCó thể đã có người làm @bjosv đã nhận hôm nay. Đang mởenhancement needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
valkey-io/valkey-operator#618 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
agent-butler-finding bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
jordansmall/spindrift#6414 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Icinga/icinga-kubernetes#294 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Cluster details: the Control Plane version field has a different border color than its icon boxĐang mởkind/design sig/ui
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
kubermatic/dashboard#8449 ·
Maintainer thường phản hồi trong vòng 1 ngày