<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet title="XSL formatting" type="text/xsl" href="https://uname.pingveno.net/blog/index.php/feed/rss2/xslt" ?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title># uname -a - Mot-clé - server</title>
    <link>https://uname.pingveno.net/blog/index.php/</link>
    <atom:link href="https://uname.pingveno.net/blog/index.php/feed/tag/server/rss2" rel="self" type="application/rss+xml" />
    <description>Le blog de uname.pingveno.net</description>
    <language>fr</language>
    <pubDate>Tue, 18 Aug 2026 13:46:21 +0200</pubDate>
    <copyright>Mathieu Pellegrin</copyright>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <generator>Dotclear</generator>
          <item>
        <title>The war on SPAM: an review of the real world tools</title>
        <link>https://uname.pingveno.net/blog/index.php/post/2017/09/12/The-war-on-SPAM%3A-an-review-of-the-real-world-tools</link>
        <guid isPermaLink="false">urn:md5:61e3fbc7776ac7b0952799741974f844</guid>
        <pubDate>Tue, 12 Sep 2017 02:54:00 +0200</pubDate>
        <dc:creator>Mathieu</dc:creator>
                  <category>Informatique</category>
                          <category>blacklist</category>
                  <category>dkim</category>
                  <category>dmarc</category>
                  <category>greylist</category>
                  <category>mail</category>
                  <category>rbl</category>
                  <category>server</category>
                  <category>spam</category>
                  <category>spf</category>
                <description>&lt;p&gt;Anti-spam techniques review: a few hints and tools review from my own experience.&lt;/p&gt;

&lt;p&gt;Spam mesage are very common these days, but filtering them out is not as easy as it seems. The filtering techniques have evolved at the same rate than the spammers' evasive techniques, and the risk of filtering out a legitimate message is greater than ever.&lt;/p&gt;

&lt;p&gt;It is also quite difficult to find good and up-to-date counter-measures list that anyone can implement.&lt;/p&gt;

&lt;p&gt;Here is a summary of the anti-spam strategies I used / am still using. I hope it will help you understanding today's threats, and build your own solutions.&lt;/p&gt;          &lt;h3&gt;Definitions&lt;/h3&gt;

&lt;ul&gt;
	&lt;li&gt;
	&lt;p&gt;&lt;strong&gt;MTA&lt;/strong&gt; : Mail Transport Agent : this is the software that will actually do mail delivery. It is listening on port 25 and answers to SMTP commands. Some common MTAs : Postfix, Exim. &lt;a href=&quot;https://en.wikipedia.org/wiki/Message_transfer_agent&quot;&gt;More about MTA&lt;/a&gt;.&lt;/p&gt;
	&lt;/li&gt;
	&lt;li&gt;
	&lt;p&gt;&lt;strong&gt;MX&lt;/strong&gt; : MX records are DNS entries that are identifying the server responsible for mail delivery for the domain. &lt;a href=&quot;https://en.wikipedia.org/wiki/MX_record&quot; hreflang=&quot;en&quot;&gt;More about MX records&lt;/a&gt;.&lt;/p&gt;
	&lt;/li&gt;
	&lt;li&gt;
	&lt;p&gt;&lt;strong&gt;RBL&lt;/strong&gt; : Realtime Blackhole List : a list of blacklisted IPs, that should be considered as spam sources. It is called Realtime because they are constantly updated. &lt;a href=&quot;https://en.wikipedia.org/wiki/DNSBL&quot;&gt;More about RBL&lt;/a&gt;.&lt;/p&gt;
	&lt;/li&gt;
	&lt;li&gt;
	&lt;p&gt;&lt;strong&gt;RFC&lt;/strong&gt; : Request For Comments, these are proposal for norms, some of them become norms. &lt;a href=&quot;https://en.wikipedia.org/wiki/Request_for_comments&quot;&gt;More about RFC&lt;/a&gt;.&lt;/p&gt;
	&lt;/li&gt;
	&lt;li&gt;
	&lt;p&gt;&lt;strong&gt;IPS&lt;/strong&gt; : Intrusion Protection System : these are &quot;smart firewalls&quot; that are blocking malicious requests, often based on behavioral rules. &lt;a href=&quot;https://en.wikipedia.org/wiki/Intrusion_detection_system&quot; hreflang=&quot;en&quot;&gt;More about IPS&lt;/a&gt;.&lt;/p&gt;
	&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;The goals&lt;/h3&gt;

&lt;p&gt;My personal goals on SPAM war are pretty short:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;
	&lt;p&gt;Minimum false positive: having a spam is better than missing an important mail, try keeping the &quot;permanent bashing&quot; as low as possible&lt;/p&gt;
	&lt;/li&gt;
	&lt;li&gt;
	&lt;p&gt;Hit harder on reoffending: coming-back spammers should be slapped harder&lt;/p&gt;
	&lt;/li&gt;
	&lt;li&gt;
	&lt;p&gt;Internet neutrality: try not to encourage big mail farm, and let fair little providers doing their business&lt;/p&gt;
	&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Available techniques&lt;/h3&gt;

&lt;h4&gt;Blacklist / Blackhole Lists&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Blacklists&lt;/strong&gt;, &lt;strong&gt;Blackhole Lists&lt;/strong&gt; (or &lt;strong&gt;RBLs&lt;/strong&gt;) are the most ancient and most common measures for reducing spam. They are still pretty accurate, but:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;It depends A LOT on the &lt;strong&gt;quality of the list&lt;/strong&gt;, trashy lists are very common and they would end up sucking resources for no result, or worse, blocking legitimate emails&lt;/li&gt;
	&lt;li&gt;They are only accurate when &lt;strong&gt;updated often&lt;/strong&gt;. I mean, very often (the R in RBL).&lt;/li&gt;
	&lt;li&gt;You &lt;strong&gt;should not use it directly on the MTA&lt;/strong&gt;, these lists are an &lt;strong&gt;aggressive&lt;/strong&gt; artefact of the past, where spam did not come from mail farms.&lt;/li&gt;
	&lt;li&gt;Very &lt;strong&gt;few are implementing IPv6&lt;/strong&gt;, I agree that IPv6 spam is quite anecdotal, but it will probably change pretty soon (believe me)&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Greylist&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Greylisting&lt;/strong&gt; is issuing a temporary &lt;strong&gt;REJECT&lt;/strong&gt; code to force the foreign server to keep the message and send it back later. It aims at increasing the &quot;cost per mail&quot; for spam farms, as they cannot &quot;hit and run&quot; as fast as before.&lt;/p&gt;

&lt;p&gt;The main culprits are that &lt;strong&gt;some providers are not implementing it well&lt;/strong&gt; (hello Facebook) and so it needs an educated whitelist to work properly.&lt;/p&gt;

&lt;p&gt;Some spammers are also re-sending the same mail several times in case of failure, looking like a legitimate mail server, and making &lt;strong&gt;Greylisting&lt;/strong&gt; inefficient.&lt;/p&gt;

&lt;p&gt;It is also hurting the fastness of the mail transmission, as the retry may occur several tens minutes after, &lt;strong&gt;slowing the mail delivery&lt;/strong&gt; with little control on delays.&lt;/p&gt;

&lt;p&gt;Also, some legitimate mail farms (hello OVH) are distributing their retry on several servers, making &lt;strong&gt;Greylisting&lt;/strong&gt; inapplicable without fully whitelisting them.&lt;/p&gt;

&lt;h4&gt;RFC compliance&lt;/h4&gt;

&lt;p&gt;Spammers are often running special softwares for their crafted emails, tightening &lt;strong&gt;RFC compliance&lt;/strong&gt; may be a good way to kick them out.&lt;/p&gt;

&lt;p&gt;It can be as simple as &lt;strong&gt;forcing an HELO on SMTP protocol&lt;/strong&gt;, or more tricky like &lt;strong&gt;checking the mail headers&lt;/strong&gt; or &lt;strong&gt;enforcing a valid reverse&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In the majority of cases, it is very efficient, but:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;Some home-made servers, especially Synology or Windows servers may be blocked while they are sending legitimate email. These servers are often ran by people who doesn't know or care on how to correctly setup a mail server. These buggy setups are more common than you think, and they are often legitimate senders, who have no clue of what is wrong, and are not willing to fix it (did I mentioned banking companies?).&lt;/li&gt;
	&lt;li&gt;In the vast majority of cases, IPv6-ready servers have no reverse on their IPv6 addresses and/or the IPv6 reverse is wrong.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;SPF and DKIM&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;SPF&lt;/strong&gt; and &lt;strong&gt;DKIM&lt;/strong&gt; are anti-spoofing techniques. They does not guarantee that a mail is legitimate, but if the controls are showing an anomaly, it is very likely to be spam (or worse : scam or social engineering tentative).&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;The &lt;strong&gt;SPF&lt;/strong&gt; technique is based on IP or sending domain whitelist: the sending email domain publishes a list of servers allowed to send email, along with a hint on what is expected if it does not pass (soft or hard reject).&lt;/li&gt;
	&lt;li&gt;&lt;strong&gt;DKIM&lt;/strong&gt; is much more complex as the sending mail server has to cryptographically sign every message with a domain-specific key, which is then published in a special domain record.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;SPF&lt;/strong&gt; has been proven efficient at its beginnings, but today many spammers are just using stolen email accounts or custom domains that does not publish any &lt;strong&gt;SPF&lt;/strong&gt; records, making it less pertinent.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;DKIM&lt;/strong&gt; is, like &lt;strong&gt;SPF&lt;/strong&gt;, an anti spoofing technique, and spammers may be likely to sign mails from their custom domain if it becomes a necessity. Like &lt;strong&gt;SPF&lt;/strong&gt;, a signed mail is not necessarily a clean mail. By the way, signature problems are pretty comon, and trashing an offending &lt;strong&gt;DKIM&lt;/strong&gt; may not be the right behavior: Yahoo broke a lot of mailing lists when they enforced their &lt;strong&gt;DMARC&lt;/strong&gt; policy.&lt;/p&gt;

&lt;p&gt;To conclude, &lt;strong&gt;DKIM&lt;/strong&gt; is relevant if you need to certify outgoing mails or if you are enforcing policies inside your company (to block spoofed email targeting your organisation) but it is definitely not an efficient anti-spam measure. And the recipient's servers may decide to simply ignore your painfully-configured DKIM headers.&lt;/p&gt;

&lt;h4&gt;Bayesian filters&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Bayesian filters&lt;/strong&gt; are frequency-based spam detection mechanisms. The idea is to sort out ham and spam for a short period of time, to let it &quot;learn&quot; what spam is made of, for efficient content-based detection. It has the benefit of being organisation-specific, as what is ham and what is spam may vary from one company to another (a company selling drugs may not be willing to filter out every message containing the word &quot;pill&quot;).&lt;/p&gt;

&lt;p&gt;But the learning process has to be taken seriously, and many end-users are just deleting spam instead of marking it for feeding the learning. By the way, the learning process needs IMAP folders to sort mails, and it will not work properly if all users are using POP mailboxes.&lt;/p&gt;

&lt;h3&gt;Spammers techniques&lt;/h3&gt;

&lt;p&gt;Or &quot;the today's weapons of this war&quot; .&lt;/p&gt;

&lt;p&gt;Here is a short review of the spammers techniques I know, and some counter measures.&lt;/p&gt;

&lt;h4&gt;Address guessing&lt;/h4&gt;

&lt;p&gt;Some spammers are taking random web domains from their crawling, and then try to send their mails to commonly used addresses patterns. It can be webmaster@ ; ceo@ or whatever. These are easy to spot in log files, and a well configured MTA can take counter measures to lock out these guesses. Free (French ISP) is actually implementing this: &lt;a href=&quot;http://postmaster.free.fr/index_en.html&quot; hreflang=&quot;en&quot;&gt;postmaster.free.fr/index_en.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Unfortunately, some legitimate email are sometimes sent to non existent addresses (typo, user deleted, etc) and legitimate MTA sometimes get blocked if the ban trigger is too low.&lt;/p&gt;

&lt;p&gt;Moreover, nowadays' spammers are distributing their guesses trough zombie machines to stay under triggers, making it hard to spot.&lt;/p&gt;

&lt;h4&gt;Botnets&lt;/h4&gt;

&lt;p&gt;A lot of spammers are using zombies machines to send a high amount of mail in a short amount of time. Commercial ISP are taking the problem seriously, and many are blocking or filtering port 25 on their dynamic ranges, making impossible to have a custom mail server at home, but also preventing infected machines from sending direct-to-SMTP queries.&lt;/p&gt;

&lt;h4&gt;Direct to SMTP connections, ignoring MXes&lt;/h4&gt;

&lt;p&gt;Some spammers are just scanning IP ranges and directly talking to MTA, even if these MTAs are internal and pointed by no MX records. You may think that an authoritarian firewall is the neat solution, but it may be worth collecting these feisty IPs and feed them to an IPS, to protect the network from their guesses on the real MTAs.&lt;/p&gt;

&lt;h4&gt;Fake bounces and backsquatting&lt;/h4&gt;

&lt;p&gt;Sometimes you get an Undelivered Message notice (DSN) for a mail you never sent. This is probably backsquatting.&lt;br /&gt;
Backsquatting is sending email to a buggy address with a valid &quot;from&quot; address. An incorrectly configured mailserver would reply straight away to the from address to notify the failed delivery, instead of rejecting the mail and letting the foreign server doing the dirty job.&lt;/p&gt;

&lt;p&gt;These configuration errors are pretty common, sometimes in defaut configurations or example configurations, but they can be easily avoided (look for documentation about backsquatting for your MTA, and test if your y server is vulnerable).&lt;/p&gt;

&lt;h3&gt;Real life advices&lt;/h3&gt;

&lt;p&gt;I am sorry, I don't have the magic wand to stop all Spam. A good spam fighting solution is always a combination of techniques, SpamAssassin for instance uses scoring from RBL as well as a bayesian filter and SPF checks.&lt;/p&gt;

&lt;p&gt;I think that constant monitoring is important. Not just automated monitoring, but also clever log reading and mind openness on what can be a better solution for each problem. You never know what can happen in a spammer mind, and what works today may not work tomorrow. The Internet of Things is already a game changer.&lt;/p&gt;

&lt;p&gt;I also advise you to be careful. Some decisions on our implementations may really hurt the Internet. Locking whole countries out is not without consequences, and the rise of IPv6 Internet has to be take into consideration from now.&lt;/p&gt;

&lt;p&gt;Things are often not that pretty in mail servers, the temptation is great for a default blocking policy (hello MailInBlack). But as sysadmins, it is our responsability to not abuse and not hurting the smallest actors in the market (mails not coming from big farms). That may be a big word, but in my opinion, the freedom of the Internet also count on our neutrality on mail processing.&lt;/p&gt;

&lt;p&gt;Thanks for reading.&lt;/p&gt;</description>
        
              </item>
          <item>
        <title>Debian 8 : Limit SSH users to SFTP</title>
        <link>https://uname.pingveno.net/blog/index.php/post/2016/01/07/Limit-SSH-users-to-SFTP-only</link>
        <guid isPermaLink="false">urn:md5:d5a47c46eec6232c19a682eae095d7a1</guid>
        <pubDate>Thu, 18 Feb 2016 10:38:00 +0100</pubDate>
        <dc:creator>Mathieu</dc:creator>
                  <category>Hacks</category>
                          <category>debian</category>
                  <category>jessie</category>
                  <category>server</category>
                  <category>sftp</category>
                  <category>ssh</category>
                <description>&lt;p&gt;Let&amp;#8217;s say you want to configure a secure remote file access for you users, but you can&amp;#8217;t use FTPS for some reasons (problems with passive mode and commercial firewalls&amp;#160;? Yes&amp;#160;!). Your only secure solution is either a VPN, or a SFTP access.&lt;/p&gt;&lt;p&gt;SFTP is great, but it may implies giving full command line access to your end users.&amp;nbsp; In order to prevent that, you could set-up a jailed SSH access with &lt;a href=&quot;http://olivier.sessink.nl/jailkit/&quot;&gt;Jailkit&lt;/a&gt; and some &lt;a href=&quot;http://unix.stackexchange.com/questions/198590/what-is-a-bind-mount&quot;&gt;bind mount&lt;/a&gt;, but it&amp;#8217;s not that trivial to configure and to maintain&amp;#160;; and it may not work with software virtualization (Docker, LXCs&amp;#8230;). There is a simpler solution.&lt;/p&gt;&lt;p&gt;The solution is&amp;#160;: use the native chroot and limitations abilities of OpenSSH. Here is how.&lt;/p&gt;          &lt;h3&gt;Warning!&lt;/h3&gt;&lt;p&gt;You should not configure this on your primary SSH access. By doing so, you will simply lock you out of your server.&lt;/p&gt;&lt;p&gt;In this article, we will set up a completely new instance of OpennSSH server, running next to the original, and handling SFTP only.&lt;/p&gt;&lt;h3&gt;1. Setup the secondary SSH access (SFTP-only)&lt;/h3&gt;&lt;p&gt;Create a new configuration file by copying the primary configuration&amp;#160;:&lt;/p&gt;&lt;pre&gt;cp /etc/ssh/sshd_config /etc/ssh/sftp_config&lt;/pre&gt;&lt;p&gt;Now edit the file &lt;strong&gt;/etc/ssh/sftp_config&lt;/strong&gt; and change the listening port (for instance 10022)&amp;#160;:&lt;/p&gt;&lt;pre&gt;Port 10022&lt;/pre&gt;&lt;p&gt;Change the PID file for this new instance, set something meaningful&amp;#160;:&lt;/p&gt;&lt;pre&gt;PidFile /var/run/sftp.pid&lt;/pre&gt;&lt;p&gt;Then add these lines to&amp;nbsp;&lt;strong&gt;/etc/ssh/sftp_config&lt;/strong&gt;&amp;#160;:&lt;/p&gt;&lt;pre&gt;ChrootDirectory %h
ForceCommand internal-sftp
AllowTcpForwarding no&lt;/pre&gt;&lt;p&gt;Here is a sample of a full configuration&amp;#160;:&lt;/p&gt;&lt;pre&gt;# Package generated configuration file
# See the sshd_config(5) manpage for details

# What ports, IPs and protocols we listen for
&lt;strong&gt;Port 10022&lt;/strong&gt;
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes

&lt;strong&gt;PidFile /var/run/sftp.pid&lt;/strong&gt;

# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
ServerKeyBits 1024

# Logging
SyslogFacility AUTH
LogLevel INFO

# Authentication:
LoginGraceTime 120
PermitRootLogin no
StrictModes yes

RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile    %h/.ssh/authorized_keys

# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes

# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords no

# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no

# Change to no to disable tunnelled clear text passwords
#PasswordAuthentication yes

# Kerberos options
#KerberosAuthentication no
#KerberosGetAFSToken no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

&lt;strong&gt;X11Forwarding no&lt;/strong&gt;
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no

#MaxStartups 10:30:60
#Banner /etc/issue.net

# Allow client to pass locale environment variables
AcceptEnv LANG LC_*

&lt;strong&gt;Subsystem sftp /usr/lib/openssh/sftp-server
ChrootDirectory %h
ForceCommand internal-sftp
AllowTcpForwarding no&lt;/strong&gt;

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of &quot;PermitRootLogin without-password&quot;.
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes
&lt;/pre&gt;&lt;p&gt;Now, let&amp;#8217;s configure autostart. Copy &lt;strong&gt;/lib/systemd/system/ssh.service&lt;/strong&gt; to&amp;nbsp;&lt;strong&gt;/lib/systemd/system/sftp.service&lt;/strong&gt; and adjust settings&amp;#160;:&lt;/p&gt;&lt;pre&gt;[Unit]
Description=&lt;strong&gt;OpenBSD Secure Shell server (SFTP only)&lt;/strong&gt;
After=network.target auditd.service
ConditionPathExists=!/etc/ssh/sshd_not_to_be_run

[Service]
EnvironmentFile=-/etc/default/ssh
ExecStart=/usr/sbin/sshd -D $SSHD_OPTS -f &lt;strong&gt;/etc/ssh/sftp.conf&lt;/strong&gt;
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure

[Install]
WantedBy=multi-user.target
Alias=&lt;strong&gt;sftp.service&lt;/strong&gt;
&lt;/pre&gt;&lt;p&gt;And enable your service&amp;#160;:&lt;/p&gt;&lt;pre&gt;systemctl enable sftp.service&lt;/pre&gt;&lt;p&gt;Make sure the symlink&amp;nbsp;&lt;strong&gt;/etc/systemd/system/sftp.service&lt;/strong&gt; is created.&lt;/p&gt;&lt;p&gt;And try to start it&amp;#160;:&lt;/p&gt;&lt;pre&gt;service sftp start&lt;/pre&gt;&lt;h3&gt;2. Reconfigure the primary SSH access&lt;/h3&gt;&lt;p&gt;In order to prevent normal users to log into a full shell, we have to change the primary configuration.&lt;/p&gt;&lt;p&gt;The configuration file should be located in &lt;strong&gt;/etc/ssh/sshd_config&lt;/strong&gt; . Add an AllowUsers or AllowGroups directive to this file&amp;#160;:&lt;/p&gt;&lt;pre&gt;# One or the other but not both!
AllowUsers root admin
#AllowGroups sudo
&lt;/pre&gt;&lt;p&gt;Here is a sample of a full configuration&amp;#160;:&lt;/p&gt;&lt;pre&gt;# Package generated configuration file
# See the sshd_config(5) manpage for details

# What ports, IPs and protocols we listen for
&lt;strong&gt;Port 22&lt;/strong&gt;
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes

# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
ServerKeyBits 1024

# Logging
SyslogFacility AUTH
LogLevel INFO

# Authentication:
LoginGraceTime 120
PermitRootLogin without-password
StrictModes yes
&lt;strong&gt;AllowUsers root admin&lt;/strong&gt;

RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile    %h/.ssh/authorized_keys

# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes

# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords no

# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no

# Change to no to disable tunnelled clear text passwords
#PasswordAuthentication yes

# Kerberos options
#KerberosAuthentication no
#KerberosGetAFSToken no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

X11Forwarding no
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no

#MaxStartups 10:30:60
Banner /etc/issue.net

# Allow client to pass locale environment variables
AcceptEnv LANG LC_*

Subsystem sftp /usr/lib/openssh/sftp-server

UsePAM yes&lt;/pre&gt;&lt;p&gt;Restart your primary SSH access, but &lt;strong&gt;don&amp;#8217;t close your terminal afterwards&lt;/strong&gt;&amp;#160;:&lt;/p&gt;&lt;pre&gt;service ssh restart&lt;/pre&gt;&lt;p&gt;Now open a new terminal and check that your primary SSH is still working. If not, rollback your configuration.&lt;/p&gt;&lt;h3&gt;3. Conclusion&lt;/h3&gt;&lt;p&gt;Now you should have two SSH sockets listening&amp;#160;: one for everyone using exclusively SFTP, and the other with full SSH access for authorized accounts.&lt;/p&gt;&lt;p&gt;Don&amp;#8217;t hesitate to reply in comments if you encounter problems. &lt;img src=&quot;/blog/themes/mathedit_material3/smilies/smile.png&quot; alt=&quot;:)&quot; class=&quot;smiley&quot;&gt;&lt;/p&gt;&lt;h3&gt;Sources&lt;/h3&gt;&lt;p&gt;&lt;a href=&quot;https://wiki.archlinux.org/index.php/SFTP_chroot&quot;&gt;https://wiki.archlinux.org/index.php/SFTP_chroot&lt;/a&gt;&lt;/p&gt;</description>
        
              </item>
          <item>
        <title>Set-up SQL quarantine with Amavisd-new and ISPConfig</title>
        <link>https://uname.pingveno.net/blog/index.php/post/2015/12/05/Set-up-SQL-quarantine-with-Amavisd-new-and-ISPConfig</link>
        <guid isPermaLink="false">urn:md5:c449e2fbaef8eadc5d8276ac89e472d3</guid>
        <pubDate>Sun, 06 Dec 2015 16:56:00 +0100</pubDate>
        <dc:creator>Mathieu</dc:creator>
                  <category>Hacks</category>
                          <category>amavis</category>
                  <category>debian</category>
                  <category>ISPConfig</category>
                  <category>jessie</category>
                  <category>mail</category>
                  <category>quarantine</category>
                  <category>server</category>
                  <category>spam</category>
                  <category>sql</category>
                <description>&lt;p&gt;It's documented, but it took me two days to do it correctly, so here is how to reconfigure an ISPConfig installation of Amavis to store quarantined mail in SQL database, in order to install a quarantine viewer like Mailzu.&lt;/p&gt;          &lt;h3&gt;1. Prerequisites&lt;/h3&gt;

&lt;ul&gt;
	&lt;li&gt;A working Postfix+Amavis stack with ISPConfig&lt;/li&gt;
	&lt;li&gt;A working SQL (PostgreSQL, MySQL...) database&lt;/li&gt;
	&lt;li&gt;Optional : a working mail server with PHP (for Mailzu)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Jump to &lt;a href=&quot;https://uname.pingveno.net/blog/index.php/post/2015/12/05/Set-up-SQL-quarantine-with-Amavisd-new-and-ISPConfig#installation&quot;&gt;Installation&lt;/a&gt; if you know what you are doing.&lt;/p&gt;

&lt;h3&gt;2. Off-subject generic explanations&lt;/h3&gt;

&lt;h4&gt;2.1 Amavis and ISPConfig policies&lt;/h4&gt;

&lt;figure style=&quot;float: right; margin: 0 0 1em 1em;&quot;&gt;&lt;a class=&quot;media-link&quot; href=&quot;https://uname.pingveno.net/blog/public/captures/ispconfig/ispconfig_mail_spamfilter_policy_tag_levels.png&quot;&gt;&lt;img alt=&quot;ispconfig_mail_spamfilter_policy_tag_levels.png&quot; class=&quot;media&quot; src=&quot;https://uname.pingveno.net/blog/public/captures/ispconfig/.ispconfig_mail_spamfilter_policy_tag_levels_s.png&quot; /&gt;&lt;/a&gt;

&lt;figcaption&gt;ISPConfig policies, Tag-Levels&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;In a default ISPConfig installation per-user ISPConfig policies are loaded. The configuration file for Amavis, written by ISPConfig contains :&lt;/p&gt;

&lt;pre&gt;
@lookup_sql_dsn =
   ( ['DBI:mysql:database=dbispconfig;host=127.0.0.1;port=3306', 'ispconfig', 'xxxx'] );
$sql_select_policy =
   'SELECT *,spamfilter_users.id'.
   ' FROM spamfilter_users LEFT JOIN spamfilter_policy ON spamfilter_users.policy_id=spamfilter_policy.id'.
   ' WHERE spamfilter_users.email IN (%k) ORDER BY spamfilter_users.priority DESC';
$sql_select_white_black_list = 'SELECT wb FROM spamfilter_wblist'.
    ' WHERE (spamfilter_wblist.rid=?) AND (spamfilter_wblist.email IN (%k))' .
    ' ORDER BY spamfilter_wblist.priority DESC';&lt;/pre&gt;

&lt;p&gt;It means that whatever you would set as&amp;nbsp;&lt;strong&gt;$sa_spam_subject_tag&lt;/strong&gt;, &lt;strong&gt;$sa_tag_level_deflt&lt;/strong&gt;, &lt;strong&gt;$sa_tag2_level_deflt&lt;/strong&gt;, &lt;strong&gt;$sa_kill_level_deflt&lt;/strong&gt;, &lt;strong&gt;$sa_dsn_cutoff_level&lt;/strong&gt;, it will be overridden by per-user policies.&lt;/p&gt;

&lt;p&gt;The ISPConfig policies can be changed in tab Email =&amp;gt; Spamfilter =&amp;gt; Policy in ISPConfig panel. If you struggle wondering why your message keeps getting smashed at level 4.5, look at the sa_tag_level in policies. We will have to change values in that policies, to make the SQL quarantine working.&lt;/p&gt;

&lt;h4&gt;2.2 Lookup DSN and Storage DSN&lt;/h4&gt;

&lt;p&gt;DSN (Data Source Name) are the connection strings with host, username, and password, used to connect to databases.&lt;/p&gt;

&lt;p&gt;Amavis can set two DSN : one for Policies lookup (used to retrieve ISPConfig policies from Panel), and one for storage of mail meta informations and quarantine. We will use the Storage DSN to set up a secondary database for quarantine storage, to not mess with existing ISPConfig database.&lt;/p&gt;

&lt;h4&gt;2.3 Levels and cutoffs&lt;/h4&gt;

&lt;p&gt;Amavis uses Spamassassin to score the mail, in order to decide what to do with it. The category of test (spam test, antivirus, etc) and the score along with levels determines the actions Amavis will trigger, and the final destiny where the mail belongs.&lt;/p&gt;

&lt;p&gt;Spamassassin levels are :&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;&lt;strong&gt;tag_level&lt;/strong&gt; : a message above that score will be tagged with &lt;strong&gt;X-Spam-Status&lt;/strong&gt;, &lt;strong&gt;X-Spam-Score&lt;/strong&gt; and &lt;strong&gt;X-Spam-Level&lt;/strong&gt; headers.&lt;/li&gt;
	&lt;li&gt;&lt;strong&gt;tag2_level&lt;/strong&gt; : a message above that score will be marked &lt;strong&gt;as X-Spam-Status: Yes&lt;/strong&gt; and the subject is changed if &lt;strong&gt;sa_spam_modifies_subj&lt;/strong&gt; is set to true.&lt;/li&gt;
	&lt;li&gt;&lt;strong&gt;kill_level&lt;/strong&gt; : a message above that score is taken to the &lt;strong&gt;final_spam_destiny&lt;/strong&gt;, and quarantined, it will not be delivered unless &lt;strong&gt;D_PASS&lt;/strong&gt; is set to &lt;strong&gt;final_spam_destiny&lt;/strong&gt;.&lt;/li&gt;
	&lt;li&gt;&lt;strong&gt;dsn_cutoff_level&lt;/strong&gt; : a message above that level will never trigger a bounce or a reject, whatever &lt;strong&gt;spam_destiny&lt;/strong&gt; is.&lt;/li&gt;
	&lt;li&gt;&lt;strong&gt;quarantine_cutoff_level&lt;/strong&gt; : a message above that level will not be quarantined.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;2.4 Final &lt;span class=&quot;gt-baf-back&quot;&gt;destinations&lt;/span&gt;&lt;/h4&gt;

&lt;p&gt;Once the message is categorized by Amavis tests (through SpamAssassin, ClamAV, etc), Amavis decides if it should be delivered to user mailbox or not, and if a bounce will be issued.&lt;/p&gt;

&lt;p&gt;This is the purpose of &lt;strong&gt;$final_virus_destiny&lt;/strong&gt;, &lt;strong&gt;$final_spam_destiny&lt;/strong&gt;, &lt;strong&gt;$final_banned_destiny&lt;/strong&gt;, &lt;strong&gt;$final_bad_header_destiny&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;They can take the following values :&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;&lt;strong&gt;D_PASS&lt;/strong&gt; : mail will be delivered to inbox.&lt;/li&gt;
	&lt;li&gt;&lt;strong&gt;D_BOUNCE&lt;/strong&gt; : mail will not be delivered, and a &lt;em&gt;delivery status notification&lt;/em&gt; will be returned by Postifx to sender (except if the score exceeds the &lt;strong&gt;dsn_cutoff&lt;/strong&gt; level)&lt;/li&gt;
	&lt;li&gt;&lt;strong&gt;D_REJECT&lt;/strong&gt; : Postfix will answer REJECT to the distant mail server, and the distant mail server may produce a &lt;em&gt;delivery status notification&lt;/em&gt; to the user&lt;/li&gt;
	&lt;li&gt;&lt;strong&gt;D_DISCARD&lt;/strong&gt; : forgive and forget : the mail will not be delivered and the sender is not informed. The mail may be quarantined if the &lt;strong&gt;quarantine_cutoff&lt;/strong&gt; level is not exceeded.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;&lt;a name=&quot;installation&quot;&gt;3. Installation&lt;/a&gt;&lt;/h3&gt;

&lt;ul&gt;
	&lt;li&gt;For Amavis : Nothing ! Amavis comes out-of-the-box with SQL storage.&lt;/li&gt;
	&lt;li&gt;For Mailzu : see &lt;a href=&quot;https://uname.pingveno.net/blog/index.php/post/2015/12/05/Set-up-SQL-quarantine-with-Amavisd-new-and-ISPConfig#mailzu&quot;&gt;Mailzu&lt;/a&gt; section.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;4. Configuration&lt;/h3&gt;

&lt;h4&gt;4.1 Database&lt;/h4&gt;

&lt;p&gt;Create an user and a database for quarantine storage :&lt;/p&gt;

&lt;pre&gt;
# mysql -u root -p
mysql&amp;gt; CREATE DATABASE amavis_storage;
mysql&amp;gt; CREATE USER 'amavis_storage'@'localhost' IDENTIFIED BY 'xxxx';
mysql&amp;gt; GRANT ALL PRIVILEGES ON amavis_storage.* TO 'amavis_storage'@'localhost';
mysql&amp;gt; FLUSH PRIVILEGES;&lt;/pre&gt;

&lt;p&gt;Load the initial schema from Amavis docs (usually located in &lt;strong&gt;/usr/share/doc/amavisd-new&lt;/strong&gt;/ ).&lt;/p&gt;

&lt;p&gt;Delete unnecessary tables, as we will be using this database only for mail storage and not for lookups :&lt;/p&gt;

&lt;pre&gt;
# mysql -u amavis_storage -p amavis_storage
mysql&amp;gt; DROP TABLE users;
mysql&amp;gt; DROP TABLE mailaddr;
mysql&amp;gt; DROP TABLE policy;
mysql&amp;gt; DROP TABLE wblist;
&lt;/pre&gt;

&lt;p&gt;Nota Bene : while executing &lt;strong&gt;DROP TABLE users&lt;/strong&gt;, don't be silly, and do not remove mysql users database.&lt;/p&gt;

&lt;h4&gt;4.2 Amavis&lt;/h4&gt;

&lt;p&gt;Update your Amavis configuration &lt;strong&gt;/etc/amavis/conf.d/50_user&lt;/strong&gt; :&lt;/p&gt;

&lt;pre&gt;
@storage_sql_dsn = ( ['DBI:mysql:database=amavis_storage;host=127.0.0.1;port=3306', 'amavis_storage', 'xxxx'] );  # none, same, or separate database

# Quarantine SPAM into SQL server.
$spam_quarantine_to = 'spam-quarantine';
$spam_quarantine_method = 'sql:';

# Quarantine VIRUS into SQL server.
$virus_quarantine_to = 'virus-quarantine';
$virus_quarantine_method = 'sql:';

# Quarantine BANNED message into SQL server.
$banned_quarantine_to = 'banned-quarantine';
$banned_files_quarantine_method = 'sql:';

# Quarantine Bad Header message into SQL server.
$bad_header_quarantine_method = 'sql:';
$bad_header_quarantine_to = 'badheader-quarantine';

# Do not store non-quarantined messages info
# You can set it to 1 (the default) to test if Amavis is filling correctly the tables maddr, msgs, and msgcrpt
$sql_store_info_for_all_msgs = 0;

#
# SQL Select statements
#

$sql_select_policy =
   'SELECT *,spamfilter_users.id'.
   ' FROM spamfilter_users LEFT JOIN spamfilter_policy ON spamfilter_users.policy_id=spamfilter_policy.id'.
   ' WHERE spamfilter_users.email IN (%k) ORDER BY spamfilter_users.priority DESC';

$sql_select_white_black_list = 'SELECT wb FROM spamfilter_wblist'.
    ' WHERE (spamfilter_wblist.rid=?) AND (spamfilter_wblist.email IN (%k))' .
    ' ORDER BY spamfilter_wblist.priority DESC';

#
# Quarantine settings
#

$final_virus_destiny = D_BOUNCE;
$final_spam_destiny = D_DISCARD;
$final_banned_destiny = D_BOUNCE;
$final_bad_header_destiny = D_PASS;

# Default settings, we st this very high to not filter aut emails accidently
$sa_spam_subject_tag = '[SPAM] ';
$sa_tag_level_deflt  = 20.0;  # add spam info headers if at, or above that level
$sa_tag2_level_deflt = 60.0; # add 'spam detected' headers at that level
$sa_kill_level_deflt = 60.0; # triggers spam evasive actions
$sa_dsn_cutoff_level = 100;   # spam level beyond which a DSN is not sent
#$sa_debug = 1;

#
# Disable spam and virus notifications for the admin user.
# Can be overridden by the policies in mysql
#

$virus_admin = undef;
$spam_admin = undef;

#
# Enable Logging
#

$DO_SYSLOG = 1;
$LOGFILE = &quot;/var/log/amavis.log&quot;;  # (defaults to empty, no log)

# Set the log_level to 5 for debugging
$log_level = 0;                # (defaults to 0)&lt;/pre&gt;

&lt;h4&gt;4.3 ISPConfig policies&lt;/h4&gt;

&lt;p&gt;Remember that ISPconfig policies are overriding a lot of our configuration in &lt;strong&gt;50_user&lt;/strong&gt;. In order to majke the quarantine work, you have to reconfigure all the available policies in ISPConfig Panel.&lt;/p&gt;

&lt;p&gt;Look at your policies list, you have to change the quarantine settings for every policies :&lt;/p&gt;

&lt;figure style=&quot;{figureStyle}&quot;&gt;&lt;a class=&quot;media-link&quot; href=&quot;https://uname.pingveno.net/blog/public/captures/ispconfig/ispconfig_mail_spamfilter_policy.png&quot;&gt;&lt;img alt=&quot;ispconfig_mail_spamfilter_policy.png&quot; class=&quot;media&quot; src=&quot;https://uname.pingveno.net/blog/public/captures/ispconfig/ispconfig_mail_spamfilter_policy.png&quot; /&gt;&lt;/a&gt;

&lt;figcaption&gt;ISPConfig Mail Spamfilter Policy&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h4&gt;When editing a policy, on the Quarantine tab, set the destinations :&lt;/h4&gt;

&lt;figure style=&quot;{figureStyle}&quot;&gt;&lt;a class=&quot;media-link&quot; href=&quot;https://uname.pingveno.net/blog/public/captures/ispconfig/ispconfig_mail_spamfilter_policy_quarantine.png&quot;&gt;&lt;img alt=&quot;ispconfig_mail_spamfilter_policy_quarantine.png&quot; class=&quot;media&quot; src=&quot;https://uname.pingveno.net/blog/public/captures/ispconfig/ispconfig_mail_spamfilter_policy_quarantine.png&quot; /&gt;&lt;/a&gt;

&lt;figcaption&gt;ISPConfig Mail Spamfilter Policy Quarantine destinations&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;&lt;strong&gt;If you do not fill something in these fields, Amavis will not store quarantined mails in SQL database, and will just discard it !&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;These fields correspond to the &lt;strong&gt;virus_quarantine_to&lt;/strong&gt;, &lt;strong&gt;spam_quarantine_to&lt;/strong&gt;, &lt;strong&gt;banned_quarantine_to&lt;/strong&gt;, &lt;strong&gt;bad_header_quarantine_to&lt;/strong&gt; variables in Amavis configuration, and an empty value is overriding those we set in Amavis configuration.&lt;/p&gt;

&lt;h4&gt;4.4 Test&lt;/h4&gt;

&lt;p&gt;Send some spam to your server, check if the tables are populated :&lt;/p&gt;

&lt;pre&gt;
mysql&amp;gt; SELECT * FROM maddr;&lt;/pre&gt;

&lt;p&gt;Check if meta informations are populated :&lt;/p&gt;

&lt;pre&gt;
mysql&amp;gt; SELECT * FROM msgs;
mysql&amp;gt; SELECT * FROM msgrcpt;&lt;/pre&gt;

&lt;p&gt;And if quarantine is filling :&lt;/p&gt;

&lt;pre&gt;
mysql&amp;gt; SELECT * FROM quarantine;&lt;/pre&gt;

&lt;h3&gt;5. Cleanup !&lt;/h3&gt;

&lt;p&gt;You should not &quot;setup and forget&quot; your quarantine SQL storage. Messages has to be deleted periodically, otherwise your database will grow forever. Look at the documentaion in &lt;strong&gt;/usr/share/docs/amavisd-new&lt;/strong&gt; to make a cronjob like this :&lt;/p&gt;

&lt;pre&gt;
#!/bin/bash

SQL_HOST=&quot;localhost&quot;;
SQL_LOGIN=&quot;amavis_storage&quot;
SQL_PASSWORD=&quot;xxxx&quot;
SQL_DB=&quot;amavis_storage&quot;

mysql --user=&quot;$SQL_LOGIN&quot; --password=&quot;$SQL_PASSWORD&quot; --host=&quot;$SQL_HOST&quot; $SQL_DB -e &quot; \
  DELETE FROM msgs WHERE time_num &amp;lt; UNIX_TIMESTAMP() - 30*24*3600; \
  DELETE FROM msgrcpt WHERE NOT EXISTS (SELECT 1 FROM msgs WHERE mail_id=msgrcpt.mail_id); \
  DELETE FROM quarantine WHERE NOT EXISTS (SELECT 1 FROM msgs WHERE mail_id=quarantine.mail_id); \
  DELETE FROM maddr WHERE NOT EXISTS (SELECT 1 FROM msgs WHERE sid=id) AND NOT EXISTS (SELECT 1 FROM msgrcpt WHERE rid=id); \
&quot;
&lt;/pre&gt;

&lt;h3&gt;&lt;a name=&quot;mailzu&quot;&gt;6. Mailzu&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;I have to admit, Mailzu seems a bit obsolete as I had to patch to make it working with Amavis 3.3 tables. But it still works pretty well for a simple task like reading and releasing quarantine mails.&lt;/p&gt;

&lt;h4&gt;6.1 Installation&lt;/h4&gt;

&lt;p&gt;Download the source files at &lt;a href=&quot;http://sourceforge.net/projects/mailzu/&quot;&gt;http://sourceforge.net/projects/mailzu/&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;62. Patch&lt;/h4&gt;

&lt;p&gt;The existing Mailzu source code is quite old, and the schema of Amavis SQL tables changed. Download and apply &lt;a href=&quot;http://sourceforge.net/p/mailzu/patches/10/&quot;&gt;this patch&lt;/a&gt; in to make Mailzu work.&lt;/p&gt;

&lt;h4&gt;6.3 Configuration&lt;/h4&gt;

&lt;p&gt;I suppose that you know how to spawn PHP with CGI to serve the Mailzu files.&lt;/p&gt;

&lt;p&gt;Configure your database login and password in &lt;strong&gt;config/config.php&lt;/strong&gt; :&lt;/p&gt;

&lt;pre&gt;
$conf['db']['dbType'] = 'mysql';
$conf['db']['dbUser'] = 'amavis_storage';
$conf['db']['dbPass'] = 'xxxx';
$conf['db']['dbName'] = 'amavis_storage';
$conf['db']['hostSpec'] = 'localhost:3306';&lt;/pre&gt;

&lt;p&gt;I am using IMAP login to authenticate in Mailzu. Unfortunately, I had to turn off SSL authentication, as it wasn't working. Here is my configuration :&lt;/p&gt;

&lt;pre&gt;
$conf['auth']['serverType'] = 'imap';
$conf['auth']['imap_hosts'] = array( 'localhost:143' );
$conf['auth']['imap_type'] = 'imaptls';
$conf['auth']['imap_domain_name'] = 'example.com';&lt;/pre&gt;

&lt;p&gt;Don't forget to set yourself &quot;super&quot; :&lt;/p&gt;

&lt;pre&gt;
$conf['auth']['s_admins'] = array ('me@example.com');&lt;/pre&gt;

&lt;p&gt;And to set your web uri :&lt;/p&gt;

&lt;pre&gt;
$conf['app']['weburi'] = 'https://example.com/mailzu';&lt;/pre&gt;

&lt;h4&gt;6.4 Configure in-app release&lt;/h4&gt;

&lt;p&gt;Mailzu can also release quarantined mail. I did not implement this function, but you have to set up the amavisd-release internface on an inet socket on port 9998, instead of the existing unix socket located at &lt;strong&gt;/var/lib/amavis/amavisd.sock&lt;/strong&gt; . &lt;a href=&quot;https://www.ijs.si/software/amavisd/amavisd-new-docs.html#quar-release&quot;&gt;Read more&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;References&lt;/h3&gt;

&lt;ul&gt;
	&lt;li&gt;&lt;a href=&quot;http://www.iredmail.org/docs/amavisd.sql.db.html&quot;&gt;Explanation of Amavisd SQL database&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;https://blog.bravi.org/?p=683&quot;&gt;AMaViS: deal with SPAM, Viruses, Banned attachments, and Bad headers&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;https://www.ijs.si/software/amavisd/amavisd-new-docs.html#quarantine&quot;&gt;amavisd-new documentation bits and pieces&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://www.raygibson.net/kb/amavis/amavisd.conf&quot;&gt;amavis.conf&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://sourceforge.net/projects/mailzu/&quot;&gt;Mailzu&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://sourceforge.net/p/mailzu/patches/10/&quot;&gt;Mailzu patch for Amavis 2.7.0&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description>
        
          <enclosure url="/blog/public/code/sql/amavis_storage_partial_schema.sql" length="4518" type="application/octet-stream" />
        
              </item>
          <item>
        <title>Configurer dibbler-client pour IPv6 sur une Dedibox (Online.net) avec Debian 8 (Jessie)</title>
        <link>https://uname.pingveno.net/blog/index.php/post/2015/10/21/Configurer-dibbler-client-pour-IPv6-sur-une-Dedibox-%28Online.net%29-avec-Debian-8-%28Jessie%29</link>
        <guid isPermaLink="false">urn:md5:68ab8bab67fba7928f19774250094c5e</guid>
        <pubDate>Wed, 21 Oct 2015 14:24:00 +0200</pubDate>
        <dc:creator>Mathieu</dc:creator>
                  <category>Hacks</category>
                          <category>debian</category>
                  <category>dedibox</category>
                  <category>dibbler</category>
                  <category>jessie</category>
                  <category>online</category>
                  <category>proxmox</category>
                  <category>server</category>
                <description>          &lt;p&gt;La documentation d&amp;#8217;Online pour IPv6 ne traite pas le cas de Debian, Ubuntu, ou toute distribution utilisant systemd (CentOS6, etc). La documention doit être étendue pour ajouter le service sysetmd au démarrage, en lieu et place de l&amp;#8217;init script.&lt;/p&gt;&lt;h3&gt;Vérifiez que l&amp;#8217;IPv6 est activé&lt;/h3&gt;&lt;p&gt;Cela devrait normalement être le cas, puisque le noyau par défaut de Debian 8 inclut nativement IPv6 et ne peut pas être désactivé. Mais au cas où vous ne verriez pas le link-local sur vos interfaces&amp;#160;:&lt;/p&gt;&lt;p&gt;Changer dans &lt;code&gt;/etc/modprobe.d/local.conf :&lt;/code&gt;&lt;/p&gt;&lt;pre&gt;options ipv6 disable=0&lt;/pre&gt;&lt;p&gt;Ajouter dans &lt;code&gt;/etc/modules :&lt;/code&gt;&lt;/p&gt;&lt;pre&gt;ipv6&lt;/pre&gt;&lt;p&gt;Il faudra sans doute redémarrer pour appliquer les changments.&lt;/p&gt;&lt;h3&gt;Récupérez votre préfixe et votre DUID depuis la console d&amp;#8217;Online&lt;/h3&gt;&lt;p&gt;Vous devez &lt;a href=&quot;https://console.online.net/fr/assistance/ticket/list&quot;&gt;demander l&amp;#8217;activation de IPv6 au support&lt;/a&gt; et créer votre /64&amp;#160;&lt;a href=&quot;https://console.online.net/fr/network/&quot;&gt;dans la console d&amp;#8217;Online&lt;/a&gt; pour obtenir votre DUID.&lt;/p&gt;&lt;p&gt;Créez un /64 et n&amp;#8217;utilisez pas le /48 ou le 56 directement, vous pourriez le regretter si vous souhaitez redécouper le réseau. Vous n&amp;#8217;avez qu&amp;#8217;un seul /48 par compte, un /56 pour chaque serveur, et un /64 pour chaque failover souscrit.&lt;/p&gt;&lt;h3&gt;Configurez l&amp;#8217;interface réseau&lt;/h3&gt;&lt;p&gt;Encore une fois, c&amp;#8217;est sans doute facultatif puisque Dibbler reconfigure l&amp;#8217;interface lorsqu&amp;#8217;il se lance, donc explicitons ça dans le fichier &lt;strong&gt;/etc/network/interfaces&lt;/strong&gt;, juste au cas où&amp;#160;:&lt;/p&gt;&lt;pre&gt;iface eth0 inet6 static
    address your_ipv6_address
    netmask 64
