spamassasin: fix sa-update.sh and ensure service is started and enabled

This commit is contained in:
Victor LABORIE 2019-01-31 14:37:41 +01:00
parent c296dd94c2
commit c1d727bb5d
3 changed files with 13 additions and 4 deletions

View File

@ -15,6 +15,7 @@ The **patch** part changes incrementally at each release.
### Changed ### Changed
### Fixed ### Fixed
* spamassasin: fix sa-update.sh and ensure service is started and enabled
### Security ### Security

View File

@ -12,7 +12,7 @@ test -x /etc/init.d/spamassassin || exit 0
# of spamassassin --lint (which will typically get emailed to root) # of spamassassin --lint (which will typically get emailed to root)
# and abort. # and abort.
die_with_lint() { die_with_lint() {
su debian-spamd -c "spamassassin --lint -D 2>&1" su - debian-spamd -c "spamassassin --lint -D 2>&1"
exit 1 exit 1
} }
@ -20,7 +20,7 @@ do_compile() {
# Compile, if rules have previously been compiled, and it's possible # Compile, if rules have previously been compiled, and it's possible
if [ -x /usr/bin/re2c -a -x /usr/bin/sa-compile \ if [ -x /usr/bin/re2c -a -x /usr/bin/sa-compile \
-a -d /var/lib/spamassassin/compiled ]; then -a -d /var/lib/spamassassin/compiled ]; then
su debian-spamd -c "sa-compile --quiet" su - debian-spamd -c "sa-compile --quiet"
# Fixup perms -- group and other should be able to # Fixup perms -- group and other should be able to
# read and execute, but never write. Works around # read and execute, but never write. Works around
# sa-compile's failure to obey umask. # sa-compile's failure to obey umask.
@ -43,12 +43,12 @@ reload() {
# Update # Update
umask 022 umask 022
su debian-spamd -c "sa-update --gpghomedir /var/lib/spamassassin/sa-update-keys" su - debian-spamd -c "sa-update --gpghomedir /var/lib/spamassassin/sa-update-keys"
case $? in case $? in
0) 0)
# got updates! # got updates!
su debian-spamd -c "spamassassin --lint" || die_with_lint su - debian-spamd -c "spamassassin --lint" || die_with_lint
do_compile do_compile
reload reload
echo -e "Les règles SpamAsassin ont été mises à jour. Merci de reporter toute anomalie." | \ echo -e "Les règles SpamAsassin ont été mises à jour. Merci de reporter toute anomalie." | \

View File

@ -71,3 +71,11 @@
changed_when: false changed_when: false
tags: tags:
- spamassassin - spamassassin
- name: ensure SpamAssasin is started and enabled
systemd:
name: spamassassin
state: started
enabled: True
tags:
- spamassassin