albertito / chasquid

SMTP (email) server with a focus on simplicity, security, and ease of operation [mirror]

Home Page:https://blitiri.com.ar/p/chasquid/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hooks seem to be ignored

DiederikvandenB opened this issue · comments

Thanks for this cool piece of software!

I was trying to get the hooks working, but they seem to be ignored. My /etc/chasquid/hooks folder looks like this:

-rwxr-xr-x+ 1 chasquid chasquid  116 Feb  5 13:23 alias-exists*
-rwxr-xr-x+ 1 chasquid chasquid   92 Feb  5 13:12 alias-resolve*
-rwxr-xr-x+ 1 chasquid chasquid 2.2K Jan 19  2019 post-data*

alias-exists:

#!/bin/bash
set -e

logger "Called alias-exists"

exit 1

alias-resolve:

#!/bin/bash
set -e

logger "Called alias-resolve"

When I run chasquid-util aliases-resolve "some@email.dev" I expect the syslog to show my two log strings, but it doesn't. When I try to send an email to the server, nothing happens either. What am I missing here?

Thank you for reporting this!

There are two things going on:

  1. chasquid-util aliases-resolve ignores the hooks. This is at the very least a documentation bug that should be fixed.
    There should also be a convenient way of resolving via chasquid itself, as that can be useful to troubleshoot issues (like in this case), and currently there isn't any.
    I've filed #18 to track fixing this issue.

  2. The hooks not working when you send email. The most typical is permissions, but yours seem to be fine here.
    What do you see in the chasquid logs? What about the monitoring http server?
    There's a tracing endpoint for the hooks, you should be able to see the execution of them there.

If you navigate to the monitoring http server, then requests (short-lived), and then the [>= 0] on both Hook.Alias-Exists and Hook.Alias-Resolve, you should be able to see the execution attempts and detailed errors. What do they say?

The same information should appear in chasquid logs if you run it with -v=2.

I don't exactly understand what's going on right now. When I do apt-get install chasquid, my emails don't come through. When trying to debug the issue above, I forked the repo trying to fix it. With only this commit on top of master DiederikvandenB@88434d7, everything works like a charm.

Is the apt package up to date? Or it might be an environmental issue which was solved by building the package myself?

That is quite odd! What version of Debian are you using? What version of the apt package are you installing?

When you build chasquid yourself, are you installing it via cp chasquid /usr/bin/chasquid or something else?

If you prefer to look at this more interactively, feel free to jump on irc, #chasquid at freenode.net!

I’m deploying on an rpi4 (armv7). I’m on mobile now so I can’t tell you the version numbers.

I ran make all and then copied the bins to /usr/bin/ (not the local dir, as per the makefile) and then service chasquid start, borrowing the service from the apt installation.

I’ll report back later with the version numbers. And thanks for taking the time debugging this with me!

So the issue is that the most up to date version on APT for raspi is v.07-1:

$ apt info chasquid
Package: chasquid
Version: 0.07-1

I also ran apt-get update

Thanks for the update! I think that explains the problem:

chasquid 0.07 (which is included in the current Debian stable release) does not have the aliases hook feature. The feature was implemented in 1.1 (2019-10-26), specifically commit f399fe3.

So updating chasquid binaries to the latest version by hand, as you're doing, good way to get it while still taking advantage of the distribution integration.

FWIW, the upcoming Debian stable release will include chasquid 1.6.

So if I understand correctly what you mentioned above, the updated binaries fix this problem and things work fine?
Besides issue #18 (chasquid-util aliases-resolve does not take hooks into account) that is, which is tracked separately.

Awesome, good to know.

Yes, other than #18, everything is working as expected. Thanks for your help, and stay healthy!

FYI, #18 is finally fixed in the next branch :)