<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

 <title>Gerardo Zamudio</title>
 <link href="https://gerardozamudio.mx/atom.xml" rel="self"/>
 <link href="https://gerardozamudio.mx/"/>
 <updated>2021-01-01T23:26:29-06:00</updated>
 <id>https://gerardozamudio.mx</id>
 <author>
   <name>Gerardo Zamudio</name>
   <email></email>
 </author>

 
 <entry>
   <title>Slackware 15 -current Mail Server with MariaDB, Postfix, and Dovecot</title>
   <link href="https://gerardozamudio.mx/2021/01/01/slackware-15-current-mail-server-with-mariadb-postfix-and-dovecot/"/>
   <updated>2021-01-01T00:00:00-06:00</updated>
   <id>https://gerardozamudio.mx/2021/01/01/slackware-15-current-mail-server-with-mariadb-postfix-and-dovecot</id>
   <content type="html">&lt;h1 id=&quot;introduction&quot;&gt;Introduction&lt;/h1&gt;

&lt;p&gt;Happy new year! The start of a new year is a perfect time for a fresh mail server, don’t you agree? :)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Slackware 15&lt;/strong&gt; has not been released yet but &lt;a href=&quot;https://www.linuxquestions.org/questions/slackware-14/mail-server-postfix-dovecot-slackware-current-14-2-a-4175687392/&quot;&gt;there is demand&lt;/a&gt; for an updated guide given Slackware has had many changes since its last stable release.&lt;/p&gt;

&lt;p&gt;For the purposes of this guide, the most notable changes are &lt;strong&gt;Postfix&lt;/strong&gt; and &lt;strong&gt;Dovecot&lt;/strong&gt; now being the default &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MTA&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;IMAP/POP3&lt;/code&gt; servers, respectively. This doesn’t affect this guide too much. In fact, most of the configuration remains the same as in &lt;a href=&quot;https://gerardozamudio.mx/2019/01/21/slackware-14-2-mail-server-with-mariadb-postfix-and-dovecot/&quot;&gt;my previous post for Slackware 14.2&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This post contains some suggestions for a mildly secure mail server running on a &lt;a href=&quot;http://www.slackware.com/&quot;&gt;Slackware Linux&lt;/a&gt; host. The guide assumes a default, fresh installation of &lt;strong&gt;Slackware64  15 (post 14.2 -current)&lt;/strong&gt; that includes at least the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;A/&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AP/&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;D/&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;L/&lt;/code&gt;, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;N/&lt;/code&gt; package series. By the end of the tutorial, you will have:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.postfix.org/&quot;&gt;Postfix&lt;/a&gt; for encrypted connections over &lt;a href=&quot;https://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol&quot;&gt;SMTP&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://dovecot.org/&quot;&gt;Dovecot&lt;/a&gt; for local mail directories and encrypted connections over &lt;a href=&quot;https://en.wikipedia.org/wiki/Post_Office_Protocol&quot;&gt;POP&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Internet_Message_Access_Protocol&quot;&gt;IMAP&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://mariadb.org/&quot;&gt;MariaDB&lt;/a&gt; to store mailbox information&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://postgrey.schweikert.ch/&quot;&gt;Postgrey&lt;/a&gt; which will require unknown senders to resend their mail, eliminating most spam&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://spamassassin.apache.org/&quot;&gt;SpamAssassin&lt;/a&gt; for e-mail spam filtering based on content-matching rules&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.clamav.net/&quot;&gt;ClamAV&lt;/a&gt; to detect trojans, viruses, malware and other malicious threats in your email&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://amavis.org/&quot;&gt;amavisd-new&lt;/a&gt; to manage ClamAV and SpamAssasin&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://opendkim.org/&quot;&gt;OpenDKIM&lt;/a&gt; a DomainKeys Identified Mail (DKIM) milter to sign and/or verify mail&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://nginx.org/&quot;&gt;nginx&lt;/a&gt; as a webserver&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://postfixadmin.sourceforge.net/&quot;&gt;Postfix Admin&lt;/a&gt; to manage mailboxes and domains using a TLS secured web user interface&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://roundcube.net/&quot;&gt;Roundcube&lt;/a&gt; with some plugins as a TLS secured webmail client&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://pigeonhole.dovecot.org/&quot;&gt;Pigeonhole&lt;/a&gt; to add support for email filter rules (forwarding, placing in folders, etc)&lt;/li&gt;
&lt;/ul&gt;

&lt;h1 id=&quot;preparation&quot;&gt;Preparation&lt;/h1&gt;

&lt;h2 id=&quot;hostname&quot;&gt;Hostname&lt;/h2&gt;

&lt;p&gt;Set up an &lt;abbr title=&quot;Fully Qualified Domain Name&quot;&gt;FQDN&lt;/abbr&gt; as your hostname. We’ll use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mail.example.org&lt;/code&gt;.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;mail.example.org&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; /etc/HOSTNAME
&lt;span class=&quot;nb&quot;&gt;hostname&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-F&lt;/span&gt; /etc/HOSTNAME&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h1 id=&quot;php--nginx&quot;&gt;PHP + nginx&lt;/h1&gt;

&lt;h2 id=&quot;php-gd&quot;&gt;PHP GD&lt;/h2&gt;

&lt;p&gt;In order to use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GD&lt;/code&gt; with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PHP&lt;/code&gt; we’ll need the following packages. You won’t have these if you only installed the recommended package series from above.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-console&quot; data-lang=&quot;console&quot;&gt;&lt;span class=&quot;gp&quot;&gt;#&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;slackpkg &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;libX11 libXpm libxcb libXau libXdmcp fontconfig libXext libXt libSM libICE&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;install-nginx&quot;&gt;Install nginx&lt;/h2&gt;

&lt;p&gt;My last guide used &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nginx 1.14.2&lt;/code&gt;, but it’s now at version &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;1.18.0&lt;/code&gt;! I won’t go through all the changes here but I recommend you take a look at the &lt;a href=&quot;http://nginx.org/en/CHANGES-1.18&quot;&gt;CHANGELOG&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Create your user and use that to run the &lt;a href=&quot;https://github.com/Ponce/slackbuilds/tree/current/network/nginx&quot;&gt;SlackBuild&lt;/a&gt;. If the version of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nginx&lt;/code&gt; is newer than the one defined in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SlackBuild&lt;/code&gt;, simply update the version number in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nginx.SlackBuild&lt;/code&gt; file before running it.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;useradd &lt;span class=&quot;nt&quot;&gt;-r&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-M&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-U&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;User for nginx&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; /srv/httpd &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; /bin/false nginx
&lt;span class=&quot;nv&quot;&gt;NGINXUSER&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;nginx &lt;span class=&quot;nv&quot;&gt;NGINXGROUP&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;nginx ./nginx.SlackBuild&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Remember that if you want to enable syntax highlighlting for the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nginx.conf&lt;/code&gt; file in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vim&lt;/code&gt;, you can copy the contents of the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;contrib/vim&lt;/code&gt; directory from the extracted nginx source to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.vim&lt;/code&gt;.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nb&quot;&gt;tar&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-xvzf&lt;/span&gt; nginx-1.18.0.tar.gz 
&lt;span class=&quot;nb&quot;&gt;mv &lt;/span&gt;nginx-1.18.0/contrib/vim ~/.vim&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;ssl-certificates&quot;&gt;SSL Certificates&lt;/h2&gt;

&lt;p&gt;I’m using &lt;abbr title=&quot;Elliptic Curve Digital Signature Algorithm&quot;&gt;ECDSA&lt;/abbr&gt; certificates and the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;secp384r1&lt;/code&gt; curve here. Remember to change the configuration below if you use something else.&lt;/p&gt;

&lt;h2 id=&quot;configure-nginx&quot;&gt;Configure nginx&lt;/h2&gt;

&lt;p&gt;At minimum, your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nginx.conf&lt;/code&gt; file will need an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;events&lt;/code&gt; section which can be left blank to activate the defaults or modified depending on the load you’re expecting on the server. Set &lt;a href=&quot;https://nginx.org/en/docs/ngx_core_module.html#worker_processes&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;worker_processes&lt;/code&gt;&lt;/a&gt; equal to the number of real CPU cores on the machine.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-nginx&quot; data-lang=&quot;nginx&quot;&gt;&lt;span class=&quot;k&quot;&gt;user&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;nginx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;worker_processes&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;pid&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/var/run/nginx.pid&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;events&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

  &lt;span class=&quot;kn&quot;&gt;worker_connections&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1024&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;http&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

  &lt;span class=&quot;kn&quot;&gt;map&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$sent_http_content_type&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$expires&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;off&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;application/x-javascript&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;1d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;text/css&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;1d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;~image/&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;1d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;kn&quot;&gt;expires&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$expires&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;client_max_body_size&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;12m&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;default_type&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;application/octet-stream&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;gzip&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;gzip_vary&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;gzip_http_version&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;.0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;gzip_comp_level&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;gzip_min_length&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10240&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

  &lt;span class=&quot;kn&quot;&gt;gzip_proxied&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;expired&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;no-cache&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;no-store&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;auth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;gzip_types&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;text/plain&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;text/css&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;text/xml&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;text/javascript&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;text/json&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;application/json&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;application/x-javascript&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;application/xml&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;application/xml&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;+rss&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

  &lt;span class=&quot;kn&quot;&gt;gzip_disable&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;MSIE&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;[1-6]&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;.&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;access_log&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/var/log/nginx/access.log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;error_log&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/var/log/nginx/error.log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;include&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/etc/nginx/mime.types&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;upstream&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;php_workers&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;server&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;unix:/var/run/php-fpm.sock&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;sendfile&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;# Hide Nginx version number&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;server_tokens&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;off&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;types_hash_max_size&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2048&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

  &lt;span class=&quot;kn&quot;&gt;include&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/etc/nginx/conf.d/*.conf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Create your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/nginx/conf.d/mailserver.conf&lt;/code&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-nginx&quot; data-lang=&quot;nginx&quot;&gt;&lt;span class=&quot;c1&quot;&gt;# HTTP&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;server&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

  &lt;span class=&quot;c1&quot;&gt;# Listen on ipv4&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;listen&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;80&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

  &lt;span class=&quot;kn&quot;&gt;server_name&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;_&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;301&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;https://&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$host$request_uri&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# HTTPS&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;server&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;listen&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;443&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;ssl&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;http2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;server_name&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;_&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;root&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/var/www/html&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;index&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;index.php&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;index.html&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;^/.well-known/&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;allow&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;all&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;access_log&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;off&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;log_not_found&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;off&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;autoindex&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;off&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;#root /var/www/html;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

   &lt;span class=&quot;kn&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;/\.&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;deny&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;all&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
   &lt;span class=&quot;kn&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/favicon.ico&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;access_log&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;off&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;log_not_found&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;off&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
   &lt;span class=&quot;kn&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/robots.txt&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;access_log&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;off&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;log_not_found&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;off&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
   
   &lt;span class=&quot;kn&quot;&gt;ssl_protocols&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;TLSv1.3&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;TLSv1.2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kn&quot;&gt;ssl_ciphers&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;HIGH:!MEDIUM:!LOW:!aNULL:!NULL:!SHA&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kn&quot;&gt;ssl_prefer_server_ciphers&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kn&quot;&gt;ssl_ecdh_curve&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;secp384r1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; 
   &lt;span class=&quot;kn&quot;&gt;ssl_certificate&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/home/acme/.acme.sh/mail.example.org_ecc/fullchain.cer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kn&quot;&gt;ssl_certificate_key&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/home/acme/.acme.sh/mail.example.org_ecc/mail.example.org.key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
   
   &lt;span class=&quot;c1&quot;&gt;# Roundcube&lt;/span&gt;
   &lt;span class=&quot;kn&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;^/mail/(bin|config|installer|logs|SQL|temp|vendor)($|/.*)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;deny&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;all&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
   
   &lt;span class=&quot;kn&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;^/mail/(CHANGELOG|composer.json|INSTALL|jsdeps.json|LICENSE|README|UPGRADING)($|.*)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;deny&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;all&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
   
   &lt;span class=&quot;kn&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;^/mail/plugins/.*/config.inc.php.*&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;deny&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;all&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
   
   &lt;span class=&quot;kn&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;^/mail/plugins/enigma/home($|/.*)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;deny&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;all&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
   
   &lt;span class=&quot;c1&quot;&gt;# Redirect URI `/mail` to `/mail/`.&lt;/span&gt;
   &lt;span class=&quot;kn&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/mail&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;301&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/mail/&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
   
   &lt;span class=&quot;kn&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;^/mail/(.*\.php)$&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;add_header&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Strict-Transport-Security&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;max-age=31536000&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;include&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;fastcgi_params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;fastcgi_index&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;index.php&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;fastcgi_pass&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;php_workers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;fastcgi_param&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;HTTP_PROXY&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;fastcgi_param&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;SCRIPT_FILENAME&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/var/www/roundcubemail/&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
   
   &lt;span class=&quot;kn&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;^/mail/(.*)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;alias&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/var/www/roundcubemail/&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;index&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;index.php&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
   
   &lt;span class=&quot;c1&quot;&gt;# Postfixadmin&lt;/span&gt;
   &lt;span class=&quot;kn&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/postfixadmin&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;301&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/postfixadmin/&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
   
   &lt;span class=&quot;kn&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;^/postfixadmin/(.*\.php)$&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;add_header&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Strict-Transport-Security&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;max-age=31536000&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;include&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;fastcgi_params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;fastcgi_index&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;index.php&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;fastcgi_pass&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;php_workers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;fastcgi_param&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;HTTP_PROXY&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;fastcgi_param&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;SCRIPT_FILENAME&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/var/www/postfixadmin/public/&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
   
   &lt;span class=&quot;kn&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;^/postfixadmin/(.*)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;alias&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/var/www/postfixadmin/public/&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;index&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;index.php&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
   
   &lt;span class=&quot;c1&quot;&gt;# Everything else&lt;/span&gt;
   &lt;span class=&quot;kn&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;\.php$&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;include&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;fastcgi_params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;fastcgi_index&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;index.php&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;fastcgi_pass&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;php_workers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;fastcgi_param&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;HTTP_PROXY&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;fastcgi_param&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;SCRIPT_FILENAME&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$document_root$fastcgi_script_name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Change the permissions of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/var/lib/php&lt;/code&gt; since we’re using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nginx&lt;/code&gt; instead of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;httpd&lt;/code&gt; to run &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PHP&lt;/code&gt;:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nb&quot;&gt;chown &lt;/span&gt;root:nginx /var/lib/php/&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;php-fpm-with-fastcgi-in-nginx&quot;&gt;PHP-FPM with FastCGI in nginx&lt;/h2&gt;

&lt;p&gt;We will start by creating a custom &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/php-fpm.d/mailserver.conf&lt;/code&gt; with the following content:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;nn&quot;&gt;[mailserver]&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;user&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;nginx&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;group&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;nginx&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;listen&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;/var/run/php-fpm.sock&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;listen.owner&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;nginx&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;listen.group&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;nginx&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;listen.mode&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;0666&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;pm&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;dynamic&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;pm.max_children&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;5&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;pm.start_servers&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;2&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;pm.min_spare_servers&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;pm.max_spare_servers&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;3&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;pm.max_requests&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;5&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;request_terminate_timeout&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;10s&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;request_slowlog_timeout&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;10s&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;access.log&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;/var/log/php-fpm_access.log&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;slowlog&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;/var/log/php-fpm_slow.log&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;security.limit_extensions&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;.php .php3 .php4 .php5 .html .htm&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Make sure the startup script is executable then start &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;php-fpm&lt;/code&gt; at least once to make sure everything is fine:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nb&quot;&gt;chmod&lt;/span&gt; +x /etc/rc.d/rc.php-fpm
/etc/rc.d/rc.php-fpm start
/etc/rc.d/rc.php-fpm stop&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Install &lt;a href=&quot;https://github.com/Ponce/slackbuilds/tree/current/libraries/php-imagick&quot;&gt;php-imagick&lt;/a&gt; as well since Roundcube will need it later.&lt;/p&gt;

&lt;h1 id=&quot;dovecot&quot;&gt;Dovecot&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Slackware&lt;/strong&gt; has chosen &lt;strong&gt;Dovecot&lt;/strong&gt; as the new &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;IMAP/POP3&lt;/code&gt; server as of November 2017. Instead of creating a &lt;strong&gt;Unix&lt;/strong&gt; account for each mailbox, we use &lt;strong&gt;Postfix Admin&lt;/strong&gt; to store user information. In the filesystem, the email will be stored in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/var/vmail&lt;/code&gt; organized by domain and user, so the email for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;admin@example.org&lt;/code&gt; would be stored in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/var/vmail/example.org/admin&lt;/code&gt;. Since &lt;strong&gt;Dovecot&lt;/strong&gt; is now part of &lt;strong&gt;Slackware&lt;/strong&gt;, the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dovenull&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dovecot&lt;/code&gt; users already exist so there is no need to create them. You will only need to create the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vmail&lt;/code&gt; user&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;useradd &lt;span class=&quot;nt&quot;&gt;-r&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; /var/vmail &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; /bin/false &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; 150 &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; 12 vmail
&lt;span class=&quot;nb&quot;&gt;mkdir&lt;/span&gt; /var/vmail
&lt;span class=&quot;nb&quot;&gt;chmod &lt;/span&gt;770 /var/vmail
&lt;span class=&quot;nb&quot;&gt;chown &lt;/span&gt;vmail:mail /var/vmail&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Fill in the database information in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/dovecot/dovecot-sql.conf.ext&lt;/code&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-conf&quot; data-lang=&quot;conf&quot;&gt;&lt;span class=&quot;n&quot;&gt;driver&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;mysql&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;connect&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;host&lt;/span&gt;=/&lt;span class=&quot;n&quot;&gt;var&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;run&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;mysql&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;mysql&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;sock&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dbname&lt;/span&gt;=&lt;span class=&quot;n&quot;&gt;mail&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;user&lt;/span&gt;=&lt;span class=&quot;n&quot;&gt;mail&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;password&lt;/span&gt;=&lt;span class=&quot;n&quot;&gt;password&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;here&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;default_pass_scheme&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;SHA512&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;CRYPT&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;These are the same credentials &lt;strong&gt;Postfix Admin&lt;/strong&gt; will use, so keep that in mind. We’re not creating the database or user yet. That will come later. Now let’s add the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;password_query&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;user_query&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/dovecot/dovecot-sql.conf.ext&lt;/code&gt;:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-conf&quot; data-lang=&quot;conf&quot;&gt;&lt;span class=&quot;n&quot;&gt;password_query&lt;/span&gt; = \
  &lt;span class=&quot;n&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;username&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;user&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;password&lt;/span&gt;, &lt;span class=&quot;s1&quot;&gt;'/var/vmail/%d/%n'&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;as&lt;/span&gt; \
  &lt;span class=&quot;n&quot;&gt;userdb_home&lt;/span&gt;, &lt;span class=&quot;s1&quot;&gt;'maildir:/var/vmail/%d/%n'&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;userdb_mail&lt;/span&gt;, \
  &lt;span class=&quot;m&quot;&gt;150&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;userdb_uid&lt;/span&gt;, &lt;span class=&quot;m&quot;&gt;12&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;userdb_gid&lt;/span&gt; \
  &lt;span class=&quot;n&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;mailbox&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WHERE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;username&lt;/span&gt; = &lt;span class=&quot;s1&quot;&gt;'%u'&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;AND&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;active&lt;/span&gt; = &lt;span class=&quot;s1&quot;&gt;'1'&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;user_query&lt;/span&gt; = \
  &lt;span class=&quot;n&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'/var/vmail/%d/%n'&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;home&lt;/span&gt;, &lt;span class=&quot;s1&quot;&gt;'maildir:/var/vmail/%d/%n'&lt;/span&gt; \
  &lt;span class=&quot;n&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;mail&lt;/span&gt;, &lt;span class=&quot;m&quot;&gt;150&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;AS&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;uid&lt;/span&gt;, &lt;span class=&quot;m&quot;&gt;12&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;AS&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;gid&lt;/span&gt;, \
  &lt;span class=&quot;n&quot;&gt;concat&lt;/span&gt;(&lt;span class=&quot;s1&quot;&gt;'dirsize:storage='&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;quota&lt;/span&gt;) &lt;span class=&quot;n&quot;&gt;AS&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;quota&lt;/span&gt; \
  &lt;span class=&quot;n&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;mailbox&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WHERE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;username&lt;/span&gt; = &lt;span class=&quot;s1&quot;&gt;'%u'&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;AND&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;active&lt;/span&gt; = &lt;span class=&quot;s1&quot;&gt;'1'&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;In the file &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/dovecot/conf.d/10-auth.conf&lt;/code&gt; we will enable the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SQL&lt;/code&gt; configuration file we just modified, disable plaintext authentication, and comment out the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;auth-system.conf.ext&lt;/code&gt; file that’s loaded by default.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-conf&quot; data-lang=&quot;conf&quot;&gt;&lt;span class=&quot;n&quot;&gt;disable_plaintext_auth&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;yes&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;auth_mechanisms&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;plain&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;login&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;#!include auth-system.conf.ext
&lt;/span&gt;!&lt;span class=&quot;n&quot;&gt;include&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;auth&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;sql&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;conf&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;ext&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Since we are using &lt;strong&gt;TLS&lt;/strong&gt;, it’s OK to use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;plain&lt;/code&gt; as the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;auth mechanism&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Next file to edit is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/dovecot/conf.d/10-mail.conf&lt;/code&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-conf&quot; data-lang=&quot;conf&quot;&gt;&lt;span class=&quot;n&quot;&gt;mail_location&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;maildir&lt;/span&gt;:/&lt;span class=&quot;n&quot;&gt;var&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;vmail&lt;/span&gt;/%&lt;span class=&quot;n&quot;&gt;d&lt;/span&gt;/%&lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;mail_uid&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;vmail&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;mail_gid&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;mail&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;first_valid_uid&lt;/span&gt; = &lt;span class=&quot;m&quot;&gt;150&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;last_valid_uid&lt;/span&gt; = &lt;span class=&quot;m&quot;&gt;150&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The SSL configuration is in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/dovecot/conf.d/10-ssl.conf&lt;/code&gt; as follows:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-conf&quot; data-lang=&quot;conf&quot;&gt;&lt;span class=&quot;n&quot;&gt;ssl_cert&lt;/span&gt; = &amp;lt;/&lt;span class=&quot;n&quot;&gt;home&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;acme&lt;/span&gt;/.&lt;span class=&quot;n&quot;&gt;acme&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;sh&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;mail&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;example&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;org_ecc&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;fullchain&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;cer&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;ssl_key&lt;/span&gt; = &amp;lt;/&lt;span class=&quot;n&quot;&gt;home&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;acme&lt;/span&gt;/.&lt;span class=&quot;n&quot;&gt;acme&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;sh&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;mail&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;example&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;org_ecc&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;mail&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;example&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;org&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;key&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;ssl_min_protocol&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;TLSv1&lt;/span&gt;.&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;ssl_cipher_list&lt;/span&gt; =  &lt;span class=&quot;n&quot;&gt;ECDHE&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;ECDSA&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;CHACHA20&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;POLY1305&lt;/span&gt;:&lt;span class=&quot;n&quot;&gt;ECDHE&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;ECDSA&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;AES256&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;GCM&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;SHA384&lt;/span&gt;:&lt;span class=&quot;n&quot;&gt;ECDHE&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;ECDSA&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;AES128&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;GCM&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;SHA256&lt;/span&gt;:&lt;span class=&quot;n&quot;&gt;ECDHE&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;ECDSA&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;AES256&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;SHA384&lt;/span&gt;:&lt;span class=&quot;n&quot;&gt;ECDHE&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;ECDSA&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;AES128&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;SHA256&lt;/span&gt;:&lt;span class=&quot;n&quot;&gt;ECDHE&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;ECDSA&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;AES128&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;SHA&lt;/span&gt;:&lt;span class=&quot;n&quot;&gt;ECDHE&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;ECDSA&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;AES256&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;SHA&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;ssl_curve_list&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;P&lt;/span&gt;-&lt;span class=&quot;m&quot;&gt;384&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;ssl_prefer_server_ciphers&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;yes&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Let’s set up the file &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/dovecot/conf.d/10-master.conf&lt;/code&gt; now. We need to uncomment the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;user&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;group&lt;/code&gt;, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mode&lt;/code&gt; lines in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;unix_listener auth-userdb&lt;/code&gt; section of the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;service auth&lt;/code&gt; block in order to have &lt;strong&gt;Dovecot&lt;/strong&gt; authenticate. &lt;strong&gt;Postfix&lt;/strong&gt; will also need a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;unix_listener&lt;/code&gt; in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;postfix&lt;/code&gt; spool directory so uncomment that section, and a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;unix_listener auth-master&lt;/code&gt; section too. Make sure to add &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;postfix&lt;/code&gt; as the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;user&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;group&lt;/code&gt;. Don’t worry about creating them now, we’ll do that later. Set up the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;stats-writer&lt;/code&gt; as well. In the end the file should look somewhat like this&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-conf&quot; data-lang=&quot;conf&quot;&gt;&lt;span class=&quot;n&quot;&gt;service&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;auth&lt;/span&gt; {
  &lt;span class=&quot;n&quot;&gt;unix_listener&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;auth&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;userdb&lt;/span&gt; {
    &lt;span class=&quot;n&quot;&gt;mode&lt;/span&gt; = &lt;span class=&quot;m&quot;&gt;0666&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;user&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;vmail&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;group&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;mail&lt;/span&gt;
  }

  &lt;span class=&quot;n&quot;&gt;unix_listener&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;auth&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;master&lt;/span&gt; {
    &lt;span class=&quot;n&quot;&gt;mode&lt;/span&gt; = &lt;span class=&quot;m&quot;&gt;0660&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;user&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;vmail&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;group&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;mail&lt;/span&gt;
  }
  
  &lt;span class=&quot;n&quot;&gt;unix_listener&lt;/span&gt; /&lt;span class=&quot;n&quot;&gt;var&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;spool&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;postfix&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;private&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;auth&lt;/span&gt; {
    &lt;span class=&quot;n&quot;&gt;mode&lt;/span&gt; = &lt;span class=&quot;m&quot;&gt;0666&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;user&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;postfix&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;group&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;postfix&lt;/span&gt;
  }

}

&lt;span class=&quot;n&quot;&gt;service&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;stats&lt;/span&gt; {
    &lt;span class=&quot;n&quot;&gt;unix_listener&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;stats&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;reader&lt;/span&gt; {
        &lt;span class=&quot;n&quot;&gt;user&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;vmail&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;group&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;mail&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;mode&lt;/span&gt; = &lt;span class=&quot;m&quot;&gt;0660&lt;/span&gt;
    }
    &lt;span class=&quot;n&quot;&gt;unix_listener&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;stats&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;writer&lt;/span&gt; {
        &lt;span class=&quot;n&quot;&gt;user&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;vmail&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;group&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;mail&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;mode&lt;/span&gt; = &lt;span class=&quot;m&quot;&gt;0660&lt;/span&gt;
    }
}&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;dovecot-pigeonhole&quot;&gt;Dovecot Pigeonhole&lt;/h2&gt;

&lt;p&gt;A new addition to this guide is &lt;strong&gt;Dovecot Pigeonhole&lt;/strong&gt;. This adds support for the &lt;strong&gt;Sieve&lt;/strong&gt; language (RFC 5228) and the &lt;strong&gt;ManageSieve&lt;/strong&gt; protocol (RFC 5804) to &lt;strong&gt;Dovecot&lt;/strong&gt;. Coupled with a &lt;strong&gt;Roundcube plugin&lt;/strong&gt;, this will allow us to filter email based on any number of factors. For example, you can create an rule in &lt;strong&gt;Roundcube&lt;/strong&gt; that will automatically place email coming from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@bank.com&lt;/code&gt; to a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Bank Notifications&lt;/code&gt; folder.&lt;/p&gt;

&lt;p&gt;After you install the &lt;a href=&quot;https://github.com/Ponce/slackbuilds/tree/current/network/dovecot-pigeonhole/&quot;&gt;SlackBuild&lt;/a&gt;, copy the following example configuration files into the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/dovecot/conf.d directory&lt;/code&gt;:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-conf&quot; data-lang=&quot;conf&quot;&gt;/&lt;span class=&quot;n&quot;&gt;usr&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;doc&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;dovecot&lt;/span&gt;-&lt;span class=&quot;m&quot;&gt;2&lt;/span&gt;.&lt;span class=&quot;m&quot;&gt;3&lt;/span&gt;.&lt;span class=&quot;m&quot;&gt;11&lt;/span&gt;.&lt;span class=&quot;m&quot;&gt;3&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;example&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;conf&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;d&lt;/span&gt;/&lt;span class=&quot;m&quot;&gt;90&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;sieve&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;conf&lt;/span&gt;
/&lt;span class=&quot;n&quot;&gt;usr&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;doc&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;dovecot&lt;/span&gt;-&lt;span class=&quot;m&quot;&gt;2&lt;/span&gt;.&lt;span class=&quot;m&quot;&gt;3&lt;/span&gt;.&lt;span class=&quot;m&quot;&gt;11&lt;/span&gt;.&lt;span class=&quot;m&quot;&gt;3&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;example&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;conf&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;d&lt;/span&gt;/&lt;span class=&quot;m&quot;&gt;90&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;sieve&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;extprograms&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;conf&lt;/span&gt;
/&lt;span class=&quot;n&quot;&gt;usr&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;doc&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;dovecot&lt;/span&gt;-&lt;span class=&quot;m&quot;&gt;2&lt;/span&gt;.&lt;span class=&quot;m&quot;&gt;3&lt;/span&gt;.&lt;span class=&quot;m&quot;&gt;11&lt;/span&gt;.&lt;span class=&quot;m&quot;&gt;3&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;example&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;conf&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;d&lt;/span&gt;/&lt;span class=&quot;m&quot;&gt;20&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;managesieve&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;conf&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;We will need to edit the following &lt;strong&gt;Dovecot&lt;/strong&gt; configuration files now:&lt;/p&gt;

&lt;p&gt;First, edit &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/dovecot/conf.d/20-lmtp.conf&lt;/code&gt;, and add&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-conf&quot; data-lang=&quot;conf&quot;&gt;&lt;span class=&quot;n&quot;&gt;protocol&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lmtp&lt;/span&gt; {
  &lt;span class=&quot;n&quot;&gt;postmaster_address&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;postmaster&lt;/span&gt;@&lt;span class=&quot;n&quot;&gt;example&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;org&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;mail_plugins&lt;/span&gt; = $&lt;span class=&quot;n&quot;&gt;mail_plugins&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sieve&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;quota&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;log_path&lt;/span&gt; = /&lt;span class=&quot;n&quot;&gt;var&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;log&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;dovecot&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;lmtp&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;errors&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;log&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;info_log_path&lt;/span&gt; = /&lt;span class=&quot;n&quot;&gt;var&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;log&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;dovecot&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;lmtp&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;log&lt;/span&gt;
}&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;For &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/dovecot/conf.d/15-lda.conf&lt;/code&gt;, add&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-conf&quot; data-lang=&quot;conf&quot;&gt;&lt;span class=&quot;n&quot;&gt;protocol&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lda&lt;/span&gt; {
  &lt;span class=&quot;n&quot;&gt;postmaster_address&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;postmaster&lt;/span&gt;@&lt;span class=&quot;n&quot;&gt;example&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;org&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;mail_plugins&lt;/span&gt; = $&lt;span class=&quot;n&quot;&gt;mail_plugins&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sieve&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;quota&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;auth_socket_path&lt;/span&gt; = /&lt;span class=&quot;n&quot;&gt;var&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;run&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;dovecot&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;auth&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;master&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;log_path&lt;/span&gt; = /&lt;span class=&quot;n&quot;&gt;var&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;log&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;dovecot&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;lda&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;errors&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;log&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;info_log_path&lt;/span&gt; = /&lt;span class=&quot;n&quot;&gt;var&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;log&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;dovecot&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;lda&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;log&lt;/span&gt;
}&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;For &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/dovecot/conf.d/10-mail.conf&lt;/code&gt;, add&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-conf&quot; data-lang=&quot;conf&quot;&gt;&lt;span class=&quot;n&quot;&gt;mail_home&lt;/span&gt; = /&lt;span class=&quot;n&quot;&gt;var&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;vmail&lt;/span&gt;/%&lt;span class=&quot;n&quot;&gt;d&lt;/span&gt;/%&lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;sieve&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;mail_location&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;maildir&lt;/span&gt;:/&lt;span class=&quot;n&quot;&gt;var&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;vmail&lt;/span&gt;/%&lt;span class=&quot;n&quot;&gt;d&lt;/span&gt;/%&lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;In &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/dovecot/conf.d/20-managesieve.conf&lt;/code&gt;, add&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-conf&quot; data-lang=&quot;conf&quot;&gt;&lt;span class=&quot;n&quot;&gt;protocols&lt;/span&gt; = $&lt;span class=&quot;n&quot;&gt;protocols&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sieve&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;service&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;managesieve&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;login&lt;/span&gt; {
  &lt;span class=&quot;n&quot;&gt;inet_listener&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sieve&lt;/span&gt; {
    &lt;span class=&quot;n&quot;&gt;port&lt;/span&gt; = &lt;span class=&quot;m&quot;&gt;4190&lt;/span&gt;
  }
&lt;span class=&quot;n&quot;&gt;service&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;managesieve&lt;/span&gt; {
  &lt;span class=&quot;n&quot;&gt;process_limit&lt;/span&gt; = &lt;span class=&quot;m&quot;&gt;1024&lt;/span&gt;
}
&lt;span class=&quot;n&quot;&gt;protocol&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sieve&lt;/span&gt; {
  &lt;span class=&quot;n&quot;&gt;log_path&lt;/span&gt; = /&lt;span class=&quot;n&quot;&gt;var&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;log&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;dovecot&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;sieve&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;errors&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;log&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;info_log_path&lt;/span&gt; = /&lt;span class=&quot;n&quot;&gt;var&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;log&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;dovecot&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;sieve&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;log&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;managesieve_max_line_length&lt;/span&gt; = &lt;span class=&quot;m&quot;&gt;65536&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;managesieve_implementation_string&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;Dovecot&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Pigeonhole&lt;/span&gt;
}&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Lastly, edit &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/dovecot/conf.d/90-sieve.conf&lt;/code&gt;, and add&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-conf&quot; data-lang=&quot;conf&quot;&gt;&lt;span class=&quot;n&quot;&gt;plugin&lt;/span&gt; {
    &lt;span class=&quot;n&quot;&gt;sieve&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;:/&lt;span class=&quot;n&quot;&gt;var&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;vmail&lt;/span&gt;/%&lt;span class=&quot;n&quot;&gt;d&lt;/span&gt;/%&lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;sieve&lt;/span&gt;;&lt;span class=&quot;n&quot;&gt;active&lt;/span&gt;=/&lt;span class=&quot;n&quot;&gt;var&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;vmail&lt;/span&gt;/%&lt;span class=&quot;n&quot;&gt;d&lt;/span&gt;/%&lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;sieve&lt;/span&gt;/.&lt;span class=&quot;n&quot;&gt;dovecot&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;sieve&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;sieve_default&lt;/span&gt; = /&lt;span class=&quot;n&quot;&gt;etc&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;dovecot&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;sieve&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;default&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;sieve&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;sieve_global&lt;/span&gt; = /&lt;span class=&quot;n&quot;&gt;etc&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;dovecot&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;sieve&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;global&lt;/span&gt;/
}
&lt;span class=&quot;n&quot;&gt;lda_mailbox_autocreate&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;yes&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;lda_mailbox_autosubscribe&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;yes&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Now we need to create some files that are needed for our configuration to work:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nb&quot;&gt;mkdir&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; /etc/dovecot/sieve/global
&lt;span class=&quot;nb&quot;&gt;chown&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-R&lt;/span&gt; vmail:mail /etc/dovecot/sieve/
&lt;span class=&quot;nb&quot;&gt;touch&lt;/span&gt; /var/log/&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;dovecot-lda-errors.log,dovecot-lda.log&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;touch&lt;/span&gt; /var/log/&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;dovecot-sieve-errors.log,dovecot-sieve.log&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;touch&lt;/span&gt; /var/log/&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;dovecot-lmtp-errors.log,dovecot-lmtp.log&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;chown &lt;/span&gt;vmail:dovecot /var/log/dovecot-&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Add &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;postfix&lt;/code&gt; to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dovecot&lt;/code&gt; group. This is needed by &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;amavisd-new&lt;/code&gt; later.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;usermod &lt;span class=&quot;nt&quot;&gt;-G&lt;/span&gt; dovecot &lt;span class=&quot;nt&quot;&gt;-a&lt;/span&gt; postfix&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h1 id=&quot;postfix&quot;&gt;Postfix&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Postfix&lt;/strong&gt; is now the default &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MTA&lt;/code&gt; in Slackware as of November 2017. We no longer have to create users or compile anything so let’s just get to adding our database configuration.&lt;/p&gt;

&lt;p&gt;Create a directory to hold these files&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nb&quot;&gt;mkdir&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; /etc/postfix/mysql&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Now let’s create our &lt;strong&gt;MySQL&lt;/strong&gt; map files&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/postfix/mysql/mysql_virtual_alias_domainaliases_maps.cf&lt;/code&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-conf&quot; data-lang=&quot;conf&quot;&gt;&lt;span class=&quot;n&quot;&gt;user&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;mail&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;password&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;mailpassword&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;hosts&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;localhost&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;dbname&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;mail&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;query&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;goto&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;alias&lt;/span&gt;,&lt;span class=&quot;n&quot;&gt;alias_domain&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;WHERE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;alias_domain&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;alias_domain&lt;/span&gt; = &lt;span class=&quot;s1&quot;&gt;'%d'&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;AND&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;alias&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;address&lt;/span&gt;=&lt;span class=&quot;n&quot;&gt;concat&lt;/span&gt;(&lt;span class=&quot;s1&quot;&gt;'%u'&lt;/span&gt;, &lt;span class=&quot;s1&quot;&gt;'@'&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;alias_domain&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;target_domain&lt;/span&gt;)
  &lt;span class=&quot;n&quot;&gt;AND&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;alias&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;active&lt;/span&gt; = &lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/postfix/mysql/mysql_virtual_alias_maps.cf&lt;/code&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-conf&quot; data-lang=&quot;conf&quot;&gt;&lt;span class=&quot;n&quot;&gt;user&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;mail&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;password&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;mailpassword&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;hosts&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;localhost&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;dbname&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;mail&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;table&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;alias&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;select_field&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;goto&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;where_field&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;address&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;additional_conditions&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;active&lt;/span&gt; = &lt;span class=&quot;s1&quot;&gt;'1'&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/postfix/mysql/mysql_virtual_domains_maps.cf&lt;/code&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-conf&quot; data-lang=&quot;conf&quot;&gt;&lt;span class=&quot;n&quot;&gt;user&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;mail&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;password&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;mailpassword&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;hosts&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;localhost&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;dbname&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;mail&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;table&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;domain&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;select_field&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;domain&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;where_field&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;domain&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;additional_conditions&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;backupmx&lt;/span&gt; = &lt;span class=&quot;s1&quot;&gt;'0'&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;active&lt;/span&gt; = &lt;span class=&quot;s1&quot;&gt;'1'&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/postfix/mysql/mysql_virtual_mailbox_domainaliases_maps.cf&lt;/code&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-conf&quot; data-lang=&quot;conf&quot;&gt;&lt;span class=&quot;n&quot;&gt;user&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;mail&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;password&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;mailpassword&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;hosts&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;localhost&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;dbname&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;mail&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;query&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;maildir&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;mailbox&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;alias_domain&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;WHERE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;alias_domain&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;alias_domain&lt;/span&gt; = &lt;span class=&quot;s1&quot;&gt;'%d'&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;AND&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;mailbox&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;username&lt;/span&gt;=&lt;span class=&quot;n&quot;&gt;concat&lt;/span&gt;(&lt;span class=&quot;s1&quot;&gt;'%u'&lt;/span&gt;, &lt;span class=&quot;s1&quot;&gt;'@'&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;alias_domain&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;target_domain&lt;/span&gt; )
  &lt;span class=&quot;n&quot;&gt;AND&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;mailbox&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;active&lt;/span&gt; = &lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/postfix/mysql/mysql_virtual_mailbox_maps.cf&lt;/code&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-conf&quot; data-lang=&quot;conf&quot;&gt;&lt;span class=&quot;n&quot;&gt;user&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;mail&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;password&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;mailpassword&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;hosts&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;localhost&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;dbname&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;mail&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;table&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;mailbox&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;select_field&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;CONCAT&lt;/span&gt;(&lt;span class=&quot;n&quot;&gt;domain&lt;/span&gt;, &lt;span class=&quot;s1&quot;&gt;'/'&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;local_part&lt;/span&gt;)
&lt;span class=&quot;n&quot;&gt;where_field&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;username&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;additional_conditions&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;active&lt;/span&gt; = &lt;span class=&quot;s1&quot;&gt;'1'&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h1 id=&quot;postfix-main-configuration&quot;&gt;Postfix Main Configuration&lt;/h1&gt;

&lt;p&gt;The only change between here and the past guide is that the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;append_dot_mydomain&lt;/code&gt; directive now defaults to no so we don’t need to include it. Here’s what should be in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/postfix/main.cf&lt;/code&gt;:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-conf&quot; data-lang=&quot;conf&quot;&gt;&lt;span class=&quot;n&quot;&gt;myhostname&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;mail&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;example&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;org&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;myorigin&lt;/span&gt; = $&lt;span class=&quot;n&quot;&gt;myhostname&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;inet_interfaces&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;all&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;mynetworks&lt;/span&gt; = &lt;span class=&quot;m&quot;&gt;127&lt;/span&gt;.&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;.&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;.&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;/&lt;span class=&quot;m&quot;&gt;24&lt;/span&gt; [::&lt;span class=&quot;n&quot;&gt;ffff&lt;/span&gt;:&lt;span class=&quot;m&quot;&gt;127&lt;/span&gt;.&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;.&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;.&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;]/&lt;span class=&quot;m&quot;&gt;104&lt;/span&gt; [::&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;]/&lt;span class=&quot;m&quot;&gt;128&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;alias_maps&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;hash&lt;/span&gt;:/&lt;span class=&quot;n&quot;&gt;etc&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;aliases&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;alias_database&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;hash&lt;/span&gt;:/&lt;span class=&quot;n&quot;&gt;etc&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;aliases&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;header_checks&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;regexp&lt;/span&gt;:/&lt;span class=&quot;n&quot;&gt;etc&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;postfix&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;header_checks&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;mime_header_checks&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;regexp&lt;/span&gt;:/&lt;span class=&quot;n&quot;&gt;etc&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;postfix&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;header_checks&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;smtpd_banner&lt;/span&gt; = $&lt;span class=&quot;n&quot;&gt;myhostname&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ESMTP&lt;/span&gt; $&lt;span class=&quot;n&quot;&gt;mail_name&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;biff&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;no&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;strong&gt;Dovecot&lt;/strong&gt; authentication section is still the same&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-conf&quot; data-lang=&quot;conf&quot;&gt;&lt;span class=&quot;n&quot;&gt;smtpd_sasl_type&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;dovecot&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;smtpd_sasl_path&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;private&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;auth&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;smtpd_sasl_auth_enable&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;yes&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;broken_sasl_auth_clients&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;no&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;smtpd_sasl_security_options&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;noanonymous&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;smtpd_sasl_local_domain&lt;/span&gt; =
&lt;span class=&quot;n&quot;&gt;smtpd_sasl_authenticated_header&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;yes&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;With newer versions of &lt;strong&gt;Postfix&lt;/strong&gt;, you can now include both &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ECDSA&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;RSA&lt;/code&gt; certificates in your configuration. I’m disabling &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SSLv2&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SSLv3&lt;/code&gt;, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TLSv1.0&lt;/code&gt; in the configuration below. We’re excluding known insecure ciphers and setting the encryption level to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;may&lt;/code&gt;. You can set this to encrypt, if you want, but the &lt;strong&gt;Postfix&lt;/strong&gt; documentation strongly advises against this for a public facing server.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-conf&quot; data-lang=&quot;conf&quot;&gt;&lt;span class=&quot;n&quot;&gt;lmtp_tls_ciphers&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;high&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;lmtp_tls_mandatory_ciphers&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;high&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;lmtp_tls_mandatory_protocols&lt;/span&gt; = !&lt;span class=&quot;n&quot;&gt;SSLv2&lt;/span&gt;, !&lt;span class=&quot;n&quot;&gt;SSLv3&lt;/span&gt;, !&lt;span class=&quot;n&quot;&gt;TLSv1&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;lmtp_tls_protocols&lt;/span&gt; = !&lt;span class=&quot;n&quot;&gt;SSLv2&lt;/span&gt;, !&lt;span class=&quot;n&quot;&gt;SSLv3&lt;/span&gt;, !&lt;span class=&quot;n&quot;&gt;TLSv1&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;smtp_tls_ciphers&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;high&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;smtp_tls_exclude_ciphers&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;aNULL&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;eNULL&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;EXPORT&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;DES&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;RC4&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;MD5&lt;/span&gt;, &lt;span class=&quot;m&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;DES&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;DES&lt;/span&gt;+&lt;span class=&quot;n&quot;&gt;MD5&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;LOW&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;DSS&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;PSK&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;aECDH&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;EDH&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;DSS&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;DES&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;CBC3&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;SHA&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;EDH&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;RSA&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;DES&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;CDC3&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;SHA&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;KRB5&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;DE5&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;CBC3&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;SHA&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;smtp_tls_loglevel&lt;/span&gt; = &lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;smtp_tls_mandatory_ciphers&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;high&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;smtp_tls_mandatory_exclude_ciphers&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;aNULL&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;eNULL&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;EXPORT&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;DES&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;RC4&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;MD5&lt;/span&gt;, &lt;span class=&quot;m&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;DES&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;DES&lt;/span&gt;+&lt;span class=&quot;n&quot;&gt;MD5&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;LOW&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;DSS&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;PSK&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;aECDH&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;EDH&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;DSS&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;DES&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;CBC3&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;SHA&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;EDH&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;RSA&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;DES&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;CDC3&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;SHA&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;KRB5&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;DE5&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;CBC3&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;SHA&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;smtp_tls_mandatory_protocols&lt;/span&gt; = !&lt;span class=&quot;n&quot;&gt;SSLv2&lt;/span&gt;, !&lt;span class=&quot;n&quot;&gt;SSLv3&lt;/span&gt;, !&lt;span class=&quot;n&quot;&gt;TLSv1&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;smtp_tls_note_starttls_offer&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;yes&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;smtp_tls_protocols&lt;/span&gt; = !&lt;span class=&quot;n&quot;&gt;SSLv2&lt;/span&gt;, !&lt;span class=&quot;n&quot;&gt;SSLv3&lt;/span&gt;, !&lt;span class=&quot;n&quot;&gt;TLSv1&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;smtp_tls_security_level&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;may&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;smtpd_reject_unlisted_recipient&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;yes&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;smtpd_reject_unlisted_sender&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;yes&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;smtpd_tls_auth_only&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;yes&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;smtpd_tls_cert_file&lt;/span&gt;= /&lt;span class=&quot;n&quot;&gt;home&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;acme&lt;/span&gt;/.&lt;span class=&quot;n&quot;&gt;acme&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;sh&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;mail&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;example&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;org&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;fullchain&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;cer&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;smtpd_tls_eccert_file&lt;/span&gt; = /&lt;span class=&quot;n&quot;&gt;home&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;acme&lt;/span&gt;/.&lt;span class=&quot;n&quot;&gt;acme&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;sh&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;mail&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;example&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;org_ecc&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;fullchain&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;cer&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;smtpd_tls_eckey_file&lt;/span&gt; = /&lt;span class=&quot;n&quot;&gt;home&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;acme&lt;/span&gt;/.&lt;span class=&quot;n&quot;&gt;acme&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;sh&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;mail&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;example&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;org_ecc&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;mail&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;example&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;org&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;key&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;smtpd_tls_eecdh_grade&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;ultra&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;smtpd_tls_exclude_ciphers&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;aNULL&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;eNULL&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;EXPORT&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;DES&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;RC4&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;MD5&lt;/span&gt;, &lt;span class=&quot;m&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;DES&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;DES&lt;/span&gt;+&lt;span class=&quot;n&quot;&gt;MD5&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;LOW&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;DSS&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;PSK&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;aECDH&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;EDH&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;DSS&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;DES&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;CBC3&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;SHA&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;EDH&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;RSA&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;DES&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;CDC3&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;SHA&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;KRB5&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;DE5&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;CBC3&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;SHA&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;smtpd_tls_key_file&lt;/span&gt;= /&lt;span class=&quot;n&quot;&gt;home&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;acme&lt;/span&gt;/.&lt;span class=&quot;n&quot;&gt;acme&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;sh&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;mail&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;example&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;org&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;mail&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;example&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;org&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;key&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;smtpd_tls_loglevel&lt;/span&gt; = &lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;smtpd_tls_mandatory_ciphers&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;high&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;smtpd_tls_mandatory_exclude_ciphers&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;aNULL&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;eNULL&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;EXPORT&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;DES&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;RC4&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;MD5&lt;/span&gt;, &lt;span class=&quot;m&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;DES&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;DES&lt;/span&gt;+&lt;span class=&quot;n&quot;&gt;MD5&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;LOW&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;DSS&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;PSK&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;aECDH&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;EDH&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;DSS&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;DES&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;CBC3&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;SHA&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;EDH&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;RSA&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;DES&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;CDC3&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;SHA&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;KRB5&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;DE5&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;CBC3&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;SHA&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;smtpd_tls_mandatory_protocols&lt;/span&gt; = !&lt;span class=&quot;n&quot;&gt;SSLv2&lt;/span&gt;, !&lt;span class=&quot;n&quot;&gt;SSLv3&lt;/span&gt;, !&lt;span class=&quot;n&quot;&gt;TLSv1&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;smtpd_tls_protocols&lt;/span&gt; = !&lt;span class=&quot;n&quot;&gt;SSLv2&lt;/span&gt;, !&lt;span class=&quot;n&quot;&gt;SSLv3&lt;/span&gt;, !&lt;span class=&quot;n&quot;&gt;TLSv1&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;smtpd_tls_received_header&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;yes&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;smtpd_tls_security_level&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;may&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;smtpd_tls_session_cache_timeout&lt;/span&gt; = &lt;span class=&quot;m&quot;&gt;3600&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;tls_preempt_cipherlist&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;yes&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;tls_random_source&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;dev&lt;/span&gt;:/&lt;span class=&quot;n&quot;&gt;dev&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;urandom&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Feel free to set these parameters to whatever fits your needs&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-conf&quot; data-lang=&quot;conf&quot;&gt;&lt;span class=&quot;n&quot;&gt;delay_warning_time&lt;/span&gt; = &lt;span class=&quot;m&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;h&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;maximal_queue_lifetime&lt;/span&gt; = &lt;span class=&quot;m&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;d&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;minimal_backoff_time&lt;/span&gt; = &lt;span class=&quot;m&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;maximal_backoff_time&lt;/span&gt; = &lt;span class=&quot;m&quot;&gt;8000&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;message_size_limit&lt;/span&gt; = &lt;span class=&quot;m&quot;&gt;20480000&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;smtp_helo_timeout&lt;/span&gt; = &lt;span class=&quot;m&quot;&gt;60&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;smtpd_recipient_limit&lt;/span&gt; = &lt;span class=&quot;m&quot;&gt;16&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;smtpd_soft_error_limit&lt;/span&gt; = &lt;span class=&quot;m&quot;&gt;3&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;smtpd_hard_error_limit&lt;/span&gt; = &lt;span class=&quot;m&quot;&gt;12&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Now we set up milters along with the &lt;strong&gt;Postgrey&lt;/strong&gt; and &lt;strong&gt;OpenDKIM&lt;/strong&gt; sockets&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-conf&quot; data-lang=&quot;conf&quot;&gt;&lt;span class=&quot;n&quot;&gt;smtpd_helo_restrictions&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;permit_mynetworks&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;permit_sasl_authenticated&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;warn_if_reject&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;reject_non_fqdn_hostname&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;reject_invalid_hostname&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;permit&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;smtpd_sender_restrictions&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;permit_sasl_authenticated&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;permit_mynetworks&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;warn_if_reject&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;reject_non_fqdn_sender&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;reject_unknown_sender_domain&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;reject_unauth_pipelining&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;permit&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;smtpd_client_restrictions&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;reject_rbl_client&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sbl&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;spamhaus&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;org&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;reject_rbl_client&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;blackholes&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;easynet&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;nl&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;reject_rbl_client&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;barracudacentral&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;org&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;smtpd_recipient_restrictions&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;reject_unauth_pipelining&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;permit_mynetworks&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;permit_sasl_authenticated&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;reject_non_fqdn_recipient&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;reject_unknown_recipient_domain&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;reject_unauth_destination&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;check_policy_service&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;unix&lt;/span&gt;:/&lt;span class=&quot;n&quot;&gt;var&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;run&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;postgrey&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;postgrey&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;sock&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;permit&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;smtpd_data_restrictions&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;reject_unauth_pipelining&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;smtpd_relay_restrictions&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;reject_unauth_pipelining&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;permit_mynetworks&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;permit_sasl_authenticated&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;reject_non_fqdn_recipient&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;reject_unknown_recipient_domain&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;reject_unauth_destination&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;check_policy_service&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;unix&lt;/span&gt;:/&lt;span class=&quot;n&quot;&gt;var&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;run&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;postgrey&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;postgrey&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;sock&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;permit&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;smtpd_helo_required&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;yes&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;smtpd_delay_reject&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;yes&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;disable_vrfy_command&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;yes&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;mailbox_size_limit&lt;/span&gt; = &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;recipient_delimiter&lt;/span&gt; = +
&lt;span class=&quot;n&quot;&gt;non_smtpd_milters&lt;/span&gt;=&lt;span class=&quot;n&quot;&gt;unix&lt;/span&gt;:/&lt;span class=&quot;n&quot;&gt;var&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;run&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;opendkim&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;opendkim&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;sock&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;smtpd_milters&lt;/span&gt;=&lt;span class=&quot;n&quot;&gt;unix&lt;/span&gt;:/&lt;span class=&quot;n&quot;&gt;var&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;run&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;opendkim&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;opendkim&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;sock&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;We need to point &lt;strong&gt;Postfix&lt;/strong&gt; to our database map files. Use the same &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UID&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GID&lt;/code&gt; that was used for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vmail&lt;/code&gt; user and the existing &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mail&lt;/code&gt; group from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/group&lt;/code&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-conf&quot; data-lang=&quot;conf&quot;&gt;&lt;span class=&quot;n&quot;&gt;virtual_mailbox_base&lt;/span&gt; = /&lt;span class=&quot;n&quot;&gt;var&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;vmail&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;virtual_mailbox_maps&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;mysql&lt;/span&gt;:/&lt;span class=&quot;n&quot;&gt;etc&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;postfix&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;mysql&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;mysql_virtual_mailbox_maps&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;cf&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;mysql&lt;/span&gt;:/&lt;span class=&quot;n&quot;&gt;etc&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;postfix&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;mysql&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;mysql_virtual_mailbox_domainaliases_maps&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;cf&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;virtual_uid_maps&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;static&lt;/span&gt;:&lt;span class=&quot;m&quot;&gt;150&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;virtual_gid_maps&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;static&lt;/span&gt;:&lt;span class=&quot;m&quot;&gt;12&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;virtual_alias_maps&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;mysql&lt;/span&gt;:/&lt;span class=&quot;n&quot;&gt;etc&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;postfix&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;mysql&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;mysql_virtual_alias_maps&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;cf&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;mysql&lt;/span&gt;:/&lt;span class=&quot;n&quot;&gt;etc&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;postfix&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;mysql&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;mysql_virtual_alias_domainaliases_maps&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;cf&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;virtual_mailbox_domains&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;mysql&lt;/span&gt;:/&lt;span class=&quot;n&quot;&gt;etc&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;postfix&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;mysql&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;mysql_virtual_domains_maps&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;cf&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The final part of the file will set up &lt;strong&gt;Dovecot&lt;/strong&gt; and &lt;strong&gt;Amavis&lt;/strong&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-conf&quot; data-lang=&quot;conf&quot;&gt;&lt;span class=&quot;n&quot;&gt;virtual_transport&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;dovecot&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;dovecot_destination_recipient_limit&lt;/span&gt; = &lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;content_filter&lt;/span&gt; = &lt;span class=&quot;n&quot;&gt;amavis&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;forward&lt;/span&gt;:&lt;span class=&quot;n&quot;&gt;unix&lt;/span&gt;:&lt;span class=&quot;n&quot;&gt;amavis&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;amavisd&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;sock&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h1 id=&quot;postfix-master-configuration&quot;&gt;Postfix Master Configuration&lt;/h1&gt;

&lt;p&gt;In the file &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/postfix/master.cf&lt;/code&gt;, we’ll set up &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SMTP&lt;/code&gt; with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TLS&lt;/code&gt; on port &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;587&lt;/code&gt;. Most options can just be enabled by uncommenting them. Make sure you comment out the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-o syslog_name=postfix/$service_name&lt;/code&gt; option right under &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;relay&lt;/code&gt;.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-conf&quot; data-lang=&quot;conf&quot;&gt;&lt;span class=&quot;n&quot;&gt;smtp&lt;/span&gt;      &lt;span class=&quot;n&quot;&gt;inet&lt;/span&gt;  &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;       -       &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;       -       -       &lt;span class=&quot;n&quot;&gt;smtpd&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;submission&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;inet&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;       -       &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;       -       -       &lt;span class=&quot;n&quot;&gt;smtpd&lt;/span&gt;
  -&lt;span class=&quot;n&quot;&gt;o&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;syslog_name&lt;/span&gt;=&lt;span class=&quot;n&quot;&gt;postfix&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;submission&lt;/span&gt;
  -&lt;span class=&quot;n&quot;&gt;o&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;smtpd_tls_security_level&lt;/span&gt;=&lt;span class=&quot;n&quot;&gt;encrypt&lt;/span&gt;
  -&lt;span class=&quot;n&quot;&gt;o&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;smtpd_sasl_auth_enable&lt;/span&gt;=&lt;span class=&quot;n&quot;&gt;yes&lt;/span&gt;
  -&lt;span class=&quot;n&quot;&gt;o&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;smtpd_enforce_tls&lt;/span&gt;=&lt;span class=&quot;n&quot;&gt;yes&lt;/span&gt;
  -&lt;span class=&quot;n&quot;&gt;o&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;smtpd_client_restrictions&lt;/span&gt;=&lt;span class=&quot;n&quot;&gt;permit_sasl_authenticated&lt;/span&gt;,&lt;span class=&quot;n&quot;&gt;reject_unauth_destination&lt;/span&gt;,&lt;span class=&quot;n&quot;&gt;reject&lt;/span&gt;
  -&lt;span class=&quot;n&quot;&gt;o&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;smtpd_sasl_tls_security_options&lt;/span&gt;=&lt;span class=&quot;n&quot;&gt;noanonymous&lt;/span&gt;
  -&lt;span class=&quot;n&quot;&gt;o&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cleanup_service_name&lt;/span&gt;=&lt;span class=&quot;n&quot;&gt;subcleanup&lt;/span&gt;
  -&lt;span class=&quot;n&quot;&gt;o&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tls_preempt_cipherlist&lt;/span&gt;=&lt;span class=&quot;n&quot;&gt;yes&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;subcleanup&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;unix&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;       -       -       -       &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;       &lt;span class=&quot;n&quot;&gt;cleanup&lt;/span&gt;
  -&lt;span class=&quot;n&quot;&gt;o&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;header_checks&lt;/span&gt;=&lt;span class=&quot;n&quot;&gt;regexp&lt;/span&gt;:/&lt;span class=&quot;n&quot;&gt;etc&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;postfix&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;submission_header_checks&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;relay&lt;/span&gt;     &lt;span class=&quot;n&quot;&gt;unix&lt;/span&gt;  -       -       &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;       -       -       &lt;span class=&quot;n&quot;&gt;smtp&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;#       -o syslog_name=postfix/$service_name
#       -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;maildrop&lt;/span&gt;  &lt;span class=&quot;n&quot;&gt;unix&lt;/span&gt;  -       &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;       &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;       -       -       &lt;span class=&quot;n&quot;&gt;pipe&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;flags&lt;/span&gt;=&lt;span class=&quot;n&quot;&gt;DRXhu&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;user&lt;/span&gt;=&lt;span class=&quot;n&quot;&gt;vmail&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;argv&lt;/span&gt;=/&lt;span class=&quot;n&quot;&gt;usr&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;local&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;bin&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;maildrop&lt;/span&gt; -&lt;span class=&quot;n&quot;&gt;d&lt;/span&gt; ${&lt;span class=&quot;n&quot;&gt;recipient&lt;/span&gt;}

&lt;span class=&quot;n&quot;&gt;dovecot&lt;/span&gt;      &lt;span class=&quot;n&quot;&gt;unix&lt;/span&gt;   -        &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;      &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;       -       -   &lt;span class=&quot;n&quot;&gt;pipe&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;flags&lt;/span&gt;=&lt;span class=&quot;n&quot;&gt;DRXhu&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;user&lt;/span&gt;=&lt;span class=&quot;n&quot;&gt;vmail&lt;/span&gt;:&lt;span class=&quot;n&quot;&gt;mail&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;argv&lt;/span&gt;=/&lt;span class=&quot;n&quot;&gt;usr&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;libexec&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;dovecot&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;dovecot&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;lda&lt;/span&gt; -&lt;span class=&quot;n&quot;&gt;f&lt;/span&gt; ${&lt;span class=&quot;n&quot;&gt;sender&lt;/span&gt;} -&lt;span class=&quot;n&quot;&gt;d&lt;/span&gt; $(&lt;span class=&quot;n&quot;&gt;recipient&lt;/span&gt;)  &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;For &lt;strong&gt;Amavis&lt;/strong&gt;, just make sure you set the max number of processes it’s allowed to run. In this example, it’s &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;4&lt;/code&gt; (the same as the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nginx&lt;/code&gt; configuration).&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-conf&quot; data-lang=&quot;conf&quot;&gt;&lt;span class=&quot;n&quot;&gt;amavis&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;forward&lt;/span&gt;      &lt;span class=&quot;n&quot;&gt;unix&lt;/span&gt;    -       -       -       -       &lt;span class=&quot;m&quot;&gt;4&lt;/span&gt;       &lt;span class=&quot;n&quot;&gt;lmtp&lt;/span&gt;
  -&lt;span class=&quot;n&quot;&gt;o&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lmtp_data_done_timeout&lt;/span&gt;=&lt;span class=&quot;m&quot;&gt;1200&lt;/span&gt;
  -&lt;span class=&quot;n&quot;&gt;o&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lmtp_send_xforward_command&lt;/span&gt;=&lt;span class=&quot;n&quot;&gt;yes&lt;/span&gt;
  -&lt;span class=&quot;n&quot;&gt;o&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;disable_dns_lookups&lt;/span&gt;=&lt;span class=&quot;n&quot;&gt;yes&lt;/span&gt;
  -&lt;span class=&quot;n&quot;&gt;o&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;max_use&lt;/span&gt;=&lt;span class=&quot;m&quot;&gt;20&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;amavis&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;amavis&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;accept&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;unix&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;       -       -       -       -       &lt;span class=&quot;n&quot;&gt;smtpd&lt;/span&gt;
  -&lt;span class=&quot;n&quot;&gt;o&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;content_filter&lt;/span&gt;=
  -&lt;span class=&quot;n&quot;&gt;o&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;local_recipient_maps&lt;/span&gt;=
  -&lt;span class=&quot;n&quot;&gt;o&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;relay_recipient_maps&lt;/span&gt;=
  -&lt;span class=&quot;n&quot;&gt;o&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cleanup_service_name&lt;/span&gt;=&lt;span class=&quot;n&quot;&gt;cleanup&lt;/span&gt;
  -&lt;span class=&quot;n&quot;&gt;o&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;smtpd_restriction_classes&lt;/span&gt;=
  -&lt;span class=&quot;n&quot;&gt;o&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;smtpd_delay_reject&lt;/span&gt;=&lt;span class=&quot;n&quot;&gt;no&lt;/span&gt;
  -&lt;span class=&quot;n&quot;&gt;o&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;smtpd_client_restrictions&lt;/span&gt;=&lt;span class=&quot;n&quot;&gt;permit_mynetworks&lt;/span&gt;,&lt;span class=&quot;n&quot;&gt;reject&lt;/span&gt;
  -&lt;span class=&quot;n&quot;&gt;o&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;smtpd_helo_restrictions&lt;/span&gt;=
  -&lt;span class=&quot;n&quot;&gt;o&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;smtpd_sender_restrictions&lt;/span&gt;=
  -&lt;span class=&quot;n&quot;&gt;o&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;smtpd_recipient_restrictions&lt;/span&gt;=&lt;span class=&quot;n&quot;&gt;permit_mynetworks&lt;/span&gt;,&lt;span class=&quot;n&quot;&gt;reject&lt;/span&gt;
  -&lt;span class=&quot;n&quot;&gt;o&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;smtpd_data_restrictions&lt;/span&gt;=&lt;span class=&quot;n&quot;&gt;reject_unauth_pipelining&lt;/span&gt;
  -&lt;span class=&quot;n&quot;&gt;o&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;smtpd_end_of_data_restrictions&lt;/span&gt;=
  -&lt;span class=&quot;n&quot;&gt;o&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;mynetworks&lt;/span&gt;=&lt;span class=&quot;m&quot;&gt;127&lt;/span&gt;.&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;.&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;.&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;/&lt;span class=&quot;m&quot;&gt;8&lt;/span&gt;
  -&lt;span class=&quot;n&quot;&gt;o&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;smtpd_error_sleep_time&lt;/span&gt;=&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;
  -&lt;span class=&quot;n&quot;&gt;o&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;smtpd_soft_error_limit&lt;/span&gt;=&lt;span class=&quot;m&quot;&gt;1001&lt;/span&gt;
  -&lt;span class=&quot;n&quot;&gt;o&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;smtpd_hard_error_limit&lt;/span&gt;=&lt;span class=&quot;m&quot;&gt;1000&lt;/span&gt;
  -&lt;span class=&quot;n&quot;&gt;o&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;smtpd_client_connection_count_limit&lt;/span&gt;=&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;
  -&lt;span class=&quot;n&quot;&gt;o&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;smtpd_client_connection_rate_limit&lt;/span&gt;=&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;
  -&lt;span class=&quot;n&quot;&gt;o&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;receive_override_options&lt;/span&gt;=&lt;span class=&quot;n&quot;&gt;no_header_body_checks&lt;/span&gt;,&lt;span class=&quot;n&quot;&gt;no_unknown_recipient_checks&lt;/span&gt;,&lt;span class=&quot;n&quot;&gt;no_milters&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Run the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;newaliases&lt;/code&gt; command to generate the aliases database file&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; /etc/postfix/
newaliases&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h1 id=&quot;amavis-with-clamav-and-spamassassin&quot;&gt;Amavis with ClamAV and SpamAssassin&lt;/h1&gt;

&lt;p&gt;We are going to be using &lt;strong&gt;amavsid-new&lt;/strong&gt; as the interface bewtween &lt;strong&gt;Postfix&lt;/strong&gt;, &lt;strong&gt;ClamAV&lt;/strong&gt; and &lt;strong&gt;SpamAssassin&lt;/strong&gt;. We need a ton of things for &lt;strong&gt;Amavis&lt;/strong&gt; and &lt;strong&gt;SpamAssassin&lt;/strong&gt;. You can go the &lt;strong&gt;SlackBuilds&lt;/strong&gt; route or just use &lt;strong&gt;CPAN&lt;/strong&gt;. I’m going to just go with &lt;strong&gt;CPAN&lt;/strong&gt; this time around. First, install the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;zeromq&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pyzor&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;unrar&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;arj&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cabextract&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;lzop&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nomarch&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;p7zip&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;libmspack&lt;/code&gt;, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GeoIP&lt;/code&gt; dependencies. This allows &lt;strong&gt;SpamAssassin&lt;/strong&gt; and &lt;strong&gt;ClamAV&lt;/strong&gt; to handle different compressed files as well.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;cpan &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;CPAN
cpan &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;App::cpanminus
cpanm &lt;span class=&quot;nt&quot;&gt;-f&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; Log::Log4perl
cpanm &lt;span class=&quot;nt&quot;&gt;-f&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; Test::Deep Test::Base Test::YAML YAML Module::Signature Module::Build Test::Pod Test::Pod::Coverage Test::Perl::Critic inc::latest Encode::Detect Image::Info TimeDate Net::LibIDN Net::SSLeay Socket6 IO::Socket::IP IO::Socket::SSL IO::Socket::INET6 Crypt::OpenSSL::Bignum Crypt::OpenSSL::Random Crypt::OpenSSL::RSA Geography::Countries IP::Country Digest::SHA Digest::SHA1 Digest::HMAC HTML::Tagset HTML::Parser Test::LeakTrace Authen::NTLM Data::Dump LWP Net::CIDR::Lite PAR::Dist ExtUtils::MakeMaker ExtUtils::Install Net::HTTP WWW::RobotRules HTTP::Date File::Listing IO::HTML Encode::Locale LWP::Protocol::https LWP::MediaTypes HTTP::Message HTTP::Negotiate HTTP::Cookies HTTP::Daemon Bundle::LWP NetAddr::IP Net::Server Net::Ident MailTools Net::IP Net::DNS Net::DNS::Resolver::Programmable Mail::SPF Mail::DKIM Geo::IP Net::Patricia Convert::TNEF Convert::UUlib Convert::BinHex Archive::Zip IO::Stringy MIME::Tools Unix::Syslog BerkeleyDB IO::Multiplex Net::LibIDN File::LibMagic&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h1 id=&quot;spamassassin&quot;&gt;SpamAssassin&lt;/h1&gt;

&lt;p&gt;Get the &lt;a href=&quot;https://github.com/Ponce/slackbuilds/tree/current/network/spamassassin/&quot;&gt;SpamAssassin SlackBuild&lt;/a&gt; and build it.&lt;/p&gt;

&lt;p&gt;After &lt;strong&gt;SpamAssassin&lt;/strong&gt; is installed, edit the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/spamassassin.conf&lt;/code&gt; file and set the following options. You only really need &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ENABLED&lt;/code&gt; but the rest are a good idea.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-conf&quot; data-lang=&quot;conf&quot;&gt;&lt;span class=&quot;n&quot;&gt;ENABLED&lt;/span&gt;=&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;OPTIONS&lt;/span&gt;=&lt;span class=&quot;s2&quot;&gt;&quot;--create-prefs --max-children 5 --helper-home-dir&quot;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;PIDFILE&lt;/span&gt;=&lt;span class=&quot;s2&quot;&gt;&quot;/var/run/spamd.pid&quot;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;CRON&lt;/span&gt;=&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The &lt;strong&gt;SpamAssassin&lt;/strong&gt; source no longer includes rules, so you’ll have to download them. Run &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sa-update&lt;/code&gt; to do this.&lt;/p&gt;

&lt;h1 id=&quot;clamav&quot;&gt;ClamAV&lt;/h1&gt;

&lt;p&gt;You’ll need a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;user&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;group&lt;/code&gt; created first.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;groupadd &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; 210 clamav
useradd &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; 210 &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; /dev/null &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; /bin/false &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; clamav clamav&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Now go ahead and grab the &lt;a href=&quot;https://github.com/Ponce/slackbuilds/tree/current/system/clamav/&quot;&gt;SlackBuild&lt;/a&gt;. After you install, make sure &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DatabaseMirror&lt;/code&gt; is set to the new &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;database.clamav.net&lt;/code&gt; mirror in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/freshclam.conf&lt;/code&gt;. Next, edit the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/clamd.conf&lt;/code&gt; file and change the&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;LocalSocket&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;LocalSocketGroup&lt;/code&gt; options&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-conf&quot; data-lang=&quot;conf&quot;&gt;&lt;span class=&quot;n&quot;&gt;LocalSocket&lt;/span&gt; /&lt;span class=&quot;n&quot;&gt;var&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;run&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;clamav&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;clamd&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;sock&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;LocalSocketGroup&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;amavis&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Let’s install &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;amavisd-new&lt;/code&gt; before we update the &lt;strong&gt;ClamAV&lt;/strong&gt; virus definitions.&lt;/p&gt;

&lt;h1 id=&quot;amavisd-new&quot;&gt;amavisd-new&lt;/h1&gt;

&lt;p&gt;Create a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;user&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;group&lt;/code&gt; before you run the script.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;groupadd &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; 225 amavis
useradd &lt;span class=&quot;nt&quot;&gt;-m&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; /var/lib/amavis &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; /bin/bash &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; 225 &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; 225 amavis&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;While we’re at it, go ahead and add the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;amavis&lt;/code&gt; user to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;clamav&lt;/code&gt; group and vice versa.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;usermod &lt;span class=&quot;nt&quot;&gt;-G&lt;/span&gt; clamav &lt;span class=&quot;nt&quot;&gt;-a&lt;/span&gt; amavis
usermod &lt;span class=&quot;nt&quot;&gt;-G&lt;/span&gt; amavis &lt;span class=&quot;nt&quot;&gt;-a&lt;/span&gt; clamav&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Run the &lt;a href=&quot;https://github.com/Ponce/slackbuilds/tree/current/network/amavisd-new/&quot;&gt;SlackBuild&lt;/a&gt; to install the package. Afer you install, uncomment the lines &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@bypass_virus_checks_maps&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@bypass_spam_checks_maps&lt;/code&gt; at the top of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/amavisd.conf&lt;/code&gt; and add the following&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-perl&quot; data-lang=&quot;perl&quot;&gt;&lt;span class=&quot;nv&quot;&gt;@bypass_virus_checks_maps&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
   &lt;span class=&quot;nv&quot;&gt;%bypass_virus_checks&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;@bypass_virus_checks_acl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$bypass_virus_checks_re&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;@bypass_spam_checks_maps&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
   &lt;span class=&quot;nv&quot;&gt;%bypass_spam_checks&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;@bypass_spam_checks_acl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$bypass_spam_checks_re&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Next, uncomment &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@lookup_sql_dsn&lt;/code&gt; and modify it to connect to your database using the &lt;strong&gt;Unix&lt;/strong&gt; socket and the proper credentials. &lt;strong&gt;Amavis&lt;/strong&gt; uses the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DBD::mysql&lt;/code&gt; &lt;strong&gt;Perl&lt;/strong&gt; module. The &lt;a href=&quot;https://metacpan.org/pod/DBD::mysql&quot;&gt;documentation&lt;/a&gt; states setting the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;host&lt;/code&gt; value to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;localhost&lt;/code&gt; will use the socket. This configuration will enable spam checking for the domains you’ve added to your database either manually or through &lt;strong&gt;Postfix Admin&lt;/strong&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-perl&quot; data-lang=&quot;perl&quot;&gt;&lt;span class=&quot;nv&quot;&gt;@lookup_sql_dsn&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;['&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;DBI:mysql:database=mail;host=localhost&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;',&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;mail&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;',&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;mailpassword&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;']);&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$sql_select_policy&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;SELECT domain from domain WHERE CONCAT(&quot;@&quot;,domain) IN (%k)&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;';&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;There are a number of configuration options we can change in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/amavisd.conf&lt;/code&gt;. The only really important one is the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;unix socket&lt;/code&gt; configuration. My recommendations are:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Set &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$max_servers&lt;/code&gt; to the same number of processes we allowed &lt;strong&gt;Amavis&lt;/strong&gt; to use in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/postfix/master.cf&lt;/code&gt;, which in my case is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;4&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;Set the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$sa_tag_level_deflt&lt;/code&gt; opton to a large negative number. This will ensure that spam headers are added to every single email&lt;/li&gt;
  &lt;li&gt;Change the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;user&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;group&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;amavis&lt;/code&gt; that we created earlier&lt;/li&gt;
  &lt;li&gt;Configure the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;home&lt;/code&gt; directory for configuraiton files and quarantine emails&lt;/li&gt;
  &lt;li&gt;Set the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;domain name&lt;/code&gt; (not the same as your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;hostname&lt;/code&gt;).&lt;/li&gt;
  &lt;li&gt;Uncomment the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;amavis&lt;/code&gt; section in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@av_scanners&lt;/code&gt;. Leave the rest of this section as is.&lt;/li&gt;
  &lt;li&gt;Comment out the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$inet_socket_port&lt;/code&gt; line&lt;/li&gt;
  &lt;li&gt;Set the &lt;strong&gt;Unix&lt;/strong&gt; socket for &lt;strong&gt;Amavis&lt;/strong&gt; in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$unix_socketname&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;Comment out &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;forward_method&lt;/code&gt; for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DKIM&lt;/code&gt; signing since we’ll use &lt;strong&gt;OpenDKIM&lt;/strong&gt; for that&lt;/li&gt;
  &lt;li&gt;Set the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pid_file&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/var/run/amavis/amavisd.pid&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The end result should look something like:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-perl&quot; data-lang=&quot;perl&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$max_servers&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$sa_tag_level_deflt&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;9999&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$daemon_user&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;amavis&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;';&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$daemon_group&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;amavis&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;';&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$mydomain&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;example.org&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;';&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$myhostname&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;mail.example.org&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;';&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$MYHOME&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;/var/lib/amavis&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;';&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$QUARANTINEDIR&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$MYHOME&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/virusmails&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&quot;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$unix_socketname&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/var/spool/postfix/amavis/amavisd.sock&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&quot;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$unix_socket_mode&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mo&quot;&gt;0660&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$pid_file&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/var/run/amavis/amavisd.pid&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&quot;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$interface_policy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;SOCK&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;'}&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;mysock&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;';&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$policy_bank&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;mysock&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;'}&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
   &lt;span class=&quot;s&quot;&gt;protocol&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;LMTP&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;',&lt;/span&gt;
   &lt;span class=&quot;s&quot;&gt;auth_required_release&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;@av_scanners&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;['&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;ClamAV-clamd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;',&lt;/span&gt;
   &lt;span class=&quot;o&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;&amp;amp;ask_daemon&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;CONTSCAN {}&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&quot;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/var/run/clamav/clamd.sock&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&quot;],&lt;/span&gt;
   &lt;span class=&quot;sx&quot;&gt;qr/\bOK$/&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;m, qr/\bFOUND$/m,&lt;/span&gt;
   &lt;span class=&quot;sx&quot;&gt;qr/^.*?: (?!Infected Archive)(.*) FOUND$/&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;m&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Since we are putting the &lt;strong&gt;Amavis&lt;/strong&gt; socket in the &lt;strong&gt;Postfix&lt;/strong&gt; queue directory, we’ll need to create it and set the permissions&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nb&quot;&gt;mkdir&lt;/span&gt; /var/spool/postfix/amavis/
&lt;span class=&quot;nb&quot;&gt;chmod &lt;/span&gt;770 /var/spool/postfix/amavis/
&lt;span class=&quot;nb&quot;&gt;chown &lt;/span&gt;amavis:postfix /var/spool/postfix/amavis/
usermod &lt;span class=&quot;nt&quot;&gt;-G&lt;/span&gt; amavis &lt;span class=&quot;nt&quot;&gt;-a&lt;/span&gt; postfix&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Use the following commands to let &lt;strong&gt;Postfix&lt;/strong&gt; create the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;amavis-accept&lt;/code&gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PID&lt;/code&gt;:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; /var/spool/postfix/public
&lt;span class=&quot;nb&quot;&gt;ln&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; ../amavis amavis
&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; /var/spool/postfix/pid
&lt;span class=&quot;nb&quot;&gt;mkdir &lt;/span&gt;unix.amavis
&lt;span class=&quot;nb&quot;&gt;chown &lt;/span&gt;root:root unix.amavis
&lt;span class=&quot;nb&quot;&gt;chmod &lt;/span&gt;700 unix.amavis&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;In order for the above to work, we need to set a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$forward_method&lt;/code&gt; in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/amavisd.conf&lt;/code&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-perl&quot; data-lang=&quot;perl&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$forward_method&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;smtp:/var/spool/postfix/amavis/amavis-accept&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;';&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;If for any reason this is not working, you can edit the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/usr/sbin/amavisd&lt;/code&gt; &lt;strong&gt;Perl&lt;/strong&gt; script directly. Look around line &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;926&lt;/code&gt; or search for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;10025&lt;/code&gt;. Comment out the existing &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$forward_method&lt;/code&gt; and replace it with this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-perl&quot; data-lang=&quot;perl&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$forward_method&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$have_inet6&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$have_inet4&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;smtp:[::1]:10025&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;'&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;smtp:/var/spool/postfix/amavis/amavis-accept&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;';&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Go through the rest of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/amavisd.conf&lt;/code&gt; file and modify any settings you might want changed.&lt;/p&gt;

&lt;p&gt;We also need to fix some permissions to get all three of these to play nicely.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nb&quot;&gt;chmod &lt;/span&gt;775 /var/lib/spamassassin/
&lt;span class=&quot;nb&quot;&gt;chown &lt;/span&gt;amavis:amavis /var/lib/spamassassin/
&lt;span class=&quot;nb&quot;&gt;chown&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-R&lt;/span&gt; amavis:amavis /var/lib/spamassassin/
&lt;span class=&quot;nb&quot;&gt;chown&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-R&lt;/span&gt; amavis:amavis /var/lib/amavis
&lt;span class=&quot;nb&quot;&gt;chown&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-R&lt;/span&gt; clamav:amavis /var/lib/clamav&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Now go ahead and update your virus database by running &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;freshclam&lt;/code&gt; as root. Don’t worry if you get a message from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;freshclam&lt;/code&gt; saying &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;clamd&lt;/code&gt; was not updated. This is because we have not started &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;clamd&lt;/code&gt; yet.&lt;/p&gt;

&lt;h1 id=&quot;postgrey&quot;&gt;Postgrey&lt;/h1&gt;

&lt;p&gt;Set up the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;user&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;group&lt;/code&gt; first, then run the &lt;a href=&quot;https://github.com/Ponce/slackbuilds/tree/current/network/postgrey&quot;&gt;SlackBuild&lt;/a&gt; to install &lt;strong&gt;Postgrey&lt;/strong&gt;.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;groupadd &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; 301 postgrey
useradd &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; 301 &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; /var/lib/postgrey &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; /bin/false &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; postgrey postgrey&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Go and edit the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SlackBuild&lt;/code&gt; to set the values of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;POSTGREYUSR&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;POSTGREYGRP&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;POSTGREYUID&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;POSTGREYGID&lt;/code&gt; to the values you set earlier when you created them. After you install, you may want to get an updated version of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;postgrey_whitelist_clients&lt;/code&gt; from the &lt;a href=&quot;https://postgrey.schweikert.ch/pub/postgrey_whitelist_clients&quot;&gt;Postgrey site&lt;/a&gt; and place it in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/postfix&lt;/code&gt;, replacing the one included with the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SlackBuild&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;We need to edit the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/postgrey.conf&lt;/code&gt; file and replace the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PORT&lt;/code&gt; line with the path to the &lt;strong&gt;Unix&lt;/strong&gt; socket we are going to set up. Set the correct &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;HOST&lt;/code&gt; and make sure &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;USER&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GROUP&lt;/code&gt; are also correct.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-conf&quot; data-lang=&quot;conf&quot;&gt;&lt;span class=&quot;n&quot;&gt;SOCKET&lt;/span&gt;=/&lt;span class=&quot;n&quot;&gt;var&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;run&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;postgrey&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;postgrey&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;sock&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;PIDFILE&lt;/span&gt;=/&lt;span class=&quot;n&quot;&gt;var&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;run&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;postgrey&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;postgrey&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;pid&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;USER&lt;/span&gt;=&lt;span class=&quot;n&quot;&gt;postgrey&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;GROUP&lt;/span&gt;=&lt;span class=&quot;n&quot;&gt;postgrey&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;HOST&lt;/span&gt;=&lt;span class=&quot;n&quot;&gt;mail&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;example&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;org&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;In the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/rc.d/rc.postgrey&lt;/code&gt; script we are going to find the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;postgrey_start()&lt;/code&gt; function and edit the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;postgrey&lt;/code&gt; flags to make sure it uses a socket instead of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TCP&lt;/code&gt;. We are basically changing &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--inet=$PORT&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--unix=$SOCKET&lt;/code&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;postgrey_start&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Starting postgrey milter:  /usr/bin/postgrey -d --inet=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$PORT&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; --pidfile=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$PIDFILE&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; --user=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$USER&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; --group=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$GROUP&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; --dbdir=/var/lib/postgrey --hostname=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$HOST&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;mkdir&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; &lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;dirname&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$PIDFILE&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;chown&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;USER&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;:&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;GROUP&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;dirname&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$PIDFILE&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;

  /usr/bin/postgrey &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
                    &lt;span class=&quot;nt&quot;&gt;--inet&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$PORT&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
                    &lt;span class=&quot;nt&quot;&gt;--pidfile&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$PIDFILE&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
                    &lt;span class=&quot;nt&quot;&gt;--user&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$USER&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--group&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$GROUP&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
                    &lt;span class=&quot;nt&quot;&gt;--dbdir&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/var/lib/postgrey &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
                    &lt;span class=&quot;nt&quot;&gt;--hostname&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$HOST&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The extracted source includes an init script, too. It’s in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;contrib/postgrey.init&lt;/code&gt; if you want to use it.&lt;/p&gt;

&lt;h1 id=&quot;opendkim-dns-and-building-trust&quot;&gt;OpenDKIM, DNS and Building Trust&lt;/h1&gt;

&lt;p&gt;The setup up to this point should be pretty much complete and meet most people’s needs. Some mail servers are quite picky when it comes to receiving email. Gmail particularly doesn’t like when an email is not signed. The next section will walk you through signing your email with &lt;strong&gt;DomainKeys Identified Mail&lt;/strong&gt; and setting up &lt;strong&gt;Sender Policy Framework&lt;/strong&gt;. If you are using a hosting provider for your server, you will need to contact them and have them set up a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PTR&lt;/code&gt; record for your IP address. This is also known as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rDNS&lt;/code&gt;. Some mail servers will reject your email if the IP you are sending from does not point back to your domain name. In general, it should look something like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-plaintext&quot; data-lang=&quot;plaintext&quot;&gt;34.216.184.93.in-addr.arpa PTR 600 example.org&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;If you’re hosting at home, you can try asking your ISP to set this up for you but it is unlikely they’ll want to. They may be willing if you purchase a static IP. You’ll also need to add &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MX&lt;/code&gt; records to your domain’s &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DNS&lt;/code&gt; records. You can add something like this&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-plaintext&quot; data-lang=&quot;plaintext&quot;&gt;example.org MX 600 10 mail.example.org&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;That’s assuming &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mail.example.org&lt;/code&gt; points to your mail sever’s IP and you want a priority of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;10&lt;/code&gt;. You can ask your DNS provider to add these for you. Check that the record has propagated with host:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-console&quot; data-lang=&quot;console&quot;&gt;&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;host &lt;span class=&quot;nt&quot;&gt;-t&lt;/span&gt; MX example.org
&lt;span class=&quot;go&quot;&gt;example.org mail is handled by 10 mail.example.org.&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h1 id=&quot;opendkim&quot;&gt;OpenDKIM&lt;/h1&gt;

&lt;p&gt;Install (&lt;a href=&quot;https://github.com/Ponce/slackbuilds/tree/current/libraries/libbsd/&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;libbsd&lt;/code&gt;&lt;/a&gt;), (&lt;a href=&quot;https://github.com/Ponce/slackbuilds/tree/current/development/opendbx/&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;opendbx&lt;/code&gt;&lt;/a&gt;), then grab my &lt;a href=&quot;https://github.com/Ponce/slackbuilds/tree/current/network/opendkim/&quot;&gt;SlackBuild&lt;/a&gt; and install &lt;strong&gt;OpenDKIM&lt;/strong&gt;. Set up the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;user&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;group&lt;/code&gt; first:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;groupadd &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; 305 opendkim
useradd &lt;span class=&quot;nt&quot;&gt;-r&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; 305 &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; opendkim &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; /var/run/opendkim/ &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; /sbin/nologin &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;OpenDKIM Milter&quot;&lt;/span&gt; opendkim&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;We’ll need to create the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;run&lt;/code&gt; directory as well:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nb&quot;&gt;mkdir&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; /var/run/opendkim
&lt;span class=&quot;nb&quot;&gt;chown &lt;/span&gt;opendkim:opendkim /var/run/opendkim&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Add this to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/rc.d/rc.opendkim&lt;/code&gt; script to have it created automatically&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nb&quot;&gt;mkdir&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; &lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;dirname&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$PID_FILE&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;chown&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;USER&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;:&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;GROUP&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;dirname&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$PID_FILE&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;We are using &lt;strong&gt;MariaDB&lt;/strong&gt; here so set the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;USE_MYSQL&lt;/code&gt; variable to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;yes&lt;/code&gt; and run the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SlackBuild&lt;/code&gt;. I used a modified version of CentOS’s &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;init&lt;/code&gt; script for &lt;a href=&quot;https://github.com/Ponce/slackbuilds/tree/current/network/opendkim/rc.opendkim&quot;&gt;rc.opendkim&lt;/a&gt;, but feel free to grab the one included in the source in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;contrib/init/generic/&lt;/code&gt; directory.&lt;/p&gt;

&lt;p&gt;Once it’s installed, we’ll need to set up a basic configuration file. You can copy the sample one from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;opendkim/opendkim.conf.simple&lt;/code&gt; in the extracted source to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/opendkim&lt;/code&gt; and add the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;user&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;group&lt;/code&gt; we created earlier. Note that the &lt;a href=&quot;https://github.com/Ponce/slackbuilds/tree/current/network/opendkim/opendkim.SlackBuild&quot;&gt;SlackBuild&lt;/a&gt; already does this for you:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;UserID opendkim:opendkim
KeyFile /etc/opendkim/keys/default.private&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;KeyFile&lt;/code&gt; is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;default.private&lt;/code&gt; since this is what’s set in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/rc.d/rc.opendkim&lt;/code&gt;. The string &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;default&lt;/code&gt; is called the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;selector&lt;/code&gt;. Feel free to use any &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;selector&lt;/code&gt; you want. The selector is used to differentiate between multiple &lt;strong&gt;DKIM&lt;/strong&gt; records for your domain.&lt;/p&gt;

&lt;p&gt;You’ll notice my &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;init&lt;/code&gt; script will automatically create some default keys for you in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/opendkim/keys&lt;/code&gt; and it also creates the directory if it doesn’t exist. We’re using &lt;strong&gt;Unix&lt;/strong&gt; sockets in this guide, so let’s change a line in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/opendkim.conf&lt;/code&gt;:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-conf&quot; data-lang=&quot;conf&quot;&gt;&lt;span class=&quot;n&quot;&gt;Socket&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;local&lt;/span&gt;:/&lt;span class=&quot;n&quot;&gt;var&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;run&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;opendkim&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;opendkim&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;sock&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;Domain&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;example&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;org&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;UMask&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0002&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;We’ll generate a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;2048&lt;/code&gt; bit key with the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;opendkim-genkey&lt;/code&gt; command. You can try something stronger like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;4096&lt;/code&gt; bits, but &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;RFC 6376&lt;/code&gt; suggests it might not fit in a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;512&lt;/code&gt; byte &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DNS&lt;/code&gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UDP&lt;/code&gt; response. See section &lt;a href=&quot;https://tools.ietf.org/html/rfc6376#section-3.3&quot;&gt;3.3.3 Key Sizes&lt;/a&gt; for more information.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;opendkim-genkey &lt;span class=&quot;nt&quot;&gt;-b&lt;/span&gt; 2048 &lt;span class=&quot;nt&quot;&gt;-D&lt;/span&gt; /etc/opendkim/keys &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; default &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; example.org&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The selector is set with the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-s&lt;/code&gt; parameter. You’ll end up with two files inside &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/opendkim/keys/&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;default.private&lt;/code&gt;, which is your key, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;default.txt&lt;/code&gt; which has a nicely formatted record you’ll need to add to your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DNS&lt;/code&gt; zone. If you don’t manage your own &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DNS&lt;/code&gt; or have access to your zone file, simply copy the text starting with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;v=DKIM1&lt;/code&gt; as a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TXT&lt;/code&gt; record in whatever control panel your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DNS&lt;/code&gt; provider uses. For the example above, this is what I got (truncated for demonstration):&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-plaintext&quot; data-lang=&quot;plaintext&quot;&gt;&quot;v=DKIM1; k=rsa;
p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0m8F6p1AD&quot;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;You’ll need to wait a while before the DNS record propagates but once it does you can check it with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dig&lt;/code&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-console&quot; data-lang=&quot;console&quot;&gt;&lt;span class=&quot;go&quot;&gt;dig default._domainkey.example.org TXT&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h1 id=&quot;sender-policy-framework&quot;&gt;Sender Policy Framework&lt;/h1&gt;

&lt;p&gt;This basically consists of adding another &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TXT&lt;/code&gt; record to your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DNS&lt;/code&gt; zone. There used to be an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SPF&lt;/code&gt; type record but this was removed in &lt;a href=&quot;https://tools.ietf.org/html/rfc7208&quot;&gt;RFC 7208&lt;/a&gt;. You’ll want to add something like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-plaintext&quot; data-lang=&quot;plaintext&quot;&gt;v=spf1 a mx ~all&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h1 id=&quot;mariadb&quot;&gt;MariaDB&lt;/h1&gt;

&lt;p&gt;We’ll set up &lt;strong&gt;MariaDB&lt;/strong&gt; first (the scripts are still named &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rc.mysqld&lt;/code&gt;):&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nb&quot;&gt;chmod&lt;/span&gt; +x /etc/rc.d/rc.mysqld
/usr/bin/mysql_install_db &lt;span class=&quot;nt&quot;&gt;--user&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;mysql
/etc/rc.d/rc.mysqld start
/usr/bin/mysql_secure_installation&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Now create the user and database we’ll be using for &lt;strong&gt;Roundcube&lt;/strong&gt;, &lt;strong&gt;Postfix Admin&lt;/strong&gt;, and all other components.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sql&quot; data-lang=&quot;sql&quot;&gt;&lt;span class=&quot;k&quot;&gt;CREATE&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;DATABASE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;mail&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;GRANT&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;ALL&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;PRIVILEGES&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;ON&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;mail&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;TO&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;&quot;mail&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;&quot;localhost&quot;&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;\&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;IDENTIFIED&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;BY&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;&quot;password-here&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;FLUSH&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;PRIVILEGES&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h1 id=&quot;roundcube-and-postfix-admin&quot;&gt;Roundcube and Postfix Admin&lt;/h1&gt;

&lt;p&gt;The same advice from my previous post regarding web based interfaces applies.&lt;/p&gt;

&lt;h1 id=&quot;postfix-admin&quot;&gt;Postfix Admin&lt;/h1&gt;

&lt;p&gt;Not many updates to &lt;strong&gt;Postfix Admin&lt;/strong&gt; this time. We still set &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;public/&lt;/code&gt; as the root directory in our &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nginx&lt;/code&gt; configuration above so just proceed with the installation as normal:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; /var/www/
wget https://github.com/postfixadmin/postfixadmin/archive/postfixadmin-3.2.4.tar.gz
&lt;span class=&quot;nb&quot;&gt;tar&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-xzf&lt;/span&gt; postfixadmin-3.2.4.tar.gz
&lt;span class=&quot;nb&quot;&gt;ln&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; postfixadmin-postfixadmin-3.2.4 postfixadmin
&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;postfixadmin
&lt;span class=&quot;nb&quot;&gt;mkdir &lt;/span&gt;templates_c
&lt;span class=&quot;nb&quot;&gt;chown &lt;/span&gt;nginx:root templates_c&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Make a copy of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;config.inc.php&lt;/code&gt; as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;config.local.php&lt;/code&gt; and make your changes there. The ones we need for this guide are&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$CONF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'configured'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$CONF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'database_type'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'mysqli'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$CONF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'database_user'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'mail'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$CONF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'database_password'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;password-here&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$CONF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'database_name'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'mail'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$CONF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'database_socket'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'/var/run/mysql/mysql.sock'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$CONF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'admin_email'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'admin@example.org'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$CONF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'encrypt'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'dovecot:SHA512-CRYPT'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$CONF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'dovecotpw'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;/usr/bin/doveadm pw&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$CONF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'default_aliases'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;array&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;s1&quot;&gt;'abuse'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'admin@example.org'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;s1&quot;&gt;'hostmaster'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'admin@example.org'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;s1&quot;&gt;'postmaster'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'admin@example.org'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;s1&quot;&gt;'webmaster'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'admin@example.org'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;s1&quot;&gt;'virusalert'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'admin@example.org'&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$CONF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'domain_path'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'NO'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$CONF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'domain_in_mailbox'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'YES'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$CONF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'footer_text'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'Return to example.org'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$CONF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'footer_link'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'https://example.org;'&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$CONF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'emailcheck_resolve_domain'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'NO'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$CONF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'password_expiration'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'NO'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Comment out the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$CONF['database_host'] = 'localhost';&lt;/code&gt; line because we are using sockets here.&lt;/p&gt;

&lt;p&gt;This tells &lt;strong&gt;Postfix Admin&lt;/strong&gt; to use &lt;strong&gt;Dovecot&lt;/strong&gt;’s &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;crypt()&lt;/code&gt; scheme for passwords and to connect to &lt;strong&gt;MariaDB&lt;/strong&gt; using &lt;strong&gt;Unix&lt;/strong&gt; sockets. Next, visit &lt;a href=&quot;https://mail.example.org/postfixadmin/setup.php&quot;&gt;https://mail.example.org/postfixadmin/setup.php&lt;/a&gt; and complete the setup. Make sure you add your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$CONF['setup_password']&lt;/code&gt; obtained from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;setup.php&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;config.local.php&lt;/code&gt;. Do this before clicking on &lt;strong&gt;Add Admin&lt;/strong&gt;.&lt;/p&gt;

&lt;h1 id=&quot;add-email-domains-and-mailboxes&quot;&gt;Add Email Domains and Mailboxes&lt;/h1&gt;

&lt;p&gt;Log in to &lt;a href=&quot;https://mail.example.org/postfixadmin&quot;&gt;https://mail.example.org/postfixadmin&lt;/a&gt; and head over to &lt;strong&gt;Domain List&lt;/strong&gt; &amp;gt; &lt;strong&gt;New Domain&lt;/strong&gt;. Fill in whatever works for you here to add a new domain, then head to &lt;strong&gt;Virtual List&lt;/strong&gt; &amp;gt; &lt;strong&gt;Add Mailbox&lt;/strong&gt; and create your first user. I set up &lt;a href=&quot;http://example.org&quot;&gt;example.org&lt;/a&gt; as an email domain and &lt;a href=&quot;mailto:admin@example.org&quot;&gt;admin@example.org&lt;/a&gt; as my first user. Doing this will generate the needed database schema that &lt;strong&gt;Postfix&lt;/strong&gt; will use. Go ahead and play around with this and make sure your aliases are set up&lt;/p&gt;

&lt;h1 id=&quot;roundcube&quot;&gt;Roundcube&lt;/h1&gt;

&lt;p&gt;The latest version of &lt;strong&gt;Roundcube&lt;/strong&gt; is now &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;1.4.10&lt;/code&gt;. There is a cool new mobile friendly theme now, too. We’ve already set up the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nginx&lt;/code&gt; configuration for &lt;strong&gt;Postfix Admin&lt;/strong&gt; and &lt;strong&gt;Roundcube&lt;/strong&gt; so now we just have to download their files and run the installers.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; /var/www/
wget https://github.com/roundcube/roundcubemail/releases/download/1.4.10/roundcubemail-1.4.10-complete.tar.gz
&lt;span class=&quot;nb&quot;&gt;tar&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-xvzf&lt;/span&gt; roundcubemail-1.4.10-complete.tar.gz
&lt;span class=&quot;nb&quot;&gt;ln&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; roundcubemail-1.4.10 roundcubemail
&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;roundcubemail
&lt;span class=&quot;nb&quot;&gt;chown &lt;/span&gt;nginx:root logs/ temp/&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;We’ll need to create a database for &lt;strong&gt;Roundcube&lt;/strong&gt; to use. Log in to *8MariaDB** with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mysql&lt;/code&gt; and create it. Make sure you use a strong password.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sql&quot; data-lang=&quot;sql&quot;&gt;&lt;span class=&quot;k&quot;&gt;CREATE&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;DATABASE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;roundcubemail&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;CHARACTER&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;SET&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;utf8&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;COLLATE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;utf8_general_ci&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;GRANT&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;ALL&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;PRIVILEGES&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;ON&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;roundcubemail&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;TO&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;&quot;roundcube&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;&quot;localhost&quot;&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;\&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;IDENTIFIED&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;BY&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;&quot;password-here&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;FLUSH&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;PRIVILEGES&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;strong&gt;Roundcube&lt;/strong&gt; includes an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SQL&lt;/code&gt; file that can create the necessary database structure for you&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;mysql &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; roundcube roundcubemail &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; &amp;lt; SQL/mysql.initial.sql&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;I recommend you check out the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;INSTALL&lt;/code&gt; file included in the source for a more complete guide on the installation. Now head over to &lt;a href=&quot;https://mail.example.org/mail/installer&quot;&gt;https://mail.example.org/installer&lt;/a&gt; and make sure everything is OK in the &lt;strong&gt;Check environment&lt;/strong&gt; section. You will probably need to temporarily comment out the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;location&lt;/code&gt; blocks in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/nginx/conf.d/mail.example.org.conf&lt;/code&gt; that block access to &lt;strong&gt;Roundcube&lt;/strong&gt; URLs such as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/installer&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;My installation complained about the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;date.timezone&lt;/code&gt; setting in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;php.ini&lt;/code&gt; so I had to set that. Get a list of supported time zones from &lt;a href=&quot;https://php.net/manual/en/timezones.php&quot;&gt;here&lt;/a&gt;. You may need to restart &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nginx&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;php-fpm&lt;/code&gt; for the changes to take effect.&lt;/p&gt;

&lt;p&gt;Click &lt;em&gt;Next&lt;/em&gt; when you’re done to move on to the &lt;strong&gt;Create config&lt;/strong&gt; section. You can leave most of these settings alone. If you want to know what a specific setting does, check out &lt;a href=&quot;https://github.com/roundcube/roundcubemail/wiki/Configuration&quot;&gt;Roundcube’s wiki&lt;/a&gt;. Fill in the &lt;strong&gt;Database setup&lt;/strong&gt; section with the user and database you created earlier.&lt;/p&gt;

&lt;h1 id=&quot;imap-and-smtp-settings&quot;&gt;IMAP and SMTP Settings&lt;/h1&gt;

&lt;p&gt;Fill in your database information in the &lt;strong&gt;Database Setup&lt;/strong&gt; section. Make sure you &lt;strong&gt;do not&lt;/strong&gt; enable spellchecking support. If you do, &lt;strong&gt;Roundcube&lt;/strong&gt; will connect to external services to check your spelling. Why would we go through all this trouble to have a third party see every word we type?&lt;/p&gt;

&lt;p&gt;We’re going to set &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;default_host&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tls://localhost&lt;/code&gt; in the &lt;strong&gt;IMAP Settings&lt;/strong&gt; section and leave the default port. In the &lt;strong&gt;SMTP Settings&lt;/strong&gt; section, set &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;smtp_server&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tls://localhost&lt;/code&gt; , &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;smtp_port&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;587&lt;/code&gt; and check the &lt;em&gt;Use the current IMAP username and password for SMTP authentication&lt;/em&gt; option. In the &lt;strong&gt;Plugins&lt;/strong&gt; section, enable &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;managesieve&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Click on &lt;strong&gt;Create config&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;After it’s done generating your configuraiton file, go through &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;config/config.inc.php&lt;/code&gt; and see if you’d like to change anything. I recommend disabling SSL peer verification for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;IMAP&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SMTP&lt;/code&gt; since we are using localhost and the SSL certificates likely won’t match the hostname. This is needed in &lt;strong&gt;PHP 5.6&lt;/strong&gt; or later and &lt;strong&gt;Slackware&lt;/strong&gt; is on &lt;strong&gt;PHP 7.4&lt;/strong&gt; as of this writing.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'default_host'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'tls://localhost'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'imap_conn_options'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;s1&quot;&gt;'ssl'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
        &lt;span class=&quot;s1&quot;&gt;'verify_peer'&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;s1&quot;&gt;'verify_peer_name'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'smtp_server'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'tls://localhost'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'smtp_conn_options'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;s1&quot;&gt;'ssl'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
        &lt;span class=&quot;s1&quot;&gt;'verify_peer'&lt;/span&gt;      &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;s1&quot;&gt;'verify_peer_name'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'log_dir'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'/var/www/roundcubemail/logs/'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'temp_dir'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'/var/www/roundcubemail/temp/'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'plugins'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'managesieve'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'enable_spellcheck'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'prefer_html'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'mime_param_folding'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h1 id=&quot;start-up-email-services&quot;&gt;Start Up Email Services&lt;/h1&gt;

&lt;p&gt;Let’s start up the services we have so far in order to get all necessary files created properly. We’ll need the services running in order to set up &lt;strong&gt;Roundcube&lt;/strong&gt; and &lt;strong&gt;Postfix Admin&lt;/strong&gt; correctly. You can place your startup commands in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/rc.d/rc.local&lt;/code&gt; and the stop commands in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/rc.d/rc.local_shutdown&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Since now &lt;strong&gt;Dovecot&lt;/strong&gt; and &lt;strong&gt;Postfix&lt;/strong&gt; are part of &lt;strong&gt;Slackware&lt;/strong&gt;, their start up scripts are run before &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/rc.d/rc.local&lt;/code&gt;. My workaround here is just to issue restarts since &lt;strong&gt;Postfix&lt;/strong&gt; depends on &lt;strong&gt;OpenDKIM&lt;/strong&gt; to be running before starting. I didn’t think too much about how to solve this problem.&lt;/p&gt;

&lt;p&gt;Make sure both scripts are executable and add this content&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/rc.d/rc.local&lt;/code&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.php-fpm &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.php-fpm start
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.nginx &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.nginx start
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.postgrey &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.postgrey start
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.clamav &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.clamav start
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.spamd &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.spamd start
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.amavisd-new &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.amavisd-new start
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.opendkim &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.opendkim start
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.postfix &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.postfix restart
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.dovecot &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.dovecot restart
&lt;span class=&quot;k&quot;&gt;fi&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/rc.d/rc.local_shutdown&lt;/code&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.nginx &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.nginx stop
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.php-fpm &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.php-fpm stop
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.postgrey &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.postgrey stop
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.amavisd-new &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.amavisd-new stop
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.clamav &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.clamav stop
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.spamd &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.spamd stop
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.opendkim &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.opendkim stop
&lt;span class=&quot;k&quot;&gt;fi&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h1 id=&quot;finishing-up&quot;&gt;Finishing Up&lt;/h1&gt;

&lt;p&gt;Go ahead and create some filters in &lt;strong&gt;Roundcube&lt;/strong&gt; and make sure emails are going to the right folders. Test sending email to and from your own domain as well as to external domains. Connect your email clients. They should automatically detect your sever’s open ports but you can use the following settings to set it up manually. You can substitute the hostname for &lt;a href=&quot;http://example.org&quot;&gt;example.org&lt;/a&gt; if that points to your server’s IP as well.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-plaintext&quot; data-lang=&quot;plaintext&quot;&gt;Username: testuser@example.org
Incoming (IMAP) server: mail.example.org
Port: 143
STARTTLS Enabled
Authentication: Plain (Normal Password)

Username: testuser@example.org
Outgoing (SMTP) server: mail.example.org
Port: 587
STARTTLS Enabled
Authentication: Plain (Normal Password)
Requires authentication&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The first time you receive an email, it’ll be greylisted thanks to &lt;strong&gt;Postgrey&lt;/strong&gt;. Check &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/var/log/maillog&lt;/code&gt;:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-plaintext&quot; data-lang=&quot;plaintext&quot;&gt;Apr 24 22:38:56 mail postgrey[945]: action=greylist, reason=new, client_name=mail.example.net, client_address=61.4.1.30, sender=testuser@example.net, recipient=testuser@example.org
Apr 24 22:38:56 mail postfix/smtpd[19527]: NOQUEUE: reject: RCPT from mail.example.net[63.4.1.30]: 450 4.2.0 &amp;lt;testuser@example.org&amp;gt;: Recipient address rejected: Greylisted, see http://postgrey.schweikert.ch/help/example.org.html; from=&amp;lt;testuser@example.net&amp;gt; to=&amp;lt;testuser@example.org&amp;gt; proto=ESMTP helo=&amp;lt;mail.example.net&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Most mail servers will try once more after some time and will be allowed the second time they send. Spammers generally only try once so this should stop some most of the common spam you could receive. Once the mail passes through, &lt;strong&gt;Amavis&lt;/strong&gt; will check for viruses and other malware.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-plaintext&quot; data-lang=&quot;plaintext&quot;&gt;Apr 24 22:48:23 mail amavis[1078]: (01078-02) Passed CLEAN {RelayedInbound}, [63.4.1.30]:43126 [63.4.1.30] &amp;lt;testuser@example.net&amp;gt; -&amp;gt; &amp;lt;testuser@example.org&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;You can also test your anti-virus using the &lt;a href=&quot;http://www.eicar.org/86-0-Intended-use.html&quot;&gt;EICAR test file&lt;/a&gt;. Send yourself an email from another mail server with &lt;strong&gt;only&lt;/strong&gt; the following string in the body:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-plaintext&quot; data-lang=&quot;plaintext&quot;&gt;X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;It will be detected as a virus and you’ll see this in the log as well:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-plaintext&quot; data-lang=&quot;plaintext&quot;&gt;Apr 24 23:05:25 mail postfix/qmgr[1060]: BF9D558771: from=&amp;lt;virusalert@example.org&amp;gt;, size=2092, nrcpt=1 (queue active)
Apr 24 23:05:25 mail amavis[21120]: (21120-01) Blocked INFECTED (Eicar-Test-Signature) {DiscardedInbound,Quarantined}, [63.4.1.30]:36539 [63.4.1.30] &amp;lt;testuser@example.net&amp;gt; -&amp;gt; &amp;lt;testuser@example.org&amp;gt;, quarantine: /var/lib/amavis/virusmails&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;In a similar fashion, you can test your spam filter using the &lt;a href=&quot;https://spamassassin.apache.org/gtube/&quot;&gt;GTUBE&lt;/a&gt;. Send a message from another mail server to yourself with &lt;strong&gt;only&lt;/strong&gt; the following string in the body:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-plaintext&quot; data-lang=&quot;plaintext&quot;&gt;XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;It will be detected as spam and you’ll see this in the log as well:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-plaintext&quot; data-lang=&quot;plaintext&quot;&gt;Apr 24 23:13:44 mail amavis[21119]: (21119-01) Passed SPAM {RelayedTaggedInternal,Quarantined}, [63.4.1.30]:36539 [63.4.1.30] &amp;lt;testuser@example.net&amp;gt; -&amp;gt; &amp;lt;testuser@example.org&amp;gt;, quarantine: /var/lib/amavis/virusmails&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h1 id=&quot;other-considerations&quot;&gt;Other Considerations&lt;/h1&gt;

&lt;p&gt;You’ll notice in your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/var/log/maillog&lt;/code&gt; file that there will be a ton of bots and compromised third party servers trying to relay using your server, trying to log in using common usernames (admin, support, test, etc) and generally just trying to wreak havoc on your mail server. The setup suggestions I described in this article should prevent most of those attacks. You may consider trying something like &lt;a href=&quot;http://www.fail2ban.org/wiki/index.php/Main_Page&quot;&gt;fail2ban&lt;/a&gt; to automatically ban these IPs. Get yourself a nice firewall using AlienBob’s &lt;a href=&quot;http://www.slackware.com/~alien/efg/&quot;&gt;Easy Firewall Generator&lt;/a&gt; and block anything you don’t need.&lt;/p&gt;

&lt;p&gt;I tested this set up by following it step by step on a fresh server and it worked for me. I may have missed some things. &lt;a href=&quot;/contact/&quot;&gt;Contact me&lt;/a&gt; if you have any comments. Encrypted email is strongly encouraged and preferred.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Slackware Mail Server with MariaDB, Postfix, and Dovecot</title>
   <link href="https://gerardozamudio.mx/2019/01/21/slackware-14-2-mail-server-with-mariadb-postfix-and-dovecot/"/>
   <updated>2019-01-21T00:00:00-06:00</updated>
   <id>https://gerardozamudio.mx/2019/01/21/slackware-14-2-mail-server-with-mariadb-postfix-and-dovecot</id>
   <content type="html">&lt;h1 id=&quot;introduction&quot;&gt;Introduction&lt;/h1&gt;

&lt;p&gt;Nearly two years after the release of &lt;strong&gt;Slackware Linux 14.2&lt;/strong&gt; and three years after my original blog post, I’m glad to finally provide an update. Sorry for the delay. The core packages that make up the mail server have received lots of updates. Besides the version and configuration updates I’ve also added some information for setting up &lt;strong&gt;Dovecot Pigeonhole&lt;/strong&gt; and configuring email filtering.&lt;/p&gt;

&lt;p&gt;This post contains some suggestions for a mildly secure mail server running on a &lt;a href=&quot;http://www.slackware.com/&quot;&gt;Slackware Linux&lt;/a&gt; host. The guide assumes a default, fresh installation of &lt;strong&gt;Slackware64 14.2&lt;/strong&gt; that includes at least the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;A/&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AP/&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;D/&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;L/&lt;/code&gt;, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;N/&lt;/code&gt; package series. By the end of the tutorial, you will have:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.postfix.org/&quot;&gt;Postfix&lt;/a&gt; for encrypted connections over &lt;a href=&quot;https://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol&quot;&gt;SMTP&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://dovecot.org/&quot;&gt;Dovecot&lt;/a&gt; for local mail directories and encrypted connections over &lt;a href=&quot;https://en.wikipedia.org/wiki/Post_Office_Protocol&quot;&gt;POP&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Internet_Message_Access_Protocol&quot;&gt;IMAP&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://mariadb.org/&quot;&gt;MariaDB&lt;/a&gt; to store mailbox information&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://postgrey.schweikert.ch/&quot;&gt;Postgrey&lt;/a&gt; which will require unknown senders to resend their mail, eliminating most spam&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://spamassassin.apache.org/&quot;&gt;SpamAssassin&lt;/a&gt; for e-mail spam filtering based on content-matching rules&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.clamav.net/&quot;&gt;ClamAV&lt;/a&gt; to detect trojans, viruses, malware and other malicious threats in your email&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://amavis.org/&quot;&gt;amavisd-new&lt;/a&gt; to manage ClamAV and SpamAssasin&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://opendkim.org/&quot;&gt;OpenDKIM&lt;/a&gt; a DomainKeys Identified Mail (DKIM) milter to sign and/or verify mail&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://nginx.org/&quot;&gt;nginx&lt;/a&gt; as a webserver (optional)&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://postfixadmin.sourceforge.net/&quot;&gt;Postfix Admin&lt;/a&gt; to manage mailboxes and domains using a TLS secured web user interface (optional)&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://roundcube.net/&quot;&gt;Roundcube&lt;/a&gt; with some plugins as a TLS secured webmail client (optional)&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://pigeonhole.dovecot.org/&quot;&gt;Pigeonhole&lt;/a&gt; to add support for email filter rules (forwarding, placing in folders, etc)&lt;/li&gt;
&lt;/ul&gt;

&lt;!--more--&gt;

&lt;h2 id=&quot;self-hosting-email&quot;&gt;Self-hosting Email&lt;/h2&gt;

&lt;p&gt;My &lt;a href=&quot;https://gerardozamudio.mx/2015/04/25/slackware-mail-server-with-mysql-postfix-and-dovecot/&quot;&gt;previous post&lt;/a&gt; goes into more detail about why you would or wouldn’t want to host your own mail server. It also gives some advice about hosting providers and things to look out for.&lt;/p&gt;

&lt;h1 id=&quot;preparation&quot;&gt;Preparation&lt;/h1&gt;

&lt;h2 id=&quot;hostname&quot;&gt;Hostname&lt;/h2&gt;

&lt;p&gt;Set up an &lt;abbr title=&quot;Fully Qualified Domain Name&quot;&gt;FQDN&lt;/abbr&gt; as your hostname. We’ll use &lt;a href=&quot;http://mail.example.org&quot;&gt;mail.example.org&lt;/a&gt;:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;mail.example.org&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; /etc/HOSTNAME
&lt;span class=&quot;nb&quot;&gt;hostname&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-F&lt;/span&gt; /etc/HOSTNAME&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h1 id=&quot;php--nginx&quot;&gt;PHP + nginx&lt;/h1&gt;

&lt;h2 id=&quot;install-nginx&quot;&gt;Install nginx&lt;/h2&gt;

&lt;p&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nginx&lt;/code&gt; webserver is at version &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;1.14.2&lt;/code&gt; as of this writing, up from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;1.8.0&lt;/code&gt; used in my previous guide. &lt;a href=&quot;https://http2.github.io/&quot;&gt;HTTP/2&lt;/a&gt; is now natively supported instead of being provided by the &lt;a href=&quot;https://www.chromium.org/spdy/spdy-whitepaper&quot;&gt;SPDY&lt;/a&gt; module. You can still hide the server headers in the source using the patches from the previous post. This is in addition to the &lt;a href=&quot;https://nginx.org/en/docs/http/ngx_http_core_module.html#server_tokens&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;server_tokens&lt;/code&gt;&lt;/a&gt; configuration option. You can also compile nginx with the &lt;a href=&quot;https://github.com/openresty/headers-more-nginx-module&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ngx_headers_more&lt;/code&gt;&lt;/a&gt; module. Keep in mind there are still many ways to detect which web server you’re running and tools like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nmap&lt;/code&gt; are particularly good at doing it. It’s up to you to decide how much effort you want to put into this.&lt;/p&gt;

&lt;p&gt;Create your user and use that to run the &lt;a href=&quot;https://slackbuilds.org/repository/14.2/network/nginx/&quot;&gt;SlackBuild&lt;/a&gt;. For newer &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nginx&lt;/code&gt; versions, simply updating the version number in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nginx.SlackBuild&lt;/code&gt; file before running it usually does the trick.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;useradd &lt;span class=&quot;nt&quot;&gt;-r&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-M&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-U&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;User for nginx&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; /srv/httpd &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; /bin/false nginx
&lt;span class=&quot;nv&quot;&gt;NGINXUSER&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;nginx &lt;span class=&quot;nv&quot;&gt;NGINXGROUP&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;nginx ./nginx.SlackBuild&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Once again, if you want to enable syntax highlighlting for the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nginx.conf&lt;/code&gt; file in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vim&lt;/code&gt;, copy the contents of the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;contrib/vim&lt;/code&gt; directory from the extracted &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nginx&lt;/code&gt; source to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.vim&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;ssl-certificates&quot;&gt;SSL Certificates&lt;/h2&gt;

&lt;p&gt;In the previous post I talked about some SSL certificate providers and curves.  We use &lt;strong&gt;ECDSA&lt;/strong&gt; certificates and the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;secp384r1&lt;/code&gt; curve here.&lt;/p&gt;

&lt;h2 id=&quot;configure-nginx&quot;&gt;Configure nginx&lt;/h2&gt;

&lt;p&gt;At minimum, your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nginx.conf&lt;/code&gt; file will need an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;events&lt;/code&gt; section which can be left blank to activate the defaults or modified depending on the load you’re expecting on the server. Set &lt;a href=&quot;https://nginx.org/en/docs/ngx_core_module.html#worker_processes&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;worker_processes&lt;/code&gt;&lt;/a&gt; equal to the number of real CPU cores on the machine.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-nginx&quot; data-lang=&quot;nginx&quot;&gt;&lt;span class=&quot;k&quot;&gt;user&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;nginx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;worker_processes&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;pid&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/var/run/nginx.pid&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;events&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

  &lt;span class=&quot;kn&quot;&gt;worker_connections&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1024&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;http&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

  &lt;span class=&quot;kn&quot;&gt;map&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$sent_http_content_type&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$expires&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

    &lt;span class=&quot;kn&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;off&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;application/x-javascript&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;1d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;text/css&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;1d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;~image/&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;1d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;kn&quot;&gt;expires&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$expires&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;client_max_body_size&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;12m&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;default_type&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;application/octet-stream&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;gzip&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;gzip_vary&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;gzip_http_version&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;.0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;gzip_comp_level&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;gzip_min_length&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10240&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

  &lt;span class=&quot;kn&quot;&gt;gzip_proxied&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;expired&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;no-cache&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;no-store&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;auth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;gzip_types&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;text/plain&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;text/css&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;text/xml&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;text/javascript&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;text/json&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;application/json&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;application/x-javascript&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;application/xml&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;application/xml&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;+rss&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

  &lt;span class=&quot;kn&quot;&gt;gzip_disable&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;MSIE&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;[1-6]&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;.&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;access_log&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/var/log/nginx/access.log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;error_log&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/var/log/nginx/error.log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;include&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/etc/nginx/mime.types&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;upstream&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;php_workers&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

    &lt;span class=&quot;kn&quot;&gt;server&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;unix:/var/run/php-fpm.sock&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;sendfile&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;# Hide Nginx version number&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;server_tokens&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;off&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;types_hash_max_size&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2048&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

  &lt;span class=&quot;kn&quot;&gt;include&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/etc/nginx/conf.d/*.conf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Create your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/nginx/conf.d/site.conf&lt;/code&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-nginx&quot; data-lang=&quot;nginx&quot;&gt;&lt;span class=&quot;c1&quot;&gt;# HTTP&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;server&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

  &lt;span class=&quot;c1&quot;&gt;# Listen on ipv4&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;listen&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;80&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

  &lt;span class=&quot;kn&quot;&gt;server_name&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;_&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;301&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;https://&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$host$request_uri&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# HTTPS&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;server&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

  &lt;span class=&quot;kn&quot;&gt;listen&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;443&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;server_name&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;_&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

  &lt;span class=&quot;kn&quot;&gt;root&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/var/www/html&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;index&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;index.php&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;index.html&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

  &lt;span class=&quot;c1&quot;&gt;# Allow access to '^/.well-known/'&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;^/.well-known/&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

    &lt;span class=&quot;kn&quot;&gt;allow&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;all&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;access_log&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;off&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;log_not_found&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;off&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;autoindex&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;off&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;c1&quot;&gt;# Deny all attempts to access hidden files such as .htaccess.&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;/\.&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

    &lt;span class=&quot;kn&quot;&gt;deny&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;all&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;c1&quot;&gt;# too many of these&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/favicon.ico&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

    &lt;span class=&quot;kn&quot;&gt;access_log&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;off&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;log_not_found&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;off&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/robots.txt&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

    &lt;span class=&quot;kn&quot;&gt;access_log&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;off&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;log_not_found&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;off&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;c1&quot;&gt;# global SSL options with Perfect Forward Secrecy (PFS) high strength ciphers&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;# first. PFS ciphers are those which start with ECDHE which means (EC)DHE&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;# which stands for (Elliptic Curve) Diffie-Hellman Ephemeral.&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;ssl&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;ssl_protocols&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;TLSv1.2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

  &lt;span class=&quot;c1&quot;&gt;# RSA ciphers&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;# ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:ECDHE-RSA-RC4-SHA;&lt;/span&gt;

  &lt;span class=&quot;c1&quot;&gt;# ECDSA ssl ciphers; google chrome prefered order, 128bit most prefered&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;ssl_ciphers&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;ssl_ecdh_curve&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;secp384r1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# 384 bit prime modulus curve efficiently supports ECDHE ssl_ciphers up to a SHA384 hash&lt;/span&gt;

  &lt;span class=&quot;kn&quot;&gt;ssl_prefer_server_ciphers&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

  &lt;span class=&quot;kn&quot;&gt;ssl_certificate&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/home/acme/.acme.sh/mail.example.org_ecc/fullchain.cer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;ssl_certificate_key&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/home/acme/.acme.sh/mail.example.org_ecc/mail.example.org.key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;


  &lt;span class=&quot;c1&quot;&gt;#&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;# Running Roundcube as a subfolder on an existing virtual host&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;#&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;# Block access to default directories and files under these directories&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;/mail/(bin|config|installer|logs|SQL|temp|vendor)($|/.*)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

    &lt;span class=&quot;kn&quot;&gt;deny&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;all&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;c1&quot;&gt;# Block access to default files under top-directory and files start with same name.&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;/mail/(CHANGELOG|composer.json|INSTALL|jsdeps.json|LICENSE|README|UPGRADING)($|.*)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

    &lt;span class=&quot;kn&quot;&gt;deny&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;all&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;c1&quot;&gt;# Block plugin config files and sample config files.&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;/mail/plugins/.*/config.inc.php.*&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

    &lt;span class=&quot;kn&quot;&gt;deny&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;all&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;c1&quot;&gt;# Block access to plugin data&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;/mail/plugins/enigma/home($|/.*)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

    &lt;span class=&quot;kn&quot;&gt;deny&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;all&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;c1&quot;&gt;# Redirect URI `/mail` to `/mail/`.&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/mail&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

    &lt;span class=&quot;kn&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;301&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/mail/&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;kn&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;^/mail/(.*\.php)$&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;# Use HTTP Strict Transport Security to force client to use secure&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# connections only. References:&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;#&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# * RFC Document (6797): HTTP Strict Transport Security (HSTS)&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;#   https://tools.ietf.org/html/rfc6797#section-6.1.2&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;#&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# * Short tutorial from Mozilla:&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;#   https://developer.mozilla.org/en-US/docs/Web/Security/HTTP_strict_transport_security&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;#&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# WARNING: According to RFC document, HSTS will fail with self-signed SSL&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;#          certificate.&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;#          https://tools.ietf.org/html/rfc6797#page-27&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;#&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# Syntax:&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;#&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;#   Strict-Transport-Security: max-age=expireTime [; includeSubDomains] [; preload]&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;add_header&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Strict-Transport-Security&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;max-age=31536000&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;#&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# Template used to handle PHP fastcgi applications&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;#&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# You still need to define `SCRIPT_FILENAME` for your PHP application, and&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# probably `fastcgi_index` if your application use different index file.&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;#&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;include&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;fastcgi_params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;# Directory index file&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;fastcgi_index&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;index.php&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;# Handle PHP files with upstream handler&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;fastcgi_pass&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;php_workers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;# Fix the HTTPROXY issue.&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# Reference: https://httpoxy.org/&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;fastcgi_param&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;HTTP_PROXY&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;


    &lt;span class=&quot;kn&quot;&gt;fastcgi_param&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;SCRIPT_FILENAME&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/var/www/roundcubemail/&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;kn&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;^/mail/(.*)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

    &lt;span class=&quot;kn&quot;&gt;alias&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/var/www/roundcubemail/&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;index&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;index.php&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;


  &lt;span class=&quot;c1&quot;&gt;#&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;# Running Postfixadmin as a subfolder on an existing virtual host&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;#&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;# Block access to default directories and files under these directories&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;/postfixadmin/(bin|config|installer|logs|SQL|temp|vendor)($|/.*)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

    &lt;span class=&quot;kn&quot;&gt;deny&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;all&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;c1&quot;&gt;# Block access to default files under top-directory and files start with same name.&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;/postfixadmin/(CHANGELOG.txt|GPL-LICENSE.TXT|INSTALL.TXT|LICENSE.TXT|README.md|composer.json|composer.lock)($|.*)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

    &lt;span class=&quot;kn&quot;&gt;deny&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;all&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;c1&quot;&gt;# Block plugin config files and sample config files.&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;/postfixadmin/plugins/.*/config.inc.php.*&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

    &lt;span class=&quot;kn&quot;&gt;deny&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;all&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;c1&quot;&gt;# Block access to plugin data&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;/postfixadmin/plugins/enigma/home($|/.*)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

    &lt;span class=&quot;kn&quot;&gt;deny&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;all&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;c1&quot;&gt;# Redirect URI `/postfixadmin` to `/postfixadmin/`.&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/postfixadmin&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

    &lt;span class=&quot;kn&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;301&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/postfixadmin/&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;kn&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;^/postfixadmin/(.*\.php)$&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;# Use HTTP Strict Transport Security to force client to use secure&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# connections only. References:&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;#&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# * RFC Document (6797): HTTP Strict Transport Security (HSTS)&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;#   https://tools.ietf.org/html/rfc6797#section-6.1.2&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;#&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# * Short tutorial from Mozilla:&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;#   https://developer.mozilla.org/en-US/docs/Web/Security/HTTP_strict_transport_security&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;#&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# WARNING: According to RFC document, HSTS will fail with self-signed SSL&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;#          certificate.&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;#          https://tools.ietf.org/html/rfc6797#page-27&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;#&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# Syntax:&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;#&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;#   Strict-Transport-Security: max-age=expireTime [; includeSubDomains] [; preload]&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;add_header&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Strict-Transport-Security&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;max-age=31536000&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;


    &lt;span class=&quot;c1&quot;&gt;#&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# Template used to handle PHP fastcgi applications&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;#&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# You still need to define `SCRIPT_FILENAME` for your PHP application, and&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# probably `fastcgi_index` if your application use different index file.&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;#&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;include&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;fastcgi_params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;# Directory index file&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;fastcgi_index&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;index.php&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;# Handle PHP files with upstream handler&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;fastcgi_pass&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;php_workers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;# Fix the HTTPROXY issue.&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# Reference: https://httpoxy.org/&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;fastcgi_param&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;HTTP_PROXY&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;


    &lt;span class=&quot;kn&quot;&gt;fastcgi_param&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;SCRIPT_FILENAME&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/var/www/postfixadmin/public/&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;kn&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;^/postfixadmin/(.*)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

    &lt;span class=&quot;kn&quot;&gt;alias&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/var/www/postfixadmin/public/&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;index&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;index.php&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;


  &lt;span class=&quot;c1&quot;&gt;# Normal PHP scripts&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;\.php$&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;#&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# Template used to handle PHP fastcgi applications&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;#&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# You still need to define `SCRIPT_FILENAME` for your PHP application, and&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# probably `fastcgi_index` if your application use different index file.&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;#&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;include&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;fastcgi_params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;# Directory index file&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;fastcgi_index&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;index.php&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;# Handle PHP files with upstream handler&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;fastcgi_pass&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;php_workers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;# Fix the HTTPROXY issue.&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# Reference: https://httpoxy.org/&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;fastcgi_param&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;HTTP_PROXY&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;


    &lt;span class=&quot;kn&quot;&gt;fastcgi_param&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;SCRIPT_FILENAME&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$document_root$fastcgi_script_name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;


&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;We’re going to skip setting up &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;memcached&lt;/code&gt; for now. The newer versions are for PHP 7 which will not be a &lt;strong&gt;Slackware&lt;/strong&gt; default until version &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;15&lt;/code&gt; is out or so. Rerfer to my old guide for help setting up &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;memcached&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Change the permissions of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/var/lib/php&lt;/code&gt; since we’re using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nginx&lt;/code&gt; instead of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;httpd&lt;/code&gt; to run PHP:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nb&quot;&gt;chown &lt;/span&gt;root:nginx /var/lib/php/&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;If you’re getting any compilation errors for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nginx&lt;/code&gt;, &lt;strong&gt;PHP&lt;/strong&gt;, or any package regarding graphics, you’ll need some &lt;strong&gt;X11&lt;/strong&gt; libraries. These are most likely not installed if you’re working on a headless server. Get the needed dependencies from a Slackware mirror:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;slackpkg &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;libX11 libXpm libxcb libXau libXdmcp&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;php-fpm-with-fastcgi-in-nginx&quot;&gt;PHP-FPM with FastCGI in nginx&lt;/h2&gt;

&lt;p&gt;We’ll set up &lt;strong&gt;PHP-FPM&lt;/strong&gt; a bit different this time around by putting its configuration in a separate file. First you’ll need to make sure the startup script is executable. Start &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;php-fpm&lt;/code&gt; at least once to let it create its default configuration files:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nb&quot;&gt;chmod&lt;/span&gt; +x /etc/rc.d/rc.php-fpm
/etc/rc.d/rc.php-fpm start
/etc/rc.d/rc.php-fpm stop&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;We’ll add our own &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/php-fpm.d/mailserver.conf&lt;/code&gt; with the following content:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;nn&quot;&gt;[mailserver]&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;user&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;nginx&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;group&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;nginx&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;listen&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;/var/run/php-fpm.sock&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;listen.owner&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;nginx&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;listen.group&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;nginx&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;listen.mode&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;0666&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;pm&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;dynamic&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;pm.max_children&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;5&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;pm.start_servers&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;2&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;pm.min_spare_servers&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;pm.max_spare_servers&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;3&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;pm.max_requests&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;5&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;request_terminate_timeout&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;10s&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;request_slowlog_timeout&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;10s&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;access.log&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;/var/log/php-fpm/php-fpm.log&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;slowlog&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;/var/log/php-fpm/slow.log&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;security.limit_extensions&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;.php .php3 .php4 .php5 .html .htm&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Make sure this file is included in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/php-fpm.conf&lt;/code&gt;. Edit the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;error_log&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;log/php-fpm/php-fpm.log&lt;/code&gt; to keep everything in place while you’re there.&lt;/p&gt;

&lt;p&gt;Install the &lt;a href=&quot;https://slackbuilds.org/repository/14.2/libraries/php-imagick/&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;php-imagick&lt;/code&gt;&lt;/a&gt; extension too. This will come in handy for &lt;strong&gt;Roundcube&lt;/strong&gt; later.&lt;/p&gt;

&lt;h1 id=&quot;dovecot&quot;&gt;Dovecot&lt;/h1&gt;

&lt;p&gt;Lots of development has been done on &lt;strong&gt;Dovecot&lt;/strong&gt; since my last guide. &lt;strong&gt;Dovecot&lt;/strong&gt; is now on version &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;2.3.4&lt;/code&gt; as of this writing, up from version &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;2.2.16&lt;/code&gt; from my past guide. We are still going to use &lt;strong&gt;Postfix Admin&lt;/strong&gt; to store the user information in this setup instead of creating a &lt;strong&gt;Unix&lt;/strong&gt; account for each mailbox. The email will be stored in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/var/vmail&lt;/code&gt; organized by domain and user, so the email for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;admin@example.org&lt;/code&gt; would be stored in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/var/vmail/example.org/admin&lt;/code&gt;. We’ll create a single user to own the mailboxes on the system and let &lt;strong&gt;Dovecot&lt;/strong&gt; manage them. &lt;strong&gt;Dovecot&lt;/strong&gt; will also need its own user and group:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;useradd &lt;span class=&quot;nt&quot;&gt;-r&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; /var/vmail &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; /bin/false &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; 150 &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; 12 vmail
&lt;span class=&quot;nb&quot;&gt;mkdir&lt;/span&gt; /var/vmail
&lt;span class=&quot;nb&quot;&gt;chmod &lt;/span&gt;770 /var/vmail
&lt;span class=&quot;nb&quot;&gt;chown &lt;/span&gt;vmail:mail /var/vmail
groupadd &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; 202 dovecot
useradd &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; /dev/null &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; /bin/false &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; 202 &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; 202 dovecot
groupadd &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; 248 dovenull
useradd &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; /dev/null &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; /bin/false &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; 248 &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; 248 dovenull&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;You can use whatever names and IDs you want but make sure it doesn’t interfere with what &lt;strong&gt;Slackware&lt;/strong&gt; already uses. Copy over the sample configuration files and replace some of them&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nb&quot;&gt;cp&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-r&lt;/span&gt; /usr/doc/dovecot-2.3.4/example-config/&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; /etc/dovecot/
&lt;span class=&quot;nb&quot;&gt;chown&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-R&lt;/span&gt; vmail:dovecot /etc/dovecot
&lt;span class=&quot;nb&quot;&gt;chmod&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-R&lt;/span&gt; o-rw /etc/dovecot&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;We’ll set up &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/dovecot/dovecot-sql.conf.ext&lt;/code&gt; first with the database connection information&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;py&quot;&gt;driver&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mysql&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;connect&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;host=/var/run/mysql/mysql.sock dbname=mail user=mail password=password-here&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;default_pass_scheme&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;SHA512-CRYPT&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Of course, set &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dbname&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;user&lt;/code&gt;, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;password&lt;/code&gt; appropriately. These are the same credentials &lt;strong&gt;Postfix Admin&lt;/strong&gt; will use, so keep that in mind. We’re not creating the database or user yet. That will come later. Now let’s add the &lt;a href=&quot;https://wiki.dovecot.org/AuthDatabase/SQL&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;password_query&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;https://wiki.dovecot.org/AuthDatabase/SQL&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;user_query&lt;/code&gt;&lt;/a&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/dovecot/dovecot-sql.conf.ext&lt;/code&gt;:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;py&quot;&gt;password_query&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\
&lt;/span&gt;  &lt;span class=&quot;s&quot;&gt;SELECT username as user, password, '/var/vmail/%d/%n' as &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\
&lt;/span&gt;  &lt;span class=&quot;s&quot;&gt;userdb_home, 'maildir:/var/vmail/%d/%n' as userdb_mail, &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\
&lt;/span&gt;  &lt;span class=&quot;s&quot;&gt;150 as userdb_uid, 12 as userdb_gid &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\
&lt;/span&gt;  &lt;span class=&quot;s&quot;&gt;FROM mailbox WHERE username = '%u' AND active = '1'&lt;/span&gt;

&lt;span class=&quot;py&quot;&gt;user_query&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\
&lt;/span&gt;  &lt;span class=&quot;s&quot;&gt;SELECT '/var/vmail/%d/%n' as home, 'maildir:/var/vmail/%d/%n' &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\
&lt;/span&gt;  &lt;span class=&quot;s&quot;&gt;as mail, 150 AS uid, 12 AS gid, &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\
&lt;/span&gt;  &lt;span class=&quot;s&quot;&gt;concat('dirsize:storage=', quota) AS quota &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\
&lt;/span&gt;  &lt;span class=&quot;s&quot;&gt;FROM mailbox WHERE username = '%u' AND active = '1'&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Edit &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/dovecot/conf.d/10-auth.conf&lt;/code&gt; and enable the &lt;strong&gt;SQL&lt;/strong&gt; configuration file we just modified. You will need to disable &lt;strong&gt;plaintext authentication&lt;/strong&gt; unless it’s already encrypted through &lt;strong&gt;TLS&lt;/strong&gt;. We’ll also disable the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;auth-system.conf.ext&lt;/code&gt; file that’s loaded by default. Don’t worry about authenticating with plain text; your connection will be secured with &lt;strong&gt;TLS&lt;/strong&gt; so this is safe:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;py&quot;&gt;disable_plaintext_auth&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;yes&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;auth_mechanisms&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;plain login&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;#!include auth-system.conf.ext
&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;!include&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;auth-sql.conf.ext&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Next, change the &lt;strong&gt;UID&lt;/strong&gt;s and mail location in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/dovecot/conf.d/10-mail.conf&lt;/code&gt; to whatever you set up earlier:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;py&quot;&gt;mail_location&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;maildir:/var/vmail/%d/%n&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;mail_uid&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;vmail&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;mail_gid&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mail&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;first_valid_uid&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;150&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;last_valid_uid&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;150&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;strong&gt;Dovecot&lt;/strong&gt; has changed some of its &lt;strong&gt;TLS&lt;/strong&gt; options. I use the secp384r1 curve for my ECDSA SSL certificates. My &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/dovecot/conf.d/10-ssl.conf&lt;/code&gt; file will looks like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;py&quot;&gt;ssl_cert&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;lt;/home/acme/.acme.sh/mail.example.org_ecc/fullchain.cer&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;ssl_key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;lt;/home/acme/.acme.sh/mail.example.org_ecc/mail.example.org.key&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;ssl_min_protocol&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;TLSv1&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;ssl_cipher_list&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;  &lt;span class=&quot;s&quot;&gt;ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;ssl_curve_list&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;P-384&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;ssl_prefer_server_ciphers&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;yes&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;In order to have &lt;strong&gt;Dovecot&lt;/strong&gt; authenticate, uncomment the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;user&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;group&lt;/code&gt;, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mode&lt;/code&gt; lines in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;unix_listener auth-userdb&lt;/code&gt; section of the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;service auth&lt;/code&gt; block in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/dovecot/conf.d/10-master.conf&lt;/code&gt;. Additionally, set up a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;unix listener&lt;/code&gt; for &lt;strong&gt;Postfix&lt;/strong&gt;. Uncomment that section as well and add &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;postfix&lt;/code&gt; as the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;user&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;group&lt;/code&gt;. We’ll create those later when we’re setting up &lt;strong&gt;Postfix&lt;/strong&gt;. Set up the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;stats-writer&lt;/code&gt; permissions, too.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;err&quot;&gt;service&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;auth&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;unix_listener&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;auth-userdb&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;py&quot;&gt;mode&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;0666&lt;/span&gt;
    &lt;span class=&quot;py&quot;&gt;user&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;vmail&lt;/span&gt;
    &lt;span class=&quot;py&quot;&gt;group&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mail&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;err&quot;&gt;unix_listener&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;/var/spool/postfix/private/auth&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;py&quot;&gt;mode&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;0666&lt;/span&gt;
    &lt;span class=&quot;py&quot;&gt;user&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;postfix&lt;/span&gt;
    &lt;span class=&quot;py&quot;&gt;group&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;postfix&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;err&quot;&gt;service&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;stats&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;err&quot;&gt;unix_listener&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;stats-reader&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;py&quot;&gt;user&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;vmail&lt;/span&gt;
        &lt;span class=&quot;py&quot;&gt;group&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mail&lt;/span&gt;
        &lt;span class=&quot;py&quot;&gt;mode&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;0660&lt;/span&gt;
    &lt;span class=&quot;err&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;err&quot;&gt;unix_listener&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;stats-writer&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;py&quot;&gt;user&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;vmail&lt;/span&gt;
        &lt;span class=&quot;py&quot;&gt;group&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mail&lt;/span&gt;
        &lt;span class=&quot;py&quot;&gt;mode&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;0660&lt;/span&gt;
    &lt;span class=&quot;err&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;dovecot-pigeonhole&quot;&gt;Dovecot Pigeonhole&lt;/h2&gt;

&lt;p&gt;A new addition to this guide is &lt;strong&gt;Dovecot Pigeonhole&lt;/strong&gt;. This adds support for the &lt;strong&gt;Sieve&lt;/strong&gt; language (RFC 5228) and the &lt;strong&gt;ManageSieve&lt;/strong&gt; protocol (RFC 5804) to &lt;strong&gt;Dovecot&lt;/strong&gt;. Coupled with a &lt;strong&gt;Roundcube plugin&lt;/strong&gt;, this will allow us to filter email based on any number of factors. For example, you can create an rule in &lt;strong&gt;Roundcube&lt;/strong&gt; that will automatically place email coming from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@bank.com&lt;/code&gt; to a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Bank Notifications&lt;/code&gt; folder.&lt;/p&gt;

&lt;p&gt;Grab the &lt;a href=&quot;https://slackbuilds.org/repository/14.2/network/dovecot-pigeonhole/&quot;&gt;SlackBuild&lt;/a&gt; and run it. The package will install some configuration files in the Dovecot documentation directory. Copy these to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/dovecot/conf.d&lt;/code&gt;:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;err&quot;&gt;/usr/doc/dovecot-2.3.4/example-config/conf.d/90-sieve.conf&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;/usr/doc/dovecot-2.3.4/example-config/conf.d/90-sieve-extprograms.conf&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;/usr/doc/dovecot-2.3.4/example-config/conf.d/20-managesieve.conf&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Let’s make some changes to these files&lt;/p&gt;

&lt;p&gt;First, edit &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/dovecot/conf.d/20-lmtp.conf&lt;/code&gt;, and add&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;err&quot;&gt;protocol&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;lmtp&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;py&quot;&gt;postmaster_address&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;postmaster@example.org&lt;/span&gt;
  &lt;span class=&quot;py&quot;&gt;mail_plugins&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;$mail_plugins sieve quota&lt;/span&gt;
  &lt;span class=&quot;py&quot;&gt;log_path&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;/var/log/dovecot-lmtp-errors.log&lt;/span&gt;
  &lt;span class=&quot;py&quot;&gt;info_log_path&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;/var/log/dovecot-lmtp.log&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;For &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/dovecot/conf.d/15-lda.conf&lt;/code&gt;, add&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;err&quot;&gt;protocol&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;lda&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;py&quot;&gt;postmaster_address&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;postmaster@example.org&lt;/span&gt;
  &lt;span class=&quot;py&quot;&gt;mail_plugins&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;$mail_plugins sieve quota&lt;/span&gt;
  &lt;span class=&quot;py&quot;&gt;auth_socket_path&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;/var/run/dovecot/auth-master&lt;/span&gt;
  &lt;span class=&quot;py&quot;&gt;log_path&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;/var/log/dovecot-lda-errors.log&lt;/span&gt;
  &lt;span class=&quot;py&quot;&gt;info_log_path&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;/var/log/dovecot-lda.log&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;For &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/dovecot/conf.d/10-mail.conf&lt;/code&gt;, add&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;py&quot;&gt;mail_home&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;/var/vmail/%d/%n/sieve&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;mail_location&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;maildir:/var/vmail/%d/%n&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;In &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/dovecot/conf.d/20-managesieve.conf&lt;/code&gt;, add&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;py&quot;&gt;protocols&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;$protocols sieve&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;service&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;managesieve-login&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;inet_listener&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;sieve&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;py&quot;&gt;port&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;4190&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;service&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;managesieve&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;py&quot;&gt;process_limit&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;1024&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;protocol&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;sieve&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;py&quot;&gt;log_path&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;/var/log/dovecot-sieve-errors.log&lt;/span&gt;
  &lt;span class=&quot;py&quot;&gt;info_log_path&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;/var/log/dovecot-sieve.log&lt;/span&gt;
  &lt;span class=&quot;py&quot;&gt;managesieve_max_line_length&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;65536&lt;/span&gt;
  &lt;span class=&quot;py&quot;&gt;managesieve_implementation_string&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Dovecot Pigeonhole&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Lastly, edit &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/dovecot/conf.d/90-sieve.conf&lt;/code&gt;, and add&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;err&quot;&gt;plugin&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;py&quot;&gt;sieve&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;file:/var/vmail/%d/%n/sieve;active=/var/vmail/%d/%n/sieve/.dovecot.sieve&lt;/span&gt;
    &lt;span class=&quot;py&quot;&gt;sieve_default&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;/etc/dovecot/sieve/default.sieve&lt;/span&gt;
    &lt;span class=&quot;py&quot;&gt;sieve_global&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;/etc/dovecot/sieve/global/&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;lda_mailbox_autocreate&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;yes&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;lda_mailbox_autosubscribe&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;yes&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Now we need to create some files that are needed for our configuration to work:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nb&quot;&gt;mkdir&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; /etc/dovecot/sieve/global
&lt;span class=&quot;nb&quot;&gt;chown&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-R&lt;/span&gt; vmail:mail /etc/dovecot/sieve/
&lt;span class=&quot;nb&quot;&gt;touch&lt;/span&gt; /var/log/&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;dovecot-lda-errors.log,dovecot-lda.log&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;touch&lt;/span&gt; /var/log/&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;dovecot-sieve-errors.log,dovecot-sieve.log&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;touch&lt;/span&gt; /var/log/&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;dovecot-lmtp-errors.log,dovecot-lmtp.log&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;chown &lt;/span&gt;vmail:dovecot /var/log/dovecot-&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Add &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;postfix&lt;/code&gt; to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dovecot&lt;/code&gt; group. This is needed by &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;amavisd-new&lt;/code&gt; later.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;usermod &lt;span class=&quot;nt&quot;&gt;-G&lt;/span&gt; dovecot &lt;span class=&quot;nt&quot;&gt;-a&lt;/span&gt; postfix&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h1 id=&quot;postfix&quot;&gt;Postfix&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Postfix&lt;/strong&gt; is now at version &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;3.3.2&lt;/code&gt; instead of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;3.0.3&lt;/code&gt; we used in the last guide. There haven’t been any major configuration changes so we’ll just proceed as normal. Create the required user and group before going any further:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;groupadd &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; 200 postfix
groupadd &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; 201 postdrop
useradd &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; 200 &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; /dev/null &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; /bin/false &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; postfix postfix&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Run the &lt;strong&gt;SlackBuild&lt;/strong&gt; with support for MySQL and install it&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nv&quot;&gt;DATABASE&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;mysql ./postfix.SlackBuild&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Let’s create our &lt;strong&gt;MySQL&lt;/strong&gt; map files now&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/postfix/mysql_virtual_alias_domainaliases_maps.cf&lt;/code&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;py&quot;&gt;user&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mail&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;password&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mailpassword&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;hosts&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;localhost&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;dbname&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mail&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;query&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;SELECT goto FROM alias,alias_domain&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;WHERE&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;alias_domain.alias_domain&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'%d'&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;AND&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;alias.address&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;concat('%u', '@', alias_domain.target_domain)&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;AND&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;alias.active&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;1&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/postfix/mysql_virtual_alias_maps.cf&lt;/code&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;py&quot;&gt;user&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mail&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;password&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mailpassword&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;hosts&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;localhost&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;dbname&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mail&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;table&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;alias&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;select_field&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;goto&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;where_field&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;address&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;additional_conditions&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;and active = '1'&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/postfix/mysql_virtual_domains_maps.cf&lt;/code&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;py&quot;&gt;user&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mail&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;password&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mailpassword&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;hosts&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;localhost&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;dbname&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mail&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;table&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;domain&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;select_field&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;domain&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;where_field&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;domain&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;additional_conditions&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;and backupmx = '0' and active = '1'&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/postfix/mysql_virtual_mailbox_domainaliases_maps.cf&lt;/code&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;py&quot;&gt;user&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mail&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;password&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mailpassword&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;hosts&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;localhost&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;dbname&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mail&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;query&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;SELECT maildir FROM mailbox, alias_domain&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;WHERE&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;alias_domain.alias_domain&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'%d'&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;AND&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;mailbox.username&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;concat('%u', '@', alias_domain.target_domain )&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;AND&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;mailbox.active&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;1&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/postfix/mysql_virtual_mailbox_maps.cf&lt;/code&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;py&quot;&gt;user&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mail&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;password&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mailpassword&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;hosts&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;localhost&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;dbname&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mail&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;table&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mailbox&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;select_field&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;CONCAT(domain, '/', local_part)&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;where_field&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;username&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;additional_conditions&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;and active = '1'&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;We’re going to strip the email client and IP address of each mail you send. Remember this is just &lt;a href=&quot;https://en.wikipedia.org/wiki/Security_through_obscurity&quot;&gt;security through obscurity&lt;/a&gt; and you’ll be violating &lt;a href=&quot;https://tools.ietf.org/html/rfc2045&quot;&gt;RFC 2045&lt;/a&gt; if you remove the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MIME-Version string&lt;/code&gt;. It’s still useful to prevent uninitiated recipients from figuring out where you are sending your mail from. Add these to the file &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/postfix/header_checks&lt;/code&gt; for now. We’ll enable it in the Postfix configuration later.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;/^Received:/                 IGNORE
/^User-Agent:/               IGNORE
/^X-Mailer:/                 IGNORE
/^X-Enigmail:/               IGNORE
/^X-Originating-IP:/         IGNORE
/^x-cr-[a-z]&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;:/              IGNORE
/^Thread-Index:/             IGNORE
/^&lt;span class=&quot;se&quot;&gt;\s&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;Mime-Version: 1.0.&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;/    REPLACE Mime-Version: 1.0&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;postfix-main-configuration&quot;&gt;Postfix Main Configuration&lt;/h2&gt;

&lt;p&gt;We only need to make some minor adjustments to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/postfix/main.cf&lt;/code&gt;:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;py&quot;&gt;myhostname&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mail.example.org&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;myorigin&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;$myhostname&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;inet_interfaces&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;all&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;mynetworks&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;127.0.0.0/24 [::ffff:127.0.0.0]/104 [::1]/128&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;alias_maps&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;hash:/etc/aliases&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;alias_database&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;hash:/etc/aliases&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;header_checks&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;regexp:/etc/postfix/header_checks&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;mime_header_checks&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;regexp:/etc/postfix/header_checks&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_banner&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;$myhostname ESMTP $mail_name&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;biff&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;no&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;append_dot_mydomain&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;no&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The &lt;strong&gt;Dovecot&lt;/strong&gt; authentication section will remain the same as in my previous guide too&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;py&quot;&gt;smtpd_sasl_type&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;dovecot&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_sasl_path&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;private/auth&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_sasl_auth_enable&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;yes&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;broken_sasl_auth_clients&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;no&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_sasl_security_options&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;noanonymous&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_sasl_local_domain&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_sasl_authenticated_header&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;yes&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;With newer versions of &lt;strong&gt;Postfix&lt;/strong&gt;, you can now include both ECDSA and RSA certificates in your configuration. I’m disabling SSLv2, SSLv3, and TLSv1.0 in the configuration below. We’re excluding known insecure ciphers and setting the encryption level to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;may&lt;/code&gt;. You can set this to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;encrypt&lt;/code&gt;, if you want, but the &lt;strong&gt;Postfix&lt;/strong&gt; documentation strongly advises against this for a public facing server.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;py&quot;&gt;lmtp_tls_ciphers&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;high&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;lmtp_tls_mandatory_ciphers&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;high&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;lmtp_tls_mandatory_protocols&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;!SSLv2, !SSLv3, !TLSv1&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;lmtp_tls_protocols&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;!SSLv2, !SSLv3, !TLSv1&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtp_tls_ciphers&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;high&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtp_tls_exclude_ciphers&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;aNULL, eNULL, EXPORT, DES, RC4, MD5, 3DES, DES+MD5, LOW, DSS, PSK, aECDH, EDH-DSS-DES-CBC3-SHA, EDH-RSA-DES-CDC3-SHA, KRB5-DE5, CBC3-SHA&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtp_tls_loglevel&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtp_tls_mandatory_ciphers&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;high&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtp_tls_mandatory_exclude_ciphers&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;aNULL, eNULL, EXPORT, DES, RC4, MD5, 3DES, DES+MD5, LOW, DSS, PSK, aECDH, EDH-DSS-DES-CBC3-SHA, EDH-RSA-DES-CDC3-SHA, KRB5-DE5, CBC3-SHA&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtp_tls_mandatory_protocols&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;!SSLv2, !SSLv3, !TLSv1&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtp_tls_note_starttls_offer&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;yes&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtp_tls_policy_maps&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;hash:/etc/postfix/tls_policy&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtp_tls_protocols&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;!SSLv2, !SSLv3, !TLSv1&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtp_tls_security_level&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;may&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_reject_unlisted_recipient&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;yes&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_reject_unlisted_sender&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;yes&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_tls_auth_only&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;yes&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_tls_cert_file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;/home/acme/.acme.sh/mail.example.org/fullchain.cer&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_tls_eccert_file&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;/home/acme/.acme.sh/mail.example.org_ecc/fullchain.cer&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_tls_eckey_file&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;/home/acme/.acme.sh/mail.example.org_ecc/mail.example.org.key&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_tls_eecdh_grade&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;ultra&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_tls_exclude_ciphers&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;aNULL, eNULL, EXPORT, DES, RC4, MD5, 3DES, DES+MD5, LOW, DSS, PSK, aECDH, EDH-DSS-DES-CBC3-SHA, EDH-RSA-DES-CDC3-SHA, KRB5-DE5, CBC3-SHA&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_tls_key_file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;/home/acme/.acme.sh/mail.example.org/mail.example.org.key&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_tls_loglevel&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_tls_mandatory_ciphers&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;high&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_tls_mandatory_exclude_ciphers&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;aNULL, eNULL, EXPORT, DES, RC4, MD5, 3DES, DES+MD5, LOW, DSS, PSK, aECDH, EDH-DSS-DES-CBC3-SHA, EDH-RSA-DES-CDC3-SHA, KRB5-DE5, CBC3-SHA&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_tls_mandatory_protocols&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;!SSLv2, !SSLv3, !TLSv1&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_tls_protocols&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;!SSLv2, !SSLv3, !TLSv1&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_tls_received_header&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;yes&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_tls_security_level&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;may&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_tls_session_cache_timeout&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;3600s&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;tls_preempt_cipherlist&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;yes&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;tls_random_source&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;dev:/dev/urandom&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Feel free to set these parameters to whatever fits your needs&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;py&quot;&gt;delay_warning_time&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;4h&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;maximal_queue_lifetime&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;5d&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;minimal_backoff_time&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;1000s&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;maximal_backoff_time&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;8000s&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;message_size_limit&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;20480000&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtp_helo_timeout&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;60s&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_recipient_limit&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;16&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_soft_error_limit&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;3&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_hard_error_limit&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;12&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Now we set up milters along with the &lt;strong&gt;Postgrey&lt;/strong&gt; and &lt;strong&gt;OpenDKIM&lt;/strong&gt; sockets&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;py&quot;&gt;smtpd_helo_restrictions&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;permit_mynetworks, permit_sasl_authenticated, warn_if_reject reject_non_fqdn_hostname, reject_invalid_hostname, permit&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_sender_restrictions&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;permit_sasl_authenticated, permit_mynetworks, warn_if_reject reject_non_fqdn_sender, reject_unknown_sender_domain, reject_unauth_pipelining, permit&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_client_restrictions&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;reject_rbl_client sbl.spamhaus.org, reject_rbl_client blackholes.easynet.nl, reject_rbl_client b.barracudacentral.org&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_recipient_restrictions&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;reject_unauth_pipelining, permit_mynetworks, permit_sasl_authenticated, reject_non_fqdn_recipient, reject_unknown_recipient_domain, reject_unauth_destination, check_policy_service unix:/var/run/postgrey/postgrey.sock, permit&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_data_restrictions&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;reject_unauth_pipelining&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_relay_restrictions&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;reject_unauth_pipelining, permit_mynetworks, permit_sasl_authenticated, reject_non_fqdn_recipient, reject_unknown_recipient_domain, reject_unauth_destination, check_policy_service unix:/var/run/postgrey/postgrey.sock, permit&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_helo_required&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;yes&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_delay_reject&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;yes&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;disable_vrfy_command&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;yes&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;mailbox_size_limit&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;0&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;recipient_delimiter&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;+&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;non_smtpd_milters&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;unix:/var/run/opendkim/opendkim.sock&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_milters&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;unix:/var/run/opendkim/opendkim.sock&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;We need to point &lt;strong&gt;Postfix&lt;/strong&gt; to our database map files. Use the same &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UID&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GID&lt;/code&gt; that was used for the &lt;strong&gt;Dovecot&lt;/strong&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;py&quot;&gt;virtual_mailbox_base&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;/var/vmail&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;virtual_mailbox_maps&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf, mysql:/etc/postfix/mysql_virtual_mailbox_domainaliases_maps.cf&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;virtual_uid_maps&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;static:150&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;virtual_gid_maps&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;static:12&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;virtual_alias_maps&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mysql:/etc/postfix/mysql_virtual_alias_maps.cf, mysql:/etc/postfix/mysql_virtual_alias_domainaliases_maps.cf&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;virtual_mailbox_domains&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mysql:/etc/postfix/mysql_virtual_domains_maps.cf&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Last, set up &lt;strong&gt;Dovecot&lt;/strong&gt; and &lt;strong&gt;Amavis&lt;/strong&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;py&quot;&gt;virtual_transport&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;dovecot&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;dovecot_destination_recipient_limit&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;content_filter&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;amavis-forward:unix:amavis/amavisd.sock&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;postfix-master-configuration&quot;&gt;Postfix Master Configuration&lt;/h2&gt;

&lt;p&gt;Moving on to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/postfix/master.cf&lt;/code&gt;, we’ll set up &lt;strong&gt;SMTP&lt;/strong&gt; with &lt;strong&gt;TLS&lt;/strong&gt; on port &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;587&lt;/code&gt; and &lt;strong&gt;SMTPS&lt;/strong&gt; on port &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;465&lt;/code&gt;. Most options can just be enabled by uncommenting them. Make sure you comment out the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-o syslog_name=postfix/$service_name&lt;/code&gt; option right under &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;relay&lt;/code&gt;.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;err&quot;&gt;submission&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;inet&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;n&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;-&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;-&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;-&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;-&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;smtpd&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;syslog_name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;postfix/submission&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;smtpd_tls_security_level&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;encrypt&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;smtpd_sasl_auth_enable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;yes&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;smtpd_enforce_tls&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;yes&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;smtpd_client_restrictions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;permit_sasl_authenticated,reject_unauth_destination,reject&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;smtpd_sasl_tls_security_options&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;noanonymous&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;cleanup_service_name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;subcleanup&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;tls_preempt_cipherlist&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;yes&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;smtps&lt;/span&gt;     &lt;span class=&quot;err&quot;&gt;inet&lt;/span&gt;  &lt;span class=&quot;err&quot;&gt;n&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;-&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;-&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;-&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;-&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;smtpd&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;syslog_name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;postfix/smtps&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;smtpd_tls_wrappermode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;yes&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;smtpd_sasl_auth_enable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;yes&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;smtpd_tls_auth_only&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;yes&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;smtpd_client_restrictions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;permit_sasl_authenticated,reject_unauth_destination,reject&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;smtpd_sasl_security_options&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;noanonymous,noplaintext&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;smtpd_sasl_tls_security_options&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;noanonymous&lt;/span&gt;

&lt;span class=&quot;err&quot;&gt;subcleanup&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;unix&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;n&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;-&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;-&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;-&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;0&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;cleanup&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;header_checks&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;regexp:/etc/postfix/submission_header_checks&lt;/span&gt;

&lt;span class=&quot;err&quot;&gt;relay&lt;/span&gt;     &lt;span class=&quot;err&quot;&gt;unix&lt;/span&gt;  &lt;span class=&quot;err&quot;&gt;-&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;-&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;n&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;-&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;-&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;smtp&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;#        -o syslog_name=postfix/$service_name
#       -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;maildrop&lt;/span&gt;  &lt;span class=&quot;err&quot;&gt;unix&lt;/span&gt;  &lt;span class=&quot;err&quot;&gt;-&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;n&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;n&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;-&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;-&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;pipe&lt;/span&gt;
  &lt;span class=&quot;py&quot;&gt;flags&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient}&lt;/span&gt;

&lt;span class=&quot;err&quot;&gt;dovecot&lt;/span&gt;      &lt;span class=&quot;err&quot;&gt;unix&lt;/span&gt;   &lt;span class=&quot;err&quot;&gt;-&lt;/span&gt;        &lt;span class=&quot;err&quot;&gt;n&lt;/span&gt;      &lt;span class=&quot;err&quot;&gt;n&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;-&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;-&lt;/span&gt;   &lt;span class=&quot;err&quot;&gt;pipe&lt;/span&gt;
  &lt;span class=&quot;py&quot;&gt;flags&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;DRhu user=vmail:mail argv=/usr/libexec/dovecot/dovecot-lda -f ${sender} -d $(recipient)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;For &lt;strong&gt;Amavis&lt;/strong&gt;, just make sure you set the max number of processes it’s  allowed to run. In this example, it’s 4 (the same as the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nginx&lt;/code&gt; configuration).&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;err&quot;&gt;amavis-forward&lt;/span&gt;      &lt;span class=&quot;err&quot;&gt;unix&lt;/span&gt;    &lt;span class=&quot;err&quot;&gt;-&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;-&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;-&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;-&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;4&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;lmtp&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;lmtp_data_done_timeout&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;1200&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;lmtp_send_xforward_command&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;yes&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;disable_dns_lookups&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;yes&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;max_use&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;20&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;amavis/amavis-accept&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;unix&lt;/span&gt;    &lt;span class=&quot;err&quot;&gt;n&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;-&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;-&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;-&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;-&lt;/span&gt;       &lt;span class=&quot;err&quot;&gt;smtpd&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;content_filter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;local_recipient_maps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;relay_recipient_maps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;cleanup_service_name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;cleanup&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;smtpd_restriction_classes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;smtpd_delay_reject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;no&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;smtpd_client_restrictions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;permit_mynetworks,reject&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;smtpd_helo_restrictions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;smtpd_sender_restrictions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;smtpd_recipient_restrictions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;permit_mynetworks,reject&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;smtpd_data_restrictions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;reject_unauth_pipelining&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;smtpd_end_of_data_restrictions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;mynetworks&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;127.0.0.0/8&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;smtpd_error_sleep_time&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;0&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;smtpd_soft_error_limit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;1001&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;smtpd_hard_error_limit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;1000&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;smtpd_client_connection_count_limit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;0&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;smtpd_client_connection_rate_limit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;0&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;receive_override_options&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;no_header_body_checks,no_unknown_recipient_checks,no_milters&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Before you continue, make an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/aliases&lt;/code&gt; file and generate the database:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nb&quot;&gt;touch&lt;/span&gt; /etc/aliases
newaliases&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h1 id=&quot;amavis-with-clamav-and-spamassassin&quot;&gt;Amavis with ClamAV and SpamAssassin&lt;/h1&gt;

&lt;p&gt;Let’s set up virus and spam checking. We are using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;amavisd-new&lt;/code&gt; here. It will be the interface bewtween &lt;strong&gt;Postfix&lt;/strong&gt;, &lt;strong&gt;ClamAV&lt;/strong&gt; and &lt;strong&gt;SpamAssassin&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;We need a ton of things for &lt;strong&gt;Amavis&lt;/strong&gt; and &lt;strong&gt;SpamAssassin&lt;/strong&gt;. You can go the &lt;strong&gt;SlackBuilds&lt;/strong&gt; route or just use &lt;a href=&quot;https://www.cpan.org/&quot;&gt;CPAN&lt;/a&gt;. If you need to keep track of what you have installed with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sbopkg&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;slackpkg&lt;/code&gt; or whatever &lt;strong&gt;Slackware&lt;/strong&gt; “package manager” you use then go the &lt;strong&gt;SlackBuilds&lt;/strong&gt; route. Before getting started you may want to install the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;re2c&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;zeromq&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pyzor&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;unrar&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;arj&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cabextract&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;lzop&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nomarch&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;p7zip&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;libmspack&lt;/code&gt;, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GeoIP&lt;/code&gt;packages to allow &lt;strong&gt;SpamAssassin&lt;/strong&gt; and &lt;strong&gt;ClamAV&lt;/strong&gt; to handle different compressed files and to satisfy some of their dependencies.&lt;/p&gt;

&lt;p&gt;If you’re using &lt;strong&gt;CPAN&lt;/strong&gt;, here’s what you need to install all the &lt;strong&gt;Perl&lt;/strong&gt; modules:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;cpan &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;CPAN
cpan &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;Log::Log4perl App::cpanminus
cpanm &lt;span class=&quot;nt&quot;&gt;-f&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; inc::latest Test::Pod Test::Pod::Coverage Encode::Detect Image::Info TimeDate Net::LibIDN Net::SSLeay Socket6 IO::Socket::IP IO::Socket::SSL IO::Socket::INET6 Crypt::OpenSSL::Bignum Crypt::OpenSSL::Random Crypt::OpenSSL::RSA Geography::Countries IP::Country Digest::SHA Digest::SHA1 Digest::HMAC HTML::Tagset HTML::Parser Test::LeakTrace Authen::NTLM Data::Dump LWP Net::CIDR::Lite PAR::Dist ExtUtils::MakeMaker ExtUtils::Install Net::HTTP WWW::RobotRules HTTP::Date File::Listing IO::HTML Encode::Locale LWP::Protocol::https LWP::MediaTypes HTTP::Message HTTP::Negotiate HTTP::Cookies HTTP::Daemon Bundle::LWP NetAddr::IP Net::Server Net::Ident MailTools Net::IP Net::DNS Net::DNS::Resolver::Programmable Mail::SPF Mail::DKIM Geo::IP Net::Patricia Convert::TNEF Convert::UUlib Convert::BinHex Archive::Zip IO::Stringy MIME::Tools Unix::Syslog BerkeleyDB IO::Multiplex Net::LibIDN File::LibMagic&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;spamassassin&quot;&gt;SpamAssassin&lt;/h2&gt;

&lt;p&gt;Get the &lt;a href=&quot;https://slackbuilds.org/repository/14.2/network/spamassassin/&quot;&gt;SpamAssassin SlackBuild&lt;/a&gt; and build it.&lt;/p&gt;

&lt;p&gt;After &lt;strong&gt;SpamAssassin&lt;/strong&gt; is installed, edit the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/spamassassin.conf&lt;/code&gt; file and set the following options. You only really need &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ENABLED&lt;/code&gt; but the rest are a good idea.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;py&quot;&gt;ENABLED&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;OPTIONS&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;--create-prefs --max-children 5 --helper-home-dir&quot;&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;PIDFILE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/var/run/spamd.pid&quot;&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;CRON&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;1&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The &lt;strong&gt;SpamAssassin&lt;/strong&gt; source no longer includes rules, so you’ll have to download them. Run &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sa-update&lt;/code&gt; to do this.&lt;/p&gt;

&lt;h2 id=&quot;clamav&quot;&gt;ClamAV&lt;/h2&gt;

&lt;p&gt;You’ll need a user and group created first.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;groupadd &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; 210 clamav
useradd &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; 210 &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; /dev/null &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; /bin/false &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; clamav clamav&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Run the &lt;a href=&quot;https://slackbuilds.org/repository/14.2/system/clamav/&quot;&gt;SlackBuild&lt;/a&gt; with the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;COUNTRY&lt;/code&gt; variable set to your country of choice.&lt;/p&gt;

&lt;p&gt;Edit the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/clamd.conf&lt;/code&gt; file and change the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;LocalSocket&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;LocalSocketGroup&lt;/code&gt; options&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;LocalSocket /var/run/clamav/clamd.sock
LocalSocketGroup amavis&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Let’s install &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;amavisd-new&lt;/code&gt; before we update the &lt;strong&gt;ClamAV&lt;/strong&gt; virus definitions.&lt;/p&gt;

&lt;h2 id=&quot;amavisd-new&quot;&gt;amavisd-new&lt;/h2&gt;

&lt;p&gt;Create a &lt;strong&gt;user&lt;/strong&gt; and &lt;strong&gt;group&lt;/strong&gt; before you run the script.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;groupadd &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; 225 amavis
useradd &lt;span class=&quot;nt&quot;&gt;-m&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; /var/lib/amavis &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; /bin/bash &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; 225 &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; 225 amavis&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;While we’re at it, go ahead and add the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;amavis&lt;/code&gt; user to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;clamav&lt;/code&gt; group and vice versa.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;usermod &lt;span class=&quot;nt&quot;&gt;-G&lt;/span&gt; clamav &lt;span class=&quot;nt&quot;&gt;-a&lt;/span&gt; amavis
usermod &lt;span class=&quot;nt&quot;&gt;-G&lt;/span&gt; amavis &lt;span class=&quot;nt&quot;&gt;-a&lt;/span&gt; clamav&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Uncomment the lines &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@bypass_virus_checks_maps&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@bypass_spam_checks_maps&lt;/code&gt; at the top of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/amavisd.conf&lt;/code&gt; and add the following&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;@bypass_virus_checks_maps &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;
   %bypass_virus_checks, @bypass_virus_checks_acl, &lt;span class=&quot;nv&quot;&gt;$bypass_virus_checks_re&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

@bypass_spam_checks_maps &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;
   %bypass_spam_checks, @bypass_spam_checks_acl, &lt;span class=&quot;nv&quot;&gt;$bypass_spam_checks_re&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Go down a bit further and uncomment &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@lookup_sql_dsn&lt;/code&gt;, then modify it to connect to your database using the &lt;strong&gt;Unix&lt;/strong&gt; socket and the proper credentials. &lt;strong&gt;Amavis&lt;/strong&gt; uses the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DBD::mysql&lt;/code&gt; Perl module. The documentation &lt;a href=&quot;https://metacpan.org/pod/DBD::mysql&quot;&gt;states&lt;/a&gt; setting the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;host&lt;/code&gt; value to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;localhost&lt;/code&gt; will use the socket. This configuration will enable spam checking for the domains you’ve added to your database either manually or through &lt;strong&gt;Postfix Admin&lt;/strong&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;err&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;py&quot;&gt;lookup_sql_dsn&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;err&quot;&gt;['DBI:mysql:&lt;/span&gt;&lt;span class=&quot;py&quot;&gt;database&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;mail;host=localhost',&lt;/span&gt;
     &lt;span class=&quot;err&quot;&gt;'mail',&lt;/span&gt;
     &lt;span class=&quot;err&quot;&gt;'mailpassword'])&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;;
&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;py&quot;&gt;sql_select_policy&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'SELECT domain from domain WHERE CONCAT(&quot;@&quot;,domain) IN (%k)';&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;There are a couple of other settings we can change. For instance, make sure you also set &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$max_servers&lt;/code&gt; to the same number of processes you allowed Amavis to use in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/postfix/master.cf&lt;/code&gt;. Setting the  &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$sa_tag_level_deflt&lt;/code&gt; opton to a large negative number will ensure that spam headers are added to every single email. Change the user and group to the ones you created earlier, set up a home directory for configuration files and quarantine emails, and set your domain name (&lt;strong&gt;not&lt;/strong&gt; the same as your hostname). Make sure you also uncomment the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;amavis&lt;/code&gt; section in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@av_scanners&lt;/code&gt;. We are also setting the &lt;strong&gt;Unix&lt;/strong&gt; socket for &lt;strong&gt;Amavis&lt;/strong&gt; here too.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-perl&quot; data-lang=&quot;perl&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$max_servers&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$sa_tag_level_deflt&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;9999&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$daemon_user&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;amavis&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;';&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$daemon_group&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;amavis&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;';&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$mydomain&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;example.org&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;';&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$myhostname&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;mail.example.org&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;';&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$MYHOME&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;/var/lib/amavis&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;';&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$QUARANTINEDIR&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$MYHOME&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/virusmails&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&quot;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$unix_socketname&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/var/spool/postfix/amavis/amavisd.sock&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&quot;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$unix_socket_mode&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mo&quot;&gt;0660&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$interface_policy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;SOCK&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;'}&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;mysock&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;';&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$policy_bank&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;mysock&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;'}&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
   &lt;span class=&quot;s&quot;&gt;protocol&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;LMTP&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;',&lt;/span&gt;
   &lt;span class=&quot;s&quot;&gt;auth_required_release&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Comment out &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$inet_socket_port&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$interface_policy('10026')&lt;/code&gt;. There may already be an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$interface_policy&lt;/code&gt; set up for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AM.PDP-SOCK&lt;/code&gt;. Comment it out or modify it to what I have above. Notice we’re placing the socket in the Postfix queue directory, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/var/spool/postfix&lt;/code&gt;. We’ll need to create the directory to hold the socket and assign some permissions as well.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nb&quot;&gt;mkdir&lt;/span&gt; /var/spool/postfix/amavis/
&lt;span class=&quot;nb&quot;&gt;chmod &lt;/span&gt;770 /var/spool/postfix/amavis/
&lt;span class=&quot;nb&quot;&gt;chown &lt;/span&gt;amavis:postfix /var/spool/postfix/amavis/
usermod &lt;span class=&quot;nt&quot;&gt;-G&lt;/span&gt; amavis &lt;span class=&quot;nt&quot;&gt;-a&lt;/span&gt; postfix&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Use the following commands to let Postfix create the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;amavis-accept&lt;/code&gt; PID:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; /var/spool/postfix/public
&lt;span class=&quot;nb&quot;&gt;ln&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; ../amavis amavis
&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; /var/spool/postfix/pid
&lt;span class=&quot;nb&quot;&gt;mkdir &lt;/span&gt;unix.amavis
&lt;span class=&quot;nb&quot;&gt;chown &lt;/span&gt;root:root unix.amavis
&lt;span class=&quot;nb&quot;&gt;chmod &lt;/span&gt;700 unix.amavis&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;In order for the above to work, we need to set a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$forward_method&lt;/code&gt; in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/amavisd.conf&lt;/code&gt;. In my setup, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;amavisd-new&lt;/code&gt; would ignore that configuration option and insist on using TCP port 10025. I could not for the life of me figure out how to get it to use a socket no matter what value I tried. I ended up having to modify the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/usr/sbin/amavisd&lt;/code&gt; Perl script directly. Look around line 926 or search for 10025. Comment out the existing &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$forward_method&lt;/code&gt; and replace it with this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-perl&quot; data-lang=&quot;perl&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$forward_method&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$have_inet6&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$have_inet4&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;smtp:[::1]:10025&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;'&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;smtp:/var/spool/postfix/amavis/amavis-accept&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;';&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Go through the rest of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/amavisd.conf&lt;/code&gt; file and modify any settings you might want changed.&lt;/p&gt;

&lt;p&gt;Now go ahead and update your virus database by running &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;freshclam&lt;/code&gt; as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;root&lt;/code&gt;. Don’t worry if you get a message from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;freshclam&lt;/code&gt; saying &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;clamd&lt;/code&gt; was not updated. This is because we have not started &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;clamd&lt;/code&gt; yet. We also need to fix some permissions to get all three to play nicely.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nb&quot;&gt;chmod &lt;/span&gt;775 /var/lib/spamassassin/
&lt;span class=&quot;nb&quot;&gt;chown &lt;/span&gt;amavis:amavis /var/lib/spamassassin/
&lt;span class=&quot;nb&quot;&gt;chown&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-R&lt;/span&gt; amavis:amavis /var/lib/spamassassin/
&lt;span class=&quot;nb&quot;&gt;chown&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-R&lt;/span&gt; amavis:amavis /var/lib/amavis
&lt;span class=&quot;nb&quot;&gt;chown&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-R&lt;/span&gt; clamav:amavis /var/lib/clamav&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h1 id=&quot;postgrey&quot;&gt;Postgrey&lt;/h1&gt;

&lt;p&gt;Set up the user and group first, then run the &lt;a href=&quot;https://slackbuilds.org/repository/14.2/network/postgrey/&quot;&gt;SlackBuild&lt;/a&gt;.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;groupadd &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; 301 postgrey
useradd &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; 301 &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; /var/lib/postgrey &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; /bin/false &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; postgrey postgrey&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Set &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;POSTGREYUSR&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;POSTGREYGRP&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;POSTGREYUID&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;POSTGREYGID&lt;/code&gt; in the &lt;strong&gt;SlackBuild&lt;/strong&gt; to the values you set earlier when you created them. You can get an updated version of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;postgrey_whitelist_clients&lt;/code&gt; from the &lt;a href=&quot;http://postgrey.schweikert.ch/pub/&quot;&gt;Postgrey&lt;/a&gt; site and place it in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/postfix&lt;/code&gt;, replacing the one included with the &lt;strong&gt;SlackBuild&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Edit the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/rc.d/rc.postgrey&lt;/code&gt; script and set &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;USER&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GROUP&lt;/code&gt;, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;HOST&lt;/code&gt; to their proper values. Feel free to get rid of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PORT&lt;/code&gt;. Find the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;postgrey_start()&lt;/code&gt; function and edit the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;postgrey&lt;/code&gt; flags to make sure it uses a socket instead of TCP.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;postgrey_start&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Starting postgrey milter:  /usr/bin/postgrey -d --unix=/var/run/postgrey/postgrey.sock --pidfile=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$PIDFILE&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; --user=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$USER&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; --group=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$GROUP&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; --dbdir=/var/lib/postgrey --hostname=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$HOST&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;mkdir&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; /var/run/postgrey
  /usr/bin/postgrey &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
                    &lt;span class=&quot;nt&quot;&gt;--unix&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/var/run/postgrey/postgrey.sock &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
                    &lt;span class=&quot;nt&quot;&gt;--pidfile&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/var/run/postgrey/postgrey.pid &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
                    &lt;span class=&quot;nt&quot;&gt;--user&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$USER&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--group&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$GROUP&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
                    &lt;span class=&quot;nt&quot;&gt;--dbdir&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/var/lib/postgrey &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
                    &lt;span class=&quot;nt&quot;&gt;--hostname&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$HOST&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The extracted source includes an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;init&lt;/code&gt; script, too. It’s in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;contrib/postgrey.init&lt;/code&gt; if you want to use it.&lt;/p&gt;

&lt;h1 id=&quot;opendkim-dns-and-building-trust&quot;&gt;OpenDKIM, DNS and Building Trust&lt;/h1&gt;

&lt;p&gt;The setup up to this point should be pretty much complete and meet most people’s needs. Some mail servers are quite picky when it comes to receiving email. Gmail particularly doesn’t like when an email is not signed. The next section will walk you through signing your email with &lt;a href=&quot;https://en.wikipedia.org/wiki/DomainKeys_Identified_Mail&quot;&gt;DomainKeys Identified Mail&lt;/a&gt; and setting up &lt;a href=&quot;https://en.wikipedia.org/wiki/Sender_Policy_Framework&quot;&gt;Sender Policy Framework&lt;/a&gt;. If you are using a hosting provider for your server, you will need to contact them and have them set up a &lt;abbr title=&quot;Pointer&quot;&gt;PTR&lt;/abbr&gt; record for your IP address. This is also known as &lt;abbr title=&quot;reverse DNS&quot;&gt;rDNS&lt;/abbr&gt;. Some mail servers will reject your email if the IP you are sending from does not point back to your domain name. In general, it should look something like this:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;34.216.184.93.in-addr.arpa	PTR	600	example.org&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If you’re hosting at home, you can try asking your ISP to set this up for you but it is unlikely they’ll want to. They may be willing if you purchase a static IP. You’ll also need to add &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MX&lt;/code&gt; records to your domain’s DNS records. You can add something like this&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;example.org MX	600 10 mail.example.org&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;That’s assuming &lt;a href=&quot;http://mail.example.org&quot;&gt;mail.example.org&lt;/a&gt; points to your mail sever’s IP and you want a priority of 10. You can ask your DNS provider to add these for you. Check that the record has propagated with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;host&lt;/code&gt;:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;host &lt;span class=&quot;nt&quot;&gt;-t&lt;/span&gt; MX example.org
example.org mail is handled by 10 mail.example.org.&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;opendkim&quot;&gt;OpenDKIM&lt;/h2&gt;

&lt;p&gt;Install (&lt;a href=&quot;https://slackbuilds.org/repository/14.2/libraries/libbsd/&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;libbsd&lt;/code&gt;&lt;/a&gt;), (&lt;a href=&quot;https://slackbuilds.org/repository/14.2/development/opendbx/&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;opendbx&lt;/code&gt;&lt;/a&gt;), then grab my &lt;a href=&quot;https://slackbuilds.org/repository/14.2/network/opendkim/&quot;&gt;SlackBuild&lt;/a&gt; and install &lt;strong&gt;OpenDKIM&lt;/strong&gt;. Set up the &lt;strong&gt;user&lt;/strong&gt; and &lt;strong&gt;group&lt;/strong&gt; first:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;groupadd &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; 305 opendkim
useradd &lt;span class=&quot;nt&quot;&gt;-r&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; 305 &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; opendkim &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; /var/run/opendkim/ &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; /sbin/nologin &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;OpenDKIM Milter&quot;&lt;/span&gt; opendkim&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;We’ll need to create the run directory as well:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nb&quot;&gt;mkdir&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; /var/run/opendkim
&lt;span class=&quot;nb&quot;&gt;chown &lt;/span&gt;opendkim:opendkim /var/run/opendkim&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;We are using MariaDB here so set the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;USE_MYSQL&lt;/code&gt; variable to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;yes&lt;/code&gt; and run the &lt;strong&gt;SlackBuild&lt;/strong&gt;. I used a modified version of CentOS’s &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;init&lt;/code&gt; script for &lt;a href=&quot;https://slackbuilds.org/slackbuilds/14.2/network/OpenDKIM/rc.opendkim&quot;&gt;rc.opendkim&lt;/a&gt;, but feel free to grab the one included in the source in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;contrib/init/generic/&lt;/code&gt; directory.&lt;/p&gt;

&lt;p&gt;Once it’s installed, we’ll need to set up a basic configuration file. You can copy the sample one from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;opendkim/opendkim.conf.simple&lt;/code&gt; in the extracted source to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/opendkim&lt;/code&gt; and add the user and group we created earlier. Note that the SlackBuild already does this for you:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;UserID opendkim:opendkim
KeyFile /etc/opendkim/keys/default.private&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;You’ll notice my &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;init&lt;/code&gt; script will automatically create some default keys for you in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/opendkim/keys&lt;/code&gt; and create the directory if it doesn’t exist. We’re using Unix sockets in this guide, so let’s change a line in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/opendkim.conf&lt;/code&gt;:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;Socket &lt;span class=&quot;nb&quot;&gt;local&lt;/span&gt;:/var/run/opendkim/opendkim.sock&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;We’ll generate a 2048 bit key with the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;opendkim-genkey&lt;/code&gt; command. You can try something stronger like 4096 bits, but RFC 6376 suggests it might not fit in a 512 byte DNS UDP response. See section &lt;a href=&quot;https://tools.ietf.org/html/rfc6376#section-3.3&quot;&gt;3.3.3 Key Sizes&lt;/a&gt; for more information.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;opendkim-genkey &lt;span class=&quot;nt&quot;&gt;-b&lt;/span&gt; 2048 &lt;span class=&quot;nt&quot;&gt;-D&lt;/span&gt; /etc/opendkim/keys &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; mailsvr &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; example.org&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The selector is simply something to tell your key apart once you add it to your DNS records. You’ll end up with two files, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mailsvr.private&lt;/code&gt;, which is your key, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mailsvr.txt&lt;/code&gt; which has a nicely formatted record you’ll need to add to your DNS zone. If you don’t manage your own DNS or have access to your zone file, simply copy the text starting with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;v=DKIM1&lt;/code&gt; as a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TXT&lt;/code&gt; record in whatever control panel your DNS provider uses. For the example above, this is what I got (truncated for demonstration):&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;s2&quot;&gt;&quot;v=DKIM1; k=rsa;
p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0m8F6p1AD&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;You’ll need to wait a while before the DNS record propagates but once it does you can check it with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dig&lt;/code&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;dig mailsvr._domainkey.example.org TXT&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;sender-policy-framework&quot;&gt;Sender Policy Framework&lt;/h2&gt;

&lt;p&gt;This basically consists of adding another &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TXT&lt;/code&gt; record to your DNS zone. There used to be an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SPF&lt;/code&gt; type record but this was removed in &lt;a href=&quot;https://tools.ietf.org/html/rfc7208&quot;&gt;RFC 7208&lt;/a&gt;. You’ll want to add something like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nv&quot;&gt;v&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;spf1 a mx ~all&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h1 id=&quot;mariadb&quot;&gt;MariaDB&lt;/h1&gt;

&lt;p&gt;We’ll set up &lt;strong&gt;MariaDB&lt;/strong&gt; first (the scripts are still named &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rc.mysqld&lt;/code&gt;):&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nb&quot;&gt;chmod&lt;/span&gt; +x /etc/rc.d/rc.mysqld
/usr/bin/mysql_install_db &lt;span class=&quot;nt&quot;&gt;--user&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;mysql
/etc/rc.d/rc.mysqld start
/usr/bin/mysql_secure_installation&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Now create the user and database we’ll be using for &lt;strong&gt;Roundcube&lt;/strong&gt;, &lt;strong&gt;Postfix Admin&lt;/strong&gt;, and all other components.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sql&quot; data-lang=&quot;sql&quot;&gt;&lt;span class=&quot;k&quot;&gt;CREATE&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;DATABASE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;mail&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;GRANT&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;ALL&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;PRIVILEGES&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;ON&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;mail&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;TO&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;&quot;mail&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;&quot;localhost&quot;&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;\&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;IDENTIFIED&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;BY&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;&quot;password-here&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;FLUSH&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;PRIVILEGES&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h1 id=&quot;start-up-email&quot;&gt;Start Up Email&lt;/h1&gt;

&lt;p&gt;Let’s start up the services we have so far in order to get all necessary files created properly. We’ll need the services running in order to set up &lt;strong&gt;Roundcube&lt;/strong&gt; and &lt;strong&gt;Postfix Admin&lt;/strong&gt; correctly.&lt;/p&gt;

&lt;p&gt;You can place your startup commands in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/rc.d/rc.local&lt;/code&gt; and the stop commands in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/rc.d/rc.local_shutdown&lt;/code&gt;. Make sure both are executable and add this content&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/rc.d/rc.local&lt;/code&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.php-fpm &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.php-fpm start
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.nginx &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.nginx start
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.postgrey &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.postgrey start
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.clamav &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.clamav start
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.spamd &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.spamd start
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.amavisd-new &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.amavisd-new start
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.postfix &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.postfix start
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.dovecot &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.dovecot start
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.opendkim &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.opendkim start
&lt;span class=&quot;k&quot;&gt;fi&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/rc.d/rc.local_shutdown&lt;/code&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.nginx &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.nginx stop
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.php-fpm &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.php-fpm stop
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.opendkim &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.opendkim stop
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.postfix &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.postfix stop
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.dovecot &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.dovecot stop
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.postgrey &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.postgrey stop
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.amavisd-new &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.amavisd-new stop
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.clamav &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.clamav stop
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.spamd &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.spamd stop
&lt;span class=&quot;k&quot;&gt;fi&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h1 id=&quot;roundcube-and-postfix-admin&quot;&gt;Roundcube and Postfix Admin&lt;/h1&gt;

&lt;p&gt;The same advice from my previous post regarding web based interfaces applies.&lt;/p&gt;

&lt;h2 id=&quot;postfix-admin&quot;&gt;Postfix Admin&lt;/h2&gt;

&lt;p&gt;The most notable change between the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;2.92&lt;/code&gt; version used in my previous guide &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;3.2.1&lt;/code&gt; as of this writing are the ability to reset passwords via email/SMS and the move of most of the files to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;public/&lt;/code&gt; directory.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; /var/www/
wget https://github.com/postfixadmin/postfixadmin/archive/postfixadmin-3.2.1.tar.gz
&lt;span class=&quot;nb&quot;&gt;tar&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-xzf&lt;/span&gt; postfixadmin-3.2.1.tar.gz
&lt;span class=&quot;nb&quot;&gt;ln&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; postfixadmin-postfixadmin-3.2.1 postfixadmin
&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;postfixadmin
&lt;span class=&quot;nb&quot;&gt;mkdir &lt;/span&gt;templates_c
&lt;span class=&quot;nb&quot;&gt;chown &lt;/span&gt;nginx:root templates_c&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Make a copy of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;config.inc.php&lt;/code&gt; as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;config.local.php&lt;/code&gt; and make your changes there. The ones we need for this guide are&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$CONF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'configured'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$CONF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'database_type'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'mysql'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$CONF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'database_user'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'mail'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$CONF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'database_password'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;password-here&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$CONF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'database_name'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'mail'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$CONF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'database_socket'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'/var/run/mysql/mysql.sock'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$CONF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'admin_email'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'admin@example.org'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$CONF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'encrypt'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'dovecot:SHA512-CRYPT'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$CONF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'dovecotpw'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;/usr/bin/doveadm pw&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$CONF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'default_aliases'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;array&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;s1&quot;&gt;'abuse'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'abuse@example.org'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;s1&quot;&gt;'hostmaster'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'hostmaster@example.org'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;s1&quot;&gt;'postmaster'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'postmaster@example.org'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;s1&quot;&gt;'webmaster'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'webmaster@example.org'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;s1&quot;&gt;'virusalert'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'virusalert@example.org'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;s1&quot;&gt;'admin'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'admin@example.org'&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$CONF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'domain_path'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'NO'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$CONF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'domain_in_mailbox'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'YES'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$CONF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'footer_text'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'Return to example.org'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$CONF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'footer_link'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'https://example.org'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$CONF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'emailcheck_resolve_domain'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'NO'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$CONF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'password_expiration'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'NO'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This tells &lt;strong&gt;Postfix Admin&lt;/strong&gt; to use &lt;strong&gt;Dovecot&lt;/strong&gt;’s &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;crypt()&lt;/code&gt; scheme for passwords and to connect to &lt;strong&gt;MariaDB&lt;/strong&gt; using &lt;strong&gt;Unix sockets&lt;/strong&gt;. Next, visit &lt;a href=&quot;https://mail.example.org/postfixadmin/setup.php&quot;&gt;https://mail.example.org/postfixadmin/setup.php&lt;/a&gt; and complete the setup. Make sure you add your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$CONF['setup_password']&lt;/code&gt; obtained from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;setup.php&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;config.local.php&lt;/code&gt;. Do this before clicking on &lt;strong&gt;Add Admin&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;We will need to move all our &lt;strong&gt;Dovecot&lt;/strong&gt; configuration to a single file in order to appease &lt;strong&gt;Postfix Admin&lt;/strong&gt;. It seems it has trouble parsing the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;!include conf.d/*.conf&lt;/code&gt; line in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/dovecot/dovecot.conf&lt;/code&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nb&quot;&gt;cp&lt;/span&gt; /etc/dovecot/dovecot.conf&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;,.bk&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
doveconf &lt;span class=&quot;nt&quot;&gt;-n&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; /etc/dovecot/dovecot.conf
&lt;span class=&quot;nb&quot;&gt;chmod &lt;/span&gt;644 /etc/dovecot/dovecot.conf
usermod &lt;span class=&quot;nt&quot;&gt;-G&lt;/span&gt; dovecot &lt;span class=&quot;nt&quot;&gt;-a&lt;/span&gt; nginx&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;add-email-domains-and-mailboxes&quot;&gt;Add Email Domains and Mailboxes&lt;/h3&gt;

&lt;p&gt;Log in to &lt;a href=&quot;https://mail.example.org/postfixadmin&quot;&gt;https://mail.example.org/postfixadmin&lt;/a&gt; and head over to &lt;strong&gt;Domain List&lt;/strong&gt; &amp;gt; &lt;strong&gt;New Domain&lt;/strong&gt;. Fill in whatever works for you here to add a new domain, then head to &lt;strong&gt;Virtual List&lt;/strong&gt; &amp;gt; &lt;strong&gt;Add Mailbox&lt;/strong&gt; and create your first user. I set up &lt;a href=&quot;http://example.org&quot;&gt;example.org&lt;/a&gt; as an email domain and &lt;a href=&quot;mailto:admin@example.org&quot;&gt;admin@example.org&lt;/a&gt; as my first user. Doing this will generate the needed database schema that Postfix will use. Go ahead and play around with this and make sure your aliases are set up&lt;/p&gt;

&lt;h2 id=&quot;roundcube&quot;&gt;Roundcube&lt;/h2&gt;

&lt;p&gt;The latest version of &lt;strong&gt;Roundcube&lt;/strong&gt; is now &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;1.3.8&lt;/code&gt;, up from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;1.1.1&lt;/code&gt; used in my previous guide. We’ve already set up the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nginx&lt;/code&gt; configuration for &lt;strong&gt;Postfix Admin&lt;/strong&gt; and &lt;strong&gt;Roundcube&lt;/strong&gt; so now we just have to download their files and run the installers.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; /var/www/
wget https://github.com/roundcube/roundcubemail/releases/download/1.3.8/roundcubemail-1.3.8-complete.tar.gz
&lt;span class=&quot;nb&quot;&gt;tar&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-xvzf&lt;/span&gt; roundcubemail-1.3.8-complete.tar.gz
&lt;span class=&quot;nb&quot;&gt;ln&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; roundcubemail-1.3.8 roundcubemail
&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;roundcubemail&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;We’ll need to create a database for &lt;strong&gt;Roundcube&lt;/strong&gt; to use. Log in to &lt;strong&gt;MariaDB&lt;/strong&gt; with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mysql -u root -p&lt;/code&gt; and create it. Make sure you use a strong password.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sql&quot; data-lang=&quot;sql&quot;&gt;&lt;span class=&quot;k&quot;&gt;CREATE&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;DATABASE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;roundcubemail&lt;/span&gt; &lt;span class=&quot;cm&quot;&gt;/*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;GRANT&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;ALL&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;PRIVILEGES&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;ON&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;roundcubemail&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;TO&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;&quot;roundcube&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;&quot;localhost&quot;&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;\&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;IDENTIFIED&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;BY&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;&quot;password-here&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;FLUSH&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;PRIVILEGES&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;strong&gt;Roundcube&lt;/strong&gt; includes an &lt;strong&gt;SQL&lt;/strong&gt; file that can create the necessary database structure for you&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;mysql &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; roundcube roundcubemail &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; &amp;lt; SQL/mysql.initial.sql&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;I recommend you check out the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;INSTALL&lt;/code&gt; file included in the source for a more complete guide on the installation. Now head over to &lt;a href=&quot;https://mail.example.org/mail/installer&quot;&gt;https://mail.example.org/installer&lt;/a&gt; and make sure everything is OK in the &lt;strong&gt;Check environment&lt;/strong&gt; section. You will probably need to temporarily comment out the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;location&lt;/code&gt; blocks in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/nginx/conf.d/mail.example.org.conf&lt;/code&gt; that block access to &lt;strong&gt;Roundcube&lt;/strong&gt; URLs such as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/installer&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;My installation complained about the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;date.timezone&lt;/code&gt; setting in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;php.ini&lt;/code&gt; so I had to set that. Get a list of supported time zones from &lt;a href=&quot;https://php.net/manual/en/timezones.php&quot;&gt;here&lt;/a&gt;. You may need to restart &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nginx&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;php-fpm&lt;/code&gt; for the changes to take effect.&lt;/p&gt;

&lt;p&gt;Click &lt;em&gt;Next&lt;/em&gt; when you’re done to move on to the &lt;strong&gt;Create config&lt;/strong&gt; section. You can leave most of these settings alone. If you want to know what a specific setting does, check out &lt;a href=&quot;https://github.com/roundcube/roundcubemail/wiki/Configuration&quot;&gt;Roundcube’s wiki&lt;/a&gt;. Fill in the &lt;strong&gt;Database setup&lt;/strong&gt; section with the user and database you created earlier.&lt;/p&gt;

&lt;p&gt;Make sure you &lt;strong&gt;do not&lt;/strong&gt; enable spellchecking support. If you do, &lt;strong&gt;Roundcube&lt;/strong&gt; will connect to external services to check your spelling. Why would we go through all this trouble to have a third party see every word we type?&lt;/p&gt;

&lt;h3 id=&quot;imap-and-smtp-settings&quot;&gt;IMAP and SMTP Settings&lt;/h3&gt;

&lt;p&gt;We’re going to set &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;default_host&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tls://mail.example.org&lt;/code&gt; in the &lt;strong&gt;IMAP Settings&lt;/strong&gt; section. In the &lt;strong&gt;SMTP Settings&lt;/strong&gt; section, set &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;smtp_server&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tls://mail.example.org&lt;/code&gt; , &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;smtp_port&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;587&lt;/code&gt; and check the &lt;em&gt;Use the current IMAP username and password for SMTP authentication&lt;/em&gt; option. Click on &lt;strong&gt;Create config&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;After it’s done writing your configuraiton file, go through &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;config/config.inc.php&lt;/code&gt; and see if you’d like to change anything.&lt;/p&gt;

&lt;h3 id=&quot;plugins&quot;&gt;Plugins&lt;/h3&gt;

&lt;p&gt;You can enable whichever plugins best fit your needs. The only one we really need to set up the email filtering we discussed is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;managesieve&lt;/code&gt;.&lt;/p&gt;

&lt;h1 id=&quot;finishing-up&quot;&gt;Finishing Up&lt;/h1&gt;

&lt;p&gt;Go ahead and create some filters in &lt;strong&gt;Roundcube&lt;/strong&gt; and make sure emails are going to the right folders. Test sending email to and from your own domain as well as to external domains. Connect your email clients. They should automatically detect your sever’s open ports but you can use the following settings to set it up manually. You can substitute the hostname for &lt;a href=&quot;http://example.org&quot;&gt;example.org&lt;/a&gt; if that points to your server’s IP as well.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;Username: testuser@example.org
Incoming &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;IMAP&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; server: mail.example.org
Port: 993
SSL/TLS Enabled
Authentication: Plain &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;Normal Password&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;

Username: testuser@example.org
Outgoing &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;SMTP&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; server: mail.example.org
Port: 587
STARTTLS Enabled
Authentication: Plain &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;Normal Password&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The first time you receive an email, it’ll be greylisted thanks to &lt;strong&gt;Postgrey&lt;/strong&gt;. Check &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/var/log/maillog&lt;/code&gt;:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;Apr 24 22:38:56 mail postgrey[945]: &lt;span class=&quot;nv&quot;&gt;action&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;greylist, &lt;span class=&quot;nv&quot;&gt;reason&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;new, &lt;span class=&quot;nv&quot;&gt;client_name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;mail.example.net, &lt;span class=&quot;nv&quot;&gt;client_address&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;61.4.1.30, &lt;span class=&quot;nv&quot;&gt;sender&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;testuser@example.net, &lt;span class=&quot;nv&quot;&gt;recipient&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;testuser@example.org
Apr 24 22:38:56 mail postfix/smtpd[19527]: NOQUEUE: reject: RCPT from mail.example.net[63.4.1.30]: 450 4.2.0 &amp;lt;testuser@example.org&amp;gt;: Recipient address rejected: Greylisted, see http://postgrey.schweikert.ch/help/example.org.html&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&amp;lt;testuser@example.net&amp;gt; &lt;span class=&quot;nv&quot;&gt;to&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&amp;lt;testuser@example.org&amp;gt; &lt;span class=&quot;nv&quot;&gt;proto&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;ESMTP &lt;span class=&quot;nv&quot;&gt;helo&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&amp;lt;mail.example.net&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Most mail servers will try once more after some time and will be allowed the second time they send. Spammers generally only try once so this should stop some most of the common spam you could receive. Once the mail passes through, &lt;strong&gt;Amavis&lt;/strong&gt; will check for viruses and other malware.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;Apr 24 22:48:23 mail amavis[1078]: &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;01078-02&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; Passed CLEAN &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;RelayedInbound&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;, &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;63.4.1.30]:43126 &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;63.4.1.30] &amp;lt;testuser@example.net&amp;gt; -&amp;gt; &amp;lt;testuser@example.org&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;You can also test your anti-virus using the &lt;a href=&quot;http://www.eicar.org/86-0-Intended-use.html&quot;&gt;EICAR test file&lt;/a&gt;. Send yourself an email from another mail server with &lt;strong&gt;only&lt;/strong&gt; the following string in the body:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;X5O!P%@AP[4&lt;span class=&quot;se&quot;&gt;\P&lt;/span&gt;ZX54&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;P^&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;7CC&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;7&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$EICAR&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;-STANDARD-ANTIVIRUS-TEST-FILE&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$H&lt;/span&gt;+H&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;It will be detected as a virus and you’ll see this in the log as well:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;Apr 24 23:05:25 mail postfix/qmgr[1060]: BF9D558771: &lt;span class=&quot;nv&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&amp;lt;virusalert@example.org&amp;gt;, &lt;span class=&quot;nv&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;2092, &lt;span class=&quot;nv&quot;&gt;nrcpt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;1 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;queue active&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
Apr 24 23:05:25 mail amavis[21120]: &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;21120-01&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; Blocked INFECTED &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;Eicar-Test-Signature&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;DiscardedInbound,Quarantined&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;, &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;63.4.1.30]:36539 &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;63.4.1.30] &amp;lt;testuser@example.net&amp;gt; -&amp;gt; &amp;lt;testuser@example.org&amp;gt;, quarantine: /var/lib/amavis/virusmails&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;In a similar fashion, you can test your spam filter using the &lt;a href=&quot;https://spamassassin.apache.org/gtube/&quot;&gt;GTUBE&lt;/a&gt;. Send a message from another mail server to yourself with &lt;strong&gt;only&lt;/strong&gt; the following string in the body:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;XJS&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;C4JDBQADN1.NSBN3&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;2IDNEN&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;C.34X&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;It will be detected as spam and you’ll see this in the log as well:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;Apr 24 23:13:44 mail amavis[21119]: &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;21119-01&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; Passed SPAM &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;RelayedTaggedInternal,Quarantined&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;, &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;63.4.1.30]:36539 &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;63.4.1.30] &amp;lt;testuser@example.net&amp;gt; -&amp;gt; &amp;lt;testuser@example.org&amp;gt;, quarantine: /var/lib/amavis/virusmails&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h1 id=&quot;other-considerations&quot;&gt;Other Considerations&lt;/h1&gt;

&lt;p&gt;You’ll notice in your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/var/log/maillog&lt;/code&gt; file that there will be a ton of bots and compromised third party servers trying to relay using your server, trying to log in using common usernames (admin, support, test, etc) and generally just trying to wreak havoc on your mail server. The setup suggestions I described in this article should prevent most of those attacks. You may consider trying something like &lt;a href=&quot;http://www.fail2ban.org/wiki/index.php/Main_Page&quot;&gt;fail2ban&lt;/a&gt; to automatically ban these IPs. Get yourself a nice firewall using AlienBob’s &lt;a href=&quot;http://www.slackware.com/~alien/efg/&quot;&gt;Easy Firewall Generator&lt;/a&gt; and block anything you don’t need.&lt;/p&gt;

&lt;p&gt;I tested this set up by following it step by step on a fresh server and it worked for me. I may have missed some things. &lt;a href=&quot;/contact/&quot;&gt;Contact me&lt;/a&gt; if you have any comments. Encrypted email is strongly encouraged and preferred.&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>Slackware Mail Server with MySQL, Postfix, and Dovecot</title>
   <link href="https://gerardozamudio.mx/2015/04/25/slackware-mail-server-with-mysql-postfix-and-dovecot/"/>
   <updated>2015-04-25T00:00:00-05:00</updated>
   <id>https://gerardozamudio.mx/2015/04/25/slackware-mail-server-with-mysql-postfix-and-dovecot</id>
   <content type="html">&lt;h1 id=&quot;introduction&quot;&gt;Introduction&lt;/h1&gt;

&lt;p&gt;This post contains some suggestions for a mildly secure mail server running on a &lt;a href=&quot;http://www.slackware.com/&quot;&gt;Slackware Linux&lt;/a&gt; host. The guide assumes a default, fresh installation of Slackware64 14.1 that includes at least the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;A/&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AP/&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;D/&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;L/&lt;/code&gt;, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;N/&lt;/code&gt; package series. By the end of the tutorial, you will have:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.postfix.org/&quot;&gt;Postfix&lt;/a&gt; for encrypted connections over &lt;a href=&quot;https://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol&quot;&gt;SMTP&lt;/a&gt; and removing identifying information from the email headers&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://dovecot.org/&quot;&gt;Dovecot&lt;/a&gt; for local mail directories and encrypted connections over &lt;a href=&quot;https://en.wikipedia.org/wiki/Post_Office_Protocol&quot;&gt;POP&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Internet_Message_Access_Protocol&quot;&gt;IMAP&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://mariadb.org/&quot;&gt;MariaDB&lt;/a&gt; a drop-in replacement for MySQL to store mailbox information&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://postgrey.schweikert.ch/&quot;&gt;Postgrey&lt;/a&gt; which will require unknown senders to resend their mail, eliminating most spam&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://spamassassin.apache.org/&quot;&gt;SpamAssassin&lt;/a&gt; for e-mail spam filtering based on content-matching rules&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.clamav.net/index.html&quot;&gt;ClamAV&lt;/a&gt; to detect trojans, viruses, malware and other malicious threats in your email&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.amavis.org/&quot;&gt;amavisd-new&lt;/a&gt; to manage ClamAV and SpamAssasin&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://opendkim.org/&quot;&gt;OpenDKIM&lt;/a&gt; a DomainKeys Identified Mail (DKIM) milter to sign and/or verify mail&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://nginx.org/&quot;&gt;nginx&lt;/a&gt; as a webserver (optional)&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://postfixadmin.sourceforge.net/&quot;&gt;Postfix Admin&lt;/a&gt; to manage mailboxes and domains using a &lt;a href=&quot;https://en.wikipedia.org/wiki/Transport_Layer_Security&quot;&gt;TLS&lt;/a&gt; secured web user interface (optional)&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://roundcube.net/&quot;&gt;Roundcube&lt;/a&gt; as a TLS secured webmail client (optional)&lt;/li&gt;
&lt;/ul&gt;

&lt;!--more--&gt;

&lt;p&gt;I based some of the Postfix and Dovecot configuration options on an existing &lt;a href=&quot;https://www.exratione.com/2014/05/a-mailserver-on-ubuntu-1404-postfix-dovecot-mysql/&quot;&gt;mailserver guide&lt;/a&gt; by &lt;a href=&quot;https://www.exratione.com/&quot;&gt;Reason&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;why&quot;&gt;Why?&lt;/h2&gt;

&lt;p&gt;There are a number of reasons you may want to host your own email. The &lt;a href=&quot;http://arstechnica.com/information-technology/2015/02/fear-in-the-digital-city-why-the-internet-has-never-been-more-dangerous/&quot;&gt;Internet of today is not the Internet of yesterday&lt;/a&gt;. There is a movement to &lt;a href=&quot;http://www.newyorker.com/tech/elements/the-mission-to-decentralize-the-internet&quot;&gt;decentralize the internet&lt;/a&gt; and regain control of one’s data. You &lt;a href=&quot;https://medium.com/backchannel/why-i-m-saying-goodbye-to-apple-google-and-microsoft-78af12071bd&quot;&gt;and others&lt;/a&gt; may want to distance yourself from &lt;a href=&quot;http://www.theatlantic.com/technology/archive/2012/12/bruce-sterling-on-why-it-stopped-making-sense-to-talk-about-the-internet-in-2012/266674/&quot;&gt;“the stacks”&lt;/a&gt;: the internet companies that control a large portion of it. Think of the chaos that ensues whenever &lt;a href=&quot;https://blog.cloudflare.com/todays-outage-post-mortem-82515/&quot;&gt;CloudFlare’s hardware fucks up&lt;/a&gt; and how much of the internet relies on providers like them and Akamai. Think of the companies that have presence in every aspect of your digital life. Today, you can be woken up by the alarm on your Google Nexus phone, running Google’s version of Android. You’ll check your email on Gmail and plan your day using Google Calendar on your Google Chromebook running Chrome OS, through your Google Fiber internet connection. They may even be your domain registrar. Watch your Google TV while you eat breakfast. You can put on Google Glass and get a quick bike route to work on Google Maps. Listen to Google Music while you drive. Go over your presentation and spreadsheets on Google Docs and save them on Google Drive. What if Google disappeared tomorrow? The infrastructure of the internet is &lt;a href=&quot;http://www.bbc.com/future/story/20150310-how-to-break-the-internet&quot;&gt;just as fragile&lt;/a&gt; and people want to keep control of their data.&lt;/p&gt;

&lt;p&gt;We also have &lt;a href=&quot;http://www.wired.com/2014/03/bitcoin-exchange/&quot;&gt;hackers breaking into crypto currency exchanges&lt;/a&gt; and vendors &lt;a href=&quot;http://bits.blogs.nytimes.com/2015/02/19/researcher-discovers-superfish-spyware-installed-on-lenovo-pcs/?_r=0&quot;&gt;bundling spyware&lt;/a&gt; with their PCs. Single points of failure are &lt;a href=&quot;http://www.theguardian.com/technology/2014/feb/28/seven-people-keys-worldwide-internet-security-web&quot;&gt;common&lt;/a&gt;, with the organizations in charge not even being able to trust each other:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Both the US commerce department and the Department of Homeland Security take a close interest, to differing degrees, in ICANN’s operations. In the wake of the ongoing revelations of NSA spying, and of undermined internet security, this does not sit well with many of ICANN’s overseas partners. Some, including Russia and Brazil – &lt;a href=&quot;http://www.theguardian.com/world/2013/nov/01/brazil-legislate-online-civil-rights-snowden&quot;&gt;whose president has made such demands very public&lt;/a&gt; – are calling for a complete overhaul of how the internet is run, suggesting it should be put under UN auspices.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Read Ken Thompson’s &lt;a href=&quot;http://ece.cmu.edu/~ganger/712.fall02/papers/p761-thompson.pdf&quot;&gt;Reflections on Trusting Trust&lt;/a&gt; and see why you can’t even trust your compiler. Trust is difficult. Email is &lt;a href=&quot;http://www.digitaltrends.com/mobile/can-email-ever-be-secure/&quot;&gt;horribly insecure&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;a-note-about-hosting-providers&quot;&gt;A note about hosting providers&lt;/h2&gt;

&lt;p&gt;There are a number of hosting providers that offer Slackware images, mostly based in the U.K. &lt;a href=&quot;https://www.linode.com/&quot;&gt;Linode&lt;/a&gt; offers some cheap VPS plans and is based in the US. I got the folks at &lt;a href=&quot;https://www.cloudsigma.com/&quot;&gt;CloudSigma&lt;/a&gt; to build a Slackware image which I’m sure they’ll happily provide if you ask. The guys at &lt;a href=&quot;http://linuxquestions.org/questions/slackware-14/&quot;&gt;LQ&lt;/a&gt; also &lt;a href=&quot;http://www.linuxquestions.org/questions/slackware-14/slackware-friendly-european-providers-of-dedicated-and-virtual-servers-4175524258/&quot;&gt;offer some suggestions&lt;/a&gt;. In general, you want to keep these things in mind:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Where is the company based? If it’s a publicly traded company, who is involved?&lt;/li&gt;
  &lt;li&gt;Does the company own their data centers or are they colocated?&lt;/li&gt;
  &lt;li&gt;Where are the data centers located? Does the country have strong privacy laws?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You’ll also want to pay attention to any modifications they may make to the images they provide. Linode, for example, provide their own custom kernel and have the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-current&lt;/code&gt; branch of Slackware selected in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/slackpkg/mirrors&lt;/code&gt;. They also have a very minimal system with only the absolute necessary packages necessary to run the OS installed. You’ll want to skip installing &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;glibc-zoneinfo&lt;/code&gt;. It turns out if you set the date on the server and then proceed to install that package, your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/localtime&lt;/code&gt; file will become corrupted. I notified Linode about this issue but they didn’t seem to care too much. On the CloudSigma platform watch out for a script they add to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/rc.d/rc.local&lt;/code&gt; that creates a shell user for them and checks your host keys. There may be other caveats on other providers. Make sure you check the OS thoroughly. You’ll also have to make some changes if you roll your own image. Most of the time, you will have to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;chroot&lt;/code&gt; and create an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;initrd&lt;/code&gt; right after installation, before rebooting:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nb&quot;&gt;chroot&lt;/span&gt; /mnt
/usr/share/mkinitrd/mkinitrd_command_generator.sh | sh&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;You’ll need to edit &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/lilo.conf&lt;/code&gt; and add some parameters to your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;global&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;partition&lt;/code&gt; sections. These were taken from a CloudSigma image. They should work on other KVM based cloud platforms that allow you to upload your own ISO, such as &lt;a href=&quot;https://www.vultr.com/&quot;&gt;Vultr&lt;/a&gt;:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;c&quot;&gt;# Start LILO global section
&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;lba32&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot; vt.default_utf8=0 elevator=deadline&quot;&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;boot&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;/dev/vda&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;disk&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;/dev/vda bios=0x80 max-partitions=7&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;bitmap&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;/boot/slack.bmp&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;bmp-colors&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;255,0,255,0,255,0&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;bmp-table&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;60,6,1,16&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;bmp-timer&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;65,27,0,255&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;prompt&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;timeout&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;100&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;reset&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;vga&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;normal&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# End LILO global section
# Linux bootable partition config begins
&lt;/span&gt;&lt;span class=&quot;py&quot;&gt;image&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;/boot/vmlinuz&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;initrd&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;/boot/initrd.gz&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;root&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;/dev/vda2&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;label&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Slackware64&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;read-only&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;#&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;Linux&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;bootable&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;partition&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;config&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;ends&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Adjust your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;root&lt;/code&gt; device accordingly or contact your provider for assistance. Don’t forget to run &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;lilo -C /mnt/etc/lilo.conf&lt;/code&gt; before rebooting.&lt;/p&gt;

&lt;h2 id=&quot;self-host&quot;&gt;Self host&lt;/h2&gt;

&lt;p&gt;Another option you have is setting this up in a physical server in your home. Former secretary of state Hillary Clinton certainly thought it was a &lt;a href=&quot;http://www.wired.com/2015/03/clintons-email-server-vulnerable/&quot;&gt;good idea&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;[She] used a private email account rather than her official State.gov email address while serving in the State Department. And this was no Gmail or Yahoo! Mail account: On Wednesday the AP reported that Clinton actually ran a private mail server in her home during her entire tenure leading the State Department, hosting her email at the domain Clintonemail.com.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The article questions her use of a private domain registrar and a self-signed certificate. These are real concerns and unfortunate tradeoffs that have to be made for those of us who are unable to register a .gov domain or purchase a certificate from a “trusted” authority. Some argue a self-signed certificate is more secure than one purchased from a certificate authority (only trust yourself), but if you want to get rid of those pesky browser warnings you’ll need to had over some money to a certificate authority.&lt;/p&gt;

&lt;p&gt;This setup will most likely involve some port forwarding being done on your modem or router. Preferably, you should also have a static IP.  Most ISPs don’t allow residential customers to host mail servers using their service. Contact them if you have any doubts.&lt;/p&gt;

&lt;p&gt;Now we’re ready to get started.&lt;/p&gt;

&lt;h1 id=&quot;preparation&quot;&gt;Preparation&lt;/h1&gt;

&lt;h2 id=&quot;hostname&quot;&gt;Hostname&lt;/h2&gt;

&lt;p&gt;Set up an &lt;abbr title=&quot;Fully Qualified Domain Name&quot;&gt;FQDN&lt;/abbr&gt; as your hostname. We’ll use &lt;a href=&quot;http://mail.example.org&quot;&gt;mail.example.org&lt;/a&gt;:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;mail.example.org&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; /etc/HOSTNAME 
&lt;span class=&quot;nb&quot;&gt;hostname&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-F&lt;/span&gt; /etc/HOSTNAME&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;php--nginx&quot;&gt;PHP + nginx&lt;/h2&gt;

&lt;h3 id=&quot;install-nginx&quot;&gt;Install nginx&lt;/h3&gt;

&lt;p&gt;I recently &lt;a href=&quot;https://gerardozamudio.mx/2014/09/30/new-blog/&quot;&gt;switched my site&lt;/a&gt; to nginx so I’ll be sticking with that for Postfix Admin and Roundcube. You’ll need to compile nginx with support for FastCGI and memcached to better support Roundcube so you’re probably better off using the &lt;a href=&quot;http://slackbuilds.org/repository/14.1/network/nginx/&quot;&gt;build from SlackBuilds&lt;/a&gt; than the configure options I gave in the linked post. Create your webserver user:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;useradd &lt;span class=&quot;nt&quot;&gt;-r&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-M&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-U&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;User for nginx&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; /srv/httpd &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; /bin/false nginx&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;If you choose to install from source, there is a handy modification you can make to the code before compiling. As of this writing, the most recent &lt;strong&gt;stable&lt;/strong&gt; release of nginx is &lt;a href=&quot;http://nginx.org/en/download.html&quot;&gt;1.8.0&lt;/a&gt;. Extract the source archive and change into the new directory:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nb&quot;&gt;tar&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-xvzf&lt;/span&gt; nginx-1.8.0.tar.gz
&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;nginx-1.8.0&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Next, we’ll edit two files to remove some identifying information. The first of these is the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;src/http/ngx_http_header_filter_module.c&lt;/code&gt; file in the extracted source. We are going to remove the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Server:&lt;/code&gt; string of the host. You don’t really need to advertise this especially if you’ll be the only user on the server (or just a few friends). The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Server:&lt;/code&gt; string is found in lines 49-50. You will also need to change lines 281-282:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-diff&quot; data-lang=&quot;diff&quot;&gt;&lt;span class=&quot;gd&quot;&gt;--- a/src/http/ngx_http_header_filter_module.c    2015-04-10 08:33:35.000000000 -0600
&lt;/span&gt;&lt;span class=&quot;gi&quot;&gt;+++ b/src/http/ngx_http_header_filter_module.c    2015-04-10 09:33:35.000000000 -0600
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;@@ -46,8 +46,8 @@&lt;/span&gt;
 };
 
 
&lt;span class=&quot;gd&quot;&gt;-static char ngx_http_server_string[] = &quot;Server: nginx&quot; CRLF;
-static char ngx_http_server_full_string[] = &quot;Server: &quot; NGINX_VER CRLF;
&lt;/span&gt;&lt;span class=&quot;gi&quot;&gt;+static char ngx_http_server_string[] = &quot;&quot;;
+static char ngx_http_server_full_string[] = &quot;&quot;;
&lt;/span&gt; 
 
 static ngx_str_t ngx_http_status_lines[] = {
&lt;span class=&quot;p&quot;&gt;@@ -278,8 +278,8 @@&lt;/span&gt;
     clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
 
     if (r-&amp;gt;headers_out.server == NULL) {
&lt;span class=&quot;gd&quot;&gt;- len += clcf-&amp;gt;server_tokens ? sizeof(ngx_http_server_full_string) - 1:
- sizeof(ngx_http_server_string) - 1;
&lt;/span&gt;&lt;span class=&quot;gi&quot;&gt;+ len += clcf-&amp;gt;server_tokens ? sizeof(ngx_http_server_full_string) - 0:
+ sizeof(ngx_http_server_string) - 0;
&lt;/span&gt;     }
 
     if (r-&amp;gt;headers_out.date == NULL) {&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The next edit will remove it from the auto generated error pages as well. This is done in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;src/http/ngx_http_special_response.c&lt;/code&gt; file in lines 21 and 28. In this same file you can also change the HTML for each of the server error pages such as 301, 404, etc:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-diff&quot; data-lang=&quot;diff&quot;&gt;&lt;span class=&quot;gd&quot;&gt;--- a/src/http/ngx_http_special_response.c        2015-04-10 08:33:35.000000000 -0600
&lt;/span&gt;&lt;span class=&quot;gi&quot;&gt;+++ b/src/http/ngx_http_special_response.c        2015-04-10 09:33:35.000000000 -0600
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;@@ -18,18 +18,8 @@&lt;/span&gt;
 static ngx_int_t ngx_http_send_refresh(ngx_http_request_t *r);
 
 
&lt;span class=&quot;gd&quot;&gt;-static u_char ngx_http_error_full_tail[] =
-&quot;&amp;lt;hr&amp;gt;&amp;lt;center&amp;gt;&quot; NGINX_VER &quot;&amp;lt;/center&amp;gt;&quot; CRLF
-&quot;&amp;lt;/body&amp;gt;&quot; CRLF
-&quot;&amp;lt;/html&amp;gt;&quot; CRLF
-;
-
-
-static u_char ngx_http_error_tail[] =
-&quot;&amp;lt;hr&amp;gt;&amp;lt;center&amp;gt;nginx&amp;lt;/center&amp;gt;&quot; CRLF
-&quot;&amp;lt;/body&amp;gt;&quot; CRLF
-&quot;&amp;lt;/html&amp;gt;&quot; CRLF
-;
&lt;/span&gt;&lt;span class=&quot;gi&quot;&gt;+static u_char ngx_http_error_full_tail[] = &quot;&quot; CRLF;
+static u_char ngx_http_error_tail[] = &quot;&quot; CRLF;
&lt;/span&gt; 
 
 static u_char ngx_http_msie_padding[] =&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Once you’ve made these changes, go ahead and compile. You can still use the &lt;a href=&quot;http://slackbuilds.org/repository/14.1/network/nginx/&quot;&gt;SlackBuild&lt;/a&gt; if you &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tar&lt;/code&gt; up the sources, otherwise, just &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;./configure &amp;amp;&amp;amp; make &amp;amp;&amp;amp; make install&lt;/code&gt;. You’ll want to add the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--with-http_spdy_module&lt;/code&gt; to add support for &lt;a href=&quot;http://tools.ietf.org/html/draft-mbelshe-httpbis-spdy-00&quot;&gt;SPDY&lt;/a&gt;, the starting point for &lt;a href=&quot;http://http2.github.io/&quot;&gt;HTTP 2.0&lt;/a&gt;. If you use the SlackBuild don’t forget to change the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;VERSION&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;USER&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GROUP&lt;/code&gt; variables in the script.&lt;/p&gt;

&lt;p&gt;Unfortunately there is no &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;init&lt;/code&gt; script included with the source, but you can use &lt;a href=&quot;http://slackbuilds.org/slackbuilds/14.1/network/nginx/rc.nginx&quot;&gt;rc.nginx&lt;/a&gt; from the SlackBuild. If you want to enable syntax highlighlting for the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nginx.conf&lt;/code&gt; file in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vim&lt;/code&gt;, copy the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;contrib/vim&lt;/code&gt; directory from the extracted source to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.vim&lt;/code&gt;.&lt;/p&gt;

&lt;h3 id=&quot;ssl-certificate&quot;&gt;SSL Certificate&lt;/h3&gt;

&lt;p&gt;This is a tough one. The SHA-1 hash algorithm has been “sunsetting” since back in 2014 &lt;a href=&quot;http://googleonlinesecurity.blogspot.mx/2014/09/gradually-sunsetting-sha-1.html&quot;&gt;thanks to Google&lt;/a&gt; so stay away from that, not just because Google says so but because they have &lt;a href=&quot;https://www.schneier.com/blog/archives/2005/02/cryptanalysis_o.html&quot;&gt;good reason to&lt;/a&gt;. You’ll hear everyone urging to move &lt;a href=&quot;https://blog.cloudflare.com/ecdsa-the-digital-signature-algorithm-of-a-better-internet/&quot;&gt;from RSA to ECDSA&lt;/a&gt;  but then it turns out &lt;a href=&quot;http://blog.cr.yp.to/20140323-ecdsa.html&quot;&gt;NIST curves are suspicious.&lt;/a&gt;. You can feel free to browse a list of &lt;a href=&quot;http://safecurves.cr.yp.to/&quot;&gt;Safe Curves&lt;/a&gt; but you’ll be hard pressed to find any Certificate Authority that offers any certificate using non-NIST curves. Browser vendors also tend to only support these as well. To that end, you can then refer to things like Mozilla’s &lt;a href=&quot;https://wiki.mozilla.org/Security/Server_Side_TLS#Modern_compatibility&quot;&gt;Modern Compatibility&lt;/a&gt; ciphersuite selection for your nginx SSL configuration. The linked example will require modern browsers and mobile devices like Android 4.4+ in order to work properly. Let’s say you go with a relatively strong NIST curve like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;secp384r1&lt;/code&gt; for compatibility (or the stronger &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;secp521r1&lt;/code&gt; if not). You’ll need to find a Certificate Authority that provides ECC SSL certificates such as Comodo or DigiCert. The suggested configuration below will include support for &lt;abbr title=&quot;HTTP Strict Transport Security&quot;&gt;HSTS&lt;/abbr&gt; and &lt;abbr title=&quot;Perfect Forward Secrecy&quot;&gt;PFS&lt;/abbr&gt; to completely get rid of plain HTTP access to the server. It will also provide support for SPDY.&lt;/p&gt;

&lt;h3 id=&quot;configure-nginx&quot;&gt;Configure nginx&lt;/h3&gt;

&lt;p&gt;Let’s set up some Server Blocks (VirtualHosts if you’re coming from Apache) to serve content. Your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nginx.conf&lt;/code&gt; file will need an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;events&lt;/code&gt; section which can be left blank to activate the defaults or modified depending on the load you’re expecting on the server.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-nginx&quot; data-lang=&quot;nginx&quot;&gt;&lt;span class=&quot;k&quot;&gt;events&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;http&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;kn&quot;&gt;charset&lt;/span&gt;                   &lt;span class=&quot;s&quot;&gt;utf-8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;kn&quot;&gt;default_type&lt;/span&gt;              &lt;span class=&quot;nc&quot;&gt;application/octet-stream&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;kn&quot;&gt;ignore_invalid_headers&lt;/span&gt;    &lt;span class=&quot;no&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;kn&quot;&gt;include&lt;/span&gt;                   &lt;span class=&quot;n&quot;&gt;/etc/nginx/mime.types&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;kn&quot;&gt;server_tokens&lt;/span&gt;             &lt;span class=&quot;no&quot;&gt;off&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;kn&quot;&gt;server_name_in_redirect&lt;/span&gt;   &lt;span class=&quot;no&quot;&gt;off&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;kn&quot;&gt;source_charset&lt;/span&gt;            &lt;span class=&quot;s&quot;&gt;utf-8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;kn&quot;&gt;ssl_ciphers&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;kn&quot;&gt;ssl_ecdh_curve&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;secp384r1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;kn&quot;&gt;ssl_prefer_server_ciphers&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;kn&quot;&gt;ssl_protocols&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;TLSv1.2&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;TLSv1.1&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;TLSv1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	
	&lt;span class=&quot;kn&quot;&gt;server&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;kn&quot;&gt;access_log&lt;/span&gt;  &lt;span class=&quot;n&quot;&gt;/var/log/nginx/access.log&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;main&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;buffer=32k&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;kn&quot;&gt;error_log&lt;/span&gt;   &lt;span class=&quot;n&quot;&gt;/var/log/nginx/error.log&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;kn&quot;&gt;listen&lt;/span&gt;      &lt;span class=&quot;mi&quot;&gt;80&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;kn&quot;&gt;server_name&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mail.example.org&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;kn&quot;&gt;root&lt;/span&gt;        &lt;span class=&quot;n&quot;&gt;/var/empty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;kn&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;301&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;https://mail.example.org&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$uri&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

	&lt;span class=&quot;kn&quot;&gt;server&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;kn&quot;&gt;add_header&lt;/span&gt;  &lt;span class=&quot;s&quot;&gt;Strict-Transport-Security&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;max-age=315360000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;includeSubdomains&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;preload&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;kn&quot;&gt;access_log&lt;/span&gt;  &lt;span class=&quot;n&quot;&gt;/var/log/nginx/access.log&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;kn&quot;&gt;error_log&lt;/span&gt;   &lt;span class=&quot;n&quot;&gt;/var/log/nginx/error.log&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;info&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;kn&quot;&gt;index&lt;/span&gt;       &lt;span class=&quot;s&quot;&gt;index.php&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;kn&quot;&gt;listen&lt;/span&gt;      &lt;span class=&quot;mi&quot;&gt;443&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;ssl&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;spdy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;kn&quot;&gt;root&lt;/span&gt;        &lt;span class=&quot;n&quot;&gt;/var/www/html/mail.example.org&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;kn&quot;&gt;server_name&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mail.example.org&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

		&lt;span class=&quot;kn&quot;&gt;ssl&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;kn&quot;&gt;ssl_session_cache&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;shared:SSL:1m&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;kn&quot;&gt;ssl_certificate&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/ssl_keys/crt/mail.example.org.crt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;kn&quot;&gt;ssl_certificate_key&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/ssl_keys/key/mail.example.org.key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
		
	&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;You will notice I am only allowing TLS and disabling SSL. I used &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/var/www/html/mail.example.org&lt;/code&gt; as the site’s &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;root&lt;/code&gt; for easier management, but you can use whatever you feel comfortable with. Make sure that whatever directory structure you choose allows the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nginx&lt;/code&gt; user and group to write to it.&lt;/p&gt;

&lt;h3 id=&quot;configure-php&quot;&gt;Configure PHP&lt;/h3&gt;

&lt;p&gt;Slackware’s default PHP installation is already compiled with support for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GD&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;curl&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mcrypt&lt;/code&gt;, and XML parsing. As mentioned before, you’ll probably want to install some extensions to increase performance. I’m going with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;memcached&lt;/code&gt;, which you can also obtain from &lt;a href=&quot;http://slackbuilds.org/repository/14.1/network/memcached/&quot;&gt;SlackBuilds&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you choose to install &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;memcached&lt;/code&gt;, don’t forget to install the PHP extension as well. You can grab the older &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;memcache&lt;/code&gt; extension from &lt;a href=&quot;http://slackbuilds.org/repository/14.1/libraries/php-memcache/&quot;&gt;SlackBuilds&lt;/a&gt;, but it’s probably easier to install the newer (confusingly named) &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;memcached&lt;/code&gt; extension through &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PECL&lt;/code&gt;:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;pecl &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;memcached&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This will require that you have &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;libmemcached&lt;/code&gt; (&lt;a href=&quot;http://slackbuilds.org/repository/14.1/libraries/libmemcached/&quot;&gt;SlackBuild&lt;/a&gt;) installed. Remember to add &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;extension=memcached.so&lt;/code&gt; to your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;php.ini&lt;/code&gt; file or simply create a new &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/php/memcached.ini&lt;/code&gt; file with that content. You’ll also want to change the user &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;memcached&lt;/code&gt; runs as in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/rc.d/rc.memcached&lt;/code&gt; init script to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nginx&lt;/code&gt; if you went the SlackBuilds route. I also recommend giving it its own run directory, assigning it to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nginx&lt;/code&gt; user and group, and modifying the value of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PID&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/var/run/memcached/memcached.pid&lt;/code&gt; in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/rc.d/rc.memcached&lt;/code&gt;. In addition, add &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-s /var/run/memcached/memcached.sock&lt;/code&gt; to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;memcached_start()&lt;/code&gt; function in the same file to use a socket instead of TCP:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nb&quot;&gt;mkdir&lt;/span&gt; /var/run/memcached
&lt;span class=&quot;nb&quot;&gt;chown &lt;/span&gt;nginx:nginx /var/run/memcached&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;While we’re changing permissions, you’ll also need to change the permissions of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/var/lib/php&lt;/code&gt; since we’re using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nginx&lt;/code&gt; instead of Apache to run PHP:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nb&quot;&gt;chown &lt;/span&gt;root:nginx /var/lib/php/&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Note that in order to make proper use of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GD&lt;/code&gt;, you’ll need some &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;X11&lt;/code&gt; libraries. These are most likely not installed if you’re working on a headless server. Get the needed dependencies from a Slackware mirror:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;slackpkg &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;libX11 libXpm libxcb libXau libXdmcp&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;php-fpm-with-fastcgi-in-nginx&quot;&gt;PHP-FPM with FastCGI in nginx&lt;/h3&gt;

&lt;p&gt;The default Slackware install includes PHP-FPM so you’ll need to make sure the startup script is executable. Start PHP-FPM at least once to let it create its default configuration files:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nb&quot;&gt;chmod&lt;/span&gt; +x /etc/rc.d/rc.php-fpm
/etc/rc.d/rc.php-fpm start
/etc/rc.d/rc.php-fpm stop&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;We’ll be making some changes to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;www&lt;/code&gt; pool in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/php-fpm/php-fpm.conf&lt;/code&gt;. First, change the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;user&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;group&lt;/code&gt; lines to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nginx&lt;/code&gt;, with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;listen mode&lt;/code&gt; set to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;0666&lt;/code&gt;. We’re going to be using Unix sockets throughout this guide so change &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;listen&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/var/run/php-fpm.sock&lt;/code&gt; . We also need to add &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.htm&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.html&lt;/code&gt; files to the scripts FPM will allow to pass. The relevant lines should look like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;nn&quot;&gt;[www]&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;user&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;nginx&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;group&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;nginx&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;listen&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;/var/run/php-fpm.sock&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;listen.owner&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;nginx&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;listen.group&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;nginx&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;listen.mode&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;0666&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;security.limit_extensions&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;.php .php3 .php4 .php5 .html .htm&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;We’ll need to add a new &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;location&lt;/code&gt; block inside the HTTPS &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;server&lt;/code&gt; block in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/nginx/nginx.conf&lt;/code&gt; telling it to use the FastCGI server we set up previously for PHP files:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-nginx&quot; data-lang=&quot;nginx&quot;&gt;&lt;span class=&quot;k&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;^(.+?\.php)(/.*)?$&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;fastcgi_param&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;HTTPS&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;try_files&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$uri&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;404&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;fastcgi_split_path_info&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;^(.+&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;.php)(/.+)&lt;/span&gt;$&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;fastcgi_pass&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;unix:/var/run/php-fpm.sock&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;fastcgi_param&lt;/span&gt;   &lt;span class=&quot;s&quot;&gt;SCRIPT_FILENAME&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$document_root$fastcgi_script_name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;fastcgi_index&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;index.php&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;include&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;fastcgi_params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;fastcgi_buffer_size&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;128k&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;fastcgi_buffers&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;256&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4k&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;fastcgi_busy_buffers_size&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;256k&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;fastcgi_temp_file_write_size&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;256k&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Feel free to adjust those values to your needs. Pay attention to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;fastcgi_pass&lt;/code&gt;, which connects to the Unix socket.&lt;/p&gt;

&lt;h1 id=&quot;dovecot&quot;&gt;Dovecot&lt;/h1&gt;

&lt;p&gt;We are going to be using Dovecot to handle secure IMAP and POP3 connections and for SMTP authentication. Postfix Admin will store the user information in this setup instead of creating a Unix account for each one. The email will be stored in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/var/vmail&lt;/code&gt; organized by domain and user, so the email for &lt;a href=&quot;mailto:admin@example.org&quot;&gt;admin@example.org&lt;/a&gt; would be stored in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/var/vmail/example.org/admin&lt;/code&gt;. We’ll create a single user to own the mailboxes on the system and let Dovecot manage them. Dovecot will also need its own user and group:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;useradd &lt;span class=&quot;nt&quot;&gt;-r&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; /var/vmail &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; /bin/false &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; 150 &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; 12 vmail
&lt;span class=&quot;nb&quot;&gt;mkdir&lt;/span&gt; /var/vmail
&lt;span class=&quot;nb&quot;&gt;chmod &lt;/span&gt;770 /var/vmail
&lt;span class=&quot;nb&quot;&gt;chown &lt;/span&gt;vmail:mail /var/vmail
groupadd &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; 202 dovecot
useradd &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; /dev/null &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; /bin/false &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; 202 &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; 202 dovecot
groupadd &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; 248 dovenull
useradd &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; /dev/null &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; /bin/false &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; 248 &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; 248 dovenull&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Make sure the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GIDs&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UIDs&lt;/code&gt; used above do not interfere with any of your current users and groups. You can compile Dovecot &lt;a href=&quot;http://dovecot.org/download.html&quot;&gt;from source&lt;/a&gt; with a simple &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;./configure &amp;amp;&amp;amp; make &amp;amp;&amp;amp; make install&lt;/code&gt; or grab the &lt;a href=&quot;http://slackbuilds.org/repository/14.1/network/dovecot/&quot;&gt;SlackBuild&lt;/a&gt;. Edit the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;VERSION&lt;/code&gt; variable in the SlackBuild to build the latest version, which is 2.2.16 as of this writing. If you build from source on your own, make sure you compile with the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--with-mysql&lt;/code&gt; flag to enable MariaDB support. You are also responsible for creating an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;init&lt;/code&gt; script to manage the service. There is one provided in the source in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;doc/dovecot-initd.sh&lt;/code&gt; which should work with Slackware after some minor adjustments. You can also use Alan Hick’s &lt;a href=&quot;http://slackbuilds.org/slackbuilds/14.1/network/dovecot/rc.dovecot&quot;&gt;simplied version from the SlackBuild&lt;/a&gt; if you like. Make sure it’s executable as well.&lt;/p&gt;

&lt;p&gt;Once you have Dovecot installed, copy over the example configuration files from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/usr/doc/dovecot-2.2.16/example-config&lt;/code&gt; into &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/dovecot&lt;/code&gt; and change its permissions while you’re there:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nb&quot;&gt;cp&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-r&lt;/span&gt; /usr/doc/dovecot-2.2.16/example-config/&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; /etc/dovecot/
&lt;span class=&quot;nb&quot;&gt;chown&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-R&lt;/span&gt; vmail:dovecot /etc/dovecot
&lt;span class=&quot;nb&quot;&gt;chmod&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-R&lt;/span&gt; o-rw /etc/dovecot&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;We are going to set up the database connection between Dovecot and MariaDB in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/dovecot/dovecot-sql.conf.ext&lt;/code&gt; file. Edit that file and make sure you set the following options:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;py&quot;&gt;driver&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mysql&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;connect&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;host=/var/run/mysql/mysql.sock dbname=mail user=mail password=password-here&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;default_pass_scheme&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;SHA512-CRYPT&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;You will also need to add two queries, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;password_query&lt;/code&gt; to retrieve passwords and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;user_query&lt;/code&gt; to get user information. This information will be obtained from the schema Postfix Admin will create. If you didn’t want to install the Postfix Admin web interface, you can still use it to generate schema for you so you can add users manually and still have Dovecot find them. Of course if you’re good with databases you can make up your own and tell Dovecot here how to find your users. See Dovecot’s &lt;a href=&quot;http://wiki2.dovecot.org/AuthDatabase/SQL&quot;&gt;SQL&lt;/a&gt; documentation for more. Either way, here’s what you need to add for Postfix Admin:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sql&quot; data-lang=&quot;sql&quot;&gt;	
&lt;span class=&quot;n&quot;&gt;password_query&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;username&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'/var/vmail/%d/%n'&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;userdb_home&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'maildir:/var/vmail/%d/%n'&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;userdb_mail&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;mi&quot;&gt;150&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;userdb_uid&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;12&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;userdb_gid&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;mailbox&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;WHERE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;username&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'%u'&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;AND&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;active&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'1'&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;user_query&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'/var/vmail/%d/%n'&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;home&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'maildir:/var/vmail/%d/%n'&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;mail&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;150&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;AS&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;uid&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;12&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;AS&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;gid&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;concat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'dirsize:storage='&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;quota&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;AS&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;quota&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;mailbox&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;WHERE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;username&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'%u'&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;AND&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;active&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'1'&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The next file to edit is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/dovecot/conf.d/10-auth.conf&lt;/code&gt;. We will enable the SQL configuration file we just modified and disable plaintext authentication unless it’s already encrypted through TLS. We’ll also disable the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;auth-system.conf.ext&lt;/code&gt; file that’s loaded by default. Don’t worry about authenticating with plain text; your connection will be secured with TLS so this is safe:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;	
&lt;span class=&quot;py&quot;&gt;disable_plaintext_auth&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;yes&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;auth_mechanisms&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;plain login&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;#!include auth-system.conf.ext
&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;!include&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;auth-sql.conf.ext&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Now we’re going to tell Dovecot where the email is stored in the filesystem. Change the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UID&lt;/code&gt; in the following lines in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/dovecot/conf.d/10-mail.conf&lt;/code&gt; to whatever you set it to when you created the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vmail&lt;/code&gt; user:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;	
&lt;span class=&quot;py&quot;&gt;mail_location&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;maildir:/var/vmail/%d/%n&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;mail_uid&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;vmail&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;mail_gid&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mail&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;first_valid_uid&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;150&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;last_valid_uid&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;150&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;You need to edit &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/dovecot/conf.d/10-ssl.conf&lt;/code&gt; and set the path to the SSL certificate you obtained earlier for nginx. We are going to disable SSLv3 as we did with the web server. We can use the same SSL ciphers here&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;py&quot;&gt;ssl&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;yes&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;ssl_cert&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;lt;/ssl_keys/crt/mail.example.org.crt&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;ssl_key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;lt;/ssl_keys/key/mail.example.org.key&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;ssl_protocols&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;!SSLv2 !SSLv3&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;ssl_cipher_list&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;  &lt;span class=&quot;s&quot;&gt;ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;ssl_prefer_server_ciphers&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;yes&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Dovecot needs to know how to authenticate to the userdb so uncomment the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;user&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;group&lt;/code&gt;, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mode&lt;/code&gt; lines in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;unix_listener auth-userdb&lt;/code&gt; section of the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;service auth&lt;/code&gt; block in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/dovecot/conf.d/10-master.conf&lt;/code&gt;. You also need to set up a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;unix listener&lt;/code&gt; for Postfix. Uncomment that section as well and add &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;postfix&lt;/code&gt; as the user and group. We’ll create those later when we’re setting up Postfix.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;service auth &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
  unix_listener auth-userdb &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    mode &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; 0666
    user &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; vmail 
    group &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; mail
  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

  unix_listener /var/spool/postfix/private/auth &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    mode &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; 0666
    user &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; postfix
    group &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; postfix
  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h1 id=&quot;postfix&quot;&gt;Postfix&lt;/h1&gt;

&lt;p&gt;Installing Postfix is simple if you use Alan Hick’s excellent &lt;a href=&quot;http://slackbuilds.org/repository/14.1/network/postfix/&quot;&gt;SlackBuild script&lt;/a&gt;. Set the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DATABASE&lt;/code&gt; variable to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mysql&lt;/code&gt; before running the script to enable MariaDB support. You have the option, of course, to compile from source yourself. In that case you will need to pay attention to the Postfix configuration parameters outlined in section 4.6.2 of the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;INSTALL&lt;/code&gt; file in &lt;a href=&quot;http://www.postfix.org/INSTALL.html#4&quot;&gt;Postfix’s official documentation &lt;/a&gt;. Whichever you choose, you will need to create a user and group for Postfix. Wietse suggests in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;INSTALL&lt;/code&gt; file to create a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;postfix&lt;/code&gt; user with no login shell or home directory and a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;postdrop&lt;/code&gt; group with a group ID that is not used by any other account, even the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;postfix&lt;/code&gt; user. The SlackBuild script has the following, which is what I went with:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;groupadd &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; 200 postfix
groupadd &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; 201 postdrop
useradd &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; 200 &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; /dev/null &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; /bin/false &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; postfix postfix&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;You’re also going to need a startup script. Alan’s &lt;a href=&quot;http://slackbuilds.org/slackbuilds/14.1/network/postfix/rc.postfix&quot;&gt;rc.postfix&lt;/a&gt; script is good enough. We’re going to need the following configuration files to tell Postfix how to find your users in the database. These are lifted straight from Reason’s guide. Note in our setup, we’re using Unix sockets so that has been changed to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;localhost&lt;/code&gt;. This will cause Postfix to connect to the &lt;a href=&quot;http://www.postfix.org/mysql_table.5.html&quot;&gt;default domain socket&lt;/a&gt;. The username and password used here are the same we’ll use when we set up Postfix Admin.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/postfix/mysql_virtual_alias_domainaliases_maps.cf&lt;/code&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;py&quot;&gt;user&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mail&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;password&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mailpassword&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;hosts&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;localhost&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;dbname&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mail&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;query&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;SELECT goto FROM alias,alias_domain&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;WHERE&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;alias_domain.alias_domain&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'%d'&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;AND&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;alias.address&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;concat('%u', '@', alias_domain.target_domain)&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;AND&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;alias.active&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;1&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/postfix/mysql_virtual_alias_maps.cf&lt;/code&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;py&quot;&gt;user&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mail&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;password&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mailpassword&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;hosts&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;localhost&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;dbname&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mail&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;table&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;alias&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;select_field&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;goto&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;where_field&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;address&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;additional_conditions&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;and active = '1'&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/postfix/mysql_virtual_domains_maps.cf&lt;/code&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;py&quot;&gt;user&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mail&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;password&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mailpassword&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;hosts&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;localhost&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;dbname&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mail&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;table&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;domain&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;select_field&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;domain&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;where_field&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;domain&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;additional_conditions&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;and backupmx = '0' and active = '1'&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/postfix/mysql_virtual_mailbox_domainaliases_maps.cf&lt;/code&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;py&quot;&gt;user&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mail&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;password&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mailpassword&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;hosts&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;localhost&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;dbname&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mail&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;query&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;SELECT maildir FROM mailbox, alias_domain&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;WHERE&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;alias_domain.alias_domain&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'%d'&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;AND&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;mailbox.username&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;concat('%u', '@', alias_domain.target_domain )&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;AND&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;mailbox.active&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;1&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/postfix/mysql_virtual_mailbox_maps.cf&lt;/code&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;py&quot;&gt;user&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mail&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;password&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mailpassword&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;hosts&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;localhost&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;dbname&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mail&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;table&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mailbox&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;select_field&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;CONCAT(domain, '/', local_part)&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;where_field&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;username&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;additional_conditions&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;and active = '1'&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;We’re going to strip the email client and IP address of each mail you send. Remember this is just &lt;a href=&quot;https://en.wikipedia.org/wiki/Security_through_obscurity&quot;&gt;security through obscurity&lt;/a&gt; and you’ll be violating &lt;a href=&quot;https://tools.ietf.org/html/rfc2045&quot;&gt;RFC 2045&lt;/a&gt; if you remove the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MIME-Version string&lt;/code&gt;. It’s still useful to prevent uninitiated recipients from figuring out where you are sending your mail from. Add these to the file &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/postfix/header_checks&lt;/code&gt; for now. We’ll enable it in the Postfix configuration later.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;	
/^Received:/                 IGNORE
/^User-Agent:/               IGNORE
/^X-Mailer:/                 IGNORE
/^X-Enigmail:/               IGNORE
/^X-Originating-IP:/         IGNORE
/^x-cr-[a-z]&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;:/              IGNORE
/^Thread-Index:/             IGNORE
/^&lt;span class=&quot;se&quot;&gt;\s&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;Mime-Version: 1.0.&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;/    REPLACE Mime-Version: 1.0&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;postfix-main-configuration&quot;&gt;Postfix Main Configuration&lt;/h2&gt;

&lt;p&gt;There are way too many &lt;a href=&quot;http://www.postfix.org/postconf.5.html&quot;&gt;Postfix configuration options&lt;/a&gt; to be able to go through them all here. The default configuration file at &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/postfix/main.cf&lt;/code&gt; should have some good defaults which you can make minor adjustments to. We are specifically adding &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;header_checks&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mime_header_checks&lt;/code&gt; to enable the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/postfix/header_checks&lt;/code&gt; file we created earlier.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;py&quot;&gt;myhostname&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mail.example.org&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;myorigin&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;/etc/hostname&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;inet_interfaces&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;all&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;mynetworks&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;127.0.0.0/24 [::ffff:127.0.0.0]/104 [::1]/128&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;alias_maps&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;hash:/etc/aliases&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;alias_database&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;hash:/etc/aliases&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;header_checks&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;regexp:/etc/postfix/header_checks&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;mime_header_checks&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;regexp:/etc/postfix/header_checks&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_banner&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;$myhostname ESMTP $mail_name&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;biff&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;no&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;append_dot_mydomain&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;no&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The next section is to use Dovecot for authentication. You’ll need to add these&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;py&quot;&gt;smtpd_sasl_type&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;dovecot&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_sasl_path&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;private/auth&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_sasl_auth_enable&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;yes&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;broken_sasl_auth_clients&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;no&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_sasl_security_options&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;noanonymous&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_sasl_local_domain&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_sasl_authenticated_header&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;yes&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;We’ll set up TLS next. We’re disabling the use of any SSL versions. The last two options are to force incoming and outgoing SMTP connections to use TLS. This may have some unwanted consquences. If a mail server you are trying to reach does not support this, you will not be able to communicate with it. You can change these options to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;may&lt;/code&gt; instead of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;encrypt&lt;/code&gt; to enable TLS but not enforce it. Check your logs frequently and if you see any incoming connections without TLS, you can suggest that server’s admin to enable this feature.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;py&quot;&gt;smtpd_tls_cert_file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;/ssl_keys/crt/mail.example.org.crt&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_tls_key_file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;/ssl_keys/key/mail.example.org.key&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_tls_mandatory_protocols&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;!SSLv2,!SSLv3&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtp_tls_note_starttls_offer&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;yes&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_tls_loglevel&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_tls_received_header&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;yes&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_tls_session_cache_timeout&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;3600s&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;tls_random_source&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;dev:/dev/urandom&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_tls_security_level&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;encrypt&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtp_tls_security_level&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;encrypt&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The SMTP parameters are below. You can tweak these to your tastes. These have to do with the amount of times server connections are retried if failed, how long you want to keep mail in your queue (in case the remote server is not reachable for some time), recipient limits, and so on.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;py&quot;&gt;delay_warning_time&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;4h&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;maximal_queue_lifetime&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;4d&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;minimal_backoff_time&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;1000s&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;maximal_backoff_time&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;8000s&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtp_helo_timeout&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;60s&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_recipient_limit&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;16&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_soft_error_limit&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;3&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_hard_error_limit&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;12&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;We need to add some restrictions regarding who can send and receive mail on this server. This also allows for checks against various &lt;a href=&quot;https://en.wikipedia.org/wiki/DNSBL&quot;&gt;DNSBLs&lt;/a&gt; to block spam. We’ll also need &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;check_policy_service&lt;/code&gt; for Postgrey later on and we’ll set up the milters to use OpenDKIM. Use Unix sockets here.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;py&quot;&gt;smtpd_helo_restrictions&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;permit_mynetworks, warn_if_reject reject_non_fqdn_hostname, reject_invalid_hostname, permit&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_sender_restrictions&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;permit_sasl_authenticated, permit_mynetworks, warn_if_reject reject_non_fqdn_sender, reject_unknown_sender_domain, reject_unauth_pipelining, permit&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_client_restrictions&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;reject_rbl_client sbl.spamhaus.org, reject_rbl_client blackholes.easynet.nl, reject_rbl_client b.barracudacentral.org&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_recipient_restrictions&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;reject_unauth_pipelining, permit_mynetworks, permit_sasl_authenticated, reject_non_fqdn_recipient, reject_unknown_recipient_domain, reject_unauth_destination, check_policy_service unix:/var/run/postgrey/postgrey.sock, permit&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_data_restrictions&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;reject_unauth_pipelining&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_relay_restrictions&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;reject_unauth_pipelining, permit_mynetworks, permit_sasl_authenticated, reject_non_fqdn_recipient, reject_unknown_recipient_domain, reject_unauth_destination, check_policy_service unix:/var/run/postgrey/postgrey.sock, permit&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_helo_required&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;yes&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_delay_reject&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;yes&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;disable_vrfy_command&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;yes&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;mailbox_size_limit&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;0&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;recipient_delimiter&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;+&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;non_smtpd_milters&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;unix:/var/run/opendkim/opendkim.sock&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;smtpd_milters&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;unix:/var/run/opendkim/opendkim.sock&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The next section will use the MySQL configuration files we set up earlier and tell Postfix were the mail folders are located. Pay attention to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UID&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GID&lt;/code&gt; used.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;py&quot;&gt;virtual_mailbox_base&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;/var/vmail&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;virtual_mailbox_maps&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf, mysql:/etc/postfix/mysql_virtual_mailbox_domainaliases_maps.cf&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;virtual_uid_maps&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;static:150&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;virtual_gid_maps&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;static:12&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;virtual_alias_maps&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mysql:/etc/postfix/mysql_virtual_alias_maps.cf, mysql:/etc/postfix/mysql_virtual_alias_domainaliases_maps.cf&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;virtual_mailbox_domains&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mysql:/etc/postfix/mysql_virtual_domains_maps.cf&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Finally, we’re going to integrate Postfix with Amavis and Dovecot.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;py&quot;&gt;virtual_transport&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;dovecot&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;dovecot_destination_recipient_limit&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;content_filter&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;amavis-forward:unix:amavis/amavisd.sock&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;postfix-master-configuration&quot;&gt;Postfix Master Configuration&lt;/h2&gt;

&lt;p&gt;That should take care of the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/postfix/main.cf&lt;/code&gt; file. Now let’s edit &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/postfix/master.cf&lt;/code&gt;. Check the file out before editing to get a feel for the format and read the comments describing what the options do. Some of them you can edit and others you’ll have to add. First we’ll set up SMTP with TLS on port 587 and SMTPS on port 465&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;submission inet n       -       -       -       -       smtpd
  &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;syslog_name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;postfix/submission
  &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;smtpd_tls_security_level&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;encrypt
  &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;smtpd_sasl_auth_enable&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;yes&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;smtpd_enforce_tls&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;yes&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;smtpd_client_restrictions&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;permit_sasl_authenticated,reject_unauth_destination,reject
  &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;smtpd_sasl_tls_security_options&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;noanonymous
smtps     inet  n       -       -       -       -       smtpd
  &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;syslog_name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;postfix/smtps
  &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;smtpd_tls_wrappermode&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;yes&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;smtpd_sasl_auth_enable&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;yes&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;smtpd_tls_auth_only&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;yes&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;smtpd_client_restrictions&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;permit_sasl_authenticated,reject_unauth_destination,reject
  &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;smtpd_sasl_security_options&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;noanonymous,noplaintext
  &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;smtpd_sasl_tls_security_options&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;noanonymous&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;We’ll set up Amavis integration. Note the number 4 in the first line. This is the number of processes Amavis is allowed to run. Incrase this if you need more.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;amavis-forward      unix    -       -       -       -       4       lmtp
  &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;lmtp_data_done_timeout&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;1200
  &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;lmtp_send_xforward_command&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;yes&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;disable_dns_lookups&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;yes&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;max_use&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;20
amavis/amavis-accept unix    n       -       -       -       -       smtpd
  &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;content_filter&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;local_recipient_maps&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;relay_recipient_maps&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;cleanup_service_name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;cleanup
  &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;smtpd_restriction_classes&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;smtpd_delay_reject&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;no
  &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;smtpd_client_restrictions&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;permit_mynetworks,reject
  &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;smtpd_helo_restrictions&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;smtpd_sender_restrictions&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;smtpd_recipient_restrictions&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;permit_mynetworks,reject
  &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;smtpd_data_restrictions&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;reject_unauth_pipelining
  &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;smtpd_end_of_data_restrictions&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;mynetworks&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;127.0.0.0/8
  &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;smtpd_error_sleep_time&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0
  &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;smtpd_soft_error_limit&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;1001
  &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;smtpd_hard_error_limit&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;1000
  &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;smtpd_client_connection_count_limit&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0
  &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;smtpd_client_connection_rate_limit&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0
  &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;receive_override_options&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;no_header_body_checks,no_unknown_recipient_checks&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Uncomment the other external delivery methods if you need them. Let’s not forget to set up the Dovecot for local delivery&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;dovecot      unix   -        n      n       -       -   pipe
  &lt;span class=&quot;nv&quot;&gt;flags&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;DRhu &lt;span class=&quot;nv&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;vmail:mail &lt;span class=&quot;nv&quot;&gt;argv&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/usr/libexec/dovecot/dovecot-lda &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; &lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;recipient&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h1 id=&quot;mariadb-and-postfix-admin&quot;&gt;MariaDB and Postfix Admin&lt;/h1&gt;

&lt;h2 id=&quot;a-note-about-web-based-interfaces&quot;&gt;A note about web based interfaces&lt;/h2&gt;

&lt;p&gt;Installing a web based user interface for any of these services is entirely optional. This makes some tasks easier, such as adding a new domain and mailbox to your Postfix database. A web based email client can be beneficial if you are in an unfamiliar environment and only have access to a browser. However, you are increasing the attack vectors to your server. Web based control panels have long been a favorite gateway for script kiddies to gain unauthorized access to servers due to their popularity. You can protect yourself against common attacks (bots looking for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/roundcube&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;install.php&lt;/code&gt;, etc) by renaming the directory where the website files reside so they’re no longer accessible or changing the permissions. You can restrict access only to your home IP using your server’s firewall or through some file access rules in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nginx.conf&lt;/code&gt;. You can also simply not install them at all and work through the command line. For the sake of completeness, this guide will assume you want them.&lt;/p&gt;

&lt;h2 id=&quot;mariadb-initial-setup&quot;&gt;MariaDB Initial Setup&lt;/h2&gt;

&lt;p&gt;Slackware officially &lt;a href=&quot;http://linux.slashdot.org/story/13/03/24/1625240/longest-running-linux-distribution-slackware-adopts-mariadb&quot;&gt;switched to MariaDB&lt;/a&gt; starting with 14.1 but the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;init&lt;/code&gt; scripts are still named &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rc.mysqld&lt;/code&gt;. It should be included in a default Slackware install as part of the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AP/&lt;/code&gt; series, but if you don’t have it just type &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;slackpkg install mysql&lt;/code&gt; as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;root&lt;/code&gt;. Make sure the program starts at boot:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nb&quot;&gt;chmod&lt;/span&gt; +x /etc/rc.d/rc.mysqld&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Now we need to perform the first time setup:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;/usr/bin/mysql_install_db &lt;span class=&quot;nt&quot;&gt;--user&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;mysql&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Start MariaDB then perform the secure installation. Make sure to set up a secure password for MariaDB’s root user.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;/etc/rc.d/rc.mysqld start
/usr/bin/mysql_secure_installation&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Once that’s set up, log in as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;root&lt;/code&gt; using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mysql -u root -p&lt;/code&gt; and create the user and database that we’ll use for Postfix Admin. Choose a secure password here.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sql&quot; data-lang=&quot;sql&quot;&gt;&lt;span class=&quot;k&quot;&gt;CREATE&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;DATABASE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;mail&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;GRANT&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;ALL&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;PRIVILEGES&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;ON&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;mail&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;TO&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;&quot;mail&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;&quot;localhost&quot;&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;\&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;IDENTIFIED&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;BY&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;&quot;password-here&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;FLUSH&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;PRIVILEGES&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;postfix-admin&quot;&gt;Postfix Admin&lt;/h2&gt;

&lt;p&gt;This one is a breeze to set up. You can create a new &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;server&lt;/code&gt; block in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nginx.conf&lt;/code&gt; to set it up as a subdomain, but I chose to install it as a subdirectory. Change into your main site’s &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;root&lt;/code&gt; and download the latest Postfix Admin tarball. As of this writing, that’s &lt;a href=&quot;http://sourceforge.net/projects/postfixadmin/files/postfixadmin/&quot;&gt;2.92&lt;/a&gt;:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; /var/www/html/mail.example.org/
wget http://softlayer-dal.dl.sourceforge.net/project/postfixadmin/postfixadmin/postfixadmin-2.92/postfixadmin-2.92.tar.gz
&lt;span class=&quot;nb&quot;&gt;tar&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-xzf&lt;/span&gt; postfixadmin-2.92.tar.gz 
&lt;span class=&quot;nb&quot;&gt;mv &lt;/span&gt;postfixadmin-2.92 postfixadmin     
&lt;span class=&quot;nb&quot;&gt;chown&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-R&lt;/span&gt; nginx:nginx postfixadmin
&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;postfixadmin&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;You can modify &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;config.inc.php&lt;/code&gt;, but I recommend you create a new &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;config.local.php&lt;/code&gt; and place your settings there. This has the advantage that whatever you don’t explicitly set is left at the default value in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;config.inc.php&lt;/code&gt; and whatever you change takes precedence. This way your changes won’t be overwritten if you decide to upgrade Postfix Admin. Now we’re going to add some lines to tell Postfix Admin how to connect to MariaDB. We are also going to set &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;configured&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;true&lt;/code&gt; and tell it how to store its data. The passwords will be stored using &lt;a href=&quot;http://wiki2.dovecot.org/Authentication/PasswordSchemes&quot;&gt;Dovecot’s crypt scheme&lt;/a&gt;:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;err&quot;&gt;$CONF&lt;/span&gt;&lt;span class=&quot;nn&quot;&gt;['configured']&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;;
&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;$CONF&lt;/span&gt;&lt;span class=&quot;nn&quot;&gt;['database_type']&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;'mysql'&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;;
&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;$CONF&lt;/span&gt;&lt;span class=&quot;nn&quot;&gt;['database_host']&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;'localhost:/var/run/mysql/mysql.sock'&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;;
&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;$CONF&lt;/span&gt;&lt;span class=&quot;nn&quot;&gt;['database_user']&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;'mail'&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;;
&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;$CONF&lt;/span&gt;&lt;span class=&quot;nn&quot;&gt;['database_password']&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;'password-here'&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;;
&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;$CONF&lt;/span&gt;&lt;span class=&quot;nn&quot;&gt;['database_name']&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;'mail'&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;;
&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;$CONF&lt;/span&gt;&lt;span class=&quot;nn&quot;&gt;['domain_path']&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;'NO'&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;;
&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;$CONF&lt;/span&gt;&lt;span class=&quot;nn&quot;&gt;['domain_in_mailbox']&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;'YES'&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;;
&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;$CONF&lt;/span&gt;&lt;span class=&quot;nn&quot;&gt;['encrypt']&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;'dovecot:SHA512-CRYPT'&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;;
&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;$CONF&lt;/span&gt;&lt;span class=&quot;nn&quot;&gt;['dovecotpw']&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;&quot;/usr/bin/doveadm&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;pw&quot;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Again, note that we are connecting using the MariaDB Unix socket. Next, visit &lt;a href=&quot;https://mail.example.org/postfixadmin/setup.php&quot;&gt;https://mail.example.org/postfixadmin/setup.php&lt;/a&gt; to generate a setup password to use in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;config.local.php&lt;/code&gt;. If you have been following this guide carefully, you should see everything OK. If you don’t see the setup page, check your nginx log files for any PHP errors or permission errors. I’ve found from experience that these PHP applications sometimes have difficulty parsing complex passwords in configuration files so if your database connection is failing, try removing some special characters from your password. Take it up with the developers, not me.&lt;/p&gt;

&lt;p&gt;Before you continue, we’ll need to make a few changes to the Dovecot configuration files. We’ve made all the configuration changes in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/dovecot/conf.d&lt;/code&gt; directory so far. It turns out Postfix Admin has some difficulty parsing the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;!include conf.d/*.conf&lt;/code&gt; line in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/dovecot/dovecot.conf&lt;/code&gt;, so we’ll need to move all our configuration to that file. This is simple enough with the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;doveconf&lt;/code&gt; utility. We’ll need to change the permissions of that file and add &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nginx&lt;/code&gt; to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dovecot&lt;/code&gt; group to give Postfix Admin access.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nb&quot;&gt;cp&lt;/span&gt; /etc/dovecot/dovecot.conf&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;,.bk&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
doveconf &lt;span class=&quot;nt&quot;&gt;-n&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; /etc/dovecot/dovecot.conf
&lt;span class=&quot;nb&quot;&gt;chmod &lt;/span&gt;644 /etc/dovecot/dovecot.conf
usermod &lt;span class=&quot;nt&quot;&gt;-G&lt;/span&gt; dovecot &lt;span class=&quot;nt&quot;&gt;-a&lt;/span&gt; nginx&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Once you’ve got that sorted out and placed your setup password in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;config.local.php&lt;/code&gt;, the setup will ask you to create an admin user for Postfix Admin. You will need to provide the setup password you selected earlier. Use an email address for the admin user such as &lt;a href=&quot;mailto:admin@example.org&quot;&gt;admin@example.org&lt;/a&gt; and choose a password for it. Please make sure it’s secure.&lt;/p&gt;

&lt;p&gt;The installer will claim you don’t need to remove &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;setup.php&lt;/code&gt; and it will recommend you block off access to it. You can do that or just delete the file. You can always get it back by downloading the source tarball again. Once you’re done, you can log in to Postfix Admin at &lt;a href=&quot;https://mail.example.org/postfixadmin&quot;&gt;https://mail.example.org/postfixadmin&lt;/a&gt; using the admin user you just created.&lt;/p&gt;

&lt;p&gt;You should take this time to go back and read through &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;config.inc.php&lt;/code&gt;. It is very well commented. There are some options you may want to set such as your default admin email and footer links. Remember to add your changes to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;config.local.php&lt;/code&gt;.&lt;/p&gt;

&lt;h3 id=&quot;add-email-domains-and-mailboxes&quot;&gt;Add Email Domains and Mailboxes&lt;/h3&gt;

&lt;p&gt;Log in to &lt;a href=&quot;https://mail.example.org/postfixadmin&quot;&gt;https://mail.example.org/postfixadmin&lt;/a&gt; and head over to &lt;strong&gt;Domain List&lt;/strong&gt; &amp;gt; &lt;strong&gt;New Domain&lt;/strong&gt;. Fill in whatever works for you here to add a new domain, then head to &lt;strong&gt;Virtual List&lt;/strong&gt; &amp;gt; &lt;strong&gt;Add Mailbox&lt;/strong&gt; and create your first user. I set up &lt;a href=&quot;http://example.org&quot;&gt;example.org&lt;/a&gt; as an email domain and &lt;a href=&quot;mailto:admin@example.org&quot;&gt;admin@example.org&lt;/a&gt; as my first user. Doing this will generate the needed database schema that Postfix will use. Go ahead and play around with this and make sure your aliases are set up&lt;/p&gt;

&lt;h1 id=&quot;amavis-with-clamav-and-spamassassin&quot;&gt;Amavis with ClamAV and SpamAssassin&lt;/h1&gt;

&lt;p&gt;Now that we’ve installed the major components, it’s time to add some virus and spam checking. We’ll be using Amavis for this. As is the case with several of the older open source projects, Amavis has gone through a few name and code base changes. The most recent, still maintained version is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;amavisd-new&lt;/code&gt;, with the name of the program being &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;amavisd&lt;/code&gt; and the name of the project being Amavis. Most people use these interchangeably. Amavis will be the interface bewtween Postfix, ClamAV and SpamAssassin.&lt;/p&gt;

&lt;p&gt;The Amavis and SpamAssassin packages are a pain to install manually mostly due to their long list of dependencies. They’re both written in Perl and need quite a few modules. These can be installed using &lt;a href=&quot;http://www.cpan.org/&quot;&gt;CPAN&lt;/a&gt; but I would recommend you stick to the scripts provided by &lt;a href=&quot;http://mnspace.net/&quot;&gt;Nishant Limbachia&lt;/a&gt; at &lt;a href=&quot;http://slackbuilds.org/result/?search=perl&amp;amp;sv=14.1&quot;&gt;SlackBuilds.org&lt;/a&gt;. This makes it much easier to keep track of what you have installed with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sbopkg&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;slackpkg&lt;/code&gt; or whatever Slackware “package manager” you use. Before getting started you may want to install the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;arj&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;unrar&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cabextract&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;lzop&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nomarch&lt;/code&gt;, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;p7zip&lt;/code&gt; packages to allow SpamAssassin and ClamAV to handle different compressed files. These are all available on &lt;a href=&quot;http://slackbuilds.org/&quot;&gt;SlackBuilds&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;amavisd-new&quot;&gt;amavisd-new&lt;/h2&gt;

&lt;p&gt;Stick with the &lt;a href=&quot;http://slackbuilds.org/repository/14.1/network/amavisd-new/&quot;&gt;SlackBuild&lt;/a&gt; for this one. The dependencies are listed thoroughly in Nishant’s &lt;a href=&quot;http://slackbuilds.org/slackbuilds/14.1/network/amavisd-new/README.SBo&quot;&gt;README.SBo&lt;/a&gt; file, including the ones for SpamAssassin. Create a user and group before you run the script.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;groupadd &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; 225 amavis
useradd &lt;span class=&quot;nt&quot;&gt;-m&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; /var/lib/amavis &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; /bin/bash &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; 225 &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; 225 amavis&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Uncomment the lines &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@bypass_virus_checks_maps&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@bypass_spam_checks_maps&lt;/code&gt; at the top of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/amavisd.conf&lt;/code&gt; and add the following&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;@bypass_virus_checks_maps &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;
   %bypass_virus_checks, @bypass_virus_checks_acl, &lt;span class=&quot;nv&quot;&gt;$bypass_virus_checks_re&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
 
@bypass_spam_checks_maps &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;
   %bypass_spam_checks, @bypass_spam_checks_acl, &lt;span class=&quot;nv&quot;&gt;$bypass_spam_checks_re&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Go down a bit further and uncomment &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@lookup_sql_dsn&lt;/code&gt;, then modify it to connect to your database using the Unix socket and the proper credentials. Amavis uses the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DBD::mysql&lt;/code&gt; Perl module. The documentation &lt;a href=&quot;https://metacpan.org/pod/DBD::mysql&quot;&gt;states&lt;/a&gt; setting the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;host&lt;/code&gt; value to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;localhost&lt;/code&gt; will use the socket. This configuration will enable spam checking for the domains you’ve added to your database either manually or through Postfix Admin&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;err&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;py&quot;&gt;lookup_sql_dsn&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;err&quot;&gt;['DBI:mysql:&lt;/span&gt;&lt;span class=&quot;py&quot;&gt;database&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;mail;host=localhost',&lt;/span&gt;
     &lt;span class=&quot;err&quot;&gt;'mail',&lt;/span&gt;
     &lt;span class=&quot;err&quot;&gt;'mailpassword'])&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;;
&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;py&quot;&gt;sql_select_policy&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'SELECT domain from domain WHERE CONCAT(&quot;@&quot;,domain) IN (%k)';&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;There are a couple of other settings we can change. For instance, make sure you also set &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$max_servers&lt;/code&gt; to the same number of processes you allowed Amavis to use in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/postfix/master.cf&lt;/code&gt;. Setting the  &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$sa_tag_level_deflt&lt;/code&gt; opton to a large negative number will ensure that spam headers are added to every single email. Change the user and group to the ones you created earlier, set up a home directory for configuraiton files and quarantine emails, and set your domain name (&lt;strong&gt;not&lt;/strong&gt; the same as your hostname). Make sure you also uncomment the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;amavis&lt;/code&gt; section in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@av_scanners&lt;/code&gt;. We are also setting the Unix socket for Amavis here too&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;err&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;py&quot;&gt;max_servers&lt;/span&gt;  &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;4;&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;py&quot;&gt;sa_tag_level_deflt&lt;/span&gt;  &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;-9999;&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;py&quot;&gt;daemon_user&lt;/span&gt;  &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'amavis'&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;;
&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;$daemon_group = 'amavis';&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;py&quot;&gt;mydomain&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'example.org'&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;;
&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;$myhostname = 'mail.example.org';&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;py&quot;&gt;MYHOME&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'/var/lib/amavis'&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;;
&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;$QUARANTINEDIR = &quot;$MYHOME/virusmails&quot;;&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;py&quot;&gt;unix_socketname&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;/var/spool/postfix/amavis/amavisd.sock&quot;&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;; 
&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;$unix_socket_mode = 0660;&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;$interface_policy{'SOCK'}&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;'mysock'&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;;
&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;$policy_bank{'mysock'}&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;{&lt;/span&gt;
   &lt;span class=&quot;py&quot;&gt;protocol&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;gt; 'LMTP',&lt;/span&gt;
   &lt;span class=&quot;py&quot;&gt;auth_required_release&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;gt; 0,&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Comment out &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$inet_socket_port&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$interface_policy('10026')&lt;/code&gt;. There may already be an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$interface_policy&lt;/code&gt; set up for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AM.PDP-SOCK&lt;/code&gt;. Comment it out or modify it to what I have above. Notice we’re placing the socket in the Postfix queue directory, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/var/spool/postfix&lt;/code&gt;. We’ll need to create the directory to hold the socket and assign some permissions as well.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nb&quot;&gt;mkdir&lt;/span&gt; /var/spool/postfix/amavis/
&lt;span class=&quot;nb&quot;&gt;chmod &lt;/span&gt;770 /var/spool/postfix/amavis/
&lt;span class=&quot;nb&quot;&gt;chown &lt;/span&gt;amavis:postfix /var/spool/postfix/amavis/
usermod &lt;span class=&quot;nt&quot;&gt;-G&lt;/span&gt; amavis &lt;span class=&quot;nt&quot;&gt;-a&lt;/span&gt; postfix&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Use the following commands to let Postfix create the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;amavis-accept&lt;/code&gt; PID:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; /var/spool/postfix/public
&lt;span class=&quot;nb&quot;&gt;ln&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; ../amavis amavis
&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; /var/spool/postfix/pid
&lt;span class=&quot;nb&quot;&gt;mkdir &lt;/span&gt;unix.amavis
&lt;span class=&quot;nb&quot;&gt;chown &lt;/span&gt;root:root unix.amavis
&lt;span class=&quot;nb&quot;&gt;chmod &lt;/span&gt;700 unix.amavis&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;In order for the above to work, we need to set a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$forward_method&lt;/code&gt; in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/amavisd.conf&lt;/code&gt;. In my setup, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;amavisd-new&lt;/code&gt; would ignore that configuration option and insist on using TCP port 10025. I could not for the life of me figure out how to get it to use a socket no matter what value I tried. I ended up having to modify the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/usr/sbin/amavisd&lt;/code&gt; Perl script directly. Look around line 926 or search for 10025. Comment out the existing &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$forward_method&lt;/code&gt; and replace it with this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-perl&quot; data-lang=&quot;perl&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$forward_method&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$have_inet6&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$have_inet4&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;smtp:[::1]:10025&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;'&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;smtp:/var/spool/postfix/amavis/amavis-accept&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;';&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Go through the rest of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/amavisd.conf&lt;/code&gt; file and modify any settings you might want changed.&lt;/p&gt;

&lt;h2 id=&quot;spamassassin&quot;&gt;SpamAssassin&lt;/h2&gt;

&lt;p&gt;Get the SpamAssassin SlackBuild from &lt;a href=&quot;http://slackbuilds.org/repository/14.1/network/spamassassin/&quot;&gt;here&lt;/a&gt;, or get the &lt;a href=&quot;https://spamassassin.apache.org/downloads.cgi&quot;&gt;source files&lt;/a&gt;. You’ll notice one of the optional dependencies of SpamAssassin is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;perl-Geo-IP&lt;/code&gt;, which requires &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GeoIP&lt;/code&gt; (&lt;a href=&quot;http://slackbuilds.org/repository/14.1/network/GeoIP/&quot;&gt;SlackBuild&lt;/a&gt;). If you decide to install that, I found that SpamAssassin’s &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sa-update&lt;/code&gt; script expects the IPv6 database to be in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/usr/share/GeoIP/&lt;/code&gt;. You can get that file from &lt;a href=&quot;http://maxmind.com&quot;&gt;MaxMind&lt;/a&gt;’s servers and place it where needed (as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;root&lt;/code&gt;):&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;wget &lt;span class=&quot;nt&quot;&gt;-O&lt;/span&gt; - &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
http://geolite.maxmind.com/download/geoip/database/GeoIPv6.dat.gz &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
| &lt;span class=&quot;nb&quot;&gt;gunzip&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; /usr/share/GeoIP/GeoIPv6.dat&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;If you chose to install from source, you can grab a startup script from the extracted tarball. The guys at Apache were nice enough to include a Slackware-ready script in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;spamd&lt;/code&gt; directory of the extracted source, named &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;slackware-rc-script.sh&lt;/code&gt;. Once you have SpamAssassin installed, edit the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/spamassassin&lt;/code&gt; and set the following options. You only really need &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ENABLED&lt;/code&gt; but the rest are a good idea.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;py&quot;&gt;ENABLED&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;OPTIONS&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;--create-prefs --max-children 5 --helper-home-dir&quot;&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;PIDFILE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/var/run/spamd.pid&quot;&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;CRON&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;1&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The SpamAssassin source no longer includes rules, so you’ll have to download them. Run &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sa-update&lt;/code&gt; to do this.&lt;/p&gt;

&lt;h2 id=&quot;clamav&quot;&gt;ClamAV&lt;/h2&gt;

&lt;p&gt;This one is pretty straightforward as well. Download the &lt;a href=&quot;http://slackbuilds.org/repository/14.1/system/clamav/&quot;&gt;SlackBuild&lt;/a&gt; and set the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;COUNTRY&lt;/code&gt; variable to your country’s two letter ISO code. Run the script to build automatically. You can also &lt;a href=&quot;http://www.clamav.net/download.html&quot;&gt;get the source&lt;/a&gt; directly and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;./configure &amp;amp;&amp;amp; make &amp;amp;&amp;amp; make install&lt;/code&gt;. It doesn’t need anything outside a base Slackware installation. Grab the &lt;a href=&quot;http://slackbuilds.org/slackbuilds/14.1/system/clamav/rc.clamav&quot;&gt;rc.clamav&lt;/a&gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;init&lt;/code&gt; script from the SlackBuild for easier management. Wether you’re using the SlackBuild or installing manually from source, you’ll need a user and group created first.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;groupadd &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; 210 clamav
useradd &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; 210 &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; /dev/null &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; /bin/false &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; clamav clamav&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;While we’re at it, go ahead and add the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;amavis&lt;/code&gt; user to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;clamav&lt;/code&gt; group and vice versa&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;usermod &lt;span class=&quot;nt&quot;&gt;-G&lt;/span&gt; clamav &lt;span class=&quot;nt&quot;&gt;-a&lt;/span&gt; amavis
usermod &lt;span class=&quot;nt&quot;&gt;-G&lt;/span&gt; amavis &lt;span class=&quot;nt&quot;&gt;-a&lt;/span&gt; clamav&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Edit the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/clamd.conf&lt;/code&gt; file and change the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;LocalSocket&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;LocalSocketGroup&lt;/code&gt; options&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;LocalSocket /var/run/clamav/clamd.sock
LocalSocketGroup amavis&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Now go ahead and update your virus database by running &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;freshclam&lt;/code&gt; as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;root&lt;/code&gt;. Don’t worry if you get a message from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;freshclam&lt;/code&gt; saying &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;clamd&lt;/code&gt; was not updated. This is because we have not started &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;clamd&lt;/code&gt; yet. We also need to fix some permissions to get all three to play nicely.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nb&quot;&gt;chmod &lt;/span&gt;775 /var/lib/spamassassin/
&lt;span class=&quot;nb&quot;&gt;chown &lt;/span&gt;amavis:amavis /var/lib/spamassassin/
&lt;span class=&quot;nb&quot;&gt;chown&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-R&lt;/span&gt; amavis:amavis /var/lib/spamassassin/
&lt;span class=&quot;nb&quot;&gt;chown&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-R&lt;/span&gt; amavis:amavis /var/lib/amavis
&lt;span class=&quot;nb&quot;&gt;chown&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-R&lt;/span&gt; clamav:amavis /var/lib/clamav&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h1 id=&quot;postgrey&quot;&gt;Postgrey&lt;/h1&gt;

&lt;p&gt;This one is simple so we might as well get it out of the way. As usual, create your user and group first&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;groupadd &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; 301 postgrey
useradd &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; 301 &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; /var/lib/postgrey &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; /bin/false &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; postgrey postgrey&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Since Postgrey is just a Perl script, feel free to copy over the needed files from the &lt;a href=&quot;http://postgrey.schweikert.ch/pub/&quot;&gt;source tarball&lt;/a&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/usr/bin&lt;/code&gt;, notably &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;postgrey&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;policy-test&lt;/code&gt;, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;contrib/postgrereport&lt;/code&gt;. Check the &lt;a href=&quot;https://github.com/schweikert/postgrey/blob/master/README&quot;&gt;requirements&lt;/a&gt; to make sure you have the needed Perl modules. You can of course use the &lt;a href=&quot;http://slackbuilds.org/repository/14.1/network/postgrey/&quot;&gt;SlackBuild&lt;/a&gt;, too. If you install from source, grab the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;init&lt;/code&gt; script from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;contrib/postgrey.init&lt;/code&gt; and place it in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/rc.d/rc.postgrey&lt;/code&gt;. Make sure you also get a copy of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;postgrey_whitelist_recipients&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;postgrey_whitelist_clients&lt;/code&gt; and place them in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/postfix&lt;/code&gt;. The SlackBuild already does this for you. If you do choose the SlackBuild, you’ll need to set &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;POSTGREYUSR&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;POSTGREYGRP&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;POSTGREYUID&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;POSTGREYGID&lt;/code&gt; in the script to the values you set earlier when you created them.&lt;/p&gt;

&lt;p&gt;Whichever you choose, you’ll need to edit the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;init&lt;/code&gt; script and set &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;USER&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GROUP&lt;/code&gt;, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;HOST&lt;/code&gt; to their proper values. Feel free to get rid of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PORT&lt;/code&gt;. Find the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;postgrey_start()&lt;/code&gt; function and edit the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;postgrey&lt;/code&gt; flags to make sure it uses a socket instead of TCP.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;postgrey_start&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Starting postgrey milter:  /usr/bin/postgrey -d --unix=/var/run/postgrey/postgrey.sock --pidfile=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$PIDFILE&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; --user=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$USER&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; --group=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$GROUP&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; --dbdir=/var/lib/postgrey --hostname=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$HOST&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;mkdir&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; /var/run/postgrey
  /usr/bin/postgrey &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
                    &lt;span class=&quot;nt&quot;&gt;--unix&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/var/run/postgrey/postgrey.sock &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
                    &lt;span class=&quot;nt&quot;&gt;--pidfile&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/var/run/postgrey/postgrey.pid &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
                    &lt;span class=&quot;nt&quot;&gt;--user&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$USER&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--group&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$GROUP&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
                    &lt;span class=&quot;nt&quot;&gt;--dbdir&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/var/lib/postgrey &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
                    &lt;span class=&quot;nt&quot;&gt;--hostname&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$HOST&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h1 id=&quot;roundcube&quot;&gt;Roundcube&lt;/h1&gt;

&lt;p&gt;Setting up Roundcube is just like setting up any other PHP site. We’ve already configured nginx to use FastCGI so it’s a matter of downloading the files and placing them in a directory. As with Postfix Admin, feel free to create a new &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;server&lt;/code&gt; block for this or just stick with using a subdirectory of your existing site. Since I placed Postfix Admin in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/var/www/html/mail.example.org/postfixadmin&lt;/code&gt; I’ll place my Roundcube installation at the root, in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/var/www/html/mail.example.org/&lt;/code&gt;. Get the sources (I recommend the “complete” version) and extract. As of this writing, that’s &lt;a href=&quot;http://downloads.sourceforge.net/project/roundcubemail/roundcubemail/1.1.1/roundcubemail-1.1.1-complete.tar.gz&quot;&gt;1.1.1&lt;/a&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; /var/www/html/mail.example.org
wget http://downloads.sourceforge.net/project/roundcubemail/roundcubemail/1.1.1/roundcubemail-1.1.1-complete.tar.gz
&lt;span class=&quot;nb&quot;&gt;tar&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--strip-components&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;1 &lt;span class=&quot;nt&quot;&gt;-xvzf&lt;/span&gt; roundcubemail-1.1.1-complete.tar.gz
&lt;span class=&quot;nb&quot;&gt;chown&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-R&lt;/span&gt; nginx:nginx .&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;We’ll need to create a database for Roundcube to use. Log in to MariaDB with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mysql -u root -p&lt;/code&gt; and create it. Make sure you use a strong password.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sql&quot; data-lang=&quot;sql&quot;&gt;&lt;span class=&quot;k&quot;&gt;CREATE&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;DATABASE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;roundcubemail&lt;/span&gt; &lt;span class=&quot;cm&quot;&gt;/*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;GRANT&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;ALL&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;PRIVILEGES&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;ON&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;roundcubemail&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;TO&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;&quot;roundcube&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;&quot;localhost&quot;&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;\&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;IDENTIFIED&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;BY&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;&quot;password-here&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;FLUSH&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;PRIVILEGES&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Roundcube includes an SQL file that can create the necessary database structure for you&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;mysql &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; roundcube roundcubemail &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; &amp;lt; SQL/mysql.initial.sql &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;I recommend you check out the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;INSTALL&lt;/code&gt; file included in the source for a more complete guide on the installation. Now head over to &lt;a href=&quot;https://mail.example.org/installer&quot;&gt;https://mail.example.org/installer&lt;/a&gt; and make sure everything is OK in the &lt;strong&gt;Check environment&lt;/strong&gt; section. My installation complained about the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;date.timezone&lt;/code&gt; setting in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;php.ini&lt;/code&gt; so I had to set that. Get a list of supported time zones from &lt;a href=&quot;https://php.net/manual/en/timezones.php&quot;&gt;here&lt;/a&gt;. You may need to restart &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nginx&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;php-fpm&lt;/code&gt; for the changes to take effect.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nb&quot;&gt;echo &lt;/span&gt;date.timezone &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;America/Mexico_City&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; /etc/httpd/php.ini&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Click &lt;em&gt;Next&lt;/em&gt; when you’re done to move on to the &lt;strong&gt;Create config&lt;/strong&gt; section. You can leave most of these settings alone. If you want to know what a specific setting does, check out &lt;a href=&quot;http://trac.roundcube.net/wiki/Howto_Config&quot;&gt;Roundcube’s wiki&lt;/a&gt;. Fill in the &lt;strong&gt;Database setup&lt;/strong&gt; section with the user and database you created earlier.&lt;/p&gt;

&lt;p&gt;Make sure you &lt;strong&gt;do not&lt;/strong&gt; enable spellchecking support. If you do, Roundcube will connect to external services to check your spelling. Why would we go through all this trouble to have a third party see every word we type?&lt;/p&gt;

&lt;h3 id=&quot;imap-and-smtp-settings&quot;&gt;IMAP and SMTP Settings&lt;/h3&gt;

&lt;p&gt;We’re going to set &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;default_host&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tls://localhost&lt;/code&gt; and the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;default_port&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;993&lt;/code&gt; in the &lt;strong&gt;IMAP Settings&lt;/strong&gt; section. In the &lt;strong&gt;SMTP Settings&lt;/strong&gt; section, set &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;smtp_server&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tls://localhost&lt;/code&gt; , &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;smtp_port&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;587&lt;/code&gt; and check the &lt;em&gt;Use the current IMAP username and password for SMTP authentication&lt;/em&gt; option. Click on &lt;strong&gt;Create config&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;After it’s done writing your configuraiton file, we’ll add support for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;memcached&lt;/code&gt; and make sure we only use HTTPS in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;config/config.inc.php&lt;/code&gt; :&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'imap_cache'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'memcache'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'memcache_hosts'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'unix:/var/run/memcached/memcached.sock'&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'force_https]'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Click on &lt;strong&gt;Continue&lt;/strong&gt; in the browser to go to &lt;strong&gt;Step 3&lt;/strong&gt;&lt;/p&gt;

&lt;h1 id=&quot;opendkim-dns-and-building-trust&quot;&gt;OpenDKIM, DNS and Building Trust&lt;/h1&gt;

&lt;p&gt;The setup up to this point should be pretty much complete and meet most people’s needs. Some mail servers are quite picky when it comes to receiving email. Gmail particularly doesn’t like when an email is not signed. The next section will walk you through signing your email with &lt;a href=&quot;https://en.wikipedia.org/wiki/DomainKeys_Identified_Mail&quot;&gt;DomainKeys Identified Mail&lt;/a&gt; and setting up &lt;a href=&quot;https://en.wikipedia.org/wiki/Sender_Policy_Framework&quot;&gt;Sender Policy Framework&lt;/a&gt;. If you are using a hosting provider for your server, you will need to contact them and have them set up a &lt;abbr title=&quot;Pointer&quot;&gt;PTR&lt;/abbr&gt; record for your IP address. This is also known as &lt;abbr title=&quot;reverse DNS&quot;&gt;rDNS&lt;/abbr&gt;. Some mail servers will reject your email if the IP you are sending from does not point back to your domain name. In general, it should look something like this:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;34.216.184.93.in-addr.arpa	PTR	600	example.org&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If you’re hosting at home, you can try asking your ISP to set this up for you but it is unlikely they’ll want to. They may be willing if you purchase a static IP. You’ll also need to add &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MX&lt;/code&gt; records to your domain’s DNS records. You can add something like this&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;example.org MX	600 10 mail.example.org&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;That’s assuming &lt;a href=&quot;http://mail.example.org&quot;&gt;mail.example.org&lt;/a&gt; points to your mail sever’s IP and you want a priority of 10. You can ask your DNS provider to add these for you. Check that the record has propagated with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;host&lt;/code&gt;:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;gzamudio@hades:~ &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;host &lt;span class=&quot;nt&quot;&gt;-t&lt;/span&gt; MX example.org
example.org mail is handled by 10 mail.example.org.&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;opendkim&quot;&gt;OpenDKIM&lt;/h2&gt;

&lt;p&gt;You’ll want to grab the &lt;a href=&quot;http://sourceforge.net/projects/opendkim/files/&quot;&gt;latest sources&lt;/a&gt;, which correspond to version &lt;strong&gt;2.10.1&lt;/strong&gt; as of this writing. I also wrote a handy &lt;a href=&quot;http://slackbuilds.org/repository/14.1/network/OpenDKIM/&quot;&gt;SlackBuild&lt;/a&gt; which you can use. Note that you will need &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;libbsd&lt;/code&gt;(&lt;a href=&quot;http://slackbuilds.org/repository/14.1/libraries/libbsd/&quot;&gt;SlackBuild&lt;/a&gt;) installed in order to be able to compile. Let’s make the user and group first:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;groupadd &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; 305 opendkim
useradd &lt;span class=&quot;nt&quot;&gt;-r&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; 305 &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; opendkim &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; /var/run/opendkim/ &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; /sbin/nologin &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;OpenDKIM Milter&quot;&lt;/span&gt; opendkim&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;We’ll need to create the run directory as well:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nb&quot;&gt;mkdir&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; /var/run/opendkim
&lt;span class=&quot;nb&quot;&gt;chown &lt;/span&gt;opendkim:opendkim /var/run/opendkim&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;If you’re building manually, you may want to add &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--prefix=/usr&lt;/code&gt; to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;configure&lt;/code&gt; script or else it’ll place everything in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/usr/local&lt;/code&gt;. We’ll need support for MariaDB, so pass &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--with-sql-backend&lt;/code&gt; to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;configure&lt;/code&gt; script as well. If you’re using the SlackBuild set the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;USE_MYSQL&lt;/code&gt; variable to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;yes&lt;/code&gt; and run the script. I used a modified version of CentOS’s &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;init&lt;/code&gt; script for &lt;a href=&quot;http://slackbuilds.org/slackbuilds/14.1/network/OpenDKIM/rc.opendkim&quot;&gt;mine&lt;/a&gt;, but feel free to grab the one included in the source in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;contrib/init/generic/&lt;/code&gt; directory.&lt;/p&gt;

&lt;p&gt;Once it’s installed, we’ll need to set up a basic configuration file. You can copy the sample one from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;opendkim/opendkim.conf.simple&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/opendkim&lt;/code&gt; and add the user and group we created earlier. Note that the SlackBuild already does this for you:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;UserID opendkim:opendkim
KeyFile /etc/opendkim/keys/default.private&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;You’ll notice my &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;init&lt;/code&gt; script will automatically create some default keys for you in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/opendkim/keys&lt;/code&gt; and create the directory if it doesn’t exist. We’re using Unix sockets in this guide, so let’s change a line in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/opendkim.conf&lt;/code&gt;:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;Socket &lt;span class=&quot;nb&quot;&gt;local&lt;/span&gt;:/var/run/opendkim/opendkim.sock&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;We’ll generate a 2048 bit key with the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;opendkim-genkey&lt;/code&gt; command. You can try something stronger like 4096 bits, but RFC 6376 suggests it might not fit in a 512 byte DNS UDP response. See section &lt;a href=&quot;https://tools.ietf.org/html/rfc6376#section-3.3&quot;&gt;3.3.3 Key Sizes&lt;/a&gt; for more information.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;opendkim-genkey &lt;span class=&quot;nt&quot;&gt;-b&lt;/span&gt; 2048 &lt;span class=&quot;nt&quot;&gt;-D&lt;/span&gt; /etc/opendkim/keys &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; mailsvr &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; example.org&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The selector is simply something to tell your key apart once you add it to your DNS records. You’ll end up with two files, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mailsvr.private&lt;/code&gt;, which is your key, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mailsvr.txt&lt;/code&gt; which has a nicely formatted record you’ll need to add to your DNS zone. If you don’t manage your own DNS or have access to your zone file, simply copy the text starting with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;v=DKIM1&lt;/code&gt; as a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TXT&lt;/code&gt; record in whatever control panel your DNS provider uses. For the example above, this is what I got (truncated for demonstration):&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;s2&quot;&gt;&quot;v=DKIM1; k=rsa; 
p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0m8F6p1AD&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;You’ll need to wait a while before the DNS record propagates but once it does you can check it with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dig&lt;/code&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;dig mailsvr._domainkey.example.org TXT&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;sender-policy-framework&quot;&gt;Sender Policy Framework&lt;/h2&gt;

&lt;p&gt;This basically consists of adding another &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TXT&lt;/code&gt; record to your DNS zone. There used to be an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SPF&lt;/code&gt; type record but this was removed in &lt;a href=&quot;https://tools.ietf.org/html/rfc7208&quot;&gt;RFC 7208&lt;/a&gt;. You’ll want to add something like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nv&quot;&gt;v&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;spf1 a mx ~all &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h1 id=&quot;testing&quot;&gt;Testing&lt;/h1&gt;

&lt;p&gt;We’ll need to start all the components we’ve installed and check their logs to make sure everything is running smoothly. You can place your startup commands in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/rc.d/rc.local&lt;/code&gt; and the stop commands in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/rc.d/rc.local_shutdown&lt;/code&gt;. Make sure both are executable and add this content&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/rc.d/rc.local&lt;/code&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.php-fpm &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.php-fpm start
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.memcached &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.memcached start
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.nginx &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.nginx start
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.postgrey &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.postgrey start
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.clamav &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.clamav start
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.spamd &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.spamd start
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.amavisd-new &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.amavisd-new start
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.postfix &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.postfix start
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.dovecot &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.dovecot start
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.opendkim &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.opendkim start
&lt;span class=&quot;k&quot;&gt;fi&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/rc.d/rc.local_shutdown&lt;/code&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.nginx &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.nginx stop
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.php-fpm &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.php-fpm stop
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.memcached &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.memcached stop
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.opendkim &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.opendkim stop
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.postfix &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.postfix stop
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.dovecot &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.dovecot stop
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.postgrey &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.postgrey stop
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.amavisd-new &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.amavisd-new stop
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.clamav &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.clamav stop
&lt;span class=&quot;k&quot;&gt;fi

if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; /etc/rc.d/rc.spamd &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        /etc/rc.d/rc.spamd stop
&lt;span class=&quot;k&quot;&gt;fi&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Log in to your Roundcube webmail at &lt;a href=&quot;https://mail.example.org&quot;&gt;https://mail.example.org&lt;/a&gt; and start sending email. Try sending to big providers like Gmail and Yahoo. You’ll note the first time you receive an email, it’ll be greylisted thanks to Postgrey. Check &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/var/log/maillog&lt;/code&gt;:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;Apr 24 22:38:56 mail postgrey[945]: &lt;span class=&quot;nv&quot;&gt;action&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;greylist, &lt;span class=&quot;nv&quot;&gt;reason&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;new, &lt;span class=&quot;nv&quot;&gt;client_name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;mail.example.net, &lt;span class=&quot;nv&quot;&gt;client_address&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;61.4.1.30, &lt;span class=&quot;nv&quot;&gt;sender&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;testuser@example.net, &lt;span class=&quot;nv&quot;&gt;recipient&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;testuser@example.org
Apr 24 22:38:56 mail postfix/smtpd[19527]: NOQUEUE: reject: RCPT from mail.example.net[63.4.1.30]: 450 4.2.0 &amp;lt;testuser@example.org&amp;gt;: Recipient address rejected: Greylisted, see http://postgrey.schweikert.ch/help/example.org.html&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&amp;lt;testuser@example.net&amp;gt; &lt;span class=&quot;nv&quot;&gt;to&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&amp;lt;testuser@example.org&amp;gt; &lt;span class=&quot;nv&quot;&gt;proto&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;ESMTP &lt;span class=&quot;nv&quot;&gt;helo&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&amp;lt;mail.example.net&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Most mail servers will try once more after some time and will be allowed the second time they send. Spammers generally only try once so this should stop some most of the common spam you could receive. Once the mail passes through, Amavis will check for viruses and other malware.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;Apr 24 22:48:23 mail amavis[1078]: &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;01078-02&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; Passed CLEAN &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;RelayedInbound&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;, &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;63.4.1.30]:43126 &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;63.4.1.30] &amp;lt;testuser@example.net&amp;gt; -&amp;gt; &amp;lt;testuser@example.org&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;You can also test your anti-virus using the &lt;a href=&quot;http://www.eicar.org/86-0-Intended-use.html&quot;&gt;EICAR test file&lt;/a&gt;. Send yourself an email from another mail server with &lt;strong&gt;only&lt;/strong&gt; the following string in the body:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;X5O!P%@AP[4&lt;span class=&quot;se&quot;&gt;\P&lt;/span&gt;ZX54&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;P^&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;7CC&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;7&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$EICAR&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;-STANDARD-ANTIVIRUS-TEST-FILE&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$H&lt;/span&gt;+H&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;It will be detected as a virus and you’ll see this in the log as well:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;Apr 24 23:05:25 mail postfix/qmgr[1060]: BF9D558771: &lt;span class=&quot;nv&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&amp;lt;virusalert@example.org&amp;gt;, &lt;span class=&quot;nv&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;2092, &lt;span class=&quot;nv&quot;&gt;nrcpt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;1 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;queue active&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
Apr 24 23:05:25 mail amavis[21120]: &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;21120-01&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; Blocked INFECTED &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;Eicar-Test-Signature&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;DiscardedInbound,Quarantined&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;, &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;63.4.1.30]:36539 &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;63.4.1.30] &amp;lt;testuser@example.net&amp;gt; -&amp;gt; &amp;lt;testuser@example.org&amp;gt;, quarantine: /var/lib/amavis/virusmails&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;In a similar fashion, you can test your spam filter using the &lt;a href=&quot;https://spamassassin.apache.org/gtube/&quot;&gt;GTUBE&lt;/a&gt;. Send a message from another mail server to yourself with &lt;strong&gt;only&lt;/strong&gt; the following string in the body:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;XJS&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;C4JDBQADN1.NSBN3&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;2IDNEN&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;C.34X&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;It will be detected as spam and you’ll see this in the log as well:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;Apr 24 23:13:44 mail amavis[21119]: &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;21119-01&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; Passed SPAM &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;RelayedTaggedInternal,Quarantined&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;, &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;63.4.1.30]:36539 &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;63.4.1.30] &amp;lt;testuser@example.net&amp;gt; -&amp;gt; &amp;lt;testuser@example.org&amp;gt;, quarantine: /var/lib/amavis/virusmails&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;You’ll probably want to set up an email client such as Thunderbird or Claws Mail. They should automatically detect your sever’s open ports but you can use the following settings to set it up manually. You can substitute the hostname for &lt;a href=&quot;http://example.org&quot;&gt;example.org&lt;/a&gt; if that points to your server’s IP as well.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;Username: testuser@example.org
Incoming &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;IMAP&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; server: mail.example.org
Port: 993
SSL/TLS Enabled
Authentication: Plain &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;Normal Password&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;

Username: testuser@example.org
Outgoing &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;SMTP&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; server: mail.example.org
Port: 587
STARTTLS Enabled
Authentication: Plain &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;Normal Password&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h1 id=&quot;other-considerations&quot;&gt;Other Considerations&lt;/h1&gt;

&lt;p&gt;You’ll notice in your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/var/log/maillog&lt;/code&gt; file that there will be a ton of bots and compromised third party servers trying to relay using your server, trying to log in using common usernames (admin, support, test, etc) and generally just trying to wreak havoc on your mail server. The setup suggestions I described in this article should prevent most of those attacks. You may consider trying something like &lt;a href=&quot;http://www.fail2ban.org/wiki/index.php/Main_Page&quot;&gt;fail2ban&lt;/a&gt; to automatically ban these IPs. Get yourself a nice firewall using AlienBob’s &lt;a href=&quot;http://www.slackware.com/~alien/efg/&quot;&gt;Easy Firewall Generator&lt;/a&gt; and block anything you don’t need.&lt;/p&gt;

&lt;p&gt;I hope you found this guide useful. I tested this setup to the best of my ability but you may find certain things didn’t work for you. If that’s the case or you have any suggestions, comments, or just want to say hi, feel free to &lt;a href=&quot;/contact.html&quot;&gt;contact me&lt;/a&gt;. Encrypted email is strongly encouraged and preferred :)&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>24</title>
   <link href="https://gerardozamudio.mx/2015/03/27/24/"/>
   <updated>2015-03-27T00:00:00-06:00</updated>
   <id>https://gerardozamudio.mx/2015/03/27/24</id>
   <content type="html">&lt;p&gt;There is a line of a song I enjoy that says, “How come 24 hours sometimes seem to slip into days?” The song goes on about homesickness and being lonely on a trip. For the longest time, I identified with that line in regards to aging. The older we get, the faster time seems to pass us by. What are we doing with the limited time we have available?&lt;/p&gt;

&lt;!--more--&gt;

&lt;p&gt;This weekend while traveling I met a man who was spending his remaining years cycling for peace. He had a big banner strapped to the side of his bicycle with a peace message written in large, thick, block letters. I spent an afternoon walking downtown with him and hearing about his experiences. He was more than twice my age, has a academic degree, and had a stable income before he decided to start his cycling journey. He showed me photos of his travels including the time agents at the border helped him repair a tire and the time he got an infection on his foot while cycling through particularly wet area. After a quick lunch we parted ways.&lt;/p&gt;

&lt;p&gt;A year ago today I was getting rid of my belongings and stuffing what few bags would fit in the cab that was to take me to start a new life in another city. I had no idea a year later I’d be typing this in a different country with the sound of a Norwegian woman playing “Gje meg handa din, venn” on the keyboard in the same room or that I’d be ruminating over an annoyingly candle lit dinner with a new friend through Earth Hour.&lt;/p&gt;

&lt;p&gt;The song and that line have changed in meaning for me. I used to think experiences were for me alone - to be kept locked away and brought out only when I wanted to relive them. The people I’ve met over the last year have taught me it’s important to share them with others, to give something back to those who share with us. Hopefully those we share with will still remember after our hours stop turning into years and start turning into decades.&lt;/p&gt;

&lt;p&gt;The man with the bike certainly thought so. But maybe he just wanted a free lunch.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>3,962 m</title>
   <link href="https://gerardozamudio.mx/2015/01/19/3962-m/"/>
   <updated>2015-01-19T00:00:00-06:00</updated>
   <id>https://gerardozamudio.mx/2015/01/19/3962-m</id>
   <content type="html">&lt;p&gt;&lt;img src=&quot;/images/skydiving.png&quot; alt=&quot;Skydiving&quot; title=&quot;Skydiving&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Celebrating life, 200km/h.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>New Blog</title>
   <link href="https://gerardozamudio.mx/2014/09/30/new-blog/"/>
   <updated>2014-09-30T00:00:00-05:00</updated>
   <id>https://gerardozamudio.mx/2014/09/30/new-blog</id>
   <content type="html">&lt;p&gt;After a week of testing and development, I’ve finally switched my site over to &lt;a href=&quot;http://jekyllrb.com/&quot;&gt;Jekyll&lt;/a&gt;, the static site generator. This allowed me to get rid of PHP and MySQL, which I feel cause too much overhead for a simple site like mine. I also felt Apache had too many features I did not use so I got rid of that and switched to &lt;a href=&quot;http://nginx.org/&quot;&gt;nginx&lt;/a&gt; instead. Also note the &lt;abbr title=&quot;Top level domain&quot;&gt;TLD&lt;/abbr&gt; change, &lt;a href=&quot;https://gerardozamudio.mx&quot;&gt;gerardozamudio.mx&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;jekyll&quot;&gt;Jekyll&lt;/h2&gt;

&lt;p&gt;The great thing about Jekyll is it’s easy to use and configure. There’s a great &lt;a href=&quot;http://jekyllrb.com/docs/quickstart/&quot;&gt;installation guide&lt;/a&gt; at the official Jekyll site already so I won’t go over that again. Just note you’ll need &lt;a href=&quot;http://nodejs.org/&quot;&gt;Node.js&lt;/a&gt; and &lt;a href=&quot;https://www.ruby-lang.org/en/&quot;&gt;Ruby&lt;/a&gt; installed in order for it to work.&lt;/p&gt;

&lt;p&gt;First, I created the directory that will hold my new site in my shell user’s home directory:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;jekyll new ~/gerardozamudio.mx
&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; ~/gerardozamudio.mx&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;My site used to run on WordPress so most of the content was stored in the MySQL database. I ran the &lt;a href=&quot;http://import.jekyllrb.com/docs/wordpress/&quot;&gt;Jekyll WordPress importer&lt;/a&gt; with the following options:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;ruby &lt;span class=&quot;nt&quot;&gt;-rubygems&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'require &quot;jekyll-import&quot;;
    JekyllImport::Importers::WordPress.run({
      &quot;dbname&quot;   =&amp;gt; &quot;wordpress-db&quot;,
      &quot;user&quot;     =&amp;gt; &quot;wordpress-user&quot;,
      &quot;password&quot; =&amp;gt; &quot;password&quot;,
      &quot;host&quot;     =&amp;gt; &quot;localhost&quot;,
      &quot;socket&quot;   =&amp;gt; &quot;/var/run/mysql/mysql.pid&quot;,
      &quot;table_prefix&quot;   =&amp;gt; &quot;wp_&quot;,
      &quot;clean_entities&quot; =&amp;gt; true,
      &quot;comments&quot;       =&amp;gt; true,
      &quot;categories&quot;     =&amp;gt; true,
      &quot;tags&quot;           =&amp;gt; true,
      &quot;more_excerpt&quot;   =&amp;gt; true,
      &quot;more_anchor&quot;    =&amp;gt; true,
      &quot;status&quot;         =&amp;gt; [&quot;publish&quot;]
    })'&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Note that Slackware uses the default PID location of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/var/run/mysql/mysql.pid&lt;/code&gt; for MySQL so you’ll have to set that. This gave me a nice structured directory with all my posts converted to &lt;a href=&quot;http://daringfireball.net/projects/markdown/syntax&quot;&gt;Markdown&lt;/a&gt; complete with &lt;a href=&quot;http://jekyllrb.com/docs/frontmatter/&quot;&gt;YAML Front Matter&lt;/a&gt; containing the author, comments, tags, etc. WordPress keeps images in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/wp-content/uploads&lt;/code&gt; by default, but I made an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;images&lt;/code&gt; directory in the root of my site for simpler management, so a little &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sed&lt;/code&gt; magic fixed that:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;find ./ &lt;span class=&quot;nt&quot;&gt;-type&lt;/span&gt; f &lt;span class=&quot;nt&quot;&gt;-exec&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;sed&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-i&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'s|https://gerardozamudio.net/wp-content/uploads/|/images/|g'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{}&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;I also noticed the posts had been saved with a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.markdown&lt;/code&gt; extension. Those are not really important in Linux, but I wanted to fix them for my own sanity:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;file &lt;span class=&quot;k&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;.markdown &lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;mv&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$file&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$file&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; | &lt;span class=&quot;nb&quot;&gt;sed&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'s/\(.*\.\)markdown/\1md/'&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;done&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Then it was just a matter of downloading the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;uploads&lt;/code&gt; directory from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wp-content&lt;/code&gt; in my WordPress site’s root directory into my new Jekyll site’s root directory and renaming it to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;images&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;wordpress-features&quot;&gt;WordPress Features&lt;/h2&gt;

&lt;p&gt;There are some features of WordPress that Jekyll, being a static site generator, does not implement by default. Luckily I future proofed my site so it was easy to port images as well as HTML used in the posts. I didn’t have many posts that used a featured image so it was simply a matter of adding a new &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;![Alt text](/images/leading-image.jpg)&lt;/code&gt; line to the top of each post.&lt;/p&gt;

&lt;h3 id=&quot;captions&quot;&gt;Captions&lt;/h3&gt;

&lt;p&gt;Speaking of images, I am using the &lt;a href=&quot;http://captionss.com/&quot;&gt;captionss&lt;/a&gt; CSS library to easily add a nice looking caption to my images. Again, Jekyll does not offer this out of the box but it was a good excuse to get familiar with &lt;a href=&quot;http://liquidmarkup.org/&quot;&gt;Liquid&lt;/a&gt; and write my own tag. I didn’t want to bother with surrounding my images with HTML every time I wanted to add a caption so I created a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cap.html&lt;/code&gt; file in my &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;_includes&lt;/code&gt; folder inside my Jekyll site directory with the following contents:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-html&quot; data-lang=&quot;html&quot;&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;center&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;figure&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;embed&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;{{ include.url }}&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;img&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;{{ include.url }}&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;alt=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;{{ include.alt }}&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;figcaption&amp;gt;&lt;/span&gt;
	{{ include.cap }}
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;/figcaption&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/figure&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Whenever I want to use an image with a caption, I can just use the following:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-html&quot; data-lang=&quot;html&quot;&gt;{% include cap.html url=&quot;/images/image.jpg&quot; alt=&quot;Alt text&quot; cap=&quot;Caption&quot; %}&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;post-excerpts&quot;&gt;Post Excerpts&lt;/h3&gt;

&lt;p&gt;WordPress uses the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;!--more--&amp;gt;&lt;/code&gt; tag to signal post excerpts, and automatically generates a &lt;strong&gt;Read more…&lt;/strong&gt; link. Jekyll does not have this by default, but it can easily be implemented using a loop in the site’s posts index with the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;split&lt;/code&gt; &lt;a href=&quot;https://github.com/Shopify/liquid/wiki/Liquid-for-Designers#standard-filters&quot;&gt;Liquid filter&lt;/a&gt;:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-html&quot; data-lang=&quot;html&quot;&gt;{% if post.content contains '&lt;span class=&quot;c&quot;&gt;&amp;lt;!--more--&amp;gt;&lt;/span&gt;' %}

    {{ post.content | split:'&lt;span class=&quot;c&quot;&gt;&amp;lt;!--more--&amp;gt;&lt;/span&gt;' | first }}

    &lt;span class=&quot;nt&quot;&gt;&amp;lt;p&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;{{ post.url }}&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Read more &lt;span class=&quot;ni&quot;&gt;&amp;amp;raquo;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&lt;/span&gt;

{% else %}

    {{ post.content }}

{% endif %}&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;archives&quot;&gt;Archives&lt;/h3&gt;

&lt;p&gt;I didn’t bother reinventing the wheel with this one, and shamelessly stole &lt;a href=&quot;http://reyhan.org/2013/03/jekyll-archive-without-plugins.html&quot;&gt;Reyhan Dhuny’s archive.html&lt;/a&gt; code to make mine. I only added a hyphen between post names and dates and I was good to go.&lt;/p&gt;

&lt;p&gt;Finally, I built the site and put my files in the web server’s directory:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;jekyll build &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; /home/gzamudio/gerardozamudio.mx &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; /var/www/html/&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;nginx&quot;&gt;nginx&lt;/h2&gt;

&lt;p&gt;Good old nginx. It’s hard to believe it’s been a decade since this web server came about and it’s certainly matured a lot since then. Development is fast and looks to be stable, so I decided to go with the &lt;a href=&quot;http://nginx.org/en/CHANGES&quot;&gt;mainline releases&lt;/a&gt;. My main goal was serving plain static content so I did not need any of the extra modules that are built in by default. I created a system user to run the daemon:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;useradd &lt;span class=&quot;nt&quot;&gt;-r&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-M&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-U&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;User for nginx&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; /srv/httpd &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; /bin/false nginx&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Then I built my package using only 3 modules: &lt;a href=&quot;http://nginx.org/en/docs/http/ngx_http_ssl_module.html&quot;&gt;http_ssl_module&lt;/a&gt;, &lt;a href=&quot;http://nginx.org/en/docs/http/ngx_http_spdy_module.html&quot;&gt;http_spdy_module&lt;/a&gt;, and &lt;a href=&quot;http://nginx.org/en/docs/http/ngx_http_gzip_module.html&quot;&gt;http_gzip_static_module&lt;/a&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;./configure &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--with-http_ssl_module&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--with-http_spdy_module&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--with-http_gzip_static_module&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--with-file-aio&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--without-http_autoindex_module&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--without-http_browser_module&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--without-http_fastcgi_module&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--without-http_geo_module&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--without-http_empty_gif_module&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--without-http_map_module&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--without-http_proxy_module&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--without-http_memcached_module&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--without-http_ssi_module&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--without-http_userid_module&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--without-mail_pop3_module&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--without-mail_imap_module&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--without-mail_smtp_module&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--without-http_split_clients_module&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--without-http_uwsgi_module&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--without-http_scgi_module&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--without-http_limit_conn_module&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--without-http_referer_module&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--without-http-cache&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--without-http_upstream_ip_hash_module&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;ssl&quot;&gt;SSL&lt;/h2&gt;

&lt;p&gt;I talked about adding a certificate in a &lt;a href=&quot;https://gerardozamudio.mx/2014/03/06/site-now-served-over-ssl/&quot;&gt;previous post&lt;/a&gt;, but I decided to take that a step further and switch to &lt;abbr title=&quot;Elliptic Curve Digital Signature Algorithm&quot;&gt;ECDSA&lt;/abbr&gt; for my SSL certificate. Unfortunately Gandi does not offer such certificates so I had to move to Comodo in order to get one. I also set up &lt;abbr title=&quot;Strict Transport Security&quot;&gt;HSTS&lt;/abbr&gt; and &lt;abbr title=&quot;Perfect Forward Secrecy&quot;&gt;PFS&lt;/abbr&gt; to completely get rid of plain HTTP access to the server. At least &lt;a href=&quot;https://www.qualys.com/&quot;&gt;Qualys&lt;/a&gt; seems to think I did a &lt;a href=&quot;https://www.ssllabs.com/ssltest/analyze.html?d=gerardozamudio.mx&amp;amp;hideResults=on&quot;&gt;good job&lt;/a&gt;. If you look closely at the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;configure&lt;/code&gt; options above you’ll notice I also enabled &lt;a href=&quot;http://tools.ietf.org/html/draft-mbelshe-httpbis-spdy-00&quot;&gt;SPDY&lt;/a&gt;, the starting point for &lt;a href=&quot;http://http2.github.io/&quot;&gt;HTTP 2.0&lt;/a&gt;. Feel free to &lt;a href=&quot;http://spdycheck.org/#gerardozamudio.mx&quot;&gt;check it out&lt;/a&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Opera Developer 24 on Slackware64 14.1</title>
   <link href="https://gerardozamudio.mx/2014/06/26/opera-developer-24-on-slackware64-14-1/"/>
   <updated>2014-06-26T12:00:11-05:00</updated>
   <id>https://gerardozamudio.mx/2014/06/26/opera-developer-24-on-slackware64-14-1</id>
   <content type="html">&lt;p&gt;&lt;img src=&quot;/images/opera.png&quot; alt=&quot;Opera Developer 24 on Slackware64 14.1&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://blogs.opera.com/desktop/2014/06/opera-24-linux-released-developer-stream/&quot; title=&quot;Opera 24 for Linux released on the Developer stream&quot;&gt;Opera 24 for Linux&lt;/a&gt; is finally out! This new version, which is the development build and not stable, includes some new features like Discover, Stash, and an improved Speed Dial and Opera Turbo. You can get a full rundown of the changes by checking the &lt;a href=&quot;http://blogs.opera.com/desktop/changelog-24/#b1537.0&quot; title=&quot;Changelog for Opera 24&quot;&gt;change log&lt;/a&gt;.&lt;/p&gt;

&lt;table&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;I haven’t been a fan of Opera since they &lt;a href=&quot;http://www.operasoftware.com/press/releases/general/opera-gears-up-at-300-million-users&quot; title=&quot;Opera gears up at 300 million users&quot;&gt;switched&lt;/a&gt; to &lt;a href=&quot;https://www.webkit.org/&quot; title=&quot;The WebKit Open Source Project&quot;&gt;WebKit&lt;/a&gt; (and eventually &lt;a href=&quot;http://thenextweb.com/insider/2013/04/04/opera-confirms-it-will-follow-google-and-ditch-webkit-for-blink-as-part-of-its-commitment-to-chromium/&quot; title=&quot;Opera confirms it will follow Google and ditch WebKit for Blink, as part of its commitment to Chromium&quot;&gt;dumped that&lt;/a&gt; for &lt;a href=&quot;http://www.chromium.org/blink&quot; title=&quot;Blink - The Chromium Projects&quot;&gt;Blink&lt;/a&gt;) but I keep the [old 12.16 version from SlackBuilds](http://slackbuilds.org/repository/14.1/network/opera/ “Opera 12.16&lt;/td&gt;
      &lt;td&gt;SlackBuilds”) around as a third browser just in case.&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;The build is supposed to be for Ubuntu 64bit but you can follow Ruarí’s &lt;a href=&quot;https://gist.github.com/ruario/99522c94838d0680633c&quot; title=&quot;Manual Opera Install Instructions&quot;&gt;installation instructions&lt;/a&gt; for other platforms to install it on Slackware. If you’re really impatient, user Vladislav Borisov &lt;a href=&quot;http://blog.t-rg.ws/20140625/files/file.33/&quot; title=&quot;Opera 24 Developer SlackBuild&quot;&gt;has already written SlackBuild for it&lt;/a&gt;. Grab the tarball directly from &lt;a href=&quot;http://blog.t-rg.ws/uploads/opera-developer.tar.gz&quot;&gt;here&lt;/a&gt;, then install as you normally would:&lt;/p&gt;

&lt;pre class=&quot;brush: plain&quot;&gt;root@slack-vbox:~# wget http://blog.t-rg.ws/uploads/opera-developer.tar.gz
root@slack-vbox:~# tar -xvzf opera-developer.tar.gz
root@slack-vbox:~# cd opera-developer
root@slack-vbox:~/opera-developer# source opera-developer.info
root@slack-vbox:~/opera-developer# wget $DOWNLOAD_x86_64
root@slack-vbox:~/opera-developer# ./opera-developer.SlackBuild
root@slack-vbox:~/opera-developer# installpkg /tmp/opera-developer-24.0.1537.0-x86_64-1fsleg.txz
&lt;/pre&gt;

&lt;p&gt;I fired up a Slackware64 14.1 virtual machine for some quick testing. Remember if you want Flash support you’ll need AlienBOB’s &lt;a href=&quot;http://www.slackware.com/~alien/slackbuilds/chromium-pepperflash-plugin/&quot;&gt;chromium-pepperflash-plugin&lt;/a&gt; package.&lt;/p&gt;

&lt;figure class=&quot;embed dark&quot;&gt;
	&lt;a href=&quot;/images/opera-slackware.png&quot;&gt;&lt;img class=&quot;center&quot; src=&quot;/images/opera-slackware.png&quot; alt=&quot;Opera 24 Running on Slackware64 14.1&quot; /&gt;&lt;/a&gt;
	&lt;figcaption&gt;
	The browser's window looks out of place in a KDE environment.
	&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;&lt;br /&gt;
You can follow the development at Opera’s &lt;a href=&quot;http://www.opera.com/developer&quot; title=&quot;Opera Developer&quot;&gt;developer site&lt;/a&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Site Now Served Over HTTPS</title>
   <link href="https://gerardozamudio.mx/2014/03/05/site-now-served-over-ssl/"/>
   <updated>2014-03-05T20:00:05-06:00</updated>
   <id>https://gerardozamudio.mx/2014/03/05/site-now-served-over-ssl</id>
   <content type="html">&lt;table&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;In the interest of &lt;a href=&quot;http://blog.cryptographyengineering.com/2013/12/how-does-nsa-break-ssl.html&quot; title=&quot;How does the NSA break SSL?&quot;&gt;security&lt;/a&gt; for readers, I’m glad to announce my site now supports &lt;a href=&quot;https://en.wikipedia.org/wiki/Secure_Sockets_Layer&quot; title=&quot;Secure Sockets Layer&quot;&gt;SSL&lt;/a&gt;. You should be automatically redirected. For enhanced security around the web, I recommend the &lt;a href=&quot;https://www.eff.org/&quot; title=&quot;Electronic Frontier Foundation&quot;&gt;EFF&lt;/a&gt;’s excellent add-on [HTTPS Everywhere](https://www.eff.org/https-everywhere “HTTPS Everywhere&lt;/td&gt;
      &lt;td&gt;Electronic Frontier Foundation”).&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
</content>
 </entry>
 
 <entry>
   <title>Xbox 360 Controller on Slackware</title>
   <link href="https://gerardozamudio.mx/2014/02/07/xbox-360-controller-on-slackware/"/>
   <updated>2014-02-07T14:30:45-06:00</updated>
   <id>https://gerardozamudio.mx/2014/02/07/xbox-360-controller-on-slackware</id>
   <content type="html">&lt;p&gt;&lt;img src=&quot;/images/steam_controller_support.png&quot; alt=&quot;Xbox 360 Controller on Slackware&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://store.steampowered.com/browse/linux/&quot; title=&quot;Steam Linux Games&quot;&gt;Steam for Linux&lt;/a&gt; has been available for a while now and it’s coming along nicely. It’s easy enough to set up for Slackware using &lt;a href=&quot;http://alien.slackbook.org/blog/&quot; title=&quot;Alien Pastures&quot;&gt;Alien Bob&lt;/a&gt;’s &lt;a href=&quot;http://www.slackware.com/~alien/slackbuilds/steamclient/&quot; title=&quot;Alien Bob&quot;&gt;steamclient&lt;/a&gt; packages. &lt;a href=&quot;http://gerardozamudio.net/2012/12/04/steam-big-picture-mode/&quot; title=&quot;Steam Big Picture Mode&quot;&gt;Big Picture Mode&lt;/a&gt; is available which means more people are going to want to use a gamepad. I have a wired Xbox 360 controller that I purchased to use with my emulators. Slackware’s kernel already includes the xpad gamepad module so the controller is detected as soon as it’s plugged in.&lt;/p&gt;

&lt;!--more--&gt;

&lt;pre class=&quot;brush: plain&quot; title=&quot;dmesg&quot;&gt;[ 6.513624] usb 2-1.6: new full-speed USB device number 3 using ehci-pci
[ 6.604012] usb 2-1.6: New USB device found, idVendor=045e, idProduct=028e
[ 6.604014] usb 2-1.6: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 6.604016] usb 2-1.6: Product: Controller
[ 6.604017] usb 2-1.6: Manufacturer: &amp;copy;Microsoft Corporation
[ 6.604018] usb 2-1.6: SerialNumber: 199BF1B
[ 6.870036] input: Microsoft X-Box 360 pad as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.6/2-1.6:1.0/input/input10
[ 6.870078] usbcore: registered new interface driver xpad&lt;/pre&gt;

&lt;p&gt;Make sure the xpad module is loaded:&lt;/p&gt;
&lt;pre class=&quot;brush: shell&quot;&gt;root@hades:~ # lsmod | grep xpad
xpad                   11426  0
&lt;/pre&gt;

&lt;p&gt;If it’s not, then load it:&lt;/p&gt;
&lt;pre class=&quot;brush: shell&quot;&gt;root@hades:~ # modprobe xpad&lt;/pre&gt;

&lt;p&gt;Unfortunately, I had some issues with the gamepad not being recognized by Steam or emulators such as &lt;a href=&quot;https://dolphin-emu.org/&quot; title=&quot;Dolphin Emulator&quot;&gt;Dolphin&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This can be fixed by creating a udev rule to set the correct permissions for the input device. Stick the rules below in &lt;strong&gt;/etc/udev/rules.d/&lt;/strong&gt;, inside something like &lt;strong&gt;99-joystick.rules&lt;/strong&gt;:&lt;/p&gt;

&lt;pre class=&quot;brush: plain&quot; title=&quot;/etc/udev/rules.d/99-joystick.rules&quot;&gt;KERNEL==&quot;event[0-9]*&quot;, ENV{ID_BUS}==&quot;?*&quot;, ENV{ID_INPUT_JOYSTICK}==&quot;?*&quot;, GROUP=&quot;games&quot;, MODE=&quot;0660&quot;
KERNEL==&quot;js[0-9]*&quot;, ENV{ID_BUS}==&quot;?*&quot;, ENV{ID_INPUT_JOYSTICK}==&quot;?*&quot;, GROUP=&quot;games&quot;, MODE=&quot;0664&quot;
&lt;/pre&gt;

&lt;p&gt;Add your user to the &lt;strong&gt;games&lt;/strong&gt; group:&lt;/p&gt;

&lt;pre class=&quot;brush: shell&quot;&gt;root@hades:~ # usermod -G games -a gerardozamudio&lt;/pre&gt;

&lt;p&gt;The Xbox 360 controller should now be assigned to the games group with read-write access.&lt;/p&gt;

&lt;pre class=&quot;brush: shell&quot;&gt;root@hades:~ # ls -l /dev/input/
total 0
drwxr-xr-x 2 root root     180 Feb  7 03:10 by-id/
drwxr-xr-x 2 root root     180 Feb  7 03:10 by-path/
crw-r----- 1 root root  13, 64 Feb  7 09:11 event0
crw-r----- 1 root root  13, 65 Feb  7 09:11 event1
crw-rw---- 1 root games 13, 74 Feb  7 09:11 event10
crw-r----- 1 root root  13, 75 Feb  7 09:11 event11
crw-r----- 1 root root  13, 76 Feb  7 09:11 event12
crw-r----- 1 root root  13, 77 Feb  7 09:11 event13
crw-r----- 1 root root  13, 78 Feb  7 09:11 event14
crw-r----- 1 root root  13, 79 Feb  7 09:11 event15
crw-r----- 1 root root  13, 80 Feb  7 09:11 event16
crw-r----- 1 root root  13, 81 Feb  7 09:11 event17
crw-r----- 1 root root  13, 82 Feb  7 09:11 event18
crw-r----- 1 root root  13, 66 Feb  7 09:11 event2
crw-r----- 1 root root  13, 67 Feb  7 09:11 event3
crw-r----- 1 root root  13, 68 Feb  7 09:11 event4
crw-r----- 1 root root  13, 69 Feb  7 09:11 event5
crw-r----- 1 root root  13, 70 Feb  7 09:11 event6
crw-r----- 1 root root  13, 71 Feb  7 09:11 event7
crw-r----- 1 root root  13, 72 Feb  7 09:11 event8
crw-r----- 1 root root  13, 73 Feb  7 09:11 event9
crw-rw-r-- 1 root games 13,  0 Feb  7 09:11 js0
crw-r----- 1 root root  13, 63 Feb  7 09:11 mice
crw-r----- 1 root root  13, 32 Feb  7 09:11 mouse0
crw-r----- 1 root root  13, 33 Feb  7 09:11 mouse1
&lt;/pre&gt;

&lt;p&gt;This should cause Steam and your emulators to detect the controller properly and allow you to configure it using each application’s settings.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>eBooks</title>
   <link href="https://gerardozamudio.mx/2013/09/12/ebooks/"/>
   <updated>2013-09-12T10:30:17-05:00</updated>
   <id>https://gerardozamudio.mx/2013/09/12/ebooks</id>
   <content type="html">&lt;p&gt;&lt;strong&gt;&amp;lt;zam&amp;gt;&lt;/strong&gt; what file naming convention would you use for a bunch of books in pdf format? &lt;br /&gt;
&lt;strong&gt;&amp;lt;Soul_keeper&amp;gt;&lt;/strong&gt; I usually choose a dir name like “junk” and just cp them in there &lt;br /&gt;
&lt;strong&gt;&amp;lt;adaptr&amp;gt;&lt;/strong&gt; and not even check the exit status of cp &lt;br /&gt;
&lt;strong&gt;&amp;lt;Soul_keeper&amp;gt;&lt;/strong&gt; exactly &lt;br /&gt;
&lt;strong&gt;&amp;lt;Soul_keeper&amp;gt;&lt;/strong&gt; nearly impossible to locate/search for one when you need it anyways &lt;br /&gt;
&lt;strong&gt;&amp;lt;adaptr&amp;gt;&lt;/strong&gt; I always use the sha256 hash of (ISBN, year, publisher, random page from book) &lt;br /&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Firefox Updates Break Search and Other Settings</title>
   <link href="https://gerardozamudio.mx/2013/08/18/firefox-updates-break-search-and-other-settings/"/>
   <updated>2013-08-18T12:00:36-05:00</updated>
   <id>https://gerardozamudio.mx/2013/08/18/firefox-updates-break-search-and-other-settings</id>
   <content type="html">&lt;p&gt;&lt;img src=&quot;/images/firefox-crop-circle.jpg&quot; alt=&quot;Firefox Updates Break Search and Other Settings&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This morning I woke up and decided to check the latest tech news, so I opened up Firefox. It seems Firefox had downloaded an update during my last browsing session and was just waiting for me to restart so it can apply it. Not surprising, since I’ve gotten used to the ridiculously annoying constant updates from Mozilla. After the update was applied, I tried to search using the location bar and was surprised to find my searches were being redirected to my local Google site, https://www.google.com.mx/.&lt;/p&gt;

&lt;!--more--&gt;

&lt;p&gt;I remember I had specifically set the &lt;strong&gt;keyword.URL&lt;/strong&gt; preference in &lt;strong&gt;about:config&lt;/strong&gt; to use Google’s encrypted search and not pass any extra parameters (browser being used, language encoding, etc). I checked my &lt;strong&gt;about:config&lt;/strong&gt; settings and sure enough, it was still there. I figured it might a bug so I searched around and discovered&lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=738818&quot; title=&quot;Bug 738818 - consolidate Firefox search preferences&quot;&gt; Mozilla thought it was a good idea to disable that feature&lt;/a&gt; starting with Firefox 23 in order to stop “search hijacking”. This has in turn disabled Google’s Browse By Name (I don’t personally use this, but loads of people do) and any third party search providers a user may have added without using the Manage Search Engines option.&lt;/p&gt;

&lt;div class=&quot;center&quot;&gt;
&lt;figure class=&quot;embed dark&quot;&gt;
	&lt;a href=&quot;/images/firefox-keyword-url.png&quot;&gt;&lt;img src=&quot;/images/firefox-keyword-url.png&quot; alt=&quot;Screenshot of the about:config dialog to change the keyword.URL preference&quot; /&gt;&lt;/a&gt;
	&lt;figcaption&gt;
	My now useless keyword.URL preference was still there.
	&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;/div&gt;

&lt;table&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;I’m not the only one &lt;a href=&quot;https://support.mozilla.org/en-US/questions/967523&quot; title=&quot;Keyword.url + Browse By Name is broken in FF23&quot;&gt;upset&lt;/a&gt; about &lt;a href=&quot;https://support.mozilla.org/en-US/questions/966867&quot; title=&quot;How to change default search in address bar from google.com.bd to google.com?&quot;&gt;this&lt;/a&gt; and it’ saddening to see the only possible workaround is to &lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/keyword-search/&quot; title=&quot;Keyword Search :: Add-ons for Firefox&quot;&gt;install an add-on&lt;/a&gt; or just [write your own plugin](https://developer.mozilla.org/en-US/docs/Creating_OpenSearch_plugins_for_Firefox “Creating OpenSearch plugins for Firefox&lt;/td&gt;
      &lt;td&gt;MDN”). Thanks to &lt;a href=&quot;https://support.mozilla.org/en-US/questions/966867#answer-463627&quot;&gt;cor-el from the Mozilla forums&lt;/a&gt;, I learned about the &lt;a href=&quot;http://mycroftproject.com/google-search-plugins.html&quot; title=&quot;Mycroft Project: Google Search Engine Plugins - Firefox IE Chrome&quot;&gt;Mycroft project&lt;/a&gt;. I quickly found the &lt;strong&gt;encrypted.google.com&lt;/strong&gt; search provider, added it to my search engines, and promptly had Google’s encrypted search working again from my location bar.&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;Another thing I noticed is that Mozilla thought it was a good idea to change my location bar setting in the Options window to suggest URLs from my history and bookmarks. I had this set to suggest nothing. Why don’t they ask for my permission to change my settings?&lt;/p&gt;

&lt;p&gt;I’m upset Mozilla would remove an option that I’ve always felt gave me more freedom to set up. I had to live with the &lt;a href=&quot;https://blog.mozilla.org/theden/2013/06/03/using-the-new-firefox-download-manager/&quot; title=&quot;Using the New Firefox Download Manager&quot;&gt;new download manager&lt;/a&gt; until I found out I could revert to the old one. Keeping downloads in a separate window allows me to close my main Firefox window without interrupting my downloads, something the new manager does not support.&lt;/p&gt;

&lt;p&gt;I hope Mozilla doesn’t start alienating more users. I’ve been a Firefox user since version 2, and with everyone and their mother &lt;a href=&quot;http://thenextweb.com/insider/2013/04/04/opera-confirms-it-will-follow-google-and-ditch-webkit-for-blink-as-part-of-its-commitment-to-chromium/&quot; title=&quot;Opera confirms it will follow Google and ditch WebKit for Blink, as part of its commitment to Chromium&quot;&gt;switching to WebKit/Blink&lt;/a&gt; I feel it’s a matter of time before Firefox does too. It’s a shame such a good browser is quickly going down the drain.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Directory Names</title>
   <link href="https://gerardozamudio.mx/2013/05/07/directory-names/"/>
   <updated>2013-05-07T12:00:51-05:00</updated>
   <id>https://gerardozamudio.mx/2013/05/07/directory-names</id>
   <content type="html">&lt;blockquote&gt;
  &lt;p&gt;Kids these days grow up with the idea that they can have spaces and lots of other funny characters in their directory names.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;cite&gt;— &lt;a href=&quot;http://stackoverflow.com/a/67458&quot;&gt;8jean&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Mailbox Is Nothing New</title>
   <link href="https://gerardozamudio.mx/2013/02/14/mailbox-is-nothing-new/"/>
   <updated>2013-02-14T12:00:02-06:00</updated>
   <id>https://gerardozamudio.mx/2013/02/14/mailbox-is-nothing-new</id>
   <content type="html">&lt;p&gt;&lt;img src=&quot;/images/mailboxapp.png&quot; alt=&quot;Mailbox Is Nothing New&quot; /&gt;&lt;/p&gt;

&lt;p&gt;A few days ago, a friend of mine posted a video ad for an email program that can be run on an iPhone. I Googled this Mailbox “app” to find out more about it. The press seems to be extremely excited for this thing, but I honestly don’t see why.&lt;/p&gt;

&lt;p&gt;Their home page is filled with modern web clichés: lots of white space, a huge 1,000-pixel vertical length video, and short paragraphs describing their product.&lt;/p&gt;

&lt;!--more--&gt;

&lt;blockquote&gt;
  &lt;p&gt;We redesigned the inbox to make email light, fast, and mobile-friendly. Quickly swipe messages to your archive or trash. Scan an entire conversation at once with chat-like organization. Snooze emails until later with the tap of a button.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I don’t understand exactly how they “redesigned the inbox”. It looks nearly identical to the Gmail application. It even has the same swipe-to-archive functionality. Chat-like organization? Oh, they mean Gmail’s conversation view.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Designed 30 years ago, traditional email transmission is clunky and slow. To make delivery as fast as possible, Mailbox checks your email from the cloud, then delivers it to your phone securely. You can even get push notifications for new messages.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This one made me laugh. Email is just text, so I have no idea what they mean by it being clunky and slow. I’m also a bit confused by their claim that they speed up delivery by “checking email from the cloud”. Where the hell else are you going to check email from?&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Stop staring at emails you can’t deal with now. Mailbox lets you put off messages until later with a swipe and a tap. Snoozed emails return to your inbox automatically, so you can focus on what’s important now.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Isn’t this called “flag for follow-up” in most other email clients?&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;When your inbox holds just the stuff you need to address now, email feels lighter and faster. Mailbox makes getting to zero — and staying there — a breeze. After you experience a clean inbox, you’ll wonder how you ever lived without it.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This one is really up to the user, I think. Many people simply don’t like deleting emails so they can search for attachments and other information. Personally, I keep a clean inbox.&lt;/p&gt;

&lt;p&gt;At the very bottom of the page I’m supposed to get in line and wait for them to allow me to use their program. As if it was some huge privilege and some exclusive group. No, thanks.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Deception</title>
   <link href="https://gerardozamudio.mx/2013/02/13/deception/"/>
   <updated>2013-02-13T10:00:20-06:00</updated>
   <id>https://gerardozamudio.mx/2013/02/13/deception</id>
   <content type="html">&lt;blockquote&gt;
  &lt;p&gt;You cannot expect normal human beings to question all their assumptions 24/7. Every time you blinked you’d have to prove to yourself that the whole universe hadn’t just been switched off and then instantaneously recreated itself.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;cite&gt;— &lt;a href=&quot;http://it.slashdot.org/comments.pl?sid=3450465&amp;amp;cid=42857989&quot;&gt;tehcyder&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Secure Banking</title>
   <link href="https://gerardozamudio.mx/2013/01/10/secure-banking/"/>
   <updated>2013-01-10T17:30:51-06:00</updated>
   <id>https://gerardozamudio.mx/2013/01/10/secure-banking</id>
   <content type="html">&lt;p&gt;Earlier this week I tried to sign up for my local bank’s online banking feature. I put aside the fact that they charge you for using it and proceeded to fill in the required information. The problem came when I tried to set a password.&lt;/p&gt;
&lt;blockquote&gt;
  &lt;p&gt;Estimado cliente:&lt;/p&gt;

  &lt;p&gt;La clave de acceso debe ser alfanumérica, no se permiten acentos, o símbolos especiales (#, &amp;amp;, ?, etc.) ni más de 2 caracteres consecutivos (123 o abc), tampoco más de 2 caracteres idénticos consecutivos (111 o aaa).&lt;/p&gt;

  &lt;p&gt;Estimado cliente, en su pregunta no se permiten caracteres especiales ni la letra ñ.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The text says that I’m not allowed to use any special characters. This also applies to the secret question I was trying to set (this means I cannot end the question with ‘?’). The passwords are also &lt;strong&gt;limited to 10 characters&lt;/strong&gt;. Way to go, Mexican banks.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Steam Big Picture Mode</title>
   <link href="https://gerardozamudio.mx/2012/12/04/steam-big-picture-mode/"/>
   <updated>2012-12-04T00:00:27-06:00</updated>
   <id>https://gerardozamudio.mx/2012/12/04/steam-big-picture-mode</id>
   <content type="html">&lt;p&gt;&lt;img src=&quot;/images/steam-big-picture-sale.png&quot; alt=&quot;Steam Big Picture Mode&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Today Steam added a new feature to their Windows client called Big Picture. This is a new interface designed with game pads and a TV in mind. The first thing I noticed was that it resembles the Xbox 360 dashboard. You even access it by pressing the guide button on an Xbox 360 controller while playing a game.&lt;/p&gt;

&lt;!--more--&gt;

&lt;figure class=&quot;embed dark&quot;&gt;
	&lt;a href=&quot;/images/steam-big-picture-home.png&quot;&gt;&lt;img class=&quot;center&quot; src=&quot;/images/steam-big-picture-home.png&quot; alt=&quot;Steam Big Picture home screen&quot; /&gt;&lt;/a&gt;
	&lt;figcaption&gt;
	The first screen after starting Steam's Big Picture mode.
	&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;The store view looks pretty good. It’s a nice way to highlight which games are on sale at the time. It includes the same categories the regular Steam client has such as Daily Deals, Specials, and New Releases.&lt;/p&gt;

&lt;figure class=&quot;embed dark&quot;&gt;
	&lt;a href=&quot;/images/steam-big-picture.png&quot;&gt;&lt;img class=&quot;center&quot; src=&quot;/images/steam-big-picture.png&quot; alt=&quot;Steam Big Picture store view&quot; /&gt;&lt;/a&gt;
	&lt;figcaption&gt;
	The Steam Big Picture store view includes familiar categories found in the regular Steam client.
	&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;If you click through to see the games available for purchase, their display resembles the way games are displayed in the Xbox 360 dashboard. I found it annoying that the currently selected game is left aligned. I wish there was an option to make it the center game. You can click through to view the game’s details, full screen trailers, and screenshots.&lt;/p&gt;

&lt;figure class=&quot;embed dark&quot;&gt;
	&lt;a href=&quot;/images/steam-big-picture-store.png&quot;&gt;&lt;img class=&quot;center&quot; src=&quot;/images/steam-big-picture-store.png&quot; alt=&quot;Game being displayed in Steam&quot; /&gt;&lt;/a&gt;
	&lt;figcaption&gt;
	In an annoying move, the currently selected game is aligned to the left.
	&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;I liked the way games in my library were displayed. There’s an option to view all your games, but I don’t recommend this because if you have items in your library that are not actual games, such as “Counter-Strike: Source Beta” Steam will just display an ugly generic banner for the game’s image.&lt;/p&gt;

&lt;figure class=&quot;embed dark&quot;&gt;
	&lt;a href=&quot;/images/steam-big-picture-library.png&quot;&gt;&lt;img class=&quot;center&quot; src=&quot;/images/steam-big-picture-library.png&quot; alt=&quot;Steam Big Picture library view&quot; /&gt;&lt;/a&gt;
	&lt;figcaption&gt;
	Steam's Big Picture library view makes your games look pretty.
	&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;There are also a few other annoyances. For example, if you go back to a previous screen the client doesn’t save where you were. This means if you’re looking at the 10th game on a list, click on it to view its details, then go back, the client will take you back to the first game on the list (instead of the one you were on). Hopefully they get that fixed for the next update.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Tiling Window Managers</title>
   <link href="https://gerardozamudio.mx/2012/09/04/tiling-window-managers/"/>
   <updated>2012-09-04T16:00:09-05:00</updated>
   <id>https://gerardozamudio.mx/2012/09/04/tiling-window-managers</id>
   <content type="html">&lt;blockquote&gt;
  &lt;p&gt;Everybody knows that tiling window managers are the cure to all the world’s problems.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;cite&gt;—  &lt;a href=&quot;http://www.slackword.net/?p=272&quot;&gt;Marcin Herda&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Computer Love</title>
   <link href="https://gerardozamudio.mx/2012/08/16/computer-love/"/>
   <updated>2012-08-16T16:30:00-05:00</updated>
   <id>https://gerardozamudio.mx/2012/08/16/computer-love</id>
   <content type="html">&lt;blockquote&gt;
  &lt;p&gt;Me too. I love downloading and uploading and updating and transferring and virus scanning and defragging and registry cleaning and installing and encoding and rendering and unzipping and compiling, as much as possible at the same time. I imagine all these massive bit streams flowing in and out, the heart rate of the computer going up, my quad core maximizing its potential and hacking through millions of operations in a harmonic way of perfection, leaving a trail structure and cleanliness behind. It’s so refreshing.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;cite&gt;— &lt;a href=&quot;http://www.reddit.com/r/gaming/comments/yb3k7/dammit/c5u0qa9?context=1&quot;&gt;AlphaCunt&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>DayZ Olympics</title>
   <link href="https://gerardozamudio.mx/2012/08/01/dayz-olympics/"/>
   <updated>2012-08-01T17:00:56-05:00</updated>
   <id>https://gerardozamudio.mx/2012/08/01/dayz-olympics</id>
   <content type="html">&lt;blockquote&gt;
  &lt;p&gt;The players of DayZ would have a fair chance of winning first place in the Olympics if crawling on all fours was included in the games.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;cite&gt;— &lt;a href=&quot;http://ocaoimh.ie/2012/07/26/if-crawling-was-an-olympic-sport/&quot;&gt;Donncha O Caoimh&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>A Programming Language's Success</title>
   <link href="https://gerardozamudio.mx/2012/06/07/a-programming-languages-success/"/>
   <updated>2012-06-07T14:30:16-05:00</updated>
   <id>https://gerardozamudio.mx/2012/06/07/a-programming-languages-success</id>
   <content type="html">&lt;blockquote&gt;
  &lt;p&gt;The main factor in determining whether or not a [programming] language succeeds is the quality of its creator’s &lt;a href=&quot;http://khason.net/blog/computer-languages-and-facial-hair-%E2%80%93-take-two/&quot;&gt;beard&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;cite&gt;— &lt;a href=&quot;http://developers.slashdot.org/comments.pl?sid=2901419&amp;amp;cid=40243501&quot;&gt;llamalad&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Google Chrome Becomes World's No. 1 Browser</title>
   <link href="https://gerardozamudio.mx/2012/05/22/google-chrome-becomes-worlds-no-1-browser/"/>
   <updated>2012-05-22T18:30:58-05:00</updated>
   <id>https://gerardozamudio.mx/2012/05/22/google-chrome-becomes-worlds-no-1-browser</id>
   <content type="html">&lt;blockquote&gt;
  &lt;p&gt;Chrome has now “sold out”, and may only be used “ironically”. The current “hip” browser is now Lynx in an xterm window set to use Helvetica (it’s “vintage”). Please adjust your usage accordingly.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;cite&gt;— &lt;a href=&quot;http://news.slashdot.org/comments.pl?sid=2864683&amp;amp;cid=40067419&quot;&gt;gman003&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>iTunes Follows the Emacs Philosophy</title>
   <link href="https://gerardozamudio.mx/2012/04/18/itunes-follows-the-emacs-philosophy/"/>
   <updated>2012-04-18T09:00:12-05:00</updated>
   <id>https://gerardozamudio.mx/2012/04/18/itunes-follows-the-emacs-philosophy</id>
   <content type="html">&lt;blockquote&gt;
  &lt;p&gt;iTunes is a nice OS, it just needs a good media player.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;cite&gt;— &lt;a href=&quot;http://apple.slashdot.org/comments.pl?sid=2792345&amp;amp;cid=39712929&quot;&gt;AmiMoJo&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>#9501</title>
   <link href="https://gerardozamudio.mx/2012/03/15/9501/"/>
   <updated>2012-03-15T10:00:33-06:00</updated>
   <id>https://gerardozamudio.mx/2012/03/15/9501</id>
   <content type="html">&lt;p&gt;&lt;strong&gt;&amp;lt;Randerson&amp;gt;&lt;/strong&gt; LMAO OMFG where’s the phone, I have to tell Dean about this &lt;br /&gt;
&lt;strong&gt;&amp;lt;AgentSmith&amp;gt;&lt;/strong&gt; How can you use the phone when you cannot…speak? &lt;br /&gt;
&lt;strong&gt;**&lt;/strong&gt;* AgentSmith sets mode: &lt;strong&gt;+m&lt;/strong&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>I Just Live On The Edge</title>
   <link href="https://gerardozamudio.mx/2012/03/15/i-just-live-on-the-edge/"/>
   <updated>2012-03-15T09:00:43-06:00</updated>
   <id>https://gerardozamudio.mx/2012/03/15/i-just-live-on-the-edge</id>
   <content type="html">&lt;blockquote&gt;
  &lt;p&gt;I feel like such a fearless badman for running arch linux before the packages were signed&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;cite&gt;— &lt;a href=&quot;http://linux.slashdot.org/comments.pl?sid=2625046&amp;amp;cid=38725594&quot;&gt;mshenrick&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>SimCity Is Back!</title>
   <link href="https://gerardozamudio.mx/2012/03/07/simcity-is-back/"/>
   <updated>2012-03-07T07:30:25-06:00</updated>
   <id>https://gerardozamudio.mx/2012/03/07/simcity-is-back</id>
   <content type="html">&lt;p&gt;Woo! &lt;a href=&quot;http://kotaku.com/5891117/simcity-5-is-official-welcome-back-simcity&quot; title=&quot;Itâ€™s Official, SimCity is Back&quot;&gt;SimCity is back&lt;/a&gt;! I can’t wait!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>X Server on Android and the Gate One</title>
   <link href="https://gerardozamudio.mx/2012/03/07/x-server-on-android-and-the-gate-one/"/>
   <updated>2012-03-07T07:00:54-06:00</updated>
   <id>https://gerardozamudio.mx/2012/03/07/x-server-on-android-and-the-gate-one</id>
   <content type="html">&lt;table&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;I don’t know what’s sexier: &lt;a href=&quot;https://my20percent.wordpress.com/2012/02/27/android-x-server/&quot; title=&quot;Android X server&quot;&gt;X Server coming to Android&lt;/a&gt; or the [Gate One](http://liftoffsoftware.com/Products/GateOne “Liftoff Software&lt;/td&gt;
      &lt;td&gt;Gate One “) Quake-style web terminal emulator and SSH client&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
</content>
 </entry>
 
 <entry>
   <title>Google's New Privacy Policy In Effect</title>
   <link href="https://gerardozamudio.mx/2012/03/02/googles-new-privacy-policy-in-effect/"/>
   <updated>2012-03-02T08:30:00-06:00</updated>
   <id>https://gerardozamudio.mx/2012/03/02/googles-new-privacy-policy-in-effect</id>
   <content type="html">&lt;p&gt;It’s March 2nd! Google will finally quit bugging me about their new privacy.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Linode Security Flaw Causes Theft</title>
   <link href="https://gerardozamudio.mx/2012/03/02/linode-security-flaw-causes-theft/"/>
   <updated>2012-03-02T08:00:05-06:00</updated>
   <id>https://gerardozamudio.mx/2012/03/02/linode-security-flaw-causes-theft</id>
   <content type="html">&lt;p&gt;Just when I was thinking about finally signing up for Linode, they go and &lt;a href=&quot;http://bitcoinmedia.com/compromised-linode-coins-stolen-from-slush-faucet-and-others/&quot; title=&quot;Compromised Linode &amp;amp; coins stolen from slush, faucet and others&quot;&gt;get hacked&lt;/a&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Raspberry Pi Possible Release Date</title>
   <link href="https://gerardozamudio.mx/2012/02/28/raspberry-pi-possible-release-date/"/>
   <updated>2012-02-28T11:00:35-06:00</updated>
   <id>https://gerardozamudio.mx/2012/02/28/raspberry-pi-possible-release-date</id>
   <content type="html">&lt;blockquote&gt;
  &lt;p&gt;The Raspberry Pi (an ARM GNU/Linux box for $25) &lt;a href=&quot;http://www.raspberrypi.org/archives/716&quot; title=&quot;Ladies and gentlemen, set your alarms!&quot;&gt;might be released&lt;/a&gt; at 00:00:00 CST on February 29th!&lt;/p&gt;
&lt;/blockquote&gt;
</content>
 </entry>
 
 <entry>
   <title>Boot to Gecko Demo</title>
   <link href="https://gerardozamudio.mx/2012/02/28/boot-to-gecko-demo/"/>
   <updated>2012-02-28T10:30:31-06:00</updated>
   <id>https://gerardozamudio.mx/2012/02/28/boot-to-gecko-demo</id>
   <content type="html">&lt;p&gt;Mozilla released a &lt;a href=&quot;https://hacks.mozilla.org/2012/02/mozillas-boot-to-gecko-the-web-is-the-platform/&quot; title=&quot;Mozillaâ€™s Boot to Gecko â€“ The Web is the Platform&quot;&gt;video demo&lt;/a&gt; of their Boot to Gecko project yesterday. I’m usually against mobile computing (iPad/tablets, browsing on a mobile phone, etc) simply because I believe computing should be done on a desktop with a nice full keyboard and optional mouse. This time, however, Mozilla has managed to spark my interest. I’m excited to see what a web standards-based phone will be capable of. I’m also happy that it won’t be yet another platform for developers to support - any web app should work automatically.&lt;/p&gt;

&lt;div class=&quot;center&quot;&gt;
&lt;figure class=&quot;embed dark&quot;&gt;
	&lt;a href=&quot;/images/owd-homescreen.png&quot;&gt;&lt;img src=&quot;/images/owd-homescreen.png&quot; alt=&quot;Mozilla Boot to Gecko OWD home screen&quot; /&gt;&lt;/a&gt;
	&lt;figcaption&gt;
	Mozilla Boot to Gecko OWD home screen.
	&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;/div&gt;

&lt;p&gt;Head over to Arstechnica for &lt;a href=&quot;http://arstechnica.com/gadgets/news/2012/02/mozilla-demos-owd-platform-with-custom-home-screen-on-a-phone.ars&quot; title=&quot;Mozilla demos OWD platform with custom home screen on a phone&quot;&gt;more screenshots&lt;/a&gt;!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Chinese Internet Users Flood Obama's Google+ Page</title>
   <link href="https://gerardozamudio.mx/2012/02/27/chinese-internet-users-flood-obamas-google-page/"/>
   <updated>2012-02-27T09:00:03-06:00</updated>
   <id>https://gerardozamudio.mx/2012/02/27/chinese-internet-users-flood-obamas-google-page</id>
   <content type="html">&lt;table&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;Chinese internet users [began flooding](http://www.ctv.ca/CTVNews/SciTech/20120226/chinese-flood-obama-site-after-googleplus-clock-lifted-120226/ “Chinese flood Obama site after Google Plus block lifted&lt;/td&gt;
      &lt;td&gt;Sci-Tech”) Barack Obama’s Google+ page with comments following an unblocking by their government. Most of the comments were in Chinese were political in nature, while others were just people ranting. This specific comment made me laugh (all the comments were being posted in Obama’s latest update, which was regarding bumper stickers):&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;figure class=&quot;embed dark&quot;&gt;
	&lt;a href=&quot;/images/chinese-flood-obama-page.png&quot;&gt;&lt;img class=&quot;center&quot; src=&quot;/images/chinese-flood-obama-page.png&quot; alt=&quot;Engrish translation of a comment by a Chinese user left on Obama's Google+ Profile&quot; /&gt;&lt;/a&gt;
	&lt;figcaption&gt;
	Engrish translation of a comment by a Chinese user.
	&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt; It looks like our friend found the answer.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/chinese-flood-obama-page-2.png&quot;&gt;&lt;img src=&quot;/images/chinese-flood-obama-page-2.png&quot; alt=&quot;&quot; title=&quot;chinese-flood-obama-page-2&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Kerning In Google Search Results</title>
   <link href="https://gerardozamudio.mx/2012/02/26/kerning-in-google-search-results/"/>
   <updated>2012-02-26T08:00:42-06:00</updated>
   <id>https://gerardozamudio.mx/2012/02/26/kerning-in-google-search-results</id>
   <content type="html">&lt;p&gt;&lt;img src=&quot;/images/google-kerning-search-result.png&quot; alt=&quot;Kerning In Google Search Results&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Is it just me, or does doing a Google search for “kerning” come up with examples of kerning?&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Anonymous Coward</title>
   <link href="https://gerardozamudio.mx/2012/02/24/anonymous-coward/"/>
   <updated>2012-02-24T15:00:04-06:00</updated>
   <id>https://gerardozamudio.mx/2012/02/24/anonymous-coward</id>
   <content type="html">&lt;blockquote&gt;
  &lt;p&gt;Developers at Gnome have reduced the entire UI to a single button and they’re even trying to get rid of that.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;cite&gt;— &lt;a href=&quot;http://tech.slashdot.org/comments.pl?sid=2669735&amp;amp;cid=39028393&quot;&gt;Anonymous Coward&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>How To: Change Welcome Screen Language in Windows 7</title>
   <link href="https://gerardozamudio.mx/2011/08/14/how-to-change-welcome-screen-language-in-windows-7/"/>
   <updated>2011-08-14T20:03:18-05:00</updated>
   <id>https://gerardozamudio.mx/2011/08/14/how-to-change-welcome-screen-language-in-windows-7</id>
   <content type="html">&lt;p&gt;&lt;img src=&quot;/images/windows_login.png&quot; alt=&quot;How To: Change Welcome Screen Language in Windows 7&quot; /&gt;&lt;/p&gt;

&lt;p&gt;After 10 years of use, I’ve finally said goodbye to Windows XP and upgraded to Windows 7. Everything is nice and dandy, except for the fact that my operating system is in Spanish.&lt;/p&gt;

&lt;!--more--&gt;

&lt;p&gt;Spanish is the primary language where I live, so any operating system acquired here is also in Spanish. I tried contacting Microsoft about buying a Windows 7 install disc from the U.S. or downloading it from their U.S online store, but they were not very helpful.&lt;/p&gt;

&lt;p&gt;I ended up buying Windows 7 Ultimate because it’s the only one that allows me to change the display language. To change the display language simply open up Windows Update (it has the same name in Spanish) and let it search for updates.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/win_update.png&quot;&gt;&lt;img src=&quot;/images/win_update.png&quot; alt=&quot;Windows Update searching for updates&quot; title=&quot;Windows Update searching for updates&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As soon as it’s done it will show a list of available language packs under &lt;strong&gt;Optional Updates&lt;/strong&gt;. In this case, I chose English because it’s the one I needed.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/en_lang_pack.png&quot;&gt;&lt;img src=&quot;/images/en_lang_pack.png&quot; alt=&quot;List of language packs downloaded through Windows Update&quot; title=&quot;List of language packs downloaded through Windows Update&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After it’s done downloading, head on over to the &lt;strong&gt;Control Panel&lt;/strong&gt; and click on &lt;strong&gt;Region and Language&lt;/strong&gt;. If you’re having trouble locating it, it’s the one that has an icon of a globe and a clock. Once there, you can change the display language by selecting the language pack you just downloaded.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/region_language.png&quot;&gt;&lt;img src=&quot;/images/region_language.png&quot; alt=&quot;Change display language&quot; title=&quot;Change display language&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here’s the tricky part: when you log off or your computer decides to finish an update before being shutdown you will notice the progress prompts are in whatever language the operating system was originally installed with.&lt;/p&gt;

&lt;p&gt;To change the display language of the Welcome Screen, go back to the &lt;strong&gt;Region and Language&lt;/strong&gt; options and click on the &lt;strong&gt;Administrative&lt;/strong&gt; tab. Click on the &lt;strong&gt;Copy settings&lt;/strong&gt; button and make sure you check &lt;strong&gt;Welcome screen and system accounts&lt;/strong&gt; and &lt;strong&gt;New user accounts&lt;/strong&gt; under &lt;strong&gt;Copy your current settings to&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/images/welcome_screen.png&quot;&gt;&lt;img src=&quot;/images/welcome_screen.png&quot; alt=&quot;Change welcome screen display language&quot; title=&quot;Change welcome screen display language&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That’s it! Now almost the entire system is in English. I say almost because there’s still some drivers and device names here and there that are named in Spanish, such as my network interface card.&lt;/p&gt;

&lt;p&gt;I still need to get my 5.1 sound speakers working, so I’ll post about that another time.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>New Journey Into Coding</title>
   <link href="https://gerardozamudio.mx/2010/12/05/new-journey-into-coding/"/>
   <updated>2010-12-05T17:36:48-06:00</updated>
   <id>https://gerardozamudio.mx/2010/12/05/new-journey-into-coding</id>
   <content type="html">&lt;p&gt;It’s been almost two months since my last update. It’s not that I’ve been busy, I just didn’t have anything interesting to talk about.&lt;/p&gt;

&lt;!--more--&gt;

&lt;p&gt;Due to private matters, I’ve come across quite a bit of free time during these past two months. I’ve used this time to begin learning how to program properly. Sure, I’ve delved into HTML, CSS, PHP and the like (hence the “amateur coder” in &lt;a href=&quot;http://gerardozamudio.net/about/&quot; title=&quot;About Gerardo Zamudio&quot;&gt;the bio&lt;/a&gt;) but I want to get into something that isn’t a scripting language. The perfect chance to start came a while ago during a meeting at work. A few coworkers complained that the template to file their trouble tickets was inconsistent and a few claimed it was hard to implement. I thought I could make some sort of program that displayed the template in a way that all the user had to do was fill in required information, click a button, and have it instantly formatted and ready to paste into a ticket.&lt;/p&gt;

&lt;p&gt;Unfortunately, I turned to a scripting language such as &lt;a href=&quot;http://www.autohotkey.com/&quot; title=&quot;AutoHotkey - Free Mouse and Keyboard Macro Program with Hotkeys and AutoText&quot;&gt;AutoHotKey&lt;/a&gt; to accomplish this. I say “unfortunately” because it went against my original plan to learn a proper language. It was something I needed to get done quickly without too much hassle, so I figured it’d be fine. I had never even seen an AutoHotKey script before let alone write one, so you could say this was my first time.&lt;/p&gt;

&lt;p&gt;It didn’t take long. The documentation is easy enough to understand. I browsed the forums to see what types of things people were doing (I believe there was a 911 dispatcher that used it for calls) and I got an idea of things I could and could not do.&lt;/p&gt;

&lt;p&gt;Anyway, I fired up AutoHotKey, typed away for a combined total of 9 hours, used &lt;a href=&quot;http://www.getpaint.net/&quot; title=&quot;Paint.NET - Free Software for Digital Photo Editing&quot;&gt;Paint.NET&lt;/a&gt; to make some basic graphics, and compiled the script into a .exe using the included compiler. Here’s a detail of a screenshot I took of the finished program:&lt;/p&gt;

&lt;div class=&quot;center&quot;&gt;
&lt;figure class=&quot;embed dark&quot;&gt;
	&lt;a href=&quot;/images/ticket_template.jpg&quot;&gt;&lt;img src=&quot;/images/ticket_template.jpg&quot; alt=&quot;Screenshot of program developed using AutoHotKey&quot; /&gt;&lt;/a&gt;
	&lt;figcaption&gt;
	I just realized the alignment of the input fields is a bit off
	&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;/div&gt;

&lt;p&gt;Obviously, I took out all styling and logos that could reference my employer. It’s nothing too fancy. I’m really proud of what I could make if I had a purpose. I’ve always found it difficult to make something from scratch so it was nice to know exactly what I wanted to accomplish before I even started.&lt;/p&gt;

&lt;p&gt;I sent this out to my coworkers to use in their tickets. They loved it and of course immediately sent tons of feature requests and bug reports. Actually, I wouldn’t really call them bugs… most of them were because of sloppy code or typos I’d made. This experience also served as great practice for developing for a specific audience. For instance, I can’t believe I forgot to add a “clear all fields” button in the first version. They immediately let me know it was needed so I added one.&lt;/p&gt;

&lt;p&gt;This is the only AutoHotKey script I plan on developing and maintaining. Once I decide what language I want to get into, I’ll post about it and make my first program available to download.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>New Internet Meme: Cigar Guy</title>
   <link href="https://gerardozamudio.mx/2010/10/07/new-internet-meme-cigar-guy/"/>
   <updated>2010-10-07T00:48:02-05:00</updated>
   <id>https://gerardozamudio.mx/2010/10/07/new-internet-meme-cigar-guy</id>
   <content type="html">&lt;p&gt;&lt;img src=&quot;/images/cigar_guy.jpg&quot; alt=&quot;New Internet Meme: Cigar Guy&quot; /&gt;&lt;/p&gt;

&lt;p&gt;A stunning picture of Tiger Woods was taken at the Ryder Cup as he swung his club and hit the ball directly into the photographer’s camera. This was an amazing feat in itself, but what actually made the picture famous was the quirky mustachioed man smoking a cigar to Tiger’s left.&lt;/p&gt;

&lt;!--more--&gt;

&lt;p&gt;The man has become an overnight internet sensation and his image has been photoshopped into &lt;a href=&quot;http://blogs.dallasobserver.com/dc9/2010/10/listomania_five_tiger_woods-ph.php&quot;&gt;a number of iconic pictures&lt;/a&gt;. Here are some for your viewing pleasure.&lt;/p&gt;

&lt;div class=&quot;center&quot;&gt;
&lt;figure class=&quot;embed dark&quot;&gt;
	&lt;a href=&quot;/images/cigar_guy_island.jpg&quot;&gt;&lt;img src=&quot;/images/cigar_guy_island.jpg&quot; alt=&quot;The cigar guy on an island&quot; /&gt;&lt;/a&gt;
	&lt;figcaption&gt;
	The cigar guy on an island.
	&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;/div&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;div class=&quot;center&quot;&gt;
&lt;figure class=&quot;embed dark&quot;&gt;
	&lt;a href=&quot;/images/cigar_guy_moon.jpg&quot;&gt;&lt;img src=&quot;/images/cigar_guy_moon.jpg&quot; alt=&quot;The cigar guy on the moon&quot; /&gt;&lt;/a&gt;
	&lt;figcaption&gt;
	The cigar guy on the moon
	&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;/div&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;div class=&quot;center&quot;&gt;
&lt;figure class=&quot;embed dark&quot;&gt;
	&lt;a href=&quot;/images/cigar_guy_bob_dylan.jpg&quot;&gt;&lt;img src=&quot;/images/cigar_guy_bob_dylan.jpg&quot; alt=&quot;The cigar guy on a Bob Dylan album&quot; /&gt;&lt;/a&gt;
	&lt;figcaption&gt;
	The cigar guy on a Bob Dylan album
	&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;/div&gt;

&lt;p&gt;I honestly don’t know what it is about this guy, but it had me laughing all day at work. Here’s the &lt;a href=&quot;http://tech.spreadit.org/pics/Tiger-Wood.jpg&quot;&gt;original photo&lt;/a&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>I'm on a lag</title>
   <link href="https://gerardozamudio.mx/2010/10/01/im-on-a-lag/"/>
   <updated>2010-10-01T11:44:04-05:00</updated>
   <id>https://gerardozamudio.mx/2010/10/01/im-on-a-lag</id>
   <content type="html">&lt;p&gt;&lt;img src=&quot;/images/cutting_edge.png&quot; alt=&quot;I'm on a lag&quot; /&gt;&lt;/p&gt;

&lt;p&gt;That xkcd comic reminds me an awful lot of myself. I still haven’t finished Half-life, I’ve yet to play Half-life 2 and all other expansion packs, and I’ve yet to play Portal. By the time I get done with these games everyone else will be enjoying Half-life 3 and Portal 2…along with whatever next generation system is out at the time.&lt;/p&gt;

&lt;!--more--&gt;

&lt;p&gt;Not to say I haven’t been trying. I’m almost done with the first game. Since I have internet now, I’ve been trying to catch up on lost time with all my Steam games. I even purched Garry’s Mod yesterday since it was their last day of the $4.99USD deal. I tried hopping on some Counter-Strike servers but it doesn’t seem to be working. It might have something to do with my download speed. Let us compare…&lt;/p&gt;

&lt;div class=&quot;center&quot;&gt;
&lt;figure class=&quot;embed dark&quot;&gt;
	&lt;a href=&quot;/images/better_speed_test.png&quot;&gt;&lt;img src=&quot;/images/better_speed_test.png&quot; alt=&quot;33.87Mb/s down, 1.70Mb/s up&quot; /&gt;&lt;/a&gt;
	&lt;figcaption&gt;
	Where I was before...
	&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;/div&gt;

&lt;div class=&quot;center&quot;&gt;
&lt;figure class=&quot;embed dark&quot;&gt;
	&lt;a href=&quot;/images/speed_test.jpg&quot;&gt;&lt;img src=&quot;/images/speed_test.jpg&quot; alt=&quot;0.99Mb/s down, 0.09Mb/s up&quot; /&gt;&lt;/a&gt;
	&lt;figcaption&gt;
	Where I am now
	&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;/div&gt;

&lt;p&gt;Seriously.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Telmex is now my ISP</title>
   <link href="https://gerardozamudio.mx/2010/09/22/telmex-is-now-my-isp/"/>
   <updated>2010-09-22T15:00:01-05:00</updated>
   <id>https://gerardozamudio.mx/2010/09/22/telmex-is-now-my-isp</id>
   <content type="html">&lt;p&gt;&lt;img src=&quot;/images/telmex_store.jpg&quot; alt=&quot;Telmex is now my ISP&quot; /&gt;&lt;/p&gt;

&lt;p&gt;It feels good to be able to update from the comfort of my bedroom! A Telmex technician showed up at our house Monday morning to set up the land line and do the wall jack installation. I was pleased when they called my cell phone first to confirm that they would be there in about an hour and asked if I would prefer another time.&lt;/p&gt;

&lt;!--more--&gt;

&lt;p&gt;Once everything was good to go, I was told I had to go to the nearest Telmex dealer and pick up my modem. That day my shift ended at 6:00pm, so I tried really hard to make it to the nearest store on time to pick it up. It turns out all Telmex stores close at 6:00pm, so I had to wait yet another day to pick it up. I wasn’t going to take a half-day from work just go pick this thing up, so I called and asked if anyone else could do it for me. They said someone else could pick it up as long as they provided a copy of my ID card. Luckily, I keep a spare at home. I called my wife and she promptly went to go pick up the modem.&lt;/p&gt;

&lt;p&gt;I was surprised by the packaging of the modem once I got home. The box itself was sturdy and the inside was padded well. The modem is an &lt;a href=&quot;http://www.thomsonbroadbandpartner.com/dsl-modems-gateways/products/product-detail.php?id=161&quot; title=&quot;ADSL2+ Thomson TG585V7&quot;&gt;ADSL2+ Thomson TG585V7&lt;/a&gt;. It came with an Ethernet cable, phone cable, power adapter, user’s guide, installation disc (?), and a quick start guide. There was also a small card where I’m supposed to write down my Telmex email user name and password. How cute.&lt;/p&gt;

&lt;div class=&quot;center&quot;&gt;
&lt;figure class=&quot;embed dark&quot;&gt;
	&lt;a href=&quot;/images/thomson_TG585V7.jpg&quot;&gt;&lt;img src=&quot;/images/thomson_TG585V7.jpg&quot; alt=&quot;Thomson TG585V7 ADSL2+ Modem&quot; /&gt;&lt;/a&gt;
	&lt;figcaption&gt;
	The Thomson TG585V7 ADSL2+ modem from Telmex
	&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;/div&gt;

&lt;p&gt;I didn’t bother with the installation disc and didn’t bother to check what it is for. It’s supposed to set up the internet connection for you and install some sort of anti virus software with parental controls, I think. I don’t really need any of that stuff so I just plugged in the modem and waited for the DSL light to be solid green. Everything worked right out of the box - no additional configuration needed.&lt;/p&gt;

&lt;p&gt;The Windows installation disc I have is slightly out of date. Like, from 2002 out of date. Believe me, installing Service Pack 3 and all the security updates on a 1MB connection is not enjoyable. I did get a kick out of Windows nagging me every two seconds that my computer was out of date. It made me wonder how there are still people out there that run out of date software.&lt;/p&gt;

&lt;div class=&quot;center&quot;&gt;
&lt;figure class=&quot;embed dark&quot;&gt;
	&lt;a href=&quot;/images/updating_windows.jpg&quot;&gt;&lt;img src=&quot;/images/updating_windows.jpg&quot; alt=&quot;Windows Update&quot; /&gt;&lt;/a&gt;
	&lt;figcaption&gt;
	I found myself staring at this update screen almost all night
	&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;/div&gt;

&lt;p&gt;It might sound weird that I’m installing Windows XP on a brand new computer, but there’s really no other option. I didn’t actually pay for my Windows disc (someone gave it to me) and if I want to buy Windows 7 I’d have to shell out $199.99USD, which is money I don’t have right now. Sure, I could install any Linux distribution but I’m not too keen on the dual-booting configuration. I’ll slap &lt;a href=&quot;http://www.archlinux.org/&quot; title=&quot;Arch Linux&quot;&gt;Arch Linux&lt;/a&gt; on that old machine I have lying around as soon as I get a monitor and keyboard for it. I’ll update when I get around to that.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>The troubles of finding a decent ISP</title>
   <link href="https://gerardozamudio.mx/2010/09/20/the-troubles-of-finding-a-decent-isp/"/>
   <updated>2010-09-20T16:21:03-05:00</updated>
   <id>https://gerardozamudio.mx/2010/09/20/the-troubles-of-finding-a-decent-isp</id>
   <content type="html">&lt;p&gt;By the end of September, I will have gone one year without having internet access at home. During this year, I’ve switched homes three times and switched jobs four times. I think I’m finally at a stable point in my life - at least stable enough to commit to a 1-year rental lease.&lt;/p&gt;

&lt;!--more--&gt;

&lt;table&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;A while back I briefly [mentioned](http://gerardozamudio.net/2010/08/27/questionable-content-and-indie-girls/ “gerardozamudio.net&lt;/td&gt;
      &lt;td&gt;Questionable Content and Indie Girls”) that I finally got around to buying a desktop PC. Sure, everyone’s buying netbooks and &lt;a href=&quot;http://www.apple.com/ipad/&quot; title=&quot;Apple iPad&quot;&gt;those pad things&lt;/a&gt; but I know I’m not the only one that thinks &lt;a href=&quot;http://gizmodo.com/5532511/netboooks-are-dead-baby-netbooks-are-dead&quot; title=&quot;Netbooks are dead baby, netbooks are dead&quot;&gt;the notebook is dead&lt;/a&gt;. Nothing beats a good ol’ desktop PC with a keyboard and mouse. I’m still planning on posting a brief overview of the computer specs and what it’s been like so far, don’t think I forgot.&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;Getting the computer was the first step. Living in an “&lt;a href=&quot;http://en.wikipedia.org/wiki/Developing_country&quot;&gt;emerging and developing&lt;/a&gt;” country makes it rather difficult to come by a reliable Internet Service Provider, so my choices were limited. I could’ve easily gone the easy way and signed up for Carlos Slim’s telephone/internet monopoly, &lt;a href=&quot;http://www.telmex.com/mx/&quot; title=&quot;Telmex&quot;&gt;Telmex&lt;/a&gt;. But where’s the fun in that? Instead, I hopped online and looked for some alternatives. The one I already had in mind was &lt;a href=&quot;http://www.cablevision.net.mx/appmanager/cablevision/portal?_nfpb=true&amp;amp;_portlet.async=false&amp;amp;_pageLabel=cablevision_portal_page_home&amp;amp;_nfto=false&quot; title=&quot;Cablevision&quot;&gt;Cablevision&lt;/a&gt;, a newcomer to online services in the area. They offer a 2MB download speed through cable (6MB in some areas). Unfortunately, when I called them they informed me their services were not available in my area because the infrastructure wasn’t fully developed. I did a bit more research and the only other ISP in my area was &lt;a href=&quot;http://www.axtel.mx/servicios/casa/internet/acceso_universal/internet_mas_telefono&quot; title=&quot;Axtel&quot;&gt;Axtel&lt;/a&gt;. They were quite friendly. I called them and the sales representative curteously gave me a rundown of all their bundles. I signed up for their 2MB DSL service with a landline that includes 200 local calls. Yes, there’s no such thing as unlimited of anything here. Yes, I did ask. I thought it was pretty good considering Telmex was giving me the same thing for $16.44USD more. They said there was a $15.66USD “contract fee” and if I payed it by 4:00pm that day, the installation people would be at my house in two days. These guys really want my business, don’t they? I took a quick break from work and walked over to the nearest bank to make the deposit. Sure enough, within two days there was Axtel at my front door ready to do all the cabling that was needed.&lt;/p&gt;

&lt;p&gt;Here’s where it gets kind of disappointing. They fooled around a bit on the roof of my house and proceeded to inform me that they could not get a signal because the house is located near the bottom of a hill. I know the technicians are just outsourced contractors that don’t really work for Axtel, but they were nice about it. They said I should call and ask for my deposit back, which I did. The original sales representative was also thoughtful enough to give me his direct extension so I didn’t have to wait in the call queue for someone to pick up the phone. The guy informed me that I would have to wait 5 business days for the refund to go through and that I would have to go to one of their offices and pick it up myself. That part was not pleasant considering the fact that the next three days were holidays, plus the weekend. I’d have to wait 11 regular days for my refund.&lt;/p&gt;

&lt;p&gt;The next day I gave in and called Telmex. I gave them my address and they said they could not find my interior number in their system, which meant I would have to go to a Telmex office and order it in person. They were not open to suggestions, either. I asked if I could just put down my neighbor’s interior number, they said no. I asked if they could send the technicians to the house and I’d show them which was the correct one, and they said no. After all, they’ve got &lt;a href=&quot;http://www.foxbusiness.com/story/markets/industries/entertainment/mexicos-telmex-q-net-seen--weak-sales-forex/&quot;&gt;80% of the country&lt;/a&gt; in their back pocket. It’s not like they need my business. I had to ignore all this and just show up in person. The lady at the counter hardly even looked at me and spoke so fast I couldn’t understand what she was saying. I must have done something right, though, because she informed me a technician would be at my home within 8 business days.&lt;/p&gt;

&lt;p&gt;I’m (reluctantly) happy to say that today in the morning a Telmex technician showed up and took no more than 20 minutes to set up the phone line. I don’t own a house phone so I couldn’t verify if there was dial tone, but he said it should work just fine. I’ve also been told I can go pick up my modem from the Telmex office I ordered the service from. How fun.&lt;/p&gt;

&lt;p&gt;I really wish I could have gone with Axtel. Minus the refund thing, they were pretty attentive whenever I spoke with them. I worked as a Technical Support Specialist for a major American ISP a few months ago and these people’s service is a thousand times better as far as I’m concerned. I’m really excited to get home today and set everything up. I’ll be posting soon about how that goes, hopefully from the comfort of my bedroom :)&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Questionable Content and Indie Girls</title>
   <link href="https://gerardozamudio.mx/2010/08/27/questionable-content-and-indie-girls/"/>
   <updated>2010-08-27T15:09:46-05:00</updated>
   <id>https://gerardozamudio.mx/2010/08/27/questionable-content-and-indie-girls</id>
   <content type="html">&lt;p&gt;&lt;img src=&quot;/images/questionable_content_logo.png&quot; alt=&quot;Questionable Content and Indie Girls&quot; /&gt;&lt;/p&gt;

&lt;p&gt;While reading the latest &lt;a href=&quot;http://xkcd.com/785/&quot; title=&quot;xkcd: Open Mic Night&quot;&gt;XKCD&lt;/a&gt;, I started looking all over the site for the link to the &lt;strong&gt;unixkcd&lt;/strong&gt; that was featured on April 1st (I eventually &lt;a href=&quot;http://uni.xkcd.com/&quot; title=&quot;unixkcd&quot;&gt;found it&lt;/a&gt;). I’ve always been aware of the “Comics I Enjoy” links toward the bottom of the page but I’ve never actually clicked on any. I went through a couple and the one that caught my interest was &lt;a href=&quot;http://questionablecontent.net/&quot; title=&quot;Questionable Content&quot;&gt;Questionable Content&lt;/a&gt; by Jeph Jacques.&lt;/p&gt;

&lt;!--more--&gt;

&lt;p&gt;The last comic put up is &lt;strong&gt;#1740&lt;/strong&gt;. Yep, over one thousand strips. I decided to start reading the comic from the beginning and I’ve got to say I love it so far. I got up to &lt;a href=&quot;http://questionablecontent.net/view.php?comic=38&quot; title=&quot;Number Thirty-Eight: Definition of a Term&quot;&gt;#38&lt;/a&gt; and stopped abruptly. Nearly every comic up to that point contains a few paragraphs below it with some updates from the artist regarding the site, the comic itself and other bits of information. In this particular one, Jeph links to that &lt;a href=&quot;http://endofworld.net/&quot; title=&quot;End of the World Flash Animation&quot;&gt;End of the World&lt;/a&gt; flash animation that was so popular back in the early 2000’s and was most likely one of the first internet videos I saw.&lt;/p&gt;

&lt;p&gt;It made me think back at all the stuff that was cool amongst the internet in 2003 how much things have changed. It’s enough to mention that the first time I saw that video it took about a half hour to load, I had an old eMachines with 256mb RAM and dial-up service with AOL software bundled. In the comics before that, the artist made references to installing iTunes for the first time and wanting a Power Mac G5. I remember getting my first and only iPod around that time. Looking at it now, it weighs a ton, doesn’t have color, and I can’t believe I thought 20GB was a lot. How could they not make an MP3 player with a color screen in 2003?!&lt;/p&gt;

&lt;p&gt;Anyway, another thing the comic mentions a lot are indie girls! According to &lt;a href=&quot;http://www.urbandictionary.com/define.php?term=Indie%20Girl&quot; title=&quot;Urban Dictionary: Indie Girl&quot;&gt;Urban Dictionary&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
  &lt;p&gt;They listen to music that you’ve probably never heard of, wear what they want and are usually in touch with subjects that allow them to express themselves such as textiles,art,media,music and photography.
That made me laugh out loud. I’ve never really thought about the term a lot but if an indie girl is anything like Faye (or Zooey Deschanel), then I’m all for it. Incidentally, a picture of Zooey is one of the first things that popped up when I Googled “indie girl” and is the subject on a blog post on &lt;a href=&quot;http://www.wolfgnards.com/index.php/2009/07/12/indie-girls-deconstructed&quot; title=&quot;Indie Girls Deconstructed&quot;&gt;Indie Girls Deconstructed&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class=&quot;center&quot;&gt;
&lt;figure class=&quot;embed dark&quot;&gt;
	&lt;a href=&quot;/images/zooey-deschanel-bangs1.jpg&quot;&gt;&lt;img src=&quot;/images/zooey-deschanel-bangs1.jpg&quot; alt=&quot;Zooey Deschanel Indie Girl&quot; /&gt;&lt;/a&gt;
	&lt;figcaption&gt;
	Is this what an indie girl looks like?
	&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;/div&gt;

&lt;p&gt;I loved her in &lt;a href=&quot;http://www.imdb.com/title/tt0349416/&quot; title=&quot;Eulogy (2004)&quot;&gt;Eulogy&lt;/a&gt; and it remains one of my favorite movies. It was also released in 2004, so it totally goes with the theme of this post.&lt;/p&gt;

&lt;p&gt;I should also mention that I finally bought a computer. Upcoming post about that, so stay tuned.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Project Upstream</title>
   <link href="https://gerardozamudio.mx/2010/08/09/project-upstream/"/>
   <updated>2010-08-09T20:01:21-05:00</updated>
   <id>https://gerardozamudio.mx/2010/08/09/project-upstream</id>
   <content type="html">&lt;p&gt;&lt;img src=&quot;/images/project_upstream.png&quot; alt=&quot;Project Upstream&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Earlier today I received a rather simple yet strange instant message on AIM. The strange thing about it was that the other person’s screen name was in the form of a 9-digit number. I really didn’t think it was an &lt;a href=&quot;http://www.icq.com/&quot;&gt;ICQ&lt;/a&gt; number and it was one digit too short to be a U.S phone number. I Googled the first three digits just to make sure it wasn’t a phone number and it turns out 614 is the area code for Columbus, OH. I don’t know anybody from Ohio, so I responded.&lt;/p&gt;

&lt;!--more--&gt;

&lt;blockquote&gt;
  &lt;p&gt;me:  Hey&lt;/p&gt;

  &lt;p&gt;614929371:  hi?&lt;/p&gt;

  &lt;p&gt;me:  You said hi first.&lt;/p&gt;

  &lt;p&gt;614929371:  haha who are you?&lt;/p&gt;

  &lt;p&gt;me:  You said hi first.. who are YOU?&lt;/p&gt;

  &lt;p&gt;614929371:  hmm i think youre project upstream?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A quick Google search took me to the &lt;a href=&quot;http://project-upstream.awardspace.com/&quot;&gt;Project Upstream&lt;/a&gt; website. Upon reading their website description, I remembered what this was all about. It turns out Project Upstream is the new name for a project that used Salmon-themed screen names (FlavoredSalmon, SenileSalmon, CannedSalmon, etc ) to get two strangers to talk to each other. Both users would receive a message and would be connected if they responded. The screen names have also been known to end in -Coho or -Trout. This project also used to be called &lt;strong&gt;“The Great Hatsby”&lt;/strong&gt;. This is the description from an archived &lt;a href=&quot;http://en.wikipedia.org&quot;&gt;Wikipedia&lt;/a&gt; page, since the current one has been deleted:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;The Great Hatsby is the name of an &lt;a href=&quot;http://www.aim.com/&quot;&gt;AIM&lt;/a&gt; Bot  that instigates conversation between two totally unrelated people. Its name is a play on words from the book &lt;span style=&quot;text-decoration: underline;&quot;&gt;The Great Gatsby&lt;/span&gt;. It is a relay bot that retrieves the most recently updated &lt;a href=&quot;http://www.livejournal.com&quot;&gt;LiveJournal&lt;/a&gt; posts and obtains the AIM screenname  of the posting user. It then sends the user the message “I say, old bean, have you seen my hat?” Responses from users are then forwarded by the bot to another one of the users similarly contacted. From this both users are typically confused insisting the other messaged them first and try to figure out what is going on&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you &lt;a href=&quot;http://answers.yahoo.com/question/index?qid=20080623074154AAywnYa&quot;&gt;find it annoying&lt;/a&gt;, there’s a way to opt out from these messages. When you get a message from a screen name ending in Trout, Coho, or Salmon simply type &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$optout&lt;/code&gt; and it will respond with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;OPERATOR: Are you sure you want to opt-out? If you do, you will *never* be contacted again on the account. There is *no way* to opt back in and undo this. If you are sure, type $optout DADD. Remember, this is permanent and irreversible!&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Once you type &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$optout DADD&lt;/code&gt; to verify you are sure, you will see &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;OPERATOR: You have opted out. The account will *never* be contacted again. Good bye!&lt;/code&gt; and you will never be contacted again - in theory.&lt;/p&gt;

&lt;p&gt;Personally, I think it’s a neat social experiment to connect strangers online. I remember posting a some conversations on the &lt;a href=&quot;http://community.livejournal.com/themissinghat&quot;&gt;themissinghat LiveJournal community&lt;/a&gt; a few years back when I first received one of these messages. Based on the most recent posts, it seems the bot screen names have now shifted to variants with numbers. If you want to opt-in and receive these messages, head over to the &lt;a href=&quot;http://project-upstream.awardspace.com/&quot;&gt;Project Upstream&lt;/a&gt; website, type in your screen name, and wait!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Edit Google Docs In Nautilus</title>
   <link href="https://gerardozamudio.mx/2010/07/21/edit-google-docs-in-nautilus/"/>
   <updated>2010-07-21T14:41:34-05:00</updated>
   <id>https://gerardozamudio.mx/2010/07/21/edit-google-docs-in-nautilus</id>
   <content type="html">&lt;p&gt;If you’ve ever needed a way to edit your Google Docs files from your Ubuntu Linux desktop, &lt;a href=&quot;http://doctormo.org/2010/07/20/google-doc-mount&quot; title=&quot;Google Doc Mount&quot;&gt;DoctorMo’s Google Doc Mount&lt;/a&gt; is just for you. Once installed, this nifty piece of software will do just that - mount your Google Docs files as a drive on your desktop.&lt;/p&gt;

&lt;!--more--&gt;

&lt;p&gt;You can open up a document in a word processor to edit it and any changes you make will also show up on Google Docs. To store them locally, simply drag and drop from the Nautilus window to the desktop. From DoctorMo:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;If you try this, remember that it’s not a supported piece of software,  bugs aren’t likely to be fixed (unless you fix them of course) the &lt;a href=&quot;https://code.launchpad.net/%7Edoctormo/doctormo-random/gdocs-mount&quot;&gt;code  is available&lt;/a&gt; and it should work on Lucid. It won’t be ported to any  other versions (at least by me) but it should be easy to recompile  everything for other versions anyway&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Keep in mind that you are required to type in your username and password every time you use it.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>New Google Image Search Results Page</title>
   <link href="https://gerardozamudio.mx/2010/07/20/new-google-image-search-results-page/"/>
   <updated>2010-07-20T21:24:54-05:00</updated>
   <id>https://gerardozamudio.mx/2010/07/20/new-google-image-search-results-page</id>
   <content type="html">&lt;p&gt;I realize I’m a little late on this, but it’s difficult to do a small write up during a busy workday. Well, today &lt;a href=&quot;http://googleblog.blogspot.com/2010/07/ooh-ahh-google-images-presents-nicer.html&quot; title=&quot;Ooh! Ahh! Google Images presents a nicer way to surf the visual web&quot;&gt;Google announced&lt;/a&gt; the release of a revamped &lt;a href=&quot;http://images.google.com/&quot; title=&quot;Google Images&quot;&gt;Google Image Search&lt;/a&gt; results page. The new results page features more focus on the images than before.&lt;/p&gt;

&lt;!--more--&gt;

&lt;p&gt;Another change that has taken place is the new landing page. When you click on an image, you will no longer be taken to the destination website inside a Google frame. Instead, you will get the image in full size on top of the website where it is located.&lt;/p&gt;

&lt;div class=&quot;center&quot;&gt;
&lt;figure class=&quot;embed dark&quot;&gt;
	&lt;a href=&quot;/images/google_images.jpg&quot;&gt;&lt;img src=&quot;/images/google_images.jpg&quot; alt=&quot;Screenshot of Google Image results page&quot; /&gt;&lt;/a&gt;
	&lt;figcaption&gt;
	The new results page puts more focus on the imgages
	&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;/div&gt;

&lt;p&gt;Here’s a rundown of the new features:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Dense tiled layout designed to make it easy to look at lots of images at once. We want to get the app out of the way so you can find what you’re really looking for.&lt;/li&gt;
  &lt;li&gt;Instant scrolling between pages, without letting you get lost in the images. You can now get up to 1,000 images, all in one scrolling page. And we’ll show small, unobtrusive page numbers so you don’t lose track of where you are.&lt;/li&gt;
  &lt;li&gt;Larger thumbnail previews on the results page, designed for modern browsers and high-res screens.&lt;/li&gt;
  &lt;li&gt;A hover pane that appears when you mouse over a given thumbnail image, giving you a larger preview, more info about the image and other image-specific features such as “Similar images.”&lt;/li&gt;
  &lt;li&gt;Once you click on an image, you’re taken to a new landing page that displays a large image in context, with the website it’s hosted on visible right behind it. Click anywhere outside the image, and you’re right in the original page where you can learn more about the source and context.&lt;/li&gt;
  &lt;li&gt;Optimized keyboard navigation for faster scrolling through many pages, taking advantage of standard web keyboard shortcuts such as Page Up / Page Down. It’s all about getting you to the info you need quickly, so you can get on with actually building that treehouse or buying those flowers.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I particularly like the web keyboard shortcuts part. They should really adopt this for their search results, too. It’s a pain having to keep clicking and navigating page after page to find the result I want. Hitting the spacebar or just tapping the Page Down button would be far quicker. Some people say the new results page &lt;a href=&quot;http://www.onenewspage.com/news/Technology/20100720/13222799/Google-Images-Makeover-Looks-an-Awful-Lot-Like.htm&quot; title=&quot;Google Images Makeover Looks an Awful Lot Like Bing&quot;&gt;looks a lot like Bing’s&lt;/a&gt; image search. This wouldn’t be the first time Google is accused of copying Bing. When they gave users the ability to change the Google homepage background image last month, many felt frustrated at &lt;a href=&quot;http://www.pcmag.com/article2/0,2817,2364601,00.asp&quot; title=&quot;Google&quot;&gt;how much it resembled&lt;/a&gt; Bing’s homepage. I hope they don’t keep releasing similar features to Bing. I come to Google for their minimalism and accurate search results. If I wanted to be distracted by as many things as possible I’d use Yahoo or Bing.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>My New Home</title>
   <link href="https://gerardozamudio.mx/2010/07/19/my-new-home/"/>
   <updated>2010-07-19T21:26:59-05:00</updated>
   <id>https://gerardozamudio.mx/2010/07/19/my-new-home</id>
   <content type="html">&lt;p&gt;This is going to be my new home on the net. I look forward to updating quite often.&lt;/p&gt;
</content>
 </entry>
 

</feed>
