Helm을 사용하여 셀프 호스팅 클러스터에서 Teleport Identity Security 실행
Teleport v18.9셀프 호스팅 Teleport 클러스터에서 Teleport Identity Security와 Access Graph를 사용하려면 Access Graph를 설정해야 합니다. 이 가이드에서는 Helm 차트를 사용하여 Kubernetes 클러스터에 Access Graph 서비스를 설정하고, Teleport 클러스터에서 Access Graph 기능을 활성화합니다.
셀프 호스팅 Teleport 클러스터에서 Teleport Identity Security와 Access Graph를 사용하려면 Access Graph를 설정해야 합니다. Access Graph는 PostgreSQL을 백킹 스토리지로 사용하며 Auth Service 및 Proxy Service와 통신하여 리소스와 접근에 관한 정보를 수집하는 전용 서비스입니다.
이 가이드에서는 Helm 차트를 사용하여 Kubernetes 클러스터에 Access Graph 서비스를 설정하고, Teleport 클러스터에서 Access Graph 기능을 활성화합니다.
지원되는 파라미터의 전체 목록은 Helm 차트 참조에서 확인할 수 있습니다.
Access Graph는 Identity Security 제품의 기능이며 Teleport Enterprise 고객에게만 제공됩니다.
작동 방식#
Auth Service, Proxy Service, 에이전트 서비스와 같은 Teleport 서비스와 달리
Teleport Access Graph는 teleport 바이너리에서 실행되지 않고, Teleport에서
컨테이너 이미지 형태로 제공되는 별도의 소프트웨어로 실행됩니다.
Teleport Access Graph는 TLS 자격 증명을 사용하여 Teleport Auth Service에 인증합니다.
또한 백킹 스토리지를 위해 PostgreSQL에 연결해야 합니다. Teleport 클러스터에서
자격 증명을 취득한 후, Teleport Access Graph용 설정 파일을 생성하고
teleport-access-graph Helm 차트를 설치합니다.
사전 요구사항#
- Kubernetes >= v1.21
- Helm >=
[helm.version] - v18.0.0 이상의 실행 중인 Teleport Enterprise 클러스터.
- 이 가이드에서는 Teleport 클러스터가 Access Graph를 배포할 동일한 Kubernetes 클러스터에서
teleport-clusterHelm 차트를 사용해 설정되어 있다고 가정합니다.
- 이 가이드에서는 Teleport 클러스터가 Access Graph를 배포할 동일한 Kubernetes 클러스터에서
- Teleport Identity Security가 활성화된 최신 Teleport Enterprise 라이선스 파일.
- v14 이상의 PostgreSQL 데이터베이스 서버.
- Access Graph는 데이터를 저장하기 위한 전용 데이터베이스가 필요합니다.
Access Graph가 데이터베이스에 연결할 때 사용하는 사용자는 해당 데이터베이스의 소유자이거나,
최소한
public스키마에 대한CREATE TABLE권한과CREATE SCHEMA권한과 같은 유사한 광범위한 권한을 가지고 있어야 합니다. - Amazon RDS for PostgreSQL을 지원합니다.
- 세션 녹화 검색을 사용하려면 Access Graph
v1.30.0 이상과
pg_trgm및pgvector확장 기능을 사용할 수 있는 PostgreSQL 인스턴스가 필요합니다. Access Graph가 이러한 확장 기능을 자동으로 활성화합니다.
- Access Graph는 데이터를 저장하기 위한 전용 데이터베이스가 필요합니다.
Access Graph가 데이터베이스에 연결할 때 사용하는 사용자는 해당 데이터베이스의 소유자이거나,
최소한
- Access Graph 서비스용 TLS 인증서
- TLS 인증서는 "server authentication" 키 사용 목적으로 발급되어야 하며,
Access Graph의 Kubernetes 서비스 이름(기본값
teleport-access-graph.teleport-access-graph.svc.cluster.local)을 포함하는 X.509 v3subjectAltName확장을 포함해야 합니다.
- TLS 인증서는 "server authentication" 키 사용 목적으로 발급되어야 하며,
Access Graph의 Kubernetes 서비스 이름(기본값
1/4단계. Teleport Helm 차트 리포지터리 추가#
Teleport Helm 리포지토리에서 Teleport 차트를 가져오도록 Helm을 구성하십시오.
$ helm repo add teleport (=teleport.helm_repo_url=)
최신 차트를 가져와 로컬 Helm 캐시를 새로 고치십시오.
$ helm repo update
2/4단계. Access Graph 설정#
Teleport 클러스터의 호스트 인증 기관(CA) 사본이 필요합니다. Access Graph는 호스트 CA가 Auth Service와 Proxy Service에 발급한 호스트 인증서를 통해 인증된 수신 연결만 요구합니다.
호스트 CA는 다음 방법 중 하나로 가져올 수 있습니다.
$ curl 'https://teleport.example.com/webapi/auth/export?type=tls-host'
-----BEGIN CERTIFICATE-----
MIIDqjCCApKgAwIBAgIQMIK8/WiQ/rUOrjlmB0IHVTANBgkqhkiG9w0BAQsFADBv
<...>
-----END CERTIFICATE-----
$ tsh login --proxy=teleport.example.com
$ tctl get cert_authorities --format=json \
| jq -r '.[] | select(.spec.type == "host") | .spec.active_keys.tls[].cert' \
| base64 -d
-----BEGIN CERTIFICATE-----
MIIDqjCCApKgAwIBAgIQMIK8/WiQ/rUOrjlmB0IHVTANBgkqhkiG9w0BAQsFADBv
<...>
-----END CERTIFICATE-----
그런 다음, Access Graph 배포에 필요한 네임스페이스와 시크릿을 생성합니다. 대신 cert-manager를 사용하여 인증서를 발급하거나, Kubernetes 클러스터에 Access Graph용 TLS 인증서를 이미 프로비저닝한 경우에는 마지막 명령을 건너뛸 수 있습니다.
$ kubectl create namespace teleport-access-graph
$ kubectl -n teleport-access-graph create secret generic teleport-access-graph-postgres \
--from-literal uri="postgres://access_graph_user:my_password@db.example.com:5432/access_graph_db?sslmode=require"
$ kubectl -n teleport-access-graph create secret tls teleport-access-graph-tls --cert=./certs/cert.crt --key=./certs/cert.key
위 명령은 Access Graph 서버용 TLS 인증서와 개인 키가 ./certs 디렉터리 아래에 저장되어 있다고 가정합니다.
개발용 TLS 인증서 생성하기
다음 스크립트를 사용하여 Access Graph를 배포하기 위한 인증 기관과 서버 TLS 인증서를 빠르게 생성할 수 있습니다.#!/usr/bin/env bash
set -e
mkdir -p ./certs
cd ./certs
openssl genrsa -aes256 -out ca.key 4096
openssl req -x509 -new -key ca.key -sha256 -days 3652 -out ca.crt -subj '/CN=root'
openssl req -new -out cert.csr -newkey rsa:4096 -nodes -keyout cert.key -subj '/CN=Access Graph'
openssl x509 -req -in cert.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out cert.crt -days 3652 -sha256 \
-extfile <(printf 'extendedKeyUsage = serverAuth, clientAuth\nsubjectAltName = DNS:teleport-access-graph.teleport-access-graph.svc.cluster.local')
echo "Certificates issued successfully"
이 스크립트는 동일한 비밀번호를 4번 입력하도록 요청합니다. 처음 2번은 CA 개인 키 자료를 암호화할 비밀번호를 생성하고 확인하기 위한 것이고, 세 번째는 개인 키를 사용하여 CA 인증서를 자체 서명하기 위한 것이며, 마지막으로 Access Graph 서버 인증서에 서명할 때 사용합니다.
이 스크립트는 개념 증명(proof-of-concept) 배포용으로만 제공되며, 모범 보안 사례를 따르지 않을 수 있음을 유의하시기 바랍니다.
시크릿을 프로비저닝한 후, Access Graph 배포를 위한 tag-values.yaml이라는 파일을 생성하고,
clusterHostCAs 키 아래의 값을 앞서 가져온 Teleport 호스트 CA 인증서로 교체합니다.
postgres:
secretName: "teleport-access-graph-postgres"
tls:
# cert-manager 또는 Kubernetes 워크로드용 TLS 인증서를 프로비저닝하는
# 다른 수단을 사용하는 경우 이 값을 변경해야 할 수 있습니다.
existingSecretName: "teleport-access-graph-tls"
clusterHostCAs:
# 이 값을 1단계에서 가져온 인증서로 교체합니다.
# `clusterHostCAs`는 여러 줄로 이루어진 YAML 문자열의 배열이며, `- |`를 제거해서는 안 되고 들여쓰기를 유지해야 합니다.
- |
-----BEGIN CERTIFICATE-----
MIIDqjCCApKgAwIBAgIQMIK8/WiQ/rUOrjlmB0IHVTANBgkqhkiG9w0BAQsFADBv
<...>
-----END CERTIFICATE-----
마지막으로, Helm을 사용하여 Access Graph 서비스를 배포합니다.
$ helm install -n teleport-access-graph -f tag-values.yaml --version (=access_graph.version=) teleport-access-graph teleport/teleport-access-graph
$ kubectl -n teleport-access-graph rollout status deployment/teleport-access-graph # 배포가 완료될 때까지 대기
3/4단계. Teleport Auth Service 설정 업데이트#
Teleport Auth Service와 Access Graph 서비스 간의 연결을 활성화하려면, 다음 항목으로 Auth Service 설정을 업데이트해야 합니다.
- Access Graph 서비스 주소
- Access Graph 서비스 TLS 인증서를 발급한 CA의 경로
- 이 경로는 Teleport pod에 마운트된, CA를 포함하는 볼륨을 참조해야 합니다.
- Teleport 클러스터에서 이미 신뢰하는 CA를 사용하는 경우
(예:
tls.existingCASecretName옵션을 통해), 또는 Mozilla CA 인증서 목록에 포함된 CA에서 인증서가 발급된 경우 CA 인증서 파일 지정을 건너뛸 수 있습니다.
다음과 같이 CA 인증서를 포함하는 ConfigMap을 생성합니다.
$ kubectl -n teleport-cluster-namespace create configmap teleport-access-graph-ca \
--from-file=ca.pem=./certs/ca.crt
그런 다음, teleport-cluster Helm 차트 배포용 값을 다음과 같이 업데이트합니다.
auth:
teleportConfig:
# <...>
# Access Graph 연결을 설정하기 위한 섹션을 추가합니다.
access_graph:
enabled: true
endpoint: teleport-access-graph.teleport-access-graph.svc.cluster.local:443
# Teleport 클러스터가 발급 CA를 이미 신뢰하는 경우 `ca` 키를 생략합니다.
ca: /var/run/access-graph/ca.pem
# Access Graph CA를 Teleport Auth Service에 볼륨으로 제공합니다.
# Teleport 클러스터가 발급 CA를 이미 신뢰하는 경우 아래 항목을 모두 생략합니다.
extraVolumes:
- name: tag-ca
configMap:
name: teleport-access-graph-ca
extraVolumeMounts:
- name: tag-ca
mountPath: /var/run/access-graph
teleport-cluster Helm 차트를 사용하지 않는 경우, Teleport 클러스터 배포에
동등한 변경 사항을 적용해야 합니다.
- Teleport Auth Service용 YAML 설정 파일 최상위 레벨에
access_graph:섹션을 추가합니다. - Auth Service가 CA 인증서를 읽을 수 있도록 생성된 ConfigMap을 볼륨으로 마운트합니다.
마지막으로, Helm 차트를 재배포합니다(값이 values-teleport.yaml에 저장되어 있다고 가정).
Auth Service 변경이 성공하면 Proxy Service를 재시작합니다. teleport-cluster-deployment-name에
teleport-cluster 배포의 이름을 할당합니다.
$ helm upgrade -n teleport-cluster-namespace -f values-teleport.yaml \
--version <version> teleport-cluster-deployment-name teleport/teleport-cluster
$ kubectl -n teleport-cluster-namespace rollout status deployment/teleport-auth # 배포가 완료될 때까지 대기
$ kubectl -n teleport-cluster-namespace rollout restart deployment/teleport-proxy
$ kubectl -n teleport-cluster-namespace rollout status deployment/teleport-proxy # 배포가 완료될 때까지 대기
4/4단계. Graph Explorer에서 Access Graph 데이터 보기#
Access Graph 서비스의 데이터를 시각화하려면 Web UI의 Graph Explorer를 사용합니다. Identity Security --> Graph Explorer를 클릭한 다음 Graph Explorer에서 볼 리소스를 선택합니다.
인터페이스에 접근하려면 사용자에게 access_graph 리소스에 대한 list 및
read verb를 허용하는 역할이 있어야 합니다. 프리셋 editor 역할에는
필요한 권한이 기본으로 포함되어 있습니다. 이러한 권한을 가진 역할을 생성하려면
다음 내용으로 access-graph-reader.yaml 파일을 엽니다.
kind: role
version: v7
metadata:
name: access-graph-reader
spec:
allow:
rules:
- resources:
- access_graph
verbs:
- list
- read
변경 사항을 적용합니다.
$ tctl create -f access-graph-reader.yaml