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 keeps crashing due to a bounced email #388

Closed sogko closed 10 years ago

sogko commented 10 years ago

Haraka keeps crashing due to a bounced email

Wrote a simple bounce plugin, always returning a next(OK). (preventing it from sending a bounce mail)

Sometimes, the server crashed because of a missing file. (I did a simple fs.existsSync)

This is the only custom plugin loaded

Running v2.2.8 I believe (did a fresh npm install -g, but running 'haraka --version' shows v2.0.4)


[DEBUG] [0C3F9456-00BB-45A6-9A31-2865E0CB9418.25] [outbound] running bounce hook in email_service.hook_bounce plugin [DEBUG] [-] [email_service.hook_bounce] hook_bounce [DEBUG] [-] [email_service.hook_bounce] "Unrecognised response from upstream server: rblsmtpd: 11.11.11.11 pid 11483: 451 http://www.barracudanetworks.com/reputation/?pr=1&ip=11.11.11.11\n" [DEBUG] [-] [email_service.hook_bounce] {"domain":null,"events":{},"maxListeners":10,"path":"/opt/haraka/queue/1385342052540_1_9671_3918.smtp.-----.com","filename":"1385342052540_1_9671_3918.smtp.-----.com","next_process":"1385341986158","num_failures":1,"notes":{},"file_size":105499,"data_start":301,"todo":{"domain":"-----.com.sg","rcpt_to":[{"original":"admin@-----.com.sg","user":"admin","host":"-----.com.sg"}],"mail_from":{"original":"mail@-----.com","user":"mail","host":"-----.com"},"notes":{},"uuid":"0C3F9456-00BB-45A6-9A31-2865E0CB9418.25"},"hooks_to_run":[],"mxlist":[],"hostlist":[],"bounce_error":"Unrecognised response from upstream server: rblsmtpd: 11.11.11.11 pid 11483: 451 http://www.0-------.com/reputation/?pr=1&ip=11.11.11.11\n","current_hook":[{"name":"email_service.hook_bounce","base":{},"timeout":30,"full_paths":["/opt/haraka/plugins/email_service.hook_bounce.js","/usr/local/lib/node_modules/Haraka/plugins/email_service.hook_bounce.js"],"config":{},"hooks":{"queue_ok":["hook_queue_ok"],"delivered":["hook_delivered"],"bounce":["hook_bounce"]}},"hook_bounce"]} [DEBUG] [-] [email_service.hook_bounce] {"pool":{"2555:localhost:300":{}}}} [DEBUG] [-] [email_service.hook_bounce] UUID:0C3F9456-00BB-45A6-9A31-2865E0CB9418 [DEBUG] [-] [email_service.hook_bounce]* filename DOES NOT EXISTS:1385342052540_1_9671_3918.smtp.-----.com [INFO] [0C3F9456-00BB-45A6-9A31-2865E0CB9418.25]* [outbound] hook=bounce plugin=email_service.hook_bounce function=hook_bounce params="Unrecognised response from upstream server: rblsmtpd: 11.11.11.11 pid 11483: 451 http://www.barracudanetworks.com/reputation/?pr=1&ip=11.11.11.11 " retval=OK msg="" [INFO] [0C3F9456-00BB-45A6-9A31-2865E0CB9418.25] [outbound] plugin responded with: 906. Not sending bounce. [PROTOCOL] [0C3F9456-00BB-45A6-9A31-2865E0CB9418.25] [outbound] S: 220 rblsmtpd.local\r\n [PROTOCOL] [0C3F9456-00BB-45A6-9A31-2865E0CB9418.25] [outbound] C: EHLO smtp.-----.com [ERROR] [0C3F9456-00BB-45A6-9A31-2865E0CB9418.25] [outbound] Ongoing connection failed: Error: write after end [INFO] [0C3F9456-00BB-45A6-9A31-2865E0CB9418.25] [outbound] Temp failing 1385342052540_1_9671_3918.smtp.-----.com for 128 seconds: Tried all MXs [PROTOCOL] [301D0BF6-555C-41B0-BE53-7518828014A7.52] [outbound] S: 220 web.de (mxweb106) Nemesis ESMTP Service ready\r\n [DEBUG] [-] [email_service.hook_bounce] "OK id=1Vkkkb-000Y2k-UM" [DEBUG] [98E6D740-00FB-4ACF-B8A8-22AE9DDCF509.47] [outbound] hook=delivered plugin=email_service.hook_bounce function=hook_delivered params="OK id=1Vkkkb-000Y2k-UM" retval=CONT msg="" [CRIT] [-] [core] Error: ENOENT, open '/opt/haraka/queue/1385342052540_1_9671_3918.smtp.-----.com' [INFO] [-] [core] Shutting down

smfreegard commented 10 years ago

If haraka --version is returning 2.0.4 then that is the version that it is picking up. You'll need to find out why and fix this issue first to make sure you are running the latest outbound code.

sogko commented 10 years ago

I'm trying to reinstall Haraka with the hope of getting v2.2.8, but I'm still getting v2.0.4 when doing "haraka --version"

Steps taken to reinstall

$ npm -g rm Haraka
$ npm install -g Haraka
# the install log shows that it has installed v2.2.8

Haraka@2.2.8 /usr/lib/node_modules/Haraka
├── daemon@1.1.0
├── npid@0.3.2
├── generic-pool@2.0.4
├── async@0.2.9
├── semver@2.2.1
├── nopt@2.1.2 (abbrev@1.0.4)
├── ipaddr.js@0.1.1 (coffee-script@1.6.3)
├── node-syslog@1.1.7
├── ldapjs@0.6.3 (assert-plus@0.1.2, asn1@0.1.11, nopt@2.1.1, bunyan@0.21.1, pooling@0.4.4, buffertools@1.1.0, dtrace-provider@0.2.8)
└── iconv@2.0.7

But when i do --version, it shows the following

$ haraka --version
> Haraka.js — Version: 2.0.4
$ which haraka
> /usr/local/bin/haraka

Is the location of 'haraka' file correct? Is it not being updated when i tried to reinstall?

I've tried to verify that the installed global npm module is the latest by looking at the package.json

$ cat  /usr/lib/node_modules/Haraka/package.json
> 
{
  "author": {
    "name": "Matt Sergeant",
    "email": "helpme@gmail.com",
    "url": "http://baudehlo.wordpress.com/"
  },
  "name": "Haraka",
  "description": "An SMTP Server project.",
  "keywords": [
    "haraka",
    "smtp",
    "server",
    "email"
  ],
  "version": "2.2.8", // <------- this seems to be correct
  "homepage": "https://github.com/baudehlo/Haraka/",
  "repository": {
    "type": "git",
    "url": "git://github.com/baudehlo/Haraka.git"
  },
  "main": "haraka.js",
  "engines": {
    "node": ">= v0.8.0"
  },
  "dependencies": {
    "nopt": ">= 1.0.5",
    "generic-pool": ">= 2.0.2",
    "iconv": ">= 1.1.3",
    "ipaddr.js": ">= 0.1.1",
    "semver": ">= 1.0.14",
    "async": ">= 0.1.22",
    "daemon": ">= 1.1.0",
    "npid": ">= 0.3.1",
    "node-syslog": ">= 1.1.2",
    "ldapjs": ">= 0.6.3"
  },
  "optionalDependencies": {
    "node-syslog": ">= 1.1.2",
    "ldapjs": ">= 0.6.3"
  },

What am i doing wrong? Thanks so much in looking into this Matt, this is a great module. Quick and easy to setup

baudehlo commented 10 years ago

Try: ls -l 'which haraka'

(Those are back ticks - can't type them on my phone).

This will tell you where 2.04 is coming from.

It's likely somewhere else in your path than the new one. Check "which npm" for where it should be.

My guess is Haraka is in /usr/bin but you want the one in /usr/local/bin

On Nov 27, 2013, at 8:55 PM, Hafiz Ismail notifications@github.com wrote:

I'm trying to reinstall Haraka with the hope of getting v2.2.8, but I'm still getting v2.0.4 when doing "haraka --version"

Steps taken to reinstall

$ npm -g rm Haraka $ npm install -g Haraka

the install log shows that it has installed v2.2.8

Haraka@2.2.8 /usr/lib/node_modules/Haraka ├── daemon@1.1.0 ├── npid@0.3.2 ├── generic-pool@2.0.4 ├── async@0.2.9 ├── semver@2.2.1 ├── nopt@2.1.2 (abbrev@1.0.4) ├── ipaddr.js@0.1.1 (coffee-script@1.6.3) ├── node-syslog@1.1.7 ├── ldapjs@0.6.3 (assert-plus@0.1.2, asn1@0.1.11, nopt@2.1.1, bunyan@0.21.1, pooling@0.4.4, buffertools@1.1.0, dtrace-provider@0.2.8) └── iconv@2.0.7 But when i do --version, it shows the following

$ haraka --version

Haraka.js — Version: 2.0.4 $ which haraka /usr/local/bin/haraka Is the location of 'haraka' file correct? Is it not being updated when i tried to reinstall?

I've tried to verify that the installed global npm module is the latest by looking at the package.json

$ cat /usr/lib/node_modules/Haraka/package.json

{ "author": { "name": "Matt Sergeant", "email": "helpme@gmail.com", "url": "http://baudehlo.wordpress.com/" }, "name": "Haraka", "description": "An SMTP Server project.", "keywords": [ "haraka", "smtp", "server", "email" ], "version": "2.2.8", // <------- this seems to be correct "homepage": "https://github.com/baudehlo/Haraka/", "repository": { "type": "git", "url": "git://github.com/baudehlo/Haraka.git" }, "main": "haraka.js", "engines": { "node": ">= v0.8.0" }, "dependencies": { "nopt": ">= 1.0.5", "generic-pool": ">= 2.0.2", "iconv": ">= 1.1.3", "ipaddr.js": ">= 0.1.1", "semver": ">= 1.0.14", "async": ">= 0.1.22", "daemon": ">= 1.1.0", "npid": ">= 0.3.1", "node-syslog": ">= 1.1.2", "ldapjs": ">= 0.6.3" }, "optionalDependencies": { "node-syslog": ">= 1.1.2", "ldapjs": ">= 0.6.3" },

What am i doing wrong? Thanks so much in looking into this Matt, this is a great module. Quick and easy to setup

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

sogko commented 10 years ago

Something strange must have happened when doing the first installation for v2.0.4. It was pointing to /usr/local/bin/haraka. But v2.2.8 installation expects it to be /usr/bin/haraka instead which shows the right version.

$ ls -l `which haraka`
lrwxrwxrwx 1 root root 37 Oct 31 07:22 /usr/local/bin/haraka -> ../lib/node_modules/Haraka/bin/haraka

$ haraka --version 
# still 2.0.4

$ /usr/local/bin/haraka --version 
# still 2.0.4

$ /usr/bin/haraka --version 
# v2.2.8

So I tried to remove the haraka file in /usr/local/bin and did a reinstall of haraka.

Note: I had to re-enter bash to re-set the PATH environment (it was still trying to pick up haraka in /usr/local/bin/)

After re-install + re-login

$  ls -l `which haraka`
> lrwxrwxrwx 1 root root 37 Nov 28 01:59 /usr/bin/haraka -> ../lib/node_modules/Haraka/bin/haraka
$ haraka --version
>  Haraka.js — Version: 2.2.8   <-- JACKPOT!

So now I'm getting the latest haraka code. Will try to see if the original issue still manifests itself.

Thanks a lot, Matt, Steve! =)

sogko commented 10 years ago

The latest code v2.2.8 seems to fix the original issue.

baudehlo commented 10 years ago

Yay! So happy for you.

On Nov 27, 2013, at 11:07 PM, Hafiz Ismail notifications@github.com wrote:

The latest code v2.2.8 seems to fix the original issue.

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