Florent,
Here's a few of my notes on setting up postfix to send and receive e-mails:
# apt-get remove --purge exim4
# apt-get install postfix
select no configuration during the install
# vi /etc/postfix/main.cf
add contents similar to the following and adjust the domains and ip address as required:
Code:
#See /usr/share/postfix/main.cf.dist for a commented, more complete version
#
# Debian specific: Specifying a file name will cause the first
# line of that file to be used as the name. The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname
#
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no
#
# appending .domain is the MUA's job.
append_dot_mydomain = no
#
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
#
readme_directory = no
#
# TLS parameters
#
smtpd_tls_key_file = /etc/pki/tls/private/mail.mydomain.com.key
smtpd_tls_cert_file = /etc/pki/tls/certs/mail.mydomain.com.cert
smtpd_use_tls = no
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
#
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
#
myhostname = vps.domain1.co.uk
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = domain1.co.uk
mydestination =
relayhost =
mynetworks = 127.0.0.0/8, xxx.xx.xx.xxx/32
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter =
inet_interfaces = all
mydomain = domain1.co.uk
message_size_limit = 104857603
local_transport = error:no local mail delivery
local_recipient_maps =
virtual_alias_maps = hash:/etc/postfix/virtual
relay_recipient_maps = hash:/etc/postfix/relay_recipients
transport_maps = hash:/etc/postfix/transport
relay_domains = domain1.co.uk, domain2.co.uk, domain3.co.uk, domain4.me.uk, domain4.co.uk, domain5.co.uk
#
# Specify your NAT/proxy EXTERNAL address here.
#proxy_interfaces =
#
smtpd_helo_required = yes
smtpd_sender_restrictions = check_sender_access hash:/etc/postfix/sender_access, reject_non_fqdn_sender, reject_unknown_sender_domain
smtpd_recipient_restrictions = permit_mynetworks, reject_unauth_destination, reject_unauth_pipelining
smtpd_data_restrictions = reject_unauth_pipelining
run the newaliases command
# newaliases
# vi /etc/postfix/virtual
add these e-mail addresses to the end of this file (do not leave any white spaces at the end of the file):
Code:
# top of file of last line of comments
postmaster postmaster@domain1.co.uk
abuse abuse@domain1.co.uk
~
~
~
Run the postmap command on this file whenever it is change/modified/adjusted
# postmap /etc/postfix/virtual
# vi /etc/postfix/relay_recipients
add these e-mail addresses to the end of this file (do not leave any white spaces at the end of the file):
Code:
# top of file of last line of comments
@domain1.co.uk OK
@domain2.co.uk OK
@domain3.co.uk OK
@domain4.me.uk OK
@domain5.co.uk OK
@domain6.co.uk OK
~
~
~
This file should contain a complete list of the full e-mail addresses that this server will accept mail for.
In order to test this set just accepts all the e-mail for each domain.
When testing is complete this file should be updated (to a full list of complete e-mail addresses).
Run the postmap command on this file whenever it is change/modified/adjusted
# postmap /etc/postfix/relay_recipients
# vi /etc/postfix/transport
add these e-mail addresses to the end of this file (do not leave any white spaces at the end of the file):
Code:
# top of file of last line of comments
domain1.co.uk relay:[xx.xx.xxx.xx]
domain2.co.uk relay:[xx.xx.xxx.xx]
domain3.co.uk relay:[xx.xx.xxx.xx]
domain4.me.uk relay:[xx.xx.xxx.xx]
domain15.co.uk relay:[xx.xx.xxx.xx]
~
~
~
replace the xx.xx.xxx.xx ip adresses above with the ip addresses of the location that you want to transport mail to.
Run the postmap command on this file whenever it is change/modified/adjusted
# postmap /etc/postfix/transport
vi /etc/postfix/sender_access
Add the following and adjust alter add and uncomment as required:
Code:
#Example sender access map file
#massivespammer@mlm.net 550 No MLM thanks
#spamtastic.tld 550 Spam is not accepted here
#hackerguy.net REJECT
#comedyspam.com OK
Run the postmap command on this file whenever it is change/modified/adjusted
# postmap /etc/postfix/sender_access
# apt-get install sysv-rc-conf
# sysv-rc-conf
remove exim4 and mfs from booting in any run level
add postfix to boot in levels 2,3,4 and 5
# /etc/init.d/postfix start
# telnet 127.0.0.1 25
Useful commands:
Watch the log as mail is sent(ctrl c - to exit)
# tail -f /var/log/mail.log
sync postfix files file file postfix chroot dir
# LINUX2
check config
# postfix check
# mailq
# qshape
# qshape deferred
# postqueue -f
# postsuper -r ALL
Use iptables and secure ssh etc to restrict access to the server
Personally I would set your domain to use Linodes DNS servers as well.
Hope this helps.
jk