&amp;nbsp;&amp;nbsp; &amp;nbsp;accept_ra 2
&lt;/pre&gt;&lt;h3&gt;Notes sur Proxmox et le forwarding&lt;/h3&gt;&lt;p&gt;Sous Proxmox on travaille sur l&amp;#8217;interface bridge, c&amp;#8217;est &lt;strong&gt;vmbr0&lt;/strong&gt; et non pas eth0.&lt;/p&gt;&lt;p&gt;Si le forwarding est activé, vous devez forcer le &lt;strong&gt;accept_ra&lt;/strong&gt; à &lt;strong&gt;2&lt;/strong&gt;, une valeur de 1 fera ignorer les router advertisements lorsque le forwarding est activé. &lt;a href=&quot;http://www.mattb.net.nz/blog/2011/05/12/linux-ignores-ipv6-router-advertisements-when-forwarding-is-enabled/&quot;&gt;Explications&lt;/a&gt;. Ajoutez dans sysctl.conf&amp;#160;:&lt;/p&gt;&lt;pre&gt;net.ipv6.conf.vmbr0.accept_ra = 2&lt;/pre&gt;&lt;p&gt;Notez bien que dans le cas où vous adressez vos machines virtuelles en IPv6 vous ne &lt;strong&gt;devez pas brancher l&amp;#8217;interface IPv6 de vos VM directement sur l&amp;#8217;interface vmbr0&lt;/strong&gt;. &lt;a href=&quot;https://forum.online.net/index.php?/topic/5380-configuring-ipv6-in-proxmox-on-dedibox-from-onlinenet/&quot;&gt;Voilà pourquoi&lt;/a&gt;.&lt;/p&gt;&lt;h3&gt;Compilez et installez Dibbler&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Téléchargez &lt;a href=&quot;http://klub.com.pl/dhcpv6/dibbler/dibbler-1.0.1.tar.gz&quot;&gt;Dibbler 1.0.1&lt;/a&gt; à partir du &lt;a href=&quot;http://klub.com.pl/dhcpv6/#DOWNLOAD&quot;&gt;site officiel&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Installez build-essential&amp;#160;: &lt;code&gt;apt-get install build-essential&lt;/code&gt;&lt;/li&gt;&lt;li&gt;Décompressez Dibbler&amp;#160;: &lt;code&gt;tar -xzf dibbler-1.0.1.tar.gz &amp;amp;&amp;amp; cd dibbler-1.0.1&lt;/code&gt;&lt;/li&gt;&lt;li&gt;Compilez et installez Dibbler&amp;#160;: &lt;code&gt;./configure &amp;amp;&amp;amp; ./make&lt;/code&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h3&gt;Configurez Dibbler&lt;/h3&gt;&lt;p&gt;Créez les dossiers et fichiers de configuration comme le précise la documentation&amp;#160;:&lt;/p&gt;&lt;p&gt;Configurez le DUID dans &lt;strong&gt;/var/lib/dibbler/client-duid&lt;/strong&gt;&amp;#160;:&lt;/p&gt;&lt;pre&gt;mkdir /var/lib/dibbler/
touch /var/lib/dibbler/client-duid
chmod 640 /var/lib/client-duid
# Set up you duid in client-duid
vim /var/lib/client-duid
&lt;/pre&gt;&lt;p&gt;Configurez &lt;strong&gt;/etc/dibbler/client.conf&lt;/strong&gt;&amp;#160;:&lt;/p&gt;&lt;pre&gt;mkdir /etc/dibbler
vim /etc/dibbler/client.conf&lt;/pre&gt;&lt;p&gt;Voici le contenu de mon &lt;strong&gt;client.conf&lt;/strong&gt;&amp;#160;:&lt;/p&gt;&lt;pre&gt;auth-protocol reconfigure-key
auth-replay monotonic
auth-methods digest-hmac-md5
duid-type duid-ll
inactive-mode
log-level 8
iface eth0 {
    pd
    ia
}
&lt;/pre&gt;&lt;p&gt;Encore une fois, c&amp;#8217;est à adapter en fonction du nom de votre interface.&lt;/p&gt;&lt;p&gt;Démarrez le client pour tester la connectivité&amp;#160;:&lt;/p&gt;&lt;pre&gt;dibbler-client run&lt;/pre&gt;&lt;p&gt;Pour vérifier que Dibbler a configuré l&amp;#8217;interface, pressez CTRL+Z pour suspendre le processus et vérifiez que l&amp;#8217;IP et les routes sont bien configurées. Tapez la commande &amp;#8220;fg&amp;#8221; pour retourner au processus en cours d&amp;#8217;exécution, et tapez CTRL+C pour stopper Dibbler.&lt;/p&gt;&lt;p&gt;Si pendant l&amp;#8217;opération les routes et les IPs sont incorrectes, vérifiez que votre pare feu accepte les connexions entrantes par le port 546 UDP.&lt;/p&gt;&lt;h3&gt;Configurez Dibbler au démarrage&lt;/h3&gt;&lt;p&gt;Cette section est différente de la documentation d&amp;#8217;Online.&lt;/p&gt;&lt;p&gt;Avant systemd, le système d&amp;#8217;init par dépendances se contentait d&amp;#8217;un script dans /etc/init.d/. Avec systemd, il faut créer un fichier &lt;strong&gt;service&lt;/strong&gt; dans &lt;strong&gt;/etc/systemd/system/&lt;/strong&gt; .&lt;/p&gt;&lt;p&gt;Créez le fichier suivant&amp;#160;: &lt;strong&gt;/etc/systemd/system/dibbler.service&lt;/strong&gt;&amp;#160;:&lt;/p&gt;&lt;pre&gt;[Unit]
Description=Dibbler
After=network.target

[Service]
Type=simple
ExecStart=/usr/local/sbin/dibbler-client start
ExecStop=/usr/local/sbin/dibbler-client stop
PrivateTmp=true
NonBlocking=yes

[Install]
WantedBy=multi-user.target&lt;/pre&gt;&lt;p&gt;Lancez la commande suivante pour que systemd lise le fichier&amp;nbsp;&amp;#160;:&lt;/p&gt;&lt;pre&gt;systemctl daemon-reload&lt;/pre&gt;&lt;p&gt;Et activez le service&amp;#160;:&lt;/p&gt;&lt;pre&gt;systemctl enable dibbler.service&lt;/pre&gt;&lt;p&gt;Et essayez de le lancer pour la première fois&amp;#160;:&lt;/p&gt;&lt;pre&gt;systemctl start dibbler.service&lt;/pre&gt;&lt;p&gt;Vérifions que tout est correct&amp;#160;:&lt;/p&gt;&lt;pre&gt;service dibbler status
ifconfig
route -6
ping6 whatever-you-want.com&lt;/pre&gt;&lt;p&gt;Si tout va bien, redémarrez et l&amp;#8217;IPv6 fonctionnera dès le démarrage&amp;#160;! &lt;img src=&quot;/blog/themes/mathedit_material3/smilies/smile.png&quot; alt=&quot;:)&quot; class=&quot;smiley&quot;&gt;&lt;/p&gt;&lt;p&gt;Addendum&amp;#160;: juste au cas où, n&amp;#8217;utilisez pas resolvconf pour pousser les DNS IPv6 automatiquement, conservez autant que possible vos DNS IPv4. Ça serait tellement dommage que votre connectivité IPv6 saute et que vous vous retrouviez sans DNS (oui ça m&amp;#8217;est arrivé&amp;#8230;).&lt;/p&gt;&lt;h3&gt;Sources&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://documentation.online.net/en/serveur-dedie/reseau/ipv6-prefix&quot;&gt;http://documentation.online.net/en/serveur-dedie/reseau/ipv6-prefix&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.lowendtalk.com/discussion/48591/configuring-ipv6-for-proxmox-kvm-on-dedibox-online-net&quot;&gt;http://www.lowendtalk.com/discussion/48591/configuring-ipv6-for-proxmox-kvm-on-dedibox-online-net&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://unix.stackexchange.com/questions/47695/how-to-write-startup-script-for-systemd&quot;&gt;http://unix.stackexchange.com/questions/47695/how-to-write-startup-script-for-systemd&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://sulek.fr/index.php?article60/configuration-ipv6-pour-une-dedibox-sous-centos-7&quot;&gt;https://sulek.fr/index.php?article60/configuration-ipv6-pour-une-dedibox-sous-centos-7&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.mattb.net.nz/blog/2011/05/12/linux-ignores-ipv6-router-advertisements-when-forwarding-is-enabled/&quot;&gt;http://www.mattb.net.nz/blog/2011/05/12/linux-ignores-ipv6-router-advertisements-when-forwarding-is-enabled/&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://forum.online.net/index.php?/topic/5380-configuring-ipv6-in-proxmox-on-dedibox-from-onlinenet/&quot;&gt;https://forum.online.net/index.php?/topic/5380-configuring-ipv6-in-proxmox-on-dedibox-from-onlinenet/&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;</description>
        
              </item>
          <item>
        <title>Configure dibbler-client for IPV6 networking on Dedibox (or any Online.net) servers with Debian 8 (Jessie)</title>
        <link>https://uname.pingveno.net/blog/index.php/post/2015/10/21/Configure-dibbler-for-IPV6-networking-on-Dedibox-%28or-any-Online.net%29-servers-with-Debian-8-%28Jessie%29</link>
        <guid isPermaLink="false">urn:md5:cf27b5e56650bb4963d6a1f71966a199</guid>
        <pubDate>Wed, 21 Oct 2015 12:50:00 +0200</pubDate>
        <dc:creator>Mathieu</dc:creator>
                  <category>Hacks</category>
                          <category>debian</category>
                  <category>dedibox</category>
                  <category>dibbler</category>
                  <category>jessie</category>
                  <category>online</category>
                  <category>proxmox</category>
                  <category>server</category>
                <description>          &lt;p&gt;The &lt;a href=&quot;http://documentation.online.net/en/serveur-dedie/reseau/ipv6-prefix&quot;&gt;Online documentation for IPv6&lt;/a&gt; is not dealing with the case of Debian 8, Ubuntu, or any distribution using systemd. Systemd replaces upstart, so the procedure has to be extended to add systemd service for startup, replacing the previoux behavior that was using init scripts.&lt;/p&gt;&lt;h3&gt;Ensure that you are IPv6-proof&lt;/h3&gt;&lt;p&gt;It should be the case as Debian 8 is shipping a kernel with native IPv6, but just to be sure&amp;#160;:&lt;/p&gt;&lt;p&gt;In &lt;code&gt;/etc/modprobe.d/local.conf :&lt;/code&gt;&lt;/p&gt;&lt;pre&gt;options ipv6 disable=0&lt;/pre&gt;&lt;p&gt;In &lt;code&gt;/etc/modules :&lt;/code&gt;&lt;/p&gt;&lt;pre&gt;ipv6&lt;/pre&gt;&lt;p&gt;You may have to reboot in order to apply the changes.&lt;/p&gt;&lt;h3&gt;Set up your IPv6 prefix and get your DUID on Online console&lt;/h3&gt;&lt;p&gt;You have to &lt;a href=&quot;https://console.online.net/fr/assistance/ticket/list&quot;&gt;request IPv6 activation to support&lt;/a&gt; and create your /64&amp;#160;&lt;a href=&quot;https://console.online.net/fr/network/&quot;&gt;on Online console&lt;/a&gt; before getting your DUID working.&lt;/p&gt;&lt;p&gt;Make a /64 and do not use your /48 or your /56 directly, as you may regret it. You can have only one /48 by account, one /56 by server, and one /64 by IP failover (the /48 is divided to make the /56 and so on).&lt;/p&gt;&lt;h3&gt;Configure your network interface&lt;/h3&gt;&lt;p&gt;It may not be mandatory as Dibbler will reconfigure your interface, but you have to ensure that you accept router advertisements. Add to &lt;strong&gt;/etc/network/interfaces&lt;/strong&gt;&amp;#160;:&lt;/p&gt;&lt;pre&gt;iface eth0 inet6 static
    address your_ipv6_address
    netmask 64
&amp;nbsp;&amp;nbsp; &amp;nbsp;accept_ra 2
&lt;/pre&gt;&lt;h3&gt;Notes about Proxmox and forwarding&lt;/h3&gt;&lt;p&gt;On Proxmox, you are working on the bridge interface, it should be &lt;strong&gt;vmbr0&lt;/strong&gt; instead of eth0.&lt;/p&gt;&lt;p&gt;If you enabled forwarding on this interface (to give your VM an access to IPv6 network), you have to force the &lt;strong&gt;accept_ra&lt;/strong&gt; to &lt;strong&gt;2&lt;/strong&gt;, while the default value of 1 wil make your Debian to ignore router advertisements when forwarding is enabled&amp;#160;! &lt;a href=&quot;http://www.mattb.net.nz/blog/2011/05/12/linux-ignores-ipv6-router-advertisements-when-forwarding-is-enabled/&quot;&gt;Read more&lt;/a&gt;. Add to sysctl.conf&amp;#160;:&lt;/p&gt;&lt;pre&gt;net.ipv6.conf.vmbr0.accept_ra = 2&lt;/pre&gt;&lt;p&gt;Also &lt;strong&gt;do not set the IPv6 interface of your VM to vmbr0&lt;/strong&gt;, as you can break your network access. &lt;a href=&quot;https://forum.online.net/index.php?/topic/5380-configuring-ipv6-in-proxmox-on-dedibox-from-onlinenet/&quot;&gt;Read more&lt;/a&gt;.&lt;/p&gt;&lt;h3&gt;Compile and install Dibbler&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Download &lt;a href=&quot;http://klub.com.pl/dhcpv6/dibbler/dibbler-1.0.1.tar.gz&quot;&gt;Dibbler 1.0.1&lt;/a&gt; from the &lt;a href=&quot;http://klub.com.pl/dhcpv6/#DOWNLOAD&quot;&gt;offical website&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;Install build-essential&amp;#160;: &lt;code&gt;apt-get install build-essential&lt;/code&gt;&lt;/li&gt;&lt;li&gt;Extract Dibbler&amp;#160;: &lt;code&gt;tar -xzf dibbler-1.0.1.tar.gz &amp;amp;&amp;amp; cd dibbler-1.0.1&lt;/code&gt;&lt;/li&gt;&lt;li&gt;Compile and install Dibbler&amp;#160;: &lt;code&gt;./configure &amp;amp;&amp;amp; ./make&lt;/code&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h3&gt;Configure Dibbler&lt;/h3&gt;&lt;p&gt;Make the directories and set up according to the documentation&amp;#160;:&lt;/p&gt;&lt;p&gt;Set up duid&amp;#160;:&lt;/p&gt;&lt;pre&gt;mkdir /var/lib/dibbler/
touch /var/lib/dibbler/client-duid
chmod 640 /var/lib/client-duid
# Set up you duid in client-duid
vim /var/lib/client-duid
&lt;/pre&gt;&lt;p&gt;Set up client.conf&amp;#160;:&lt;/p&gt;&lt;pre&gt;mkdir /etc/dibbler
vim /etc/dibbler/client.conf&lt;/pre&gt;&lt;p&gt;The content of my client.conf&amp;#160;:&lt;/p&gt;&lt;pre&gt;auth-protocol reconfigure-key
auth-replay monotonic
auth-methods digest-hmac-md5
duid-type duid-ll
inactive-mode
log-level 8
iface eth0 {
    pd
    ia
}
&lt;/pre&gt;&lt;p&gt;Note that if your interface name is different you have to change it accordingly. For instance, on a Proxmox host server, it should be &lt;strong&gt;vmbr0&lt;/strong&gt; instead of eth0.&lt;/p&gt;&lt;p&gt;Start dibbler to try the connectivity&amp;#160;:&lt;/p&gt;&lt;pre&gt;dibbler-client run&lt;/pre&gt;&lt;p&gt;Hit CTRL+Z to suspend the process and check that the IP and routes are configured. Type the command &amp;#8220;fg&amp;#8221; to get back to the running process and hit CTRL+C to stop it.&lt;/p&gt;&lt;p&gt;If it doesn&amp;#8217;t work, check your firewall, dibbler needs to listen port 546 UDP.&lt;/p&gt;&lt;h3&gt;Set Dibbler at startup&lt;/h3&gt;&lt;p&gt;This section differs from Online documentation.&lt;/p&gt;&lt;p&gt;Before systemd, the dependency-based boot sequence only needed an init script, for instance /etc/init.d/dibbler . With systemd, you have to make a &lt;strong&gt;service&lt;/strong&gt; file in &lt;strong&gt;/etc/systemd/system/&lt;/strong&gt; .&lt;/p&gt;&lt;p&gt;Make the following file&amp;#160;: &lt;strong&gt;/etc/systemd/system/dibbler.service&lt;/strong&gt;&amp;#160;:&lt;/p&gt;&lt;pre&gt;[Unit]
Description=Dibbler
After=network.target

[Service]
Type=simple
ExecStart=/usr/local/sbin/dibbler-client start
ExecStop=/usr/local/sbin/dibbler-client stop
PrivateTmp=true
NonBlocking=yes

[Install]
WantedBy=multi-user.target&lt;/pre&gt;&lt;p&gt;Run the following command to make systemd read file&amp;#160;:&lt;/p&gt;&lt;pre&gt;systemctl daemon-reload&lt;/pre&gt;&lt;p&gt;Enable the service&amp;#160;:&lt;/p&gt;&lt;pre&gt;systemctl enable dibbler.service&lt;/pre&gt;&lt;p&gt;And then, try to start it&amp;#160;:&lt;/p&gt;&lt;pre&gt;systemctl start dibbler.service&lt;/pre&gt;&lt;p&gt;Check everything is fine&amp;#160;:&lt;/p&gt;&lt;pre&gt;service dibbler status
ifconfig
route -6
ping6 whatever-you-want.com&lt;/pre&gt;&lt;p&gt;Reboot and the IPv6 networking should work at startup&amp;#160;! &lt;img src=&quot;/blog/themes/mathedit_material3/smilies/smile.png&quot; alt=&quot;:)&quot; class=&quot;smiley&quot;&gt;&lt;/p&gt;&lt;p&gt;Addendum&amp;#160;: just in case, don&amp;#8217;t use resolvconf with IPv6 DNS pushing and if possible keep IPv4 DNS, it would be such a pity if the IPv6 networking crashes while your DNS servers are set to IPv6 addresses (yeah, it happened to to me)&amp;#8230;&lt;/p&gt;&lt;h3&gt;Sources&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://documentation.online.net/en/serveur-dedie/reseau/ipv6-prefix&quot;&gt;http://documentation.online.net/en/serveur-dedie/reseau/ipv6-prefix&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.lowendtalk.com/discussion/48591/configuring-ipv6-for-proxmox-kvm-on-dedibox-online-net&quot;&gt;http://www.lowendtalk.com/discussion/48591/configuring-ipv6-for-proxmox-kvm-on-dedibox-online-net&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://unix.stackexchange.com/questions/47695/how-to-write-startup-script-for-systemd&quot;&gt;http://unix.stackexchange.com/questions/47695/how-to-write-startup-script-for-systemd&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://sulek.fr/index.php?article60/configuration-ipv6-pour-une-dedibox-sous-centos-7&quot;&gt;https://sulek.fr/index.php?article60/configuration-ipv6-pour-une-dedibox-sous-centos-7&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.mattb.net.nz/blog/2011/05/12/linux-ignores-ipv6-router-advertisements-when-forwarding-is-enabled/&quot;&gt;http://www.mattb.net.nz/blog/2011/05/12/linux-ignores-ipv6-router-advertisements-when-forwarding-is-enabled/&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://forum.online.net/index.php?/topic/5380-configuring-ipv6-in-proxmox-on-dedibox-from-onlinenet/&quot;&gt;https://forum.online.net/index.php?/topic/5380-configuring-ipv6-in-proxmox-on-dedibox-from-onlinenet/&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;</description>
        
              </item>
          <item>
        <title>Postfix : configure postmaster, hostmaster, and abuse catchall  for RFC compliance</title>
        <link>https://uname.pingveno.net/blog/index.php/post/2015/08/29/Postfix-%3A-configure-postmaster%2C-hostmaster%2C-and-abuse-catchall-for-RFC-compliance</link>
        <guid isPermaLink="false">urn:md5:2236b92a9adc8066108e9709c6c32959</guid>
        <pubDate>Sat, 29 Aug 2015 18:02:00 +0200</pubDate>
        <dc:creator>Mathieu</dc:creator>
                  <category>Hacks</category>
                          <category>catchall</category>
                  <category>debian</category>
                  <category>mail</category>
                  <category>postfix</category>
                  <category>server</category>
                <description>          &lt;p&gt;This short howto will show you how to set up a catchall for common required email addresses. Some mail servers are testing if mail is accepted on this addresses to detect spammymail servers. Hostmaster address can also be used for domain Trading, to check the ownership of the domain.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;1. &lt;/strong&gt;Create a file named &lt;strong&gt;/etc/postfix/regexp-catchall.cf&lt;/strong&gt; with the following content:&lt;/p&gt;&lt;pre&gt;# Catchall to comply with RFC standards
/^postmaster@/    youshouldreadit@mydomain.com
/^hostmaster@/    youshouldreadit@mydomain.com
/^abuse@/         youshouldreadit@mydomain.com&lt;/pre&gt;&lt;p&gt;Replace &lt;em&gt;youshouldreadit@mydomain.com&lt;/em&gt; with a mail address you actually read.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;2.&lt;/strong&gt; Open &lt;strong&gt;/etc/postfix/main.cf&lt;/strong&gt; and locate (or create) the line &lt;strong&gt;virtual_alias_maps&lt;/strong&gt;, and add at the end &lt;strong&gt;regexp:/etc/postfix/regexp-catchall.cf&lt;/strong&gt;, for instance:&lt;/p&gt;&lt;pre&gt;virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, regexp:/etc/postfix/regexp-catchall.cf&lt;/pre&gt;&lt;p&gt;&lt;strong&gt;3. &lt;/strong&gt;Restart Postfix.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Warning&amp;#160;: read &lt;a href=&quot;http://uname.pingveno.net/blog/index.php/post/2015/08/29/Postfix-%3A-configure-postmaster%2C-hostmaster%2C-and-abuse-catchall-for-RFC-compliance#c73895&quot;&gt;comment #4&lt;/a&gt; for issues with this setup&lt;/strong&gt;.&lt;/p&gt;</description>
        
              </item>
          <item>
        <title>Nagios : quick and dirty patch to enable (force) SSL on check_mysql_health</title>
        <link>https://uname.pingveno.net/blog/index.php/post/2015/06/06/Nagios-%3A-quick-and-dirty-patch-to-enable-%28force%29-SSL-on-check_mysql_health</link>
        <guid isPermaLink="false">urn:md5:3244ad7656fe67739208c0268a811102</guid>
        <pubDate>Sat, 06 Jun 2015 16:10:00 +0200</pubDate>
        <dc:creator>Mathieu</dc:creator>
                  <category>Hacks</category>
                          <category>check_mysql_health</category>
                  <category>debian</category>
                  <category>monitoring</category>
                  <category>mysql</category>
                  <category>nagios</category>
                  <category>server</category>
                <description>          &lt;p&gt;Sometimes you don&amp;#8217;t want to set up a VPN just to safely monitor your MySQL servers. Because SSL should be implemented in &lt;a href=&quot;https://exchange.nagios.org/directory/MySQL/check_mysql_health/details&quot;&gt;check_mysql_health&lt;/a&gt;, here is a quick and dirty patch for SSL connexion. I assume you already configured your MySQL server to use SSL if client wants to (or if user requires ssl).&lt;/p&gt;

&lt;p&gt;File &lt;strong&gt;/usr/lib/nagios/plugins/check_mysql_health&lt;/strong&gt; at line &lt;strong&gt;1863&lt;/strong&gt;, after the following block&amp;#160;:&lt;/p&gt;

