서버 접근 제어
Teleport v18.9Teleport의 역할 기반 접근 제어(RBAC) 시스템을 사용하면 Teleport에 연결된 Linux 서버에 대한 인증을 세밀하게 제어하는 권한을 설정할 수 있습니다. 정책의 한 예로 서버 관리자는 모든 것에 접근할 수 있고, QA 팀과 엔지니어는 스테이징 서버에 대한 전체 접근 권한을 가지며, 엔지니어는 긴급 상황 시 프로덕션 서버에 대한 임시 접근 권한을 얻을 수 있다와 같은 정책을 들 수 있습니다.
Teleport의 역할 기반 접근 제어(RBAC) 시스템을 사용하면 Teleport에 연결된 Linux 서버에 대한 인증을 세밀하게 제어하는 권한을 설정할 수 있습니다.
정책의 한 예로 서버 관리자는 모든 것에 접근할 수 있고, QA 팀과 엔지니어는 스테이징 서버에 대한 전체 접근 권한을 가지며, 엔지니어는 긴급 상황 시 프로덕션 서버에 대한 임시 접근 권한을 얻을 수 있다와 같은 정책을 들 수 있습니다.
이 페이지에서는 Teleport로 보호되는 서버에 대한 접근을 구성하기 위해 Teleport 역할에서 사용할 수 있는 구성 옵션을 설명합니다.
Teleport 역할에 대한 보다 일반적인 설명과 예시는 접근 제어 가이드를 참조하세요. 이 섹션은 Teleport에 연결된 서버에 대한 RBAC를 구성하는 데 초점을 맞춥니다.
역할 구성#
Teleport의 "역할" 리소스는 서버 접근을 제한하기 위해 다음과 같은 수단을 제공합니다.
kind: role
version: v5
metadata:
name: developer
spec:
allow:
# The logins array defines the OS/UNIX logins a user is allowed to use.
# both strings and template variables are supported in this field
logins: [ubuntu, debian, '{{internal.logins}}']
# node_labels: a user with this role will be allowed to connect to
# SSH nodes whose labels match any of the expressions below.
node_labels:
# literal strings:
'env': 'test'
# the wildcard ('*') means "any node"
'*': '*'
# a list of allowed values:
'region': ['us-west-1', 'eu-central-1']
# regular expressions start with ^ and end with $
# Teleport uses Go's regexp syntax (https://github.com/google/re2/wiki/Syntax)
# the list example above can be expressed as:
'reg': '^us-west-1|eu-central-1$'
# List of host groups the created user will be added to. Any that don't
# already exist are created. Only applies when create_host_user_mode
# is not 'off'.
host_groups: [ubuntu, nginx, other]
# Assign the user to the sudoers group
host_sudoers:
- 'ALL=(ALL) NOPASSWD: ALL'
# Deny access to the root user
deny:
logins:
- root
거부 규칙(Deny rules)은 우선적으로(탐욕적으로) 매칭됩니다. 위 예시에서 "root" 서버 사용자 계정을 사용하려는 서버 세션 시도는 거부됩니다.
템플릿 변수#
Teleport에서 다른 리소스에 접근하기 위한 역할 필드와 마찬가지로, 서버 관련 필드도 템플릿 변수를 지원합니다.
{{external.xyz}} 형식의 변수는 외부 SSO 제공업체의 값으로 대체됩니다. OIDC 로그인의 경우 {{external.xyz}}는 "xyz" 클레임을 참조하며, SAML 로그인의 경우 {{external.xyz}}는 "xyz" 어설션을 참조합니다.
예를 들어, 사용자의 Okta environments 및 allowedlogins 어설션으로부터 허용된 서버 환경 유형과 허용된 로그인을 할당하려는 경우 역할은 다음과 같은 형태가 될 수 있습니다.
spec:
allow:
node_labels:
- env: '{{external.environments}}'
logins:
- '{{external.allowedlogins}}'
{{internal.logins}} 변수는 로컬 사용자에게 적용되며 Teleport 트러스티드 클러스터와 함께 작동합니다. 트러스티드 클러스터를 사용하면 루트 Teleport 클러스터에서 다른 Teleport 클러스터에 연결된 리소스로 연결할 수 있습니다. 리프 클러스터로 식별되는 이러한 Teleport 클러스터는 루트 Teleport 클러스터를 신뢰함으로써 연결을 허용합니다.
예를 들어, 루트 클러스터의 사용자가 다음 역할을 가지고 있다고 가정합니다. 로컬 사용자로서 이 사용자는 logins 트레이트로 jeff를 가질 수 있으므로 jeff와 ubuntu 두 가지 로그인을 갖게 됩니다.
spec:
allow:
logins: ['{{internal.logins}}', ubuntu]
리프 클러스터의 역할은 사용자에게 허용된 서버 계정과 이름을 사용하도록 설정할 수 있습니다. 그러면 {{internal.logins}} 템플릿 변수가 사용될 때 리프 클러스터는 루트 클러스터에서 허용된 것과 동일한 로그인을 포함하게 됩니다.
spec:
allow:
logins: ["{{internal.logins}}"]
Teleport 역할에서 변수 확장이 작동하는 방식에 대한 전체 세부 정보는 접근 제어 참조를 참조하세요.
서버 역할 옵션#
위에서 설명한 allow 및 deny 섹션은 허용되는 서버와 로그인을 제어하는 데 사용됩니다. 역할 옵션은 지정된 역할을 가진 사용자가 사용할 수 있는 Teleport 기능을 제공합니다. 이러한 옵션은 서버 접근에 적용됩니다.
spec:
allow:
#....
options:
# Sets the default shell for automatically provisioned SSH users. An absolute path to a shell or a name
# reachable through the system PATH are both valid values. Only applies when
# create_host_user_mode is not set to off.
create_host_user_default_shell: bash
# Controls whether this role supports automatically provisioning of users.
# Options: keep (keep users at session end), insecure-drop (remove user on session end),
# and off (disable host user creation)
create_host_user_mode: keep
# forward_agent controls whether SSH agent forwarding is allowed
forward_agent: true
# ssh_port_forwarding controls which TCP port forwarding modes are allowed over SSH. This replaces
# the deprecated port_forwarding field, which did not differentiate between remote and local
# port forwarding modes. If you have any existing roles that allow forwarding by enabling the
# legacy port_forwarding field then the forwarding controls configured in ssh_port_forwarding will be
# ignored.
ssh_port_forwarding:
# configures remote port forwarding behavior
remote:
enabled: true
# configures local port forwarding behavior
local:
enabled: true
# ssh_file_copy controls whether file copying (SCP/SFTP) is allowed.
# Defaults to true.
ssh_file_copy: false
# client_idle_timeout determines if SSH sessions to cluster nodes are
# forcefully terminated after no activity from a client (idle client).
# It overrides the global cluster setting. examples: "30m", "1h" or "1h30m"
client_idle_timeout: never
# Determines if the clients will be forcefully disconnected when their
# certificates expire in the middle of an active session.
# It overrides the global cluster setting.
disconnect_expired_cert: false
# max_sessions is total number of session channels that can be established
# across a single connection. Setting it to 10 matches OpenSSH default behavior.
max_sessions: 10
# Defines which events are recorded by the BPF-based session recorder.
enhanced_recording:
- command
- disk
- network
# permit_x11_forwarding allows users to use X11 forwarding with openssh
# clients and servers through the proxy
permit_x11_forwarding: true
# The Enterprise-only max_connections field sets a limit of concurrent sessions within a
# cluster. This setting slows down Teleport performance because it has to track
# connections cluster-wide.
max_connections: 2
# Define how Teleport deals with session recording failures, such as a full
# disk error. The value can be set to either `best_effort` or `strict`. If
# set to `strict`, the session will terminate immediately. If set to
# `best_effort`, the session won’t be terminated, and the recording will be
# disabled. The configuration is done per service (currently, only `ssh` is
# supported).
record_session:
# Optional: the default session recording mode to use when a
# protocol-specific mode is not set.
default: best_effort|strict
# Optional: Session recording mode for SSH sessions.
# If not set, the value set on default will be used.
ssh: best_effort|strict
# Require an additional MFA tap to start new sessions.
# Optional: the default is false.
require_session_mfa: true
# Enterprise-only: when enabled, the source IP that was used to log in is embedded in the user
# certificates, preventing a compromised certificate from being used on another
# network. The default is false.
pin_source_ip: true
# Specify a list of names and associated values to be included in user SSH keys.
# The key type can only be "ssh" and the mode can only be "extension".
# The name and value fields can be arbitrary strings and the value field
# supports variable interpolation.
cert_extensions:
- type: ssh
mode: extension
name: login@github.com
value: "{{ external.github_login }}"