Projet

Général

Profil

Support #86247

Scripter l’adaptation de la configuration de fournisseur OIDC pour le renouvellement automatique du JWKSet (?)

Ajouté par Paul Marillonnet il y a 3 mois. Mis à jour il y a 3 mois.

Statut:
Fermé
Priorité:
Normal
Assigné à:
-
Catégorie:
-
Version cible:
-
Début:
29 janvier 2024
Echéance:
% réalisé:

0%

Temps estimé:
Patch proposed:
Non
Planning:
Non
Club:
Non

Description

Depuis #83841 en fournissant juste l’URL du jwkset du fournisseur il y a gestion automatique du renouvellement des clés.
Cependant certains fournisseurs déclarent encore ce jwkset par son contenu json plutôt que par son URL, sans gestion du renouvellement donc.
Exemple #86230 ce matin, il doit sans doute y en avoir encore ailleurs. On se dit ici qu’on pourrait parcourir les fournisseurs Azure AD sur la prod et procéder automatiquement au remplacement (?)


Demandes liées

Lié à Authentic 2 - Development #83841: oidc, ajouter la possibilité de renouvellement automatique du jwksetFermé22 novembre 2023

Actions

Historique

#1

Mis à jour par Paul Marillonnet il y a 3 mois

  • Lié à Development #83841: oidc, ajouter la possibilité de renouvellement automatique du jwkset ajouté
#3

Mis à jour par Serghei Mihai il y a 3 mois

Pour tous les idp Azure à priori l'uri sera au format: https://login.microsoftonline.com/{tenant}/discovery/v2.0/keys

#4

Mis à jour par Serghei Mihai il y a 3 mois

J'ai vite fait préparé ce script (pour relecture):

import requests

from authentic2_auth_oidc.models import OIDCProvider

for provider in OIDCProvider.objects.filter(issuer__startswith='https://login.microsoftonline.com'):
    wellknown_url = '%s/.well-known/openid-configuration' % provider.issuer
    r = requests.get(wellknown_url)
    data = r.json()
    if 'jwks_uri' in data:
        jwkset_url = data['jwks_uri']
        jwk_response = requests.get(jwkset_url)
        if jwk_response.ok:
            provider.jwkset_url = data['jwks_uri']
            provider.save()

#5

Mis à jour par Thomas Noël il y a 3 mois

  • Projet changé de Publik à Admin système
  • Club Non supprimé

Je bascule ce ticket sur sysadmin, parce que bon.

Joué avec juste un print à la place du save, ça donne sur front1.test :

* Running command runscript on tenant connexion-agglo-seine-eure.test.entrouvert.org
https://login.microsoftonline.com/ea45bbb8-9fcb-4a36-b604-69b435821f55/discovery/v2.0/keys
--
* Running command runscript on tenant connexion-clermont-metropole.test.entrouvert.org
https://login.microsoftonline.com/ff14d1c4-6f08-49f4-b4d0-e202cff755be/discovery/v2.0/keys
--
* Running command runscript on tenant connexion-estensemble.test.entrouvert.org
https://login.microsoftonline.com/663f9ebc-9fc5-4a24-8f32-dadc6b0d616f/discovery/v2.0/keys
--
* Running command runscript on tenant connexion-finistere.test.entrouvert.org
https://login.microsoftonline.com/bc3d0552-6223-4e38-a01c-b255d8ca7962/discovery/v2.0/keys
--
* Running command runscript on tenant connexion-metrorouen.test.entrouvert.org
https://login.microsoftonline.com/abd8ef44-3e5d-486e-9c95-6a1e33916821/discovery/v2.0/keys
--
* Running command runscript on tenant connexion-nimes.test.entrouvert.org
https://login.microsoftonline.com/5f343bc2-6d94-49a3-a40b-df5599796dce/discovery/v2.0/keys

Et sur front1.prod :

* Running command runscript on tenant connexion.demarches.metropole-rouen-normandie.fr
https://login.microsoftonline.com/abd8ef44-3e5d-486e-9c95-6a1e33916821/discovery/v2.0/keys
--
* Running command runscript on tenant connexion.e-services.finistere.fr
https://login.microsoftonline.com/bc3d0552-6223-4e38-a01c-b255d8ca7962/discovery/v2.0/keys
--
* Running command runscript on tenant connexion.mes-demarches.nimes.fr
https://login.microsoftonline.com/5f343bc2-6d94-49a3-a40b-df5599796dce/discovery/v2.0/keys
--
* Running command runscript on tenant connexion.services.est-ensemble.fr
https://login.microsoftonline.com/663f9ebc-9fc5-4a24-8f32-dadc6b0d616f/discovery/v2.0/keys

avec un crash sur clermont parce que la configuration est en cours #85201 et j'ai mis XXX sur le tenant, pas d'inquiétude.

Sur le SaaS HDS, aucun SSO OIDC, ni en test ni en prod.

C'est donc pour "go" pour moi sur notre SaaS OVH, test et prod.

#6

Mis à jour par Serghei Mihai il y a 3 mois

  • Projet changé de Admin système à Publik
  • Club mis à Non

Lancé en test:

sudo -u authentic-multitenant authentic2-multitenant-manage tenant_command runscript oidc_providers.py --all-tenants -v 2
* Running command runscript on tenant authentic-atreal.test.entrouvert.org
* Running command runscript on tenant connexion-aecuvillon.test.entrouvert.org
* Running command runscript on tenant connexion-agents-cd14.test.entrouvert.org
* Running command runscript on tenant connexion-agglo-saumur.test.entrouvert.org
* Running command runscript on tenant connexion-agglo-seine-eure.test.entrouvert.org
https://login.microsoftonline.com/ea45bbb8-9fcb-4a36-b604-69b435821f55/discovery/v2.0/keys
* Running command runscript on tenant connexion-amathias.test.entrouvert.org
* Running command runscript on tenant connexion-amiens.test.entrouvert.org
* Running command runscript on tenant connexion-ampmetropole.test.entrouvert.org
* Running command runscript on tenant connexion-angouleme.test.entrouvert.org
* Running command runscript on tenant connexion-antibes.test.entrouvert.org
* Running command runscript on tenant connexion-antilles-guyanne-mineduc.test.entrouvert.org
* Running command runscript on tenant connexion-arles.test.entrouvert.org
* Running command runscript on tenant connexion-armentieres.test.entrouvert.org
* Running command runscript on tenant connexion-assos.test.entrouvert.org
* Running command runscript on tenant connexion-atreal-ideau.test.entrouvert.org
* Running command runscript on tenant connexion-auch.test.entrouvert.org
* Running command runscript on tenant connexion-auvergne-rhone-alpes-mineduc.test.entrouvert.org
* Running command runscript on tenant connexion-berreletang.test.entrouvert.org
* Running command runscript on tenant connexion-bethunebruay.test.entrouvert.org
* Running command runscript on tenant connexion-billettik.test.entrouvert.org
* Running command runscript on tenant connexion-blagnac.test.entrouvert.org
* Running command runscript on tenant connexion-bmallet.test.entrouvert.org
* Running command runscript on tenant connexion-bourgogne-franche-comte-mineduc.test.entrouvert.org
* Running command runscript on tenant connexion-boussu.test.entrouvert.org
* Running command runscript on tenant connexion-braine-l-alleud.test.entrouvert.org
* Running command runscript on tenant connexion-cabourg-ccncpa.test.entrouvert.org
* Running command runscript on tenant connexion-caen-la-mer.test.entrouvert.org
* Running command runscript on tenant connexion-cah.test.entrouvert.org
* Running command runscript on tenant connexion-calvados.test.entrouvert.org
* Running command runscript on tenant connexion-cantal.test.entrouvert.org
* Running command runscript on tenant connexion-cap-atlantique.test.entrouvert.org
* Running command runscript on tenant connexion-cc-pays-herbiers.test.entrouvert.org
* Running command runscript on tenant connexion-cca.test.entrouvert.org
* Running command runscript on tenant connexion-cch.test.entrouvert.org
* Running command runscript on tenant connexion-cci-france.test.entrouvert.org
* Running command runscript on tenant connexion-cd22.test.entrouvert.org
* Running command runscript on tenant connexion-cd44.test.entrouvert.org
* Running command runscript on tenant connexion-cdourdent.test.entrouvert.org
* Running command runscript on tenant connexion-chateauroux.test.entrouvert.org
* Running command runscript on tenant connexion-chemdata.test.entrouvert.org
* Running command runscript on tenant connexion-chris-a.test.entrouvert.org
* Running command runscript on tenant connexion-chris.test.entrouvert.org
* Running command runscript on tenant connexion-cinor.test.entrouvert.org
* Running command runscript on tenant connexion-clermont-metropole.test.entrouvert.org
https://login.microsoftonline.com/ff14d1c4-6f08-49f4-b4d0-e202cff755be/discovery/v2.0/keys
* Running command runscript on tenant connexion-cnil-pro.test.entrouvert.org
* Running command runscript on tenant connexion-cnil.test.entrouvert.org
* Running command runscript on tenant connexion-commune-nantesmetro.test.entrouvert.org
* Running command runscript on tenant connexion-correze.test.entrouvert.org
* Running command runscript on tenant connexion-croix.test.entrouvert.org
* Running command runscript on tenant connexion-csam.test.entrouvert.org
* Running command runscript on tenant connexion-cserale.test.entrouvert.org
* Running command runscript on tenant connexion-csma.test.entrouvert.org
* Running command runscript on tenant connexion-directions-mineduc.test.entrouvert.org
* Running command runscript on tenant connexion-dne-mineduc.test.entrouvert.org
* Running command runscript on tenant connexion-documents.test.entrouvert.org
* Running command runscript on tenant connexion-dordogne.test.entrouvert.org
* Running command runscript on tenant connexion-dreux.test.entrouvert.org
* Running command runscript on tenant connexion-e-service-seine-et-marne.test.entrouvert.org
* Running command runscript on tenant connexion-ecazenave.test.entrouvert.org
* Running command runscript on tenant connexion-ehess.test.entrouvert.org
* Running command runscript on tenant connexion-essonne.test.entrouvert.org
* Running command runscript on tenant connexion-estensemble.test.entrouvert.org
https://login.microsoftonline.com/663f9ebc-9fc5-4a24-8f32-dadc6b0d616f/discovery/v2.0/keys
* Running command runscript on tenant connexion-eurometropolemetz.test.entrouvert.org
* Running command runscript on tenant connexion-experimentation-publik.test.entrouvert.org
* Running command runscript on tenant connexion-exploc.test.entrouvert.org
* Running command runscript on tenant connexion-finistere.test.entrouvert.org
https://login.microsoftonline.com/bc3d0552-6223-4e38-a01c-b255d8ca7962/discovery/v2.0/keys
* Running command runscript on tenant connexion-fondettes.test.entrouvert.org
* Running command runscript on tenant connexion-formation-mineduc.test.entrouvert.org
* Running command runscript on tenant connexion-gba.test.entrouvert.org
* Running command runscript on tenant connexion-gbn.test.entrouvert.org
* Running command runscript on tenant connexion-gec.test.entrouvert.org
* Running command runscript on tenant connexion-gonfreville-l-orcher.test.entrouvert.org
* Running command runscript on tenant connexion-gpseo.test.entrouvert.org
* Running command runscript on tenant connexion-grand-chambery.test.entrouvert.org
* Running command runscript on tenant connexion-grand-chatellerault.test.entrouvert.org
* Running command runscript on tenant connexion-grand-est-mineduc.test.entrouvert.org
* Running command runscript on tenant connexion-grand-nancy.test.entrouvert.org
* Running command runscript on tenant connexion-hautes-pyrenees.test.entrouvert.org
* Running command runscript on tenant connexion-hauts-de-france-mineduc.test.entrouvert.org
* Running command runscript on tenant connexion-ile-de-france-mineduc.test.entrouvert.org
* Running command runscript on tenant connexion-implicit.test.entrouvert.org
* Running command runscript on tenant connexion-indre.test.entrouvert.org
* Running command runscript on tenant connexion-interne-villeurbanne.test.entrouvert.org
* Running command runscript on tenant connexion-intranet-correze.test.entrouvert.org
* Running command runscript on tenant connexion-isere.test.entrouvert.org
* Running command runscript on tenant connexion-isereagents.test.entrouvert.org
* Running command runscript on tenant connexion-jura.test.entrouvert.org
* Running command runscript on tenant connexion-la-carotte-bleue.test.entrouvert.org
* Running command runscript on tenant connexion-lambersart.test.entrouvert.org
* Running command runscript on tenant connexion-landes.test.entrouvert.org
* Running command runscript on tenant connexion-lanester.test.entrouvert.org
* Running command runscript on tenant connexion-lareunion.test.entrouvert.org
* Running command runscript on tenant connexion-larochelle.test.entrouvert.org
* Running command runscript on tenant connexion-lehavre.test.entrouvert.org
* Running command runscript on tenant connexion-lenord-preprod.test.entrouvert.org
* Running command runscript on tenant connexion-lenord.test.entrouvert.org
* Running command runscript on tenant connexion-leplessistrevise.test.entrouvert.org
* Running command runscript on tenant connexion-lessables.test.entrouvert.org
* Running command runscript on tenant connexion-lille.test.entrouvert.org
* Running command runscript on tenant connexion-lozere.test.entrouvert.org
* Running command runscript on tenant connexion-malakoff.test.entrouvert.org
* Running command runscript on tenant connexion-marcoussis.test.entrouvert.org
* Running command runscript on tenant connexion-marseille.test.entrouvert.org
* Command runscript is ignored on tenant connexion-martigues.test.entrouvert.org because TENANT_DISABLE_CRON_JOBS is set
* Running command runscript on tenant connexion-mates.test.entrouvert.org
* Running command runscript on tenant connexion-matrik.test.entrouvert.org
* Running command runscript on tenant connexion-mauguio-carnon.test.entrouvert.org
* Running command runscript on tenant connexion-mel.test.entrouvert.org
* Running command runscript on tenant connexion-metrorouen.test.entrouvert.org
https://login.microsoftonline.com/abd8ef44-3e5d-486e-9c95-6a1e33916821/discovery/v2.0/keys
* Running command runscript on tenant connexion-meudon.test.entrouvert.org
* Running command runscript on tenant connexion-meuse.test.entrouvert.org
* Running command runscript on tenant connexion-meyzieu.test.entrouvert.org
* Running command runscript on tenant connexion-mincult.test.entrouvert.org
* Running command runscript on tenant connexion-minint.test.entrouvert.org
* Running command runscript on tenant connexion-ministere-solidarites-sante.test.entrouvert.org
* Running command runscript on tenant connexion-ministeres-mineduc.test.entrouvert.org
* Running command runscript on tenant connexion-miribel.test.entrouvert.org
* Running command runscript on tenant connexion-mkuntz.test.entrouvert.org
* Running command runscript on tenant connexion-mnca.test.entrouvert.org
* Running command runscript on tenant connexion-mnhn.test.entrouvert.org
* Running command runscript on tenant connexion-mnovales.test.entrouvert.org
* Running command runscript on tenant connexion-modele.test.entrouvert.org
* Running command runscript on tenant connexion-montelimar-agglo.test.entrouvert.org
* Running command runscript on tenant connexion-montlouis.test.entrouvert.org
* Running command runscript on tenant connexion-montoulouse-integ.test.entrouvert.org
* Running command runscript on tenant connexion-montoulouse.test.entrouvert.org
* Running command runscript on tenant connexion-montpellier-gdi.test.entrouvert.org
* Running command runscript on tenant connexion-multipref-minint.test.entrouvert.org
* Running command runscript on tenant connexion-nancy.test.entrouvert.org
* Running command runscript on tenant connexion-nantes-metropole.test.entrouvert.org
* Running command runscript on tenant connexion-national-mineduc.test.entrouvert.org
* Running command runscript on tenant connexion-neutre-villeurbanne.test.entrouvert.org
* Running command runscript on tenant connexion-nimes.test.entrouvert.org
https://login.microsoftonline.com/5f343bc2-6d94-49a3-a40b-df5599796dce/discovery/v2.0/keys
* Running command runscript on tenant connexion-normandie-bretagne-loire-mineduc.test.entrouvert.org
* Running command runscript on tenant connexion-nouvelle-aquitaine-mineduc.test.entrouvert.org
* Running command runscript on tenant connexion-noyelles-godault.test.entrouvert.org
* Running command runscript on tenant connexion-occitanie-mineduc.test.entrouvert.org
* Running command runscript on tenant connexion-oceanie-mineduc.test.entrouvert.org
* Running command runscript on tenant connexion-orenard.test.entrouvert.org
* Running command runscript on tenant connexion-orleans.test.entrouvert.org
* Running command runscript on tenant connexion-paca-corse-mineduc.test.entrouvert.org
* Running command runscript on tenant connexion-parisnanterre.test.entrouvert.org
* Running command runscript on tenant connexion-parsifal-preprod.test.entrouvert.org
* Running command runscript on tenant connexion-pfwb.test.entrouvert.org
* Running command runscript on tenant connexion-pm.test.entrouvert.org
* Running command runscript on tenant connexion-pmarillonnet.test.entrouvert.org
* Running command runscript on tenant connexion-publik-famille.test.entrouvert.org
* Running command runscript on tenant connexion-publik-light.test.entrouvert.org
* Running command runscript on tenant connexion-publik-notifications.test.entrouvert.org
* Running command runscript on tenant connexion-quimper.test.entrouvert.org
* Running command runscript on tenant connexion-recette.formulaireextranet.grandlyon.com
* Running command runscript on tenant connexion-recette.formulaireintranet.grandlyon.com
* Running command runscript on tenant connexion-regionreunion.test.entrouvert.org
* Running command runscript on tenant connexion-registre-traitements.test.entrouvert.org
* Running command runscript on tenant connexion-residences.test.entrouvert.org
* Running command runscript on tenant connexion-reunion-mayotte-mineduc.test.entrouvert.org
* Running command runscript on tenant connexion-rh.test.entrouvert.org
* Running command runscript on tenant connexion-roannais-agglomeration.test.entrouvert.org
* Running command runscript on tenant connexion-roanne-mutuel.test.entrouvert.org
* Running command runscript on tenant connexion-rochefort-agglo.test.entrouvert.org
* Running command runscript on tenant connexion-rouen-intranet.test.entrouvert.org
* Running command runscript on tenant connexion-rouen.test.entrouvert.org
* Running command runscript on tenant connexion-saint-chamond.test.entrouvert.org
* Running command runscript on tenant connexion-saint-denis-93.test.entrouvert.org
* Running command runscript on tenant connexion-saint-lo.test.entrouvert.org
* Running command runscript on tenant connexion-saintlaurentduvar.test.entrouvert.org
* Running command runscript on tenant connexion-saone-et-loire.test.entrouvert.org
* Running command runscript on tenant connexion-semsirh-mineduc.test.entrouvert.org
* Running command runscript on tenant connexion-sens.test.entrouvert.org
* Running command runscript on tenant connexion-sguiet.test.entrouvert.org
* Running command runscript on tenant connexion-slaget.test.entrouvert.org
* Running command runscript on tenant connexion-somme.test.entrouvert.org
* Running command runscript on tenant connexion-strasbourg.test.entrouvert.org
* Running command runscript on tenant connexion-thonon-agglomeration.test.entrouvert.org
* Running command runscript on tenant connexion-thononagglo.test.entrouvert.org
* Running command runscript on tenant connexion-toulouse.test.entrouvert.org
* Running command runscript on tenant connexion-tours.test.entrouvert.org
* Running command runscript on tenant connexion-univ-avignon.test.entrouvert.org
* Running command runscript on tenant connexion-univ-nantes.test.entrouvert.org
* Running command runscript on tenant connexion-univ-smb.test.entrouvert.org
* Running command runscript on tenant connexion-univ-toulon.test.entrouvert.org
* Running command runscript on tenant connexion-universite-lorraine.test.entrouvert.org
* Running command runscript on tenant connexion-up.test.entrouvert.org
* Running command runscript on tenant connexion-validation.test.entrouvert.org
* Running command runscript on tenant connexion-vandoeuvre.test.entrouvert.org
* Running command runscript on tenant connexion-vendee.test.entrouvert.org
* Running command runscript on tenant connexion-venissieux.test.entrouvert.org
* Running command runscript on tenant connexion-victor.test.entrouvert.org
* Running command runscript on tenant connexion-villedavray.test.entrouvert.org
* Running command runscript on tenant connexion-villeneuvedascq.test.entrouvert.org
* Running command runscript on tenant connexion-villeurbanne.test.entrouvert.org
* Running command runscript on tenant connexion-vitry94.test.entrouvert.org
* Running command runscript on tenant connexion.guichet-recette.grandlyon.com
* Running command runscript on tenant connexion.publik.love
* Running command runscript on tenant connexion.services-test.haute-garonne.fr
* Running command runscript on tenant connexion.signalpublik.test.entrouvert.org
* Running command runscript on tenant connexiondemarches-fsb.test.entrouvert.org
* Running command runscript on tenant idp-test-entrouvert.montpellier3m.fr

