Re: courier will be missing in the next stable version of Debian and Devuan

Alessandro Vesely <[email protected]> Mon, 23 Dec 2024 15:06:49 +0100
Newsgroups gmane.mail.imap.courier.general
Message-ID <[email protected]>
On Sat 21/Dec/2024 23:36:00 +0100 anfibiosdeasturias-2 wrote:
>>>>         unfortunately it will not be feasible to continue using courier as
>>>> mail on the servers working with Devuan.
>>>
>>> These kinds of things are always a question of supply/demand. If there's not
>>> enough Devuan user base to result in someone deciding to go ahead and put some
>>> elbow grease in this, then that's what it is.
>> 
>> I'm running Courier under Devuan and I feel perfectly well compiling from
>> sources.  I have a do-conf file for running configure with my custom options
>> and a postinst.sh which tweaks a few quirks, i.e. patch sendit.sh so as to sign
>> messages from webmail, set permissions of webmail, wrap sendmail to catch
>> local errors, strip debug info into separate files.
> 
> Many thanks to all the people who have taken the time to answer me.
> 
> Alessandro, if you feel comfortable doing so (no problem if you don't), I would appreciate it if you could document the process, share patches and/or extra files and whatever you think would help. I understand that you compile with the classic "configure & make & make install" and don't create deb packages, but it is interesting and helpful in any case. I prefer to continue trying to create deb packages without dependency on systemd (in the time I have spent so far using the debian folder included in the sources as a base I was not able to get rid of systemd with the changes I was making), but I don't rule out the classic "configure & make & make install" if that saves my mail servers (I like courier, I have spent time over the years understanding it and I want to avoid migrating to something else).


I don't do-conf is much useful/ portable.  Modify it as needed.  In particular, mind existing configs and queues.

DON'T COPY AND RUN AS IS!

The following code might just be useful to bring ideas about possible handling of Courier tarballs.


-----start do-conf-----
#!/bin/sh


# for shared libraries, recall /etc/ld.so.conf.d/courier.conf
# it currently has:
#
#     /usr/local/lib/courier-authlib
#     /usr/local/lib (for courier-unicode)

CC=gcc
export CC
if [ -z "$CFLAGS" ]; then
	CFLAGS="`getconf LFS_CFLAGS` -march=nocona -O2 -g"
fi
export CFLAGS
if [ -z "$LDFLAGS" ]; then
	LDFLAGS="`getconf LFS_LDFLAGS` -march=nocona -O2 -g"
fi
export LDFLAGS
CXXFLAGS="$CFLAGS -std=c++11 -g"
export CXXFLAGS

DIRECTORIES="
		--bindir=/usr/local/bin \
		--sbindir=/usr/local/sbin \
		--libexecdir=/usr/local/libexec \
		--sysconfdir=/etc/courier \
		--localstatedir=/var/courier \
		--mandir=/usr/man"
umask 22
if [ -f authdaemon.c ]; then
	echo 'configure auth package'
	./configure $DIRECTORIES \
		--with-mailuser=courier \
		--with-mailgroup=courier \
		--with-db=db \
		--enable-dependency-tracking

	echo "run ldconfig after install"
		
elif [ -f unicode.c ]; then
	echo 'configure unicode'

	./configure $DIRECTORIES

	echo "run ldconfig after install"

elif [ -d courier ]; then
	echo 'configure courier'

CFLAGS="$CFLAGS -g"

MAKEFLAGS="-j 4"; export MAKEFLAGS
  
  if [ "$1" = "" ]; then
  	MYLANGOPT=""
  else
  	# hmm... this is now tagged "reserved for future use."
  	MYLANGOPT="--with-defaultlang=$1"
  	echo "$MYLANGOPT is not supported anymore"
  	exit 0
  fi
  if [ -w / ]; then
  	echo "rerun as non-root"
  	exit 0
  fi
  umask 022

  ./configure $MYLANGOPT $DIRECTORIES\
		--with-gnutls \
		--with-notice=unicode \
		--disable-shared \
		--enable-imageurl=/images \
		--with-cachedir=/var/courier/webmail-logincache \
		--with-cacheowner=courier \
		--with-mailuser=courier \
		--with-mailgroup=courier \
		--with-paranoid-smtpext \
		--with-db=db \
		--with-ispell=/usr/bin/ispell \
		--enable-https \
		--enable-mimecharset=utf-8 \
		--disable-autorenamesent \
		--with-calendardir=/var/courier/pcp-calendar \
		--enable-hardtimeout=14400 \
		--enable-softtimeout=3600 \
		--enable-dependency-tracking

     # was --enable-mimecharset=iso-8859-1 until 7oct2017\

  echo "check how courier's sendmail is used"
  ls -lt /usr/lib/sendmail \
        /usr/sbin/sendmail \
        /usr/local/bin/sendmail* \
        /usr/share/quilt/compat/sendmail \
        /usr/bin/msmtp
  if [ -f /usr/local/bin/sendmail.courier ]; then
   cp /usr/local/bin/sendmail ../sendmail.wrapper
  fi
  printf '\n\nUpon installation, run sudo postinst.sh\n'
elif [ -f courier-analog.in ]; then
	echo 'configure log-analyzer'
	./configure $DIRECTORIES
else
	echo 'must cd into the relevant directory before issuing ../do-conf'
fi
-----end do-conf-----


Postinst also reflect my particular settings.


-----postinst.sh start-----
#! /bin/bash

chmod a+rx /usr/local/libexec/courier/webmail

patch -d /usr/lib/courier/share/sqwebmail <<'EOF'
--- sendit.sh
+++ sendit-postinst
@@ -23,4 +23,5 @@
  #
  # exec /usr/sbin/sendmail -oi -t -f "$1"
  
-exec /usr/local/bin/sendmail $DSN -f "$1"
+logger -p mail.info -t webmailsend "addr=<$1>,login=<$2>"
+/usr/local/bin/zdkimsign -t/var/tmp --db-filter --domain "$1"| /usr/local/bin/sendmail $DSN -f "$1"
EOF


mv /usr/local/bin/sendmail /usr/local/bin/sendmail.courier

cat << 'EOF' > /usr/local/bin/sendmail
#! /bin/sh
#
# sendmail wrapper (with log)

logger -t "sendmail" -p mail.info "local message: $*, started"
f=$(mktemp -p /tmp sendmail.XXXXXX)
cat > "$f"
/usr/local/bin/sendmail.courier "$@" <"$f"
code=$?
# 67 is for no recipient, discard it
if [ $code = "0" -o $code = "67" ]; then
	rm -f "$f"
else
	logger -t "sendmail" -p mail.err "local error: $code, file $f"
fi
exit $code
EOF

chmod u=rwx,go=rx /usr/local/bin/sendmail
echo "check how courier's sendmail is used"
ls -lt /usr/lib/sendmail \
        /usr/sbin/sendmail \
        /usr/local/bin/sendmail* \
        /usr/share/quilt/compat/sendmail \
        /usr/bin/msmtp

# strip debug info into separate files
for file in $(find /usr/local/libexec/courier -type f \! -name '*.debug') \
	/usr/lib/courier/share/sqwebmail/ldapsearch /usr/local/bin/preline \
	/usr/local/libexec/filters/perlfilter /usr/local/libexec/filters/dupfilter \
	/usr/local/libexec/filters/ratefilter /usr/local/libexec/filters/verifyfilter \
	/usr/local/bin/{cancelmsg,mailq,sendmail,testmxlookup,dotforward,couriermlm,webmlmd,courier-config,couriertls,maildrop,lockmail,reformail,reformime,mailbot,mimegpg,imapd,makemime,deliverquota,maildirmake,maildiracl,maildirkw} \
	/usr/local/sbin/{aliaslookup,courier,courierldapaliasd,couriertcpd,showconfig,showmodules} ; do
		grep -q debug_info $file && eu-strip $file -f $file.debug
done
-----postinst.sh end-----


Best
Ale
-- 







_______________________________________________
courier-users mailing list
[email protected]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users