Koozali.org: home of the SME Server

Obsolete Releases => SME Server 9.x => Topic started by: SchulzStefan on February 16, 2017, 09:14:11 AM

Title: [SOLVED] Problem with spamassassin
Post by: SchulzStefan on February 16, 2017, 09:14:11 AM
Good day,

SME 9.1. up-to-date, box is running behind a proxy.

anacron shows:

/etc/cron.daily/sa_update:

error: unable to refresh mirrors file for channel updates.spamassassin.org, using old file
channel: could not find working mirror, channel failed

less /etc/cron.daily/sa_update shows:

#!/bin/bash
# Only restart spamd if sa-update returns 0, meaning it updated the rules
export HOME=/var/lib/spamassassin
cd $HOME
(/usr/bin/sa-update \
  --gpgkeyfile /etc/mail/spamassassin/gpgkeys \
  --channelfile /etc/mail/spamassassin/channels \
  && service spamassassin condrestart > /dev/null) 2>&1 \
  | tee -a /var/log/sa-update.log

A ping shows:

# ping updates.spamassassin.org
ping: bad address 'updates.spamassassin.org'
# ping sought.rules.yerp.org
ping: bad address 'sought.rules.yerp.org'

edit:

some more info:
#sa-update --checkonly -v
Update available for channel updates.spamassassin.org: 1781505 -> 1783068
Update was available, but not installed in checkonly mode
# sa-update -v
Update available for channel updates.spamassassin.org: 1781505 -> 1783068
http: (curl) GET http://spamassassin.apache.org/updates/MIRRORED.BY, FAILED, status: exit 22
error: unable to refresh mirrors file for channel updates.spamassassin.org, using old file
http: (curl) GET http://sa-update.secnap.net/1783068.tar.gz, FAILED, status: exit 22
http: (curl) GET http://www.sa-update.pccc.com/1783068.tar.gz, FAILED, status: exit 22
http: (curl) GET http://sa-update.dnswl.org/1783068.tar.gz, FAILED, status: exit 22
http: (curl) GET http://sa-update.space-pro.be/1783068.tar.gz, FAILED, status: exit 22
channel: could not find working mirror, channel failed
Update failed, exiting with code 4

Anybody else with this problem/behaviour?

Thank's for any answer in advance.
stefan
Title: Re: Problem with spamassassin
Post by: SchulzStefan on February 16, 2017, 10:24:20 AM
From https://wiki.apache.org/spamassassin/RuleUpdates

Quote
What if I need update requests to go through a proxy server?

sa-update uses the LWP::UserAgent module, which allows certain environment variables to be set so that requests use defined proxy servers. The main one of interest is "http_proxy", which should be set to an URL defining the proxy. ie: export http_proxy='http://proxy.example.com:8080/'

Where/how could this be done in the smeserver?
Title: Re: [SOLVED] Problem with spamassassin
Post by: SchulzStefan on February 16, 2017, 11:21:35 AM
I'm sorry  - I could have checked this earlier:

https://wiki.contribs.org/SME_Server:Documentation:FAQ:Section01#Upstream_proxy_server_configuration

Working now. I'm going to template this for future updates...

stefan
Title: Re: [SOLVED] Problem with spamassassin
Post by: janet on February 16, 2017, 08:03:29 PM
SchulzStefan

Quote
I'm going to template this for future updates...

What do you mean, it is already a db command, so no additional templating needed for that to be made to work.
Title: Re: [SOLVED] Problem with spamassassin
Post by: SchulzStefan on February 17, 2017, 08:51:22 AM
janet

like this:

i#!/bin/bash
# Only restart spamd if sa-update returns 0, meaning it updated the rules
export http_proxy='http://myproxyhostIP:3128'
export HOME=/var/lib/spamassassin
cd $HOME
(/usr/bin/sa-update \
  --gpgkeyfile /etc/mail/spamassassin/gpgkeys \
  --channelfile /etc/mail/spamassassin/channels \
  && service spamassassin condrestart > /dev/null) 2>&1 \
  | tee -a /var/log/sa-update.log

in custom-templates...

Anything wrong with that?