# 오픈서치 admin 패스워드 변경

1. 마스터 노드의 터미널 접속
2. 패스워드 생성 (제공되는 tool 스크립트 이용)

```
cd /usr/share/opensearch/plugins/opensearch-security/tools

./hash.sh -p <new_password>

# example - output
sh-5.2$ ./hash.sh -p dhvmstjcl!
**************************************************************************
** This tool will be deprecated in the next major release of OpenSearch **
** https://github.com/opensearch-project/security/issues/1755           **
**************************************************************************
$2y$12$8CL1a9FLy1JwNe5q6yudZuTtzs/9.hkxvk1WnInwOV16JV3P3RoC6
```

3. 현재 설정 로드

```
// Some code./securityadmin.sh -backup my-backup-directory \
  -icl \
  -nhnv \
  -cacert ../../../config/admin/ca.crt \
  -cert ../../../config/admin/tls.crt \
  -key ../../../config/admin/tls.key
```

4. 설정을 변경하고 반영 스크립트 수행

```
# 치환할 라인 대상 검색
# admin 항목의 hash값 라인 찾기
cat -n my-backup-directory/internal_users.yml

    23	  config_version: 2
    24	admin:
    25	  hash: "$2a$12$W5jcOBWSN6/q9bOKhFbTE.m/pK.POlHkLFCcR7W79M479kq3FiOIO"
    26	  reserved: true
    27	  hidden: false
    28	  backend_roles:

# 내용 추가 (라인제거 후 내용 추가)
sed -i '행번호 d' 파일명
sed -i '행번호i\내용' 파일명
# sed -i '25d' my-backup-directory/internal_users.yml
# sed -i '25 i\  hash: "$2y$12$8CL1a9FLy1JwNe5q6yudZuTtzs/9.hkxvk1WnInwOV16JV3P3RoC6"' my-backup-directory/internal_users.yml

# 반영
./securityadmin.sh -f my-backup-directory/internal_users.yml \
  -t internalusers \
  -icl \
  -nhnv \
  -cacert ../../../config/admin/ca.crt \
  -cert ../../../config/admin/tls.crt \
  -key ../../../config/admin/tls.key
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cocktailcloud.gitbook.io/cocktail-cloud-online/log-service/setting/admin.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
