Package Details: postsrsd 1.11-1

Git Clone URL: https://aur.archlinux.org/postsrsd.git (read-only, click to copy)
Package Base: postsrsd
Description: Provides the Sender Rewriting Scheme (SRS) via TCP-based lookup tables for Postfix
Upstream URL: https://github.com/roehling/postsrsd
Licenses: GPL2
Submitter: fordprefect
Maintainer: fordprefect
Last Packager: fordprefect
Votes: 2
Popularity: 0.000000
First Submitted: 2016-03-30 16:15
Last Updated: 2021-10-15 10:15

Latest Comments

1 2 3 Next › Last »

fordprefect commented on 2021-10-15 10:16

Thanks, fixed that. That issue obviously does not come up upon testing on a system with previously installed deamon…

Asuranceturix commented on 2021-10-12 11:48

No problem, glad I could help. However, mind that the current version now does not autogenerate /etc/postsrsd/postsrsd.secret; you might want to put that bit back into the postsrsd.install, or tmpfiles won't have a file to set permissions to. :)

fordprefect commented on 2021-10-12 09:12

Thanks, Asuranceturix, for the hints on the fixes for the package. Sorry for the partial fix earlier, ignorance on my side, should not happen again.

Asuranceturix commented on 2021-10-08 15:31

As Jonhoo commented a while ago, the sysusers.d config file fails to give the new user the mail group; apparently the syntax to specify group names instead of group IDs should be, in this case, -:mail. At any rate, the install script tries to change the ownership of the config file before the user is created:

:: Processing package changes...
(1/1) installing postsrsd                                                                                                                      [########################################################################################] 100%
chown: invalid user: ‘postsrsd:root’
chown: invalid user: ‘postsrsd:root’
Don’t forget to set your domainname in /etc/postsrsd/postsrsd.conf
:: Running post-transaction hooks...
(1/3) Creating system user accounts...
Failed to parse UID: ‘mail’: Invalid argument
(2/3) Reloading system manager configuration...
(3/3) Arming ConditionNeedsUpdate...

Fortunately, systemd-tmpfiles can be used to adjust ownership and permissions after the user has been created. I don't know whether the config directory really needs to be owned by postsrsd, but I think this achieves the same intent of the current package:

diff --git a/PKGBUILD b/PKGBUILD
index 976bbe3..6e4cb8f 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -16,9 +16,11 @@ url="https://github.com/roehling/postsrsd"
 install=postsrsd.install
 license=(GPL2)
 source=("${pkgname}-${pkgver}.tar.gz::https://github.com/roehling/postsrsd/archive/${pkgver}.tar.gz"
-        "postsrsd.conf")
+        "sysusers.d-postsrsd.conf"
+        "tmpfiles.d-postsrsd.conf")
 md5sums=('5585ff7685ad5f0331ac6dde6304ca4b'
-         'dd002a74bd323a7ea315da4ef2df79dc')
+         'cee1be46359eb9b6a44d1fac3cbc718b'
+         '8fd5e7ac5bb0aab0c3fae995d21c8a10')


 check() {
   cd "$srcdir/postsrsd-$pkgver/build"
@@ -38,7 +40,8 @@ package() {
   cd "$srcdir/postsrsd-$pkgver/build"
   make DESTDIR="$pkgdir/" install

-  install -Dm644 "$srcdir/postsrsd.conf" "$pkgdir/usr/lib/sysusers.d/postsrsd.conf"
+  install -Dm644 "$srcdir/sysusers.d-postsrsd.conf" "$pkgdir/usr/lib/sysusers.d/postsrsd.conf"
+  install -Dm644 "$srcdir/tmpfiles.d-postsrsd.conf" "$pkgdir/usr/lib/tmpfiles.d/postsrsd.conf"

   #rm -rf $pkgdir/usr/lib
   mv "$pkgdir/usr/sbin" "$pkgdir/usr/bin"
diff --git a/postsrsd.install b/postsrsd.install
index e185b08..d933733 100644
--- a/postsrsd.install
+++ b/postsrsd.install
@@ -1,9 +1,4 @@
 post_install() {
-  #useradd -r -g mail -d / postsrsd
-  chown -R postsrsd:root etc/postsrsd
-
   [ -e /etc/postsrsd/postsrsd.secret ] || dd if=/dev/urandom bs=18 count=1 status=none | base64 > /etc/postsrsd/postsrsd.secret
-  chown postsrsd:root /etc/postsrsd/postsrsd.secret
-  chmod 400 /etc/postsrsd/postsrsd.secret
   echo  "Don't forget to set your domainname in /etc/postsrsd/postsrsd.conf"
 }
diff --git a/postsrsd.conf b/sysusers.d-postsrsd.conf
similarity index 65%
rename from postsrsd.conf
rename to sysusers.d-postsrsd.conf
index b4692ff..3afeab2 100644
--- a/postsrsd.conf
+++ b/sysusers.d-postsrsd.conf
@@ -1,2 +1,2 @@
 # Type Name     ID             GECOS                 Home directory Shell
-u postsrsd  mail    "Postsrsd user" 
+u postsrsd  -:mail    "Postsrsd user" 
diff --git a/tmpfiles.d-postsrsd.conf b/tmpfiles.d-postsrsd.conf
new file mode 100644
index 0000000..5bd3830
--- /dev/null
+++ b/tmpfiles.d-postsrsd.conf
@@ -0,0 +1,3 @@
+#Type Path                                     Mode User Group Age         Argument
+Z /etc/postsrsd - postsrsd root - -
+z /etc/postsrsd/postsrsd.secret 0400 postsrsd root - -

fordprefect commented on 2021-03-21 20:01

ALERT: Another security fix in 1.11.

fordprefect commented on 2020-12-12 12:27

ALERT: Security fix in 1.10. Update strongly advised.

fordprefect commented on 2020-11-02 14:28

@Thaodan: Thanks for your suggestions. However, I prefer explanations over plain diff dumps. I see why we'd want to set systemd in the cmake flags, but why install an empty directory?

Thaodan commented on 2020-11-02 03:25

Needed to patch the pkgbuild by this to build in a clean-chroot: The indendation is not important but forcing the init systemd detection and the install.

diff --git a/PKGBUILD b/PKGBUILD
index 19c9507..eafd6af 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -37,7 +37,11 @@ build() {
   [[ -d build ]] && rm -rf build
   mkdir build
   cd build
-  cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DGENERATE_SRS_SECRET=OFF -DCONFIG_DIR=/etc/postsrsd
+  cmake .. -DCMAKE_INSTALL_PREFIX=/usr \
+        -DCMAKE_BUILD_TYPE=Release \
+        -DGENERATE_SRS_SECRET=OFF \
+        -DCONFIG_DIR=/etc/postsrs \
+        -DINIT_FLAVOR=systemd
   make all
 }

@@ -49,6 +53,7 @@ package() {

   #rm -rf $pkgdir/usr/lib
   mv "$pkgdir/usr/sbin" "$pkgdir/usr/bin"
+  install -m755 -d "$pkgdir/etc/postsrsd"
   sed -e 's/^\(RUN_AS=\)nobody/#\1postsrsd/;s/\(\/etc\/postsrsd\)\(\.secret\)/\1\/postsrsd\2/' \
       -e 's/^\(# is \).*$/\1localhost\.localdomain/'< postsrsd.default > "$pkgdir/etc/postsrsd/postsrsd"

Jonhoo commented on 2019-07-02 15:44

It looks like sysusers.d is broken again. I now get:

Jul 02 10:23:17 vm-mx systemd-sysusers[270]: Failed to parse UID: 'mail': Invalid argument

I think the issue is that you must give a numeric UID. You can't give the name of an existing user. It looks like - is the value to use for automatic assignment, which is probably what we want.

fordprefect commented on 2019-04-30 06:57

@Jonhoo: you are right, we need type u here. Thank you.