1

I am following a guide from arstechnica to install an email server on my web server. I'm not using Ubuntu as stated in the tutorial but CentOS 6.

http://arstechnica.com/business/2014/03/taking-e-mail-back-part-3-fortifying-your-box-against-spammers/2/

Now I want to install and configure Spamassassin; I edited the file /etc/sysconfig/spamassassin such that the content is:

# Options to spamd
 SAHOME="/var/lib/spamassassin"
 SAGLOBALCFGPATH="/etc/mail/spamassassin"

 SPAMDOPTIONS="-d -x --max-children=5 --helper-home-dir=/var/lib/spamassassin -u spamd -g spamd --siteconfigpath=/etc/mail/spamassassin --socketpath /var/spool/postfix/spamassassin/spamd.sock --socketowner spamd --socketgroup spamd --socketmode 0660"

 # Change to one to enable spamd
 ENABLED=1

 # Pid file
 # Where should spamd write its PID to file? If you use the -u or
 # --username option above, this needs to be writable by that user.
 # Otherwise, the init script will not be able to shut spamd down.
 PIDFILE="/var/run/spamd.pid"

 # Cronjob
 # Set to anything but 0 to enable the cron job to automatically update
 # spamassassins rules on a nightly basis
 CRON=1

When restarting the Spamassassin via

service spamassassin restart 

I get the error messages

warn: server socket setup failed, retry 2: spamd: directory for /var/spool/postfix/spamassassin/spamd.sock does not exist, exiting

When I start the spamd process via

spamd -d -x --max-children=5 --helper-home-dir=var/lib/spamassassin -u spamd -g spamd --siteconfigpath=/etc/mail/spamassassin --socketpath /var/spool/postfix/spamassassin/spamd.sock --socketowner spamd --socketgroup spamd --socketmode 0660

there are no error messages and the spamd.sock file is created automatically.

Does anybody have an idea what might have gone wrong?

seyfe
  • 141
  • 1
  • 4
  • Can you correct the 5th line above in your config (the ** part) and try? `SPAMDOPTIONS="-d -x --max-children=5 --helper-home-dir=**/var/lib/spamassassin** -u spamd -g spamd --s ....` ( `/` is missing). – Diamond Nov 17 '15 at 23:48
  • Make sure you have also the directory available as mentioned in the docu and the right permission set. – Diamond Nov 17 '15 at 23:55
  • You're right, I forget a slash in front of the path, but unfortunately this does solve the problem! The folder `/var/lib/spamassassin` directory does exist and the permissions are `spamd spamd` – seyfe Nov 17 '15 at 23:56
  • It does or it doesn't? – Diamond Nov 17 '15 at 23:57
  • Sorry, it does not! ;) – seyfe Nov 17 '15 at 23:59
  • Can you try to configure `/etc/sysconfig/spamassassin` as exactily as it is in the docu and try? Use the variable name and notice no `=` sign: `OPTIONS="-x --max-children 5 --helper-home-dir ${SAHOME} -u spamd -g spamd --siteconfigpath ${SAGLOBALCFGPATH} --socketpath=/var/spool/postfix/spamassassin/spamd.sock --socketowner=spamd --socketgroup=spamd --socketmode=0660"` – Diamond Nov 18 '15 at 00:07
  • If I use `OPTIONS` instead of `SPAMDOPTIONS` no error message is returned, it says `[OK]`when restarting. However, there is no file at `/var/spool/postfix/spamassassin/spamd.sock`, so I guess spamd is started without passing the options. `SPAMDOPTIONS` was used in the default file after installation! (This might be different on different operating systems?!) – seyfe Nov 18 '15 at 00:20

1 Answers1

1

As you have mentioned yourself, you are using a documentation to install and configure Spamassassain on Centos, which is actually written for Ubuntu. This is not really wise. The configuration files often vary a lot between different OS's, and between different versions of the same OS (although they may serve the same purpose).

This is the case here too. The content of /etc/sysconfig/spamassassin in Centos seems quite different to that of Ubuntu. You can install it using yum and have a look at it.

I can only suggest that you follow the instructions which are written exclusively for OS CentOS and the version you are using. This way you will be avoiding many unwanted issues. Yet if you want to continue with the documentation for some reason, then pay special attention to the differences and try to customize it accordingly (i.e. avoid doing a copy-paste).

Here is link on How to install and integrate SpamAssassin with Postfix on a CentOS 6 VPS, you can have look at and compare/edit the necessary files.

Diamond
  • 8,791
  • 3
  • 22
  • 37
  • Thanks for your answer, I wanted to use the unix socket to avoid starting the SpamAssassin process each time for checking an email. However all the instructions I found for CentOS relay the messages through SpamAssassin. Do you happen to know any CentOS guide that covers that? The strange thing with my approach was that I used the original CentOS file and edited accordingly. Starting spamd with the options directly worked - doing this via SpamAssassin however didn't. – seyfe Nov 18 '15 at 19:07