InfoGrab Docs

GCP로 서비스 등록하기

요약

이 가이드에서는 GCP 조인 방법을 사용하여 GCP VM에서 실행 중인 Teleport 프로세스가 비밀을 공유하지 않고 Teleport 클러스터에 참여하도록 구성하는 방법을 설명합니다. GCP 조인 방법은 GCP VM에서 실행 중인 모든 Teleport 프로세스에서 사용할 수 있습니다.

이 가이드에서는 GCP 조인 방법을 사용하여 GCP VM에서 실행 중인 Teleport 프로세스가 비밀을 공유하지 않고 Teleport 클러스터에 참여하도록 구성하는 방법을 설명합니다.

작동 방식#

GCP 조인 방법은 GCP VM에서 실행 중인 모든 Teleport 프로세스에서 사용할 수 있습니다. VM에는 서비스 계정 이 할당되어 있어야 합니다(기본 서비스 계정으로 충분합니다). 클러스터에 참여하는 Teleport 프로세스에는 IAM 역할이 필요하지 않습니다.

내부적으로, 서비스는 GCP 프로젝트에서 실행 중임을 증명하기 위해 GCP 조인 토큰에 구성된 허용 규칙과 일치하는 서명된 ID 토큰을 전송합니다.

사전 요구 사항#

  • 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 서비스를 호스팅할 GCP VM으로, 서비스 계정이 할당되어 있고 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/4단계. GCP 조인 토큰 생성#

GCP 프로젝트의 서비스가 Teleport 클러스터에 참여할 수 있도록 하는 특수 동적 토큰으로 Teleport Auth Service를 구성합니다.

GCP 인스턴스가 실행될 GCP 프로젝트 ID, 서비스 계정, 위치를 지정하는 gcp.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 GCP project to use this token
  name: gcp-token
spec:
  # use the minimal set of roles required (e.g. Node, Proxy, App, Kube, DB, WindowsDesktop)
  roles: [Node]

  # set the join method allowed for this token
  join_method: gcp

  gcp:
    allow:
      # The GCP project ID(s) that VMs can join from.
      - project_ids: ["example-project-id"]
        # (Optional) The locations that VMs can join from. Note: both regions and
        # zones are accepted.
        locations: ["us-west1", "us-west2-a"]
        # (Optional) The email addresses of service accounts that VMs can join
        # with.
        service_accounts: ["example@example.com"]

다음 명령을 실행하여 토큰을 생성합니다:

$ tctl create token.yaml

2/4단계. Teleport 설치#

GCP Linux VM에 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
    

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

GCP 조인 방법은 SSH(Node), Proxy, Kubernetes, 애플리케이션, 데이터베이스 또는 Windows Desktop Services를 실행하는 Teleport 프로세스에 사용할 수 있습니다. Teleport 프로세스는 GCP VM에서 직접 실행되어야 합니다.

사용자 지정 teleport.yaml 파일로 Teleport 프로세스를 구성합니다. 1단계에서 생성한 토큰과 일치하는 token_namemethod: gcp를 포함한 join_params 섹션을 다음 예시 구성과 같이 사용합니다:

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

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

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를 시작한 후, 서비스가 클러스터에 연결하여 참여할 수 있는지 확인합니다.

GCP로 서비스 등록하기

원문 보기
요약

이 가이드에서는 GCP 조인 방법을 사용하여 GCP VM에서 실행 중인 Teleport 프로세스가 비밀을 공유하지 않고 Teleport 클러스터에 참여하도록 구성하는 방법을 설명합니다. GCP 조인 방법은 GCP VM에서 실행 중인 모든 Teleport 프로세스에서 사용할 수 있습니다.

이 가이드에서는 GCP 조인 방법을 사용하여 GCP VM에서 실행 중인 Teleport 프로세스가 비밀을 공유하지 않고 Teleport 클러스터에 참여하도록 구성하는 방법을 설명합니다.

작동 방식#

GCP 조인 방법은 GCP VM에서 실행 중인 모든 Teleport 프로세스에서 사용할 수 있습니다. VM에는 서비스 계정 이 할당되어 있어야 합니다(기본 서비스 계정으로 충분합니다). 클러스터에 참여하는 Teleport 프로세스에는 IAM 역할이 필요하지 않습니다.

내부적으로, 서비스는 GCP 프로젝트에서 실행 중임을 증명하기 위해 GCP 조인 토큰에 구성된 허용 규칙과 일치하는 서명된 ID 토큰을 전송합니다.

사전 요구 사항#

  • 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 서비스를 호스팅할 GCP VM으로, 서비스 계정이 할당되어 있고 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/4단계. GCP 조인 토큰 생성#

GCP 프로젝트의 서비스가 Teleport 클러스터에 참여할 수 있도록 하는 특수 동적 토큰으로 Teleport Auth Service를 구성합니다.

GCP 인스턴스가 실행될 GCP 프로젝트 ID, 서비스 계정, 위치를 지정하는 gcp.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 GCP project to use this token
  name: gcp-token
spec:
  # use the minimal set of roles required (e.g. Node, Proxy, App, Kube, DB, WindowsDesktop)
  roles: [Node]

  # set the join method allowed for this token
  join_method: gcp

  gcp:
    allow:
      # The GCP project ID(s) that VMs can join from.
      - project_ids: ["example-project-id"]
        # (Optional) The locations that VMs can join from. Note: both regions and
        # zones are accepted.
        locations: ["us-west1", "us-west2-a"]
        # (Optional) The email addresses of service accounts that VMs can join
        # with.
        service_accounts: ["example@example.com"]

다음 명령을 실행하여 토큰을 생성합니다:

$ tctl create token.yaml

2/4단계. Teleport 설치#

GCP Linux VM에 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
    

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

GCP 조인 방법은 SSH(Node), Proxy, Kubernetes, 애플리케이션, 데이터베이스 또는 Windows Desktop Services를 실행하는 Teleport 프로세스에 사용할 수 있습니다. Teleport 프로세스는 GCP VM에서 직접 실행되어야 합니다.

사용자 지정 teleport.yaml 파일로 Teleport 프로세스를 구성합니다. 1단계에서 생성한 토큰과 일치하는 token_namemethod: gcp를 포함한 join_params 섹션을 다음 예시 구성과 같이 사용합니다:

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

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

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를 시작한 후, 서비스가 클러스터에 연결하여 참여할 수 있는지 확인합니다.