InfoGrab DocsInfoGrab Docs

Amazon Keyspaces(Apache Cassandra)를 이용한 데이터베이스 접근

요약

Teleport는 Teleport Database Service를 통해 Amazon Keyspaces (Apache Cassandra)에 대한 보안 접근을 제공할 수 있습니다. Teleport Database Service는 IAM 인증을 사용하여 Amazon Keyspaces와 통신합니다.

Teleport는 Teleport Database Service를 통해 Amazon Keyspaces (Apache Cassandra)에 대한 보안 접근을 제공할 수 있습니다. 이를 통해 Teleport의 RBAC를 사용한 세분화된 접근 제어가 가능합니다.

이 가이드에서는 다음을 수행합니다:

  1. Amazon Keyspaces (Apache Cassandra) 데이터베이스를 구성합니다 IAM 인증을 사용하여.
  2. 데이터베이스를 Teleport 클러스터에 추가합니다.
  3. Teleport를 통해 데이터베이스에 연결합니다.

작동 원리#

Teleport Database Service는 IAM 인증을 사용하여 Amazon Keyspaces와 통신합니다. 사용자가 Teleport를 통해 데이터베이스에 연결하면 Teleport Database Service는 AWS 자격 증명을 얻고 데이터베이스에 액세스할 수 있는 권한을 가진 IAM 주체(principal)로 AWS에 인증합니다.

자체 호스팅 Teleport 클러스터에 Amazon Keyspaces 등록

클라우드 호스팅 Teleport 클러스터에 Amazon Keyspaces 등록

필수 조건#

  • 실행 중인 Teleport 클러스터. Teleport를 시작하려면 무료 체험판에 가입하거나 데모 환경을 구성하세요.

  • tctl and tsh clients.

    Installing `tctl` and `tsh` clients
    1. Teleport 클러스터의 버전을 확인합니다. tctl and tsh 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')"
      
    2. 사용 중인 플랫폼에 대한 지침에 따라 tctl and tsh clients를 설치합니다:

Mac

     `tctl` and `tsh` clients가 포함된, 서명된 Teleport macOS .pkg 설치 프로그램을 다운로드합니다:
 
     ```code
     $ curl -O https://cdn.teleport.dev/teleport-${TELEPORT_VERSION?}.pkg
     ```

     Finder에서 `pkg` 파일을 더블 클릭하여 설치를 시작합니다.
 
     
Warning
       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 `tctl` and `tsh` clients to your %PATH%
     # NOTE: Do not place the `tctl` and `tsh` 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 바이너리에는 `tctl` and `tsh` 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
     ```
   

 
  • IAM 정책을 생성하고 연결할 권한이 있는 Amazon Keyspaces 데이터베이스를 포함한 AWS 계정
  • cqlsh Cassandra 클라이언트가 설치되어 시스템의 PATH 환경 변수에 추가된 상태
  • Teleport 데이터베이스 서비스를 실행할 호스트 (예: Amazon EC2 인스턴스)

Teleport cluster에 연결할 수 있는지 확인하려면 tsh login으로 로그인한 다음, 현재 자격 증명으로 tctl 명령을 실행할 수 있는지 확인합니다.

예를 들어, teleport.example.com에 cluster 내 Teleport Proxy Service의 도메인 이름을, email@example.com에 Teleport 사용자 이름을 지정하여 다음 명령을 실행합니다:

$ tsh login --proxy=teleport.example.com --user=email@example.com
$ tctl status
# Cluster  (=teleport.url=)
# Version  (=teleport.version=)
# CA pin   (=presets.ca_pin=)

cluster에 연결하여 tctl status 명령을 실행할 수 있다면, 현재 자격 증명을 사용하여 워크스테이션에서 이후의 tctl 명령을 실행할 수 있습니다. 자체 Teleport cluster를 호스팅하는 경우, 전체 권한을 얻기 위해 Teleport Auth Service를 호스팅하는 컴퓨터에서 tctl 명령을 실행할 수도 있습니다.

1/5단계. Teleport 데이터베이스 서비스 설정#

Database Service가 Teleport 클러스터에 조인하려면 유효한 조인 토큰이 필요합니다. 다음 tctl 명령을 실행하고 Database Service를 실행할 서버에서 토큰 출력을 /tmp/token에 저장합니다:

$ tctl tokens add --type=db --format=text
(=presets.tokens.first=)
대체 방법

AWS에 많은 인프라를 보유하고 있거나 많은 인스턴스를 생성 또는 재생성할 수 있는 사용자의 경우, Teleport를 실행하는 새 EC2 인스턴스를 조인하는 대체 방법을 고려하십시오:

Linux 서버에 Teleport Agent를 설치하려면:

권장 설치 방법은 클러스터 설치 스크립트입니다. 이 스크립트는 클러스터에 맞는 올바른 버전, 에디션, 설치 모드를 선택합니다.

  1. teleport.example.com:443에 Teleport 클러스터의 호스트명과 포트를 할당하되, 스킴(https://)은 포함하지 마십시오.

  2. 클러스터의 설치 스크립트를 실행하십시오:

    $ curl "https://teleport.example.com:443/scripts/install.sh" | sudo bash
    

Teleport 프록시 서비스의 주소를 --proxy 플래그에 지정하여 Teleport 데이터베이스 서비스 구성을 생성합니다:

$ sudo teleport db configure create \
   -o file \
  --token=/tmp/token \
  --proxy=teleport.example.com:443 \
  --name=keyspaces \
  --protocol=cassandra \
  --aws-account-id=12345678912 \
  --aws-region=us-east-1 \
  --labels=env=dev

Teleport 프록시 서비스의 주소를 --proxy 플래그에 지정하여 Teleport 데이터베이스 서비스 구성을 생성합니다:

$ sudo teleport db configure create \
   -o file \
  --token=/tmp/token \
  --proxy=mytenant.teleport.sh:443 \
  --name=keyspaces \
  --protocol=cassandra \
  --aws-account-id=12345678912 \
  --aws-region=us-east-1 \
  --labels=env=dev

the Teleport Database Service이(가) AWS에 인증하는 데 사용할 수 있는 자격 증명에 대한 접근 권한을 부여합니다.

  • the Teleport Database Service을(를) EC2 인스턴스에서 실행하는 경우 EC2 Instance Metadata Service 방식을 사용할 수 있습니다
  • the Teleport Database Service을(를) Kubernetes에서 실행하는 경우 IAM Roles for Service Accounts (IRSA)를 사용할 수 있습니다
  • 그 외의 경우에는 환경 변수를 사용해야 합니다

Instance Metadata Service

Teleport는 EC2 인스턴스에서 실행 중일 때를 감지하고 Instance Metadata Service를 사용하여 자격 증명을 가져옵니다.

EC2 인스턴스는 EC2 인스턴스 프로파일을 사용하도록 구성되어야 합니다. 자세한 내용은 Using Instance Profiles를 참고하세요.

Kubernetes IRSA

AWS에서 OIDC provider를 설정하고 pod의 서비스 계정이 role을 assume할 수 있도록 허용하는 AWS IAM role을 구성하려면 IAM Roles for Service Accounts (IRSA)를 참고하세요.

Environment Variables

Teleport의 내장 AWS 클라이언트는 다음 환경 변수에서 자격 증명을 읽습니다:

  • AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY
  • AWS_DEFAULT_REGION

the Teleport Database Service을(를) 시작하면 서비스는 /etc/default/teleport 경로의 파일에서 환경 변수를 읽습니다. 이러한 자격 증명은 조직에서 얻으세요. 각 변수의 값을 교체하여 /etc/default/teleport가 다음 내용을 담도록 하세요:

AWS_ACCESS_KEY_ID=00000000000000000000
AWS_SECRET_ACCESS_KEY=0000000000000000000000000000000000000000
AWS_DEFAULT_REGION=
AWS 자격 증명 소스가 여러 개인가요?

Teleport의 AWS 클라이언트는 다음 순서로 여러 소스에서 자격 증명을 로드합니다:

  • 환경 변수
  • 공유 자격 증명 파일
  • 공유 구성 파일 (Teleport는 항상 공유 구성을 활성화합니다)
  • EC2 Instance Metadata (자격 증명만)

공유 자격 증명 파일이나 공유 구성 파일을 통해 AWS 자격 증명을 제공할 수 있지만, 원하는 프로파일의 이름을 AWS_PROFILE 환경 변수에 할당하여 the Teleport Database Service을(를) 실행해야 합니다.

위의 지침이 다루지 않는 특정 사용 사례가 있다면, 자격 증명 로딩 동작에 대한 자세한 설명은 AWS SDK for Go 문서를 참고하세요.

systemd 서비스를 생성하여 호스트가 부팅될 때 the Teleport Database Service이 자동으로 시작되도록 구성합니다. 지침은 the Teleport Database Service을 어떻게 설치했는지에 따라 다릅니다.

Package Manager

the Teleport Database Service을 실행할 호스트에서 Teleport를 활성화하고 시작합니다:

$ sudo systemctl enable teleport
$ sudo systemctl start teleport

TAR Archive

the Teleport Database Service을 실행할 호스트에서 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로 the Teleport Database Service의 상태를 확인하고 journalctl -fu teleport로 로그를 볼 수 있습니다.

2/5단계. Teleport 사용자 생성#

Tip

기존 사용자를 수정하여 Database Service 접근 권한을 부여하려면 Database Access Controls를 참조하십시오.

Teleport Community Edition

내장 access 역할을 가진 로컬 Teleport 사용자를 생성합니다:

$ tctl users add \
  --roles=access \
  --db-users="*" \
  --db-names="*" \
  alice

Teleport Enterprise/Enterprise Cloud

내장 accessrequester 역할을 가진 로컬 Teleport 사용자를 생성합니다:

$ tctl users add \
  --roles=access,requester \
  --db-users="*" \
  --db-names="*" \
  alice
Flag 설명
--roles 사용자에게 할당할 역할 목록입니다. 내장 access 역할은 Teleport에 등록된 모든 데이터베이스 서버에 연결할 수 있게 합니다.
--db-users 사용자가 데이터베이스에 연결할 때 사용할 수 있는 데이터베이스 사용자명 목록입니다. 와일드카드는 모든 사용자를 허용합니다.
--db-names 사용자가 데이터베이스 서버 내에서 연결할 수 있는 논리적 데이터베이스(즉, 스키마) 목록입니다. 와일드카드는 모든 데이터베이스를 허용합니다.
Warning

데이터베이스 이름은 PostgreSQL, MongoDB, Cloud Spanner 데이터베이스에서만 적용됩니다.

데이터베이스 접근 제어 및 접근 제한 방법에 대한 자세한 정보는 RBAC 문서를 참조하십시오.

3/5단계. Amazon Keyspaces 역할 생성#

Keyspaces 사용자로 사용할 AWS IAM 역할을 생성합니다. IAM -> 액세스 관리 -> 역할로 이동합니다. 역할 생성을 클릭합니다.

역할 생성 1단계 AWS는 Keyspaces 사용자의 역할에 포함할 수 있는 AmazonKeyspacesReadOnlyAccessAmazonKeyspacesFullAccess IAM 정책을 제공합니다. Amazon Keyspaces에 대한 읽기 전용 액세스를 위해 AmazonKeyspacesReadOnlyAccess를 선택하거나, 전체 액세스를 위해 AmazonKeyspacesFullAccess를 선택할 수 있습니다.

Tip

AmazonKeyspacesReadOnlyAccessAmazonKeyspacesFullAccess 정책은 의도한 것보다 너무 많거나 적은 액세스를 제공할 수 있습니다. 사용 계획이 있다면 이 정책들이 요구 사항을 충족하는지 검증하세요. 사용자 지정 Amazon Keyspaces 권한 정책을 직접 만들 수도 있습니다: Amazon Keyspaces ID 기반 정책 예제.

역할 생성 1단계 역할 이름을 입력하고 "역할 생성"을 클릭합니다. 역할 생성 1단계

4/5단계. Teleport에 역할 수임 권한 부여#

다음으로, Teleport 데이터베이스 서비스 인스턴스가 사용하는 IAM 역할 또는 IAM 사용자에게 다음 정책을 연결합니다. 이 정책은 데이터베이스 서비스가 IAM 역할을 수임할 수 있도록 허용합니다:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "sts:AssumeRole",
      "Resource": "*"
    }
  ]
}
Tip

와일드카드 대신 "Resource" 필드에 특정 IAM 역할 리소스 ARN을 제공하여 정책을 더 엄격하게 만들 수 있습니다.

5/5단계. 연결#

데이터베이스 서비스가 클러스터에 참가하면 로그인하여 사용 가능한 데이터베이스를 확인합니다:

$ tsh login --proxy=teleport.example.com --user=alice
$ tsh db ls
# Name      Description Allowed Users Labels  Connect
# --------- ----------- ------------- ------- -------
# keyspaces             [*]           env=dev
$ tsh login --proxy=mytenant.teleport.sh --user=alice
$ tsh db ls
# Name      Description Allowed Users Labels  Connect
# --------- ----------- ------------- ------- -------
# keyspaces             [*]           env=dev

데이터베이스 사용자로 KeyspacesReader AWS IAM Keyspaces 역할을 사용하여 특정 데이터베이스 인스턴스에 연결하려면:

$ tsh db connect --db-user=KeyspacesReader keyspaces
# Connected to Amazon Keyspaces at localhost:55084
# [cqlsh 6.0.0 | Cassandra 3.11.2 | CQL spec 3.4.4 | Native protocol v4]
# Use HELP for help.
# KeyspacesReader@cqlsh>
Note

이 섹션의 내용은 원문 문서를 참조하세요. (proxy-db-tunnel.mdx)

데이터베이스에서 로그아웃하고 자격 증명을 제거하려면:

# 특정 데이터베이스 인스턴스의 자격 증명 제거.
$ tsh db logout keyspaces
# 모든 데이터베이스 인스턴스의 자격 증명 제거.
$ tsh db logout

추가 자료#

다음 단계#

Amazon Keyspaces(Apache Cassandra)를 이용한 데이터베이스 접근

Teleport v18.9
원문 보기
요약

Teleport는 Teleport Database Service를 통해 Amazon Keyspaces (Apache Cassandra)에 대한 보안 접근을 제공할 수 있습니다. Teleport Database Service는 IAM 인증을 사용하여 Amazon Keyspaces와 통신합니다.

Teleport는 Teleport Database Service를 통해 Amazon Keyspaces (Apache Cassandra)에 대한 보안 접근을 제공할 수 있습니다. 이를 통해 Teleport의 RBAC를 사용한 세분화된 접근 제어가 가능합니다.

이 가이드에서는 다음을 수행합니다:

  1. Amazon Keyspaces (Apache Cassandra) 데이터베이스를 구성합니다 IAM 인증을 사용하여.
  2. 데이터베이스를 Teleport 클러스터에 추가합니다.
  3. Teleport를 통해 데이터베이스에 연결합니다.

작동 원리#

Teleport Database Service는 IAM 인증을 사용하여 Amazon Keyspaces와 통신합니다. 사용자가 Teleport를 통해 데이터베이스에 연결하면 Teleport Database Service는 AWS 자격 증명을 얻고 데이터베이스에 액세스할 수 있는 권한을 가진 IAM 주체(principal)로 AWS에 인증합니다.

자체 호스팅 Teleport 클러스터에 Amazon Keyspaces 등록

클라우드 호스팅 Teleport 클러스터에 Amazon Keyspaces 등록

필수 조건#

  • 실행 중인 Teleport 클러스터. Teleport를 시작하려면 무료 체험판에 가입하거나 데모 환경을 구성하세요.

  • tctl and tsh clients.

    Installing `tctl` and `tsh` clients
    1. Teleport 클러스터의 버전을 확인합니다. tctl and tsh 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')"
      
    2. 사용 중인 플랫폼에 대한 지침에 따라 tctl and tsh clients를 설치합니다:

Mac

     `tctl` and `tsh` clients가 포함된, 서명된 Teleport macOS .pkg 설치 프로그램을 다운로드합니다:
 
     ```code
     $ curl -O https://cdn.teleport.dev/teleport-${TELEPORT_VERSION?}.pkg
     ```

     Finder에서 `pkg` 파일을 더블 클릭하여 설치를 시작합니다.
 
     
Warning
       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 `tctl` and `tsh` clients to your %PATH%
     # NOTE: Do not place the `tctl` and `tsh` 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 바이너리에는 `tctl` and `tsh` 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
     ```
   

 
  • IAM 정책을 생성하고 연결할 권한이 있는 Amazon Keyspaces 데이터베이스를 포함한 AWS 계정
  • cqlsh Cassandra 클라이언트가 설치되어 시스템의 PATH 환경 변수에 추가된 상태
  • Teleport 데이터베이스 서비스를 실행할 호스트 (예: Amazon EC2 인스턴스)