&lt;pre&gt;
    } else {
      $self-&amp;gt;{dsn} .= sprintf &quot;;host=%s&quot;, $self-&amp;gt;{hostname};
      $self-&amp;gt;{dsn} .= sprintf &quot;;port=%s&quot;, $self-&amp;gt;{port}
          unless $self-&amp;gt;{socket} || $self-&amp;gt;{hostname} eq 'localhost';
      $self-&amp;gt;{dsn} .= sprintf &quot;;mysql_socket=%s&quot;, $self-&amp;gt;{socket}
          if $self-&amp;gt;{socket};&lt;/pre&gt;

&lt;p&gt;Add these lines&amp;#160;:&lt;/p&gt;

&lt;pre&gt;
    $self-&amp;gt;{dsn} .= &quot;;mysql_ssl=1&quot;;
    $self-&amp;gt;{dsn} .= &quot;;mysql_ssl_client_key=/etc/ssl/mysql/client.key&quot;;
    $self-&amp;gt;{dsn} .= &quot;;mysql_ssl_client_cert=/etc/ssl/mysql/client.crt&quot;;
    $self-&amp;gt;{dsn} .= &quot;;mysql_ssl_ca_file=/etc/ssl/mysql/ca.crt&quot;;&lt;/pre&gt;

&lt;p&gt;Where &lt;strong&gt;/etc/ssl/mysql/client.key&lt;/strong&gt; is the path to client key, &lt;strong&gt;/etc/ssl/mysql/client.crt&lt;/strong&gt; the path to client certificate, and &lt;strong&gt;/etc/ssl/mysql/ca.crt&lt;/strong&gt; the path to the CA certificate.&lt;/p&gt;

&lt;p&gt;It should work, while there is still no &amp;#8220;SSL switch&amp;#8221; on that plugin.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&amp;#160;: actually there is an undocumented param named &amp;#8220;&amp;#8212;mycnf&amp;#8221; which should allow you to enable SSL for client connection in a prettier way.&lt;/p&gt;</description>
        
              </item>
          <item>
        <title>Configure sender rate limits to prevent spam, using cluebringer (policyd) with Postfix</title>
        <link>https://uname.pingveno.net/blog/index.php/post/2015/03/11/Configure-sender-rate-limits-to-prevent-spam%2C-using-cluebringer-%28policyd%29-with-Postfix</link>
        <guid isPermaLink="false">urn:md5:11c6569b7382d3cd707a41e60deae65c</guid>
        <pubDate>Fri, 13 Mar 2015 09:18:00 +0100</pubDate>
        <dc:creator>Mathieu</dc:creator>
                  <category>Hacks</category>
                          <category>cluebringer</category>
                  <category>debian</category>
                  <category>mail</category>
                  <category>policyd</category>
                  <category>postfix</category>
                  <category>server</category>
                <description>&lt;p&gt;This small how-to will show you how to configure cluebringer (aka policyd) to set a per-hour/per-user limit for sent mails. Note that sending to multiple recipient will count like multiple mails were sent.&lt;/p&gt;

&lt;p&gt;This how-to is Debian-oriented but should apply to any unix operating system.&lt;/p&gt;          &lt;h3&gt;Requirements&lt;/h3&gt;

&lt;p&gt;A mail server with Postfix installed.&lt;/p&gt;

&lt;h3&gt;Installation&lt;/h3&gt;

&lt;p&gt;Install a DBMS (MySQL for instance), cluebringer, and cluebringer-webui&amp;#160;:&lt;/p&gt;

&lt;pre&gt;
apt-get install mysql-server cluebringer cluebringer-mysql cluebringer-webui&lt;/pre&gt;

&lt;p&gt;Note that cluebringer-webui will install apache as a dependency if you don&amp;#8217;t already have a webserver.&lt;/p&gt;

&lt;h3&gt;Set-up the Cluebringer database&lt;/h3&gt;

&lt;p&gt;Get the initial database schema that correspond to your DBMS, for instance mysql&amp;#160;:&lt;/p&gt;

&lt;pre&gt;
cp /usr/share/doc/postfix-cluebringer/database/policyd-db.mysql.gz ~/ &amp;amp;&amp;amp; gunzip ~/policyd-db.mysql.gz&lt;/pre&gt;

&lt;p&gt;Create the database, and populate it with the initial dump&amp;#160;:&lt;/p&gt;

&lt;pre&gt;
# cd  ~/ &amp;amp;&amp;amp; mysql -u root -p
mysql&amp;gt; CREATE DATABASE cluebringer;
mysql&amp;gt; CREATE USER 'cluebringer'@'localhost' IDENTIFIED BY 'mypassword';
mysql&amp;gt; GRANT ALL PRIVILEGES ON cluebringer.* TO 'cluebringer'@'localhost';
mysql&amp;gt; \. policyd-db.mysql
mysql&amp;gt; quit
mysql&amp;gt; Bye
&lt;/pre&gt;

&lt;p&gt;Note that on Debian I had to modify the dump to make it work, &lt;em&gt;TYPE=InnoDB&lt;/em&gt; was rejected by MySQL as an invalid syntax.&lt;/p&gt;

&lt;h3&gt;Configure Cluebringer&lt;/h3&gt;

&lt;p&gt;Add your DBMS credentials to the file &lt;strong&gt;/etc/cluebringer/cluebringer.conf&lt;/strong&gt;&amp;#160;:&lt;/p&gt;

&lt;pre&gt;
DSN=DBI:mysql:dbname=cluebringer;host=localhost

DB_Type=mysql
DB_Host=localhost
DB_Port=3306
DB_Name=cluebringer
Username=cluebringer
Password=mypassword&lt;/pre&gt;

&lt;p&gt;And start it&amp;#160;:&lt;/p&gt;

&lt;pre&gt;
service postfix-cluebringer start&lt;/pre&gt;

&lt;h3&gt;Configure Cluebringer webui&lt;/h3&gt;

&lt;p&gt;Configure the file &lt;strong&gt;/etc/cluebringer/cluebringer-webui.conf&lt;/strong&gt; with your DBMS credentials&amp;#160;:&lt;/p&gt;

&lt;pre&gt;
&amp;lt;?php

$DB_DSN=&quot;mysql:host=localhost;dbname=cluebringer&quot;;
$DB_USER=&quot;cluebringer&quot;;
$DB_PASS=&quot;mypassword&quot;;&lt;/pre&gt;

&lt;p&gt;Cluebringer Webui needs a web server to run. Copy the sample configuration from the package documentation&amp;#160;:&lt;/p&gt;

&lt;pre&gt;
cp /usr/share/doc/postfix-cluebringer-webui/examples/httpd/cluebringer-httpd.conf /etc/apache2/conf.d/&lt;/pre&gt;

&lt;p&gt;Restart Apache&amp;#160;:&lt;/p&gt;

&lt;pre&gt;
service apache2 restart&lt;/pre&gt;

&lt;p&gt;You may need to adjust a few things to access it from the outside. If you a really lazy, just make a ssh tunnel to access the webserver from localhost&amp;#160;:&lt;/p&gt;

&lt;pre&gt;
ssh -L 8008:localhost:80 mylogin@mymailserver&lt;/pre&gt;

&lt;p&gt;Don&amp;#8217;t forget&amp;#160;: you have to make this tunnel from the outside, do not run this command on server, it won&amp;#8217;t work.&lt;/p&gt;

&lt;p&gt;You should now be able to open http://localhost:8080/ and see your fresh new Cluebinger Webui&amp;#160;!&lt;/p&gt;

&lt;h3&gt;Configure Cluebringer using its webui&lt;/h3&gt;

&lt;h4&gt;Add a policy&lt;/h4&gt;

&lt;p&gt;Under &lt;strong&gt;Policies&lt;/strong&gt; -&amp;gt; &lt;strong&gt;Main&lt;/strong&gt;, disable Test policy (select policy and choose &lt;strong&gt;Action&lt;/strong&gt; -&amp;gt; &lt;strong&gt;Change&lt;/strong&gt; and switch &lt;strong&gt;Disabled&lt;/strong&gt; to &lt;strong&gt;yes&lt;/strong&gt;, validate)&lt;/p&gt;

&lt;p&gt;Add a new policy&amp;#160;: &lt;strong&gt;Action&lt;/strong&gt; -&amp;gt; &lt;strong&gt;Add&lt;/strong&gt;, give it a name and a description&lt;/p&gt;

&lt;p&gt;Activate your new policy&amp;#160;: select policy and choose &lt;strong&gt;Action&lt;/strong&gt; -&amp;gt; &lt;strong&gt;Change&lt;/strong&gt; (switch &lt;strong&gt;Disabled&lt;/strong&gt; to &lt;strong&gt;no&lt;/strong&gt;)&lt;/p&gt;

&lt;p&gt;Add a new member to your policy&amp;#160;: select it and choose &lt;strong&gt;Action&lt;/strong&gt; -&amp;gt; &lt;strong&gt;Members&lt;/strong&gt;, and then &lt;strong&gt;Action&lt;/strong&gt; -&amp;gt; &lt;strong&gt;Add&lt;/strong&gt;. Specify &lt;strong&gt;any&lt;/strong&gt; as source and &lt;strong&gt;any&lt;/strong&gt; as destination.&lt;/p&gt;

&lt;p&gt;Go back to your policy, choose &lt;strong&gt;Action&lt;/strong&gt; -&amp;gt; &lt;strong&gt;Members&lt;/strong&gt;, and the select your member, do &lt;strong&gt;Action&lt;/strong&gt; -&amp;gt; &lt;strong&gt;Change&lt;/strong&gt;, and activate your new member (switch &lt;strong&gt;Disabled&lt;/strong&gt; to &lt;strong&gt;no&lt;/strong&gt;).&lt;/p&gt;

&lt;h4&gt;Add a quota&lt;/h4&gt;

&lt;p&gt;Under &lt;strong&gt;Quotas&lt;/strong&gt; -&amp;gt; &lt;strong&gt;Configure&lt;/strong&gt;, disable Test quotas.&lt;/p&gt;

&lt;p&gt;Add a new quota&amp;#160;: Choose &lt;strong&gt;Action&lt;/strong&gt; -&amp;gt; &lt;strong&gt;Add&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;Name&amp;#160;: whatever you want&lt;/li&gt;
	&lt;li&gt;Track&amp;#160;: &lt;strong&gt;user@domain&lt;/strong&gt;&lt;/li&gt;
	&lt;li&gt;Period (seconds)&amp;#160;: &lt;strong&gt;3600&lt;/strong&gt;&lt;/li&gt;
	&lt;li&gt;Link to policy&amp;#160;: specify the policy you created here&lt;/li&gt;
	&lt;li&gt;Verdict&amp;#160;: &lt;strong&gt;Defer&lt;/strong&gt;&lt;/li&gt;
	&lt;li&gt;Data&amp;#160;: set a custom error message here&lt;/li&gt;
	&lt;li&gt;Comment&amp;#160;: whatever you want&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Activate your quota&amp;#160;: switch &lt;strong&gt;Disabled&lt;/strong&gt; to &lt;strong&gt;no&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Add a limit to your quota&amp;#160;: select your quota, and choose &lt;strong&gt;Action&lt;/strong&gt; -&amp;gt; &lt;strong&gt;Limits&lt;/strong&gt;, then &lt;strong&gt;Action&lt;/strong&gt; -&amp;gt; &lt;strong&gt;Add&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;Type&amp;#160;: &lt;strong&gt;MessageCount&lt;/strong&gt;&lt;/li&gt;
	&lt;li&gt;Counter Limit&amp;#160;: &lt;strong&gt;200&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Activate your limit&amp;#160;: switch &lt;strong&gt;Disabled&lt;/strong&gt; to &lt;strong&gt;no&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;Configure Postfix to call Cluebringer for each mail sent&lt;/h3&gt;

&lt;p&gt;Open &lt;strong&gt;/etc/postfix/main.cf&lt;/strong&gt; and locate the line &lt;strong&gt;smtpd_sender_restrictions&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Add &lt;strong&gt;check_policy_service inet:127.0.0.1:10031&lt;/strong&gt; at the end of the line, for instance&amp;#160;:&lt;/p&gt;

&lt;pre&gt;
smtpd_sender_restrictions = check_sender_access mysql:/etc/postfix/mysql-virtual_sender.cf&lt;strong&gt;, check_policy_service inet:127.0.0.1:10031&lt;/strong&gt;&lt;/pre&gt;

&lt;p&gt;If the line does not exists, simply add it.&lt;/p&gt;

&lt;p&gt;Don&amp;#8217;t forget to restart Postfix&amp;#160;:&lt;/p&gt;

&lt;pre&gt;
service postfix restart&lt;/pre&gt;

&lt;h3&gt;Check your config&lt;/h3&gt;

&lt;p&gt;You can now send some mails to see what happens. To check if these mails are passed to Cluebringer, connect to MySQL as the cluebringer user&amp;#160;:&lt;/p&gt;

&lt;pre&gt;
# mysql -u cluebringer -p cluebringer&lt;/pre&gt;

&lt;p&gt;And execute the query&amp;#160;:&lt;/p&gt;

&lt;pre&gt;
mysql&amp;gt; SELECT * FROM quotas_tracking;&lt;/pre&gt;

&lt;p&gt;You should see the value LastUpdate and Counter updating when sending a mail. Note that sending to multiple recipient will count like multiple mails were sent.&lt;/p&gt;

&lt;h3&gt;Pitfalls, bleeding edges, etc&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Cluebringer versions prior to 2.1.x does not support IPv6&lt;/strong&gt;, your customers won&amp;#8217;t be able to send any mail if they have an IPv6 connection.&lt;/p&gt;

&lt;p&gt;Unfortunately, the Debian stable version (wheezy) provides Cluebringer 2.0.10 within its repositories, as well as the experimental release of Debian (sid). As an alternative, you should consider &lt;a href=&quot;http://wiki.policyd.org/download&quot;&gt;installing the 2.1.x experimental Cluebringer&lt;/a&gt; from official website instead of Debian packages from repositories.&lt;/p&gt;

&lt;h3&gt;References&lt;/h3&gt;

&lt;ul&gt;
	&lt;li&gt;&lt;a href=&quot;http://wiki.policyd.org/installing&quot; hreflang=&quot;en&quot;&gt;Installing Policyd&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://imanudin.net/2014/09/09/zimbra-tips-how-to-configure-rate-limit-sending-message-on-policyd/&quot; hreflang=&quot;en&quot;&gt;Configuring Policyd for Zimbra&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;https://jrklein.com/2014/03/09/debian-wheezy-postfix-cluebringer-policyd-v2-ipv6/&quot; hreflang=&quot;en&quot;&gt;Debian, Cluebringer, IPv6&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description>
        
              </item>
          <item>
        <title>Set up an incremental backup with duplicity, rsync, and backupninja on Debian</title>
        <link>https://uname.pingveno.net/blog/index.php/post/2015/02/17/Set-up-files-and-database-incremental-backup-with-duplicity%2C-rsync%2C-and-backupninja-on-Debian</link>
        <guid isPermaLink="false">urn:md5:d56ab4f920ea9aee3677e1e3916e5b89</guid>
        <pubDate>Fri, 20 Feb 2015 22:08:00 +0100</pubDate>
        <dc:creator>Mathieu</dc:creator>
                  <category>Hacks</category>
                          <category>backup</category>
                  <category>backupninja</category>
                  <category>debian</category>
                  <category>server</category>
                <description>&lt;p&gt;&lt;a class=&quot;ref-post&quot; href=&quot;https://uname.pingveno.net/blog/index.php/post/2015/02/21/Configurer-un-backup-incr%C3%A9mental-avec-duplicity%2C-rsync%2C-et-backupninja-sous-Debian&quot;&gt;Version française&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This is a not-so-concise how-to about setting up an incremental backup, using Backupninja with Duplicity backend on Debian.&lt;/p&gt;

&lt;h3&gt;Abstract&lt;/h3&gt;

&lt;p&gt;If you know what a backup is, you should know there are several types of backups :&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;A full backup is when you just copy all your files, hoping that the hard drive on the backup server will not explode after 3 backups.&lt;/li&gt;
	&lt;li&gt;An incremental backup consist in a base full backup, and the next backups are just &quot;diffs&quot; sent to the backup server, to keep track of modified files.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Obviously, a full backup is easier to read and to restore because it's just plain files, whereas an incremental backup has a specific file format to represent diffs. But considering the gain in speed, bandwidth, and disk space, your choice for a long-term backup solution should be the incremental backup.&lt;/p&gt;

&lt;h3&gt;The tools&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Duplicity&lt;/strong&gt; is an opensource software similar to rdiff-backup. It creates incremental backups. Duplicity can also encrypt your backups, so they can be safely sent to any remote disk provider. A classic setup for Duplicity would be using rsync as a backend to send files faster to the remote backup server, but you can also use a local drive, a remote FTP server, or an Amazon E3 cloud server. As the title says, I will be using rsync for that setup.&lt;/p&gt;

&lt;p&gt;But what about databases ? Databases can't be saved by simply copying files, it could lead to corrupted and unusable data in your backups, so you would use a backup script to fetch your databases before sending it to Duplicity.&lt;/p&gt;

&lt;p&gt;Good news : &lt;strong&gt;backupninja&lt;/strong&gt; is the global solution you need. Backupninja is a sort of &quot;backup-master&quot; : it can fetch different type of data (files, databases...) from different sources and sent it to different destinations (plain backup, duplicity, etc). you just have to write a specific config file for each source !&lt;/p&gt;

&lt;p&gt;We will use backupninja to fetch our databases, we will add these SQL archives to our files backup, send this to Duplicity backend, and finally send it to our backup server with rsync. And with just 3 config files (one by SQL type, one for Duplicity and rsync).&lt;/p&gt;

&lt;p&gt;Let's go !&lt;/p&gt;          &lt;h3&gt;Requirements&lt;/h3&gt;

&lt;ul&gt;
	&lt;li&gt;A Debian machine to backup, let's call it &lt;strong&gt;production&lt;/strong&gt;&lt;/li&gt;
	&lt;li&gt;A backup server, with SSH access (SSH is required for rsync, but an FTP server can do the job), let's call it &lt;strong&gt;backup&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Configure the backup user on the remote machine&lt;/h3&gt;

&lt;p&gt;In order to send the backed up files to &lt;strong&gt;backup&lt;/strong&gt;, we will need a way to authenticate from &lt;strong&gt;production&lt;/strong&gt; without specifying a password.&lt;/p&gt;

&lt;p&gt;First, be root on &lt;strong&gt;production&lt;/strong&gt; : &lt;code&gt;sudo -s&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Then, create ssh key pairs : &lt;code&gt;ssh-keygen -t rsa&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The public key will set up on &lt;code&gt;/root/.ssh/id_rsa.pub&lt;/code&gt; and the private key in &lt;code&gt;/root/.ssh/id_rsa&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now, let's consider &lt;strong&gt;backup&lt;/strong&gt;, check if your SSH server on &lt;strong&gt;backup&lt;/strong&gt; acccepts the public key authentications. In &lt;code&gt;/etc/ssh/sshd_config&lt;/code&gt;, you should have the lines :&lt;/p&gt;

&lt;pre&gt;
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile     %h/.ssh/authorized_keys&lt;/pre&gt;

&lt;p&gt;If not, simply add it (and restart ssh service).&lt;/p&gt;

&lt;p&gt;Now, add the prod_server user on &lt;strong&gt;backup&lt;/strong&gt; : &lt;code&gt;useradd prod_server&lt;/code&gt;&lt;br /&gt;
You may want to change its home, I assume you know how to do it.&lt;/p&gt;

&lt;p&gt;Now, back to &lt;strong&gt;production&lt;/strong&gt;, simply copy the SSH public key to the &lt;strong&gt;backup&lt;/strong&gt; file named /home/prod_server/.ssh/authorized_keys&lt;br /&gt;
The trashy way : &lt;code&gt;scp /root/.ssh/id_rsa.pub root@backup:/home/prod_server/.ssh/authorized_keys&lt;/code&gt;&lt;br /&gt;
The classic way : copy/paste the content of &lt;code&gt;&lt;strong&gt;production:&lt;/strong&gt;/root/.ssh/id_rsa.pub&lt;/code&gt; at the end of the file &lt;code&gt;&lt;strong&gt;backup:&lt;/strong&gt;/home/prod_server/.ssh/authorized_keys&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If you did it right, you should now be able to ssh from &lt;strong&gt;production&lt;/strong&gt; to &lt;strong&gt;backup&lt;/strong&gt; without password.&lt;/p&gt;

&lt;h3&gt;Install backupninja (and friends)&lt;/h3&gt;

&lt;p&gt;On &lt;strong&gt;production&lt;/strong&gt;, use the Debian magic line : &lt;code&gt;sudo apt-get install backupninja duplicity rsync&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;Configure databases dump&lt;/h3&gt;

&lt;p&gt;Okay, let's start configuring &lt;strong&gt;backupninja&lt;/strong&gt; !&lt;/p&gt;

&lt;p&gt;For MySQL, copy the sample file from &lt;code&gt;/usr/share/doc/backupninja/examples/example.mysql&lt;/code&gt; to &lt;code&gt;/etc/backup.d/10-alldb.mysql&lt;/code&gt; and change it for your own needs (the file is pretty trivial and well commented).&lt;/p&gt;

&lt;pre&gt;
databases   = all
backupdir   = /var/backups/mysql
hotcopy     = no
sqldump     = yes
compress    = yes
configfile = /etc/mysql/debian.cnf&lt;/pre&gt;

&lt;p&gt;For PostgreSQL, all the same ! Copy &lt;code&gt;/usr/share/doc/backupninja/examples/example.mysql&lt;/code&gt; to &lt;code&gt;/etc/backup.d/10-alldb.pgsql&lt;/code&gt; and change the desired values.&lt;/p&gt;

&lt;pre&gt;
backupdir = /var/backups/postgres
databases = all
compress = yes
format = plain&lt;/pre&gt;

&lt;p&gt;Why am I using that weird &lt;code&gt;10- &lt;/code&gt;at the beginning of the file ? For the same reason you have to prefix your files with number in Nginx configuration : for precedence. I need the database dumps to be done just before the files backup, otherwise, backupninja will send to duplicity the dumps of yesterday, and next create new dumps without including it in the Duplicity files for the current backup ! So, my database backup configuration files have to be like &lt;code&gt;10- &lt;/code&gt;and my Duplicity configuration file should be like &lt;code&gt;20-, &lt;/code&gt;for instance.&lt;/p&gt;

&lt;p&gt;Note that the SQL dumps will be generated in &lt;code&gt;/var/backups/&lt;/code&gt; .&lt;/p&gt;

&lt;h3&gt;Configure Duplicity files backup&lt;/h3&gt;

&lt;p&gt;Again, copy the sample file : &lt;code&gt;cp /usr/share/doc/backupninja/examples/example.dup &lt;/code&gt;&lt;code&gt;/etc/backup.d/20-files.dup&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;And change its values :&lt;/p&gt;

&lt;pre&gt;
# Disable testconnect because we use desturl
testconnect = no

# You may change this if you are a partition-maniac
tmpdir = /tmp

[gpg]
# Using symetric encryption for archive files
# Note that an encryption method is mandaory, either with symetric or private keys
# Don't forget to note that password somewhere !
password = whateveryouwant

[source]
# Specify the paths to your files
include = /var/spool/cron/crontabs
include = /var/log
include = /var/mail
include = /var/www
include = /etc
include = /root
include = /home
include = /usr/local

# And to your database dumps !
include = /var/backups/mysql
include = /var/backups/postgresql

# There are some files we don't need
# Don't forget to add the tmpdir in the exclude list, if it was included in the previous paths !
exclude = /home/*/.gnupg
exclude = /var/cache/backupninja/duplicity
exclude = /tmp

[dest]
# Adjust these to your own taste
incremental = yes
increments = 15
keep = 30
keepincroffulls = all

# Specify the backup server crendentials
## desturl = file:///usr/local/backup
## desturl = rsync://user@other.host//var/backup/bla
## desturl = s3+http://
## desturl = ftp://myftpuser@ftp.example.org/remote/ftp/path
&lt;strong&gt;desturl = rsync://prod_server@backup//home/prod_server/data&lt;/strong&gt;

# Only if you choose FTP
# ftp_password = whateveryouwant&lt;/pre&gt;

&lt;p&gt;Note that this setup uses symetric encryption for duplicity archives, if you want an asymetric encryption to enforce the safety of your backups, you should &lt;a href=&quot;https://wiki.debian.org/Duplicity&quot; hreflang=&quot;en&quot;&gt;read the docs&lt;/a&gt; and adapt this sample configuration.&lt;/p&gt;

&lt;h3&gt;Configure backupninja update frequency&lt;/h3&gt;

&lt;p&gt;You may have noticed that backupninja set up a cronjob in &lt;code&gt;/etc/cron.d/backupninja&lt;/code&gt; but if you open that file, you will notice that this cronjob runs every hour. Why ? Because this cronjob is only used to start the backup manager, to check if a refresh is needed, not to actually run the backup every hour. You can set the backup frequency in the file &lt;code&gt;/etc/backupninja.conf&lt;/code&gt; :&lt;/p&gt;

&lt;pre&gt;
when = everyday at 01:00&lt;/pre&gt;

&lt;p&gt;Adjust it to your needs, and then save it. Note that you can combo multiple lines, if you want multiple start dates (&lt;a href=&quot;https://labs.riseup.net/code/issues/577&quot; hreflang=&quot;en&quot;&gt;read more&lt;/a&gt;).&lt;/p&gt;

&lt;h3&gt;Run you first backup, and check it&lt;/h3&gt;

&lt;p&gt;It's time for the first run ! If you don't want to wait for the cronjob, execute your first run with the command &lt;code&gt;backupninja -d -n&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If you see no errors, Bravo ! you have configured backupninja !&lt;/p&gt;

&lt;p&gt;Now, let's check our backup : connect to &lt;strong&gt;backup&lt;/strong&gt; and list files under &lt;code&gt;/home/prod_server/data/&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;You should see the files created by duplicity, you cannot use it without some commands :&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;Show the collection status : &lt;strong&gt;duplicity collection-status file:///home/prod_server/data&lt;/strong&gt;&lt;/li&gt;
	&lt;li&gt;List files in archive : &lt;strong&gt;duplicity list-current-files file:///home/prod_server/data&lt;/strong&gt;&lt;/li&gt;
	&lt;li&gt;Restore the latest backup in a specific directory &lt;strong&gt;duplicity restore file:///home/prod_server/data/ /home/prod_server/test-restore/&lt;/strong&gt; (if you see errors but files are there after the command, it's because duplicity tries to chown files, while you were not root when starting the command).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Note that you must&amp;nbsp; have Duplicity installed on &lt;strong&gt;backup&lt;/strong&gt;&amp;nbsp; on in order to use these commands on &lt;strong&gt;backup&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Also note that instead of using &lt;code&gt;file://&lt;/code&gt; on &lt;strong&gt;backup&lt;/strong&gt;, you can run the command on &lt;strong&gt;production&lt;/strong&gt; and use the ssh &lt;code&gt;desturl&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;Conclusion&lt;/h3&gt;

&lt;p&gt;You should now be able to implement a complete backup solution, using backupninja.&lt;/p&gt;

&lt;p&gt;I hope this post was useful to you, you can write a comment below if you experienced problems with this how-to.&lt;/p&gt;</description>
        
              </item>
          <item>
        <title>Configure Postfix as standalone single-domain SMTP server using Unix users and PAM on Debian</title>
        <link>https://uname.pingveno.net/blog/index.php/post/2014/02/01/Configure-Postfix-as-STMP-standalone-single-domain-server-using-Unix-users-and-PAM-on-Debian</link>
        <guid isPermaLink="false">urn:md5:e8f08f8049c5bf438f9d352254044c7f</guid>
        <pubDate>Sat, 01 Feb 2014 22:05:00 +0100</pubDate>
        <dc:creator>Mathieu</dc:creator>
                  <category>Hacks</category>
                          <category>debian</category>
                  <category>mail</category>
                  <category>note</category>
                  <category>pam</category>
                  <category>postfix</category>
                  <category>sasl</category>
                  <category>server</category>
                <description>          &lt;p&gt;Here is a quick setup to configure Postfix mail server, using existing Unix users.&lt;/p&gt;

&lt;p&gt;The server will process mails for only one domain, and every existing user on the server will have a mail box inside his home directory.&lt;/p&gt;

&lt;h3&gt;Abstract&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Postfix&lt;/strong&gt; is an &lt;strong&gt;SMTP&lt;/strong&gt; server, it receives incoming mail from other &lt;strong&gt;SMTP&lt;/strong&gt; servers, and allows client to send mails to other &lt;strong&gt;SMTP&lt;/strong&gt; servers.&lt;/p&gt;

&lt;p&gt;What we don't want is an open mail relay. A mail relay is a &lt;strong&gt;SMTP&lt;/strong&gt; server that take anything from any client, and send it to any &lt;strong&gt;SMTP&lt;/strong&gt; server. We only want trusted users to send emails, to prevent anonymous clients from sending spam.&lt;/p&gt;

&lt;p&gt;Incoming mail will be processed either if :&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;The domain name of one of the recipient matches the mail server domain, and the mail user name is also a system user (&lt;strong&gt;SMTP&lt;/strong&gt; servers can send us incoming mails).&lt;/li&gt;
	&lt;li&gt;The client who tries to sends the mail has successfully authenticated.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Postfix&lt;/strong&gt; authentication for clients can be handled by &lt;strong&gt;SASL&lt;/strong&gt;. &lt;strong&gt;SASL&lt;/strong&gt; is a standard protocol to provide an authentication layer. It can query &lt;strong&gt;PAM&lt;/strong&gt;, or other authentication providers (MySQL users, etc).&lt;/p&gt;

&lt;p&gt;Notes :&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;&lt;em&gt;We will use PAM for Unix users SMTP authentication.&lt;/em&gt;&lt;/li&gt;
	&lt;li&gt;&lt;em&gt;Unix users are stored in&lt;code&gt; /etc/passwd&lt;/code&gt; and their passwords are stored in &lt;code&gt;/etc/shadow&lt;/code&gt;&lt;/em&gt;.&lt;/li&gt;
	&lt;li&gt;&lt;em&gt;Mails will be stored in the ~/Maildir/ of each users, in Maildir format.&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Postfix : installation and configuration&lt;/h3&gt;

&lt;p&gt;Install Postfix : &lt;code&gt;apt-get install postfix&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Answer the questions during installation to setup your mail domain (the &quot;example.com&quot; in user@example.com).&lt;/p&gt;

&lt;p&gt;Modify config files :&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;/etc/postfix/main.cf&lt;/strong&gt; :&lt;/p&gt;

&lt;p&gt;Configure TLS and Maildir :&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;# TLS parameters&lt;br /&gt;
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key&lt;br /&gt;
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem&lt;br /&gt;
smtpd_tls_CAfile = /etc/ssl/certs/ca-certificates.crt&lt;br /&gt;
smtpd_use_tls=yes&lt;br /&gt;
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache&lt;br /&gt;
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache&lt;br /&gt;
&lt;br /&gt;
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for&lt;br /&gt;
# information on enabling SSL in the smtp client.&lt;br /&gt;
&lt;br /&gt;
myhostname = mail.example.com&lt;br /&gt;
alias_maps = hash:/etc/aliases&lt;br /&gt;
alias_database = hash:/etc/aliases&lt;br /&gt;
myorigin = /etc/mailname&lt;br /&gt;
mydestination = example.com, localhost&lt;br /&gt;
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128&lt;br /&gt;
mailbox_size_limit = 0&lt;br /&gt;
recipient_delimiter = +&lt;br /&gt;
&lt;br /&gt;
home_mailbox = Maildir/&lt;br /&gt;
&lt;br /&gt;
# These are the &quot;no relay&quot; restrictions&lt;br /&gt;
smtpd_recipient_restrictions = permit_mynetworks permit_inet_interfaces permit_sasl_authenticated reject_unauth_destination&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;/etc/postfix/master.cf&lt;/strong&gt; :&lt;/p&gt;

&lt;p&gt;Enable TLS and alternate (submission) ports :&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;submission inet n&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; smtpd&lt;br /&gt;
&amp;nbsp; -o syslog_name=postfix/submission&lt;br /&gt;
&amp;nbsp; -o smtpd_tls_security_level=encrypt&lt;br /&gt;
&amp;nbsp; -o smtpd_sasl_auth_enable=yes&lt;br /&gt;
&amp;nbsp; -o smtpd_client_restrictions=permit_sasl_authenticated,reject&lt;br /&gt;
&amp;nbsp; -o milter_macro_daemon_name=ORIGINATING&lt;br /&gt;
smtps&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; inet&amp;nbsp; n&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; smtpd&lt;br /&gt;
&amp;nbsp; -o syslog_name=postfix/smtps&lt;br /&gt;
&amp;nbsp; -o smtpd_tls_wrappermode=yes&lt;br /&gt;
&amp;nbsp; -o smtpd_sasl_auth_enable=yes&lt;br /&gt;
&amp;nbsp; -o smtpd_client_restrictions=permit_sasl_authenticated,reject&lt;br /&gt;
&amp;nbsp; -o milter_macro_daemon_name=ORIGINATING&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;SASL : installation and configuration&lt;/h3&gt;

&lt;p&gt;SASL plugin for Postfix (Cyrus) is part of the dependencies of Postfix server.&lt;/p&gt;

&lt;p&gt;Install SASL administration tools : &lt;code&gt;apt-get install sasl2-bin&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Enable SASL daemon at startup : edit &lt;strong&gt;/etc/default/saslauthd&lt;/strong&gt; and switch &lt;code&gt;START&lt;/code&gt; to &lt;code&gt;yes&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Start it manually for the first time : &lt;code&gt;service saslauthd start&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;Enable PAM authentication for SASL&lt;/h3&gt;

&lt;p&gt;Check that PAM is part of the MECHANISMS variable in &lt;strong&gt;/etc/default/saslauthd&lt;/strong&gt; :&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;MECHANISMS=&quot;pam&quot;&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Create &lt;strong&gt;/etc/pam.d/smtp&lt;/strong&gt; :&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;#&lt;br /&gt;
# /etc/pam.d/smtp - specify PAM SMTP behavior&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
@include common-auth&lt;br /&gt;
@include common-account&lt;br /&gt;
@include common-password&lt;br /&gt;
@include common-session&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;Enable SASL for Postfix&lt;/h3&gt;

&lt;p&gt;Add to &lt;strong&gt;/etc/postfix/main.cf&lt;/strong&gt; :&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;smtpd_sasl_auth_enable = yes&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Create &lt;strong&gt;/etc/postfix/sasl/smtpd.conf&lt;/strong&gt; :&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;pwcheck_method: saslauthd&lt;br /&gt;
mech_list: PLAIN LOGIN&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Adjust &lt;code&gt;OPTIONS&lt;/code&gt; in &lt;strong&gt;/etc/default/saslauthd&lt;/strong&gt; :&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;OPTIONS=&quot;-c -m /var/spool/postfix/var/run/saslauthd&quot;&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Add &lt;strong&gt;postfix user&lt;/strong&gt; to &lt;strong&gt;sasl group&lt;/strong&gt; :&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;adduser postfix sasl&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;Configuration check&lt;/h3&gt;

&lt;p&gt;Restart all services (postfix, salsauthd).&lt;/p&gt;

&lt;p&gt;Try authentication using SASL : &lt;code&gt;testsaslauthd -u user -p password&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Try authentication from command line, without mail client : &lt;a href=&quot;https://qmail.jms1.net/test-auth.shtml&quot; hreflang=&quot;en&quot;&gt;https://qmail.jms1.net/test-auth.shtml&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Try SMTP reception by sending mail to your domain (your MX fields in domain has to be configured accordingly).&lt;/p&gt;

&lt;h3&gt;Sources&lt;/h3&gt;

&lt;ul&gt;
	&lt;li&gt;&lt;a href=&quot;http://www.postfix.org/SASL_README.html#saslauthd&quot; hreflang=&quot;en&quot;&gt;Postfix SASL Howto&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://www.postfix.org/SASL_README.html#testing_saslauthd&quot; hreflang=&quot;en&quot;&gt;Testing SASL auth&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://blog.ntrippy.net/2008/05/warning-sasl-authentication-failure.html&quot; hreflang=&quot;en&quot;&gt;Fixing SASL authentication failure: cannot connect to saslauthd server: No such file or directory&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://www.faqforge.com/linux/how-to-enable-port-587-submission-in-postfix/&quot; hreflang=&quot;en&quot;&gt;How to enable submission ports in Postfix&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;https://www.howtoforge.com/community/threads/cannot-connect-to-saslauthd-server-permission-denied.22730/&quot; hreflang=&quot;en&quot;&gt;Cannot connect to saslauthd : permission denied&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description>
        
              </item>
          <item>
        <title>Configure Munin graphs with Nginx, FastCGI, and Debian 7</title>
        <link>https://uname.pingveno.net/blog/index.php/post/2013/08/25/Configure-Munin-graphs-with-Nginx-and-Debian-7</link>
        <guid isPermaLink="false">urn:md5:d14a00a2d515953f6b51a757207912d8</guid>
        <pubDate>Sun, 25 Aug 2013 11:40:00 +0200</pubDate>
        <dc:creator>Mathieu</dc:creator>
                  <category>Informatique</category>
                          <category>debian</category>
                  <category>fastcgi</category>
                  <category>munin</category>
                  <category>nginx</category>
                  <category>server</category>
                  <category>wheezy</category>
                <description>&lt;p&gt;Setting up Munin with Nginx can be a little harsh. Here is the ready-to-go solution for Debian Wheezy.&lt;/p&gt;          &lt;p&gt;I will make the assumption that you have already configured Munin and Munin-node. I also assume that you didn&amp;#8217;t change the CGI and CRON params in the Munin default configuration provided by the Debian package.&lt;/p&gt;

&lt;h3&gt;Abstract&lt;/h3&gt;

&lt;ul&gt;
	&lt;li&gt;
	&lt;p&gt;In the default configuration, the HTML files for Munin graphes are generated by Cron, and are stored in &lt;code&gt;/var/cache/munin/www/&lt;/code&gt;&lt;/p&gt;
	&lt;/li&gt;
	&lt;li&gt;
	&lt;p&gt;To display Munin graphs, you have to call the &lt;code&gt;munin-cgi-graph&lt;/code&gt; program located in &lt;code&gt;/usr/lib/munin/cgi/&lt;/code&gt;&lt;/p&gt;
	&lt;/li&gt;
	&lt;li&gt;
	&lt;p&gt;To display Munin extra HTML, you have to call the &lt;code&gt;munin-cgi-html&lt;/code&gt; program located in &lt;code&gt;/usr/lib/munin/cgi/&lt;/code&gt;&lt;/p&gt;
	&lt;/li&gt;
	&lt;li&gt;
	&lt;p&gt;The configuration I use is an adapted version of Apache configuration delivered with the Debian package at &lt;code&gt;/etc/munin/apache2.conf&lt;/code&gt;.&lt;/p&gt;
	&lt;/li&gt;
	&lt;li&gt;
	&lt;p&gt;Unlike Apache, Nginx does not spawn CGI processes, you will have to make a startup script to create the appropriate sockets.&lt;/p&gt;
	&lt;/li&gt;
	&lt;li&gt;
	&lt;p&gt;The spawned sockets run with the munin user, you will have to chown some logfiles and change logrotate configuration.&lt;/p&gt;
	&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Installation&lt;/h3&gt;

&lt;p&gt;Let&amp;#8217;s start with a basic Ningx installation&amp;#160;: &lt;code&gt;apt-get install nginx&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Next, add &lt;code&gt;fcgiwrap&lt;/code&gt;, the Ningx CGI wrapper&amp;#160;: &lt;code&gt;apt-get install fcgiwrap&lt;/code&gt;. Note that in the dependencies, you have &lt;code&gt;spawn-fcgi&lt;/code&gt;. we will use it to create the CGI sockets.&lt;/p&gt;

&lt;h3&gt;The CGI sockets&lt;/h3&gt;

&lt;p&gt;To spawn the &lt;code&gt;munin-cgi-graph&lt;/code&gt; and &lt;code&gt;munin-cgi-html&lt;/code&gt; processes, create a startup script at &lt;code&gt;/etc/init.d/munin-fastcgi&lt;/code&gt;&amp;#160;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;#! /bin/sh&lt;br /&gt;
### BEGIN INIT INFO&lt;br /&gt;
# Provides:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; munin-fastcgi&lt;br /&gt;
# Required-Start:&amp;nbsp;&amp;nbsp;&amp;nbsp; $remote_fs $network&lt;br /&gt;
# Required-Stop:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $remote_fs $network&lt;br /&gt;
# Default-Start:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2 3 4 5&lt;br /&gt;
# Default-Stop:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 1 6&lt;br /&gt;
# Short-Description: starts munin-fastcgi&lt;br /&gt;
# Description:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Spawn Munin FCGI sockets for Web access&lt;br /&gt;
### END INIT INFO&lt;br /&gt;
&lt;br /&gt;
#&lt;br /&gt;
# munin-fastcgi&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Startup script for Munin CGI services&lt;br /&gt;
#&lt;br /&gt;
# chkconfig: - 84 15&lt;br /&gt;
# description: Loading Munin CGI services using spawn-cgi&lt;br /&gt;
#&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; HTML files and CGI.&lt;br /&gt;
#&lt;br /&gt;
# Author:&amp;nbsp; Ryan Norbauer &amp;lt;ryan.norbauer@gmail.com&amp;gt;&lt;br /&gt;
# Modified:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Geoffrey Grosenbach http://topfunky.com&lt;br /&gt;
# Modified:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; David Krmpotic http://davidhq.com&lt;br /&gt;
# Modified:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Kun Xi http://kunxi.org&lt;br /&gt;
# Modified:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; http://drumcoder.co.uk/&lt;br /&gt;
# Modified:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; http://uname.pingveno.net/&lt;br /&gt;
&lt;br /&gt;
DAEMON=/usr/bin/spawn-fcgi&lt;br /&gt;
FCGI_GRAPH_SOCK=/var/run/munin/fastcgi-munin-graph.sock&lt;br /&gt;
FCGI_HTML_SOCK=/var/run/munin/fastcgi-munin-html.sock&lt;br /&gt;
WWW_USER=www-data&lt;br /&gt;
FCGI_USER=munin&lt;br /&gt;
FCGI_GROUP=munin&lt;br /&gt;
FCGI_SPAWN_GRAPH=/usr/lib/munin/cgi/munin-cgi-graph&lt;br /&gt;
FCGI_SPAWN_HTML=/usr/lib/munin/cgi/munin-cgi-html&lt;br /&gt;
PIDFILE_GRAPH=/var/run/munin/fastcgi-munin-graph.pid&lt;br /&gt;
PIDFILE_HTML=/var/run/munin/fastcgi-munin-html.pid&lt;br /&gt;
DESC=&quot;Munin FCGI for Graph an HTML&quot;&lt;br /&gt;
&lt;br /&gt;
# Gracefully exit if the package has been removed.&lt;br /&gt;
test -x $DAEMON || exit 0&lt;br /&gt;
test -x $FCGI_SPAWN_GRAPH || exit 0&lt;br /&gt;
test -x $FCGI_SPAWN_HTML || exit 0&lt;br /&gt;
&lt;br /&gt;
start() {&lt;br /&gt;
&amp;nbsp; $DAEMON -s $FCGI_GRAPH_SOCK -U $WWW_USER -u $FCGI_USER -g $FCGI_GROUP -P $PIDFILE_GRAPH $FCGI_SPAWN_GRAPH 2&amp;gt; /dev/null || echo &quot;Graph Already running&quot;&lt;br /&gt;
&amp;nbsp; $DAEMON -s $FCGI_HTML_SOCK -U $WWW_USER -u $FCGI_USER -g $FCGI_GROUP -P $PIDFILE_HTML $FCGI_SPAWN_HTML 2&amp;gt; /dev/null || echo &quot;HTML Already running&quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
stop() {&lt;br /&gt;
&amp;nbsp; kill -QUIT `cat $PIDFILE_GRAPH` || echo &quot;Graph not running&quot;&lt;br /&gt;
&amp;nbsp; kill -QUIT `cat $PIDFILE_HTML` || echo &quot;HTML Not running&quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
restart() {&lt;br /&gt;
&amp;nbsp; kill -HUP `cat $PIDFILE_GRAPH` || echo &quot;Can't reload Graph&quot;&lt;br /&gt;
&amp;nbsp; kill -HUP `cat $PIDFILE_HTML` || echo &quot;Can't reload HTML&quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
case &quot;$1&quot; in&lt;br /&gt;
&amp;nbsp; start)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; echo &quot;Starting $DESC: &quot;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; start&lt;br /&gt;
&amp;nbsp; ;;&lt;br /&gt;
&amp;nbsp; stop)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; echo &quot;Stopping $DESC: &quot;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; stop&lt;br /&gt;
&amp;nbsp; ;;&lt;br /&gt;
&amp;nbsp; restart|reload)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; echo &quot;Restarting $DESC: &quot;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; stop&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; # One second might not be time enough for a daemon to stop,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; # if this happens, d_start will fail (and dpkg will break if&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; # the package is being upgraded). Change the timeout if needed&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; # be, or change d_stop to have start-stop-daemon use --retry.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Notice that using --retry slows down the shutdown process somewhat.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; sleep 1&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; start&lt;br /&gt;
&amp;nbsp; ;;&lt;br /&gt;
&amp;nbsp; *)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; echo &quot;Usage: $SCRIPTNAME {start|stop|restart|reload}&quot; &amp;gt;&amp;amp;2&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; exit 3&lt;br /&gt;
&amp;nbsp; ;;&lt;br /&gt;
esac&lt;br /&gt;
&lt;br /&gt;
exit $?&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Don&amp;#8217;t forget to set it executable&amp;#160;: &lt;code&gt;chmod +x /etc/init.d/munin-fastcgi&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Finally, add your startup script to runlevels&amp;#160;: &lt;code&gt;update-rc.d munin-fastcgi defaults&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;And start it&amp;#160;: &lt;code&gt;service munin-fastcgi start&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;Fix for log files&lt;/h3&gt;

&lt;p&gt;The log files are owned by &lt;code&gt;www-data&lt;/code&gt; user. In our configuration, the CGI process is run by &lt;code&gt;munin&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Change the owner of logfiles&amp;#160;: &lt;code&gt;chown munin /var/log/munin/munin-cgi-graph.log &amp;amp;&amp;amp; chown munin /var/log/munin/munin-cgi-html.log&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Change the logrotate configuration&amp;#160;: &lt;code&gt;open /etc/logrotate.d/munin&lt;/code&gt; and change &lt;code&gt;create 640 www-data adm&lt;/code&gt; to &lt;code&gt;create 640 munin adm&lt;/code&gt; for the two logfiles.&lt;/p&gt;

&lt;h3&gt;Nginx VirtualHost configuration&lt;/h3&gt;

&lt;p&gt;Create the following /etc/nginx/sites-available/munin&amp;#160;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;server {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #listen&amp;nbsp;&amp;nbsp; 80; ## listen for ipv4; this line is default and implied&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #listen&amp;nbsp;&amp;nbsp; [::]:80 default_server ipv6only=on; ## listen for ipv6&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Make site accessible from http://localhost/&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; server_name localhost;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Here, the whole vhost has auth requirements.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # You can duplicate it to the graph and html locations if you have&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # something else that doesn't need auth.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; auth_basic&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;Private access&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; auth_basic_user_file&amp;nbsp; /etc/munin/munin_htpasswd;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; location /munin/ {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; alias /var/cache/munin/www/;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # not authenticated =&amp;gt; no rewrite (back to auth)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ($remote_user ~ ^$) { break; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # is on the right subtree ?&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set $ok &quot;no&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # admin can see it all&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ($remote_user = 'admin') { set $ok &quot;yes&quot;; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # only allow given path&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ($uri ~ /munin/([^/]*)) { set $path $1; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ($path = $remote_user) { set $ok &quot;yes&quot;; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # not allowed here ? redirect them where they should land&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ($ok != &quot;yes&quot;) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # redirect to where they should be&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rewrite / /munin/$remote_user/ redirect;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; location ^~ /munin-cgi/munin-cgi-graph/ {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # not authenticated =&amp;gt; no rewrite (back to auth)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ($remote_user ~ ^$) { break; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # is on the right subtree ?&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set $ok &quot;no&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # admin can see it all&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ($remote_user = 'admin') { set $ok &quot;yes&quot;; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # only allow given path&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ($uri ~ /munin-cgi/munin-cgi-graph/([^/]*)) { set $path $1; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ($path = $remote_user) { set $ok &quot;yes&quot;; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # not allowed here ? redirect them where they should land&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ($ok != &quot;yes&quot;) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # redirect to where they should be&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rewrite / /munin-cgi/munin-cgi-graph/$remote_user/ redirect;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fastcgi_split_path_info ^(/munin-cgi/munin-cgi-graph)(.*);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fastcgi_param PATH_INFO $fastcgi_path_info;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fastcgi_pass unix:/var/run/munin/fastcgi-munin-graph.sock;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; include fastcgi_params;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; location&amp;nbsp; ^~ /munin-cgi/munin-cgi-html/ {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # not authenticated =&amp;gt; no rewrite (back to auth)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ($remote_user ~ ^$) { break; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # is on the right subtree ?&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set $ok &quot;no&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # admin can see it all&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ($remote_user = 'admin') { set $ok &quot;yes&quot;; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # only allow given path&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ($uri ~ /munin-cgi/munin-cgi-html/([^/]*)) { set $path $1; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ($path = $remote_user) { set $ok &quot;yes&quot;; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # not allowed here ? redirect them where they should land&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ($ok != &quot;yes&quot;) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # redirect to where they should be&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rewrite / /munin-cgi/munin-cgi-html/$remote_user/ redirect;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fastcgi_split_path_info ^(/munin-cgi/munin-cgi-html)(.*);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fastcgi_param PATH_INFO $fastcgi_path_info;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fastcgi_pass unix:/var/run/munin/fastcgi-munin-html.sock;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; include fastcgi_params;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; location /munin/static/ {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; alias /etc/munin/static/;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
}&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Don&amp;#8217;t forget to enable your VirtualHost&amp;#160;: &lt;code&gt;ln -s /etc/nginx/sites-available/munin /etc/nginx/sites-enabled/munin&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;And to restart Nginx&amp;#160;: &lt;code&gt;service nginx restart&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;Htaccess creation&lt;/h3&gt;

&lt;p&gt;To protect our stats, the VirtualHost includes HTTP authentication. But you have to create the htpasswd file in &lt;code&gt;/etc/munin/munin_htpasswd&lt;/code&gt;. To do so, you can install Apache Utils.&lt;/p&gt;

&lt;p&gt;Install Apache utils&amp;#160;: &lt;code&gt;apt-get install apache2-utils&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Create the htpasswd&amp;#160;: &lt;code&gt;touch /etc/munin/munin_htpasswd &amp;amp;&amp;amp; chown root:www-data /etc/munin/munin_htpasswd &amp;amp;&amp;amp; chmod 640 /etc/munin/munin_htpasswd&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;And add your admin password&amp;#160;: &lt;code&gt;htpasswd /etc/munin/munin_htpasswd&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;Conclusion&lt;/h3&gt;

&lt;p&gt;Your Munin installation will be available at &lt;a href=&quot;http://localhost/munin/&quot;&gt;http://localhost/munin/&lt;/a&gt; with your admin password.&lt;/p&gt;

&lt;p&gt;I hope I saved you from a headhache. &lt;img src=&quot;/blog/themes/mathedit_material3/smilies/wink.png&quot; alt=&quot;;)&quot; class=&quot;smiley&quot;&gt;&lt;/p&gt;

&lt;h4&gt;Sources&lt;/h4&gt;

&lt;p&gt;&lt;a href=&quot;http://munin.readthedocs.org/en/latest/example/webserver/nginx.html&quot;&gt;http://munin.readthedocs.org/en/latest/example/webserver/nginx.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://drumcoder.co.uk/blog/2010/aug/04/debian-initd-script-fcgi/&quot;&gt;http://drumcoder.co.uk/blog/2010/aug/04/debian-initd-script-fcgi/&lt;/a&gt;&lt;/p&gt;</description>
        
              </item>
          <item>
        <title>Configure 2-factor Yubikey authentication for Debian : the easiest way</title>
        <link>https://uname.pingveno.net/blog/index.php/post/2013/08/06/Configure-2-factor-Yubikey-authentication-for-Debian-%3A-the-easiest-way</link>
        <guid isPermaLink="false">urn:md5:db871557ab4246d3da107e8cd37a6384</guid>
        <pubDate>Tue, 06 Aug 2013 00:20:00 +0200</pubDate>
        <dc:creator>Mathieu</dc:creator>
                  <category>Hacks</category>
                          <category>2-factor authentication</category>
                  <category>debian</category>
                  <category>PAM</category>
                  <category>server</category>
                  <category>ssh</category>
                  <category>token</category>
                  <category>yubico</category>
                  <category>yubikey</category>
                <description>          &lt;p&gt;One of last five years trending topics is the rise of Token authentication, to provide a safer way to authenticate than the classic login/password couple.&lt;/p&gt;
&lt;p&gt;Today I will show you how to configure a 2-factor authentication (login/password + yubikey), in order to use it with your local Unix users as well as with SSH login (PAM powered).&lt;/p&gt;
&lt;p&gt;In this tutorial, I will use the Yubico API, because it&amp;#8217;s simpler. When using the API, the validity check will be computed by Yubico servers. By the way, you can set up your own authentication server if you don&amp;#8217;t want to depend on Yubico servers.&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;p&gt;First things first, you have to afford a Yubikey at &lt;a hreflang=&quot;en&quot; href=&quot;http://www.yubico.com/&quot;&gt;http://www.yubico.com/&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Get your &lt;strong&gt;Yubikey ID.&lt;/strong&gt; You can use the 12 first digit of every Yubikey generated password, but you can also generate it from &lt;a hreflang=&quot;en&quot; href=&quot;http://demo.yubico.com/php-yubico/Modhex_Calculator.php&quot;&gt;http://demo.yubico.com/php-yubico/Modhex_Calculator.php&lt;/a&gt;&lt;br /&gt;For lazy people, type this in a shell and activate your Yubikey&amp;#160;: &lt;code&gt;read -p &quot;Enter a YubiKey OTP: &quot; s &amp;amp;&amp;amp; echo 'The key id is' ${s:0:12}&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create a &lt;code&gt;.yubico&lt;/code&gt; directory in your home, and create a file named &lt;code&gt;authorized_yubikeys&lt;/code&gt; inside it. Fill this file with your &lt;strong&gt;unix username&lt;/strong&gt; and &lt;strong&gt;Yubikey ID&lt;/strong&gt; like that&amp;#160;: &lt;code&gt;username:yubikeyid&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Next, create a id/secret couple for each server ou service you want to authenticate&amp;#160;: &lt;a hreflang=&quot;en&quot; href=&quot;https://upgrade.yubico.com/getapikey/&quot;&gt;https://upgrade.yubico.com/getapikey/&lt;/a&gt;&lt;br /&gt;The ID returned after submitting the URL is the &lt;strong&gt;service ID&lt;/strong&gt;, and the &lt;strong&gt;secret&lt;/strong&gt; is the associated secret. Every pair ID/secret is unique.&lt;br /&gt;You could use the same id/secret for every server you configure, but it is not intended for&amp;#160;: you should use a different id/secret couple for every different server.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Log in to your server &lt;strong&gt;as root&lt;/strong&gt;, and install &lt;code&gt;libpam-yubico&lt;/code&gt; (from apt&amp;#160;: &lt;code&gt;apt-get install libpam-yubico&lt;/code&gt;).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;And configure it&amp;#160;: &lt;code&gt;sudo dpkg-reconfigure libpam-yubico&lt;/code&gt;. When prompted, set the &lt;strong&gt;service ID&lt;/strong&gt; in place of the N in &lt;em&gt;id=N&lt;/em&gt; and the &lt;strong&gt;secret&lt;/strong&gt; in place of the K in &lt;em&gt;key=K&lt;/em&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Then apply the configuration with the command &lt;code&gt;pam-auth-update&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;That&amp;#8217;s all&amp;#160;! Every PAM-compliant authentication will now ask for the Yubikey code to authenticate (as well as login and password). When login from SSH, juste activate your Yubikey after typing your password, before typing &amp;#8220;enter&amp;#8221;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Warning&amp;#160;: if you messed up the Yubikey configuration and are using &amp;#8220;sudo&amp;#8221; before every command, you will be locked outside your server&amp;#160;! After dpkg-reconfigure, if you checked &amp;#8220;Yubico authentication&amp;#8221;,&amp;nbsp;it will ask for a Yubikey code every time a &amp;#8220;sudo&amp;#8221; authentication is required, so keep a root terminal opened to revert your changes.&lt;/strong&gt;&lt;/p&gt;</description>
        
              </item>
          <item>
        <title>Apache : globally configure HTTPS for all VirtualHosts</title>
        <link>https://uname.pingveno.net/blog/index.php/post/2013/01/25/Apache-%3A-globally-configure-HTTPS-for-all-VirtualHosts</link>
        <guid isPermaLink="false">urn:md5:fe226c3e55b5ee9393d47508ef2ebab3</guid>
        <pubDate>Sat, 16 Mar 2013 19:16:00 +0100</pubDate>
        <dc:creator>Mathieu</dc:creator>
                  <category>Hacks</category>
                          <category>apache</category>
                  <category>configuration</category>
                  <category>https</category>
                  <category>server</category>
                <description>          &lt;p&gt;You want to configure &amp;#8220;once and for all&amp;#8221; HTTPs for all domains and sub-domains handled by your webserver, and you don&amp;#8217;t want to redeclare the certificate in each VirtualHost. Here is the trick.&lt;/p&gt;
&lt;p&gt;I run Debian. In a default Apache installation, the directory &lt;strong&gt;/etc/sites-enabled&lt;/strong&gt; contains a file named &lt;strong&gt;000-default&lt;/strong&gt; which declares a default VirtualHost for HTTP.&lt;/p&gt;
&lt;p&gt;You have to know that when Apache loads an entire directory of configuration files, the files are read in alphabetical order. So if you want to declare something before something else, you can cheat on its name in the loaded configuration. It is exactly what &lt;strong&gt;000-default&lt;/strong&gt; does.&lt;/p&gt;
&lt;p&gt;In &lt;strong&gt;/etc/apache2/sites-available&lt;/strong&gt;, you have a file named &lt;strong&gt;default-ssl&lt;/strong&gt;. Edit this file to fit your needs (path to certificate, etc). Note that this certificate will be the same for all the domains hosted on your server. It&amp;#8217;s what we want&amp;#160;: only one configuration. If you are hosting multiple domains on the same server, the certificate will probably be invalid for at least one of your domains, and you should use &lt;a hreflang=&quot;en&quot; href=&quot;http://httpd.apache.org/docs/trunk/en/mod/mod_macro.html&quot;&gt;mod_macro&lt;/a&gt; instead of a global HTTPs configuration.&lt;/p&gt;
&lt;p&gt;Now, enable the website the common way&amp;#160;: &lt;strong&gt;a2ensite default-ssl&lt;/strong&gt;. Don&amp;#8217;t restart Apache yet.&lt;/p&gt;
&lt;p&gt;Rename the file &lt;strong&gt;default-ssl&lt;/strong&gt; created in &lt;strong&gt;/etc/apache2/sites-enabled/&lt;/strong&gt; to &lt;strong&gt;000-default-ssl&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Configure your other VirtualHost with a &lt;strong&gt;*:80&lt;/strong&gt; section and a &lt;strong&gt;*:443&lt;/strong&gt; section, as usual but without specifying certificate and SSL informations for VirtualHosts on &lt;strong&gt;*:443&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;If you restart Apache, you will notice something like this&amp;#160;:&lt;/p&gt;
&lt;pre&gt;_default_ virtualhost overlap on port 443&lt;/pre&gt;
&lt;p&gt;To get rid of these warnings, just add to your &lt;strong&gt;ports.conf&lt;/strong&gt;, in the right section&amp;#160;: &lt;/p&gt;
&lt;pre&gt;NameVirtualHost *:443
Listen 443 http&lt;/pre&gt;
&lt;p&gt;When you finally restart Apache, every VirtualHost declared as &lt;strong&gt;*:443&lt;/strong&gt; will use the certificate defined in &lt;strong&gt;000-default-ssl&lt;/strong&gt; without mentioning it.&lt;/p&gt;</description>
        
              </item>
      </channel>
</rss>
