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
rmilter: Fix a couple of bugs #21866
Conversation
LGTM! |
When multiple sockets are specified systemd socket activation will pass them as file descriptors from fd:3 upwards (fd:3, fd:4, ..., fd:n) |
Then that also causes a problem since |
If it only support one socket address at the time, the options should not allow to specify multiple. Picking the last socket does not make sense to me. |
actually socket activation needs only because libmilter can't setup proper permissions on unix socket, but systemd can. |
rmilter unable to listen more than one socket/port, due libmilter desing flaw |
socket activation is also useful to prevent race conditions between connecting smtp daemons and rmilter on startup, because systemd create listening sockets before any service is started. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 on the changes, but this will break current setups using unix sockets and socketActivation
disabled. The sockets will have 777 permissions.
Could you please add one or two sentences to the release notes for 17.03? Thanks!
@fpletz It why I implement socket activation in module (and also why upstream author add it), libmilter unable to set proper permissions on socket (as well, as listen to more than one socket) |
@avnik If rmilter can't listen on more than one socket the Nix module shouldn't allow someone to configure more than one socket. |
On Sat, Jan 21, 2017 at 01:26:31PM -0800, Peter J. Jones wrote:
@avnik If rmilter can't listen on more than one socket the Nix module shouldn't allow someone to configure more than one socket.
Correct.
Will try to improve it from my side (unless you want to do it as part of
this PR)
|
@avnik If you have time please go ahead and work on it. I've got a lot on my plate right now so this is going to have to sit on the back burner for now. |
7fd9728
to
4ac0aee
Compare
@fpletz thank you. Your changes looks good. |
|
||
rmilterConf = '' | ||
pidfile = /run/rmilter/rmilter.pid; | ||
bind_socket = ${if cfg.socketActivation then "fd:3" else last inetSockets}; | ||
bind_socket = ${if cfg.socketActivation then "fd:3" else rspamdSocket}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't rspamdSocket
be rmilterSocket
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, right! I've actually never tested this with a rspamd postfix but will before merging of course. Thanks for reading my changes carefully! 👍
I added one comment, and I also think the description for the |
* The module uses `stringSplit` but it should be `splitString` * `rmilter` doesn't actually support binding to multiple sockets. Therefore, bind to the last one specified if `socketActivation` is `false`. I also believe there is a bug in this module related to systemd `ListenStream`. If `socketActivation` is true, Postfix gets connection timeouts trying to connect to one of the `ListenStream` inet addresses. I don't know enough about `ListenStream` passing connections on to `fd:3` to understand what's going on. These changes are in production (with `socketActivation = false`) via NixOps.
Rebased, fixed the issues @pjones mentioned and also tightened the permissions so only users in the rmilter or rspamd groups can access the unix sockets. |
milter_protocol = 6 | ||
milter_mail_macros = i {mail_addr} {client_addr} {client_name} {auth_authen} | ||
# skip mail without checks if milter will die | ||
milter_default_action = accept |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more thing: I removed milter_default_action
here because it would get appended last in my main.cf
so I couldn't overwrite it anymore. This should be set in services.postfix.extraConfig
manually if required IMHO. The postfix default is tempfail
which should be fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For what it's worth, I don't use this feature of the package. I add the milter stuff to postfix by hand because my needs are a bit different.
Motivation for this change
The module uses
stringSplit
but it should besplitString
rmilter
doesn't actually support binding to multiple sockets.Therefore, bind to the last one specified if
socketActivation
isfalse
.I also believe there is a bug in this module related to systemd
ListenStream
. IfsocketActivation
is true, Postfix getsconnection timeouts trying to connect to one of the
ListenStream
inet addresses. I don't know enough about
ListenStream
passingconnections on to
fd:3
to understand what's going on.These changes are in production (with
socketActivation = false
) via NixOps.Things done
(nix.useSandbox on NixOS,
or option
build-use-sandbox
innix.conf
on non-NixOS)
nix-shell -p nox --run "nox-review wip"
./result/bin/
)