haraka / Haraka

A fast, highly extensible, and event driven SMTP server
https://haraka.github.io
MIT License
5.08k stars 661 forks source link

Haraka on Openshift doesn't get called #1043

Closed avently closed 9 years ago

avently commented 9 years ago

Hello.

I trying to install Haraka on Openshift. On my local machine its working fine but on Openshift Haraka listen only on port 80 from web browser. I use swaks for testing. Here are the results:

swaks -h mysite.ru -t test-mail@yandex.ru -f iam@ mysite.ru -s mymail-app.rhcloud.com -p 80 -au user -ap password
=== Trying  mymail-app.rhcloud.com:80...
=== Connected to  mymail-app.rhcloud.com.
<** Timeout (30 secs) waiting for server response
 -> QUIT
<** <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<** <html><head>
<** <title>400 Bad Request</title>
<** </head><body>
<** <h1>Bad Request</h1>
<** <p>Your browser sent a request that this server could not understand.<br />
<** 045</p>
<** <hr>
<** <address>Apache/2.2.15 (Red Hat) Server at localhost Port 80</address>
<** </body></html>
*** Remote host closed connection unexpectedly.

This is the logs:

loglevel: LOGDEBUG
Starting up Haraka version 2.6.1
[INFO] [-] [core] Loading plugins
[INFO] [-] [core] Loading plugin: auth/flat_file
[DEBUG] [-] [core] no timeout in auth/flat_file.timeout
[DEBUG] [-] [core] no timeout in plugin_timeout
[DEBUG] [-] [core] plugin auth/flat_file timeout is: 30s
[INFO] [-] [core] loaded 6791 Public Suffixes
[INFO] [-] [core] loaded TLD files: 1=442 2=4542 3=283
[DEBUG] [-] [core] no timeout in auth/auth_base.timeout
[DEBUG] [-] [core] no timeout in plugin_timeout
[DEBUG] [-] [core] plugin auth/auth_base timeout is: 30s
[DEBUG] [-] [core] registered hook capabilities to auth/flat_file.hook_capabilities
[DEBUG] [-] [core] registered hook unrecognized_command to auth/flat_file.hook_unrecognized_command
[INFO] [-] [core] Loading plugin: dkim_sign
[DEBUG] [-] [core] no timeout in dkim_sign.timeout
[DEBUG] [-] [core] no timeout in plugin_timeout
[DEBUG] [-] [core] plugin dkim_sign timeout is: 30s
[DEBUG] [-] [core] Returning boolean false for main.disabled=false
[DEBUG] [-] [core] registered hook queue_outbound to dkim_sign.hook_queue_outbound
[NOTICE] [-] [core] Listening on 127.10.232.1:8080
[DEBUG] [-] [server] running init_master hooks
[DEBUG] [-] [core] [outbound] Creating queue directory /var/lib/openshift/55808fea4382ec64b300005f/app-root/runtime/repo/queue
[INFO] [-] [core] [outbound] Loading outbound queue from /var/lib/openshift/55808fea4382ec64b300005f/app-root/runtime/repo/queue

As you can see Haraka did not get a call. Also i use 80 port instead of 8080 because of Openshift specific.

When i open browser and go to mymail-app.rhcloud.com:80 Haraka write this:

[NOTICE] [109430B4-CD9B-4D4F-9479-752950A1A8DA] [core] connect ip=127.10.232.1 port=15826 local_ip=127.10.232.1 local_port=8080
[DEBUG] [109430B4-CD9B-4D4F-9479-752950A1A8DA] [core] running lookup_rdns hooks
[DEBUG] [109430B4-CD9B-4D4F-9479-752950A1A8DA] [core] [early_talker] state=4 esmtp=false line="GET / HTTP/1.1"
[DEBUG] [109430B4-CD9B-4D4F-9479-752950A1A8DA] [core] running connect hooks
[DEBUG] [109430B4-CD9B-4D4F-9479-752950A1A8DA] [core] running unrecognized_command hooks
[DEBUG] [109430B4-CD9B-4D4F-9479-752950A1A8DA] [core] running unrecognized_command hook in auth/flat_file plugin
[DEBUG] [109430B4-CD9B-4D4F-9479-752950A1A8DA] [core] hook=unrecognized_command plugin=auth/flat_file function=hook_unrecognized_command params="GET" retval=CONT msg=""
[DEBUG] [109430B4-CD9B-4D4F-9479-752950A1A8DA] [core] running unrecognized_command hooks
[DEBUG] [109430B4-CD9B-4D4F-9479-752950A1A8DA] [core] running unrecognized_command hook in auth/flat_file plugin
[DEBUG] [109430B4-CD9B-4D4F-9479-752950A1A8DA] [core] hook=unrecognized_command plugin=auth/flat_file function=hook_unrecognized_command params="host:" retval=CONT msg=""
[DEBUG] [109430B4-CD9B-4D4F-9479-752950A1A8DA] [core] running unrecognized_command hooks
[DEBUG] [109430B4-CD9B-4D4F-9479-752950A1A8DA] [core] running unrecognized_command hook in auth/flat_file plugin
[DEBUG] [109430B4-CD9B-4D4F-9479-752950A1A8DA] [core] hook=unrecognized_command plugin=auth/flat_file function=hook_unrecognized_command params="accept:" retval=CONT msg=""
[DEBUG] [109430B4-CD9B-4D4F-9479-752950A1A8DA] [core] running unrecognized_command hooks
[DEBUG] [109430B4-CD9B-4D4F-9479-752950A1A8DA] [core] running unrecognized_command hook in auth/flat_file plugin
[DEBUG] [109430B4-CD9B-4D4F-9479-752950A1A8DA] [core] hook=unrecognized_command plugin=auth/flat_file function=hook_unrecognized_command params="accept-language:" retval=CONT msg=""
[DEBUG] [109430B4-CD9B-4D4F-9479-752950A1A8DA] [core] running unrecognized_command hooks
[DEBUG] [109430B4-CD9B-4D4F-9479-752950A1A8DA] [core] running unrecognized_command hook in auth/flat_file plugin
[DEBUG] [109430B4-CD9B-4D4F-9479-752950A1A8DA] [core] hook=unrecognized_command plugin=auth/flat_file function=hook_unrecognized_command params="connection:" retval=CONT msg=""
[DEBUG] [109430B4-CD9B-4D4F-9479-752950A1A8DA] [core] running unrecognized_command hooks
[DEBUG] [109430B4-CD9B-4D4F-9479-752950A1A8DA] [core] running unrecognized_command hook in auth/flat_file plugin
[DEBUG] [109430B4-CD9B-4D4F-9479-752950A1A8DA] [core] hook=unrecognized_command plugin=auth/flat_file function=hook_unrecognized_command params="accept-encoding:" retval=CONT msg=""
[DEBUG] [109430B4-CD9B-4D4F-9479-752950A1A8DA] [core] running unrecognized_command hooks
[DEBUG] [109430B4-CD9B-4D4F-9479-752950A1A8DA] [core] running unrecognized_command hook in auth/flat_file plugin
[DEBUG] [109430B4-CD9B-4D4F-9479-752950A1A8DA] [core] hook=unrecognized_command plugin=auth/flat_file function=hook_unrecognized_command params="user-agent:" retval=CONT msg=""
[DEBUG] [109430B4-CD9B-4D4F-9479-752950A1A8DA] [core] running unrecognized_command hooks
[DEBUG] [109430B4-CD9B-4D4F-9479-752950A1A8DA] [core] running unrecognized_command hook in auth/flat_file plugin
[DEBUG] [109430B4-CD9B-4D4F-9479-752950A1A8DA] [core] hook=unrecognized_command plugin=auth/flat_file function=hook_unrecognized_command params="X-Forwarded-For:" retval=CONT msg=""
[DEBUG] [109430B4-CD9B-4D4F-9479-752950A1A8DA] [core] running unrecognized_command hooks
[DEBUG] [109430B4-CD9B-4D4F-9479-752950A1A8DA] [core] running unrecognized_command hook in auth/flat_file plugin
[DEBUG] [109430B4-CD9B-4D4F-9479-752950A1A8DA] [core] hook=unrecognized_command plugin=auth/flat_file function=hook_unrecognized_command params="X-Client-IP:" retval=CONT msg=""
[DEBUG] [109430B4-CD9B-4D4F-9479-752950A1A8DA] [core] running unrecognized_command hooks
[DEBUG] [109430B4-CD9B-4D4F-9479-752950A1A8DA] [core] running unrecognized_command hook in auth/flat_file plugin
[DEBUG] [109430B4-CD9B-4D4F-9479-752950A1A8DA] [core] hook=unrecognized_command plugin=auth/flat_file function=hook_unrecognized_command params="X-Forwarded-Proto:" retval=CONT msg=""
[DEBUG] [109430B4-CD9B-4D4F-9479-752950A1A8DA] [core] running unrecognized_command hooks
[DEBUG] [109430B4-CD9B-4D4F-9479-752950A1A8DA] [core] running unrecognized_command hook in auth/flat_file plugin
[DEBUG] [109430B4-CD9B-4D4F-9479-752950A1A8DA] [core] hook=unrecognized_command plugin=auth/flat_file function=hook_unrecognized_command params="X-Forwarded-Host:" retval=CONT msg=""
[DEBUG] [109430B4-CD9B-4D4F-9479-752950A1A8DA] [core] running unrecognized_command hooks
[DEBUG] [109430B4-CD9B-4D4F-9479-752950A1A8DA] [core] running unrecognized_command hook in auth/flat_file plugin
[DEBUG] [109430B4-CD9B-4D4F-9479-752950A1A8DA] [core] hook=unrecognized_command plugin=auth/flat_file function=hook_unrecognized_command params="X-Forwarded-Port:" retval=CONT msg=""
[DEBUG] [109430B4-CD9B-4D4F-9479-752950A1A8DA] [core] running unrecognized_command hooks
[DEBUG] [109430B4-CD9B-4D4F-9479-752950A1A8DA] [core] running unrecognized_command hook in auth/flat_file plugin
[DEBUG] [109430B4-CD9B-4D4F-9479-752950A1A8DA] [core] hook=unrecognized_command plugin=auth/flat_file function=hook_unrecognized_command params="" retval=CONT msg=""
[INFO] [109430B4-CD9B-4D4F-9479-752950A1A8DA] [core] client [127.10.232.1] connection error: Error: write EPIPE
[DEBUG] [109430B4-CD9B-4D4F-9479-752950A1A8DA] [core] running disconnect hooks
[NOTICE] [109430B4-CD9B-4D4F-9479-752950A1A8DA] [core] disconnect ip=127.10.232.1 rdns="DNSERROR" helo="" relay=N early=Y esmtp=N tls=N pipe=N txns=0 rcpts=0/0/0 msgs=0/0/0 bytes=0 lr="500 Unrecognized command" time=0.013

