Snowflake로 데이터베이스 액세스
Teleport can provide secure access to Snowflake via the Teleport Database Service. In this guide, you will: Teleport Database Service는 데이터베이스 클라이언트용 Teleport 인증 기관이 서명한 JSON 웹 토큰이 포함된 HTTP 메시지를 사용하여 Snowflake와 통신합니다.
Teleport can provide secure access to Snowflake via the Teleport Database Service. This allows for fine-grained access control through Teleport's RBAC.
In this guide, you will:
- Configure your Snowflake database 키 쌍 인증으로.
- Add the database to your Teleport cluster.
- Connect to the database via Teleport.
작동 방식#
Teleport Database Service는 데이터베이스 클라이언트용 Teleport 인증 기관이 서명한 JSON 웹 토큰이 포함된 HTTP 메시지를 사용하여 Snowflake와 통신합니다. Snowflake는 Teleport 데이터베이스 클라이언트 CA를 신뢰하도록 구성됩니다. 사용자가 Teleport를 통해 Snowflake에 연결하면 Database Service는 사용자의 요청을 Teleport 인증된 메시지로 Snowflake에 전달합니다.


사전 조건#
-
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
tctlandtshclients.Installing `tctl` and `tsh` clients
-
Determine the version of your Teleport cluster. The
tctlandtshclients must be at most one major version behind your Teleport cluster version. Send a GET request to the Proxy Service at/v1/webapi/findand 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')" -
Follow the instructions for your platform to install
tctlandtshclients:
-
-
SECURITYADMIN역할 이상의 Snowflake 계정. -
snowsql이 설치되어 시스템PATH환경 변수에 추가되어 있어야 합니다. -
Teleport Database Service를 실행할 호스트.
자세한 내용은 설치를 참조하세요.
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.
1/5단계. Teleport Database Service 설정#
The Database Service requires a valid join token to join your Teleport cluster.
Run the following tctl command and save the token output in /tmp/token
on the server that will run the Database Service:
$ tctl tokens add --type=db --format=text
(=presets.tokens.first=)
Teleport Database Service를 실행할 곳에 Teleport를 설치하고 구성합니다:
To install a Teleport Agent on your Linux server:
The recommended installation method is the cluster install script. It will select the correct version, edition, and installation mode for your cluster.
-
Assign to your Teleport cluster hostname and port, but not the scheme (https://).
-
Run your cluster's install script:
$ curl "https:///scripts/install.sh" | sudo bash
On the host where you will run the Teleport Database Service, start Teleport with the appropriate configuration.
Note that a single Teleport process can run multiple different services, for
example multiple Database Service agents as well as the SSH Service or Application
Service. The step below will overwrite an existing configuration file, so if
you're running multiple services add --output=stdout to print the config in
your terminal, and manually adjust /etc/teleport.yaml.
Generate a configuration file at /etc/teleport.yaml for the Database Service:
(!docs/pages/includes/start-teleport.mdx service="the Teleport Database Service"!)
Teleport는 Kubernetes 클러스터에 Teleport Database Service를 설치하기 위한 Helm 차트를 제공합니다.
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
Make sure that the Teleport Agent pod is running. You should see one
teleport-kube-agent pod with a single ready container:
$ kubectl -n teleport-agent get pods
NAME READY STATUS RESTARTS AGE
teleport-kube-agent-0 1/1 Running 0 32s
(!docs/pages/includes/database-access/multiple-instances-tip.mdx !)
2/5단계. Teleport 사용자 생성#
| Flag | Description |
|---|---|
--roles |
List of roles to assign to the user. The builtin access role allows them to connect to any database server registered with Teleport. |
--db-users |
List of database usernames the user will be allowed to use when connecting to the databases. A wildcard allows any user. |
--db-names |
List of logical databases (aka schemas) the user will be allowed to connect to within a database server. A wildcard allows any database. |
For more detailed information about database access controls and how to restrict access see RBAC documentation.
3/5단계. 공개 키 내보내기#
아래 tctl auth sign 명령을 사용하여 Snowflake 사용자의 공개 키를 내보냅니다:
$ tctl auth sign --format=snowflake --out=server
이 명령은 Teleport의 공개 키가 포함된 server.pub 파일을 생성합니다. Teleport는 해당 개인 키를 사용하여 Snowflake 인증에 사용될 JWT(JSON Web Token)를 생성합니다.
4/5단계. Snowflake 사용자에 공개 키 추가#
이전에 생성한 공개 키를 사용하여 키 쌍 인증을 활성화합니다.
Snowflake 인스턴스에 로그인하고 아래 SQL 문을 실행합니다:
alter user alice set rsa_public_key='MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAv3dHYw4LJCcZzdbhb3hV...LwIDAQAB';
이 문에서 alice는 Snowflake 사용자 이름이고 rsa_public_key는 PEM 헤더/푸터(첫 번째 및 마지막 줄)를 제외하고 이전에 생성된 키입니다.
describe user 명령으로 사용자의 공개 키를 확인할 수 있습니다:
desc user alice;
자세한 내용은 Snowflake 문서를 참조하세요.
5/5단계. 연결#
Teleport 클러스터에 로그인하고 사용 가능한 데이터베이스를 확인합니다:
$ tsh login --proxy=teleport.example.com --user=alice
$ tsh db ls
# Name Description Labels
# ----------------- ------------------- --------
# example-snowflake Example Snowflake ❄ env=dev
$ tsh login --proxy=mytenant.teleport.sh --user=alice
$ tsh db ls
# Name Description Labels
# ----------------- ------------------- --------
# example-snowflake Example Snowflake ❄ env=dev
데이터베이스의 자격 증명을 가져와 연결하려면:
$ tsh db connect --db-user=alice --db-name=SNOWFLAKE_SAMPLE_DATA example-snowflake
이 섹션의 내용은 원문 문서를 참조하세요. (proxy-db-tunnel.mdx)
연결하려면 snowsql 명령줄 클라이언트가 시스템 PATH에 있어야 합니다.
데이터베이스에서 로그아웃하고 자격 증명을 제거하려면:
# 특정 데이터베이스 인스턴스의 자격 증명 제거.
$ tsh db logout example-snowflake
# 모든 데이터베이스 인스턴스의 자격 증명 제거.
$ tsh db logout
Teleport를 통한 Snowsight 액세스#
Teleport Database Service는 Snowflake 데이터베이스에 대한 CLI 및 프로그래밍 방식 액세스를 제공하지만 Snowsight 웹 인터페이스에 대한 직접 액세스는 제공하지 않습니다. Snowsight 액세스를 활성화하려면 Teleport에서 SAML 애플리케이션으로 구성하여 Teleport가 Snowsight의 ID 공급자(IdP) 역할을 할 수 있습니다.
Teleport가 Snowsight의 IdP로 구성된 경우 SAML 인증만 처리합니다. Snowsight 활동은 Teleport를 통해 감사되거나 기록되지 않습니다.
Teleport를 SAML ID 공급자로 사용하기 및 Snowflake에서 페더레이션 인증 구성하기를 따라 Teleport를 IdP로 설정합니다.
다음은 Snowflake 데이터베이스에서 생성할 보안 통합 예시입니다:
CREATE SECURITY INTEGRATION teleport_idp
TYPE = saml2
ENABLED = true
SAML2_ISSUER = 'https://teleport.example.com/enterprise/saml-idp/metadata'
SAML2_SSO_URL = 'https://teleport.example.com/enterprise/saml-idp/sso'
SAML2_PROVIDER = 'custom'
SAML2_X509_CERT = 'MII...'
SAML2_ENABLE_SP_INITIATED = true
SAML2_SP_INITIATED_LOGIN_PAGE_LABEL = 'Teleport Login'
URL과 X.509 인증서를 Teleport Web UI의 등록 플로우 중에 생성된 값으로 교체합니다. 통합을 생성한 후 통합을 설명하여 Teleport에서 구성해야 하는 Snowflake URL을 가져옵니다.
기본적으로 Teleport는 Teleport 사용자 이름을 Snowsight 계정 이름으로 전달합니다. 커스텀 매핑은 SAML IdP 속성 매핑을 참조하세요.
다음 단계#
-
Learn how to restrict access to certain users and databases.
-
View the High Availability (HA) guide.
-
Take a look at the YAML configuration reference.
-
See the full CLI reference.
