goauthentik / authentik

The authentication glue you need.
https://goauthentik.io
Other
13.77k stars 927 forks source link

Authentik + Roundcube + Dovecot - 404 page on webmail after successful authentication on Authentik #8306

Closed LeftoversTodayAppAdmin closed 4 months ago

LeftoversTodayAppAdmin commented 10 months ago

Describe the bug

I am using Authentik to build SSO with Roundcube + Dovecot but I get a 404 page on webmail after successful authentication on Authentik. Direct authentication to the web server has no issues. Authentik is also working really well with Rocket.chat

To Reproduce Steps to reproduce the behavior:

I can provide access to my test setup.

Expected behavior After auth the redirect opens the inbox on iRedmail

Screenshots Its just a nginx 404 page with this URL: https://mail.mydomain.com/index.php/login/oauth?code=31e7ce7051194543906e6fe2ebda58c8&state=G3qhnBAQz7sT

Logs Roundcube logs: Jan 25 07:23:13 mail roundcube: <83b3gt0f> IMAP Error: Login failed for support@leftovers.today against 127.0.0.1 from 97.126.115.237. AUTHENTICATE LOGIN: A0002 NO [AUTHENTICATIONFAILED] Authentication failed. in /opt/www/roundcubemail-1.6.5/program/lib/Roundcube/rcube_imap.php on line 211 (POST /?_task=login&_action=login) Jan 25 07:23:14 mail roundcube: <83b3gt0f> Failed login for support@leftovers.today from 97.126.115.237 in session 83b3gt0f8leaq23f (error: 0)

Nothing in the dovecot logs

Version and Deployment (please complete the following information):

Additional context Add any other context about the problem here.

MaximalCats commented 9 months ago

Having the same issue - any fix for it yet?

Atomique commented 9 months ago

Also having an issue that seems like this one. I get an error while authenticating to gitlab and seafile. Worked before my update.

MaximalCats commented 9 months ago

I seemed to have found a fix for this; i forgot where or what i did however. It had something to do with the way how nginx finds php files. Here is my nginx config.

If i remember correctly, i think i changed the regex value which nginx uses to find php files to: [^/]\.php(/|$). If any issues arise, i unfortunately can't help. I have switched to Caddy, and my knowledge of nginx is very limited.

Leatherface75 commented 8 months ago

For me the problem seems to be in dovecot. Have tried everything can't get this to work.

Mar 23 20:32:48 auth-worker(65471): Info: conn unix:auth-worker (pid=59652,uid=302): auth-worker<4>: pam(xxxxxxxx,::1,<em8AzkVUkcoAAAAAAAAAAAAAAAAAAAAB>): pam_authenticate() failed: Authentication failure (Password mismatch?) Mar 23 20:32:48 auth: Info: oauth2(xxxxxx,::1,<em8AzkVUkcoAAAAAAAAAAAAAAAAAAAAB>): oauth2 failed: Introspection failed: Username 'xxxxxxx' did not match 'xxxxxxx@xxxxxxx.xxx'

This with all settings as the guide says.

authentik-automation[bot] commented 6 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

authentik-automation[bot] commented 4 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Leatherface75 commented 4 months ago

Any news? Still can't get this working.

LeftoversTodayAppAdmin commented 3 months ago

@Leatherface75 Im moving over to using this instead: https://docs.postalserver.io/

xpufx commented 2 months ago

Hello peoples. I am having a similar but different issues. My initial login works fine. It also works fine if I log out and log back in or go to the Authentik portal and click the link there. What doesn't work is, after a certain amount of time the connection is lost (authentication fails probably) and if I refresh the page it does not log in again successfully. I get an authentication error from roundcube via imap xoauth.

I need to also add that if you followed the roundcube/authentik documentation, you might have the same issues as I because I wrote the documentation on the site. Will let you know if I find the reason and a solution.

@Leatherface75 Your issue sounds different. You have a mismatch btw username vs username@domain.com . Be more than happy to compare configs with you.

Leatherface75 commented 2 months ago

Hello peoples. I am having a similar but different issues. My initial login works fine. It also works fine if I log out and log back in or go to the Authentik portal and click the link there. What doesn't work is, after a certain amount of time the connection is lost (authentication fails probably) and if I refresh the page it does not log in again successfully. I get an authentication error from roundcube via imap xoauth.

I need to also add that if you followed the roundcube/authentik documentation, you might have the same issues as I because I wrote the documentation on the site. Will let you know if I find the reason and a solution.

@Leatherface75 Your issue sounds different. You have a mismatch btw username vs username@domain.com . Be more than happy to compare configs with you.

I have done as it says here https://docs.goauthentik.io/integrations/services/roundcube/ and also tried to change to use username without luck. I am using usernames as login in Dovecot and as you says it mismatches.