If i make port forwarding and use localhost of my home computer when using swaks everything is fine and working.

Can you please help me?

smfreegard commented 9 years ago

[NOTICE] [-] [core] Listening on 127.10.232.1:8080

Haraka isn't listening on port 80 like you think it is. I highly suspect that Openshift is proxying the traffic between port 80 on the external IP to 8080 and treating it as HTTP - hence why Haraka is seeing HTTP traffic on it's port.

This is an OpenShift question - you need to go speak to their support. See https://forums.openshift.com/expose-port-8080-to-the-internet

avently commented 9 years ago

Other PaaS services (like IBM Bluemix) have this issue too. So I think we should fine a right way together.

If Haraka can see queries on port 80 why it can't listen other events? I don't understand this moment

avently commented 9 years ago

Other node servers working fine... Why not Haraka? image

baudehlo commented 9 years ago

Your other node servers are http servers. You can't send http to Haraka and expect it to work.

On Jun 17, 2015, at 8:44 PM, avently notifications@github.com wrote:

Other node servers working fine... Why not Haraka?

— Reply to this email directly or view it on GitHub.

avently commented 9 years ago

Ok, I understand. Can I run node server, send json file with email data to it via http and then forward this data somehow to Haraka? I need only outgoing mail.

smfreegard commented 9 years ago

You could write your own plugin to do that.

However.

These PaaS providers will likely block outbound port 25 (as they don't want to deal with spam/abuse) or will heavily rate-limit it. They pretty much expect you to use something like AmazonSES, Sendgrid or Mailgun to send mail from your apps - and for that you want nodemailer and not Haraka.