SMTP/IMAP auth fails with 535 on ThunderID 1.0.0 when Direct-Auth-Secret is not sent
I maintainer di solito rispondono entro 1 giorno
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
Summary
With ThunderID 1.0.0 as the IdP, SMTP AUTH (and IMAP LOGIN) against raven fails with 535 Invalid credentials even though the username and password are correct. ThunderID's Direct API (POST /auth/credentials/authenticate) needs a Direct-Auth-Secret header. If the header is missing, ThunderID rejects the request with 401 AUTH-4010 "Authentication is required" before it checks the password. raven can't tell this apart from a wrong password, so the user sees 535 Invalid credentials.
What we saw
A service account (<user>@<domain>) tried SMTP AUTH PLAIN with a password we know is correct. We tried twice and got the same result both times. raven's SASL log:
PLAIN authentication attempt for user: <user>@<domain>
Authentication API returned status 401 for user: <user>
From outside the cluster, a call to /auth/credentials/authenticate without the header also gives 401 AUTH-4010 for both <user> and <user>@<domain>. That means the IdP rejects the request before it looks at the credentials, so changing or resetting the password won't help.
Root cause
Since #289, raven sends the header, but only when an environment variable is set:
internal/idp/token.go:DirectAuthSecret()readsIDP_DIRECT_AUTH_SECRETinternal/sasl/server.go(SASL PLAIN/LOGIN for Postfix) andinternal/server/auth/auth.go(IMAP LOGIN) addDirect-Auth-Secretonly when that value isn't empty
If the variable is unset (or the deployed image is older than #289), raven:
- leaves the header out without logging anything,
- gets
401 AUTH-4010from ThunderID, - logs
Authentication API returned status 401, which reads the same as a wrong password, and - tells the client
Invalid credentials(535over SMTP).
Neither config/raven.yaml nor docs/ mentions IDP_DIRECT_AUTH_SECRET (or IDP_CLIENT_ID / IDP_CLIENT_SECRET / IDP_RESOURCE), so it's easy to deploy without it.
How to confirm
Run this inside the ThunderID pod. It reads the direct-auth secret and sends it with the request without ever printing it:
oc -n <namespace> exec deploy/<thunderid-deployment> -- sh -c \
'S=$(cat config/secrets/direct_auth_secret); curl -s -w " HTTP %{http_code}\n" -X POST \
-H "Content-Type: application/json" -H "Direct-Auth-Secret: $S" \
http://localhost:8090/auth/credentials/authenticate \
-d "{\"username\":\"<user>\",\"password\":\"<password>\"}"'
If it returns HTTP 200, the account and password are fine, and the only thing missing is raven sending the header.
Proposed fix
Immediate (deployment): set IDP_DIRECT_AUTH_SECRET on the raven containers (SASL and IMAP) to the same value as ThunderID's config/secrets/direct_auth_secret, and make sure the image includes #289.
In raven:
- Log a warning at startup (SASL service and IMAP server) when
IDP_DIRECT_AUTH_SECRETis unset, or fail fast if ThunderID is the configured IdP. - Treat a 401 response with an
AUTH-4010body as a configuration/upstream error: log the IdP error code and answer with a temporary failure ([UNAVAILABLE]/454) instead ofInvalid credentials, so a missing secret doesn't look like a bad password. - Document the
IDP_*environment variables (IDP_CLIENT_ID,IDP_CLIENT_SECRET,IDP_DIRECT_AUTH_SECRET,IDP_RESOURCE) in the README / deployment docs. - Optionally, also support reading the secret from
raven.yamlor a mounted file path, to match how ThunderID stores it.
Alternative workaround (if raven can't be updated soon): skip SMTP AUTH for clients inside the cluster (e.g. ThunderID's pods) by trusting them through Postfix mynetworks. This weakens auth and should only be temporary.
- Lingua principale
- Go
- Stelle
- 12
- Fork
- 13
- Merge medio
- 2g 3h
- PR unite (30g)
- 8
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di OpenGovMail/raven
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
OpenGovMail/raven#338 ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG] UNSELECT accepts extra arguments instead of returning BADForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertabug good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
OpenGovMail/raven#322 ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG] NAMESPACE accepts extra arguments instead of returning BADForse già presa @tharinfernando l’ha presa 1 giorno fa. Apertabug good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
OpenGovMail/raven#321 ·
I maintainer di solito rispondono entro 1 giorno
-
bug good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
OpenGovMail/raven#320 ·
I maintainer di solito rispondono entro 1 giorno
-
bug good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
OpenGovMail/raven#319 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di OpenGovMail/raven
Issue simili
-
Typos Check fails when the typos binary download failsForse già presa @akshat-kumar-singhal l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 2 giorni
-
defect
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
nats-io/nats-server#8966 ·
I maintainer di solito rispondono entro 1 giorno
-
cmd/fix, x/tools/go/analysis/passes/modernize: mapsloop moves comments out of the range operandForse già presa @muratmirgun l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
Cojekt/LibreDental#258 ·
I maintainer di solito rispondono entro 1 giorno
-
needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
stacklok/toolhive-catalog#2094 ·
I maintainer di solito rispondono entro 1 giorno