mod_spamhaus on CentOS 5

Trying this module out on Centos 5 and Apache 2 to see how it goes (Debian install how-to here)

  • yum install httpd-devel (if ‘which apxs’ shows nothing)
  • wget http://www.mirrorservice.org/sites/download.sourceforge.net/pub/sourceforge/m/project/mo/mod-spamhaus/mod-spamhaus/0.7/mod-spamhaus-0.7.tar.gz
  • ln -s /usr/sbin/apxs /usr/sbin/apxs2
  • tar zxf mod_spamhaus*.tar.gz
  • cd mod_spamhaus
  • make
  • make install
  • touch /etc/httpd/mod_spamhaus.wl
  • LoadModule spamhaus_module /usr/lib/httpd/modules/mod_spamhaus.so
    was automatically added to httpd.conf
  • vi /etc/httpd/conf/httpd.conf

    {IfModule mod_spamhaus.c}
    MS_METHODS POST,PUT,OPTIONS,CONNECT
    MS_WhiteList /etc/httpd/mod_spamhaus.wl
    MS_CacheSize 256
    {/ifmodule}

    /etc/init.d/httpd restart

(change the curly braces in the quote above to angle brackets)

  • After a while check the Apache error log e.g. grep spamhaus /var/log/httpd/error_log . You should see some rejected connections – mainly on contactus.php type pages.

    [Fri Oct 16 03:41:08 2009] [crit] [client 111.222.222.111] mod_spamhaus: address 111.222.222.111.sbl-xbl.spamhaus.org is blacklisted. Deny connection to blogs.domain.tld/library/wp-comments-post.php, referer: http://blogs.domain.tld/library/library/path/to/anotherpost/
    [Fri Oct 16 03:52:44 2009] [crit] [client 222.111.111.222] mod_spamhaus: address 222.111.111.222.sbl-xbl.spamhaus.org is blacklisted. Deny connection to blogs.domain.tld/library/wp-comments-post.php, referer: http://blogs.domain.tld/library/path/to/mypost/

  • I think it would be useful if there was the ability to add other/custom RBLs. The URL is listed as
    cfg->dnshost=”sbl-xbl.spamhaus.org”;
    in the source file mod_spamhaus.c so could be changed. Not sure if others can be added?

4 Responses to “mod_spamhaus on CentOS 5”

  1. Adam

    When I try to install it I get this error:

    apxs2 -Wc, -Wc,-DDST_CLASS=3 -c src/mod_spamhaus.c
    cannot open /httpd/build/config_vars.mk: No such file or directory at /usr/sbin/apxs2 line 201.
    make: *** [src/.libs/mod_spamhaus.so] Error 2
    [root@devapp mod-spamhaus]# make

    apxs2 -Wc, -Wc,-DDST_CLASS=3 -c src/mod_spamhaus.c
    cannot open /httpd/build/config_vars.mk: No such file or directory at /usr/sbin/apxs2 line 201.
    make: *** [src/.libs/mod_spamhaus.so] Error 2

    Do you have any idea what could cause that? httpd-devel is installed.

    Thanks,
    Adam

    Reply
  2. tick

    Adam, juz edit Makefile and change APXS=apxs2 to APXS=apxs
    make && make install

    Done 😉

    Reply

Leave a Reply

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>