Now we have created the external files Postfix will use when connecting to the 'mail' database (see the previous article for details), we can carry on and edit the main Postfix configuration file.
The main Postfix configuration file is know as 'main.cf'.
Let's go ahead and edit that:
sudo nano /etc/postfix/main.cf
The default entries include the hostname that was set during the Postfix installation.
As such, the bottom part of the file looks like this:
myhostname = mail.demoslice.com alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases myorigin = /etc/mailname mydestination = relayhost = mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 mailbox_size_limit = 0 recipient_delimiter = + inet_interfaces = all
You will find the 'myhostname' and 'mydestination' already have the hostname set - you will need to remove any entries for the 'mydestination' field.
Now we need to add the details of the four files we created in the previous article so Postfix knows to refer to those in any mail execution.
At the bottom of the file add these lines:
virtual_alias_domains = virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-forwards.cf, mysql:/etc/postfix/mysql-email.cf virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-domains.cf virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-mailboxes.cf virtual_mailbox_base = /home/vmail virtual_uid_maps = static:5000 virtual_gid_maps = static:5000 proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps
You can see the references to the files we created and also the references to the 'vmail' user we created (where the mail is physically located).
The last line lets Postfix know what to search for in a mail domain to get the relevant details for the database query.
Now we have Postfix configured to query the database whenever needed.
The next article concentrates on configuring saslauthd for our secure connections.