보안 토큰으로 서비스 조인하기
이 가이드에서는 조인 토큰을 제시하여 하나 이상의 서비스를 실행하는 Teleport 프로세스를 클러스터에 등록하는 방법을 보여줍니다. 이 방식에서는 새 Teleport 프로세스를 등록하겠다는 의도를 선언하면, Teleport가 해당 프로세스가 Teleport 클러스터와 신뢰 관계를 수립하는 데 사용할 보안 토큰을 생성합니다.
이 가이드에서는 조인 토큰을 제시하여 하나 이상의 서비스를 실행하는 Teleport 프로세스를 클러스터에 등록하는 방법을 보여줍니다.
이 방식에서는 새 Teleport 프로세스를 등록하겠다는 의도를 선언하면, Teleport가 해당 프로세스가 Teleport 클러스터와 신뢰 관계를 수립하는 데 사용할 보안 토큰을 생성합니다.
사전 요구 사항#
-
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
tctlandtshclients.Installing `tctl` and `tsh` clients
-
Determine the version of your Teleport cluster. The
tctlandtshclients must be at most one major version behind your Teleport cluster version. Send a GET request to the Proxy Service at/v1/webapi/findand 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')" -
Follow the instructions for your platform to install
tctlandtshclients:
-
-
Teleport 프로세스를 호스팅할 Linux 서버(예: Linux 배포판 기반 이미지를 사용하는 가상 머신 또는 Docker 컨테이너).
이 가이드에서는 Teleport SSH 서비스 인스턴스를 등록하는 방법을 보여줍니다. 이 방식은 Proxy 서비스, Kubernetes 서비스, Database 서비스 등 인프라의 리소스에 접근하기 위한 다른 Teleport 서비스에도 적용됩니다.
로드 밸런서 뒤에서 여러 Proxy 서비스 인스턴스 실행하기
조인 토큰 방식은 클러스터에 단일 Proxy 서비스 인스턴스가 있는 경우와 로드 밸런서(LB) 또는 여러 값을 가진 DNS 항목 뒤에 여러 Proxy 서비스 인스턴스가 있는 경우 모두 동작합니다. Proxy 서비스 인스턴스가 여러 개인 경우, 클러스터에 조인하는 Teleport 프로세스는 모든 Proxy 서비스 인스턴스에 터널을 설정합니다.
로드 밸런서를 사용하는 경우, 라운드 로빈 또는 유사한 균형 조정 알고리즘을 사용해야 합니다. Teleport Proxy 서비스 인스턴스와 함께 스티키 로드 밸런싱 알고리즘 (예: "세션 어피니티")을 사용하지 마십시오.
TipDocker 컨테이너를 사용하는 경우, 이 가이드는 Linux 호스트에
curl과sudo가 설치되어 있다고 가정합니다.To check that you can connect to your Teleport cluster, sign in with
tsh login, then verify that you can runtctlcommands 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 statuscommand, you can use your current credentials to run subsequenttctlcommands from your workstation. If you host your own Teleport cluster, you can also runtctlcommands on the computer that hosts the Teleport Auth Service for full permissions.1단계/3단계. Teleport 설치#
Linux 호스트에 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.
-
Assign to your Teleport cluster hostname and port, but not the scheme (https://).
-
Run your cluster's install script:
$ curl "https:///scripts/install.sh" | sudo bash
2단계/3단계. Teleport 프로세스를 클러스터에 조인하기#
이 섹션에서는 다음을 통해 Teleport 프로세스를 클러스터에 조인합니다:
- 조인 토큰 획득
- 조인 토큰으로 Teleport 프로세스 실행
토큰 생성#
Teleport는 클러스터에 조인한 Teleport 프로세스를 통해서만 인프라의 리소스에 접근을 허용합니다.
로컬 머신에서
tctl도구를 사용하여 새 토큰을 생성합니다. 다음 예시에서는 TTL이 5분인 새 토큰을 생성합니다:# 새 Teleport SSH 서비스 인스턴스를 위한 단기 초대 토큰 생성: $ tctl tokens add --ttl=5m --type=node The invite token: (=presets.tokens.first=) This token will expire in 5 minutes. Run this on the new node to join the cluster: > teleport start \ --roles=node \ --token=(=presets.tokens.first=) \ --ca-pin=(=presets.ca_pin=) \ --auth-server=192.0.2.0:3025 Please note: - This invitation token will expire in 5 minutes - 192.0.2.0:3025 must be reachable from the new node이 명령에서는 토큰에
node유형을 지정하여 SSH 서비스 인스턴스에 속함을 나타냅니다.이 가이드의 이후 단계에서 사용할 수 있도록 토큰을 복사하십시오.
tctl tokens add출력의 나머지 부분은 무시해도 됩니다.지원되는 토큰 유형
조인 토큰 생성 시
--type플래그에 사용할 수 있는 모든 값은 다음과 같습니다:Role Teleport Service appApplication Service authAuth Service botMachine & Workload Identity Bot dbDatabase Service discoveryDiscovery Service kubeKubernetes Service nodeSSH Service proxyProxy Service windowsdesktopWindows Desktop Service 관리자는 필요에 따라 토큰을 생성할 수 있습니다. Teleport 프로세스는 TTL(유효 기간)이 만료될 때까지 토큰을 여러 번 사용할 수 있으며, 머신 및 워크로드 아이덴티티에서 사용하는
bot유형의 토큰은 예외입니다.생성한 모든 토큰 목록을 확인하려면 다음 명령을 실행하십시오:
$ tctl tokens ls Token Type Labels Expiry Time (UTC) -------------------------------- ---- ------ -------------------------- (=presets.tokens.first=) Node 30 Mar 23 18:15 UTC (2m8s)안전하지 않은 대안: 정적 토큰
Warning장기 정적 토큰 대신 단기 토큰을 사용하십시오. 정적 토큰은 도난, 추측, 유출이 더 쉽습니다.
정적 토큰은 관리자가 미리 정의하여 Auth 서비스의 설정 파일에 저장됩니다:
# Auth 서비스의 `/etc/teleport.yaml` 파일 내 설정 섹션 auth_service: enabled: true tokens: # 이 정적 토큰은 새 호스트가 "proxy" 또는 "node"로 클러스터에 조인할 수 있도록 허용합니다 - 'proxy,node:secret-token-value' # 토큰을 파일에 저장할 수도 있습니다. 이 예시에서는 새 Auth 서비스 인스턴스 추가를 위한 # 토큰이 /path/to/tokenfile에 저장됩니다 - 'auth:/path/to/tokenfile'초대 토큰으로 Teleport 프로세스 시작하기#
새 Teleport 프로세스를 실행하는 호스트에서 다음 명령을 실행하여 클러스터에 추가합니다. 에는 앞서 생성한 토큰을, 에는 Teleport Proxy 서비스 또는 Teleport Enterprise Cloud 테넌트의 호스트와 웹 포트 (예:
teleport.example.com:443)를 지정합니다:$ sudo teleport configure \ --roles=node \ --token= \ --proxy= \ -o fileTipSSH 서비스 인스턴스의 경우,
teleport configure대신teleport node configure를 실행할 수도 있습니다. 이 방식을 사용하면 명령에서--roles=node플래그를 생략할 수 있습니다.Auth 서비스에 직접 연결하기
지금까지 이 가이드는 Proxy 서비스에 연결하여 새 Teleport 프로세스를 클러스터에 조인하는 것으로 가정했습니다. (Teleport Enterprise Cloud에서는 이것이 유일한 방법입니다.) 인프라 설계에 따라, 새 Teleport 프로세스를 Auth 서비스에 직접 연결해야 할 수도 있습니다.
Warning다른 조인 방법이 적합하지 않은 경우에만 Teleport 프로세스를 Auth 서비스에 직접 연결하십시오. Auth 서비스를 최대한 적은 수의 인그레스 트래픽 소스에 노출하는 것을 권장합니다.
클러스터에 조인하는 Teleport 프로세스는 공격자가 Auth 서비스의 주소를 가로채는 것을 방지하기 위해 Auth 서비스와도 신뢰를 설정해야 합니다.
이를 위해, CA 핀이라고 불리는 Auth 서비스의 인증 기관이 생성한 보안 해시 값을 새 Teleport 프로세스에 제공합니다. 이렇게 하면 공격자가 개인 키를 위조하여 Teleport 프로세스가 악성 서비스와 통신하도록 속이기가 어려워집니다.
CA 핀 획득#
로컬 머신에서 Auth 서비스의 CA 핀을 검색합니다:
$ tctl status Cluster teleport.example.com Version 12.1.1 host CA never updated user CA never updated db CA never updated openssh CA never updated jwt CA never updated saml_idp CA never updated CA pin (=presets.ca_pin=)CA 핀을 복사하여 의 값에 지정합니다.
WarningTeleport 관리자가
tctl auth rotate를 실행하여 CA 교체를 수행하면 CA 핀이 무효화됩니다.조인 토큰과 CA 핀으로 Teleport 프로세스 구성하기#
앞서 보여준
teleport configure명령 대신 다음 명령을 실행하여 Teleport 프로세스를 구성합니다. 에는 Auth 서비스 호스트의 호스트와 gRPC 포트 (예:teleport.example.com:3025)를 지정합니다.$ sudo teleport configure \ --roles=node \ --token= \ --auth-server= \ -o file다음으로, Teleport 설정 파일
/etc/teleport.yaml을 편집하여 CA 핀 (teleport.ca_pin필드)을 앞서 복사한 값으로 지정합니다:$ sudo sed -i 's| ca_pin: ""| ca_pin: "You can check the status of your Teleport instance with
systemctl status teleportand view its logs withjournalctl -fu teleport.로컬 Docker 컨테이너를 사용하고 있습니까?
로컬 Docker 컨테이너로 이 가이드를 진행한 경우, 컨테이너 내에서 다음 명령을 실행하여 새 Teleport 프로세스를 포그라운드에서 실행합니다:
$ teleport start새 서비스가 온라인 상태가 되면 Auth 서비스에 몇 초마다 하트비트 요청을 보내기 시작합니다. 이를 통해 사용자가 클러스터 구성원 및 규모를 파악할 수 있습니다.
로컬 머신에서 다음 명령을 실행하여 클러스터의 모든 Teleport SSH 서비스 인스턴스를 확인합니다:
$ tctl nodes ls Host UUID Public Address Labels Version ------------- --------------------- -------------- ---------------------- ------- 1f58429134c4 6805dda3-779e-493b... hostname=1f58429134c4 (=teleport.version=)3단계/3단계. 초대 취소하기#
조인 토큰을 해지하여 Teleport 프로세스가 이를 사용하지 못하도록 할 수 있습니다.
로컬 머신에서 다음 명령을 실행하여 새 Proxy 서비스를 위한 토큰을 생성합니다:
$ tctl nodes add --ttl=5m --roles=proxy # The invite token: (=presets.tokens.first=). # This token will expire in 5 minutes. # # Run this on the new node to join the cluster: # # > teleport start \ # --roles=proxy \ # --token=(=presets.tokens.first=) \ # --ca-pin=(=presets.ca_pin=) \ # --auth-server=123.123.123.123:443 # # Please note: # # - This invitation token will expire in 5 minutes # - 123.123.123.123 must be reachable from the new node다음으로, 아래 명령을 실행하여 미처리 토큰 목록을 확인합니다:
$ tctl tokens ls Token Type Labels Expiry Time (UTC) -------------------------------- ----- ------ --------------------------- (=presets.tokens.first=) Node 30 Mar 23 18:20 UTC (36s) (=presets.tokens.second=) Proxy 30 Mar 23 18:24 UTC (4m39s)가입 토큰tctl tokens ls의 출력에는 클러스터에 Teleport 프로세스를 추가하는 데 사용되는 토큰과 함께 사용자 추가에 사용되는 토큰도 포함됩니다.이 가이드의 앞부분에서 새 Teleport 프로세스를 이 클러스터에 초대하기 위해
Node역할로 토큰을 생성했습니다. 두 번째 토큰은 Proxy 서비스 인스턴스를 위해 생성한 것입니다.tctl을 통해 생성된 토큰은tctl tokens rm명령으로 삭제(해지)할 수 있습니다. 위 출력에서 두 번째 토큰을 복사하고 다음 명령을 실행하여 삭제합니다. 삭제할 토큰을 에 지정하십시오.$ tctl tokens rm # Token (=presets.tokens.first=) has been deleted다음 단계#
- 워크로드가 서로 다른 네트워크 또는 클라우드에 분산되어 있는 경우, 신뢰할 수 있는 클러스터를 설정하는 것을 권장합니다. 신뢰할 수 있는 클러스터 구성에서 시작하는 방법을 확인하십시오.
-
