public inbox for pmg-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: pmg-devel@lists.proxmox.com
Subject: [pmg-devel] [PATCH spamassassin 1/2] kam-rules: ship full ruleset not only KAM.cf
Date: Fri, 24 Mar 2023 13:46:53 +0100	[thread overview]
Message-ID: <20230324124655.39567-2-s.ivanov@proxmox.com> (raw)
In-Reply-To: <20230324124655.39567-1-s.ivanov@proxmox.com>

The KAM ruleset consists of more files than just KAM.cf - and with the
enabling of the HashBL module in SA 4.0.0 the KAM.cf depends on
settings in other files from the ruleset. This leads to warnings when
starting pmg-smtp-filter on a freshly installed system (more exactly
on a system where pmg-daily did not already download the complete KAM
ruleset to /var/lib)

This patch follows the logic we use in pmg-daily and ships the
complete ruleset in /usr/share/spamassassin-extra

KAM.cf itself was also moved to the kam.sa-channels.mcgrail.org
subdirectory so that we can use the downloaded cf file to get the
correct includes

Given that the default installations from PMG 6.4 on download and use
the complete ruleset the potential for regression should be quite
small.

I shortly considered adding a symlink from KAM.cf pointing to
kam_sa-channels_mcgrail_com/KAM.cf so that users with unadapted
templates still load at least KAM.cf - but since SpamAssassin simply
ignores non-existing files, and most setups, which have modified
templates probably ran pmg-daily at some point resulting in the files
from /var/lib/spamassassin being preferred I left that out.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
 Makefile | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index 65474a1..a0f6bb9 100644
--- a/Makefile
+++ b/Makefile
@@ -26,7 +26,9 @@ DBG_DEB = proxmox-spamassassin-dbgsym_${DEB_VERSION_UPSTREAM_REVISION}_amd64.deb
 DEBS = ${DEB} ${DBG_DEB}
 DSC = proxmox-spamassassin_${DEB_VERSION_UPSTREAM_REVISION}.dsc
 
-EXTRA_RULES = KAM.cf
+KAM_CHANNEL_FILE = debian/tree/etc/mail/spamassassin/channel.d/KAM_channel.conf
+KAM_KEYID = $(shell awk -F '=' '/^KEYID/ { print $$2 }' ${KAM_CHANNEL_FILE})
+
 
 SA_UPDATE_GPG_DIR = .sa-update-gpghome
 
@@ -53,12 +55,12 @@ ${NPKGNAME}.orig.tar.gz: upstream/
 	cp -a upstream ${NPKGNAME}
 	tar -czf $@ ${NPKGNAME}
 
-${NPKGNAME}: sa-updates ${EXTRA_RULES} ${NPKGNAME}.orig.tar.gz
+${NPKGNAME}: sa-updates kam-updates ${NPKGNAME}.orig.tar.gz
 	cp -a debian $@
 	mkdir -p $@/debian/tree/usr/share/spamassassin
 	rsync -av sa-updates/ $@/debian/tree/usr/share/spamassassin
 	mkdir -p $@/debian/tree/usr/share/spamassassin-extra
-	cp -a ${EXTRA_RULES} $@/debian/tree/usr/share/spamassassin-extra
+	rsync -av kam-updates/ $@/debian/tree/usr/share/spamassassin-extra
 
 ${OPKGNAME}.tar.gz:
 	rm -f $@*
@@ -67,15 +69,12 @@ ${OPKGNAME}.tar.gz:
 	mv $@.asc.tmp $@.asc
 	gpgv --keyring ./sa-releasekey.gpg $@.asc $@
 
-KAM.cf:
-	wget https://www.pccc.com/downloads/SpamAssassin/contrib/KAM.cf -O $@.tmp
-	mv KAM.cf.tmp $@
-
 ${SA_UPDATE_GPG_DIR}/.prepared: ${OPKGNAME}.tar.gz
 	rm -rf ${SA_UPDATE_GPG_DIR}
 	mkdir --mode=0700 -p ${SA_UPDATE_GPG_DIR}
 	tar --strip-components 2 -xzf ${OPKGNAME}.tar.gz ${OPKGNAME}/rules/sa-update-pubkey.txt
 	sa-update --gpghomedir ${SA_UPDATE_GPG_DIR} --import sa-update-pubkey.txt
+	sa-update --gpghomedir ${SA_UPDATE_GPG_DIR} --import ${KAM_CHANNEL_FILE}
 	rm sa-update-pubkey.txt
 	touch $@
 
@@ -85,13 +84,20 @@ update-sa: ${SA_UPDATE_GPG_DIR}/.prepared
 	sa-update --gpghomedir ${SA_UPDATE_GPG_DIR} --updatedir updates.tmp --channel updates.spamassassin.org
 	rsync -av --delete --exclude=local.cf --exclude=regression_tests.cf --exclude=*.txt  --exclude=MIRRORED.BY updates.tmp/updates_spamassassin_org/ sa-updates
 
+.PHONY: update-kam
+update-kam: ${SA_UPDATE_GPG_DIR}/.prepared
+	rm -rf kam-updates.tmp
+	sa-update --gpghomedir ${SA_UPDATE_GPG_DIR} --gpgkey ${KAM_KEYID} --updatedir kam-updates.tmp --channel kam.sa-channels.mcgrail.com
+	rm -rf kam-updates.tmp/kam_sa-channels_mcgrail_com/MIRRORED.BY
+	mv kam-updates.tmp kam-updates
+
 .PHONY: upload
 upload: ${DEBS}
 	tar cf - ${DEBS} | ssh -X repoman@repo.proxmox.com -- upload --product pmg --dist bullseye
 
 .PHONY: clean distclean
 clean:
-	rm -rf *~ debian/*~ *.deb proxmox-spamassassin_* updates.tmp ${SA_UPDATE_GPG_DIR} ${OPKGNAME}.tar.gz.*
+	rm -rf *~ debian/*~ *.deb proxmox-spamassassin_* updates.tmp kam-updates.tmp ${SA_UPDATE_GPG_DIR} ${OPKGNAME}.tar.gz.*
 
 distclean: clean
 	rm -rf  ${OPKGNAME}.*
-- 
2.30.2





  reply	other threads:[~2023-03-24 12:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-24 12:46 [pmg-devel] [PATCH spamassassin/pmg-api ] ship complete KAM ruleset Stoiko Ivanov
2023-03-24 12:46 ` Stoiko Ivanov [this message]
2023-03-24 12:46 ` [pmg-devel] [PATCH spamassassin 2/2] buildsys: update outdated docs on updating rulesets Stoiko Ivanov
2023-03-24 12:46 ` [pmg-devel] [PATCH pmg-api 1/1] templates: adapt to new path for KAM rules in proxmox-spamassassin Stoiko Ivanov
2023-03-26 16:11 ` [pmg-devel] applied-series: [PATCH spamassassin/pmg-api ] ship complete KAM ruleset Thomas Lamprecht
2023-03-27  8:43   ` Stoiko Ivanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230324124655.39567-2-s.ivanov@proxmox.com \
    --to=s.ivanov@proxmox.com \
    --cc=pmg-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal