Hello friends,

I followed a HOWTO document and it wasn't an entire success.  I do want to be 
more proficient with Postfix and have bought The Book of Postfix from No Starch 
and Postfix: The Definitive Guide from O'Reilly.  I've spent about 15 hours in 
each book, so hopefully I have a vague idea of how it works.

The HOWTO is:

https://www.digitalocean.com/community/tutorials/how-to-configure-a-mail-server-using-postfix-dovecot-mysql-and-spamassasin

For the sake of privacy, hereafter the domains concerned will be example.org 
and example.com.

There are two things I deviated from in this document.  First, I chose not to 
use the StartSLL.com keys (not even for free) due to the dim reputation of that 
firm.  I decided to stay with what was given to me. Secondly, I decided to omit 
SpamAssassin.  Continuing onwards, will be an installation of Squirrelmail.  
All this is built on a Droplet VM running Ubuntu 14.04.


No surprise, it didn't quite work.  In fact, I got more bytes dropped in 
mail.log and syslog than any of the queues (which are apparently still empty).

I'll show the preliminary files in /etc that are cited in main.cf

/etc/hostname
# begin /etc/hostname
  example.com
# eof

/etc/mailname
# begin /etc/mailname
  example.com
# eof


I tested the SQL lookups and they do work.  I tested the negative cases too 
using nonexistent domains (example.net) or email addresses (phony).

root@example:/etc/postfix#  postmap -q example.com 
mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
1
root@example:/etc/postfix#  postmap -q example.org 
mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
1
root@example:/etc/postfix#  postmap -q example.net 
mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
root@example:/etc/postfix#  postmap -q ph...@example.com 
mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
root@example:/etc/postfix#  postmap -q b...@example.com 
mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
1
root@example:/etc/postfix#  postmap -q i...@example.com 
mysql:/etc/postfix/mysql-virtual-alias-maps.cf
b...@example.com
root@example:/etc/postfix#  postmap -q ph...@example.com 
mysql:/etc/postfix/mysql-virtual-alias-maps.cf


And now here is my main.cf.   I tried to be as descriptive of the reasoning as 
I could in the commenting.  While I may ask questions in the comments, it would 
probably be more aesthetic to not reply inline with the file, but I can't be 
picky with how I receive help.  I tested the SQL lookups and they do work.



# 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 (Ubuntu)
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

# I commented some of these to comply with the HOWTO, but the 
# howto specifies using StartSSL.com, which I hear elsewhere is
# a bad idea, so I actually wish to use the files that were
# provided
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
# smtpd_use_tls=yes
# smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
# smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
# end comment

# As stated before, I don't want to use the StartSSL.com keys
# so these are commented out and I left the defaults open above
#smtpd_tls_cert_file=/etc/ssl/certs/dovecot.pem
#smtpd_tls_key_file=/etc/ssl/private/dovecot.pem
smtpd_use_tls=yes
smtpd_tls_auth_only = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_recipient_restrictions =
        permit_sasl_authenticated,
        permit_mynetworks,
        reject_unauth_destination

# This is the end of the encryption part of the postfix howto

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated 
defer_unauth_destination

# Verified that myhostname is set to the FQDN, and it is
myhostname = example.com
# End of verified myhostname section


# There is a table in MySQL that stores the aliases so are
# these next two lines even relevant???
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname

# I was asked to modify this parameter
#mydestination = example.com, localhost.com, , localhost
mydestination = localhost
# end of this modified section

relayhost = 
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all

# I added this, 
#   "for local mail delivery to all virtual domains listed
#    inside the MySQL table"
virtual_transport = lmtp:unix:private/dovecot-lmtp

# I added these,
#   "to tell Postfix to configure the virtual domains, users
#    and aliases."
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf
# end section of added parameters concerning the virtual stuff

# eof

So when I send a test email from my MacBook using mail in the command line, I 
get these in mail.log.  I get many, many of these.  For now, I'm mainly 
concerned with the postfix error.  The Dovecot stuff, I can refer to their list 
once the Postfix is in good shape.  The /var/spool/ and /var/mail/ directories 
seem to be unchanged, which is a bit disturbing (maybe a permissions problem?)

Dec 12 21:52:06 example postfix/qmgr[29911]: 21EDCC08A3: 
from=<gary@Garys-MacBook-Pro.local>, size=578, nrcpt=1 (queue active)
Dec 12 21:52:06 example dovecot: lmtp(30139): Connect from local
Dec 12 21:52:06 example dovecot: lmtp(30139, b...@example.com): Error: user 
b...@example.com: Initialization failed: namespace configuration error: 
inbox=yes namespace missing
Dec 12 21:52:06 example dovecot: lmtp(30139): Disconnect from local: Successful 
quit
Dec 12 21:52:06 example postfix/lmtp[30138]: 21EDCC08A3: to=<b...@example.com>, 
relay=example.com[private/dovecot-lmtp], delay=1021, 
delays=1021/0.02/0.02/0.04, dsn=4.3.0, status=deferred (host 
example.com[private/dovecot-lmtp] said: 451 4.3.0 <b...@example.com> Temporary 
internal error (in reply to end of DATA command))



What are your thoughts.  My apologies for such a long and detailed e-mail.  If 
there are suggestions for me to make this more compact, I am willing to try to 
make this more readable.

Thanks to all whom have made it down to here :)

Reply via email to