How to use localhost for sending out email?

Hello,

I was trying to configure localhost to send out mail notifications, however, i get this in the logs:

[2020-08-05 14:37:36] ERROR [aTw5qRgG74Q] getaddrinfo ENOTFOUND null
[2020-08-05 14:37:36] DEBUG [aTw5qRgG74Q] Closing connection to the server using “destroy”
[2020-08-05 14:37:36] ERROR Send Error: getaddrinfo ENOTFOUND null
{“errno”:“ENOTFOUND”,“code”:“EDNS”,“syscall”:“getaddrinfo”,“hostname”:“null”,“command”:“CONN”,“level”:“error”,“message”:"mail/index/sendSTMPEmailgetaddrinfo ENOTFOUND null

I tried to change

HOLLAEX_CONFIGMAP_SMTP_SERVER=localhost
HOLLAEX_CONFIGMAP_SMTP_PORT=25
HOLLAEX_CONFIGMAP_SMTP_USER=root

But this configuration doesnt get reflected, can anyone help me understand what I am doing wrong ?

Thanks,

Ok, managed to fix this by deleting the exchange :

hollaex web --terminate
hollaex terminate

then visited dash.bitholla.com and signed up as DIY Exchange then perform :

hollaex setup
hollaex web --setup

hollaex start
hollaex web --start

However, my setup is run behind proxy server, but application (api.domain.com) is not able to pickup X-Forwarded-For IP of remote client. How to fix this ?

Having a reverse proxy is a common practice but what exactly is the issue you are facing now? Providing screenshots could help.

Hello,

So I have apache proxy --> Load Balancer setup before hollaex --> VM
Apache Proxy (public IP , 10.0.1.1 pvt vm lan)
Hollaex VM (pvt IP : 10.0.1.5)

Apache has been setup with remoteip and proxy* modules
with X-Forward-For setup and it sends the remote client IP and shows up this in its log :slight_smile:

Hollaex Configuration

    ProxyPreserveHost On
    ProxyRequests Off
    ProxyVia On
    ProxyPass "/" "http://10.0.1.5:80/"
    ProxyPassReverse "/" "http://10.0.1.5:80/"

RemoteIPHeader X-Forwarded-For

103.242.120.104 - - [06/Aug/2020:19:54:28 +0530] “GET /v1/reset-password?captcha=AAAYYY&email=xxx HTTP/2.0” 200 158 “https://domain.com/reset-password” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36”

While nginx corresponding log shows :
10.0.1.1 - - [06/Aug/2020:14:24:28 +0000] 200 “GET /v1/reset-password?captcha=AAAYYY&email=xxx HTTP/1.1” 63 “https://domain.com/reset-password” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36” "103.242.120.104"

However the application server running at hollaex is picking up IP of remote client as : 10.0.1.1 instead of 103.242.120.104

Let me know if you require further details,

Hi there.

Looks like you are having a logging issue while you are running HollaEx with a reverse proxy.

There are two types of logs you could check the IPs.

  • Nginx Logs
  • API Logs

For the Nginx logs, as you mentioned above, it displays the X-forwarded-for logs at the end of the logs line. You could get the real IP by checking it.

For the API logs, it also supports to display the X-forwarded-for IP, but the log lines are separated.

Here’s an example:

2020-08-07 16:24:00	
{"message":"::ffff:192.168.148.227 - - [07/Aug/2020:07:24:00 +0000] "GET /v1/constant HTTP/1.1" 200 7771 "-" "python-requests/2.21.0"
 ","level":"info","timestamp":"2020-08-07T07:24:00.137Z"}

2020-08-07 16:24:04	
{"level":"info","message":"9db7c6fc-bb20-4dde-90c6-10487526bfa2 middleware/hostname api.domain.com 53.51.127.60  GET /v1/constant","timestamp":"2020-08-07T07:24:04.471Z","log":"{\"level\":\"info\",\"message\":\"9db7c6fc-bb20-4dde-90c6-10487526bfa2 middleware/hostname api.domain.com 53.51.127.60  GET /v1/constant\",\"timestamp\":\"2020-08-07T07:24:04.471Z\"}\n"}

On the first line, it only shows the internal IP of a load balancer, but the following logs do show the real IP of the user. Please keep this in mind.

Also, this is not related to the logs, but the emails that the server sends to the user also displays an IP. It only records the local IP (with no X-forwarded-for) by default. You could customize this at the /mail folder of the HollaEx Kit if you want. Make sure to redeploy it by running hollaex upgrade once you customize it.

Thanks.