Teleport cluster에 연결할 수 있는지 확인하려면 tsh login으로 로그인한 다음, 현재 자격 증명으로 tctl 명령을 실행할 수 있는지 확인합니다.

예를 들어, teleport.example.com에 cluster 내 Teleport Proxy Service의 도메인 이름을, email@example.com에 Teleport 사용자 이름을 지정하여 다음 명령을 실행합니다:

$ tsh login --proxy=teleport.example.com --user=email@example.com
$ tctl status
# Cluster  (=teleport.url=)
# Version  (=teleport.version=)
# CA pin   (=presets.ca_pin=)

cluster에 연결하여 tctl status 명령을 실행할 수 있다면, 현재 자격 증명을 사용하여 워크스테이션에서 이후의 tctl 명령을 실행할 수 있습니다. 자체 Teleport cluster를 호스팅하는 경우, 전체 권한을 얻기 위해 Teleport Auth Service를 호스팅하는 컴퓨터에서 tctl 명령을 실행할 수도 있습니다.

1/5단계. Teleport 데이터베이스 서비스 설정#

Database Service가 Teleport 클러스터에 조인하려면 유효한 조인 토큰이 필요합니다. 다음 tctl 명령을 실행하고 Database Service를 실행할 서버에서 토큰 출력을 /tmp/token에 저장합니다:

$ tctl tokens add --type=db --format=text
(=presets.tokens.first=)
대체 방법

AWS에 많은 인프라를 보유하고 있거나 많은 인스턴스를 생성 또는 재생성할 수 있는 사용자의 경우, Teleport를 실행하는 새 EC2 인스턴스를 조인하는 대체 방법을 고려하십시오:

Linux 서버에 Teleport Agent를 설치하려면:

권장 설치 방법은 클러스터 설치 스크립트입니다. 이 스크립트는 클러스터에 맞는 올바른 버전, 에디션, 설치 모드를 선택합니다.

  1. teleport.example.com:443에 Teleport 클러스터의 호스트명과 포트를 할당하되, 스킴(https://)은 포함하지 마십시오.

  2. 클러스터의 설치 스크립트를 실행하십시오:

    $ curl "https://teleport.example.com:443/scripts/install.sh" | sudo bash
    

Teleport 프록시 서비스의 주소를 --proxy 플래그에 지정하여 Teleport 데이터베이스 서비스 구성을 생성합니다:

$ sudo teleport db configure create \
   -o file \
  --token=/tmp/token \
  --proxy=teleport.example.com:443 \
  --name=keyspaces \
  --protocol=cassandra \
  --aws-account-id=12345678912 \
  --aws-region=us-east-1 \
  --labels=env=dev

Teleport 프록시 서비스의 주소를 --proxy 플래그에 지정하여 Teleport 데이터베이스 서비스 구성을 생성합니다:

$ sudo teleport db configure create \
   -o file \
  --token=/tmp/token \
  --proxy=mytenant.teleport.sh:443 \
  --name=keyspaces \
  --protocol=cassandra \
  --aws-account-id=12345678912 \
  --aws-region=us-east-1 \
  --labels=env=dev

the Teleport Database Service이(가) AWS에 인증하는 데 사용할 수 있는 자격 증명에 대한 접근 권한을 부여합니다.

  • the Teleport Database Service을(를) EC2 인스턴스에서 실행하는 경우 EC2 Instance Metadata Service 방식을 사용할 수 있습니다
  • the Teleport Database Service을(를) Kubernetes에서 실행하는 경우 IAM Roles for Service Accounts (IRSA)를 사용할 수 있습니다
  • 그 외의 경우에는 환경 변수를 사용해야 합니다

Instance Metadata Service

Teleport는 EC2 인스턴스에서 실행 중일 때를 감지하고 Instance Metadata Service를 사용하여 자격 증명을 가져옵니다.

EC2 인스턴스는 EC2 인스턴스 프로파일을 사용하도록 구성되어야 합니다. 자세한 내용은 Using Instance Profiles를 참고하세요.

Kubernetes IRSA

AWS에서 OIDC provider를 설정하고 pod의 서비스 계정이 role을 assume할 수 있도록 허용하는 AWS IAM role을 구성하려면 IAM Roles for Service Accounts (IRSA)를 참고하세요.

Environment Variables

Teleport의 내장 AWS 클라이언트는 다음 환경 변수에서 자격 증명을 읽습니다:

  • AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY
  • AWS_DEFAULT_REGION

the Teleport Database Service을(를) 시작하면 서비스는 /etc/default/teleport 경로의 파일에서 환경 변수를 읽습니다. 이러한 자격 증명은 조직에서 얻으세요. 각 변수의 값을 교체하여 /etc/default/teleport가 다음 내용을 담도록 하세요:

AWS_ACCESS_KEY_ID=00000000000000000000
AWS_SECRET_ACCESS_KEY=0000000000000000000000000000000000000000
AWS_DEFAULT_REGION=
AWS 자격 증명 소스가 여러 개인가요?

Teleport의 AWS 클라이언트는 다음 순서로 여러 소스에서 자격 증명을 로드합니다:

  • 환경 변수
  • 공유 자격 증명 파일
  • 공유 구성 파일 (Teleport는 항상 공유 구성을 활성화합니다)
  • EC2 Instance Metadata (자격 증명만)

공유 자격 증명 파일이나 공유 구성 파일을 통해 AWS 자격 증명을 제공할 수 있지만, 원하는 프로파일의 이름을 AWS_PROFILE 환경 변수에 할당하여 the Teleport Database Service을(를) 실행해야 합니다.

위의 지침이 다루지 않는 특정 사용 사례가 있다면, 자격 증명 로딩 동작에 대한 자세한 설명은 AWS SDK for Go 문서를 참고하세요.

systemd 서비스를 생성하여 호스트가 부팅될 때 the Teleport Database Service이 자동으로 시작되도록 구성합니다. 지침은 the Teleport Database Service을 어떻게 설치했는지에 따라 다릅니다.

Package Manager

the Teleport Database Service을 실행할 호스트에서 Teleport를 활성화하고 시작합니다:

$ sudo systemctl enable teleport
$ sudo systemctl start teleport

TAR Archive

the Teleport Database Service을 실행할 호스트에서 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로 the Teleport Database Service의 상태를 확인하고 journalctl -fu teleport로 로그를 볼 수 있습니다.

2/5단계. Teleport 사용자 생성#

Tip

기존 사용자를 수정하여 Database Service 접근 권한을 부여하려면 Database Access Controls를 참조하십시오.

Teleport Community Edition

내장 access 역할을 가진 로컬 Teleport 사용자를 생성합니다:

$ tctl users add \
  --roles=access \
  --db-users="*" \
  --db-names="*" \
  alice

Teleport Enterprise/Enterprise Cloud

내장 accessrequester 역할을 가진 로컬 Teleport 사용자를 생성합니다:

$ tctl users add \
  --roles=access,requester \
  --db-users="*" \
  --db-names="*" \
  alice
Flag 설명
--roles 사용자에게 할당할 역할 목록입니다. 내장 access 역할은 Teleport에 등록된 모든 데이터베이스 서버에 연결할 수 있게 합니다.
--db-users 사용자가 데이터베이스에 연결할 때 사용할 수 있는 데이터베이스 사용자명 목록입니다. 와일드카드는 모든 사용자를 허용합니다.
--db-names 사용자가 데이터베이스 서버 내에서 연결할 수 있는 논리적 데이터베이스(즉, 스키마) 목록입니다. 와일드카드는 모든 데이터베이스를 허용합니다.
Warning

데이터베이스 이름은 PostgreSQL, MongoDB, Cloud Spanner 데이터베이스에서만 적용됩니다.

데이터베이스 접근 제어 및 접근 제한 방법에 대한 자세한 정보는 RBAC 문서를 참조하십시오.

3/5단계. Amazon Keyspaces 역할 생성#

Keyspaces 사용자로 사용할 AWS IAM 역할을 생성합니다. IAM -> 액세스 관리 -> 역할로 이동합니다. 역할 생성을 클릭합니다.

역할 생성 1단계 AWS는 Keyspaces 사용자의 역할에 포함할 수 있는 AmazonKeyspacesReadOnlyAccessAmazonKeyspacesFullAccess IAM 정책을 제공합니다. Amazon Keyspaces에 대한 읽기 전용 액세스를 위해 AmazonKeyspacesReadOnlyAccess를 선택하거나, 전체 액세스를 위해 AmazonKeyspacesFullAccess를 선택할 수 있습니다.

Tip

AmazonKeyspacesReadOnlyAccessAmazonKeyspacesFullAccess 정책은 의도한 것보다 너무 많거나 적은 액세스를 제공할 수 있습니다. 사용 계획이 있다면 이 정책들이 요구 사항을 충족하는지 검증하세요. 사용자 지정 Amazon Keyspaces 권한 정책을 직접 만들 수도 있습니다: Amazon Keyspaces ID 기반 정책 예제.

역할 생성 1단계 역할 이름을 입력하고 "역할 생성"을 클릭합니다. 역할 생성 1단계

4/5단계. Teleport에 역할 수임 권한 부여#

다음으로, Teleport 데이터베이스 서비스 인스턴스가 사용하는 IAM 역할 또는 IAM 사용자에게 다음 정책을 연결합니다. 이 정책은 데이터베이스 서비스가 IAM 역할을 수임할 수 있도록 허용합니다:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "sts:AssumeRole",
      "Resource": "*"
    }
  ]
}
Tip

