1

Topic: iRedmail + Nextcloud + MySQL identity integration

I've got iRedMail 0.9.9 MySQL version running on FreeBSD. All is good. I also run Nextcloud for file sharing, calendar sharing, and its many features. By installing the  User SQL plugin on Nextcloud, I can link the identities I define in iRedMail and that are used in Nextcloud. If a user exists in my iRedMail setup, they will automatically get access to all the features of Nextcloud. Here's the setup that I use in Nextcloud.

One of my users needed to use the forgot password feature on Nextcloud, and it allowed him to reset his password in a way that was compatible with iRedMail, too. This lets my iRedMail's MySQL server act as a central identity service. I don't use quota features much, but it looks like iRedMail and Nextcloud may have compatible quota features to allow me to set a single quota for a user, that would be enforced in both places.

This is a really great way to increase the value of my iRedMail server.

  1. Install the User SQL plugin like you would any other.[*/]

  2. Logged in as a Nextcloud admin, go to Settings.

  3. Choose SQL Backend.

  4. On the SQL backend settings page, under Database Connection set things this way:

    • SQL Driver = MySQL (Presumably you can also use PostgreSQL, but I haven't tested it)

    • Hostname = (your database server)

    • Database = vmail

    • Username = vmail

    • Password = your vmail password. Get it from /root/.my.cnf-vmail, for example.

  5. Under Options:

    • Tick Enable Display Name Change

    • Tick Allow Password Change

    • Hash Algorithm = SSHA512 (that's what I use, you have to pick something that works for you)

    • Email Sync = SQL Always Wins

    • Other options you can set as you like.

  6. Under User Table:

    • Table name = mailbox

    • Username = username

    • Email = username

    • Password = password

    • Display Name = name

    • Active = enablesmtp (if enablesmtp is set to 0, they won't have access to Nextcloud, either)

  7. Leave the Group Table and User Group Table empty.

2

Re: iRedmail + Nextcloud + MySQL identity integration

Hey pacohope, thank you so much for this guide on setting this up. I too am running Nextcloud along with my iRedMail instance.

I had a question. I currently have them separated with a couple of users, with the RainLoop webmail installed on Nextcloud set to use the users I have setup login information to automatically login to the mail server. With that of course their username and passwords are just set to the same as their inbox. Do you know if I was to enable this feature now, would this break the current users?

Again, thank you very much for this, this is huge.

3

Re: iRedmail + Nextcloud + MySQL identity integration

I went ahead and tested my theory, and it does not like it at all.

Quota, also, does not work. If you set it up to use the quota it reads the amounts incorrectly, changing it in either NC or iRedAdmin does not update after the initial pull and rewrites back to what it was before (Whether Default, Static or Query is set).

I tried to change a password in NC and it did not update in iRedAdmin, but this could have been because I was using the username I had already setup before to do it.

4

Re: iRedmail + Nextcloud + MySQL identity integration

wylel wrote:

Do you know if I was to enable this feature now, would this break the current users?

If you enable this now, every nextcloud user is either a local nextcloud-only user or a shared user. If the user currently has the same email address as a login on both places, I think you're fine. I think it means their iredmail password becomes their nextcloud password. Their app may or may not stop syncing until they update their nextcloud password in their app/laptop/etc.

I had a different problem. Originally my iredmail users had one set of user names and passwords and my nextcloud users had another. Moreover, my nextcloud users were simple usernames, not email addresses. To migrate from separate nextcloud identities, I had to do a bunch of things in the nextcloud MySQL tables and in the nextcloud filesystem. I only had 5 users at the time, so it was easy enough.

Since then, I've created more iredmail users and they just got nextcloud access as a side-effect.