Bound Keypair 정적 키를 사용하여 서비스 조인하기
Teleport v18.11요약
이 가이드는 Bound Keypair 조인 방법을 사용하여 Teleport 프로세스가 Teleport 클러스터에 조인하도록 구성하는 방법을 설명합니다. Bound Keypair 조인 방법은 Teleport 에이전트에 대해 두 가지 동작 모드를 지원합니다.
이 가이드는 Bound Keypair 조인 방법을 사용하여 Teleport 프로세스가 Teleport 클러스터에 조인하도록 구성하는 방법을 설명합니다.
Bound Keypair 조인 방법은 Teleport 에이전트에 대해 두 가지 동작 모드를 지원합니다.
- 등록 시크릿을 통한 조인: 일회용 시크릿을 Teleport에 제공하거나 Teleport가 생성하여
조인하는 에이전트에 복사합니다. 기존
token조인 방법과 유사합니다. - 정적 키를 사용한 조인: 조인하는 에이전트에서 키 쌍을 생성하고 별도 경로로 Teleport에 전달합니다. 그러면 Teleport가 해당 에이전트의 공개 키를 신뢰하도록 구성됩니다.
이 가이드는 에이전트가 상태를 저장하지 않거나 장기 영구 스토리지가 없는 상황에서 유용한 정적 키의 사용 방법을 다룹니다. Bound Keypair 등록 시크릿으로 에이전트를 조인하려면 전용 가이드를 참고하세요.
이 가이드는 표준 teleport 바이너리로 에이전트를 조인하는 경우에 적용됩니다.
bound_keypair 조인 방법으로 봇을 조인하는 방법은
봇 전용 가이드를 참고하세요.
작동 방식#
Bound Keypair 조인에서는 Teleport 에이전트가 고유한 키 쌍을 생성하여 노드별 내부 아이덴티티 스토리지에 기록합니다. 그런 다음 Teleport가 이후 조인 시도에서 이 공개 키를 신뢰하도록 구성됩니다.
이후 에이전트가 클러스터에 조인하려고 하면 Teleport는 개인 키로만 완료할 수 있는 챌린지를 발급합니다. 에이전트는 해결한 챌린지를 반환하여 자신의 아이덴티티를 증명하고, 조건에 따라 클러스터에 조인할 수 있습니다. 드물게 에이전트가 새 인증서를 받아야 하는 경우에는 저장된 키를 사용하여 챌린지 과정을 반복함으로써 다시 인증하고 새 인증서를 가져옵니다.
이 조인 방법의 작동 방식과 프로덕션 환경에서의 사용 방법에 대한 자세한 내용은 참조 페이지를 참고하세요.
봇이 아닌 에이전트에 Bound Keypair 조인을 사용할 때는 다음과 같은 제약이 있습니다.
- Bound Keypair 조인 방법으로 클러스터에 조인하는 Teleport 에이전트는 일반적으로
최초 조인 시도 중에 Bound Keypair 기능을 한 번만 사용합니다.
Teleport에 자주 인증하는
tbot클라이언트와 달리 에이전트는 조인할 때 일반적으로 갱신되지 않는 장기 인증서를 발급받습니다. 따라서 조인 상태 검증, 키 쌍 교체 등 Bound Keypair 기능은 에이전트의 일반 운영 중에는 사용되지 않습니다. - 표준 사전 등록 키는 현재 지원되지 않습니다.
에이전트 조인의 제약에 대한 자세한 내용은 관리자 가이드를 참고하세요.
사전 요구사항#
-
실행 중인 Teleport (v18.8.0 or higher) 클러스터. Teleport를 시작하려면 무료 체험판에 가입하거나 데모 환경을 구성하세요.
-
`tsh`, `tctl`, and `tbot` clients.
Installing \`tsh\`, \`tctl\`, and \`tbot\` clients
-
Teleport 클러스터의 버전을 확인합니다. `tsh`, `tctl`, and `tbot` clients는 Teleport 클러스터 버전보다 최대 한 개의 메이저 버전까지만 뒤처질 수 있습니다. Proxy Service의
/v1/webapi/find로 GET 요청을 보내고 JSON 쿼리 도구를 사용하여 클러스터 버전을 확인합니다.teleport.example.com:443를 Teleport Proxy Service의 웹 주소로 바꿉니다:$ TELEPORT_DOMAIN=teleport.example.com:443 $ TELEPORT_VERSION="$(curl -s https://$TELEPORT_DOMAIN/v1/webapi/find | jq -r '.server_version')" -
사용 중인 플랫폼에 대한 지침에 따라 `tsh`, `tctl`, and `tbot` clients를 설치합니다:
-
Mac
\`tsh\`, \`tctl\`, and \`tbot\` clients가 포함된, 서명된 Teleport macOS .pkg 설치 프로그램을 다운로드합니다:
```code
$ curl -O https://cdn.teleport.dev/teleport-${TELEPORT_VERSION?}.pkg
```
Finder에서 `pkg` 파일을 더블 클릭하여 설치를 시작합니다.
Homebrew를 사용하여 Teleport를 설치하는 것은 지원되지 않습니다. Homebrew의
Teleport 패키지는 Teleport에서 유지 관리하지 않으므로 신뢰성이나 보안을
보장할 수 없습니다.
Windows - Powershell
```code
$ curl.exe -O https://cdn.teleport.dev/teleport-v${TELEPORT_VERSION?}-windows-amd64-bin.zip
# Unzip the archive and move the \`tsh\`, \`tctl\`, and \`tbot\` clients to your %PATH%
# NOTE: Do not place the \`tsh\`, \`tctl\`, and \`tbot\` clients in the System32 directory, as this can cause issues when using WinSCP.
# Use %SystemRoot% (C:\Windows) or %USERPROFILE% (C:\Users\<username>) instead.
```
Linux
Linux 설치판의 모든 Teleport 바이너리에는 \`tsh\`, \`tctl\`, and \`tbot\` clients가 포함되어 있습니다. RPM/DEB
패키지 및 i386/ARM/ARM64용 다운로드를 포함한 더 많은 옵션은
[설치 페이지](../installation/installation.mdx)를 참조하세요.
```code
$ curl -O https://cdn.teleport.dev/teleport-v${TELEPORT_VERSION?}-linux-amd64-bin.tar.gz
$ tar -xzf teleport-v${TELEPORT_VERSION?}-linux-amd64-bin.tar.gz
$ cd teleport
$ sudo ./install
# Teleport binaries have been copied to /usr/local/bin
```
- 베어메탈 또는 영구 스토리지가 있는 VM 형태의 Linux 호스트
1/5단계. Teleport 설치#
Linux VM 또는 베어메탈 호스트에 Teleport를 설치합니다.
Linux 서버에 Teleport Agent를 설치하려면:
권장 설치 방법은 클러스터 설치 스크립트입니다. 이 스크립트는 클러스터에 맞는 올바른 버전, 에디션, 설치 모드를 선택합니다.
-
teleport.example.com:443에 Teleport 클러스터의 호스트명과 포트를 할당하되, 스킴(https://)은 포함하지 마십시오. -
클러스터의 설치 스크립트를 실행하십시오:
$ curl "https://teleport.example.com:443/scripts/install.sh" | sudo bash
2/5단계. 정적 키 생성#
대상 VM 또는 베어메탈 호스트에서 tbot 클라이언트로 키 쌍을 생성합니다.
tbot keypair create를 실행하여 키를 파일에 기록합니다.
$ tbot keypair create \
--proxy-server teleport.example.com:443 \
--static \
--static-key-path /path/to/static-key
[...]
To register the keypair with Teleport, include this public key in the token's
'spec.bound_keypair.onboarding.initial_public_key' field:
ssh-ed25519 <data>
[...help text continues...]
이 명령은 조인 토큰 생성 방법을 안내하는 도움말 메시지를 출력합니다.
도움말에 적힌 ssh-ed25519 <data>는 이후 단계에서 사용하므로 기록해 둡니다.
정확한 ssh-[...] 접두사는 클러스터 구성에 따라
다를 수 있습니다.
3/5단계. 토큰 생성#
로컬 머신에서 이 공개 키를 사용하여 새 조인 토큰을 생성합니다.
먼저 Teleport 클러스터의 리소스를 프로비저닝하는 방식에 따라 다음 토큰 템플릿을 참고합니다.
원하는 bound_keypair 구성을 지정하는 bound_keypair 섹션이 포함된
다음 token.yaml 파일을 생성합니다. 아래 템플릿을 참고하여
다음과 같이 변경합니다.
spec.bound_keypair.onboarding.initial_public_key를 찾아, 앞서 대상 호스트에서 생성한 공개 키(ssh-ed25519 ...로 시작)를 붙여 넣습니다.spec.bound_keypair.recovery.mode를insecure로 설정합니다. 정적 키 조인에 필요합니다.
kind: token
version: v2
metadata:
name: example-token
spec:
roles: [Bot]
join_method: bound_keypair
bot_name: example
# Fields related to the bound keypair joining process.
bound_keypair:
# Fields related to the initial join attempt.
onboarding:
# If set to a public key in SSH authorized_keys format, the
# joining client must have the corresponding private key to join. This
# keypair may be created using `tbot keypair create`. If set,
# `registration_secret` and `must_register_before` are ignored.
initial_public_key: ""
# If set to a secret string value, a client may use this secret to perform
# the first join without pre-registering a public key in
# `initial_public_key`. If unset and no `initial_public_key` is provided,
# a random value will be generated automatically into
# `.status.bound_keypair.registration_secret`.
registration_secret: ""
# If set to an RFC 3339 timestamp, attempts to register via
# `registration_secret` will be denied once the timestamp has elapsed. If
# more time is needed, this field can be edited to extend the registration
# period.
must_register_before: ""
# Fields related to recovery after certificates have expired.
recovery:
# The maximum number of allowed recovery attempts. This value may
# be raised or lowered after creation to allow additional recovery
# attempts should the initial limit be exhausted. If `mode` is set to
# `standard`, recovery attempts will only be allowed if
# `.status.bound_keypair.recovery_count` is less than this limit. This
# limit is not enforced if `mode` is set to `relaxed` or `insecure`. This
# value must be at least 1 to allow for the initial join during
# onboarding, which counts as a recovery.
limit: 1
# The recovery rule enforcement mode. Valid values:
# - standard (or unset): all configured rules enforced. The recovery limit
# and client join state are required and verified. This is the most
# secure recovery mode.
# - relaxed: recovery limit is not enforced, but client join state is
# still required. This effectively allows unlimited recovery attempts,
# but client join state still helps mitigate stolen credentials.
# - insecure: neither the recovery limit nor client join state are
# enforced. This allows any client with the private key to join freely.
# This is less secure, but can be useful in certain situations, like in
# otherwise unsupported CI/CD providers. This mode should be used with
# care, and RBAC rules should be configured to heavily restrict which
# resources this identity can access.
mode: "standard"
# If set to an RFC 3339 timestamp, once elapsed, a keypair rotation will be
# forced on next join if it has not already been rotated. The most recent
# rotation is recorded in `.status.bound_keypair.last_rotated_at`.
rotate_after: ""
토큰 구성을 마치면 다음 명령을 실행하여 토큰을 생성합니다.
$ tctl create token.yaml
원하는 bound_keypair 구성을 지정하는 bound_keypair 섹션이 포함된 다음 리소스를
Terraform 구성에 추가합니다.
아래 템플릿을 참고하여 다음과 같이 변경합니다.
spec.bound_keypair.onboarding.initial_public_key를 찾아, 앞서 대상 호스트에서 생성한 공개 키(ssh-ed25519 ...로 시작)를 붙여 넣습니다.spec.bound_keypair.recovery.mode를insecure로 설정합니다. 정적 키 조인에 필요합니다.
이 섹션의 내용은 원문 문서를 참조하세요. (bound-keypair-spec-hcl.mdx)
다음 쿠버네티스 리소스 매니페스트 템플릿으로 원하는
bound_keypair 구성을 지정합니다. 아래 템플릿을 참고하여
다음과 같이 변경합니다.
spec.bound_keypair.onboarding.initial_public_key를 찾아, 앞서 대상 호스트에서 생성한 공개 키(ssh-ed25519 ...로 시작)를 붙여 넣습니다.spec.bound_keypair.recovery.mode를insecure로 설정합니다. 정적 키 조인에 필요합니다.
이 섹션의 내용은 원문 문서를 참조하세요. (bound-keypair-spec-kube.mdx)
토큰 구성을 마치면 다음 명령을 실행하여 토큰을 생성합니다.
$ kubectl apply -f token.yaml
4/5단계. 서비스 구성#
Bound Keypair 조인 방법은 SSH(Node), 프록시, 쿠버네티스, 애플리케이션, 데이터베이스,
Windows Desktop 서비스를 실행하는 Teleport 프로세스에 사용할 수 있습니다.
Teleport 프로세스는 Linux 호스트에서 직접 실행해야 합니다.
사용자 지정 teleport.yaml 파일로 Teleport 프로세스를 구성합니다.
다음 예시 구성과 같이 join_params 섹션에서 token_name은 3단계에서 생성한 토큰과 일치시키고
method: bound_keypair를 지정합니다.
# /etc/teleport.yaml
version: v3
teleport:
join_params:
token_name: example-token
method: bound_keypair
bound_keypair:
static_key_path: /path/to/static-key
proxy_server: teleport.example.com:443
ssh_service:
enabled: true
auth_service:
enabled: false
proxy_service:
enabled: false
static_key_path는 2단계에서 생성한 정적 키의 경로로
설정해야 합니다.
5/5단계. Teleport 프로세스 시작#
systemd 서비스를 생성하여 호스트가 부팅될 때 your Teleport instance이 자동으로 시작되도록 구성합니다. 지침은 your Teleport instance을 어떻게 설치했는지에 따라 다릅니다.
Package Manager
your Teleport instance을 실행할 호스트에서 Teleport를 활성화하고 시작합니다:
$ sudo systemctl enable teleport
$ sudo systemctl start teleport
TAR Archive
your Teleport instance을 실행할 호스트에서 Teleport용 systemd 서비스 구성을 생성하고, Teleport 서비스를 활성화한 후 Teleport를 시작합니다:
$ sudo teleport install systemd -o /etc/systemd/system/teleport.service
$ sudo systemctl enable teleport
$ sudo systemctl start teleport
systemctl status teleport로 your Teleport instance의 상태를 확인하고 journalctl -fu teleport로
로그를 볼 수 있습니다.
Teleport를 시작한 후 서비스가 클러스터에 연결하고 조인할 수 있는지 확인합니다.