# Sendmail + Spam Assassin + Roundcube



## Lego (Sep 12, 2009)

Hello, So Im trying to install spam assassin and use it with sendmail and roundcube.  I've been using these too pages as walkthroughs http://www.hart.co.jp/spam/sa-clamav-e.html & http://networking.ringofsaturn.com/Unix/spamassassin.php and they both go about it a different way, one uses p5-Mail-SpamAssassin and after installing milter; the other uses spamass-milter Port.  Whats the difference?

Either way I've tried to install both ways and get this result:

```
===>   p5-Mail-SpamAssassin-3.2.5_4 depends on file: /usr/local/bin/perl5.8.9 - found
===>  Configuring for p5-Mail-SpamAssassin-3.2.5_4
NOTE: settings for "make test" are now controlled using "t/config.dist".
See that file if you wish to customise what tests are run, and how.

checking module dependencies and their versions...

***************************************************************************
ERROR: the required Digest::SHA1 module is not installed. at 
  lib/Mail/SpamAssassin/Util/DependencyInfo.pm line 294.


  The Digest::SHA1 module is used as a cryptographic hash for some
  tests and the Bayes subsystem.  It is also used by Razor2.


***************************************************************************
ERROR: the required HTML::Parser (version 3.43) module is not installed. at
   lib/Mail/SpamAssassin/Util/DependencyInfo.pm line 294.


  HTML is used for an ever-increasing amount of email so this dependency
  is unavoidable.  Run "perldoc -q html" for additional information.


***************************************************************************
ERROR: the required Net::DNS (version 0.34) module is not installed. at
   lib/Mail/SpamAssassin/Util/DependencyInfo.pm line 294.


  Used for all DNS-based tests (SBL, XBL, SpamCop, DSBL, etc.),
  perform MX checks, and is also used when manually reporting spam to
  SpamCop.

  You need to make sure the Net::DNS version is sufficiently up-to-date:

  - version 0.34 or higher on Unix systems
  - version 0.46 or higher on Windows systems


***************************************************************************
NOTE: the optional Mail::SPF module is not installed.

  Used to check DNS Sender Policy Framework (SPF) records to fight email
  address forgery and make it easier to identify spams.  (This is preferred
  over Mail::SPF::Query.)


***************************************************************************
NOTE: the optional Mail::SPF::Query module is not installed.

  Used to check DNS Sender Policy Framework (SPF) records to fight email
  address forgery and make it easier to identify spams.  (Mail::SPF is
  preferred instead of this module.)


***************************************************************************
NOTE: the optional IP::Country module is not installed.

  Used by the RelayCountry plugin (not enabled by default) to determine
  the domain country codes of each relay in the path of an email.


***************************************************************************
NOTE: the optional Razor2 (version 2.61) module is not installed.

  Used to check message signatures against Vipul's Razor collaborative
  filtering network. Razor has a large number of dependencies on CPAN
  modules. Feel free to skip installing it, if this makes you nervous;
  SpamAssassin will still work well without it.

  More info on installing and using Razor can be found
  at http://wiki.apache.org/spamassassin/InstallingRazor .


***************************************************************************
NOTE: the optional Net::Ident module is not installed.

  If you plan to use the --auth-ident option to spamd, you will need
  to install this module.


***************************************************************************
NOTE: the optional IO::Socket::INET6 module is not installed.

  This is required if the first nameserver listed in your IP
  configuration or /etc/resolv.conf file is available only via
  an IPv6 address.


***************************************************************************
NOTE: the optional IO::Socket::SSL module is not installed.

  If you wish to use SSL encryption to communicate between spamc and
  spamd (the --ssl option to spamd), you need to install this
  module. (You will need the OpenSSL libraries and use the
  ENABLE_SSL="yes" argument to Makefile.PL to build and run an SSL
  compatibile spamc.)


***************************************************************************
NOTE: the optional Compress::Zlib module is not installed.

  If you wish to use the optional zlib compression for communication
  between spamc and spamd (the -z option to spamc), you need to install
  this module.


***************************************************************************
NOTE: the optional Mail::DomainKeys module is not installed.

  If this module is installed, and you enable the DomainKeys plugin,
  SpamAssassin will perform Domain Key lookups when Domain Key
  information is present in the message headers.  (Note that new versions
  of Mail::DKIM render this module superfluous.)


***************************************************************************
NOTE: the optional Mail::DKIM module is not installed.

  If this module is installed, and you enable the DKIM plugin,
  SpamAssassin will perform DKIM lookups when a DKIM-Signature
  header is present in the message headers.  (New versions of this module
  support both Domain Keys and DKIM, rendering Mail::DomainKeys obsolete.)


***************************************************************************
NOTE: the optional DBI module is not installed.

  If you intend to use SpamAssassin with an SQL database backend for
  user configuration data, Bayes storage, or other storage, you will need
  to have these installed; both the basic DBI module and the driver for
  your database.


***************************************************************************
NOTE: the optional LWP::UserAgent module is not installed.

  The "sa-update" script requires this module to make HTTP requests.


***************************************************************************
NOTE: the optional HTTP::Date module is not installed.

  The "sa-update" script requires this module to make HTTP
  If-Modified-Since GET requests.


***************************************************************************
NOTE: the optional Archive::Tar (version 1.23) module is not installed.

  The "sa-update" script requires this module to access tar update
  archive files.


***************************************************************************
NOTE: the optional IO::Zlib (version 1.04) module is not installed.

  The "sa-update" script requires this module to access compressed
  update archive files.


***************************************************************************
NOTE: the optional Encode::Detect module is not installed.

  If you plan to use the normalize_charset config setting to detect
  charsets and convert them into Unicode, you will need to install
  this module.

REQUIRED module missing: Digest::SHA1
REQUIRED module missing: HTML::Parser
REQUIRED module missing: Net::DNS
optional module missing: Mail::SPF
optional module missing: Mail::SPF::Query
optional module missing: IP::Country
optional module missing: Razor2
optional module missing: Net::Ident
optional module missing: IO::Socket::INET6
optional module missing: IO::Socket::SSL
optional module missing: Compress::Zlib
optional module missing: Mail::DomainKeys
optional module missing: Mail::DKIM
optional module missing: DBI
optional module missing: LWP::UserAgent
optional module missing: HTTP::Date
optional module missing: Archive::Tar
optional module missing: IO::Zlib
optional module missing: Encode::Detect

warning: some functionality may not be available,
please read the above report before continuing!

*** Error code 1

Stop in /usr/ports/mail/p5-Mail-SpamAssassin.
*** Error code 1

Stop in /usr/ports/mail/p5-Mail-SpamAssassin.
```


----------



## Lego (Sep 12, 2009)

Forgot to add that Everything has been installed with the FreeBSD 7.1-Release CD version of the Port tree (as I've had problems after upgrading stuff).  I also tried spam assassin in this state, after they both failed the first time, i 'portsnap fetch update' and tried again, with the same results.


----------



## Lego (Sep 12, 2009)

Ok, I worked around that issue with 'pkg_add -r spam-milter'
which finished fine... did the same for CamAV... after adding what needed to be added to the blurr-ink.com.cf and running 'make' copying it to sendmail.cf and restarting sendmail Im getting this error:


```
blurr-ink# /etc/rc.d/sendmail stop
Stopping sendmail.
Stopping sendmail_clientmqueue.
blurr-ink# /etc/rc.d/sendmail onestart
Starting sendmail.
WARNING: Xspamassassin: local socket name /var/run/spamass-milter.sock missing
WARNING: Xclmilter: local socket name /var/run/clamav/clmilter.sock missing
blurr-ink#
```

how do I fix this?


```
blurr-ink# ps -axw | grep -e clam -e spam
  938  ??  Is     0:00.00 /usr/local/sbin/spamass-milter -f -p /var/run/spamass-milter.sock
 1004  ??  Is     0:00.94 /usr/local/bin/freshclam --daemon -p /var/run/clamav/freshclam.pid
```


----------



## DutchDaemon (Sep 12, 2009)

Aren't there separate start-up scripts for milters? I have start scripts for DKIM and Greylist milters in /usr/local/etc/rc.d, and they need to be activated in /etc/rc.conf as well.


----------



## Lego (Sep 12, 2009)

my rc.conf has the following added for those things


```
spamass_milter_enable="YES"
spamd_enable="YES"
clamav_clamd_enable="YES"
clamav_milter_enable="YES"
clamav_freshclam_enable="YES"
```

May mail is still functioning fine, but no sign of spamassin scanning test emails and such...


```
INPUT_MAIL_FILTER(`spamassassin',`S=local:/var/run/spamass-milter.sock, F=, T=C:15m;S:4m;R:4m;E:10m')dnl
INPUT_MAIL_FILTER(`clmilter', `S=local:/var/run/clamav/clmilter.sock, F=, T=S:4m;R:4m')dnl
define(`confINPUT_MAIL_FILTERS', `clmilter,spamassassin')dnl
FEATURE(dnsbl,`sbl-xbl.spamhaus.org')dnl
```

thats what was added to the blurr-ink.com.cf before remaking it


----------



## DutchDaemon (Sep 12, 2009)

So, are they running? They're the scripts that place the sockets. These should be owned by user mailnull, I believe.


----------



## Lego (Sep 12, 2009)

I've rebooted twice so im guess no..... because not all the things that person has listed are listed for me

```
blurr-ink# ps -axw | grep -e clam -e spam
  939  ??  Is     0:00.01 /usr/local/sbin/spamass-milter -f -p /var/run/spamass-milter.sock
 1002  ??  Is     0:00.00 /usr/local/sbin/clamd
 1007  ??  Is     0:00.00 /usr/local/bin/freshclam --daemon -p /var/run/clamav/freshclam.pid
```


----------



## Lego (Sep 12, 2009)

```
blurr-ink# /usr/local/etc/rc.d/sa-spamd start
Starting spamd.
eval: /usr/local/bin/spamd: not found
blurr-ink# ps -axw | grep -e clam -e spam
  939  ??  Is     0:00.03 /usr/local/sbin/spamass-milter -f -p /var/run/spamass-milter.sock
 1002  ??  Is     0:00.00 /usr/local/sbin/clamd
 1007  ??  Is     0:00.00 /usr/local/bin/freshclam --daemon -p /var/run/clamav/freshclam.pid
blurr-ink#
```


----------



## DutchDaemon (Sep 12, 2009)

Well, install mail/spamd, I guess.


----------



## Lego (Sep 13, 2009)

ok i did that with "pkg_add -r spamd", went fine; rebooted and still get this:

```
blurr-ink# ps -axw | grep -e clam -e spam
  943  ??  Is     0:00.00 /usr/local/sbin/spamass-milter -f -p /var/run/spamass-milter.sock
 1006  ??  Is     0:00.00 /usr/local/sbin/clamd
 1011  ??  Is     0:00.00 /usr/local/bin/freshclam --daemon -p /var/run/clamav/freshclam.pid
```

but it looks like its installed:

```
blurr-ink# pkg_info|grep spam
p5-Mail-SpamAssassin-3.2.5 A highly efficient mail filter for identifying spam
razor-agents-2.84   A distributed, collaborative, spam detection and filtering
spamass-milter-0.3.1_7 Sendmail Milter (mail filter) plugin for SpamAssassin
spamd-4.1.2         Traps spammers with a very slow smtp-login and return 4xx e
```

And I did a 'portupgrade -a' and now my webmin won't open my webpages and domain still work but when i try and access webmin it gives me the page cannot be displayed. Any Idea's?? can a 'portupgrade -a' be undone??


----------



## Lego (Sep 13, 2009)

```
blurr-ink# /usr/local/etc/rc.d/sa-spamd onestart
Starting spamd.
eval: /usr/local/bin/spamd: not found
blurr-ink# ps -axw | grep -e clam -e spam                                           
943  ??  Is     0:00.00 /usr/local/sbin/spamass-milter -f -p /var/run/spamass-milter.sock
 1006  ??  Is     0:00.00 /usr/local/sbin/clamd
 1011  ??  Is     0:00.00 /usr/local/bin/freshclam --daemon -p /var/run/clamav/freshclam.pid
 1337  p0  R+     0:00.00 grep -e clam -e spam
```


```
blurr-ink# /usr/local/etc/rc.d/spamd onestart
/usr/local/etc/rc.d/spamd: Command not found.
blurr-ink# /etc/rc.d/spamd onestart
/etc/rc.d/spamd: Command not found.
```

I dunno just things i've tried....


----------



## DutchDaemon (Sep 13, 2009)

Try a 'rehash' or 'hash -r' first.


----------



## dennylin93 (Sep 13, 2009)

The script of mail/spamd is /usr/local/etc/rc.d/obspamd, and the script of mail/p5-Mail-SpamAssassin is /usr/local/etc/rc.d/sa-spamd.

If you're using spamd/spamc (SpamAssassin), make sure SPAMD is selected.

Remember that mail/spamd and mail/p5-Mail-SpamAssassin are completely different things although they both turn away spam. OpenBSD developers developed mail/spamd for greylisting and blacklisting while mail/p5-Mail-SpamAssassin scans the content of the mail.

Edit: If you're using blacklist mode with mail/spamd, see ports/137992. The maintainer has approved the patch, but it hasn't been comitted yet.


----------



## Lego (Sep 13, 2009)

Ok, that makes some sense, Thanks for the response.  What would you recommend me doing at this point then??  I want to use SpamAssassin, with spamhaus as the list.  Although I did fix Webmin, i just re-ran the config.


----------



## Lego (Sep 13, 2009)

ok I uninstalled everything, and 'pkg_add -r p5-Mail-SpamAssassin' & 'pkg_add -r spamass-milter'; 'rehash';

```
blurr-ink# /usr/local/etc/rc.d/spamass-milter start
Starting spamass_milter.
blurr-ink# /usr/local/etc/rc.d/sa-spamd start
Starting spamd.
eval: /usr/local/bin/spamd: not found
blurr-ink#
```


----------



## DutchDaemon (Sep 13, 2009)

According to the port's pkg-plist, these are installed in /usr/local/


```
bin/sa-compile
bin/sa-learn
bin/sa-update
bin/spamassassin
bin/spamc
bin/spamd
```

Any of them actually there? If so, what gives [cmd=]/usr/local/etc/rc.d/sa-spamd rcvar[/cmd]? Maybe somehting untoward in /etc/rc.conf that's interfering with the start script or the environment?


----------



## Lego (Sep 13, 2009)

```
blurr-ink# /usr/local/etc/rc.d/sa-spamd rcvar
# spamd
spamd_enable=YES
blurr-ink#
```

how do i list just the 's's in the bin directory because i can't scroll high enough to see them when i 'ls', and my rc.conf is fine they say to have spamass_milter_enable="YES" and spamd_enable="YES", i have both..


----------



## DutchDaemon (Sep 13, 2009)

[cmd=]ls s*[/cmd]


----------



## Lego (Sep 14, 2009)

Yes all 6 are there.  This guy http://www.qmailrocks.org/qmrbb/showthread.php?t=6043 was having the same problem and just change the /usr/local/etc/rc.d/sa-spamd.sh file first line but i dont' have that file i have /usr/local/etc/rc.d/sa-spamd they look the exact same and when i start them /usr/local/etc/rc.d/sa-spamd.sh start doesn't work for me /usr/local/etc/rc.d/sa-spamd start does.... i tried what he did and then got a new error about line 19


----------



## Lego (Sep 14, 2009)

original "#!/bin/sh"

```
blurr-ink# /usr/local/etc/rc.d/sa-spamd.sh start
/usr/local/etc/rc.d/sa-spamd.sh: Command not found.
blurr-ink# /usr/local/etc/rc.d/sa-spamd start
Starting spamd.
eval: /usr/local/bin/spamd: not found
```

change the line to "#!/usr/local/bin/perl"

```
blurr-ink# /usr/local/etc/rc.d/sa-spamd start
syntax error at /usr/local/etc/rc.d/sa-spamd line 19, near "."
Execution of /usr/local/etc/rc.d/sa-spamd aborted due to compilation errors.
```

change to "#!/usr/local/bin"

```
blurr-ink# /usr/local/etc/rc.d/sa-spamd start
/usr/local/etc/rc.d/sa-spamd: Permission denied.
```


----------



## DutchDaemon (Sep 14, 2009)

The '.sh' extension was dropped sometime around FreeBSD 6 (IIRC). No port should use .sh scripts nowadays. So 'sa-spamd' now is equivalent to 'sa-spamd.sh' 2-3 versions ago.


----------



## DutchDaemon (Sep 14, 2009)

I think the guy meant changing the first line of /usr/local/bin/spamd, not of the start script ..


----------



## Lego (Sep 14, 2009)

Yes, you are right, he ment /usr/local/bin/spamd;

```
blurr-ink# /usr/local/etc/rc.d/sa-spamd start
/usr/local/bin/.: Permission denied.
name=spamd: Command not found.
set_rcvar: Command not found.
rcvar=: Command not found.
extra_commands=reload: Command not found.
name: Undefined variable.
blurr-ink#
```
should i be getting all that?


----------



## DutchDaemon (Sep 14, 2009)

No. Did you put 
	
	



```
#!/bin/sh
```
 back at the top of /usr/local/etc/rc.d/sa-spamd?

Can you run [cmd=]sh -x /usr/local/etc/rc.d/sa-spamd start[/cmd] and see whether there's more information as to what goes wrong? Try [cmd=]sh -xv /usr/local/etc/rc.d/sa-spamd start[/cmd] for even more verbose output.


----------



## Lego (Sep 14, 2009)

LOL, YES! I changed the line in the start up script and not the spamd file, changed it to #!/usr/local/bin/perl and it worked perfect.

```
blurr-ink# /usr/local/etc/rc.d/sa-spamd start
Starting spamd.
blurr-ink# ps -axw | grep -e clam -e spam
  943  ??  Is     0:00.00 /usr/local/sbin/spamass-milter -f -p /var/run/spamass-milter.sock
 1006  ??  Is     0:00.00 /usr/local/sbin/clamd
 1011  ??  Is     0:00.00 /usr/local/bin/freshclam --daemon -p /var/run/clamav/freshclam.pid
 1176  ??  Ss     0:01.77 /usr/local/bin/spamd -c -d -r /var/run/spamd/spamd.pid (perl)
 1177  ??  I      0:00.01 spamd child (perl)
 1178  ??  I      0:00.01 spamd child (perl)
 1254  p0  R+     0:00.00 grep -e clam -e spam
```

Now I just need to figure out whats wrong with clamav-milter LOL! Thanks DutchDaemon! you've solved my mail issues again! I owe ya big!


----------



## Lego (Sep 14, 2009)

Deleted.... yes its working properly..


----------



## Lego (Sep 14, 2009)

```
blurr-ink# cd /etc/mail
blurr-ink# make
blurr-ink# cp blurr-ink.com.cf sendmail.cf
blurr-ink# /etc/rc.d/sendmail stop
Stopping sendmail.
Stopping sendmail_clientmqueue.
blurr-ink# /etc/rc.d/sendmail start
Starting sendmail.
WARNING: Xclmilter: local socket name /var/run/clamav/clmilter.sock missing
blurr-ink#
```

I think i know what i did wrong... i for got to 'make -DWITH_MILTER' and just did a make install clean...


----------



## Lego (Sep 14, 2009)

Yup, thats what I did wrong, and its all working perfect now! Thanks again!


----------

