Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mailcow as OAuth2/OpenID Connect Provider #684

Closed
HerHde opened this issue Oct 26, 2017 · 32 comments
Closed

Mailcow as OAuth2/OpenID Connect Provider #684

HerHde opened this issue Oct 26, 2017 · 32 comments

Comments

@HerHde
Copy link

HerHde commented Oct 26, 2017

Ahoj,
Mails are a central service in organisational environments, as well as identity management, so why not use Mailcow for both? Is it possible implement an OAuth2 or OpenID Connect provider, so other services like Nextcloud or GitLab could authenticate against Mailcow?

@mkuron
Copy link
Member

mkuron commented Oct 26, 2017

That should be possible without much effort as Mailcow has its user accounts and password hashes stored in MySQL. Nobody has done it yet though, but pull requests are welcome.

@lavdnone
Copy link

SSO with SOGo and for example NextCloud
For mc/docker

@Braintelligence
Copy link
Contributor

@mkuron By the way, what algorithm is used for the hashes?

@lavdnone
Copy link

Used this info

$config['password_driver'] = 'sql';
$config['password_algorithm'] = 'ssha256';
$config['password_algorithm_prefix'] = '{SSHA256}';
$config['password_query'] = "UPDATE mailbox SET password = %P WHERE username = %u";

from
https://mailcow.github.io/mailcow-dockerized-docs/third_party-roundcube/

maybe you mean session browser hash? guess can be found around

@stale
Copy link

stale bot commented Oct 14, 2018

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.

@stale stale bot added the dunno label Oct 14, 2018
@HerHde
Copy link
Author

HerHde commented Oct 14, 2018

So, before this gets closed, has anybody made progress here?

@stale stale bot removed the dunno label Oct 14, 2018
@andryyy
Copy link
Contributor

andryyy commented Oct 14, 2018

Yes, but I’m not sure if we push it to master. :/

@HerHde
Copy link
Author

HerHde commented Oct 14, 2018

I can't find a PR or something. And what's the problem?

@andryyy
Copy link
Contributor

andryyy commented Oct 14, 2018

I think it still is in dev (yes, shame on me).

It probably just needs some testing. Do you think it will be used? I'm just not sure.

@HerHde
Copy link
Author

HerHde commented Oct 14, 2018

Ah, I've just found #1204, which references your commits.

I'm not sure either, but from what I've seen there is not that much code that needs maintenance etc.
Some people are interested in this, but it seems like it is more a professional feature, which fills a certain gap "on the market". Also it creates many opportunities of interoperability. Not too bad, I guess.

@ghost
Copy link

ghost commented Dec 2, 2018

I will use it.
Is there a API too?

@andryyy
Copy link
Contributor

andryyy commented Dec 2, 2018

Don’t know. Not really working on it anymore.

@leona-ya
Copy link

leona-ya commented Dec 9, 2018

I would also use this. It's better than building own oauth service. If you want I can test it

@stale
Copy link

stale bot commented Feb 7, 2019

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.

@andryyy
Copy link
Contributor

andryyy commented Feb 14, 2019

Y u close

@andryyy andryyy reopened this Feb 14, 2019
@stale stale bot removed the dunno label Feb 14, 2019
@Braintelligence
Copy link
Contributor

Maybe you could incorporate Gluu into the stack @andryyy?

@andryyy
Copy link
Contributor

andryyy commented Feb 14, 2019

I just need to add a label. :)

@andryyy
Copy link
Contributor

andryyy commented Mar 5, 2019

Still working on it, but enotime. :(

@asifbacchus
Copy link

Not sure if there's any interest, but I thought I'd throw it in this thread for reference. It's not that difficult to set up an openLDAP server and have it use SASL-rimap through stunnel for secure password authentication against mailcow. That way you get all the benefits of LDAP with directory information but mailcow is handling the passwords so it's easy for users -- "oh, I just use my email password!". Basically taking advantage of the already present imap password verification mailcow offers but extending it via LDAP for programs (like seafile) that choose to not support imap auth. If there's interest I can make a write-up or can maybe try to setup some kind of docker container to integrate with mailcow? Just thought I'd put it out there as an alternative.

@HerHde
Copy link
Author

HerHde commented Mar 28, 2019

I generally like your approach, had a LDAP + Mailcow + GitLab + Own-/Nextcloud setup myself some time ago (I guess it was pre-Docker Mailcow). Yes, it is very convenient indeed. However my personal experience was, that the LDAP ecosystem really much lacked a good, free/libre administration frontend 😢

I've just seen #2316, mentioning LDAP and several implementations, including Gluu, as mentioned by @Braintelligence. Would spare you the work to create a docker container.

@andryyy What do you think? Or how's it going, what are you doing, like which approach, if I may ask?

@l00ptr
Copy link

l00ptr commented May 15, 2019

I generally like your approach, had a LDAP + Mailcow + GitLab + Own-/Nextcloud setup myself some time ago (I guess it was pre-Docker Mailcow). Yes, it is very convenient indeed. However my personal experience was, that the LDAP ecosystem really much lacked a good, free/libre administration frontend cry

I've just seen #2316, mentioning LDAP and several implementations, including Gluu, as mentioned by @Braintelligence. Would spare you the work to create a docker container.

@andryyy What do you think? Or how's it going, what are you doing, like which approach, if I may ask?

What about fusiondirectory to manage your LDAP content ?

@HerHde
Copy link
Author

HerHde commented May 16, 2019

It broke several times while updating. Also I don't like their schemata and documentation, but I'd consider it still the best FOSS tool around from those I've tested.

@stale
Copy link

stale bot commented Jul 15, 2019

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.

@stale stale bot added the dunno label Jul 15, 2019
@Adorfer
Copy link

Adorfer commented Jul 15, 2019

i run plenty of services which need user credentials. Having OAuth in mailcow would really help, since people have some kind of email anyway and the other services are "on top" like seafile, forum, pad etc.

@stale stale bot removed the dunno label Jul 15, 2019
@Braintelligence
Copy link
Contributor

It looks to me like Nextcloud can work as OAuth-Provider: nextcloud/server#3599

Would that solve your problem?

@Adorfer
Copy link

Adorfer commented Jul 15, 2019

Would that solve your problem?

where are all/the most users already?
Here it's mail (->account somewhere in mailcow)
i do not use nextcloud at the moment (seafile with it's web-office stuff), but if i could move auth for mail (inc. 2FA for initial client setup and webmail) into nextcould: woud be nice.

@Braintelligence
Copy link
Contributor

My thought-process was that Nextcloud is (was?) able to use Mailcow users as external users and maybe you could just bridge them to the Nextcloud OAuth.
If that would be possible there would be no need to make OAuth available in Mailcow directly; don't you think?

@mkuron
Copy link
Member

mkuron commented Jul 15, 2019

Nextcloud's IMAP authentication hasn't been that reliable, so I don't think Mailcow uses it anymore. OAuth2 in Mailcow would be the cleanest solution, both for Nextcloud and for external services. Since @andryyy is quite busy with other things, you could consider implementing it yourself; a pull request would be appreciated. I don't think it's a lot of work; someone with PHP experience could probably hook an existing OAuth2 library into Mailcow in little time.

@stale
Copy link

stale bot commented Sep 13, 2019

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.

@stale stale bot added the dunno label Sep 13, 2019
@stale stale bot closed this as completed Sep 20, 2019
@Tcharl
Copy link

Tcharl commented Sep 26, 2019

What about keycloak?

Configuring it to delegate authentication to ldap won't cost anything, but we could have OIDC for Sogo or any frontend

@Keridos
Copy link

Keridos commented Jun 10, 2020

Seems Mailcow has OAuth. But not OpenID connect. Would it be possible to implement OpenID Connect, too? I want to add mailcow to my keycloak as authentication provider but it only supports openID connect. Specifically It requires the scope "openid", which I cannot turn off so Mailcow gives back an error because of invalid scopes when I try to add it.

@chris2fr
Copy link

chris2fr commented Apr 4, 2022

I just tried this and the weirdest thing happened. I put HTTPS in the redirect, but got back to HTTP

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests