{"id":57,"date":"2007-03-01T09:25:58","date_gmt":"2007-03-01T17:25:58","guid":{"rendered":"http:\/\/blog.11h.net\/brian\/57"},"modified":"2007-03-01T09:25:58","modified_gmt":"2007-03-01T17:25:58","slug":"postfix","status":"publish","type":"post","link":"https:\/\/11h.net\/blog\/postfix\/","title":{"rendered":"Postfix"},"content":{"rendered":"<p>w00t!  I finally got the <a title=\"Postfix\" href=\"http:\/\/www.postfix.org\/\">Postfix<\/a> MTA running on my home network!  I was using qmail on my old faithful Slackware 9.0 router, decided against using it again since it was a bit complex for my needs.  Postfix is simple, very configurable, and lets me use a MySQL database for all of my virtual e-mail clients!<\/p>\n<p>Unfortunately, like most Linux MTA&#8217;s, documentation and tutorials that somebody with no formal knowledge of e-mail servers are a bit hard to find.  After reading nearly all of the Postfix docs and several random tutorials and howto&#8217;s, I finally got a setup that works perfectly for my needs.  And I&#8217;ll be adding server-side spam checking in the future, too!<\/p>\n<p>Basically, I installed the following on my <a title=\"Slackware\" href=\"http:\/\/www.slackware.org\/\">Slackware<\/a> 11.0 server, which is a dual-processor, dual-core Xeon 3.6GHz system with hyper-threading, 4GB RAM, 1TB+ of HD space, and lots of little goodies:<\/p>\n<ul>\n<li>Postfix 2.4 (2007-02-24 CVS snapshot)<\/li>\n<li><a title=\"Courier-IMAP\" href=\"http:\/\/www.courier-mta.org\/imap\/\">Courier-IMAP<\/a><\/li>\n<li><a title=\"Courier-Authlib\" href=\"http:\/\/www.courier-mta.org\/authlib\/\">Courier-Authlib<\/a><\/li>\n<li><a title=\"RoundCube\" href=\"http:\/\/www.roundcube.net\/\">RoundCube<\/a> Webmail<\/li>\n<\/ul>\n<p>Below are very brief notes of how I installed it.  I already installed MySQL 5, PHP5, and Apache2 a while back so they were already in working order.  I didn&#8217;t want quotas (yes, I have plenty of space for my 3 users), and don&#8217;t care (as of yet) about SSL.<br \/>\n<span style=\"font-weight: bold\" \/><span style=\"font-weight: bold\"><br \/>\nPreparations<\/span><\/p>\n<p>Create a MySQL database for postfix give privileges in the database for a postfix user.  I set my database up like this, but you&#8217;ll (and I&#8217;ll) probably want to add some additional fields, like IDs, and relationship fields, like Domain, to be shared between the tables (make queries from a management script, for example, much easier and logical).<\/p>\n<h2 style=\"font-weight: normal; font-style: italic\"><font size=\"2\">Table structure for table alias<\/font><\/h2>\n<div>\n<table cellspacing=\"1\" cellpadding=\"0\" border=\"1\">\n<tr>\n<td style=\"padding: 0.75pt\">\n<p align=\"center\" style=\"text-align: center\" class=\"MsoNormal\"><strong>Field<\/strong><\/p>\n<\/td>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\"><strong>Type<\/strong><\/p>\n<\/td>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\"><strong>Null<\/strong><\/p>\n<\/td>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\"><strong>Default<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\"><strong><em>address<\/em><\/strong><\/p>\n<\/td>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\">varchar(255)<\/p>\n<\/td>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\">Yes<\/p>\n<\/td>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\">\n<\/td>\n<\/tr>\n<tr>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\">goto<\/p>\n<\/td>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\">text<\/p>\n<\/td>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\">Yes<\/p>\n<\/td>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\">\n<\/td>\n<\/tr>\n<tr>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\">active<\/p>\n<\/td>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\">tinyint(1)<\/p>\n<\/td>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\">Yes<\/p>\n<\/td>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\">1<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p>I set a few aliases like this:<\/p>\n<div>\n<table width=\"499\" cellspacing=\"0\" cellpadding=\"3\" border=\"1\" style=\"height: 98px\">\n<tr>\n<td style=\"vertical-align: top; font-weight: bold\">address<\/td>\n<td style=\"vertical-align: top; font-weight: bold\">goto<\/td>\n<td style=\"vertical-align: top; font-weight: bold\">active<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 33%\">postmaster@11h.net<\/td>\n<td style=\"width: 33%\">joe123@11h.net<\/td>\n<td style=\"width: 33%\">1<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 33%\">logs@11h.net<\/td>\n<td style=\"width: 33%\">joe123@11h.net<\/td>\n<td style=\"width: 33%\">1<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 33%\">@myserversname.11h.net<\/td>\n<td style=\"width: 33%\">@11h.net<\/td>\n<td style=\"width: 33%\">1<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p>That last one will keep the username the same changing only the virtual domain it is redirected to.  The first two simply redirect postmaster and logs to the e-mail joe123@11h.net.<\/p>\n<h2 style=\"font-weight: normal; font-style: italic\"><font size=\"2\">Table structure for table domain<\/font><\/h2>\n<div>\n<table cellspacing=\"1\" cellpadding=\"0\" border=\"1\">\n<tr>\n<td style=\"padding: 0.75pt\">\n<p align=\"center\" style=\"text-align: center\" class=\"MsoNormal\"><strong>Field<\/strong><\/p>\n<\/td>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\"><strong>Type<\/strong><\/p>\n<\/td>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\"><strong>Null<\/strong><\/p>\n<\/td>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\"><strong>Default<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\"><strong><em>domain<\/em><\/strong><\/p>\n<\/td>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\">varchar(255)<\/p>\n<\/td>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\">Yes<\/p>\n<\/td>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\">\n<\/td>\n<\/tr>\n<tr>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\">active<\/p>\n<\/td>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\">tinyint(1)<\/p>\n<\/td>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\">Yes<\/p>\n<\/td>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\">1<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p>My 2 domains are merely &#8220;11h.net&#8221; and &#8220;myserversname.11h.net&#8221;.  If you host any other domains, add them here.<\/p>\n<h2 style=\"font-weight: normal; font-style: italic\"><font size=\"2\">Table structure for table mailbox<\/font><\/h2>\n<div>\n<table cellspacing=\"1\" cellpadding=\"0\" border=\"1\">\n<tr>\n<td style=\"padding: 0.75pt\">\n<p align=\"center\" style=\"text-align: center\" class=\"MsoNormal\"><strong>Field<\/strong><\/p>\n<\/td>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\"><strong>Type<\/strong><\/p>\n<\/td>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\"><strong>Null<\/strong><\/p>\n<\/td>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\"><strong>Default<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\"><strong><em>username<\/em><\/strong><\/p>\n<\/td>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\">varchar(255)<\/p>\n<\/td>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\">Yes<\/p>\n<\/td>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\">\n<\/td>\n<\/tr>\n<tr>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\">password<\/p>\n<\/td>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\">varchar(255)<\/p>\n<\/td>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\">Yes<\/p>\n<\/td>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\">\n<\/td>\n<\/tr>\n<tr>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\">name<\/p>\n<\/td>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\">varchar(255)<\/p>\n<\/td>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\">Yes<\/p>\n<\/td>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\">\n<\/td>\n<\/tr>\n<tr>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\">maildir<\/p>\n<\/td>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\">varchar(255)<\/p>\n<\/td>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\">Yes<\/p>\n<\/td>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\">\n<\/td>\n<\/tr>\n<tr>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\">active<\/p>\n<\/td>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\">tinyint(1)<\/p>\n<\/td>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\">Yes<\/p>\n<\/td>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\">1<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p>This one gets a little more complicated because of the password field.  Here&#8217;s an example for &#8220;joe123&#8221;:<\/p>\n<p style=\"margin-left: 40px\">username:  joe123@11h.net<\/p>\n<p style=\"margin-left: 40px\">password:  $1$WmD\/q3et$Hiz97VoENZ0q2Lm49V3ax.<\/p>\n<p style=\"margin-left: 40px\">name:  Joe User<\/p>\n<p style=\"margin-left: 40px\">maildir:  joe123@11h.net\/<\/p>\n<p style=\"margin-left: 40px\">active:  1<\/p>\n<p>First, the username is the full e-mail address.<\/p>\n<p>Second, the password is in hashed form.  For the most part, Courier-IMAP can recognize these types of passwords, depending on what they look like in the database  (from man pages):<\/p>\n<ul>\n<li>A traditional triple-DES crypted password, or a MD5+salt-hashed password, as used in Linux.<\/li>\n<li><span class=\"QUOTE\">&#8220;{MD5}&#8221;<\/span> followed by a base64-encoded MD5 hash of the password.<\/li>\n<li><span class=\"QUOTE\">&#8220;{SHA}&#8221;<\/span> followed by a base64-encoded SHA1 hash of the password.<\/li>\n<\/ul>\n<p>In my case, since I was &#8220;upgrading&#8221; from qmail on one server to postfix on this server, I simply copied the users passwords on the old system from \/etc\/shadow.  For new users, its easier to just use MySQL&#8217;s ENCRYPT function.  The password in my example above is from \/etc\/shadow for an old user, it is the hash of &#8220;example&#8221;.<\/p>\n<p>Third, maildir is the directory under \/var\/spool\/postfix\/virtual where the user&#8217;s e-mail is stored.  <span style=\"font-weight: bold\">This must end with a slash<\/span> for it to be in &#8220;Maildir&#8221; format.  I simply use the e-mail address, others may wish to separate them into domains.  For example: &#8220;11h.net\/joe123\/&#8221;.<\/p>\n<p>Finally, 1 in active indicates this e-mail can receive mail&#8230;<\/p>\n<h2 style=\"font-weight: normal; font-style: italic\"><font size=\"2\">Table structure for table transport<\/font><\/h2>\n<div>\n<table cellspacing=\"1\" cellpadding=\"0\" border=\"1\">\n<tr>\n<td style=\"padding: 0.75pt\">\n<p align=\"center\" style=\"text-align: center\" class=\"MsoNormal\"><strong>Field<\/strong><\/p>\n<\/td>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\"><strong>Type<\/strong><\/p>\n<\/td>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\"><strong>Null<\/strong><\/p>\n<\/td>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\"><strong>Default<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\"><strong><em>domain<\/em><\/strong><\/p>\n<\/td>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\">varchar(255)<\/p>\n<\/td>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\">Yes<\/p>\n<\/td>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\">\n<\/td>\n<\/tr>\n<tr>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\">transport<\/p>\n<\/td>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\">varchar(128)<\/p>\n<\/td>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\">Yes<\/p>\n<\/td>\n<td style=\"padding: 0.75pt\">\n<p class=\"MsoNormal\">\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p>I also created a user account and group &#8220;postfix&#8221; (for the postfix daemon&#8217;s to run as), a group (no associated user) named &#8220;postdrop&#8221;, and a user account and group &#8220;vmail&#8221; (the owner of the Maildirs in \/var\/spool\/postfix\/virtual\/).<\/p>\n<p><span style=\"font-weight: bold\">Courier-Auth<\/span><\/p>\n<p>Did a usual install according to the instructions.  The .\/configure script auto-detected MySQL and whatever else it needed.  It installed to the \/usr\/local prefix and stuck its configuration files in \/usr\/local\/etc\/authlib (don&#8217;t forget to rename the copied files so as to lose the .dist extension).  Its daemon was put in \/usr\/local\/sbin, but I start it via the scripts it put in \/usr\/local\/libexec\/courier-authlib.<\/p>\n<p>In the authdaemonrc configuration file, I just set the authmodulelist to only include &#8220;authmysql&#8221;.  I don&#8217;t want my local system users to have e-mail; only virtual addresses stored in the mysql table, so this works out for me.<\/p>\n<p>In authmysqlrc, I basically set it up with these settings:<\/p>\n<div style=\"margin-left: 40px\"><span style=\"font-family: Courier New\">MYSQL_SERVER            localhost<\/span><br style=\"font-family: Courier New\" \/> <span style=\"font-family: Courier New\">MYSQL_USERNAME          postfix<\/span><br style=\"font-family: Courier New\" \/> <span style=\"font-family: Courier New\">MYSQL_PASSWORD          password<\/span><br style=\"font-family: Courier New\" \/> <span style=\"font-family: Courier New\">MYSQL_DATABASE          postfix<\/span><br style=\"font-family: Courier New\" \/> <span style=\"font-family: Courier New\">MYSQL_USER_TABLE        mailbox<\/span><br style=\"font-family: Courier New\" \/> <span style=\"font-family: Courier New\">MYSQL_CRYPT_PWFIELD     password<\/span><br style=\"font-family: Courier New\" \/> <span style=\"font-family: Courier New\">DEFAULT_DOMAIN          11h.net<\/span><br style=\"font-family: Courier New\" \/> <span style=\"font-family: Courier New\">MYSQL_UID_FIELD         &#8216;1006&#8217;<\/span><br style=\"font-family: Courier New\" \/> <span style=\"font-family: Courier New\">MYSQL_GID_FIELD         &#8216;107&#8217;<\/span><br style=\"font-family: Courier New\" \/> <span style=\"font-family: Courier New\">MYSQL_LOGIN_FIELD       username<\/span><br style=\"font-family: Courier New\" \/> <span style=\"font-family: Courier New\">MYSQL_HOME_FIELD        &#8216;\/var\/spool\/postfix\/virtual&#8217;<\/span><br style=\"font-family: Courier New\" \/> <span style=\"font-family: Courier New\">MYSQL_NAME_FIELD        name<\/span><br style=\"font-family: Courier New\" \/> <span style=\"font-family: Courier New\">MYSQL_MAILDIR_FIELD     maildir<\/span><br style=\"font-family: Courier New\" \/> <br style=\"font-family: Courier New\" \/> <span style=\"font-family: Courier New\"># MYSQL_CLEAR_PWFIELD   clear<\/span><\/div>\n<p><span style=\"font-weight: bold\"><br \/>\n<\/span>Essentially, the way this configuration file works, for the fields, is it wants the name of the Database field.  If the entry is &#8220;static&#8221; (i.e. don&#8217;t look it up in the database, but specify the value directly in the file) it is enclosed in single-quotes (&#8221;).  So the authdaemon will obtain the Mailbox information from the &#8220;mailbox&#8221; table in the &#8220;postfix&#8221; SQL database.  Within that table, the user&#8217;s hashed (encrypted) password in the &#8220;password&#8221; field, the user&#8217;s username\/e-mail address in the &#8220;username&#8221; field, the user&#8217;s real name in the &#8220;name&#8221; field, and the user&#8217;s Maildir directory in the filesystem in the &#8220;maildir&#8221; field.  The UID and GUI on my system are 1006 and 107, which are for the &#8220;vmail&#8221; system user account and group.  This is who the maildir directory is owned by &#8212; it shouldn&#8217;t be readable by anybody except this user.<\/p>\n<p>The default domain is specified so the user&#8217;s may log in as &#8220;joe123&#8221; instead of having to specify &#8220;joe123@11h.net&#8221;.  I also left out the clear password field since I don&#8217;t consider it good practice to store plain-text user passwords inside a database (or anywhere for that matter).  Note that this does, however, sacrifice the ability to use <a title=\"CRAM-MD5 Authentication\" href=\"http:\/\/www.courier-mta.org\/imap\/INSTALL.html#crammd5\">CRAM-MD5 Authentication<\/a>.<\/p>\n<p><span style=\"font-weight: bold\">Courier-IMAP<\/span><\/p>\n<p>Did the usual install in accordance w\/ the instructions&#8230; well almost, one of the tutorials I read said to compile it like this:<\/p>\n<div style=\"margin-left: 40px\"><span style=\"font-family: Courier New\">$ .\/configure &#8211;prefix=\/usr\/local\/courier &#8211;enable-unicode<br \/>\n<\/span><\/div>\n<p>So it stuck everything in its own directory.  How nice.  The daemons are started from \/usr\/local\/courier\/libexec, and the configurations in \/usr\/local\/courier\/etc.  Don&#8217;t forget to rename the default config files as you had to do with the authdaemon.<\/p>\n<p style=\"text-align: justify\">In the etc dir, Peek thru &#8220;imapd&#8221; and make sure it all looks good.  Options to pay attention are, as I did:<\/p>\n<div style=\"margin-left: 40px\">DEFDOMAIN=&#8221;@11h.net&#8221;<br \/>\nIMAP_CAPABILITY=&#8221;IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE&#8221;<br \/>\nIMAP_IDLE_TIMEOUT=5<br \/>\nIMAP_EMPTYTRASH=Trash:90<br \/>\nIMAP_MOVE_EXPUNGE_TO_TRASH=1<br \/>\nIMAPDSTART=YES<\/div>\n<p>On the capabilities part, you&#8217;ll want to use the other one if you store a clear-text password and want CRAM-MD5 authentication.  I didn&#8217;t care, so I left it as that.  Also, configure pop3d if you want that, too.<\/p>\n<p><span style=\"font-weight: bold\"> Postfix<\/span><\/p>\n<p>I&#8217;m sure I did a pretty basic installation, which picked up on MySQL and everything I needed.  Configuring it was the most difficult for me since I had (well still have) no idea how this MTA even works.<\/p>\n<p>Once installed, at least the way I set it up, the configuration files are in \/etc\/postfix, and mail spool stuff in \/var\/spool\/postfix.  I created a directory in there called &#8220;virtual&#8221; which is where all the e-mail goes.<\/p>\n<p>First, I renamed all the config files to get rid of the &#8220;dist&#8221; or &#8220;.default&#8221; extensions.  Then I edited &#8220;main.cf&#8221; to contain something like this:<\/p>\n<div style=\"margin-left: 40px\"><font size=\"1\"><span style=\"font-family: Courier New\">queue_directory = \/var\/spool\/postfix<\/span><br style=\"font-family: Courier New\" \/>  <span style=\"font-family: Courier New\">command_directory = \/usr\/sbin<\/span><br style=\"font-family: Courier New\" \/>  <span style=\"font-family: Courier New\">daemon_directory = \/usr\/libexec\/postfix<\/span><br style=\"font-family: Courier New\" \/>  <span style=\"font-family: Courier New\">mail_owner = postfix<\/span><br style=\"font-family: Courier New\" \/>  <span style=\"font-family: Courier New\">myhostname = mail.11h.net<\/span><br style=\"font-family: Courier New\" \/>  <span style=\"font-family: Courier New\">mydomain = 11h.net<\/span><br style=\"font-family: Courier New\" \/>  <span style=\"font-family: Courier New\">myorigin = $mydomain<\/span><br style=\"font-family: Courier New\" \/>  <span style=\"font-family: Courier New\">local_recipient_maps = $virtual_mailbox_maps<\/span><br style=\"font-family: Courier New\" \/>  <span style=\"font-family: Courier New\">unknown_local_recipient_reject_code = 550<\/span><br style=\"font-family: Courier New\" \/>  <span style=\"font-family: Courier New\">mynetworks_style = host<\/span><br style=\"font-family: Courier New\" \/>  <span style=\"font-family: Courier New\">mynetworks = 10.0.0.0\/16, 127.0.0.0\/8<\/span><br style=\"font-family: Courier New\" \/>  <span style=\"font-family: Courier New\">relayhost = [my.isps.mail.server]<\/span><br style=\"font-family: Courier New\" \/>  <span style=\"font-family: Courier New\">home_mailbox = Maildir\/<\/span><br style=\"font-family: Courier New\" \/>  <span style=\"font-family: Courier New\">debug_peer_level = 2<\/span><br style=\"font-family: Courier New\" \/>  <span style=\"font-family: Courier New\">debugger_command =<\/span><br style=\"font-family: Courier New\" \/>  <span style=\"font-family: Courier New\">         PATH=\/bin:\/usr\/bin:\/usr\/local\/bin:\/usr\/X11R6\/bin<\/span><br style=\"font-family: Courier New\" \/>  <span style=\"font-family: Courier New\">         xxgdb $daemon_directory\/$process_name $process_id &#038; sleep 5<\/span><br style=\"font-family: Courier New\" \/>  <span style=\"font-family: Courier New\">sendmail_path = \/usr\/sbin\/sendmail<\/span><br style=\"font-family: Courier New\" \/>  <span style=\"font-family: Courier New\">newaliases_path = \/usr\/bin\/newaliases<\/span><br style=\"font-family: Courier New\" \/>  <span style=\"font-family: Courier New\">mailq_path = \/usr\/bin\/mailq<\/span><br style=\"font-family: Courier New\" \/>  <span style=\"font-family: Courier New\">setgid_group = postdrop<\/span><br style=\"font-family: Courier New\" \/>  <span style=\"font-family: Courier New\">html_directory = no<\/span><br style=\"font-family: Courier New\" \/>  <span style=\"font-family: Courier New\">manpage_directory = \/usr\/local\/man<\/span><br style=\"font-family: Courier New\" \/>  <span style=\"font-family: Courier New\">sample_directory = \/etc\/postfix<\/span><br style=\"font-family: Courier New\" \/>  <span style=\"font-family: Courier New\">readme_directory = no<\/span><br style=\"font-family: Courier New\" \/>  <span style=\"font-family: Courier New\">local_transport = virtual:11h.net<\/span><br style=\"font-family: Courier New\" \/>  <span style=\"font-family: Courier New\">transport_maps = mysql:\/etc\/postfix\/mysql_transport_maps.cf<\/span><br style=\"font-family: Courier New\" \/>  <span style=\"font-family: Courier New\">virtual_alias_maps = mysql:\/etc\/postfix\/mysql_virtual_alias_maps.cf<\/span><br style=\"font-family: Courier New\" \/>  <span style=\"font-family: Courier New\">virtual_gid_maps = static:107<\/span><br style=\"font-family: Courier New\" \/>  <span style=\"font-family: Courier New\">virtual_mailbox_base = \/var\/spool\/postfix\/virtual<\/span><br style=\"font-family: Courier New\" \/>  <span style=\"font-family: Courier New\">virtual_mailbox_domains = mysql:\/etc\/postfix\/mysql_virtual_domains_maps.cf<\/span><br style=\"font-family: Courier New\" \/> <span style=\"font-family: Courier New\">virtual_mailbox_limit = 1073741824<\/span><br style=\"font-family: Courier New\" \/> <span style=\"font-family: Courier New\">virtual_mailbox_maps = mysql:\/etc\/postfix\/mysql_virtual_mailbox_maps.cf<\/span><br style=\"font-family: Courier New\" \/> <span style=\"font-family: Courier New\">virtual_minimum_uid = 1006<\/span><br style=\"font-family: Courier New\" \/> <span style=\"font-family: Courier New\">virtual_transport = virtual<\/span><br style=\"font-family: Courier New\" \/> <span style=\"font-family: Courier New\">virtual_uid_maps = static:1006<\/span><br style=\"font-family: Courier New\" \/> <span style=\"font-family: Courier New\">message_size_limit = 268435456<\/span><\/font><\/div>\n<p>Phew, the most important ones are at the bottom&#8230; note that I set my &#8220;local&#8221; transport to always assume a virtual transport with @11h.net as the defaut domain (so e-mails to &#8220;joe123&#8221; and &#8220;joe123@11h.net&#8221; both go to joe123@11h.net rather than attempt the linux system account &#8220;joe123&#8221;).  I also set obsenly high message size limits.  Make sure to set the virtual_gid_maps, virtual_uid_maps, and virtual_minimum_uid to the user\/group ID of &#8220;vmail&#8221;, as they&#8217;re used to write to the Maildir directories to deliver mail.<\/p>\n<p>The extra files I created are these:<\/p>\n<div style=\"margin-left: 40px\">\n<div>\n<table width=\"384\" cellspacing=\"0\" cellpadding=\"3\" border=\"1\" style=\"height: 698px\">\n<tr>\n<td style=\"width: 100%\"><span style=\"font-weight: bold\">mysql_relay_domains_maps.cf<\/span><\/td>\n<\/tr>\n<tr>\n<td style=\"width: 100%\"><font size=\"1\"><span style=\"font-family: Courier New\">user = postfix<\/span><br style=\"font-family: Courier New\" \/> <span style=\"font-family: Courier New\">password = password<\/span><br style=\"font-family: Courier New\" \/> <span style=\"font-family: Courier New\">hosts = localhost<\/span><br style=\"font-family: Courier New\" \/> <span style=\"font-family: Courier New\">dbname = postfix<\/span><br style=\"font-family: Courier New\" \/> <span style=\"font-family: Courier New\">table = domain<\/span><br style=\"font-family: Courier New\" \/> <span style=\"font-family: Courier New\">select_field = domain<\/span><br style=\"font-family: Courier New\" \/> <span style=\"font-family: Courier New\">where_field = domain<\/span><br style=\"font-family: Courier New\" \/> <span style=\"font-family: Courier New\">additional_conditions = and backupmx = &#8216;1&#8217;<\/span><\/font><\/td>\n<\/tr>\n<tr>\n<td style=\"width: 100%\"><span style=\"font-weight: bold\">mysql_transport_maps.cf<\/span><\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align: top\"><font size=\"1\" style=\"font-family: Courier New\">user=postfix<br \/>\npassword=<\/font><font size=\"1\"><span style=\"font-family: Courier New\">password<\/span><\/font><br \/>\n<font size=\"1\" style=\"font-family: Courier New\">dbname=postfix<br \/>\nhosts=localhost<br \/>\ntable=transport<br \/>\nselect_field=transport<br \/>\nwhere_field=domain<\/font><\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align: top\"><span style=\"font-weight: bold\">mysql_virtual_alias_maps.cf<\/span><\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align: top\"><font size=\"1\"><span style=\"font-family: Courier New\">user = postfix<\/span><br style=\"font-family: Courier New\" \/> <span style=\"font-family: Courier New\">password = <\/span><\/font><font size=\"1\"><span style=\"font-family: Courier New\">password<\/span><\/font><font size=\"1\"><span style=\"font-family: Courier New\"><br style=\"font-family: Courier New\" \/> <\/span><span style=\"font-family: Courier New\">hosts = localhost<\/span><br style=\"font-family: Courier New\" \/> <span style=\"font-family: Courier New\">dbname = postfix<\/span><br style=\"font-family: Courier New\" \/> <span style=\"font-family: Courier New\">table = alias<\/span><br style=\"font-family: Courier New\" \/> <span style=\"font-family: Courier New\">select_field = goto<\/span><br style=\"font-family: Courier New\" \/> <span style=\"font-family: Courier New\">where_field = address<\/span><\/font><\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align: top\"><span style=\"font-weight: bold\">mysql_virtual_domains_maps.cf<\/span><\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align: top\"><font size=\"1\"><span style=\"font-family: Courier New\">user = postfix<\/span><br style=\"font-family: Courier New\" \/> <span style=\"font-family: Courier New\">password = <\/span><\/font><font size=\"1\"><span style=\"font-family: Courier New\">password<\/span><\/font><font size=\"1\"><span style=\"font-family: Courier New\"><br style=\"font-family: Courier New\" \/> <\/span><span style=\"font-family: Courier New\">hosts = localhost<\/span><br style=\"font-family: Courier New\" \/> <span style=\"font-family: Courier New\">dbname = postfix<\/span><br style=\"font-family: Courier New\" \/> <span style=\"font-family: Courier New\">table = domain<\/span><br style=\"font-family: Courier New\" \/> <span style=\"font-family: Courier New\">select_field = domain<\/span><br style=\"font-family: Courier New\" \/> <span style=\"font-family: Courier New\">where_field = domain<\/span><br style=\"font-family: Courier New\" \/> <span style=\"font-family: Courier New\">additional_conditions = and active = &#8216;1&#8217;<\/span><\/font><\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align: top\"><span style=\"font-weight: bold\">mysql_virtual_mailbox_maps.cf<\/span><\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align: top\"><font size=\"1\"><span style=\"font-family: Courier New\">user = postfix<\/span><br style=\"font-family: Courier New\" \/> <span style=\"font-family: Courier New\">password = <\/span><\/font><font size=\"1\"><span style=\"font-family: Courier New\">password<\/span><\/font><font size=\"1\"><span style=\"font-family: Courier New\"><br style=\"font-family: Courier New\" \/> <\/span><span style=\"font-family: Courier New\">hosts = localhost<\/span><br style=\"font-family: Courier New\" \/> <span style=\"font-family: Courier New\">dbname = postfix<\/span><br style=\"font-family: Courier New\" \/> <span style=\"font-family: Courier New\">table = mailbox<\/span><br style=\"font-family: Courier New\" \/> <span style=\"font-family: Courier New\">select_field = maildir<\/span><br style=\"font-family: Courier New\" \/> <span style=\"font-family: Courier New\">where_field = username<\/span><br style=\"font-family: Courier New\" \/> <span style=\"font-family: Courier New\">additional_conditions = and active = &#8216;1&#8217;<\/span><\/font><\/td>\n<\/tr>\n<\/table>\n<\/div>\n<\/div>\n<p>Start and stop the daemon with &#8220;postfix&#8221; commands&#8230; i.e.:<\/p>\n<div style=\"margin-left: 40px\"><span style=\"font-family: Courier New\"># postfix start<\/span><br style=\"font-family: Courier New\" \/> <span style=\"font-family: Courier New\"># postfix reload<\/span><br style=\"font-family: Courier New\" \/> <span style=\"font-family: Courier New\"># postfix stop<\/span><br style=\"font-family: Courier New\" \/> <span style=\"font-family: Courier New\"># postfix help<\/span><\/div>\n<p>And check \/var\/log\/maillog for any problems!<\/p>\n<p><span style=\"font-weight: bold\">RoundCube<\/span><\/p>\n<p>This web-mail front end is very simple to use, has just enough features to make me happy, has a very nice ajaxy interface, and fully supports IMAP, which means I can keep my gigs of e-mail on my server and access them from my Windows IMAP client, a Linux IMAP client, or via RoundCube via the web interface!  Very cool.  I just created a VHOST in apache and dumped the latest SVN copy into it (its PHP).  Its easy to configure and can use multiple IMAP servers, local or remote.  Read the docs and play with their <a title=\"online demo\" href=\"http:\/\/www.roundcube.net\/?p=demo\">online demo<\/a>.<\/p>\n<p><span style=\"font-weight: bold\">Final Notes<\/span><\/p>\n<p>Postfix will create the &#8220;Maildir&#8221; structure under \/var\/spool\/postfix\/virtual automatically when the user&#8217;s first e-mail is delivered.  Until then, Courier-IMAP will not allow the user to login.  Roundcube will also just hang and eventually time out with an access deined message.  For simplicity, I just send a dummy e-mail to the user.  Transferring existing users from qmail was a peice of cake &#8212; just tarred the user&#8217;s Maildir on the old server, copied it to the new server, and extracted it (w\/o the Maildir part) to their virtual directory and changed the owner to vmail:vmail.<\/p>\n<p>I know I left out some very important details, as this was supposed to be brief.  Remember: read the man pages&#8230; and probably buy a book on it so you can figure out what all those new-fangled terms mean!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>w00t! I finally got the Postfix MTA running on my home network! I was using qmail on my old faithful Slackware 9.0 router, decided against using it again since it was a bit complex for my needs. Postfix is simple, very configurable, and lets me use a MySQL database for all of my virtual e-mail clients!<\/p>\n<p>Unfortunately, like most Linux MTA&#8217;s, documentation and tutorials that somebody with no formal knowledge of e-mail servers are a bit hard to find. After reading nearly all of the Postfix docs and several random tutorials and howto&#8217;s, I finally got a setup that works perfectly for my needs. And I&#8217;ll be adding server-side spam <a href=\"https:\/\/11h.net\/blog\/postfix\/\">&#8230;<\/p>\n<p>[Continue reading]<\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/11h.net\/blog\/wp-json\/wp\/v2\/posts\/57"}],"collection":[{"href":"https:\/\/11h.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/11h.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/11h.net\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/11h.net\/blog\/wp-json\/wp\/v2\/comments?post=57"}],"version-history":[{"count":0,"href":"https:\/\/11h.net\/blog\/wp-json\/wp\/v2\/posts\/57\/revisions"}],"wp:attachment":[{"href":"https:\/\/11h.net\/blog\/wp-json\/wp\/v2\/media?parent=57"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/11h.net\/blog\/wp-json\/wp\/v2\/categories?post=57"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/11h.net\/blog\/wp-json\/wp\/v2\/tags?post=57"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}