feat(ess-pro): generate AIM spaces from authentik groups #20
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/aim-spaces-generator"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
ess_aim_spaces_generator_enabled, defaultfalse): every authentik group withmatrix_space: truebecomes an AIM space without a playbook run. A systemd timer runsrun.sh→docker compose run --rm aim-spaces-generator(stockpython:3.12-alpine, stdlib-only script mounted likeldap-paging-shim, no image build).aim-config.base.yamlonly; the generator writesaim-config.yaml= base +spaces: <json>atomically (temp file + rename) and restarts AIM only on change.flockserialises timer and play; the play's final generator run always picks up the new base. Switching it off stops the timer before Ansible writesaim-config.yamlagain.spaces:key in the base (assert oness_aim_extra_config), or more thanmax_removalsdropped spaces → file untouched, non-zero exit (journal / failed task). Space id = groupuid(rename-stable),externalId= group DN (verified in group-sync v0.21.0:groups.get(rule.externalId)keyed bygroup.dn).SHIM_REQUIRE_MEMBER_OFgate already running on a deployed host back into the role asess_aim_ldap_paging_shim_require_member_of(default empty = off, compose unchanged). Rendered shim is byte-identical to the host's local copy.Before deploying to a host that uses AIM spaces today
ess_aim_ldap_paging_shim_require_member_ofin the inventory if the host runs the gate — otherwise the deploy turns it off and every user gets provisioned.ess_aim_extra_config(spaces:) toess_aim_spaces_generator_static_spaces, keeping itsid, before enabling the generator (the play fails fast otherwise).Test plan
compose.ymlandaim-config.yamlbyte-identical tomainuid; DN format matches group-sync's log; boolean custom attributes render astruerun.sh): changed + restart, then unchanged; rename keeps id; removal over limit blocked,--allow-removalsoverride; wrong password (49), wrong base (32), shim down → rc=1, file untouchedgenerate.py --self-test, shellcheck, argument_specs validation; ansible-lint: only newvar-naming[no-role-prefix](role-wideess_*convention)--check --diff, second run withoutchangedess_aim_dry_run: true): flag a group → space in log; remove flag → abandon logged; rename; shim stopped → timer unit failsReview
feat/aim-spaces-generator(2b05e85,0a8b1cc)Sauber gebaut, aus meiner Sicht merge-fähig. Ein paar Punkte zum Klären vorher, einer davon zeitkritisch.
Geprüft
generate.py --self-testläuft durch.mainkonfliktfrei (mainsteht noch auf dem Merge-Base63ff6a5).var-naming[no-role-prefix].internal/outpost/ldap/group/group.go,utils.go): Gruppen liefernuid= Gruppen-PK (bleibt bei Umbenennung stabil). Attributnamen werden nur bei/→-und.angepasst,matrix_spacekommt also unverändert an. Ein booleschestruewird zu"true".deploy.yml(Compose gerendert und gestartet) läuft voraim.yml, also vor dem erstenrun.sh.Gefällt mir
aim-config.yamldurch den Generator) plusassertgegenspaces:iness_aim_extra_config.max_removals,flock, Restart nur beiRESULT: changed, Bind-Passwort als 0400-Datei.Punkte
ldap-paging-shim.pybereits im Stand dieses Branches, mitSHIM_REQUIRE_MEMBER_OF=cn=matrix-users,…. Ein Playbook-Lauf ausmainwürde den Filter wieder entfernen. Bitte mergen, bevor das nächste Mal ausmaindeployt wird.sek2-rootsteht heute als mehrzeiligespaces:-Liste iness_aim_extra_config. Er muss nachess_aim_spaces_generator_static_spaces, sonst verschwindet er.parse_spaces()erkennt nur die eigene einzeilige JSON-Form, also sieht der Entfernungsschutz beim ersten Lauf die alten Spaces nicht. Vorschlag: im README erwähnen oder die alte Form beim Vergleich mitlesen.drop_for_membership()lässt einen Eintrag durch, wennentry_attributes()ihn nicht lesen kann. Für einen Filter würde ich eher geschlossen erwarten: im Zweifel weglassen und loggen. Mindestens ein Log-Eintrag wäre hilfreich.memberOfvom Outpost enthält nur direkte Gruppen. Unterguppen vonmatrix-usersgreifen also nur mitflattenInheritance: true(Flatten-Timer). Gehört ins README.aim-config.base.yamlundaim-config.yamlenthalten beide Admin-Token und DB-Passwort mit 0644. Das Muster gab es vorher schon, jetzt liegt es doppelt da. Eventuell 0640 mit Gruppe 65532?ignore_errorsmit Warnung.gated_ids_droppedwird pro Verbindung gezählt und vermischt sich bei parallelen Suchen auf derselben Verbindung. Betrifft nur das Log.Für später (nicht blockierend)
Rollen fehlen noch: Der Generator setzt pro Space nur
externalId, keinpowerLevel. Für Moderatoren und Admins aus authentik bräuchte es z. B. ein zweites Attribut (matrix_space_moderators: <Gruppe>) oder Einträge instatic_spaces.Vorschlag zum Vorgehen
Punkte 2 und 3 klären, dann mergen. Danach im sek2-Inventar
ess_aim_spaces_generator_*setzen, den Root-Space nachstatic_spacesverschieben und zuerst mitess_aim_dry_run: truedeployen. Im Log prüfen, ob dieexternalId(DN) passt, dann live schalten.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.