Postfix is one of the most popuar MTAs around. Postfix has a modular design that improve security,speed and east of configuration. In this design, a master daemon controls individual light weight processes (modules) that performs specific tasks. The master deamon binary is "/usr/sbin/postfix" and the daemon configuration file is /etc/postfix/mster.cf. But this file rarely needs change unless you need to enable / disable some sub processes(modules). The MTA configuration is in /etc/postfix/main.cf. There are other configuration files for specific purposes and all of them lies under the folder /etc/postfix. Following is a minimal configuration of main.cf that will let you run a postfix mail server for your own domain.
Most of the configuration parameters in main.cf will have a commented example version, you can either uncomment and edit them, or add a new line. I will just list out important configuration parameters with comments added. The example configuration is for running an MTA for safeer.in domain.
## The configuration file is in "key = value" format. The key defined previously in the file
## can be referred to as $key in the coming sections.
## The domain for which you are configuring MTA
mydomain = safeer.in
## FQDN of the mail server where postfix is being configured
myhostname = smtp.safeer.in
## The domain name that locally sent and received mail appears to be from and/or delivered to.
## When you are running mail server for a domain, set as follows, default if unset is to use hostname.
myorigin = $mydomain
## By default postfix listens only on loopback, make it listen an all interfaces.
inet_interfaces = all
## The SMTP server will accept mails to the email ids addressed to the following domains and/or hostnames.
## In our setup, this will include the mail server (smtp.safeer.in) and the mail domain safeer.in
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
## Define trusted networks from which clients can connect to the smtp server without any restrictions.
mynetworks = 192.168.4.0/24, 10.10.5.0/24
## Allow smtp clients only from $mytnetworks and reject un authorized clients
smtpd_recipient_restrictions = permit_mynetworks, reject_unauth_destination
This will get you started off with a minimal SMTP server. Make these changes and restart your postfix server.
sudo /usr/sbin/service postfix
Ensure postfix has started listening by running
sudo netstat -atnp|grep :25|grep LISTEN
To test your server is working from command line, visit this link
Test your SMTP server with telnet
To know more about postfix configuration parameters check the official website of postfix or look at the man page by running "man 5 postconf"
No comments:
Post a Comment