exim_commands
exim_compiling
exim_conf
exim_configuration
exim_encryption
exim_gui
exim_redhat
exim_spamassassin
mail
mail_filtering
|
Mail and Webmail Configuration
|
Mail is split into two areas, sending (SMTP) and receiving (IMAP, POP3, IMAPS, SPOP3). Red Hat uses University of Washington's IMAP server, which provides IMAP and POP3 to all users with a normal account on the server. There are other IMAP servers available; however these take considerably more configuration than the standard package.
As with other areas there are multiple applications available for Linux that will serve the function of a SMTP server. My preferred SMTP server is Exim, which is available from http://www.exim.org/
Other SMTP servers include:
|
Exim is currently on version 4.20, it may be downloaded from here.
Install Exim
There is extremely good documentation on the Exim site, in short there are a few steps to install Exim:
- expand the compressed distribution
- tar zxvf exim-4.20.tar.gz
- cd exim-4.20
- cp src/EDITME Local/Makefile
- cp eximon/EDITME Local/eximon.conf
- edit the Makefile and eximon.conf
- cd Local
- vi Makefile
- Please check the example Makefile and eximon.conf compared to the originals in the downloaded distribution.
- vi eximon.conf
- copy a file into the source to enable SpamAssassin
cp sa-exim.c src/local_scan.c
- make
- su -root -c "make install"
- copy example exim init file for Red Hat to location
cp exim.init /etc/init.d/exim
- link exim init file so exim starts automatically upon boot
ln -s /etc/init.d/exim /etc/rc3.d/S90exim
ln -s /etc/init.d/exim /etc/rc5.d/S90exim
Configure Exim
Marc Merlin has a some great example configuration files here and mirrored here the default file is here. This depth is not needed for a basic mail server and you can start with only a couple of modifications to the basic file. The basic modifications suggested are as follows:
- Ensure that you have set your hostname correctly, if it is still localhost or localhost.localdomain then it should be set to a dns resolveable name by entering the correct name in /etc/sysconfig/network. You can ensure that exim has the correct hostname by setting primary_hostname
- local_domains - if this server is the main mail server rather than a mail relay then this should list all the domains for which you will be receiving mail.
- relay_to_domains - If this is a mail relay, then you must enter the domains for which you are relaying.
- relay_from_hosts - If your mail server is to relay mail to the outside world, then this should contain a list of IPs, resolveable hostnames or networks such as 192.168.5.0/24
Exim may then be restarted by the following command: service exim restart
Configure Exim - More Advanced
Encryption
Exim should be configured to use encryption, this can be done by creating the certificates with the following command:
openssl req -x509 -newkey rsa:1024 -keyout /etc/mail/exim.cert -out /etc/mail/exim.cert -days 9999 -nodes
the -nodes option is important as this prevents the key being encrypted with a pass-phrase which is not helpful for use with an MTA
The configuration options are exim.conf is as follows:
tls_certificate = /etc/mail/exim.cert
tls_privatekey = /etc/mail/exim.cert
tls_advertise_hosts = *
These should be entered into the configuration file at the top
Authentication
Authentication allows for remote users to send email through the mail server using basic authentication. The following configuration options should be entered at the end of the exim.conf file where it states authentication configuration:
begin authenticators
plain:
driver = plaintext
public_name = PLAIN
server_condition = ${if eq{$3}{${lookup{$2}lsearch{/etc/mail/auth.pass}{$value}fail}}{yes}{no}}
server_set_id = $2
login:
driver = plaintext
public_name = LOGIN
server_prompts = Username:: : Password::
server_condition = ${if eq{$2}{${lookup{$1}lsearch{/etc/mail/auth.pass}{$value}fail}}{yes}{no}}
server_set_id = $1
cram:
driver = cram_md5
public_name = CRAM-MD5
server_secret = ${if eq{$2}{${lookup{$1}lsearch{/etc/mail/auth.pass}{$value}fail}}{yes}{no}}
server_set_id = $1
# End of Exim configuration file
The file /etc/mail/auth.pass is a plain text file that has the following format:
username password
user2 password2
Exim with NIS
This requires NIS to be working and enabled. This can be tested using ypcat passwd; you should be provided with the aoutput of the alias file. To configure exim to use the NIS aliases only one line needs to be changed, this is in system_aliases:
This should be changed from:
data = ${lookup{$local_part}lsearch{/etc/aliases}}
to
data = ${lookup{$local_part}nis{mail.aliases}}
exim should be restarted following this change.
Management of Exim
eximon
Exim may be managed using eximon, a graphical utility to freeze, retry and cancel emails. Eximon requires a GUI to run and the menu is obtains by pressing shift and left-clicking on the emails into the list.
exim commands
exim -bp -> mailq --- The mailq is relevant as it gives your the email IDs.
exim -M messageID -> force delivery of one message
exim -qf -> Force another queue run
exim -qff -> Force another queue run and attempt to flush frozen messages
exim -Mvl messageID -> View Log for message
exim -Mvb messageID -> View Body for message
exim -Mrm messageID -> ReMove message (no errors sent)
exim -Mg messageID -> Give up and fail message, message bounces to sender
|
|
|
|