인증과 권한
인증과 권한 (Authentication and Authorization)
Apache Druid에서 익스텐션에 특화되지 않은 인증(authentication)과 권한 부여(authorization) 구성을 설명하는 문서예요. Authenticator 체인, Escalator, Authorizer, 그리고 내부 시스템 사용자(internal system user) 처리 방식을 다루어요.
출처: 문서
본문
이 문서는 익스텐션에 특화되지 않은 Apache Druid 인증 및 권한 부여 구성을 설명해요.
공통 설정 (Common configuration)
다음은 인증·권한과 관련된 공통 설정 프로퍼티 목록이에요.
| 프로퍼티 | 타입 | 설명 | 기본값 | 필수 |
|---|---|---|---|---|
druid.auth.authenticatorChain |
JSON List of Strings | Authenticator 타입 이름 목록 | ["allowAll"] | 아니요 |
druid.escalator.type |
String | 내부 Druid 통신에 사용할 Escalator 타입. 이 Escalator는 druid.auth.authenticatorChain의 Authenticator가 지원하는 인증 스킴을 사용해야 해요. |
"noop" | 아니요 |
druid.auth.authorizers |
JSON List of Strings | Authorizer 타입 이름 목록 | ["allowAll"] | 아니요 |
druid.auth.unsecuredPaths |
List of Strings | 보안 검사가 수행되지 않을 경로 목록. 이 경로에 대한 모든 요청이 허용돼요. | [] | 아니요 |
druid.auth.allowUnauthenticatedHttpOptions |
Boolean | 미인증 사용자의 HTTP OPTIONS 요청을 허용할지 여부. 주로 CORS preflight 요청 지원에 유용하며, Druid는 이를 직접 지원하지 않지만 타사 익스텐션으로 활성화할 수 있어요. 활성화하면 druid.server.http.allowedHttpMethods에 "OPTIONS"를 추가해야 해요. OPTIONS 요청에 대한 인증 검사를 비활성화하면 미인증 사용자가 어떤 Druid 엔드포인트가 유효한지(OPTIONS 요청이 404 대신 200을 반환하는지 확인) 알아낼 수 있어요. 이 옵션을 활성화하면 로드된 익스텐션 정보 등 서버 구성에 대한 정보가 미인증 사용자에게 노출돼요. |
false | 아니요 |
인증/권한 허용 로드 테스트 (Enabling Authentication/AuthorizationLoadingLookupTest)
Authenticator 체인 (Authenticator chain)
인증 결정은 Authenticator 인스턴스의 체인에 의해 처리돼요. 요청은 druid.auth.authenticatorChain에 정의된 순서대로 Authenticator에 의해 확인돼요.
Authenticator 구현은 익스텐션에 의해 제공돼요.
예를 들어 다음 authenticator chain 정의는 druid-kerberos와 druid-basic-security 코어 익스텐션의 Kerberos 및 HTTP Basic authenticator를 각각 활성화해요.
druid.auth.authenticatorChain=["kerberos", "basic"]
요청은 체인의 모든 Authenticator를 통과하며, Authenticator 중 하나가 요청을 성공적으로 인증하거나 HTTP 오류 응답을 보낼 때까지 계속돼요. 첫 번째 성공적인 인증 후 또는 요청이 오류 응답으로 종료되면 체인의 나중 Authenticator는 건너뛰어져요.
체인의 어떤 Authenticator도 요청을 성공적으로 인증하지 못했거나 HTTP 오류 응답을 보내지 않았다면, 체인 끝에서 HTTP 오류 응답이 전송돼요.
Druid에는 두 개의 내장 Authenticator가 있으며, 하나는 기본 비보안 구성에 사용돼요.
AllowAll authenticator
이 내장 Authenticator는 모든 요청을 인증하고 항상 allowAll이라는 이름의 Authorizer로 라우팅해요. 기본 비보안 구성이 아닌 용도로는 사용하지 않는 것이 좋아요.
druid.auth.authorizer.allowAll.type=allowAll
Anonymous authenticator (Anonymous authenticator)
이 내장 Authenticator는 모든 요청을 인증하고 사용자가 구성에서 지정한 Authorizer로 라우팅해요. 기본 수준의 접근을 추가하기 위해 사용되며, Anonymous Authenticator는 authenticator chain의 끝에 추가해야 해요. 체인 끝의 Anonymous Authenticator에 도달한 요청은 Anonymous Authenticator에 연결된 Authorizer가 어떻게 구성되었는지에 따라 성공하거나 실패해요.
| 프로퍼티 | 설명 | 기본값 | 필수 |
|---|---|---|---|
druid.auth.authenticator.<authenticatorName>.authorizerName |
요청이 라우팅될 Authorizer | N/A | 예 |
druid.auth.authenticator.<authenticatorName>.identity |
요청자의 신원(identity) | defaultUser | 아니요 |
Anonymous Authenticator를 사용하려면 anonymous 타입의 authenticator를 authenticatorChain에 추가하세요.
예를 들어 다음은 druid-basic-security 익스텐션과 함께 Anonymous Authenticator를 활성화해요.
druid.auth.authenticatorChain=["basic", "anonymous"]
druid.auth.authenticator.anonymous.type=anonymous
druid.auth.authenticator.anonymous.identity=defaultUser
druid.auth.authenticator.anonymous.authorizerName=myBasicAuthorizer
# ... usual configs for basic authentication would go here ...
신뢰 도메인 Authenticator (Trusted domain Authenticator)
이 내장 Trusted Domain Authenticator는 구성된 신뢰 도메인에서 온 요청을 인증하고 사용자가 구성에서 지정한 Authorizer로 라우팅해요. 기본 수준의 신뢰를 추가하고 같은 도메인 내 호스트의 접근을 허용하기 위해 사용되요.
| 프로퍼티 | 설명 | 기본값 | 필수 |
|---|---|---|---|
druid.auth.authenticator.<authenticatorName>.name |
authenticator 이름 | N/A | 예 |
druid.auth.authenticator.<authenticatorName>.domain |
요청이 인증될 신뢰 도메인. 특정 호스트에서 온 연결만 인증하려면 해당 호스트의 완전한 호스트 이름을 지정해야 해요. | N/A | 예 |
druid.auth.authenticator.<authenticatorName>.useForwardedHeaders |
Druid에 연결하는 클라이언트는 여러 프록시 레이어를 통과할 수 있어요. 일부 프록시는 요청을 다른 프록시로 전달하기 전에 자체 IP 주소를 'X-Forwarded-For' 헤더에 추가하기도 하고, 클라이언트를 대신해 연결하기도 해요. 이 설정이 true이고 'X-Forwarded-For'가 있으면 trusted domain authenticator는 X-Forwarded-For 헤더의 가장 왼쪽 호스트 이름을 사용해요. 주의: HTTP 요청에서 X-Forwarded-For 헤더를 스푸핑할 수 있으므로 조심해서 활성화하세요. | false | 아니요 |
druid.auth.authenticator.<authenticatorName>.authorizerName |
요청이 라우팅될 Authorizer | N/A | 예 |
druid.auth.authenticator.<authenticatorName>.identity |
요청자의 신원 | defaultUser | 아니요 |
Trusted Domain Authenticator를 사용하려면 trustedDomain 타입의 authenticator를 authenticatorChain에 추가하세요.
예를 들어 다음은 Trusted Domain Authenticator를 활성화해요.
druid.auth.authenticatorChain=["trustedDomain"]
druid.auth.authenticator.trustedDomain.type=trustedDomain
druid.auth.authenticator.trustedDomain.domain=trustedhost.mycompany.com
druid.auth.authenticator.trustedDomain.identity=defaultUser
druid.auth.authenticator.trustedDomain.authorizerName=myBasicAuthorizer
druid.auth.authenticator.trustedDomain.name=myTrustedAutenticator
# ... usual configs for druid would go here ...
Escalator
druid.escalator.type 프로퍼티는 내부 Druid 클러스터 통신(예: Broker 프로세스가 쿼리 처리를 위해 Historical 프로세스와 통신할 때)에 어떤 인증 스킴을 사용할지를 결정해요.
이 프로퍼티에 선택된 Escalator는 druid.auth.authenticatorChain의 Authenticator가 지원하는 인증 스킴을 사용해야 해요. 특정 인증 스킴을 내부 Druid 통신에 사용하려 한다면 Authenticator 익스텐션 구현자는 그에 대응하는 Escalator 구현도 함께 제공해야 해요.
Noop escalator
이 내장 기본 Escalator는 기본 AllowAll Authenticator와 Authorizer에서만 사용하기 위한 것이에요.
Authorizer
권한 부여 결정은 Authorizer에 의해 처리돼요. druid.auth.authorizers 프로퍼티는 어떤 Authorizer 구현이 활성화될지를 결정해요.
"default"와 "noop" 두 개의 내장 Authorizer가 있으며, 다른 구현은 익스텐션에 의해 제공돼요.
예를 들어 다음 authorizers 정의는 druid-basic-security의 "basic" 구현을 활성화해요.
druid.auth.authorizers=["basic"]
하나의 요청을 승인하는 Authorizer는 단 하나만 있어요.
AllowAll authorizer
"allowAll" 타입 이름의 Authorizer는 모든 요청을 수락해요.
기본 비보안 구성 (Default Unsecured Configuration)
druid.auth.authenticatorChain을 비워 두거나 지정하지 않으면, Druid는 "allowAll"이라는 이름의 단일 AllowAll Authenticator로 authenticator chain을 생성해요.
druid.auth.authorizers를 비워 두거나 지정하지 않으면, Druid는 "allowAll"이라는 이름의 단일 AllowAll Authorizer를 생성해요.
druid.escalator.type의 기본값은 기본 비보안 Authenticator/Authorizer 구성과 일치하도록 "noop"이에요.
Authenticator에서 Authorizer로의 라우팅 (Authenticator to Authorizer Routing)
Authenticator가 요청을 성공적으로 인증하면 요청에 AuthenticationResult를 첨부해야 해요. 이 결과에는 요청자의 신원 정보와, 인증된 요청을 승인해야 하는 Authorizer의 이름이 포함돼요.
Authenticator 구현은 설정을 통해 사용자가 Authenticator가 요청을 라우팅할 Authorizer를 선택할 수 있는 수단을 제공해야 해요.
내부 시스템 사용자 (Internal system user)
Druid 프로세스 간 내부 요청(사용자 주도가 아닌 통신)에는 인증 자격 증명이 첨부되어야 해요.
이러한 요청은 Druid 클러스터 자체를 나타내고 전체 접근 권한을 가진 신원인 "내부 시스템 사용자(internal system user)"로 실행되어야 해요.
내부 시스템 사용자가 어떻게 정의되는지에 대한 세부 사항은 익스텐션 구현에 맡겨져 있어요.
Authorizer의 내부 시스템 사용자 처리 (Authorizer Internal System User Handling)
Authorizer 구현은 전체 접근 권한을 가진 "내부 시스템 사용자"의 신원을 인식하고 승인해야 해요.
Authenticator와 Escalator의 내부 시스템 사용자 처리 (Authenticator and Escalator Internal System User Handling)
내부 Druid 통신을 지원하려는 Authenticator 구현은 대응하는 Escalator 구현이 제공하는 "내부 시스템 사용자"의 자격 증명을 인식해야 해요.
Escalator는 내부 시스템 사용자와 관련된 세 가지 메서드를 구현해야 해요.
public HttpClient createEscalatedClient(HttpClient baseClient);
public org.eclipse.jetty.client.HttpClient createEscalatedJettyClient(org.eclipse.jetty.client.HttpClient baseClient);
public AuthenticationResult createEscalatedAuthenticationResult();
createEscalatedClient는 "내부 시스템 사용자"의 자격 증명을 요청에 첨부하는 래핑된 HttpClient를 반환해요.
createEscalatedJettyClient는 createEscalatedClient와 비슷하지만 Jetty HttpClient에 대해 동작해요.
createEscalatedAuthenticationResult는 "내부 시스템 사용자"의 신원을 담은 AuthenticationResult를 반환해요.
예약 이름 구성 프로퍼티 (Reserved Name Configuration Property)
익스텐션 구현자에게, 다음 구성 프로퍼티는 Authenticator와 Authorizer의 이름을 위해 예약되어 있어요.
druid.auth.authenticator.<authenticator-name>.name=<authenticator-name>
druid.auth.authorizer.<authorizer-name>.name=<authorizer-name>
이 프로퍼티들은 authenticator와 authorizer 이름을 @JsonProperty 파라미터로 구현에 제공하며, 같은 타입의 authenticator나 authorizer가 여러 개 구성된 경우 유용할 수 있어요.
더 알아보기 (Learn more)
- LDAP 인증 문서에서 LDAP를 통한 인증 설정을 살펴보세요.
- druid-basic-security 익스텐션 문서에서 기본 보안 익스텐션을 알아보아요.
- SQL 기반 인제스트 보안 문서에서 MSQ 태스크 엔진의 권한 모델을 확인해 보세요.