Repository: haraka/Haraka

Issue #2763: Haraka crashes when MX A address is valid and AAAA is not valid
Created: 2020-02-15T12:29:56Z
system info



Haraka
Haraka.js — Version: 2.8.23




Node
v6.17.1


OS
Linux mx.bluestreak.net 3.10.0-957.12.2.el7.x86_64 #1 SMP Tue May 14 21:24:32 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux


openssl
OpenSSL 1.0.2k-fips  26 Jan 2017



Expected behavior
I expect Haraka to not crash.
Observed behavior
Haraka crashes: if an MX host has an invalid AAAA address, even though it has a valid A address, an exception is thrown.
Feb 14 08:59:52 mx haraka[18095]: [INFO] [0816B6BC-2EE6-457B-8731-731B342E7332.1] [mail_from.is_resolvable] e.smilereminder.com: MX 5 mail.communitect.com => 192.41.13.251,::192.41.13.251
Feb 14 08:59:52 mx haraka[18095]: [CRIT] [-] [core] Error: ipaddr: the address has neither IPv6 nor IPv4 format
Feb 14 08:59:52 mx haraka[18095]: [CRIT] [-] [core]     at Object.ipaddr.parse (/usr/lib/node_modules/Haraka/node_modules/ipaddr.js/lib/ipaddr.js:595:13)
Feb 14 08:59:52 mx haraka[18095]: [CRIT] [-] [core]     at Object.exports.ipv6_bogus (/usr/lib/node_modules/Haraka/node_modules/haraka-net-utils/index.js:347:26)
Feb 14 08:59:52 mx haraka[18095]: [CRIT] [-] [core]     at /usr/lib/node_modules/Haraka/plugins/mail_from.is_resolvable.js:119:39
Feb 14 08:59:52 mx haraka[18095]: [CRIT] [-] [core]     at /usr/lib/node_modules/Haraka/node_modules/haraka-net-utils/index.js:328:7
Feb 14 08:59:52 mx haraka[18095]: [CRIT] [-] [core]     at /usr/lib/node_modules/Haraka/node_modules/async/dist/async.js:3888:9
Feb 14 08:59:52 mx haraka[18095]: [CRIT] [-] [core]     at /usr/lib/node_modules/Haraka/node_modules/async/dist/async.js:473:16
Feb 14 08:59:52 mx haraka[18095]: [CRIT] [-] [core]     at iteratorCallback (/usr/lib/node_modules/Haraka/node_modules/async/dist/async.js:1064:13)
Feb 14 08:59:52 mx haraka[18095]: [CRIT] [-] [core]     at /usr/lib/node_modules/Haraka/node_modules/async/dist/async.js:969:16
Feb 14 08:59:52 mx haraka[18095]: [CRIT] [-] [core]     at /usr/lib/node_modules/Haraka/node_modules/async/dist/async.js:3885:13
Feb 14 08:59:52 mx haraka[18095]: [CRIT] [-] [core]     at dns.resolve6 (/usr/lib/node_modules/Haraka/node_modules/haraka-net-utils/index.js:320:11)
Steps to reproduce
Haraka is running on server with IPv4 only.
Haraka will crash when it receives an email from an MX host that has a valid A address and an invalid AAAA address.
$ host mail.communitect.com
mail.communitect.com has address 192.41.13.251
mail.communitect.com has IPv6 address ::192.41.13.251

Duplicate issue #2865: Invalid IP address causes Haraka to crash
Created: 2020-11-24T12:38:49Z
system info



Haraka
Haraka.js — Version: 2.8.25




Node
v13.14.0


OS
Linux mx3.bluestreak.net 3.10.0-1062.18.1.el7.x86_64 #1 SMP Tue Mar 17 23:49:17 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux


openssl
OpenSSL 1.0.2k-fips  26 Jan 2017



Observed behavior
Haraka crashes
Nov 24 07:08:40 mx3 haraka[24923]: [INFO] [E623781C-31A5-4F30-BF3F-1EE3DC01DCD5] [helo.checks] helo_host: smtp-timely-01.communitect.com, ips: 192.41.19.137,192.41.19.171,192.41.19.138,192.41.19.173,192.41.19.135,192.41.19.170,192.41.19.134,192.41.19.172,192.41.19.136,192.41.19.139,::192.41.19.173,::192.41.19.138,::192.41.19.139,::192.41.19.134,::192.41.19.135,::192.41.19.136,::192.41.19.137,::192.41.19.171,::192.41.19.170,::192.41.19.172, pass:match_re, bare_ip, dynamic, big_co(not), literal_mismatch, valid_hostname, rdns_match(org_dom), forward_dns, host_mismatch
Nov 24 07:08:40 mx3 haraka[24923]: [INFO] [E623781C-31A5-4F30-BF3F-1EE3DC01DCD5] [core]  hook=helo plugin=dnswl function=check_dnswl params=smtp-timely-01.communitect.com retval=OK msg=""
Nov 24 07:08:41 mx3 haraka[24923]: [CRIT] [-] [core] Error: ipaddr: the address has neither IPv6 nor IPv4 format
Nov 24 07:08:41 mx3 haraka[24923]: [CRIT] [-] [core]     at Object.ipaddr.parse (/usr/local/share/.config/yarn/global/node_modules/ipaddr.js/lib/ipaddr.js:632:13)
Nov 24 07:08:41 mx3 haraka[24923]: [CRIT] [-] [core]     at Object.exports.ipv6_bogus (/usr/local/share/.config/yarn/global/node_modules/haraka-net-utils/index.js:347:26)
Nov 24 07:08:41 mx3 haraka[24923]: [CRIT] [-] [core]     at /usr/local/share/.config/yarn/global/node_modules/Haraka/plugins/mail_from.is_resolvable.js:131:39
Nov 24 07:08:41 mx3 haraka[24923]: [CRIT] [-] [core]     at /usr/local/share/.config/yarn/global/node_modules/haraka-net-utils/index.js:328:7
Nov 24 07:08:41 mx3 haraka[24923]: [CRIT] [-] [core]     at /usr/local/share/.config/yarn/global/node_modules/async/dist/async.js:3888:9
Nov 24 07:08:41 mx3 haraka[24923]: [CRIT] [-] [core]     at /usr/local/share/.config/yarn/global/node_modules/async/dist/async.js:473:16
Nov 24 07:08:41 mx3 haraka[24923]: [CRIT] [-] [core]     at iteratorCallback (/usr/local/share/.config/yarn/global/node_modules/async/dist/async.js:1064:13)
Nov 24 07:08:41 mx3 haraka[24923]: [CRIT] [-] [core]     at /usr/local/share/.config/yarn/global/node_modules/async/dist/async.js:969:16
Nov 24 07:08:41 mx3 haraka[24923]: [CRIT] [-] [core]     at /usr/local/share/.config/yarn/global/node_modules/async/dist/async.js:3885:13
Nov 24 07:08:41 mx3 haraka[24923]: [CRIT] [-] [core]     at QueryReqWrap.callback (/usr/local/share/.config/yarn/global/node_modules/haraka-net-utils/index.js:320:11)
Nov 24 07:08:41 mx3 haraka[24923]: [NOTICE] [-] [core] Shutting down

Closing comment (2020-12-16T19:01:23Z): duplicate of #2763 , already fixed in newer Haraka versions (which depend on newer haraka-net-utils)