| 1 |
REQUIREMENTS |
| 2 |
|
| 3 |
You'll need a decent compiler, we have tested gcc on FreeBSD and |
| 4 |
Linux, Sun Studio 8 and 12 on Solaris Sparc. |
| 5 |
|
| 6 |
In order to configure dnsbl queries you need c-ares library for |
| 7 |
asynhronous dns queries. You can download it here: |
| 8 |
http://daniel.haxx.se/projects/c-ares/ |
| 9 |
|
| 10 |
COMPILING |
| 11 |
|
| 12 |
You should be able to compile it for testing by just commanding: |
| 13 |
|
| 14 |
$ ./configure |
| 15 |
$ sudo make install |
| 16 |
|
| 17 |
Default install location is /usr/local which can be overridden by |
| 18 |
specifying a --prefix argument to configure. Run ./configure --help |
| 19 |
for other options. |
| 20 |
|
| 21 |
It might be a good idea to configure with CFLAGS="-g -O0", it |
| 22 |
will make debugging a lot more effective. |
| 23 |
|
| 24 |
BASIC CONFIGURATION |
| 25 |
|
| 26 |
An example configuration is included in doc/example/grossd.conf: |
| 27 |
It is installed also as the default configuration in |
| 28 |
$PREFIX/etc/grossd.conf. You may tell grossd to use another config |
| 29 |
file via -f command line option. |
| 30 |
|
| 31 |
Grossd query server defaults to port 5525/tcp with proto=postfix, |
| 32 |
port 5525/udp with proto=sjsms and replication service |
| 33 |
(if configured) to port 5526/tcp. Grossd listens for status queries |
| 34 |
on port 5522/tcp. |
| 35 |
|
| 36 |
Detailed information about each option is included within the |
| 37 |
example configuration file. |
| 38 |
|
| 39 |
BLOOM FILTER CONFIGURATION |
| 40 |
|
| 41 |
The server keeps the state information in the Bloom filter bit arrays. |
| 42 |
By the nature of the filters you can insert elements in the filters, but |
| 43 |
not to remove them. So we actually use several filters, and rotate them |
| 44 |
on intervals. The actual filter is just a logical OR of those rotating |
| 45 |
filters. number_buffers is the number of the rotating filters, and |
| 46 |
rotate_interval is the interval in seconds. |
| 47 |
|
| 48 |
The default setting in the example grossd.cnf is: |
| 49 |
number_buffers = 8 |
| 50 |
rotate_interval = 3600 |
| 51 |
|
| 52 |
So, this will give you approximately 60 * 7.5 minutes worth of state |
| 53 |
information. That is, any greylisted triplet will be stored for |
| 54 |
7.5 hours on average. If you find that remote servers are taking |
| 55 |
longer than 7.5 hours to retry their messages, then you should increase |
| 56 |
the the number_buffers setting accordingly. Alternatively, you could |
| 57 |
increase the rotate_interval, but setting this value too high isn't |
| 58 |
recommended. |
| 59 |
|
| 60 |
The filter_bits setting (default is 24) defines the size of each |
| 61 |
Bloom filter. Increasing the filter_bits setting will reduce the |
| 62 |
likelihood of false positives within the filter. See |
| 63 |
http://en.wikipedia.org/wiki/Bloom_filter for more information. |
| 64 |
|
| 65 |
CREATE STATEFILE |
| 66 |
|
| 67 |
If you get this far, you can start the server. I suggest you |
| 68 |
run the server first in foreground with -d option. If you |
| 69 |
configured statefile, you have to start grossd with -C option |
| 70 |
in order to create the state file. |
| 71 |
|
| 72 |
$ sudo -u nobody $PREFIX/sbin/grossd -C |
| 73 |
|
| 74 |
Note: make sure that the run-time user has permissions to create |
| 75 |
and write to the statefile. |
| 76 |
|
| 77 |
SERVER STARTUP |
| 78 |
|
| 79 |
To start the grossd server, just run this. |
| 80 |
|
| 81 |
$ sudo -u nobody $PREFIX/sbin/grossd |
| 82 |
|
| 83 |
After starting, you can test it with $PREFIX/bin/gclient. |
| 84 |
|
| 85 |
MTA CONFIGURATION |
| 86 |
|
| 87 |
Although never tested in production, Gross should work with |
| 88 |
Postfix's native filtering protocol. |
| 89 |
|
| 90 |
On the other hand, SJSMS needs some mapping entry for queries. |
| 91 |
This is an example production server config: |
| 92 |
|
| 93 |
ORIG_MAIL_ACCESS |
| 94 |
|
| 95 |
! allow all DSNs and MDNs |
| 96 |
TCP|*|*|*|*|*|*|tcp_local||*|* $Y$E |
| 97 |
! allow all incoming mail to postmaster and abuse |
| 98 |
TCP|*|*|*|*|*|*|tcp_local|*|*|postmaster@* $Y$E |
| 99 |
TCP|*|*|*|*|*|*|tcp_local|*|*|abuse@* $Y$E |
| 100 |
! use gross to check all triplets (client_ip,sender,recipient) |
| 101 |
TCP|*|*|*|*|SMTP/*|*|tcp_local|*|*|* $[/usr/local/gross/lib/grosscheck.so,grosscheck,10.10.13.1,10.10.13.2,5525,$2,$=$8$_,$=$6$_,$=$4$_] |
| 102 |
|
| 103 |
The server will always query the first server if it's available. |
| 104 |
|
| 105 |
First, when you have only one server, you can test it like this: |
| 106 |
|
| 107 |
TCP|*|*|*|*|SMTP/*|*|tcp_local|*|*|* $[/path/to/grosscheck.so,grosscheck,127.0.0.1,,5525,$2,$=$8$_,$=$6$_,$=$4$_] |
| 108 |
|
| 109 |
SOPHOS BLOCKER INTEGRATION |
| 110 |
|
| 111 |
grossd is able to query the proprietary Sophos Blocker service, which |
| 112 |
is basically a private DNSBL that is part of the Sophos PureMessage |
| 113 |
product. You can configure grossd to query your existing |
| 114 |
PureMessage system, or install it on the same server(s) as gross. |
| 115 |
|
| 116 |
DNS CACHING |
| 117 |
|
| 118 |
If you process a high volume of email traffic, then you will |
| 119 |
definitely want to install a local caching DNS server. |
| 120 |
BIND/named is recommended. |
| 121 |
|
| 122 |
KNOWN ISSUES |
| 123 |
|
| 124 |
See https://codeberg.org/bizdelnick/gross/issues for bugs |
| 125 |
and known issues. |
| 126 |
|
| 127 |
LOGGING AND TROUBLESHOOTING |
| 128 |
|
| 129 |
grossd logs everything through syslog. Facility is LOG_MAIL, loglevel |
| 130 |
defaults to INFO. You can control logging with 'log_level' and |
| 131 |
'syslog_facility' configuration options. |
| 132 |
|
| 133 |
You can enable full debugging by starting grossd with -D command line |
| 134 |
option. You may also want -d, as grossd then writes output on standard |
| 135 |
terminal instead of syslog. |
| 136 |
|
| 137 |
gclient is a tool for manually querying the grossd server. You can |
| 138 |
install and run gclient on any server. |
| 139 |
|
| 140 |
$ gclient PROTOCOL sender recipient ip_address [runs] [host port] |
| 141 |
$ /usr/local/bin/gclient sjsms [email protected] [email protected] 127.0.0.2 2 10.10.10.13 5525 |
| 142 |
|
| 143 |
(note that 127.0.0.2 will always be blacklisted) |
| 144 |
|
| 145 |
SOLARIS 10 SERVICE MANAGEMENT FACILITY |
| 146 |
|
| 147 |
If you are running Gross on Solaris 10, then you should utilize the |
| 148 |
Service Management Facility. SMF is better than init.d scripts |
| 149 |
for starting and stopping services. SMF will detect if Gross dies or |
| 150 |
is killed, and will restart it automatically. |
| 151 |
|
| 152 |
An example SMF configuration is included in doc/examples/smf-definition.xml |
| 153 |
|
| 154 |
To import the service: |
| 155 |
|
| 156 |
$ sudo svccfg import doc/examples/smf-definition.xml |
| 157 |
|
| 158 |
To start/stop Gross: |
| 159 |
|
| 160 |
$ sudo svcadm [enable|disable] grossd |
| 161 |
|
| 162 |
To check the status of Gross: |
| 163 |
|
| 164 |
$ svcs -x -v grossd |
| 165 |
|
| 166 |
http://www.sun.com/bigadmin/content/selfheal/smf-quickstart.html |
| 167 |
|
| 168 |
INSTALLING ON SOLARIS 10 ZONES |
| 169 |
|
| 170 |
Gross can be installed on Solaris 10 zones. The one caveat is that |
| 171 |
you can't install things in /usr when you are using sparse zones. |
| 172 |
This means that you must either |
| 173 |
|
| 174 |
a) install c-ares and gross in /usr on the global zone |
| 175 |
|
| 176 |
The sparse zone will be able to execute the gross binary from |
| 177 |
/usr but your configuration and state file should be kept on the |
| 178 |
sparse zone (e.g. in /opt) |
| 179 |
|
| 180 |
b) install c-ares and gross in /opt (for example) on the sparse zone |
| 181 |
|
| 182 |
For example, you can install c-ares on the sparse zone |
| 183 |
with "--prefix=/opt/local". Then, to configure grossd, run this: |
| 184 |
|
| 185 |
$ env LDFLAGS='-L/opt/local/lib -R/opt/local/lib' ./configure |
| 186 |
--prefix=/opt/gross |
| 187 |
|