diff -ruN netqmail-1.06-original/Makefile netqmail-1.06/Makefile --- netqmail-1.06-original/Makefile 2023-02-19 18:29:14.959842009 +0100 +++ netqmail-1.06/Makefile 2023-07-06 09:31:04.332197122 +0200 @@ -1,7 +1,6 @@ # Don't edit Makefile! Use conf-* for configuration. -VPOPMAIL_HOME=/home/vpopmail -VPOPMAIL_LIBS=`head -1 $(VPOPMAIL_HOME)/etc/lib_deps` `cat dns.lib` +VPOPMAIL_LIBS=`head -1 $(shell /bin/sh vpopmail-dir.sh)/etc/lib_deps` `cat dns.lib` SMTPD_CHKUSER_OBJ=chkuser.o dns.o @@ -127,8 +126,10 @@ &&./auto-uid auto_uidq `head -6 conf-users | tail -1` \ &&./auto-uid auto_uidr `head -7 conf-users | tail -1` \ &&./auto-uid auto_uids `head -8 conf-users | tail -1` \ + &&./auto-uid auto_uidv `head -9 conf-users | tail -1` \ &&./auto-gid auto_gidq `head -1 conf-groups` \ &&./auto-gid auto_gidn `head -2 conf-groups | tail -1` \ + &&./auto-gid auto_gidv `head -3 conf-groups | tail -1` \ ) > auto_uids.c.tmp && mv auto_uids.c.tmp auto_uids.c auto_uids.o: \ diff -ruN netqmail-1.06-original/Makefile-cert.mk netqmail-1.06/Makefile-cert.mk --- netqmail-1.06-original/Makefile-cert.mk 2023-07-06 12:16:34.038138177 +0200 +++ netqmail-1.06/Makefile-cert.mk 2022-09-28 17:16:57.484045719 +0200 @@ -9,13 +9,13 @@ PATH=$$PATH:/usr/local/ssl/bin \ openssl req -new -newkey rsa:4096 -x509 -nodes -days 366 -out $@ -keyout $@ chmod 640 $@ - chown `head -2 conf-users | tail -1`:`head -1 conf-groups` $@ + chown `head -9 conf-users | tail -1`:`head -3 conf-groups | tail -1` $@ req.pem: PATH=$$PATH:/usr/local/ssl/bin openssl req \ -new -newkey rsa:4096 -nodes -out $@ -keyout QMAIL/control/servercert.pem chmod 640 QMAIL/control/servercert.pem - chown `head -2 conf-users | tail -1`:`head -1 conf-groups` QMAIL/control/servercert.pem + chown `head -9 conf-users | tail -1`:`head -3 conf-groups | tail -1` QMAIL/control/servercert.pem @echo @echo "Send req.pem to your CA to obtain signed_req.pem, and do:" @echo "cat signed_req.pem >> QMAIL/control/servercert.pem" diff -ruN netqmail-1.06-original/auto_uids.h netqmail-1.06/auto_uids.h --- netqmail-1.06-original/auto_uids.h 1998-06-15 12:53:16.000000000 +0200 +++ netqmail-1.06/auto_uids.h 2023-06-04 09:53:27.346658060 +0200 @@ -9,8 +9,10 @@ extern int auto_uidq; extern int auto_uidr; extern int auto_uids; +extern int auto_uidv; extern int auto_gidn; extern int auto_gidq; +extern int auto_gidv; #endif diff -ruN netqmail-1.06-original/conf-cc netqmail-1.06/conf-cc --- netqmail-1.06-original/conf-cc 2022-09-28 17:16:57.488045708 +0200 +++ netqmail-1.06/conf-cc 2023-06-16 19:48:46.352201636 +0200 @@ -1,3 +1,3 @@ -cc -O2 -g -DEXTERNAL_TODO -DTLS=20200107 -I/usr/local/ssl/include -I/home/vpopmail/include +cc -O2 -g -DEXTERNAL_TODO -DTLS=20200107 -I/usr/local/ssl/include -I`/bin/sh ./vpopmail-dir.sh`/include This will be used to compile .c files. diff -ruN netqmail-1.06-original/conf-groups netqmail-1.06/conf-groups --- netqmail-1.06-original/conf-groups 2023-07-06 11:57:18.753928550 +0200 +++ netqmail-1.06/conf-groups 2022-09-28 17:16:57.488045708 +0200 @@ -1,5 +1,6 @@ qmail nofiles +vchkpw These are the qmail groups. The second group should not have access to any files, but it must be usable for processes; this requirement diff -ruN netqmail-1.06-original/conf-users netqmail-1.06/conf-users --- netqmail-1.06-original/conf-users 2023-07-06 11:57:11.065941236 +0200 +++ netqmail-1.06/conf-users 2022-09-28 17:16:57.489045706 +0200 @@ -6,6 +6,7 @@ qmailq qmailr qmails +vpopmail The qmail system is heavily partitioned for security; it does almost nothing as root. diff -ruN netqmail-1.06-original/hier.c netqmail-1.06/hier.c --- netqmail-1.06-original/hier.c 2023-04-02 11:24:24.832148219 +0200 +++ netqmail-1.06/hier.c 2023-06-17 20:07:57.777402075 +0200 @@ -37,7 +37,7 @@ h(auto_qmail,auto_uido,auto_gidq,0755); d(auto_qmail,"control",auto_uido,auto_gidq,0755); - d(auto_qmail,"control/cache",89,89,0755); + d(auto_qmail,"control/cache",auto_uidv,auto_gidv,0755); d(auto_qmail,"users",auto_uido,auto_gidq,0755); d(auto_qmail,"bin",auto_uido,auto_gidq,0755); d(auto_qmail,"boot",auto_uido,auto_gidq,0755); diff -ruN netqmail-1.06-original/vpopmail-dir.sh netqmail-1.06/vpopmail-dir.sh --- netqmail-1.06-original/vpopmail-dir.sh 1970-01-01 01:00:00.000000000 +0100 +++ netqmail-1.06/vpopmail-dir.sh 2023-07-06 11:59:47.450686404 +0200 @@ -0,0 +1,47 @@ +#!/bin/sh +# +# Returns the vpopmail installation dir +# Roberto Puzzanghera - https://notes.sagredo.eu + +# extract the vpopmail user from conf-users +VUSR=`head -9 conf-users | tail -1` + +# cut path +CUT="" +for f in /bin/cut /usr/bin/cut /sbin/cut /usr/sbin/cut /usr/local/bin/cut /usr/local/sbin/cut +do + if [ -x $f ]; then + CUT=$f + break + fi +done +if [ "$CUT" = "" ]; then + echo "/cut/binary/not/found" + exit 1 +fi + +# getent path +GETENT="" +for f in /usr/bin/getent /bin/getent /usr/sbin/getent /sbin/getent /usr/local/bin/getent /usr/local/sbin/getent +do + if [ -x $f ]; then + GETENT=$f + break + fi +done +if [ "$GETENT" = "" ]; then + echo "/getent/binary/not/found" + exit 1 +fi + +VPOPMAILDIR=$($GETENT passwd $VUSR | $CUT -d: -f6) +if [ "$VPOPMAILDIR" != "" ]; then + echo $VPOPMAILDIR +elif [ -d /home/vpopmail ]; then + echo "/home/vpopmail" +else + echo "/vpopmail/dir/not/found" + exit 1 +fi + +exit 0