Teleport 애플리케이션 서비스 레퍼런스
Teleport v18.9이 페이지는 teleport 바이너리의 정적 구성 파일, 동적 app 리소스, tsh apps 명령을 포함하여 Teleport Application Service와 상호 작용하기 위한 인터페이스 및 옵션을 나열합니다.
이 페이지는 teleport 바이너리의 정적 구성 파일, 동적 app 리소스, tsh apps 명령을 포함하여 Teleport Application Service와 상호 작용하기 위한 인터페이스 및 옵션을 나열합니다.
구성#
영구적인 수정을 가하기 전에 프로덕션 인스턴스, 환경 및/또는 설정을 백업하는 것을 모범 사례로 권장합니다. 이렇게 하면 필요한 경우 기존 상태로 롤백할 수 있습니다.
다음 스니펫은 teleport.yaml 구성 파일에 나타나는 Application Service의 전체 YAML 구성을 보여줍니다.
app_service:
# Enables application proxy service.
enabled: true
# Teleport provides a small debug app called "dumper" that can be used
# to make sure application access is working correctly. It outputs JWTs,
# so it can be useful when extending your application.
debug_app: true
# Matchers for application resources created with "tctl create" command.
resources:
- labels:
"*": "*"
# This section contains definitions of all applications proxied by this
# service. It can contain multiple items.
apps:
# Name of the application. Used for identification purposes.
- name: "grafana"
# Free-form application description.
description: "This is an internal Grafana instance"
# URI and port the application is available at.
uri: "http://localhost:3000"
# Optional application public address to override.
public_addr: "grafana.teleport.example.com"
# Rewrites section.
rewrite:
# Specify whether to include roles or traits in the JWT.
# Options:
# - roles-and-traits: include both roles and traits
# - roles: include only roles
# - traits: include only traits
# - none: exclude both roles and traits from the JWT token
# Default: roles-and-traits
jwt_claims: roles-and-traits
# Rewrite the "Location" header on redirect responses replacing the
# host with the public address of this application.
redirect:
- "grafana.internal.dev"
# Headers passthrough configuration.
headers:
- "X-Custom-Header: example"
- "X-External-Trait: {{external.env}}"
# Disable application certificate validation.
insecure_skip_verify: true
# Optional static labels to assign to the app. Used in RBAC.
labels:
env: "prod"
# Optional dynamic labels to assign to the app. Used in RBAC.
commands:
- name: "hostname"
command: ["hostname"]
period: 1m0s
# Optional AWS-specific configurations.
aws:
# External ID used when assuming AWS roles for this application.
external_id: "example-external-id"
- name: "azure-cli"
# Optional: For access to cloud provider APIs, specify the cloud provider.
# Allowed values are "AWS", "Azure", and "GCP".
cloud: "Azure"
Teleport 역할을 구성하는 방법에 대한 전체 세부 정보와 Teleport가 external 트레이트를 채우는 방법을 포함한 내용은 접근 제어 레퍼런스를 참조하세요.
Application 리소스#
tctl 리소스 명령으로 관리되는 애플리케이션 리소스의 전체 YAML 스펙:
kind: app
version: v3
metadata:
# Application name.
name: example
# Application description.
description: "Example application"
# Application static labels.
labels:
env: local
spec:
# URI and port application is available at.
uri: http://localhost:4321
# Optional application public address.
public_addr: test.example.com
# Disable application certificate validation.
insecure_skip_verify: true
# Rewrites configuration.
rewrite:
# Rewrite the "Location" header on redirect responses replacing the
# host with the public address of this application.
redirect:
- "grafana.internal.dev"
# Headers passthrough configuration.
headers:
- name: "X-Custom-Header"
value: "example"
- name: "X-External-Trait"
value: "{{external.env}}"
# Optional dynamic labels.
dynamic_labels:
hostname:
command: ["hostname"]
period: 1m0s
uname:
command: ["uname", "-a"]
period: 5m0s
구성이 담긴 app.yaml이라는 YAML 파일을 이미 생성했다고 가정할 때, 다음 명령을 실행하여 새 app 리소스를 생성할 수 있습니다.
# Log in to your cluster with tsh so you can use tctl from your local machine.
# You can also run tctl on your Auth Service host without running "tsh login"
# first.
$ tsh login --proxy=teleport.example.com --user=myuser
# Create the resource
$ tctl create -f app.yaml
# Log in to your cluster with tsh so you can use tctl from your local machine.
$ tsh login --proxy=mytenant.teleport.sh --user=myuser
# Create the resource.
$ tctl create -f app.yaml
CLI#
이 섹션에서는 애플리케이션 액세스와 관련된 CLI 명령을 보여줍니다.
tsh apps ls#
사용 가능한 애플리케이션을 나열합니다.
$ tsh apps ls
tsh apps login#
CLI 애플리케이션 접근을 위한 단기 X.509 인증서를 가져옵니다.
$ tsh apps login grafana
| 플래그 | 설명 |
|---|---|
--aws-role |
AWS CLI 접근의 경우, AWS IAM 역할의 역할 ARN 또는 역할 이름입니다. |
--azure-identity |
Azure CLI 접근의 경우, Azure CLI 접근에 사용할 Azure 관리형 아이덴티티의 이름 또는 URI입니다. |
tsh apps logout#
CLI 애플리케이션 접근 인증서를 제거합니다.
# Log out of a particular app.
$ tsh apps logout grafana
# Log out of all apps.
$ tsh apps logout
tsh apps config#
애플리케이션 연결 정보를 출력합니다.
# Print app information in a table form.
$ tsh apps config
# Print information for a particular app.
$ tsh apps config grafana
# Print an example curl command.
$ tsh apps config --format=curl
# Construct a curl command.
$ curl $(tsh apps config --format=uri) \
--cacert $(tsh apps config --format=ca) \
--cert $(tsh apps config --format=cert) \
--key $(tsh apps config --format=key)
| 플래그 | 설명 |
|---|---|
--format |
선택적 출력 형식으로, uri(앱 주소 출력), ca(CA 인증서 경로 출력), cert(인증서 경로 출력), key(키 경로 출력), curl(예시 curl 명령 출력) 중 하나입니다. |
tsh az#
Teleport Application Service를 통해 Azure CLI 명령을 실행합니다.
$ tsh az <command>
<command>: az CLI 내의 유효한 명령으로, 인수와 플래그를 포함합니다.
az CLI 명령의 전체 목록은 Azure 문서를 참조하세요.
이 명령을 실행하려면 사용자의 역할 중 하나가 Application Service에서 사용하는 아이덴티티 중 하나로 spec.allow.azure_identities 필드를 포함해야 합니다. Teleport를 통해 Azure에 대한 안전한 접근을 설정하는 방법을 알아보려면 Teleport Application Access로 Azure CLI 보호하기를 읽어보세요.