1

Topic: Cloudflare and iRedMail

==== Required information ====
- iRedMail version (check /etc/iredmail-release):  latest
- Linux/BSD distribution name and version: Debian8 Jessie
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Apache
- Manage mail accounts with iRedAdmin-Pro?
- Related log if you're reporting an issue:
====

I can't get iRedMail to work with cloudflare. My mail server was on the same server as my site but it got hit with some attacks so i enabled free cloudflare.
I left the mail on the server ip itself but it stopped working so i switched it also to cloudflare. But still doesnt work. it always says it cant connect to database. But the entire site doesnt have any problem and it uses a database and it connects just fine, no details were changed.

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Cloudflare and iRedMail

Does it work if you disable cloudflare?

3 (edited by denede 2016-06-26 08:25:29)

Re: Cloudflare and iRedMail

No it doesn't. That's what's bugging me. It worked just fine before the attack.
Even stranger in the logs it says that: [pid 3586] (20014)Internal error: AH00629: Can't connect to mysql: Access denied for user 'vmail'@'127.0.0.1' (using password: YES)
But like i said, i never changed any details.
edit: i tried the login details for account vmail via phpmyadmin and the password that is in dovecot conf file works just fine
edit2: just saw that the mail.log has a lot of:
postfix/cleanup[8352]: warning: proxy:mysql:/etc/postfix/mysql/sender_bcc_maps_user.cf lookup error for "www-data@xxx.xx.xxx.xx

4

Re: Cloudflare and iRedMail

Seems web server daemon user is trying to send email, please try to add below setting in Postfix main.cf and reload/restart postfix service:

authorized_submit_users = !www-data

5

Re: Cloudflare and iRedMail

with this is not working at all anymore. says unable to send mail.
and also when i try to connect to roundecube i get
DATABASE ERROR: CONNECTION FAILED!
Unable to connect to the database!
Please contact your server-administrator.
i believe this is the entire problem..it cant simply connect to the sql
arghhh..i hate cloudflare so much

6

Re: Cloudflare and iRedMail

How about disable cloudflare first and make sure all mail services are working fine?

7

Re: Cloudflare and iRedMail

i did that, and the same thing happens
i believe if the main domain is on cloudflare then all things go to shit.. sad
even though the mail.domain.tld is on another ip

8

Re: Cloudflare and iRedMail

I'm confused here.

*) Did your iRedMail server running well before the attack?
*) Did the iRedMail server running well right after the attack? Which service didn't work?

9

Re: Cloudflare and iRedMail

Mail was working perfect before the attack. [Had the server ip]
The when the attack was happening i switched to CF, but mail remained on the server ip. It wasn't working after the switch was done.
Then i swtiched mail also to CF and still wasn't working.
At first i thought that mail isnt working because i didnt switched it to CF but i see now that it didn't do any good.

10

Re: Cloudflare and iRedMail

after i disabled cloudflare everything works as normal
cloudflare is blocking the service and it doesnt matter if its on cloudflare ip or server ip ...

11 (edited by denede 2017-07-10 21:25:58)

Re: Cloudflare and iRedMail

Hmm, seems this post is still here. hehehe..
So same issue, kinda..
I switched over to Coudflare a few days ago. Mail server was working perfect, even on cloudflare.
Yesterday i noticed that the mail won't work. When i saw the logs i have only

warning: proxy:mysql:/etc/postfix/mysql/sender_bcc_maps_user.cf lookup error for "www-data@mail.domain.tld"
warning: proxy:mysql:/etc/postfix/mysql/sender_bcc_maps_user.cf lookup error for "root@mail.domain.tld"

Again, this is so weird for me, didn't thought i will get it again after 1 year.
Why did it worked after i switched to CF and why doesn't it work anymore. I didn't touched postfix at all.
In cloudflare DNS management the mail server is NOT under cloudflare. It is on my server ip where the mail is installed so it shouldn't be any lookup errors
When i do a whois or ping for the mail server it gives the proper ip.
Again like i said this is mindblowing.