와일드카드 대신 "Resource" 필드에 특정 IAM 역할 리소스 ARN을 제공하여 정책을 더 엄격하게 만들 수 있습니다.

5/5단계. 연결#

데이터베이스 서비스가 클러스터에 참가하면 로그인하여 사용 가능한 데이터베이스를 확인합니다:

$ tsh login --proxy=teleport.example.com --user=alice
$ tsh db ls
# Name      Description Allowed Users Labels  Connect
# --------- ----------- ------------- ------- -------
# keyspaces             [*]           env=dev
$ tsh login --proxy=mytenant.teleport.sh --user=alice
$ tsh db ls
# Name      Description Allowed Users Labels  Connect
# --------- ----------- ------------- ------- -------
# keyspaces             [*]           env=dev

데이터베이스 사용자로 KeyspacesReader AWS IAM Keyspaces 역할을 사용하여 특정 데이터베이스 인스턴스에 연결하려면:

$ tsh db connect --db-user=KeyspacesReader keyspaces
# Connected to Amazon Keyspaces at localhost:55084
# [cqlsh 6.0.0 | Cassandra 3.11.2 | CQL spec 3.4.4 | Native protocol v4]
# Use HELP for help.
# KeyspacesReader@cqlsh>
Note

이 섹션의 내용은 원문 문서를 참조하세요. (proxy-db-tunnel.mdx)

데이터베이스에서 로그아웃하고 자격 증명을 제거하려면:

# 특정 데이터베이스 인스턴스의 자격 증명 제거.
$ tsh db logout keyspaces
# 모든 데이터베이스 인스턴스의 자격 증명 제거.
$ tsh db logout

추가 자료#

다음 단계#