사용자와 인증 방법용 Terraform 패턴

사용자와 인증 방법용 Terraform 패턴 (Terraform patterns for users and auth methods)

Terraform 패턴으로 Boundary password와 LDAP 인증 방법을 만들고, 계정을 추가해서 사용자와 연결해 그룹 멤버십과 역할 기반 접근을 할당할 수 있어요. Boundary는 password, OIDC(OpenID Connect), LDAP(경량 디렉터리 접근 프로토콜) 인증 방법을 지원합니다.

이 페이지는 인증 방법, 계정, 사용자 생성만 다룹니다. 사용자 그룹화와 역할 할당은 그룹과 RBAC 페이지를 참고하세요.

인증 방법 가장 적합한 경우
Password 단순하고 자체 관리하는 자격 증명
LDAP 기존 디렉터리 기반 아이덴티티 프로바이더
OIDC OpenID Connect를 지원하는 페더레이션 아이덴티티 프로바이더

출처: HashiCorp Boundary docs

본문

사전 요구 사항

이 문서는 독자가 다음을 갖추고 있다고 가정합니다:

  • Terraform 기초에 대한 이해
  • 기존 Boundary 설치
  • Terraform Boundary 프로바이더 구성
  • 사용자와 인증 방법을 추가할 스코프 생성

인증 방법 구성

다음은 password 인증 방법을 만드는 예시입니다. Terraform은 scope_id 옵션이 지정한 스코프에 인증 방법을 만듭니다.

resource "boundary_auth_method" "password" {
  scope_id = boundary_scope.org.id
  type     = "password"
}

LDAP 인증 방법 구성

다음 예시는 기존 아이덴티티 프로바이더에 Boundary를 연결하기 위해 LDAP 인증 방법을 구성하는 방법을 보여줍니다.

resource "boundary_auth_method_ldap" "forumsys_ldap" {
  name          = "forumsys public LDAP"
  scope_id      = "global"                               # add the new auth method to the global scope
  urls          = ["ldap://ldap.forumsys.com"]           # the addr of the LDAP server
  user_dn       = "dc=example,dc=com"                    # the basedn for users
  user_attr     = "uid"                                  # the user attribute
  group_dn      = "dc=example,dc=com"                    # the basedn for groups
  bind_dn       = "cn=read-only-admin,dc=example,dc=com" # the dn to use when binding
  bind_password = "password"                             # passwd to use when binding
  state         = "active-public"                        # make sure the new auth-method is available to everyone
  enable_groups = true                                   # this turns-on the discovery of a user's groups
  discover_dn   = true                                   # this turns-on the discovery of an authenticating user's dn
}

계정과 사용자 구성

인증 방법을 만든 다음에는 그 인증 방법에 계정을 추가하고, 계정을 나타내는 사용자를 만들어야 해요. 사용자와 계정은 서로 다른 구성 요소입니다. 사용자는 지원되는 인증 방법으로 만든 하나 이상의 계정에 연결되는 '부모' 객체입니다.

이 예시는 password 인증 방법과 연결된 사용자를 사용해 계정 2개를 만듭니다.

# Create a user named "Jeff"
resource "boundary_account_password" "jeff" {
  auth_method_id = boundary_auth_method.password.id
  type           = "password"
  login_name     = "jeff"
  password       = "$uper$ecure"
}

# Associate the Jeff account with a user alias
resource "boundary_user" "jeff" {
  name        = "jeff"
  description = "Jeff's user resource"
  account_ids = [boundary_account_password.jeff.id]
  scope_id    = boundary_scope.org.id
}

#Create a user named Susmitha
resource "boundary_account_password" "susmitha" {
  auth_method_id = boundary_auth_method.password.id
  type           = "password"
  login_name     = "susmitha"
  password       = "more$super$ecure"
}

# And this associates the account with a user alias
resource "boundary_user" "susmitha" {
  name        = "susmitha"
  description = "Susmitha's user resource"
  account_ids = [boundary_account_password.susmitha.id]
  scope_id    = boundary_scope.org.id
}

관련 인증 방법 및 계정 문서

이 주제에서 언급한 Boundary 리소스에 대한 자세한 내용은 도메인 모델 문서를 참고하세요:

Terraform으로 다음 리소스를 관리하는 방법에 대한 자세한 내용은 Boundary 프로바이더 문서를 참고하세요:

더 알아보기 (Learn more)

사용자와 인증 방법을 만든 다음에는 사용자용 그룹을 만들거나, 사용자가 수행할 수 있는 작업을 정의하는 RBAC를 구성하고 싶을 거예요.