Enjoy Slackware 15.0!
Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
howtos:network_services:postfix_dovecot_mysql:postfix [2015/02/16 01:26 (UTC)] astrogeek |
howtos:network_services:postfix_dovecot_mysql:postfix [2018/10/08 02:14 (UTC)] (current) astrogeek [Configuring The Postfix MTA] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== Installing The Postfix MTA ===== | + | ====== Installing The Postfix MTA ====== |
- | <note important> | + | This page is supplemental to main article: [[howtos: |
Postfix is a popular and secure mail transport agent, or MTA. | Postfix is a popular and secure mail transport agent, or MTA. | ||
Line 41: | Line 41: | ||
Copy the package file to the target platform if necessary and install: | Copy the package file to the target platform if necessary and install: | ||
< | < | ||
- | ===== Configuring The Postfix MTA ===== | + | ====== Configuring The Postfix MTA ====== |
- | You should | + | |
+ | You must become familiar with the [[http:// | ||
+ | |||
+ | <note important> | ||
What follows is a minimum configuration to safely operate a virtual email server on the internet, but you will surely want to adapt it to your specific needs. | What follows is a minimum configuration to safely operate a virtual email server on the internet, but you will surely want to adapt it to your specific needs. | ||
Line 57: | Line 60: | ||
vi / | vi / | ||
- | //Uncomment the following lines...// | + | # Uncomment the following lines # |
smtp inet n | smtp inet n | ||
submission inet n | submission inet n | ||
Line 70: | Line 73: | ||
vi / | vi / | ||
- | //Now enter the following lines...// | + | # Enter the following lines # |
mynetworks_style = host | mynetworks_style = host | ||
myorigin = $mydomain | myorigin = $mydomain | ||
- | #Change my-domain.com to the actual domain name of your server | + | # Change my-domain.com to the actual domain name of your server |
mydomain = my-domain.com | mydomain = my-domain.com | ||
- | # | + | # mydestination must be localhost only to allow postfix to deliver non-virtual system mail # |
mydestination = localhost | mydestination = localhost | ||
#IMPORTANT - relay_domains should be empty to prevent your server from becoming a spam relay! | #IMPORTANT - relay_domains should be empty to prevent your server from becoming a spam relay! | ||
#If you actually need to relay to other domains READ THE DOCUMENTATION CAREFULLY! | #If you actually need to relay to other domains READ THE DOCUMENTATION CAREFULLY! | ||
- | relay_domains = | + | relay_domains = |
+ | # We have no local users, so no local notifications # | ||
biff = no | biff = no | ||
- | append_dot_mydomain = no | ||
</ | </ | ||
Now we need to configure the secure aspects of our mail server, again in main.cf: | Now we need to configure the secure aspects of our mail server, again in main.cf: | ||
- | |||
< | < | ||
vi / | vi / | ||
- | //Enter the following lines...// | + | # Enter the following lines # |
- | #SSL certificates will be created at these locations when we configure dovecot | + | # SSL certificates will be created at these locations when we configure dovecot |
smtpd_tls_cert_file = / | smtpd_tls_cert_file = / | ||
- | smtpd_tls_key_file = /etc/ssl/localcerts/dove.key | + | smtpd_tls_key_file = /etc/ssl/private/dove.key |
#Accept only secure smtp connections | #Accept only secure smtp connections | ||
Line 119: | Line 121: | ||
vi / | vi / | ||
- | //Enter the following lines...// | + | # Enter the following lines # |
#Tell postfix to use dovecot lmtp for virtual mail delivery | #Tell postfix to use dovecot lmtp for virtual mail delivery | ||
Line 129: | Line 131: | ||
virtual_alias_maps = mysql:/ | virtual_alias_maps = mysql:/ | ||
- | #Set localhost | + | #Set localhost |
alias_maps = hash:/ | alias_maps = hash:/ | ||
</ | </ | ||
- | The last four files do not yet exist on the system and so, must be created. The virtual | + | The last four files do not yet exist on the system and so, must be created. The files prefixed with " |
First we must tell postfix how to identify which virtual domains it handles mail for by providing a proper query of the virtual database. This query must return true if the domain is in the database: | First we must tell postfix how to identify which virtual domains it handles mail for by providing a proper query of the virtual database. This query must return true if the domain is in the database: | ||
Line 140: | Line 142: | ||
vi / | vi / | ||
- | //Enter the following lines...// | + | # Enter the following lines # |
user= mailuser | user= mailuser | ||
password = {your mailuser password} | password = {your mailuser password} | ||
- | host = localhost | + | hosts = localhost |
dbname = mailserver | dbname = mailserver | ||
query = SELECT 1 FROM virtual_domains WHERE name=' | query = SELECT 1 FROM virtual_domains WHERE name=' | ||
Line 154: | Line 155: | ||
This will return true (1) if the domain is found, NULL if not found, and an error message if the query or connection is not correctly configured. | This will return true (1) if the domain is found, NULL if not found, and an error message if the query or connection is not correctly configured. | ||
+ | |||
+ | Also note that other database connection options are available, for example if you are connecting to a remote database server, or multiple servers. See the mysql_table man page from the postfix package for complete connect parameter information. | ||
Next, we must tell postfix how to identify valid virtual mail box users. This query must also only return true if the mail box exists in the database. | Next, we must tell postfix how to identify valid virtual mail box users. This query must also only return true if the mail box exists in the database. | ||
Line 160: | Line 163: | ||
vi / | vi / | ||
- | //Enter the following lines...// | + | # Enter the following lines # |
user= mailuser | user= mailuser | ||
password = {your mailuser password} | password = {your mailuser password} | ||
- | host = localhost | + | hosts = localhost |
dbname = mailserver | dbname = mailserver | ||
query = SELECT 1 FROM virtual_users WHERE email=' | query = SELECT 1 FROM virtual_users WHERE email=' | ||
Line 178: | Line 180: | ||
vi / | vi / | ||
- | //Enter the following lines...// | + | # Enter the following lines # |
user= mailuser | user= mailuser | ||
password = {your mailuser password} | password = {your mailuser password} | ||
- | host = localhost | + | hosts = localhost |
dbname = mailserver | dbname = mailserver | ||
query = SELECT destination FROM virtual_aliases WHERE source=' | query = SELECT destination FROM virtual_aliases WHERE source=' | ||
Line 196: | Line 197: | ||
vi / | vi / | ||
- | //Enter the following lines...// | + | # Enter the following lines # |
postmaster: root | postmaster: root | ||
- | root: myself | + | root: root |
</ | </ | ||
- | After creating the aliases file, you must use the postmap | + | After creating the aliases file, you must use the newaliases |
- | < | + | < |
This will create the file / | This will create the file / | ||
Line 210: | Line 211: | ||
[[howtos: | [[howtos: | ||
+ | |||
+ | ====== Sources ====== | ||
+ | * Based primarily on [[http:// | ||
+ | * Originally written by [[wiki: | ||
{{tag> | {{tag> |