์๋
ํ์ธ์,
์ฌ์ค CA๋ฅผ ์ฌ์ฉํ์ฌ TLS ์ฌ์ดํธ์ ์ก์ธ์คํ ์ ์๋๋ก ํ๋ ค๋ฉด AWX ์ปจํ
์ด๋์ CA ์ธ์ฆ์๋ฅผ ์ถ๊ฐํด์ผ ํฉ๋๋ค. AWX ์ฐ์ฐ์๋ฅผ ์ฌ์ฉํ์ฌ ๊ทธ๋ ๊ฒ ํ๋ ๊ธฐ๋ณธ ๋ฐฉ๋ฒ์ด ์์ต๋๊น?
extra_volumes/ee_extra_volume_mounts๋ฅผ ์ฌ์ฉํ์ฌ crt ํ์ผ์ /etc/pki/ca-trust/source/anchors/์ ๊ฐ์ ธ์์ง๋ง update-ca-trust ์คํ์ด ๋๋ฝ๋์์ต๋๋ค. ์์ฒด CA๋ฅผ ์ถ๊ฐํ๋ ๊ธฐ๋ณธ ๋ฐฉ๋ฒ์ด ์์ต๋๊น?
ํ์ฌ ์ด์ ๋ํ ๋ ๊ฐ์ง ์ฌ์ฉ ์ฌ๋ก๊ฐ ์์ต๋๋ค.
์ด ์ฃผ์์ ์คํ ํ๊ฒฝ์ ์ฌ์ฉ์ ์ ์ํ๋ ๋ช ๊ฐ์ง ๋ฐฉ๋ฒ์ ์ค๋ช
ํฉ๋๋ค. ansible-builder
๋ํ ์ง์ ์ ์ธ ๊ฒฝํ์ ์์ง๋ง "๊ณต์" EE(์ถ๊ฐ ๋ณผ๋ฅจ ๋ง์ดํ
๊ณผ ํจ๊ป)์์ ๋์ปค ์ด๋ฏธ์ง๋ฅผ ํ์ํ๋ ๊ฒ๋ง์ผ๋ก ์ถฉ๋ถํฉ๋๋ค.
@suukit https://github.com/ansible/awx-operator/compare/devel...tchellomello :custom-ca?expand=1 ๋ถ๊ธฐ์ ๋ช ์๋ ๋ณ๊ฒฝ ์ฌํญ์ ์๋ํด ๋ณผ ์ ์์ต๋๊น?
๋ ์ฝ๊ฒ ํ๊ธฐ ์ํด ์ด ํ
์คํธ ์ด๋ฏธ์ง๋ฅผ https://quay.io/repository/tchellomello/awx-operator?tab=tags quay.io/tchellomello/awx-operator:custom-ca
๊ฒ์ํ์ต๋๋ค.
๋ฐ๋ผ์ ๊ธฐ๋ณธ์ ์ผ๋ก ๋ค์ ๋จ๊ณ๋ฅผ ์ํํ ์ ์์ต๋๋ค.
awx-operator
๋ฅผ ์
๋ฐ์ดํธํ์ญ์์ค(https://gist.github.com/tchellomello/e38c71248591034f8a7cc28421fe2245 ์ฐธ์กฐ).$ kubectl apply -f https://gist.githubusercontent.com/tchellomello/e38c71248591034f8a7cc28421fe2245/raw/b8c1d657553d33d8ba75bb077b5960bb5abbca3c/awx-operator.yml
์ฐธ๊ณ : ํค๋ bundle-ca.crt
์ฌ์ผ ํฉ๋๋ค.
$ cat Toca_ROOT_CA.crt Toca_Intermediate_CA.crt > /tmp/bundle-ca.crt
$ kubectl create secret generic awx-ssl-ca-custom --from-file=bundle-ca.crt=/tmp/bundle-ca.crt
awx
์ข
๋ฅ๋ฅผ ์์ ํ์ฌ ์ ๋น๋ฐ์ ๋งคํํฉ๋๋ค.apiVersion: awx.ansible.com/v1beta1
kind: AWX
....
spec:
bundle_cacert_secret: awx-ssl-ca-custom
....
```
So before applying this patch, you should see:
![image](https://user-images.githubusercontent.com/809840/121632422-f153e880-ca4e-11eb-8d83-c0179e326427.png)
```yaml
$ openssl s_client -connect git.tatu.home:443
CONNECTED(00000003)
[...SNIP...]
SRP username: None
TLS session ticket lifetime hint: 604800 (seconds)
TLS session ticket:
0000 - 18 71 bb 56 c4 6d 89 64-d0 df ac 2d fa cc 45 1e .q.V.m.d...-..E.
0010 - c0 71 c4 ba 50 ee 91 90-da d5 fe 8e 5e d1 a1 00 .q..P.......^...
0020 - 57 8c 77 3b 09 e9 d5 fe-25 24 d5 bf d7 fd 76 bc W.w;....%$....v.
0030 - 1e a5 77 1b bd 3c bb 9b-25 df 48 a5 07 91 40 3b ..w..<..%.H...@;
0040 - d0 28 de e7 c6 4c 3c 12-51 d8 a0 0f ae 38 7a 44 .(...L<.Q....8zD
0050 - 65 03 9a ac a7 82 e6 6f-be 2f 68 6c 6e 4e 11 55 e......o./hlnN.U
0060 - d9 a6 85 9a ee 81 cd 63-51 65 58 8a 38 30 61 c8 .......cQeX.80a.
0070 - d0 91 0c 1a 96 2b 1d 6c-c4 67 2a cf a2 05 a1 a0 .....+.l.g*.....
0080 - ad .
Start Time: 1623388039
Timeout : 7200 (sec)
Verify return code: 21 (unable to verify the first certificate) <--- oops
Extended master secret: no
Max Early Data: 0
์ด ํจ์น๊ฐ ๋๋๋ฉด ๋ค์์ด ํ์๋ฉ๋๋ค.
awx-ssl-ca-6cccf6577d-jzrk9 0/4 Pending 0 0s <none> <none> <none> <none>
awx-ssl-ca-6cccf6577d-jzrk9 0/4 Pending 0 0s <none> p70 <none> <none>
awx-ssl-ca-6cccf6577d-jzrk9 0/4 Init:0/1 0 0s <none> p70 <none> <none>
awx-ssl-ca-6cccf6577d-jzrk9 0/4 Init:0/1 0 1s 10.233.64.98 p70 <none> <none>
awx-ssl-ca-6cccf6577d-jzrk9 0/4 PodInitializing 0 2s 10.233.64.98 p70 <none> <none>
awx-ssl-ca-6cccf6577d-jzrk9 4/4 Running 0 4s 10.233.64.98 p70 <none> <none>
๋ํ ์ปจํ ์ด๋๋ฅผ ํ์ธํ๋ฉด ์ฌ์ฉ์ ์ง์ CA๊ฐ ์ ๋ขฐํ ์ ์๋ ๊ฒ์ผ๋ก ํ์๋์ด์ผ ํฉ๋๋ค.
(py39) mdemello<strong i="11">@storm</strong> ~> kubectl iexec awx /bin/bash 00:53:40
Namespace: default | Pod: โ awx-ssl-ca-6cccf6577d-jzrk9
Container: โ awx-ssl-ca-task
bash-4.4$ ls -la /etc/pki/ca-trust/source/anchors/bundle-ca.crt
-rw-r--r--. 1 root root 4086 Jun 11 04:51 /etc/pki/ca-trust/source/anchors/bundle-ca.crt
bash-4.4$ trust list | grep -i toca
label: TOCA ROOT CA
label: Toca Intermediate Certificate Authority
bash-4.4$ openssl s_client -connect git.tatu.home:443
CONNECTED(00000003)
[...SNIP...]
SRP username: None
TLS session ticket lifetime hint: 604800 (seconds)
TLS session ticket:
0000 - 18 71 bb 56 c4 6d 89 64-d0 df ac 2d fa cc 45 1e .q.V.m.d...-..E.
0010 - 00 b2 67 b8 66 db 91 57-f8 85 92 e3 ef 61 4e 3f ..g.f..W.....aN?
0020 - 66 e2 64 01 45 b8 ab 7f-f8 84 7f 5e f6 2d e2 56 f.d.E......^.-.V
0030 - d3 2c 4b 19 cb 93 19 74-c7 0b e3 7d 76 d8 cd f7 .,K....t...}v...
0040 - 30 5a 87 23 27 34 d7 47-8e f5 c3 6c 41 81 7d 18 0Z.#'4.G...lA.}.
0050 - 13 96 4e e7 76 3b 50 f0-fb 8d 9d df 4a 51 9d 36 ..N.v;P.....JQ.6
0060 - 0e a9 1a 57 26 62 51 eb-f2 ec 24 56 93 5f 01 73 ...W&bQ...$V._.s
0070 - 67 f5 a1 a7 38 e1 dc 5e-27 65 c6 24 f5 ff 2c dc g...8..^'e.$..,.
0080 - eb .
Start Time: 1623387247
Timeout : 7200 (sec)
Verify return code: 0 (ok) <----- yes
Extended master secret: no
Max Early Data: 0
---
read R BLOCK
bash-4.4$ git clone https://git.tatu.home/mmello/test-ansible.git
Cloning into 'test-ansible'...
remote: Enumerating objects: 10, done.
remote: Counting objects: 100% (10/10), done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 10 (delta 3), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (10/10), 1.81 KiB | 928.00 KiB/s, done.
๊ทธ๊ฒ์ด ๋น์ ์ ์ํด ์ผํ๋์ง ์๋ ค์ฃผ์ญ์์ค.
@tchellomello : ๊ฐ์ฌํฉ๋๋ค
์ฌ๊ธฐ์์ ์ ์๋ํฉ๋๋ค. ํผ๋๋ฐฑ์ด ๋ฆ์ด ์ฃ์กํฉ๋๋ค!
์ด ์๋ฃจ์
์ด WinRM CA ์ธ์ฆ์์ ์๋ํฉ๋๊น? ์ด์์ ๋๋ awx ๋ฌธ์ ์ธ์ง ๋ชจ๋ฅด๊ธฐ ๋๋ฌธ์ awx์ ๋ฌธ์ ๋ฅผ ์ฝ๋๋ค.
https://github.com/ansible/awx/issues/10884
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
์ฌ๊ธฐ์์ ์ ์๋ํฉ๋๋ค. ํผ๋๋ฐฑ์ด ๋ฆ์ด ์ฃ์กํฉ๋๋ค!