가이드 제목은 [도구명] [내용]-하기 형태(ex Bitbucket Cloud 저장소 생성하기)로 입력한다.
이 문서에 대한 요약 /개요를 입력한다. (구글에서 검색되었을때 표시되는 문장)
이 문서는 Confluence의 DB 패스워드 정보를 암호화하는 가이드를 공유하기 위해 작성되었다.
가이드에 사용되는 도구 정보를 입력한다.
|
첨부한 이미지 너비는 800px 을 넘기지 않는다.
이 방법은 암호화된 패스워드를 구성 파일의 어느 곳에도 저장할 필요가 없기 때문에 권한이 없는 당사자가 패스워드를 찾아 해독하기 어렵게 하므로 더 많은 보안을 제공합니다.
아래 표를 참고하여 암호화 JSON object 준비
예)
{"plainTextPassword":"Your DB Password","algorithm":"AES/CBC/PKCS5PADDING","algorithmKey":"AES"} |
Field | Description |
---|---|
plainTextPassword | Password in plaintext. |
algorithm | You can choose one of the following algorithms:
|
algorithmKey | The algorithm key must correspond with the algorithm chosen above:
|
<Confluence-Install Directory>/bin으로 이동하여 아래 명령 입력
#Confluence 버전이 8.5.X 이하인 경우 java -cp "./*" com.atlassian.db.config.password.tools.CipherTool -c com.atlassian.db.config.password.ciphers.algorithm.AlgorithmCipher #Confluence 버전이 8.6X 이상인 경우 java -cp "./*" com.atlassian.secrets.cli.db.DbCipherTool -c com.atlassian.secrets.store.algorithm.AlgorithmSecretStore #java 명령어 입력시 아래와 같이 텍스트 출력되면서 파일이 3개 생성됨 2023-10-13 00:30:49,016 main INFO [com.atlassian.secrets.DefaultSecretStoreProvider] Initiating secret store class: com.atlassian.secrets.store.algorithm.AlgorithmSecretStore 2023-10-13 00:30:50,811 main DEBUG [secrets.store.algorithm.AlgorithmSecretStore] Initiate AlgorithmCipher 2023-10-13 00:30:50,891 main DEBUG [secrets.store.algorithm.AlgorithmSecretStore] Encrypting data... 2023-10-13 00:30:50,950 main DEBUG [store.algorithm.serialization.EnvironmentVarBasedConfiguration] Will try to read file path from environment variable under: com_atlassian_db_config_password_ciphers_algorithm_java_security_AlgorithmParameters 2023-10-13 00:30:50,951 main DEBUG [store.algorithm.serialization.EnvironmentVarBasedConfiguration] Nothing found under environment variable. 2023-10-13 00:30:51,093 main DEBUG [store.algorithm.serialization.UniqueFilePathGenerator] Will use generated name: java.security.AlgorithmParameters_1234567890 2023-10-13 00:30:51,108 main DEBUG [secrets.store.algorithm.AlgorithmSecretStore] Name of generated file with algorithm params used for encryption: java.security.AlgorithmParameters_1234567890 2023-10-13 00:30:51,111 main DEBUG [store.algorithm.serialization.EnvironmentVarBasedConfiguration] Will try to read file path from environment variable under: com_atlassian_db_config_password_ciphers_algorithm_javax_crypto_spec_SecretKeySpec 2023-10-13 00:30:51,111 main DEBUG [store.algorithm.serialization.EnvironmentVarBasedConfiguration] Nothing found under environment variable. 2023-10-13 00:30:51,220 main DEBUG [store.algorithm.serialization.UniqueFilePathGenerator] Will use generated name: javax.crypto.spec.SecretKeySpec_1234567890 2023-10-13 00:30:51,245 main DEBUG [store.algorithm.serialization.SerializationFile] Saved file: javax.crypto.spec.SecretKeySpec_1234567890 2023-10-13 00:30:51,353 main DEBUG [store.algorithm.serialization.UniqueFilePathGenerator] Will use generated name: javax.crypto.SealedObject_1234567890 2023-10-13 00:30:51,357 main DEBUG [store.algorithm.serialization.SerializationFile] Saved file: javax.crypto.SealedObject_1234567890 2023-10-13 00:30:51,369 main DEBUG [secrets.store.algorithm.AlgorithmSecretStore] Encryption done. Success! For Jira, set the following properties in dbconfig.xml: <atlassian-password-cipher-provider>com.atlassian.secrets.store.algorithm.AlgorithmSecretStore</atlassian-password-cipher-provider> <password>{"sealedObjectFilePath":"javax.crypto.SealedObject_1234567890","keyFilePath":"javax.crypto.spec.SecretKeySpec_1234567890"}</password> For Bitbucket, set the following properties in bitbucket.properties: jdbc.password.decrypter.classname=com.atlassian.secrets.store.algorithm.AlgorithmSecretStore jdbc.password={"sealedObjectFilePath":"javax.crypto.SealedObject_1234567890","keyFilePath":"javax.crypto.spec.SecretKeySpec_1234567890"} For Bamboo, set the following properties in bamboo.cfg.xml: <property name="jdbc.password.decrypter.classname">com.atlassian.secrets.store.algorithm.AlgorithmSecretStore</property> <property name="hibernate.connection.password">{"sealedObjectFilePath":"javax.crypto.SealedObject_1234567890","keyFilePath":"javax.crypto.spec.SecretKeySpec_1234567890"}</property> For Confluence, set the following properties in confluence.cfg.xml: <property name="jdbc.password.decrypter.classname">com.atlassian.secrets.store.algorithm.AlgorithmSecretStore</property> <property name="hibernate.connection.password">{"sealedObjectFilePath":"javax.crypto.SealedObject_1234567890","keyFilePath":"javax.crypto.spec.SecretKeySpec_1234567890"}</property> |
업그레이드 등을 대비하여 변경되지 않을 위치로 아래 3개 파일 이동
#생성된 파일 3개 javax.crypto.SealedObject_[timestamp] 암호화된 비밀번호가 있는 파일입니다. javax.crypto.spec.SecretKeySpec_[timestamp] 암호를 암호화하는 데 사용되는 키입니다. 암호를 해독하려면 이 파일이 필요합니다. java.security.AlgorithmParameters_[timestamp] 암호를 암호화하는 데 사용되는 알고리즘 매개 변수입니다. 암호를 다시 만들려는 경우에만 이 파일이 필요합니다. #파일 이동 mv javax.crypto.SealedObject_[timestamp] javax.crypto.spec.SecretKeySpec_[timestamp] <Confluence-home>/dbkeys/ |
이 단계는 선택 사항이지만 추가 보안을 위해 수행하는 것이 좋습니다. |
생성된 파일에 대한 경로를 환경 변수로 저장하도록 선택할 수 있습니다. 경로가 파일에 없는 경우 Confluence는 특정 환경 변수에서 자동으로 경로를 찾습니다. 이렇게 하면 파일 경로가 파일에 저장되지 않으므로 암호화에 사용되는 파일을 찾기가 어렵습니다.
#환경변수 선언 export com_atlassian_db_config_password_ciphers_algorithm_javax_crypto_spec_SecretKeySpec=<Confluence-home>/dbkeys/javax.crypto.spec.SecretKeySpec_1234567890 export com_atlassian_db_config_password_ciphers_algorithm_javax_crypto_SealedObject=<Confluence-home>/dbkeys/javax.crypto.SealedObject_1234567890 |
#환경 변수 선언 <property name="jdbc.password.decrypter.classname">com.atlassian.secrets.store.algorithm.AlgorithmSecretStore</property> <property name="hibernate.connection.password">{}</property> #환경 변수 미선언(Linux계열) <property name="jdbc.password.decrypter.classname">com.atlassian.secrets.store.algorithm.AlgorithmSecretStore</property> <property name="hibernate.connection.password">{"sealedObjectFilePath":"<Confluence-home>/dbkeys/javax.crypto.SealedObject_1234567890","keyFilePath":"<Confluence-home>/dbkeys/javax.crypto.spec.SecretKeySpec_1234567890"}</property> #환경 변수 미선언(Windows계열) <property name="jdbc.password.decrypter.classname">com.atlassian.secrets.store.algorithm.AlgorithmSecretStore</property> <property name="hibernate.connection.password">{"sealedObjectFilePath":"C:/confluence/javax.crypto.SealedObject_1234567890","keyFilePath":"C:/confluence/javax.crypto.spec.SecretKeySpec_1234567890"}</property> |
데이터베이스 암호를 해독하려면 아래의 절차를 따릅니다.
java -cp "./*" com.atlassian.secrets.cli.db.DbCipherTool -c com.atlassian.secrets.store.algorithm.AlgorithmSecretStore -m decrypt |
패스워드를 묻는 메시지가 표시되면 confluence.cfg.xml에 기입된 아래 내용을 입력합니다.
<property name="hibernate.connection.password">{"sealedObjectFilePath":"<Confluence-home>/dbkeys/javax.crypto.SealedObject_1234567890","keyFilePath":"<Confluence-home>/dbkeys/javax.crypto.spec.SecretKeySpec_1234567890"}</property> |
복호화 성공 시 아래와 유사한 메시지가 노출되며 패스워드를 확인 할 수 있습니다.
2023-10-13 05:01:14,203 main INFO [com.atlassian.secrets.DefaultSecretStoreProvider] Initiating secret store class: com.atlassian.secrets.store.algorithm.AlgorithmSecretStore 2023-10-13 05:01:15,991 main DEBUG [secrets.store.algorithm.AlgorithmSecretStore] Initiate AlgorithmCipher 2023-10-13 05:01:16,068 main DEBUG [secrets.store.algorithm.AlgorithmSecretStore] Decrypting data... 2023-10-13 05:01:16,250 main DEBUG [secrets.store.algorithm.AlgorithmSecretStore] Decryption done. Success! Decrypted password using cipher provider: com.atlassian.secrets.store.algorithm.AlgorithmSecretStore decrypted password: YourDBpassword |