Auto-auth 방법: 애플리케이션 역할
Auto-auth 방법: 애플리케이션 역할 (AppRole)
approle 방법은 파일에서 역할 ID와 시크릿 ID를 읽어 그 값을 AppRole 인증 방법에 보냅니다.
이 방법은 값을 캐시하므로 역할 ID/시크릿 ID 파일은 읽은 후 삭제해도 안전합니다. 실제로 기본적으로 시크릿 ID를 읽은 후 에이전트는 그 파일을 삭제합니다. 예상 위치에 새 파일이나 값이 쓰여지면 다음 인증에서 사용되며 새 값이 캐시됩니다.
출처: 문서
본문
구성 (Configuration)
role_id_file_path(string: required)— 역할 ID가 든 파일의 경로입니다.secret_id_file_path(string: optional)— 시크릿 ID가 든 파일의 경로입니다. 설정하지 않으면role-id만 사용됩니다. 이 경우 AppRole에bind_secret_id가false로 설정되어 있어야 합니다. 그렇지 않으면 Vault Agent가 로그인할 수 없습니다.remove_secret_id_file_after_reading(bool: optional, 기본값 true)— 시크릿 ID 파일을 읽은 후 제거하는 기본 동작을 비활성화하려면false로 설정할 수 있습니다.secret_id_response_wrapping_path(string: optional)— 설정하면secret_id_file_path의 값이 역할의 시크릿 ID 검색 엔드포인트(예:auth/approle/role/webservers/secret-id)의 출력을 담은 Response-Wrapping 토큰일 것으로 예상되며, 해당 response-wrapping 토큰의 생성 경로가 여기에 설정된 값과 일치해야 합니다.
예시 구성
approle을 사용해 auto-auth를 활성화하고 평문 토큰 싱크와 response-wrapped 토큰 싱크 파일을 모두 만드는 예시 구성은 다음과 같습니다.
pid_file = "./pidfile"
vault {
address = "https://127.0.0.1:8200"
}
auto_auth {
method {
type = "approle"
config = {
role_id_file_path = "roleid"
secret_id_file_path = "secretid"
remove_secret_id_file_after_reading = false
}
}
sink {
type = "file"
wrap_ttl = "30m"
config = {
path = "sink_file_wrapped_1.txt"
}
}
sink {
type = "file"
config = {
path = "sink_file_unwrapped_2.txt"
}
}
}
api_proxy {
use_auto_auth_token = true
}
listener "tcp" {
address = "127.0.0.1:8100"
tls_disable = true
}
template {
source = "/etc/vault/server.key.ctmpl"
destination = "/etc/vault/server.key"
}
template {
source = "/etc/vault/server.crt.ctmpl"
destination = "/etc/vault/server.crt"
}