Awx-operator: Ajouter des CA privées aux conteneurs

Créé le 7 juin 2021  ·  6Commentaires  ·  Source: ansible/awx-operator

Salut,
pour autoriser l'accès aux sites TLS à l'aide d'autorités de certification privées, nous devons ajouter des certificats d'autorité de certification aux conteneurs AWX. Existe-t-il un moyen natif de le faire en utilisant l'opérateur AWX ?

J'ai utilisé extra_volumes/ee_extra_volume_mounts pour obtenir les fichiers crt dans /etc/pki/ca-trust/source/anchors/ mais une exécution de update-ca-trust est manquante. Existe-t-il un moyen natif d'ajouter ses propres autorités de certification ?

Actuellement, nous avons deux cas d'utilisation pour cela :

  1. récupérer des projets depuis GIT
  2. utiliser le module "uri" dans les rôles
    merci d'avance
    Max
bug in_progress

Commentaire le plus utile

Fonctionne bien ici, désolé pour le retour tardif!

Tous les 6 commentaires

Ce commentaire décrit deux manières de personnaliser un environnement d'exécution. Je n'ai pas d'expérience directe avec le ansible-builder mais le simple fait de dériver une image docker de l'EE "officiel" (en combinaison avec un montage de volume supplémentaire) fonctionne pour moi.

@suukit pourriez-vous s'il vous plaît essayer avec les changements notés sur cette branche https://github.com/ansible/awx-operator/compare/devel...tchellomello :custom-ca?expand=1

Pour vous faciliter la tâche, j'ai publié cette image de test sur https://quay.io/repository/tchellomello/awx-operator?tab=tags quay.io/tchellomello/awx-operator:custom-ca

Donc, en gros, vous pouvez suivre les étapes suivantes :

  1. Mettez à jour votre awx-operator utilisant ce POC de test (voir https://gist.github.com/tchellomello/e38c71248591034f8a7cc28421fe2245)
$ kubectl apply -f https://gist.githubusercontent.com/tchellomello/e38c71248591034f8a7cc28421fe2245/raw/b8c1d657553d33d8ba75bb077b5960bb5abbca3c/awx-operator.yml
  1. Créez un secret avec toutes les autorités de certification du bundle. Voir mon exemple ci-dessous :

note : la clé doit être 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
  1. Une fois l'opérateur mis à jour, modifiez votre type awx pour mapper le nouveau secret
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


Après ce patch, vous devriez voir :

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>

image

De plus, en vérifiant le conteneur, vous devriez voir le ca personnalisé répertorié comme approuvé

(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.

Merci de me dire si cela a fonctionné pour vous.

@tchellomello : merci, je vais essayer

Fonctionne bien ici, désolé pour le retour tardif!

Cette solution fonctionne-t-elle pour les certificats WinRM CA ? J'ouvre un problème à awx, car je ne sais pas s'il s'agit d'un problème d'opérateur ou d'awx.
https://github.com/ansible/awx/issues/10884

Cette page vous a été utile?
0 / 5 - 0 notes