InfoGrab Docs

Teleport로 웹 애플리케이션 보호하기

요약

이 튜토리얼은 Teleport를 통해 애플리케이션에 대한 보안 접근을 구성하는 방법을 보여줍니다. 전반적으로, 애플리케이션에 대한 접근 구성에는 다음 단계가 포함됩니다: 이 가이드에서 설명하는 설정에서 Teleport Application Service는 보안 토큰으로 Teleport 클러스터에 참여합니다.

이 튜토리얼은 Teleport를 통해 애플리케이션에 대한 보안 접근을 구성하는 방법을 보여줍니다. 이 튜토리얼은 Docker 컨테이너나 Kubernetes 클러스터에서 추가 구성 없이 간단하게 설치하고 실행할 수 있기 때문에 Grafana를 샘플 애플리케이션으로 사용합니다. 다른 웹 애플리케이션에 대한 접근을 구성하려면 이 튜토리얼을 일반 가이드로 활용할 수 있습니다.

전반적으로, 애플리케이션에 대한 접근 구성에는 다음 단계가 포함됩니다:

  • 환경이 사전 요구 사항을 충족하는지 확인합니다.
  • Docker 컨테이너, Kubernetes 클러스터, 또는 다른 방법으로 애플리케이션을 실행할 수 있는지 확인합니다.
  • 애플리케이션이 Teleport 클러스터에 참여할 수 있도록 단기 초대 토큰을 생성합니다.
  • 애플리케이션 호스트에 Teleport를 설치하고 구성합니다.
  • 애플리케이션 접근을 검증하기 위한 사용자를 추가합니다.

작동 원리#

이 가이드에서 설명하는 설정에서 Teleport Application Service는 보안 토큰으로 Teleport 클러스터에 참여합니다. 구성 파일을 사용하여 웹 애플리케이션을 보호하도록 Application Service를 구성합니다. Application Service가 클러스터에 참여한 후, Teleport Proxy Service는 최종 사용자의 요청을 Teleport Application Service로 라우팅하고, Application Service의 응답을 최종 사용자에게 다시 전달합니다.

Application Service는 Teleport Auth Service에서 관리하는 CA에 대해 요청의 JSON 웹 토큰(JWT)을 검증함으로써 사용자 요청을 인증합니다. 요청하는 사용자의 역할이 JWT에 인코딩되어 있어, Application Service가 사용자에게 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 tctl and tsh clients.

    Installing `tctl` and `tsh` clients
    1. Determine the version of your Teleport cluster. The tctl and tsh clients must be at most one major version behind your Teleport cluster version. Send a GET request to the Proxy Service at /v1/webapi/find and 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')"
      
    2. Follow the instructions for your platform to install tctl and tsh clients:

To check that you can connect to your Teleport cluster, sign in with tsh login, then verify that you can run tctl commands 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 status command, you can use your current credentials to run subsequent tctl commands from your workstation. If you host your own Teleport cluster, you can also run tctl commands on the computer that hosts the Teleport Auth Service for full permissions.

  • Teleport Application Service를 실행할 호스트.
  • Grafana를 실행할 Docker 컨테이너 또는 Kubernetes 클러스터.

서브도메인과 애플리케이션#

Once the Teleport Application Service is proxying traffic to your web application, the Teleport Proxy Service makes the application available at the following URL:

https://


You can check the status of the Teleport Application Service with systemctl status teleport and view its logs with journalctl -fu teleport.

Configure Helm to fetch Teleport charts from the Teleport Helm repository:

$ helm repo add teleport (=teleport.helm_repo_url=)

Refresh the local Helm cache by fetching the latest charts:

$ helm repo update

다음과 유사한 명령으로 Kubernetes 클러스터에 teleport-kube-agent Helm 차트를 설치하여 Grafana를 프록시합니다:

$ JOIN_TOKEN=$(cat /tmp/token)
$ helm install teleport-kube-agent teleport/teleport-kube-agent \
  --create-namespace \
  --namespace teleport-agent \
  --set roles=app \
  --set proxyAddr=:443 \
  --set authToken=${JOIN_TOKEN?} \
  --set "apps[0].name=grafana" \
  --set "apps[0].uri=http://example-grafana.example-grafana.svc.cluster.local" \
  --set "apps[0].labels.env=dev" \
  --version (=teleport.version=)
  • proxyAddr를 Teleport 클러스터 주소로 설정합니다 (예: teleport.example.com 또는 mytenant.teleport.sh).
  • -authToken을 이전에 생성한 초대 토큰으로 설정합니다.
  • 다른 웹 애플리케이션에 대한 접근을 구성하는 경우 apps[0].nameapps[0].uri를 변경합니다.

Teleport 에이전트 파드가 실행 중인지 확인합니다. 단일 준비 컨테이너를 가진 하나의 teleport-kube-agent 파드가 표시되어야 합니다:

$ kubectl -n teleport-agent get pods
NAME                    READY   STATUS    RESTARTS   AGE
teleport-kube-agent-0   1/1     Running   0          32s

4단계/5. 사용자 생성#

이제 애플리케이션을 Teleport로 보호되는 리소스로 등록했으므로, 애플리케이션 접근을 테스트할 사용자를 생성할 수 있습니다. Teleport에는 사용자가 클러스터 리소스에 접근할 수 있도록 하는 access라는 내장 역할이 있습니다.

alice라는 새 로컬 사용자에게 access 역할을 할당하려면 다음 명령을 실행합니다:

$ tctl users add --roles=access alice

이 명령은 새 사용자를 위한 초대 URL을 생성합니다. URL을 사용하여 비밀번호를 선택하고, 다단계 인증을 설정하고, Teleport Web UI에 로그인할 수 있습니다.

5단계/5. 애플리케이션 접근#

프록시된 애플리케이션에 접근하는 몇 가지 방법이 있습니다.

브라우저 사용#

Teleport 클러스터 주소를 사용하여 Teleport Web UI에 로그인합니다. 사용 가능한 모든 애플리케이션이 애플리케이션 탭에 표시됩니다. Grafana 애플리케이션 타일의 Launch를 클릭하여 접근합니다.

또는 서브도메인으로 애플리케이션 이름을 사용하여 직접 애플리케이션을 호출할 수 있습니다. 예를 들어 https://grafana.teleport.example.com 또는 https://grafana.mytenant.teleport.sh와 같이 사용할 수 있습니다. 이미 인증되지 않은 경우 로그인하라는 메시지가 표시됩니다.

CLI 클라이언트 사용#

커맨드라인 도구와 스크립트를 사용하여 Teleport로 보호된 웹 애플리케이션에 접근할 수 있습니다. 이를 위해 애플리케이션에 대한 단기 X.509 인증서를 가져옵니다. Teleport는 이 인증서를 사용하여 요청을 인증합니다. 다음 명령을 실행하세요:

$ tsh apps login grafana

출력에는 대상 애플리케이션의 API를 호출하는 데 사용할 수 있는 예시 curl 명령이 표시됩니다. curl 명령은 API 호출을 인증하는 데 사용할 인증서와 개인 키의 파일 경로를 보여줍니다.

다음 단계#

다음 주제에서 Teleport로 애플리케이션을 보호하는 방법에 대해 자세히 알아보십시오:

Teleport로 웹 애플리케이션 보호하기

원문 보기
요약

이 튜토리얼은 Teleport를 통해 애플리케이션에 대한 보안 접근을 구성하는 방법을 보여줍니다. 전반적으로, 애플리케이션에 대한 접근 구성에는 다음 단계가 포함됩니다: 이 가이드에서 설명하는 설정에서 Teleport Application Service는 보안 토큰으로 Teleport 클러스터에 참여합니다.

이 튜토리얼은 Teleport를 통해 애플리케이션에 대한 보안 접근을 구성하는 방법을 보여줍니다. 이 튜토리얼은 Docker 컨테이너나 Kubernetes 클러스터에서 추가 구성 없이 간단하게 설치하고 실행할 수 있기 때문에 Grafana를 샘플 애플리케이션으로 사용합니다. 다른 웹 애플리케이션에 대한 접근을 구성하려면 이 튜토리얼을 일반 가이드로 활용할 수 있습니다.

전반적으로, 애플리케이션에 대한 접근 구성에는 다음 단계가 포함됩니다:

  • 환경이 사전 요구 사항을 충족하는지 확인합니다.
  • Docker 컨테이너, Kubernetes 클러스터, 또는 다른 방법으로 애플리케이션을 실행할 수 있는지 확인합니다.
  • 애플리케이션이 Teleport 클러스터에 참여할 수 있도록 단기 초대 토큰을 생성합니다.
  • 애플리케이션 호스트에 Teleport를 설치하고 구성합니다.
  • 애플리케이션 접근을 검증하기 위한 사용자를 추가합니다.

작동 원리#

이 가이드에서 설명하는 설정에서 Teleport Application Service는 보안 토큰으로 Teleport 클러스터에 참여합니다. 구성 파일을 사용하여 웹 애플리케이션을 보호하도록 Application Service를 구성합니다. Application Service가 클러스터에 참여한 후, Teleport Proxy Service는 최종 사용자의 요청을 Teleport Application Service로 라우팅하고, Application Service의 응답을 최종 사용자에게 다시 전달합니다.

Application Service는 Teleport Auth Service에서 관리하는 CA에 대해 요청의 JSON 웹 토큰(JWT)을 검증함으로써 사용자 요청을 인증합니다. 요청하는 사용자의 역할이 JWT에 인코딩되어 있어, Application Service가 사용자에게 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 tctl and tsh clients.

    Installing `tctl` and `tsh` clients
    1. Determine the version of your Teleport cluster. The tctl and tsh clients must be at most one major version behind your Teleport cluster version. Send a GET request to the Proxy Service at /v1/webapi/find and 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')"
      
    2. Follow the instructions for your platform to install tctl and tsh clients:

To check that you can connect to your Teleport cluster, sign in with tsh login, then verify that you can run tctl commands 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 status command, you can use your current credentials to run subsequent tctl commands from your workstation. If you host your own Teleport cluster, you can also run tctl commands on the computer that hosts the Teleport Auth Service for full permissions.

  • Teleport Application Service를 실행할 호스트.
  • Grafana를 실행할 Docker 컨테이너 또는 Kubernetes 클러스터.

서브도메인과 애플리케이션#

Once the Teleport Application Service is proxying traffic to your web application, the Teleport Proxy Service makes the application available at the following URL:

https://


You can check the status of the Teleport Application Service with systemctl status teleport and view its logs with journalctl -fu teleport.

Configure Helm to fetch Teleport charts from the Teleport Helm repository:

$ helm repo add teleport (=teleport.helm_repo_url=)

Refresh the local Helm cache by fetching the latest charts:

$ helm repo update

다음과 유사한 명령으로 Kubernetes 클러스터에 teleport-kube-agent Helm 차트를 설치하여 Grafana를 프록시합니다:

$ JOIN_TOKEN=$(cat /tmp/token)
$ helm install teleport-kube-agent teleport/teleport-kube-agent \
  --create-namespace \
  --namespace teleport-agent \
  --set roles=app \
  --set proxyAddr=:443 \
  --set authToken=${JOIN_TOKEN?} \
  --set "apps[0].name=grafana" \
  --set "apps[0].uri=http://example-grafana.example-grafana.svc.cluster.local" \
  --set "apps[0].labels.env=dev" \
  --version (=teleport.version=)
  • proxyAddr를 Teleport 클러스터 주소로 설정합니다 (예: teleport.example.com 또는 mytenant.teleport.sh).
  • -authToken을 이전에 생성한 초대 토큰으로 설정합니다.
  • 다른 웹 애플리케이션에 대한 접근을 구성하는 경우 apps[0].nameapps[0].uri를 변경합니다.

Teleport 에이전트 파드가 실행 중인지 확인합니다. 단일 준비 컨테이너를 가진 하나의 teleport-kube-agent 파드가 표시되어야 합니다:

$ kubectl -n teleport-agent get pods
NAME                    READY   STATUS    RESTARTS   AGE
teleport-kube-agent-0   1/1     Running   0          32s

4단계/5. 사용자 생성#

이제 애플리케이션을 Teleport로 보호되는 리소스로 등록했으므로, 애플리케이션 접근을 테스트할 사용자를 생성할 수 있습니다. Teleport에는 사용자가 클러스터 리소스에 접근할 수 있도록 하는 access라는 내장 역할이 있습니다.

alice라는 새 로컬 사용자에게 access 역할을 할당하려면 다음 명령을 실행합니다:

$ tctl users add --roles=access alice

이 명령은 새 사용자를 위한 초대 URL을 생성합니다. URL을 사용하여 비밀번호를 선택하고, 다단계 인증을 설정하고, Teleport Web UI에 로그인할 수 있습니다.

5단계/5. 애플리케이션 접근#

프록시된 애플리케이션에 접근하는 몇 가지 방법이 있습니다.

브라우저 사용#

Teleport 클러스터 주소를 사용하여 Teleport Web UI에 로그인합니다. 사용 가능한 모든 애플리케이션이 애플리케이션 탭에 표시됩니다. Grafana 애플리케이션 타일의 Launch를 클릭하여 접근합니다.

또는 서브도메인으로 애플리케이션 이름을 사용하여 직접 애플리케이션을 호출할 수 있습니다. 예를 들어 https://grafana.teleport.example.com 또는 https://grafana.mytenant.teleport.sh와 같이 사용할 수 있습니다. 이미 인증되지 않은 경우 로그인하라는 메시지가 표시됩니다.

CLI 클라이언트 사용#

커맨드라인 도구와 스크립트를 사용하여 Teleport로 보호된 웹 애플리케이션에 접근할 수 있습니다. 이를 위해 애플리케이션에 대한 단기 X.509 인증서를 가져옵니다. Teleport는 이 인증서를 사용하여 요청을 인증합니다. 다음 명령을 실행하세요:

$ tsh apps login grafana

출력에는 대상 애플리케이션의 API를 호출하는 데 사용할 수 있는 예시 curl 명령이 표시됩니다. curl 명령은 API 호출을 인증하는 데 사용할 인증서와 개인 키의 파일 경로를 보여줍니다.

다음 단계#

다음 주제에서 Teleport로 애플리케이션을 보호하는 방법에 대해 자세히 알아보십시오: