Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Haraka fails to read docs/Plugins.md after installation on 3.0.4 #3394

Open
tyranron opened this issue Aug 26, 2024 · 3 comments
Open

Haraka fails to read docs/Plugins.md after installation on 3.0.4 #3394

tyranron opened this issue Aug 26, 2024 · 3 comments

Comments

@tyranron
Copy link
Contributor

Describe the bug

npm install -g Haraka@3.0.4
haraka -i /etc/haraka/

haraka -o -c /etc/haraka

Expected behavior

Something like:

loaded TLD files:
  1=1448
  2=8320
  3=3571
loaded 9672 Public Suffixes
loglevel: INFO
log format: DEFAULT

Hook: connect ------------------------------------------------------------------
Plugin                              Method                              Prio T/O
--------------------------------------------------------------------------------
dnsbl                               connect_first                          0  30

Hook: helo ---------------------------------------------------------------------
Plugin                              Method                              Prio T/O
--------------------------------------------------------------------------------
helo.checks                         proto_mismatch_smtp                    0  30
helo.checks                         init                                   0  30
helo.checks                         match_re                               0  30
helo.checks                         bare_ip                                0  30
helo.checks                         dynamic                                0  30
helo.checks                         big_company                            0  30
helo.checks                         valid_hostname                         0  30
helo.checks                         rdns_match                             0  30
helo.checks                         forward_dns                            0  30
helo.checks                         host_mismatch                          0  30
helo.checks                         emit_log                               0  30
helo.checks                         literal_mismatch                       0  30

Hook: ehlo ---------------------------------------------------------------------
Plugin                              Method                              Prio T/O
--------------------------------------------------------------------------------
helo.checks                         proto_mismatch_esmtp                   0  30
helo.checks                         init                                   0  30
helo.checks                         match_re                               0  30
helo.checks                         bare_ip                                0  30
helo.checks                         dynamic                                0  30
helo.checks                         big_company                            0  30
helo.checks                         valid_hostname                         0  30
helo.checks                         rdns_match                             0  30
helo.checks                         forward_dns                            0  30
helo.checks                         host_mismatch                          0  30
helo.checks                         emit_log                               0  30
helo.checks                         literal_mismatch                       0  30

Hook: mail ---------------------------------------------------------------------
Plugin                              Method                              Prio T/O
--------------------------------------------------------------------------------
mail_from.is_resolvable             hook_mail                              0  30
rcpt_to.in_host_list                hook_mail                              0  30

Hook: rcpt ---------------------------------------------------------------------
Plugin                              Method                              Prio T/O
--------------------------------------------------------------------------------
rcpt_to.in_host_list                hook_rcpt                              0  30

Hook: data_post ----------------------------------------------------------------
Plugin                              Method                              Prio T/O
--------------------------------------------------------------------------------
headers                             duplicate_singular                     0  30
headers                             missing_required                       0  30
headers                             invalid_return_path                    0  30
headers                             invalid_date                           0  30
headers                             user_agent                             0  30
headers                             direct_to_mx                           0  30
headers                             from_match                             0  30
headers                             delivered_to                           0  30
headers                             mailing_list                           0  30
headers                             from_phish                             0  30

Hook: queue --------------------------------------------------------------------
Plugin                              Method                              Prio T/O
--------------------------------------------------------------------------------
queue/smtp_forward                  queue_forward                          0  30

Hook: get_mx -------------------------------------------------------------------
Plugin                              Method                              Prio T/O
--------------------------------------------------------------------------------
queue/smtp_forward                  get_mx                                 0  30

Observed behavior

loaded TLD files:
  1=1448
  2=8320
  3=3571
loaded 9672 Public Suffixes
loglevel: INFO
log format: DEFAULT

node:fs:561
  return binding.open(
                 ^

Error: ENOENT: no such file or directory, open 'docs/Plugins.md'
    at Object.openSync (node:fs:561:18)
    at Object.readFileSync (node:fs:445:35)
    at getHooks (/usr/local/lib/node_modules/Haraka/bin/haraka:231:8)
    at Object.<anonymous> (/usr/local/lib/node_modules/Haraka/bin/haraka:371:24)
    at Module._compile (node:internal/modules/cjs/loader:1546:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1691:10)
    at Module.load (node:internal/modules/cjs/loader:1317:32)
    at Module._load (node:internal/modules/cjs/loader:1127:12)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:217:24) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: 'docs/Plugins.md'
}

Node.js v22.7.0

Additional context

3.0.3 works OK.

@s-aga-r
Copy link

s-aga-r commented Sep 3, 2024

There are additional issues as well. For instance, in the hook_delivered params, the host is mistakenly set as the IP address. Additionally, the mailauth plugin's SPF check consistently fails.

@brutus
Copy link

brutus commented Sep 4, 2024

Same here. If I manually copy docs/Plugin.md to the current working directory it no longer bails that way.

But fails like this:

loaded TLD files:
  1=1448
  2=8320
  3=3571
loaded 9672 Public Suffixes
loglevel: INFO
log format: DEFAULT

/opt/haraka/lib/node_modules/Haraka/bin/haraka:371
    for (const hook of getHooks()) {
                       ^

TypeError: getHooks is not a function or its return value is not iterable
    at Object.<anonymous> (/opt/haraka/lib/node_modules/Haraka/bin/haraka:371:24)
    at Module._compile (node:internal/modules/cjs/loader:1364:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
    at Module.load (node:internal/modules/cjs/loader:1203:32)
    at Module._load (node:internal/modules/cjs/loader:1019:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:128:12)
    at node:internal/main/run_main_module:28:49

I guess b/c the getHooks function is missing an return?

@lnedry
Copy link
Contributor

lnedry commented Sep 19, 2024

Plugins.md needs to be installed in the docs folder, e.g. /etc/haraka/docs/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants