InfoGrab Docs

Secrets에서 값 조회

요약

이 가이드에서는 Teleport Kubernetes 운영자 CR 대신 Kubernetes Secrets에 민감한 정보를 저장하는 방법을 설명합니다. 일부 Teleport 리소스에는 민감한 값이 포함될 수 있습니다. 이 가이드를 따르려면 다음이 필요합니다:

이 가이드에서는 Teleport Kubernetes 운영자 CR 대신 Kubernetes Secrets에 민감한 정보를 저장하는 방법을 설명합니다.

작동 방식#

일부 Teleport 리소스에는 민감한 값이 포함될 수 있습니다. 특정 CR 필드는 기존 Kubernetes 시크릿을 참조할 수 있으며, 운영자는 조정(reconciling) 시 시크릿에서 값을 검색합니다.

현재 시크릿 조회가 지원되는 필드:

  • GithubConnector client_secret
  • OIDCConnector client_secret
  • TrustedClusterV2 token

사전 요구사항#

이 가이드를 따르려면 다음이 필요합니다:

  • 실행 중인 Teleport 클러스터
  • 기능적인 Teleport Kubernetes 운영자 설정
  • 운영자 네임스페이스에서 CR 및 Secrets를 편집할 Kubernetes 권한
  • 로컬에 설치된 kubectl 및 Kubernetes 클러스터에 대해 구성된 설정
  • 운영자로 관리하려는 작동 중인 GitHub 또는 OIDC 커넥터
  • Teleport 클러스터에 설치 및 로그인된 tctltsh

중요 고려 사항#

CR에서 민감한 값을 저장하더라도 CR은 Kubernetes 시크릿 자체만큼 중요하게 취급되어야 합니다. 많은 CR은 Teleport RBAC을 구성합니다. CR 편집 권한이 있는 사람은 Teleport 관리자가 되어 Teleport에서 민감한 값을 검색할 수 있습니다.

시크릿 조회 기능을 구성하기 전에 고려해야 할 두 가지 제한 사항이 있습니다:

  • 성능 상의 이유로, 시크릿은 감시되지 않습니다. 시크릿 내용 변경이 리소스에 즉시 반영되지 않습니다. 운영자가 새 시크릿 값을 사용하도록 강제하려면 CR을 편집하거나, 운영자를 재시작하거나, 다음 전체 동기화(12시간마다)를 기다려 조정을 트리거해야 합니다.
  • 보안 상의 이유로, 운영자는 임의의 시크릿에서 조회를 허용하지 않습니다. 시크릿에는 resources.teleport.dev/allow-lookup-from-cr 어노테이션이 달려야 합니다. 가능한 값은 * 또는 쉼표로 구분된 CR 이름 목록입니다.

1단계/3단계: 민감한 값을 포함하는 Kubernetes Secret 생성#

이 가이드에서 저장하려는 민감한 값은 GitHub 커넥터 클라이언트 시크릿입니다.

다음 secret.yaml 매니페스트를 생성합니다:

apiVersion: v1
kind: Secret
metadata:
  name: teleport-github-connector
  annotations:
    # This annotation allows any CR to look up this secret
    resources.teleport.dev/allow-lookup-from-cr: "*"
# We use stringData instead of data for the sake of simplicity, both are OK
stringData:
  githubSecret: my-github-secret-value

가 Teleport Kubernetes 운영자 네임스페이스인 경우, kubectl을 사용하여 매니페스트를 적용합니다:

$ kubectl apply -n  -f secret.yaml
secret/teleport-github-connector created

2단계/3단계: 시크릿을 참조하는 사용자 정의 리소스 생성#

다음 github-connector.yaml 매니페스트를 생성합니다:

apiVersion: resources.teleport.dev/v3
kind: TeleportGithubConnector
metadata:
  name: github
spec:
  # This value will be looked up from the secret. `teleport-github-connector` is the secret name and `githubSecret` is the secret key.
  client_secret: "secret://teleport-github-connector/githubSecret"
  # Replace all the values below by the ones to work with your github account
  client_id: my-client-id
  display: Github
  redirect_url: "my value"
  teams_to_roles:
    - organization: ORG-NAME
      roles:
        - access
      team: team-name

운영자 및 시크릿과 동일한 네임스페이스에 매니페스트를 적용합니다:

$ kubectl apply -n  -f github-connector.yaml
teleportgithubconnector.resources.teleport.dev/github created

3단계/3단계: 리소스가 생성되었는지 확인#

운영자는 CR status 필드에서 조정이 작동했는지 여부를 나타냅니다. 다음 명령을 실행하여 성공 여부를 확인합니다:

$ kubectl get -n  teleportgithubconnector github -o yaml

apiVersion: resources.teleport.dev/v3
kind: TeleportGithubConnector
# [...]
status:
  conditions:
  - lastTransitionTime: "2022-07-25T16:15:52Z"
    message: Teleport resource has the Kubernetes origin label.
    reason: OriginLabelMatching
    status: "True"
    type: TeleportResourceOwned
  - lastTransitionTime: "2022-07-25T17:08:58Z"
    message: 'Teleport Resource was successfully reconciled, no error was returned by Teleport.'
    reason: NoError
    status: "True"
    type: SuccessfullyReconciled

모든 것이 정상 작동했다면 모든 조건 상태가 True여야 합니다. 일부 상태가 False인 경우, 메시지와 이유가 무엇이 실패했는지에 대한 추가 정보를 제공합니다.

마지막으로 Teleport에서 리소스가 올바르게 생성되었는지 확인합니다:

$ tctl get github
version: v3
kind: github
metadata:
  name: github
spec:
  client_secret: "my-github-secret-value"
  # ...

spec.client_secret의 내용이 시크릿의 내용으로 교체된 것을 확인할 수 있습니다.

Secrets에서 값 조회

원문 보기
요약

이 가이드에서는 Teleport Kubernetes 운영자 CR 대신 Kubernetes Secrets에 민감한 정보를 저장하는 방법을 설명합니다. 일부 Teleport 리소스에는 민감한 값이 포함될 수 있습니다. 이 가이드를 따르려면 다음이 필요합니다:

이 가이드에서는 Teleport Kubernetes 운영자 CR 대신 Kubernetes Secrets에 민감한 정보를 저장하는 방법을 설명합니다.

작동 방식#

일부 Teleport 리소스에는 민감한 값이 포함될 수 있습니다. 특정 CR 필드는 기존 Kubernetes 시크릿을 참조할 수 있으며, 운영자는 조정(reconciling) 시 시크릿에서 값을 검색합니다.

현재 시크릿 조회가 지원되는 필드:

  • GithubConnector client_secret
  • OIDCConnector client_secret
  • TrustedClusterV2 token

사전 요구사항#

이 가이드를 따르려면 다음이 필요합니다:

  • 실행 중인 Teleport 클러스터
  • 기능적인 Teleport Kubernetes 운영자 설정
  • 운영자 네임스페이스에서 CR 및 Secrets를 편집할 Kubernetes 권한
  • 로컬에 설치된 kubectl 및 Kubernetes 클러스터에 대해 구성된 설정
  • 운영자로 관리하려는 작동 중인 GitHub 또는 OIDC 커넥터
  • Teleport 클러스터에 설치 및 로그인된 tctltsh

중요 고려 사항#

CR에서 민감한 값을 저장하더라도 CR은 Kubernetes 시크릿 자체만큼 중요하게 취급되어야 합니다. 많은 CR은 Teleport RBAC을 구성합니다. CR 편집 권한이 있는 사람은 Teleport 관리자가 되어 Teleport에서 민감한 값을 검색할 수 있습니다.

시크릿 조회 기능을 구성하기 전에 고려해야 할 두 가지 제한 사항이 있습니다:

  • 성능 상의 이유로, 시크릿은 감시되지 않습니다. 시크릿 내용 변경이 리소스에 즉시 반영되지 않습니다. 운영자가 새 시크릿 값을 사용하도록 강제하려면 CR을 편집하거나, 운영자를 재시작하거나, 다음 전체 동기화(12시간마다)를 기다려 조정을 트리거해야 합니다.
  • 보안 상의 이유로, 운영자는 임의의 시크릿에서 조회를 허용하지 않습니다. 시크릿에는 resources.teleport.dev/allow-lookup-from-cr 어노테이션이 달려야 합니다. 가능한 값은 * 또는 쉼표로 구분된 CR 이름 목록입니다.

1단계/3단계: 민감한 값을 포함하는 Kubernetes Secret 생성#

이 가이드에서 저장하려는 민감한 값은 GitHub 커넥터 클라이언트 시크릿입니다.

다음 secret.yaml 매니페스트를 생성합니다:

apiVersion: v1
kind: Secret
metadata:
  name: teleport-github-connector
  annotations:
    # This annotation allows any CR to look up this secret
    resources.teleport.dev/allow-lookup-from-cr: "*"
# We use stringData instead of data for the sake of simplicity, both are OK
stringData:
  githubSecret: my-github-secret-value

가 Teleport Kubernetes 운영자 네임스페이스인 경우, kubectl을 사용하여 매니페스트를 적용합니다:

$ kubectl apply -n  -f secret.yaml
secret/teleport-github-connector created

2단계/3단계: 시크릿을 참조하는 사용자 정의 리소스 생성#

다음 github-connector.yaml 매니페스트를 생성합니다:

apiVersion: resources.teleport.dev/v3
kind: TeleportGithubConnector
metadata:
  name: github
spec:
  # This value will be looked up from the secret. `teleport-github-connector` is the secret name and `githubSecret` is the secret key.
  client_secret: "secret://teleport-github-connector/githubSecret"
  # Replace all the values below by the ones to work with your github account
  client_id: my-client-id
  display: Github
  redirect_url: "my value"
  teams_to_roles:
    - organization: ORG-NAME
      roles:
        - access
      team: team-name

운영자 및 시크릿과 동일한 네임스페이스에 매니페스트를 적용합니다:

$ kubectl apply -n  -f github-connector.yaml
teleportgithubconnector.resources.teleport.dev/github created

3단계/3단계: 리소스가 생성되었는지 확인#

운영자는 CR status 필드에서 조정이 작동했는지 여부를 나타냅니다. 다음 명령을 실행하여 성공 여부를 확인합니다:

$ kubectl get -n  teleportgithubconnector github -o yaml

apiVersion: resources.teleport.dev/v3
kind: TeleportGithubConnector
# [...]
status:
  conditions:
  - lastTransitionTime: "2022-07-25T16:15:52Z"
    message: Teleport resource has the Kubernetes origin label.
    reason: OriginLabelMatching
    status: "True"
    type: TeleportResourceOwned
  - lastTransitionTime: "2022-07-25T17:08:58Z"
    message: 'Teleport Resource was successfully reconciled, no error was returned by Teleport.'
    reason: NoError
    status: "True"
    type: SuccessfullyReconciled

모든 것이 정상 작동했다면 모든 조건 상태가 True여야 합니다. 일부 상태가 False인 경우, 메시지와 이유가 무엇이 실패했는지에 대한 추가 정보를 제공합니다.

마지막으로 Teleport에서 리소스가 올바르게 생성되었는지 확인합니다:

$ tctl get github
version: v3
kind: github
metadata:
  name: github
spec:
  client_secret: "my-github-secret-value"
  # ...

spec.client_secret의 내용이 시크릿의 내용으로 교체된 것을 확인할 수 있습니다.