안녕하세요
해당 이슈는 앤서블 버전 2.5.0a1 이후로 모두 발견됩니다.
#1 생성한 AES256 암호화 파일을 ansible-vault에서 볼트 암호화 파일로 인식하지 못하게 하기
#1-1 우선 알고 계시는 방법으로 vault_key를 생성합니다.
[vagrant@ansible-server ~]$
ansible-vault create ~/.ansible/vault_key
New Vault password:
Confirm New Vault password:
0L, 0C written
[vagrant@ansible-server ~]$
cat ~/.ansible/vault_key
$ANSIBLE_VAULT;1.1;AES256
34613235653831373135356463663939353438633731356666363961663338366433613833663235
6632336534323665393132646432633338373738303661610a636564656134356136363833663230
65353539323437636266373933646565613961636136656131346565666237393735303562356330
6261333337356137320a353466656237373837613933613038373637613539363461353061366361
3039
#1-2 여기서
$(달러 기호)를 삭제 합니다.
[vagrant@ansible-server ~]$
cat .ansible/vault_key
ANSIBLE_VAULT;1.1;AES256
34613235653831373135356463663939353438633731356666363961663338366433613833663235
6632336534323665393132646432633338373738303661610a636564656134356136363833663230
65353539323437636266373933646565613961636136656131346565666237393735303562356330
6261333337356137320a353466656237373837613933613038373637613539363461353061366361
3039
#1-3 그런 이후에 는 vault_key를 평문으로 인식하고 진행이 됩니다.
[vagrant@ansible-server ~]$
ansible-vault encrypt ./group_vars/nodes --vault-password-file ~/.ansible/vault_key
Encryption successful
[vagrant@ansible-server ~]$
ansible-vault decrypt ./group_vars/nodes --vault-password-file ~/.ansible/vault_key
Decryption successful
#2 볼트가 아닌 openssl
을 이용하여 난수로 작성된 vault_key를 생성합니다.
#2-1 아래의 명령어를 실행하여 vault_key_by_ssl 이라는 vault_key파일을 생성합니다.
[vagrant@ansible-server ~]$
openssl rand -base64 2048 > ~/.ansible/vault_key_by_ssl
#2-2 처음 보는 거니까, 내용을 살펴 봅니다.
[vagrant@ansible-server ~]$
cat ~/.ansible/vault_key_by_ssl
R4kTxBUg3daBqsL9Ouu6Fl9RPOTv8Gpi+w7hFN9Jd+6o+U0sCs4cKqnFnUDYTil3
EgZotHewfSw8Gax/L7dDC7rPb0VN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LOe6U41a
53qKNtthtxRT+XyGFkZ56G2beG9Yggqe/+TQKd6XHwnBoB/iHXSa1Y9V/R01JNOr
7eMSlfw8hYu63ULnI2Z/7Ji7IyMORFWWlhtcl8EM6A6E559WMad3syPnU0+XzaVI
fru8tZwlfY+EmEGoUOsnxaAdo3Qx16df1PPHGvFw9jfVpnfF3bUHKDoo/3rS0S9M
I87vIAxVgCPvMPTvcmEZc20o95RYrHQBeolVTWA2QzWiiY32xfrK+zlIEjjgF098
51TPXqqZuWNY/2aDvZZgpe3GltEI8WFJq22sVTRy0V8Pd0fP+myaGPv51N0NeLpj
GW95wCIKBroIf+5nfnLT0JKqo2jCQ3VCV/4JRZWol2kJs8LKsvJ7iDJuL0c58vm7
yeKa7Oqli31QR0pYsuFpKJtVLTkGFZnxKPdrykj/ar/TDwSIcX0E2Nx92QQQUk/Z
NLHI9iQ/IPpxqKKOlFaBEgCu9+TuW07LYJyHAqiAXMM=
#2-3 새로 생성한 vault_key인 vault_key_by_ssl을 이용해서 암호화합니다.
[vagrant@ansible-server ~]$
ansible-vault encrypt ./group_vars/nodes --vault-password-file ~/.ansible/vault_key_by_ssl
Encryption successful
#2-4 암호화된 파일을 확인합니다.
[vagrant@ansible-server ~]$
cat ./group_vars/nodes
$ANSIBLE_VAULT;1.1;AES256
38323237383235633039383566343232336237326565633738393662383837316134636639373732
6463626234326530633032323437303638663362643930350a323033636166646334656362343361
65336132366366633936323230363866316135613764336339333830393134356532663662363965
3166653161386136330a313232666439343536393932343730366334666235343738306630303534
35343637306238376362396563383034643564313431653834613938646464663332
#2-5 복호화도 해봅니다.
[vagrant@ansible-server ~]$
ansible-vault decrypt ./group_vars/nodes --vault-password-file ~/.ansible/vault_key_by_ssl
Decryption successful
혹시 비슷한 이슈가 있다면, 위의 방법이 도움이 되시길 바랍니다.
조훈 드림.