I run z-push with the Zimbra backend behind a reverse proxy with nginx.
The z-push log file it shows the IP address of the nginx gateway and not the real address
You are welcome. Happy it worked for you. I use it all the time myself.
It also gets added to the CURL calls from the zimbra backend so that additional information is available in the mailbox.log file for the z-push calls. This can be useful for debugging purposes also. For example
You can see the call came from the z-push server 192.168.200.100 in this case, but also in the ua string you can see the Device Type that made the request and the last 6 chars of the deviceID. In devip you get the device IP address, and the zimbra backend version.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I did that and the zimbra audit.log reads correctly the remote ip ... problem is the z-push log that writes the ip of the front-end reverse proxy and not the remote ip …
Last edit: milauria 2017-07-14
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks heaps for the hint ... I would have never though about it!
Under Centos7 I saw that I need to donwload the tar manually etc ... following the "keep it simple" philosophy, should I better uninstall apache and install a plain nginx also on the zimbra server for the z-push so that it can better communicate with the upstream nginx reverse-proxy ?
I though to use this configration for z-push with nginx: https://zignar.net/2012/04/14/z-push/
Thanks for any advice, I will try anyway and report here the result
Last edit: milauria 2017-07-14
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Usually I leave Zimbra on port 443, and then patch zimbra's nginx to forward /Microsoft-Server-ActiveSync to a local apache/nginx on port (i.e.) 444. But this implies patching zimbra after every upgrade.
Otherwise you can keep your current config but serve the AS url directly from the nginx proxy, without passing it over to apache.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This is very interesting ..so you are saying that from the reverse proxy server 192.168.0.100 I can put something like the below with no need of apache on zimbra server?
I run z-push with the Zimbra backend behind a reverse proxy with nginx.
The z-push log file it shows the IP address of the nginx gateway and not the real address
In nginx I have set:
any way to have z-push to log the real ip address of the remote device connecting ?
I need this for an effective fail2ban setup
thanks for any advise
Last edit: milauria 2017-07-14
Have you configured this setting in the z-push config.php file?
Fantastic, this works perfectly … my overlook on the z-push settings … thanks a lot for the hint from a very happy user !
You are welcome. Happy it worked for you. I use it all the time myself.
It also gets added to the CURL calls from the zimbra backend so that additional information is available in the mailbox.log file for the z-push calls. This can be useful for debugging purposes also. For example
2017-07-14 00:06:23,965 INFO [qtp509886383-17878:http://192.168.200.10:8080/service/soap/] [name=userName;mid=11;ip=192.168.200.10;oip=213.233.132.156, 192.168.200.100;ua=Android-SAMSUNG-SM-G920F/101.700(...f5d123) devip=213.233.132.156 ZPZB/66.1;] soap - (batch) GetFolderRequest elapsed=0
You can see the call came from the z-push server 192.168.200.100 in this case, but also in the ua string you can see the Device Type that made the request and the last 6 chars of the deviceID. In devip you get the device IP address, and the zimbra backend version.
You should probably add your nginx's server ip address to Zimbra's trusted IP. Check zimbra attribute zimbraMailTrustedIP
I did that and the zimbra audit.log reads correctly the remote ip, problem is the z-push log that still reads the reverse proxy that stays in front…
I did that and the zimbra audit.log reads correctly the remote ip ... problem is the z-push log that writes the ip of the front-end reverse proxy and not the remote ip …
Last edit: milauria 2017-07-14
Try with:
This is in the nginx.conf of the reverse proxy?
you mean something like this:
am I setting variables values with the above ?
I'm not fully understanding your configuration...
Do you have
public -> nginx proxy (zpush) -> zimbra
or something else?
I have public --> nginx reverse proxy (ip 192.168.0.100) --> zimbra & z-push on the same server ip 192.168.0.110
On the zimbra server 192.168.0.110 ... zimbra is listening on 8443 and z-push/httpd is listening on 443 ...
Last edit: milauria 2017-07-14
So you're not seeing the real IP on httpd (I suppose apache). You need to install mod_rpaf
https://zeldor.biz/2011/01/nginx-apache2-real-ip/
Thanks heaps for the hint ... I would have never though about it!
Under Centos7 I saw that I need to donwload the tar manually etc ... following the "keep it simple" philosophy, should I better uninstall apache and install a plain nginx also on the zimbra server for the z-push so that it can better communicate with the upstream nginx reverse-proxy ?
I though to use this configration for z-push with nginx: https://zignar.net/2012/04/14/z-push/
Thanks for any advice, I will try anyway and report here the result
Last edit: milauria 2017-07-14
Usually I leave Zimbra on port 443, and then patch zimbra's nginx to forward /Microsoft-Server-ActiveSync to a local apache/nginx on port (i.e.) 444. But this implies patching zimbra after every upgrade.
Otherwise you can keep your current config but serve the AS url directly from the nginx proxy, without passing it over to apache.
This is very interesting ..so you are saying that from the reverse proxy server 192.168.0.100 I can put something like the below with no need of apache on zimbra server?
Last edit: milauria 2017-07-14
Not exaclty. nginx should serve also as an http server, and proxy /zimbra and its stuff.
https://zignar.net/2012/04/14/z-push/