Bug 273787 - mail/postsrsd: 2.0.8 fails to start
Summary: mail/postsrsd: 2.0.8 fails to start
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Robert Clausecker
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-09-14 15:25 UTC by Javier Sturman
Modified: 2023-09-23 16:26 UTC (History)
3 users (show)

See Also:
lwhsu: maintainer-feedback? (ports)


Attachments
postsrsd missing files and variables (1.47 KB, patch)
2023-09-19 10:25 UTC, Krzysztof
ports: maintainer-approval+
Details | Diff
poudriere testport log (33.68 KB, text/plain)
2023-09-19 10:25 UTC, Krzysztof
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Javier Sturman 2023-09-14 15:25:34 UTC
After upgrading to 2.0.8 via pkg upgrade I did all the necesary changes to integrate version 2.x with postfix.

changed:
sender_canonical_maps -> socketmap:unix:srs:forward
and
recipient_canonical_maps -> socketmap:unix:srs:reverse

and copied the default confing file from /usr/local/share/doc/postsrsd to /usr/local/etc/


When I try to start the service I get:

eval: cannot create : No such file or directory
postsrsd: WARNING: failed precmd routine for postsrsd


To keep my mail server running I had to downgrade to 1.10 and revert main.cf changes.
Comment 1 Krzysztof 2023-09-15 07:14:14 UTC
I've checked rc.d/postsrsd script. I remove (by mistake):
: ${postsrsd_secret="/usr/local/etc/postsrsd.secret"}

(I've checked it by executing as root:
sh -x /usr/local/etc/rc.d/postsrsd onestart
)

So you have to define in /etc/rc.conf variable:
postsrsd_secret="/usr/local/etc/postsrsd.secret"

(or another file - as you have configured now)

Yes, I will make simple patch to modify rc script.

Greetings,
Comment 2 Krzysztof 2023-09-19 10:25:06 UTC
Created attachment 245015 [details]
postsrsd missing files and variables

I've made a patch which restores needed startup variable postsrsd_secret. Also this patch "installs" postsrsd.conf.sample (as I was asked).

I've tested this patch with poudriere, so logfile is alsa attached
Comment 3 Krzysztof 2023-09-19 10:25:31 UTC
Created attachment 245016 [details]
poudriere testport log

poudriere testport log
Comment 4 Robert Clausecker freebsd_committer freebsd_triage 2023-09-19 17:10:11 UTC
Will commit with slight changes:

 - INSTALL_DATA instead of CP to install files
 - PORTVERSION -> DISTVERSION

No MFH as 2023Q3 is still on 1.10.
Comment 5 Krzysztof 2023-09-20 08:42:35 UTC
(In reply to Robert Clausecker from comment #4)

Thank you for your notes. Do I have to make a new patch?
Comment 6 Krzysztof 2023-09-20 08:45:42 UTC
(In reply to Krzysztof from comment #5)
OK, it was stupid question :-))) I did not read carefully.
Comment 7 commit-hook freebsd_committer freebsd_triage 2023-09-22 05:09:14 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=3e774cb07c9bb3a4fc28ad8d69c009c123fe3714

commit 3e774cb07c9bb3a4fc28ad8d69c009c123fe3714
Author:     Krzysztof <ports@bsdserwis.com>
AuthorDate: 2023-09-19 17:08:25 +0000
Commit:     Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2023-09-22 04:54:46 +0000

    mail/postsrsd: add missing files and variables

    This fixes an issue where postsrsd would fail to start.

    Reported by:    Javier Sturman <sturmanj@gmail.com>
    PR:             273787

 mail/postsrsd/Makefile          | 7 ++++++-
 mail/postsrsd/files/postsrsd.in | 2 ++
 2 files changed, 8 insertions(+), 1 deletion(-)
Comment 8 Robert Clausecker freebsd_committer freebsd_triage 2023-09-22 05:13:56 UTC
Thank you for your contribution.
Comment 9 Javier Sturman 2023-09-22 19:07:17 UTC
I tried using the latest package from today -2023-09-22- 2.0.8,1 and now I'm getting this error:

[j@myvps:/var/spool/postfix $]> sudo service postsrsd startStarting postsrsd.
postsrsd: error: cannot drop privileges: failed to chdir to chroot: No such file or directory
/usr/local/etc/rc.d/postsrsd: WARNING: failed to start postsrsd

At first I thought it was an error with the directory I created for the socketmap in /var/spool/postfix/srs manually while testing the original report so I deleted it and forced a pkg install -f postsrd the directory was created with the desired permissions:

srw-rw-rw-   1 root     wheel       0 Sep 22 15:58 srs
Comment 11 Krzysztof 2023-09-23 05:37:52 UTC
(In reply to Javier Sturman from comment #10)

Did you run:
sudo sh -x /usr/local/etc/rc.d/postsrsd onestart

It will show full debug and which directory is missing. Maybe it is not problem of startup script but configuration?
Comment 12 Krzysztof 2023-09-23 05:54:01 UTC
(In reply to Krzysztof from comment #11)
So I found. Problem is with default configuration settings:
# Execute PostSRSd in chroot jail
# PostSRSd will jail itself in the given directory, which adds an additional
# layer of protection against the exploitation of security bugs in PostSRSd. To
# prevent PostSRSd from chrooting, set this to the empty string.
#
# Example:
#     chroot-dir = "/usr/local/var/lib/postsrsd"
#
chroot-dir = "/usr/local/var/lib/postsrsd"

I think it is default linux hierarchy :-)))

Please close this bug.
Comment 13 Javier Sturman 2023-09-23 11:49:24 UTC
So it’s a default configuration issue then ?