Disclaimer

This information HAS errors and is made available WITHOUT ANY WARRANTY OF ANY KIND and without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. It is not permissible to be read by anyone who has ever met a lawyer or attorney. Use is confined to Engineers with more than 370 course hours of engineering.
If you see an error contact:
+1(785) 841 3089
inform@xtronics.com

Exim


Generate single config file

/usr/sbin/update-exim4.conf --keepcomments -o /root/exim4.conf-gen

The effort to create a config shortcut is understandable - works on simple hosts - but is a REALLY bad idea on anything else.  This is how to get a starting config.

You will want to get rid of lines with macros.


Quick tricks

To unfreeze all messages :
exim -bp | grep -i frozen | awk '{print $3}' | while read LINE; do exim -Mt $LINE; done

To check to see if an IP is listed in a RBL(Reverse Black List) see  http://openrbl.org/

exim -bp | grep -i frozen | awk '{print $3}' | while read LINE; do exim -Mt $LINE; done

Bogofilter stuff

Bogofilter is the spam filter of choice.

I have bogofilter working with exim-4.12 - the router needed domain = +localdomains so outgoing e-mail did not get scanned.

I've fixed it by generating a unique header to tag (x-flag (make up your own)) as it scanned here - and look for that instead of the x-bogosity header in the router. Then in local deliveries I remove the header again so it won't effect any filter stats.

Be sure to set the owner of the word list to something exims! (maill)


ROUTERS

# Bogofilter will add X-Bogosity header to all incoming mail.
# This usually goes right after the dns_lookup router and
# before any local deliver routers. Location is important!
bogo_router:
 domains = +local_domains
 no_verify
condition = ${if !eq {$received_protocol}{bogodone} {1}{0}} driver = accept
transport = bogo_transport


#end of routerS

Transports

# Bogofilter will add X-Bogosity header to all incoming mail.
# This can go anywhere in the transport section, usually at
# the very end after address_reply
bogo_transport:
 driver = pipe
command = /usr/sbin/exim -oMr bogodone -bS use_bsmtp = true headers_add = X-Bogofilterd: true transport_filter = /usr/bin/bogofilter -d /etc/bogofilter -l -p -e -u return_fail_output = true group = mail user = mail home_directory = "/tmp" current_directory = "/tmp" log_output = true return_path_add = false

local_delivery:
 driver = appendfile
 file = /var/mail/$local_part
#lose the X-flag header
 headers_remove = X-flag
 delivery_date_add
 envelope_to_add
 return_path_add
 group = mail
 mode = 0660
# end of transport

Question

Is the X-bogosity header ignored while creating the data bases? or would I have to remove them?

That is if I run a test - will it replace the old bogosity header?

I can imagine that spammers will put a fake header in after people start using the filter. Any provision to change the header name as a command-line option?

Answer

It's not a problem. In lexer.l is code to detect any "X-Bogosity" header lines and remove them. Any attempts by a spammer to supply their own X-Bogosity lines to deceive bogofilter will fail. Note: you must be using the passthrough option ('-p') to have bogofilter rewrite the message. (The rewritten message has old X-Bogosity lines removed and the new one inserted at the end of the message header). bogofilter also has a provision in the config file to change the x-bogosity name (but it is hard to think of a better name<g>)

bogofilter Testing hints

bogoutil -w dbdirectory .MSG_COUNT
bogoutil -w dbdirectory testword

Anyone getting started should archive a few 100 spams and emails as a first step. It also will flag most viruses if you put them in with the spam.

Keep all your spams and real emails archived by quarters - as your email and spams change you may want to create a new data base with more recent messages.

Cyrus and Exim

I had some problems with configuring exim 4 and cyrus but now it works.... maybe this helps others as well

/etc/services

# Local services

lmtp 24/tcp # LMTP Mail Delivery over TCP
lmtp 24/udp # LMTP Mail Delivery over TCP
pop3 110/tcp pop-3 # POP version 3
pop3 110/udp pop-3
imap 143/tcp imap2 # Interim Mail Access Proto v2
imap 143/udp imap2
imaps 993/tcp # IMAP over SSL
imaps 993/udp # IMAP over SSL
pop3s 995/tcp # POP-3 over SSL
pop3s 995/udp # POP-3 over SSL
sieve 2000/tcp # Sieve Mail Filter Daemon
sieve 2000/udp # Sieve Mail Filter Daemon

/etc/imapd.conf

configdirectory: /var/lib/imap
partition-default: /var/spool/imap
admins: cyrus
allowanonymouslogin: no
sieveuserhomedir: no
sievedir: /var/lib/imap/sieve
sendmail: /usr/sbin/sendmail
hashimapspool: true
sasl_pwcheck_method: saslauthd
sasl_mech_list: PLAIN
tls_cert_file: /usr/share/ssl/certs/cyrus-imapd.pem
tls_key_file: /usr/share/ssl/certs/cyrus-imapd.pem

/etc/cyrus.conf

# standard standalone server implementation
START {
# do not delete this entry!
recover cmd="ctl_cyrusdb -r"
# this is only necessary if using idled for IMAP IDLE
# idled cmd="idled"
} # UNIX sockets start with a slash and are put into /var/lib/imap/sockets SERVICES { # add or remove based on preferences imap cmd="imapd" listen="imap" prefork=5 imaps cmd="imapd -s" listen="imaps" prefork=1 pop3 cmd="pop3d" listen="pop3" prefork=3 pop3s cmd="pop3d -s" listen="pop3s" prefork=1 sieve cmd="timsieved" listen="sieve" prefork=0
# at least one LMTP is required for delivery
lmtp cmd="lmtpd -a" listen="lmtp" prefork=0
# lmtpunix cmd="lmtpd -a" listen="/var/lib/imap/socket/lmtp" prefork=1
# this is only necessary if using notifications
# notify cmd="notifyd" listen="/var/lib/imap/socket/notify" proto="udp" prefork=1
}
EVENTS 
# this is required
checkpoint cmd="ctl_cyrusdb -c" period=30
# this is only necessary if using duplicate delivery suppression
delprune cmd="ctl_deliver -E 3" at=0400
# this is only necessary if caching TLS sessions
tlsprune cmd="tls_prune" at=0400
}

/etc/exim/exim.conf

# ....
########## ROUTERS
smart_route:
 driver = manualroute
 domains = !+local_domains
 transport = remote_smtp
 route_list = * "smarthost.com" byname
 localuser:
driver = accept transport = local_delivery_lmtp
########## TRANSPORTS
local_delivery_lmtp:
 driver = smtp
 protocol = lmtp
 hosts_override
 hosts = localhost
 allow_localhost
 return_path_add
# ....

steps

Have fun !

Hylafax - Exim - and html -- Exim configuration for Faxmail

These configurations enable exim and hylafax (www.hylafax.org) work together, i mean sending fax by email (user@123456.fax). Obs: There is a problem faxmail does not support email in html format. If someone solved this problem, pls tell me.

exim.conf

# TRANSPORTS CONFIGURATION #
######################################################################
# ORDER DOES NOT MATTER #
# Only one appropriate transport is called for each delivery. 
######################################################################
# A transport is used only when referenced from a director or a router that
# successfully handles an address.

#These configure for sending of fax for email
fax:
  driver = pipe
  user = cpd
  command ="/usr/bin/faxmail -d ${local_part}@${extract{1}{.}{$domain}}"
  home_directory = /usr/bin
######################################################################
# ROUTERS CONFIGURATION #
# Specifies how remote addresses are handled 
######################################################################
# ORDER DOES MATTER #
# A remote address is passed to each in turn until it is accepted. #
######################################################################
# Estas configuracoes sao para habilitar o envia de fax por email
fax:
  driver = domainlist
  transport = fax
  route_list ="*.fax"
# End of Exim configuration file

Hylafax - Exim - and html -- Exim configuration for Faxmail using $local_part as destination

To enable hylafax/faxmail/exim4 to process mail as 12345678@yourdomain.tld, that is, fax number as $local_part follow the directions below.

Please note this is best for standalone hylafax servers that do not process other email for local delivery. If you are using hylafax on a server that performs other functions, particularly email for your domain/local delivery, you would do best to use the traditional foo@12345678.fax transport route seen above.

1. Put the following in: '/etc/exim4/conf.d/transport/40_exim4-hylafax-gateway' substitute your country code as necessary by changing +1 to +33

######################################################################
# TRANSPORTS CONFIGURATION #
######################################################################
# ORDER DOES NOT MATTER #
# Only one appropriate transport is called for each delivery. #
######################################################################

# A transport is used only when referenced from a director or a router
# that successfully handles an address.

#These configure  for sending of fax for email
fax:
driver = pipe
user = faxmaster
command ="/usr/bin/faxmail -n -d +1$local_part"
home_directory = /tmp
use_shell = true

2. Put the following in: '/etc/exim4/conf.d/router/050_exim4-hylafax-gateway' make sure you change yourdomain.tld to your domain, such as foobar.com
######################################################################
# ROUTERS CONFIGURATION #
# Specifies how remote addresses are handled #
######################################################################
# ORDER DOES MATTER #
# A remote address is passed to each in turn until it is accepted. #
######################################################################

fax:
driver = manualroute
transport = fax
route_list ="*yourdomain.tld"

3. Edit '/etc/exim4/conf.d/main/01_exim4-config_listmacrosdefs' to change from the local delivery option of mail_spool to the new fax transport you've created.

.ifndef LOCAL_DELIVERY
# The default transport, set in /etc/exim4/update-exim4.conf.conf,
# defaulting to mail_spool. See CONFDIR/conf.d/transport/ for possibilities
LOCAL_DELIVERY=fax
#LOCAL_DELIVERY=mail_spool
.endif

4. If using single-file config, proceed to step 5. If using exim4 split configuration, update your configuration file with 'update-exim4.conf.template -r'

5. Restart exim4 '/etc/init.d/exim4 restart'

6. Send a test fax to 2345678@yourdomain.tld the transport will add the country code automatically, resulting in 12345678@yourdomain.tld</code>

Hylafax HTML setup

How to send HTML files?

I want to fax HTML documents so they look like html pages not >source. >

First of all, fetch html2ps by Jan Karrman from : http://www.tdb.uu.se/~jan/html2ps.html It is a perl script and does an excellent job on any text/html stuff; it will also tackle embedded images if you have ImageMagick and PerlMagick installed.

Second, insert the following into the typerules file, just above the bottom line :

# HTML support
0 string <!DOCTYPE HTML ps /usr/local/bin/html2ps %i >%o
0 string <!doctype html ps /usr/local/bin/html2ps %i >%o
0 string <HEAD ps /usr/local/bin/html2ps %i >%o
0 string <head ps /usr/local/bin/html2ps %i >%o
0 string <TITLE ps /usr/local/bin/html2ps %i >%o
0 string <title ps /usr/local/bin/html2ps %i >%o
0 string <HTML ps /usr/local/bin/html2ps %i >%o
0 string <html ps /usr/local/bin/html2ps %i >%o

Remember all this is at the client end (if your client is a different machine to your fax server).

Exim Testing Hints

$ exim -bh ''ip address''
HELO BAR.COM
MAIL FROM:<foo@bar.com>
RCPT TO:<wayne@bar.com>
DATA  
 Date: Fri, Jul 16 2010, 13:41:30 -0400 
 From: "Commissioner Gordon" <foo@bar.com> 
 Subject: DAILY REPORT OF DISK UTILIZATION 
 To: "Bruce Wayne" <wayne@bar.com>

Top Page wiki Index