DBAtlas · 데이터베이스 운영 아틀라스

롤과 native 사용자 생성, 비밀번호 변경, API key 발급

Elasticsearch보안

명령어

POST _security/role/log_okuma
{
  "cluster": ["monitor"],
  "indices": [
    { "names": ["log-*"], "privileges": ["read", "view_index_metadata"] }
  ]
}
POST _security/user/rapor_kullanici
{
  "password": "Degistir-123!",
  "roles": ["log_okuma"],
  "full_name": "Rapor Servisi"
}
GET _security/user/rapor_kullanici
# User making this request and its roles:
GET _security/_authenticate
POST _security/user/rapor_kullanici/_password
{
  "password": "Yeni-Sifre-456!"
}
# Time-limited API key with restricted privileges:
POST _security/api_key
{
  "name": "rapor-key",
  "expiration": "30d",
  "role_descriptors": { "log_okuma": { "indices": [ { "names": ["log-*"], "privileges": ["read"] } ] } }
}
# If the elastic user's password is lost (shell on a node):
# bin/elasticsearch-reset-password -u elastic -i

하는 일

인덱스 패턴에 대한 읽기 권한을 가진 롤과 그 롤을 가진 native realm 사용자를 만들고, 비밀번호를 변경하고, 호출자의 신원을 확인하며, 권한을 좁힌 기한부 API key를 발급한다.

사용 시점

최소 권한으로 리포팅, 애플리케이션, 모니터링 계정을 만들 때, 비밀번호 교체 중, 그리고 서비스를 사용자에서 API key로 옮길 때.

주의

애플리케이션에서 elastic superuser를 사용하지 않는다. API key의 권한은 생성한 사용자의 권한을 넘을 수 없으며 role_descriptors는 권한을 좁히기만 한다. API key는 생성 시점 소유자 권한의 스냅샷으로 제한되므로 이후 롤 변경은 기존 key에 영향을 주지 않는다. 비밀번호 변경 후 이전 비밀번호를 쓰는 서비스는 401을 받으므로 전환을 계획한다. API key 응답의 encoded 값은 한 번만 반환되므로 저장해 둔다.

DBAtlas에서 열기 →