InfoGrab Docs

AWS에 tbot 배포

요약

이 가이드는 AWS EC2 인스턴스에 머신 및 워크로드 아이덴티티의 에이전트 tbot을 배포하고 Teleport 클러스터에 연결하는 방법을 보여줍니다. AWS에서 가상 머신에는 IAM 역할을 할당할 수 있으며, 가상 머신이 이 역할을 가정하여 머신에 대한 정보를 포함하는 서명된 문서를 요청할 수 있습니다.

이 가이드는 AWS EC2 인스턴스에 머신 및 워크로드 아이덴티티의 에이전트 tbot을 배포하고 Teleport 클러스터에 연결하는 방법을 보여줍니다.

작동 방식#

AWS에서 가상 머신에는 IAM 역할을 할당할 수 있으며, 가상 머신이 이 역할을 가정하여 머신에 대한 정보를 포함하는 서명된 문서를 요청할 수 있습니다.

Teleport iam 조인 방법은 머신 및 워크로드 아이덴티티 봇이 할당된 아이덴티티를 사용하여 AWS에서 이 서명된 문서를 요청하고 검증을 위해 Teleport Auth Service로 보내도록 지시합니다. 이를 통해 봇은 장기 시크릿의 교환 없이 클러스터에 조인할 수 있습니다.

이 가이드는 EC2 인스턴스에 tbot을 배포하는 데 초점을 맞추지만, EKS Kubernetes 클러스터에서 실행 중인 워크로드와 함께 iam 조인 방법을 사용하는 것도 가능합니다. 이렇게 하려면 클러스터와 tbot 파드가 사용할 Kubernetes 서비스 계정에 대해 서비스 계정 IAM 역할(IRSA)을 설정해야 합니다. Kubernetes에서 워크로드로 tbot을 배포하는 추가 지침은 Kubernetes 플랫폼 가이드를 참조하세요.

사전 조건#

  • 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:

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.

  • Teleport 클러스터에 접근을 허용하려는 AWS IAM 역할. 이 역할에는 sts:GetCallerIdentity가 부여되어야 합니다. 이 가이드에서 이 역할의 이름은 teleport-bot-role입니다.
  • IAM 역할이 연결된 tbot을 설치할 AWS EC2 가상 머신.

1단계/5단계. tbot 설치#

이 단계는 AWS EC2 인스턴스에서 완료합니다.

먼저 머신 및 워크로드 아이덴티티를 사용할 VM에 tbot을 설치해야 합니다.

플랫폼에 맞는 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
    

2단계/5단계. 봇 만들기#

이 단계는 로컬 머신에서 완료합니다.

Next, you need to create a Bot. A Bot is a Teleport identity for a machine or group of machines. Like users, bots have a set of roles and traits which define what they can access.

Create bot.yaml:

kind: bot
version: v1
metadata:
  # name is a unique identifier for the Bot in the cluster.
  name: example
spec:
  # roles is a list of roles to grant to the Bot. Don't worry if you don't know
  # what roles you need to specify here, the Access Guides will walk you through
  # creating and assigning roles to the already created Bot.
  roles: []

Make sure you replace example with a unique, descriptive name for your Bot.

Use tctl to apply this file:

$ tctl create bot.yaml

3단계/5단계. 조인 토큰 만들기#

이 단계는 로컬 머신에서 완료합니다.

bot-token.yaml을 만듭니다:

kind: token
version: v2
metadata:
  # name은 이 토큰을 사용하는 `tbot`에서 지정됩니다.
  name: example-bot
spec:
  roles: [Bot]
  # bot_name은 이 가이드에서 이전에 만든 봇의 이름과 일치해야 합니다.
  bot_name: example
  join_method: iam
  # 이 토큰을 사용할 수 있는 AWS 계정 및 (선택 사항) ARN을 제한합니다.
  # 이 정보는 CLI에서 "aws sts get-caller-identity" 명령을 실행하여 얻을 수 있습니다.
  allow:
    - aws_account: "111111111111"
      aws_arn: "arn:aws:sts::111111111111:assumed-role/teleport-bot-role/i-*"

교체:

  • 111111111111을 AWS 계정 ID로.
  • teleport-bot-role을 만들어 EC2 인스턴스에 할당한 AWS IAM 역할 이름으로.
  • example을 두 번째 단계에서 만든 봇의 이름으로.
  • i-*은 지정된 역할이 있는 모든 인스턴스가 조인 방법을 사용할 수 있음을 나타냅니다. 특정 인스턴스로 제한하려면 i-*을 전체 인스턴스 ID로 교체하세요.

tctl을 사용하여 이 파일을 적용합니다:

$ tctl create -f bot-token.yaml

4단계/5단계. tbot 설정#

이 단계는 AWS EC2 인스턴스에서 완료합니다.

/etc/tbot.yaml을 만듭니다:

version: v2
proxy_server: example.teleport.sh:443
onboarding:
  join_method: iam
  token: example-bot
storage:
  type: memory
# services는 접근 가이드를 완료하는 동안 채워집니다.
services: []

교체:

  • example.teleport.sh:443을 Teleport Proxy Service 또는 Auth Service의 주소로. Teleport Proxy Service 인스턴스의 주소를 사용하는 것이 좋습니다.
  • example-bot을 두 번째 단계에서 만든 토큰 이름으로.

Now, you must decide if you want to run tbot as a daemon or in one-shot mode.

In daemon mode, tbot runs continually, renewing the short-lived credentials for the configured outputs on a fixed interval. This is often combined with a service manager (such as systemd) in order to run tbot in the background. This is the default behaviour of tbot.

In one-shot mode, tbot generates short-lived credentials and then exits. This is useful when combining tbot with scripting (such as in CI/CD) as it allows further steps to be dependent on tbot having succeeded. It is important to note that the credentials will expire if not renewed and to ensure that the TTL for the certificates is long enough to cover the length of the CI/CD job.

Configuring tbot as a daemon#

(!docs/pages/includes/machine-id/daemon.mdx!)

Configuring tbot for one-shot mode#

To use tbot in one-shot mode, modify /etc/tbot.yaml to add oneshot: true:

version: v2
oneshot: true
auth_server: ...

Now, you should test your tbot configuration. When started, several log messages will be emitted before it exits with status 0:

$ export TELEPORT_ANONYMOUS_TELEMETRY=1
$ tbot start -c /etc/tbot.yaml

TELEPORT_ANONYMOUS_TELEMETRY enables the submission of anonymous usage telemetry. This helps us shape the future development of tbot. You can disable this by omitting this.

5단계/5단계. 서비스 설정#

You have now prepared the base configuration for tbot. At this point, it identifies itself to the Teleport cluster and renews its own credentials but does not output any credentials for other applications to use.

Follow one of the access guides to configure a service that meets your access needs.

다음 단계#

AWS에 tbot 배포

원문 보기
요약

이 가이드는 AWS EC2 인스턴스에 머신 및 워크로드 아이덴티티의 에이전트 tbot을 배포하고 Teleport 클러스터에 연결하는 방법을 보여줍니다. AWS에서 가상 머신에는 IAM 역할을 할당할 수 있으며, 가상 머신이 이 역할을 가정하여 머신에 대한 정보를 포함하는 서명된 문서를 요청할 수 있습니다.

이 가이드는 AWS EC2 인스턴스에 머신 및 워크로드 아이덴티티의 에이전트 tbot을 배포하고 Teleport 클러스터에 연결하는 방법을 보여줍니다.

작동 방식#

AWS에서 가상 머신에는 IAM 역할을 할당할 수 있으며, 가상 머신이 이 역할을 가정하여 머신에 대한 정보를 포함하는 서명된 문서를 요청할 수 있습니다.

Teleport iam 조인 방법은 머신 및 워크로드 아이덴티티 봇이 할당된 아이덴티티를 사용하여 AWS에서 이 서명된 문서를 요청하고 검증을 위해 Teleport Auth Service로 보내도록 지시합니다. 이를 통해 봇은 장기 시크릿의 교환 없이 클러스터에 조인할 수 있습니다.

이 가이드는 EC2 인스턴스에 tbot을 배포하는 데 초점을 맞추지만, EKS Kubernetes 클러스터에서 실행 중인 워크로드와 함께 iam 조인 방법을 사용하는 것도 가능합니다. 이렇게 하려면 클러스터와 tbot 파드가 사용할 Kubernetes 서비스 계정에 대해 서비스 계정 IAM 역할(IRSA)을 설정해야 합니다. Kubernetes에서 워크로드로 tbot을 배포하는 추가 지침은 Kubernetes 플랫폼 가이드를 참조하세요.

사전 조건#

  • 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:

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.

  • Teleport 클러스터에 접근을 허용하려는 AWS IAM 역할. 이 역할에는 sts:GetCallerIdentity가 부여되어야 합니다. 이 가이드에서 이 역할의 이름은 teleport-bot-role입니다.
  • IAM 역할이 연결된 tbot을 설치할 AWS EC2 가상 머신.

1단계/5단계. tbot 설치#

이 단계는 AWS EC2 인스턴스에서 완료합니다.

먼저 머신 및 워크로드 아이덴티티를 사용할 VM에 tbot을 설치해야 합니다.

플랫폼에 맞는 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
    

2단계/5단계. 봇 만들기#

이 단계는 로컬 머신에서 완료합니다.

Next, you need to create a Bot. A Bot is a Teleport identity for a machine or group of machines. Like users, bots have a set of roles and traits which define what they can access.

Create bot.yaml:

kind: bot
version: v1
metadata:
  # name is a unique identifier for the Bot in the cluster.
  name: example
spec:
  # roles is a list of roles to grant to the Bot. Don't worry if you don't know
  # what roles you need to specify here, the Access Guides will walk you through
  # creating and assigning roles to the already created Bot.
  roles: []

Make sure you replace example with a unique, descriptive name for your Bot.

Use tctl to apply this file:

$ tctl create bot.yaml

3단계/5단계. 조인 토큰 만들기#

이 단계는 로컬 머신에서 완료합니다.

bot-token.yaml을 만듭니다:

kind: token
version: v2
metadata:
  # name은 이 토큰을 사용하는 `tbot`에서 지정됩니다.
  name: example-bot
spec:
  roles: [Bot]
  # bot_name은 이 가이드에서 이전에 만든 봇의 이름과 일치해야 합니다.
  bot_name: example
  join_method: iam
  # 이 토큰을 사용할 수 있는 AWS 계정 및 (선택 사항) ARN을 제한합니다.
  # 이 정보는 CLI에서 "aws sts get-caller-identity" 명령을 실행하여 얻을 수 있습니다.
  allow:
    - aws_account: "111111111111"
      aws_arn: "arn:aws:sts::111111111111:assumed-role/teleport-bot-role/i-*"

교체:

  • 111111111111을 AWS 계정 ID로.
  • teleport-bot-role을 만들어 EC2 인스턴스에 할당한 AWS IAM 역할 이름으로.
  • example을 두 번째 단계에서 만든 봇의 이름으로.
  • i-*은 지정된 역할이 있는 모든 인스턴스가 조인 방법을 사용할 수 있음을 나타냅니다. 특정 인스턴스로 제한하려면 i-*을 전체 인스턴스 ID로 교체하세요.

tctl을 사용하여 이 파일을 적용합니다:

$ tctl create -f bot-token.yaml

4단계/5단계. tbot 설정#

이 단계는 AWS EC2 인스턴스에서 완료합니다.

/etc/tbot.yaml을 만듭니다:

version: v2
proxy_server: example.teleport.sh:443
onboarding:
  join_method: iam
  token: example-bot
storage:
  type: memory
# services는 접근 가이드를 완료하는 동안 채워집니다.
services: []

교체:

  • example.teleport.sh:443을 Teleport Proxy Service 또는 Auth Service의 주소로. Teleport Proxy Service 인스턴스의 주소를 사용하는 것이 좋습니다.
  • example-bot을 두 번째 단계에서 만든 토큰 이름으로.

Now, you must decide if you want to run tbot as a daemon or in one-shot mode.

In daemon mode, tbot runs continually, renewing the short-lived credentials for the configured outputs on a fixed interval. This is often combined with a service manager (such as systemd) in order to run tbot in the background. This is the default behaviour of tbot.

In one-shot mode, tbot generates short-lived credentials and then exits. This is useful when combining tbot with scripting (such as in CI/CD) as it allows further steps to be dependent on tbot having succeeded. It is important to note that the credentials will expire if not renewed and to ensure that the TTL for the certificates is long enough to cover the length of the CI/CD job.

Configuring tbot as a daemon#

(!docs/pages/includes/machine-id/daemon.mdx!)

Configuring tbot for one-shot mode#

To use tbot in one-shot mode, modify /etc/tbot.yaml to add oneshot: true:

version: v2
oneshot: true
auth_server: ...

Now, you should test your tbot configuration. When started, several log messages will be emitted before it exits with status 0:

$ export TELEPORT_ANONYMOUS_TELEMETRY=1
$ tbot start -c /etc/tbot.yaml

TELEPORT_ANONYMOUS_TELEMETRY enables the submission of anonymous usage telemetry. This helps us shape the future development of tbot. You can disable this by omitting this.

5단계/5단계. 서비스 설정#

You have now prepared the base configuration for tbot. At this point, it identifies itself to the Teleport cluster and renews its own credentials but does not output any credentials for other applications to use.

Follow one of the access guides to configure a service that meets your access needs.

다음 단계#