InfoGrab Docs

AWS IAM 역할을 통한 서비스 조인

요약

이 가이드는 IAM 조인 방법을 사용하여 AWS에서 실행 중인 Teleport 프로세스가 어떠한 시크릿도 공유하지 않고 Teleport 클러스터에 조인하도록 구성하는 방법을 설명합니다. 사용 사례에 따라 두 가지 다른 AWS 조인 방법도 사용할 수 있습니다:

이 가이드는 IAM 조인 방법을 사용하여 AWS에서 실행 중인 Teleport 프로세스가 어떠한 시크릿도 공유하지 않고 Teleport 클러스터에 조인하도록 구성하는 방법을 설명합니다.

사용 사례에 따라 두 가지 다른 AWS 조인 방법도 사용할 수 있습니다:

  1. EC2 조인 방법: 셀프 호스팅 Teleport 배포에서만 사용 가능합니다 (문서 참조). EC2 인스턴스에서 실행 중인 Teleport 프로세스가 서명된 EC2 인스턴스 아이덴티티 문서를 요청하고 이를 Teleport Auth Service에 제출하면, Auth Service가 EC2 API를 조회하여 인스턴스가 유효한지 확인합니다. 이 방법은 셀프 호스팅 Teleport 클러스터와 Teleport Auth Service에 대한 IAM 자격 증명이 필요합니다.
  2. AWS 서명되지 않은 토큰: AWS에서 실행 중인 Teleport 프로세스를 Teleport 조인 토큰을 통해, 또는 Kubernetes에서 실행 중인 Teleport 프로세스의 경우 서명된 ServiceAccount 토큰을 통해 클러스터에 조인하도록 구성할 수 있습니다. 이 방법은 AWS 특정 API에 의존하고 싶지 않을 때, 예를 들어 클라우드 무관(agnostic) 접근 방식을 채택할 때 유용합니다.

작동 방식#

IAM 조인 방법은 EC2 인스턴스에 연결된 IAM 역할과 같이 IAM 자격 증명에 접근할 수 있는 어느 곳에서나 실행 중인 모든 Teleport 프로세스에서 사용할 수 있습니다. 특정 권한이나 IAM 정책은 필요하지 않습니다: 연결된 정책이 없는 IAM 역할로도 충분합니다. Teleport Auth Service에는 IAM 자격 증명이 필요하지 않습니다.

Teleport 프로세스는 사전 서명된 sts:GetCallerIdentity 요청을 Teleport Auth Service에 전송함으로써 AWS 계정에서 실행 중임을 증명합니다. 서비스의 아이덴티티는 AWS 서비스 조인 토큰에 구성된 허용 규칙과 일치해야 합니다.

사전 요구 사항#

  • A running Teleport cluster. If you want to get started with Teleport, sign up for a free trial or set up a demo environment.

  • The tctl and tsh clients.

    Installing `tctl` and `tsh` clients
    1. Determine the version of your Teleport cluster. The tctl and tsh clients must be at most one major version behind your Teleport cluster version. Send a GET request to the Proxy Service at /v1/webapi/find and use a JSON query tool to obtain your cluster version. Replace with the web address of your Teleport Proxy Service:

      $ TELEPORT_DOMAIN=
      $ TELEPORT_VERSION="$(curl -s https://$TELEPORT_DOMAIN/v1/webapi/find | jq -r '.server_version')"
      
    2. Follow the instructions for your platform to install tctl and tsh clients:

  • Teleport 서비스를 호스팅할 AWS EC2 인스턴스(Teleport 바이너리 설치 필요).

To check that you can connect to your Teleport cluster, sign in with tsh login, then verify that you can run tctl commands using your current credentials.

For example, run the following command, assigning to the domain name of the Teleport Proxy Service in your cluster and to your Teleport username:

$ tsh login --proxy= --user=
$ tctl status
# Cluster  (=teleport.url=)
# Version  (=teleport.version=)
# CA pin   (=presets.ca_pin=)

If you can connect to the cluster and run the tctl status command, you can use your current credentials to run subsequent tctl commands from your workstation. If you host your own Teleport cluster, you can also run tctl commands on the computer that hosts the Teleport Auth Service for full permissions.

1/5단계. AWS IAM 자격 증명 설정#

IAM 방법을 사용하여 Teleport 클러스터에 조인하는 모든 Teleport 프로세스는 sts:GetCallerIdentity API를 호출하기 위해 AWS IAM 자격 증명이 필요합니다. 특정 IAM 정책이나 권한은 필요하지 않습니다. 어떤 IAM 사용자나 역할도 이 API를 호출할 수 있습니다.

EC2 인스턴스에서 Teleport를 실행하는 경우, 인스턴스에 IAM 역할을 연결하는 것으로 충분합니다. EC2 대시보드에서 IAM 역할을 연결하려면 작업 > 보안 > IAM 역할 수정을 선택하세요. 역할에 IAM 정책이 전혀 연결되어 있지 않아도 됩니다. 인스턴스에 AWS 자격 증명이 별도로 필요하지 않은 경우, 연결된 정책이 없는 빈 역할을 생성하여 연결하는 것이 권장됩니다.

2/5단계. AWS 조인 토큰 생성#

AWS 계정과 Teleport 프로세스의 아이덴티티가 일치해야 하는 ARN을 지정하는 allow 규칙을 포함한 다음 token.yaml 파일을 생성하세요.

  # token.yaml
  kind: token
  version: v2
  metadata:
    # the token name is not a secret because instances must prove that they are
    # running in your AWS account to use this token
    name: iam-token
  spec:
    # use the minimal set of roles required (e.g. Node, App, Kube, DB, WindowsDesktop)
    roles: [Node]
    
    # set the join method allowed for this token
    join_method: iam
    
    allow:
      # specify the AWS account which Teleport processes may join from
      - aws_account: "111111111111"
      # multiple allow rules are supported
      - aws_account: "222222222222"
      # aws_arn is optional and allows you to restrict the IAM role of joining
      # Teleport processes
      - aws_account: "333333333333"
        aws_arn: "arn:aws:sts::333333333333:assumed-role/teleport-node-role/i-*"
    ```
<!-- /INCLUDE:ENGLISH -->

토큰 이름 `iam-token`은 예시일 뿐이며, 3단계의 `join_params.token_name`에서
동일한 값을 사용하는  원하는 어떤 값이든 사용할  있습니다.

허용 규칙의 선택적 `aws_arn` 필드는 와일드카드 문자를 지원합니다:
- `*`: 임의의 문자 조합과 일치
- `?`: 임의의 단일 문자와 일치

다음 명령을 실행하여 토큰을 생성하세요:

```code
$ tctl create -f token.yaml

3/5단계 Teleport 설치#

AWS EC2 인스턴스에 Teleport를 설치하세요.

To install a Teleport Agent on your Linux server:

The recommended installation method is the cluster install script. It will select the correct version, edition, and installation mode for your cluster.

  1. Assign to your Teleport cluster hostname and port, but not the scheme (https://).

  2. Run your cluster's install script:

    $ curl "https:///scripts/install.sh" | sudo bash
    

4/5단계. 서비스 구성#

사용자 정의 teleport.yaml 파일로 Teleport 서비스를 구성하세요. 2단계에서 생성한 토큰과 일치하는 token_namemethod: iam을 포함한 join_params 섹션을 다음 예제 구성과 같이 사용하세요:

# /etc/teleport.yaml
version: v3
teleport:
  join_params:
    token_name: iam-token
    method: iam
  proxy_server: teleport.example.com:443
ssh_service:
  enabled: true
auth_service:
  enabled: false
proxy_service:
  enabled: false

teleport.proxy_server 필드에서 해당 값을 Teleport Proxy Service 또는 Teleport Enterprise Cloud 테넌트의 호스트 및 웹 포트로 교체하세요. 예: mytenant.teleport.sh:443.

5/5단계. Teleport 프로세스 실행#

Grant your Teleport instance access to credentials that it can use to authenticate to AWS.

  • If you are running your Teleport instance on an EC2 instance, you may use the EC2 Instance Metadata Service method
  • If you are running your Teleport instance in Kubernetes, you can use IAM Roles for Service Accounts (IRSA)
  • Otherwise, you must use environment variables
Have multiple sources of AWS credentials?

Teleport's AWS client loads credentials from different sources in the following order:

  • Environment Variables
  • Shared credentials file
  • Shared configuration file (Teleport always enables shared configuration)
  • EC2 Instance Metadata (credentials only)

While you can provide AWS credentials via a shared credentials file or shared configuration file, you will need to run your Teleport instance with the AWS_PROFILE environment variable assigned to the name of your profile of choice.

If you have a specific use case that the instructions above do not account for, consult the documentation for the AWS SDK for Go for a detailed description of credential loading behavior.

Configure your Teleport instance to start automatically when the host boots up by creating a systemd service for it. The instructions depend on how you installed your Teleport instance.

You can check the status of your Teleport instance with systemctl status teleport and view its logs with journalctl -fu teleport.

Teleport를 시작한 후, 서비스가 클러스터에 연결하고 조인할 수 있는지 확인하세요.

AWS IAM 역할을 통한 서비스 조인

원문 보기
요약

이 가이드는 IAM 조인 방법을 사용하여 AWS에서 실행 중인 Teleport 프로세스가 어떠한 시크릿도 공유하지 않고 Teleport 클러스터에 조인하도록 구성하는 방법을 설명합니다. 사용 사례에 따라 두 가지 다른 AWS 조인 방법도 사용할 수 있습니다:

이 가이드는 IAM 조인 방법을 사용하여 AWS에서 실행 중인 Teleport 프로세스가 어떠한 시크릿도 공유하지 않고 Teleport 클러스터에 조인하도록 구성하는 방법을 설명합니다.

사용 사례에 따라 두 가지 다른 AWS 조인 방법도 사용할 수 있습니다:

  1. EC2 조인 방법: 셀프 호스팅 Teleport 배포에서만 사용 가능합니다 (문서 참조). EC2 인스턴스에서 실행 중인 Teleport 프로세스가 서명된 EC2 인스턴스 아이덴티티 문서를 요청하고 이를 Teleport Auth Service에 제출하면, Auth Service가 EC2 API를 조회하여 인스턴스가 유효한지 확인합니다. 이 방법은 셀프 호스팅 Teleport 클러스터와 Teleport Auth Service에 대한 IAM 자격 증명이 필요합니다.
  2. AWS 서명되지 않은 토큰: AWS에서 실행 중인 Teleport 프로세스를 Teleport 조인 토큰을 통해, 또는 Kubernetes에서 실행 중인 Teleport 프로세스의 경우 서명된 ServiceAccount 토큰을 통해 클러스터에 조인하도록 구성할 수 있습니다. 이 방법은 AWS 특정 API에 의존하고 싶지 않을 때, 예를 들어 클라우드 무관(agnostic) 접근 방식을 채택할 때 유용합니다.

작동 방식#

IAM 조인 방법은 EC2 인스턴스에 연결된 IAM 역할과 같이 IAM 자격 증명에 접근할 수 있는 어느 곳에서나 실행 중인 모든 Teleport 프로세스에서 사용할 수 있습니다. 특정 권한이나 IAM 정책은 필요하지 않습니다: 연결된 정책이 없는 IAM 역할로도 충분합니다. Teleport Auth Service에는 IAM 자격 증명이 필요하지 않습니다.

Teleport 프로세스는 사전 서명된 sts:GetCallerIdentity 요청을 Teleport Auth Service에 전송함으로써 AWS 계정에서 실행 중임을 증명합니다. 서비스의 아이덴티티는 AWS 서비스 조인 토큰에 구성된 허용 규칙과 일치해야 합니다.

사전 요구 사항#

  • A running Teleport cluster. If you want to get started with Teleport, sign up for a free trial or set up a demo environment.

  • The tctl and tsh clients.

    Installing `tctl` and `tsh` clients
    1. Determine the version of your Teleport cluster. The tctl and tsh clients must be at most one major version behind your Teleport cluster version. Send a GET request to the Proxy Service at /v1/webapi/find and use a JSON query tool to obtain your cluster version. Replace with the web address of your Teleport Proxy Service:

      $ TELEPORT_DOMAIN=
      $ TELEPORT_VERSION="$(curl -s https://$TELEPORT_DOMAIN/v1/webapi/find | jq -r '.server_version')"
      
    2. Follow the instructions for your platform to install tctl and tsh clients:

  • Teleport 서비스를 호스팅할 AWS EC2 인스턴스(Teleport 바이너리 설치 필요).

To check that you can connect to your Teleport cluster, sign in with tsh login, then verify that you can run tctl commands using your current credentials.

For example, run the following command, assigning to the domain name of the Teleport Proxy Service in your cluster and to your Teleport username:

$ tsh login --proxy= --user=
$ tctl status
# Cluster  (=teleport.url=)
# Version  (=teleport.version=)
# CA pin   (=presets.ca_pin=)

If you can connect to the cluster and run the tctl status command, you can use your current credentials to run subsequent tctl commands from your workstation. If you host your own Teleport cluster, you can also run tctl commands on the computer that hosts the Teleport Auth Service for full permissions.

1/5단계. AWS IAM 자격 증명 설정#

IAM 방법을 사용하여 Teleport 클러스터에 조인하는 모든 Teleport 프로세스는 sts:GetCallerIdentity API를 호출하기 위해 AWS IAM 자격 증명이 필요합니다. 특정 IAM 정책이나 권한은 필요하지 않습니다. 어떤 IAM 사용자나 역할도 이 API를 호출할 수 있습니다.

EC2 인스턴스에서 Teleport를 실행하는 경우, 인스턴스에 IAM 역할을 연결하는 것으로 충분합니다. EC2 대시보드에서 IAM 역할을 연결하려면 작업 > 보안 > IAM 역할 수정을 선택하세요. 역할에 IAM 정책이 전혀 연결되어 있지 않아도 됩니다. 인스턴스에 AWS 자격 증명이 별도로 필요하지 않은 경우, 연결된 정책이 없는 빈 역할을 생성하여 연결하는 것이 권장됩니다.

2/5단계. AWS 조인 토큰 생성#

AWS 계정과 Teleport 프로세스의 아이덴티티가 일치해야 하는 ARN을 지정하는 allow 규칙을 포함한 다음 token.yaml 파일을 생성하세요.

  # token.yaml
  kind: token
  version: v2
  metadata:
    # the token name is not a secret because instances must prove that they are
    # running in your AWS account to use this token
    name: iam-token
  spec:
    # use the minimal set of roles required (e.g. Node, App, Kube, DB, WindowsDesktop)
    roles: [Node]
    
    # set the join method allowed for this token
    join_method: iam
    
    allow:
      # specify the AWS account which Teleport processes may join from
      - aws_account: "111111111111"
      # multiple allow rules are supported
      - aws_account: "222222222222"
      # aws_arn is optional and allows you to restrict the IAM role of joining
      # Teleport processes
      - aws_account: "333333333333"
        aws_arn: "arn:aws:sts::333333333333:assumed-role/teleport-node-role/i-*"
    ```
<!-- /INCLUDE:ENGLISH -->

토큰 이름 `iam-token`은 예시일 뿐이며, 3단계의 `join_params.token_name`에서
동일한 값을 사용하는  원하는 어떤 값이든 사용할  있습니다.

허용 규칙의 선택적 `aws_arn` 필드는 와일드카드 문자를 지원합니다:
- `*`: 임의의 문자 조합과 일치
- `?`: 임의의 단일 문자와 일치

다음 명령을 실행하여 토큰을 생성하세요:

```code
$ tctl create -f token.yaml

3/5단계 Teleport 설치#

AWS EC2 인스턴스에 Teleport를 설치하세요.

To install a Teleport Agent on your Linux server:

The recommended installation method is the cluster install script. It will select the correct version, edition, and installation mode for your cluster.

  1. Assign to your Teleport cluster hostname and port, but not the scheme (https://).

  2. Run your cluster's install script:

    $ curl "https:///scripts/install.sh" | sudo bash
    

4/5단계. 서비스 구성#

사용자 정의 teleport.yaml 파일로 Teleport 서비스를 구성하세요. 2단계에서 생성한 토큰과 일치하는 token_namemethod: iam을 포함한 join_params 섹션을 다음 예제 구성과 같이 사용하세요:

# /etc/teleport.yaml
version: v3
teleport:
  join_params:
    token_name: iam-token
    method: iam
  proxy_server: teleport.example.com:443
ssh_service:
  enabled: true
auth_service:
  enabled: false
proxy_service:
  enabled: false

teleport.proxy_server 필드에서 해당 값을 Teleport Proxy Service 또는 Teleport Enterprise Cloud 테넌트의 호스트 및 웹 포트로 교체하세요. 예: mytenant.teleport.sh:443.

5/5단계. Teleport 프로세스 실행#

Grant your Teleport instance access to credentials that it can use to authenticate to AWS.

  • If you are running your Teleport instance on an EC2 instance, you may use the EC2 Instance Metadata Service method
  • If you are running your Teleport instance in Kubernetes, you can use IAM Roles for Service Accounts (IRSA)
  • Otherwise, you must use environment variables
Have multiple sources of AWS credentials?

Teleport's AWS client loads credentials from different sources in the following order:

  • Environment Variables
  • Shared credentials file
  • Shared configuration file (Teleport always enables shared configuration)
  • EC2 Instance Metadata (credentials only)

While you can provide AWS credentials via a shared credentials file or shared configuration file, you will need to run your Teleport instance with the AWS_PROFILE environment variable assigned to the name of your profile of choice.

If you have a specific use case that the instructions above do not account for, consult the documentation for the AWS SDK for Go for a detailed description of credential loading behavior.

Configure your Teleport instance to start automatically when the host boots up by creating a systemd service for it. The instructions depend on how you installed your Teleport instance.

You can check the status of your Teleport instance with systemctl status teleport and view its logs with journalctl -fu teleport.

Teleport를 시작한 후, 서비스가 클러스터에 연결하고 조인할 수 있는지 확인하세요.