12

Re: Cloudflare and iRedMail

*) What's the log context of above 2 errors in Postfix log file?
*) Is mysql service running?
*) Does it work if you disabling CF (i'm not sure whether CF is directly involved here)?

13 (edited by denede 2017-07-13 05:53:47)

Re: Cloudflare and iRedMail

CF is not involved since the mail.domain.tld record is not under CF proxy.
Mysql is running since the site is up and online with no problems
By log context you mean this ?

Jul 12 23:48:02 mail postfix/cleanup[63860]: warning: proxy:mysql:/etc/postfix/mysql/sender_bcc_maps_user.cf lookup error for "root@mail.domain.tld"
Jul 12 23:48:02 mail postfix/cleanup[63860]: warning: 0DFAF484BF: sender_bcc_maps map lookup problem -- message not accepted, try again later
Jul 12 23:48:02 mail postfix/pickup[58446]: warning: maildrop/EE940494E3: error writing 0DFAF484BF: queue file write error
Jul 12 23:48:03 mail postfix/pickup[58446]: 0E485484D2: uid=33 from=<www-data>
Jul 12 23:48:03 mail postfix/cleanup[63860]: warning: proxy:mysql:/etc/postfix/mysql/sender_bcc_maps_user.cf lookup error for "www-data@mail.domain.tld"
Jul 12 23:48:03 mail postfix/cleanup[63860]: warning: 0E485484D2: sender_bcc_maps map lookup problem -- message not accepted, try again later
Jul 12 23:48:03 mail postfix/pickup[58446]: warning: maildrop/4895148685: error writing 0E485484D2: queue file write error
Jul 12 23:48:04 mail postfix/pickup[58446]: warning: 0EA46484E7: message has been queued for 2 days

The lookup error means that it can't find the ip/server, right!? But i didn't do any changes and whois and ping reveal the proper ip address
The weird thing is that i have 2 other domains/sites with their own separate server(obviously) which use CF exactly the same way and their mail is working...

14

Re: Cloudflare and iRedMail

No idea yet. The error message is not so clear for troubleshooting, need further debugging. Try to enable debug mode in Postfix and send some more emails to reproduce this issue, then check Postfix log file to see whether there's some more useful log.

15

Re: Cloudflare and iRedMail

I put debug level on 3 but same log i receive, nothing different

16

Re: Cloudflare and iRedMail

Debug level doesn't matter that much in Postfix, try this tutorial:
http://www.iredmail.org/docs/debug.postfix.html

17

Re: Cloudflare and iRedMail

Do you think it is possible that someone would edit their hosts file on their machine and attach their ip to my mail dns domain?
I think the lookup error is from this because i saw last night that my mail dns has another ip which is home user ip address. I don't have any idea from were that ip is. Doesnt CF has protection against this?

18

Re: Cloudflare and iRedMail

Again, we need some debug log for troubleshooting.
http://www.iredmail.org/docs/debug.postfix.html

19

Re: Cloudflare and iRedMail

Yep, did that and still no new info in the logs apppearing

20

Re: Cloudflare and iRedMail

Did you set the correct client IP address in Postfix "debug_peer_list ="?

21 (edited by denede 2017-07-20 06:42:37)

Re: Cloudflare and iRedMail

yes of course. it is of the server itself
ohh so troublesome.. wouldn't be better to just make another mail dns and change it from mail.domain.tld to email.domain.tld which points to my server ip...
i just need to edit the main.cf in postfix for this ?
New error is: Temporary lookup failure
it just cant see my server sad
p.s I removed CF and still same issues. Yep for sure is because what i said a few posts above about that home user ip showing as my dns e-mail host...
edit: changed the mail dns, everything in hosts and hostname file and still the same. lookup error after lookup error.
tested every single user and password that needs too connect to mysql, all work
127.0.0.1 is set in hosts file for the new email.domain.tld

22

Re: Cloudflare and iRedMail

There is still a way to solve that problem?

Use iRedMail with Cloudflare proxy

Regards