daef7ea190
Helper functions (matrix-mas capability group): - mas_client_register_bash_infra: register/sync OAuth clients via mas-cli - mas_syn2mas_migration_bash_infra: dry-run + apply user migration to MAS - synapse_msc3861_enable_go_infra: edit homeserver.yaml MSC3861 block (with diff) - wellknown_oidc_patch_go_infra: patch well-known JSON with msc2965.authentication - synapse_login_flows_check_go_infra: health-check post-migration login flows Flows + issues for custom Matrix clients (PC + Android): - 0010 matrix-client-pc: Wails + React+Mantine (issues 0147-0153) - 0011 matrix-client-android: Kotlin + Compose (issues 0154-0161) - 0162 enable MAS as auth provider (Synapse delegate) — EXECUTED on VPS - 0163 custom admin panel propio (sustituye synapse-admin) Production state (organic-machine.com): - Synapse migrated SQLite -> Postgres - MSC3861 active, password_config disabled - 21 users + 41 access_tokens migrated via syn2mas - 4 MAS clients registered (element, matrix_pc, matrix_android, admin_panel) - synapse-admin container removed + Coolify route deleted - well-known patched with org.matrix.msc2965.authentication Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3.7 KiB
3.7 KiB
name, kind, lang, domain, version, purity, signature, description, tags, uses_functions, uses_types, returns, returns_optional, error_type, imports, tested, tests, test_file_path, file_path, params, output
| name | kind | lang | domain | version | purity | signature | description | tags | uses_functions | uses_types | returns | returns_optional | error_type | imports | tested | tests | test_file_path | file_path | params | output | ||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| wellknown_oidc_patch | function | go | infra | 0.1.0 | impure | func WellknownOidcPatch(cfg WellknownOidcPatchConfig) (WellknownOidcPatchResult, error) | Parchea el JSON .well-known/matrix/client aniadiendo org.matrix.msc2965.authentication (MAS issuer + account URL) para que los clientes Matrix descubran el OIDC provider dinamicamente. Preserva todos los campos existentes (m.homeserver, org.matrix.msc4143.rtc_foci, etc.). Crea backup antes de escribir. Soporta DryRun. |
|
|
false | error_go_core |
|
true |
|
functions/infra/wellknown_oidc_patch_test.go | functions/infra/wellknown_oidc_patch.go |
|
WellknownOidcPatchResult con BackupPath (vacio en DryRun/no-op), Before y After JSON pretty-printed, y Modified=false si el valor ya era identico. |
Ejemplo
cfg := infra.WellknownOidcPatchConfig{
WellknownJsonPath: "/tmp/wellknown_client.json",
Issuer: "https://auth-af2f3d.organic-machine.com/",
AccountURL: "https://auth-af2f3d.organic-machine.com/account",
BackupDir: "/tmp/wellknown_backups",
DryRun: true,
}
res, err := infra.WellknownOidcPatch(cfg)
if err != nil {
log.Fatal(err)
}
fmt.Println("Modified:", res.Modified)
fmt.Println("After:\n", res.After)
// Si el resultado es correcto, volver a llamar con DryRun: false para escribir.
Cuando usarla
Paso 5 de la migracion 0162 (Synapse → MAS): antes de hacer hot-reload nginx del container wellknown. Tambien util si cambia el issuer MAS en el futuro (basta llamarla de nuevo con el nuevo URL — la idempotencia garantiza que no duplica la clave).
Gotchas
- Issuer DEBE terminar en
/: los clientes Matrix siguen RFC 8414 estrictamente. Un issuer sin/final causa fallos de descubrimiento silenciosos. - Usar mapa dinamico, no struct: la funcion parsea el JSON en
map[string]anypara preservar campos desconocidos. No asumir que el archivo solo tienem.homeserver. - Tras escribir, recargar nginx:
ssh <host> docker exec <wellknown_container> nginx -s reload. Esta funcion no lo hace — es responsabilidad del operador. - Synapse tambien puede servir el well-known:
/_matrix/client/.well-knownpuede provenir de Synapse ademas del container wellknown. Verificar concurl -s https://matrix.organic-machine.com/.well-known/matrix/clientycurl -s https://matrix.organic-machine.com/_matrix/client/.well-known/matrix/clientpara saber cual usa cada cliente. - DryRun no crea backup ni BackupDir: usar DryRun para verificar el diff antes de ejecutar en produccion.