#7

Mis à jour par Guillaume Baffoin il y a 3 mois

lancement de la commande

import requests

from authentic2_auth_oidc.models import OIDCProvider
for provider in OIDCProvider.objects.filter(issuer__startswith='https://login.microsoftonline.com', enabled=True):
    wellknown_url = '%s/.well-known/openid-configuration' % provider.issuer
    r = requests.get(wellknown_url)
    data = r.json()
    if 'jwks_uri' in data:
        jwkset_url = data['jwks_uri']
        jwk_response = requests.get(jwkset_url)
        if jwk_response.ok:
            provider.jwkset_url = data['jwks_uri']
            provider.save()


ce matin a 10H58 sur la prod.

#8

Mis à jour par Serghei Mihai il y a 3 mois

  • Statut changé de Nouveau à Solution déployée

Super, merci.

#9

Mis à jour par Guillaume Baffoin il y a 3 mois

* Running command runscript on tenant connexion.demarches.metropole-rouen-normandie.fr
https://login.microsoftonline.com/abd8ef44-3e5d-486e-9c95-6a1e33916821/discovery/v2.0/keys
* Running command runscript on tenant connexion.e-services.finistere.fr
https://login.microsoftonline.com/bc3d0552-6223-4e38-a01c-b255d8ca7962/discovery/v2.0/keys
* Running command runscript on tenant connexion.mes-demarches.nimes.fr
https://login.microsoftonline.com/5f343bc2-6d94-49a3-a40b-df5599796dce/discovery/v2.0/keys
* Running command runscript on tenant connexion.services.est-ensemble.fr
https://login.microsoftonline.com/663f9ebc-9fc5-4a24-8f32-dadc6b0d616f/discovery/v2.0/keys

#10

Mis à jour par Paul Marillonnet il y a 3 mois

Top, merci à vous deux Serghei et Guillaume.

#11

Mis à jour par Transition automatique il y a 26 jours

Automatic expiration

Formats disponibles : Atom PDF