<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule">
<channel>
    <title>freebsd.munk.me.uk - Security</title>
    <link>http://freebsd.munk.me.uk/</link>
    <description>FreeBSD System Administration</description>
    <dc:language>en</dc:language>
    <generator>Serendipity 1.5.2 - http://www.s9y.org/</generator>
    
    <image>
        <url>http://freebsd.munk.me.uk/templates/default/img/s9y_banner_small.png</url>
        <title>RSS: freebsd.munk.me.uk - Security - FreeBSD System Administration</title>
        <link>http://freebsd.munk.me.uk/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>Installing Exim, SASLAuthd, ClamAV and SpamAssassin on FreeBSD 6.2</title>
    <link>http://freebsd.munk.me.uk/archives/212-Installing-Exim,-SASLAuthd,-ClamAV-and-SpamAssassin-on-FreeBSD-6.2.html</link>
            <category>Email</category>
            <category>Ports</category>
            <category>Security</category>
            <category>Spam</category>
    
    <comments>http://freebsd.munk.me.uk/archives/212-Installing-Exim,-SASLAuthd,-ClamAV-and-SpamAssassin-on-FreeBSD-6.2.html#comments</comments>
    <wfw:comment>http://freebsd.munk.me.uk/wfwcomment.php?cid=212</wfw:comment>

    <slash:comments>13</slash:comments>
    <wfw:commentRss>http://freebsd.munk.me.uk/rss.php?version=2.0&amp;type=comments&amp;cid=212</wfw:commentRss>
    

    <author>nospam@example.com (munk)</author>
    <content:encoded>
    &lt;strong&gt;Introduction&lt;/strong&gt;&lt;br /&gt;
This article describes the steps necessary to install and configure Exim on FreeBSD 6.2 with support for the following:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;li/&gt;authenticated SMTP (asmtp) using SASLAuthd&lt;br /&gt;
&lt;li/&gt;spam detection and quarantine using SpamAssassin&lt;br /&gt;
&lt;li/&gt;malware detection and quarantine using ClamAV&lt;/ul&gt;&lt;br /&gt;
&lt;br /&gt;
Each of the required &#039;dependencies&#039; or components will be installed and configured, Exim will be installed and configured and finally we will test to check each component is working as required.&lt;br /&gt;
&lt;br /&gt;
With regards to spam and malware scanning, the system described will quarantine any files/messages that it finds classified as spam or malware.  In this way the quarantined files can be checked over by the admin at a later date and various stats gathering can be done if required.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Installing and Configuring SASLAuthd&lt;/strong&gt;&lt;br /&gt;
SASLAuthd is an authentication daemon that can handle authentication requests from 3rd party applications such as Exim - generally for any application that can&#039;t directly access a system password database because of permission restrictions.  In this case running Exim MTA as &#039;root&#039; is a potential security risk, so exim runs as the &#039;mailnull&#039; user on FreeBSD.  Unfortunately this means Exim can&#039;t easily read the system password database to authenticate users who want to send mail via the server, which is where SASLAuthd comes in.  Any requests for authentication with Exim are passed on to the SASLAuthd daemon which will then verify whether the user credentials are valid - if so, the email is delivered, if not, it&#039;s rejected.&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;&lt;li/&gt;Install SASLAuthd from the FreeBSD ports tree:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;root@win&amp;#160;/root#&amp;#160;cd&amp;#160;/usr/ports/security/cyrus-sasl2-saslauthd/&lt;br /&gt;
root@win&amp;#160;/usr/ports/security/cyrus-sasl2-saslauthd#&amp;#160;make&amp;#160;install&lt;br /&gt;
...&lt;br /&gt;
root@win&amp;#160;/usr/ports/security/cyrus-sasl2-saslauthd#&amp;#160;rehash&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;li/&gt;Configure SASLAuthd to run at boot.&lt;br /&gt;
&lt;br /&gt;
Edit /etc/rc.conf to include the following:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;saslauthd_enable=&quot;YES&quot;&lt;br /&gt;
saslauthd_flags=&quot;-a&amp;#160;getpwent&quot;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Note:&lt;/b&gt;&lt;br /&gt;
SASLAuthd will run using the &#039;getpwent&#039; authentication mechanism with the flag above.  This method uses the passwd file directly instead of using other means like kerberos or PAM.  If you require another method, check the manpage for saslauthd.&lt;br /&gt;
&lt;br /&gt;
&lt;li/&gt;Start the SASLAuthd daemon running:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;root@win&amp;#160;/usr/ports/security/cyrus-sasl2-saslauthd#&amp;#160;cd&amp;#160;/usr/local/etc/rc.d&lt;br /&gt;
root@win&amp;#160;/usr/local/etc/rc.d#&amp;#160;./saslauthd&amp;#160;start&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;li/&gt;(Optional) Test the SASLAuthd daemon:&lt;br /&gt;
&lt;br /&gt;
Substitute &#039;user&#039; and &#039;pass&#039; for the username and password of a user&lt;br /&gt;
account on your system:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;root@win&amp;#160;/usr/local/etc/rc.d#&amp;#160;testsaslauthd&amp;#160;-u&amp;#160;user&amp;#160;-p&amp;#160;pass&lt;br /&gt;
0&amp;#58;&amp;#160;OK&amp;#160;&quot;Success.&quot;&lt;/div&gt;&lt;br /&gt;
&lt;/ol&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Installing and Configuring SpamAssassin&lt;/strong&gt;&lt;br /&gt;
SpamAssassin (SA) is one solution to the problem of spam.  SA can run as a daemon (spamd) in the background and accept requests from an MTA such as Exim to check whether an email message should be classified as spam.&lt;br /&gt;
&lt;br /&gt;
Spamd looks at the message and checks for various factors that make the message more or less likely to be spam and assigns the message a score based on what it finds.  Spamd will then reply to the MTA, telling it the spam score that it gave that message.  The MTA can then decide - based on that score - whether to accept/reject the message - or in the case of this guide whether to instead quarantine the message.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;&lt;li/&gt;Install SA from the FreeBSD ports.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Note:&lt;/b&gt;&lt;br /&gt;
There are various installation options you can choose when installing SA which you should see when you first run &#039;make install&#039; in the SA port directory.  To see the options after already configuring them you can run &#039;make config&#039;.&lt;br /&gt;
&lt;br /&gt;
In turn, each of SA&#039;s dependencies may also have options you can configure at install time.&lt;br /&gt;
&lt;br /&gt;
To write this guide I&#039;m only using the single option &#039;AS_ROOT&#039; in the SA install configuation and for the other items  generally just choose the&lt;br /&gt;
defaults.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;root@win&amp;#160;/root#&amp;#160;cd&amp;#160;/usr/ports/mail/p5-Mail-SpamAssassin/&lt;br /&gt;
root@win&amp;#160;/usr/ports/mail/p5-Mail-SpamAssassin#&amp;#160;make&amp;#160;install&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Once complete, you should see:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&lt;br /&gt;
&amp;#42;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;_&amp;#160;&amp;#160;_____&amp;#160;_____&amp;#160;_____&amp;#160;_&amp;#160;&amp;#160;&amp;#160;_&amp;#160;_____&amp;#160;___&amp;#160;___&amp;#160;&amp;#160;_&amp;#160;&amp;#160;&amp;#160;_&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#42;&lt;br /&gt;
&amp;#42;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;/&amp;#160;\|_&amp;#160;&amp;#160;&amp;#160;_|_&amp;#160;&amp;#160;&amp;#160;_|&amp;#160;____|&amp;#160;\&amp;#160;|&amp;#160;|_&amp;#160;&amp;#160;&amp;#160;_|_&amp;#160;_/&amp;#160;_&amp;#160;\|&amp;#160;\&amp;#160;|&amp;#160;|&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#42;&lt;br /&gt;
&amp;#42;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;/&amp;#160;_&amp;#160;\&amp;#160;|&amp;#160;|&amp;#160;&amp;#160;&amp;#160;|&amp;#160;|&amp;#160;|&amp;#160;&amp;#160;_|&amp;#160;|&amp;#160;&amp;#160;\|&amp;#160;|&amp;#160;|&amp;#160;|&amp;#160;&amp;#160;|&amp;#160;|&amp;#160;|&amp;#160;|&amp;#160;|&amp;#160;&amp;#160;\|&amp;#160;|&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#42;&lt;br /&gt;
&amp;#42;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;/&amp;#160;___&amp;#160;\|&amp;#160;|&amp;#160;&amp;#160;&amp;#160;|&amp;#160;|&amp;#160;|&amp;#160;|___|&amp;#160;|\&amp;#160;&amp;#160;|&amp;#160;|&amp;#160;|&amp;#160;&amp;#160;|&amp;#160;|&amp;#160;|_|&amp;#160;|&amp;#160;|\&amp;#160;&amp;#160;|&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#42;&lt;br /&gt;
&amp;#42;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;/_/&amp;#160;&amp;#160;&amp;#160;\_\_|&amp;#160;&amp;#160;&amp;#160;|_|&amp;#160;|_____|_|&amp;#160;\_|&amp;#160;|_|&amp;#160;|___\___/|_|&amp;#160;\_|&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#42;&lt;br /&gt;
&amp;#42;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#42;&lt;br /&gt;
&amp;#42;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;See&amp;#160;/usr/local/share/doc/p5-Mail-SpamAssassin/INSTALL,&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#42;&lt;br /&gt;
&amp;#42;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;and&amp;#160;/usr/local/share/doc/p5-Mail-SpamAssassin/UPGRADE,&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#42;&lt;br /&gt;
&amp;#42;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;or&amp;#160;http&amp;#58;//spamassassin.org/dist/INSTALL&amp;#160;and&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#42;&lt;br /&gt;
&amp;#42;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;http&amp;#58;//spamassassin.org/dist/UPGRADE&amp;#160;BEFORE&amp;#160;enabling&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#42;&lt;br /&gt;
&amp;#42;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;this&amp;#160;version&amp;#160;of&amp;#160;SpamAssassin&amp;#160;for&amp;#160;important&amp;#160;information&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#42;&lt;br /&gt;
&amp;#42;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;regarding&amp;#160;changes&amp;#160;in&amp;#160;this&amp;#160;version.&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#42;&lt;br /&gt;
&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
It&#039;s a good idea to read the files listed in the banner above.  SA has a large number of options that can be configured; a good place to start configuring options on FreeBSD is in /usr/local/etc/mail/spamassassin/.&lt;br /&gt;
&lt;br /&gt;
&lt;li/&gt;Configure SA to run at boot.&lt;br /&gt;
&lt;br /&gt;
Edit /etc/rc.conf to include the following:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;spamd_enable=&quot;YES&quot;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;li/&gt;Start SA spamd.&lt;br /&gt;
&lt;br /&gt;
We can now go on to actually start spamd running as a daemon and verify spamd started ok:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;root@win&amp;#160;/root#&amp;#160;cd&amp;#160;/usr/local/etc/rc.d&lt;br /&gt;
root@win&amp;#160;/usr/local/etc/rc.d#&amp;#160;rehash&lt;br /&gt;
root@win&amp;#160;/usr/local/etc/rc.d#&amp;#160;./sa&lt;br /&gt;
sa-spamd&amp;#42;&amp;#160;&amp;#160;&amp;#160;saslauthd&amp;#42;&lt;br /&gt;
root@win&amp;#160;/usr/local/etc/rc.d#&amp;#160;./sa-spamd&amp;#160;start&lt;br /&gt;
Starting&amp;#160;spamd.&lt;br /&gt;
munk@win&amp;#160;/usr/local/etc/rc.d#&amp;#160;./sa-spamd&amp;#160;status&lt;br /&gt;
spamd&amp;#160;is&amp;#160;running&amp;#160;as&amp;#160;pid&amp;#160;754.&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
This tells us spamd is running ok in the background.&lt;br /&gt;
&lt;/ol&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Installing and Configuring ClamAV&lt;/strong&gt;&lt;br /&gt;
ClamAV is an anti-virus suite and includes a daemon clamd (runs in the background to check for requests to test for virii), another daemon freshclam (updates the virus definition database) and a couple of clients to run on the commandline if you need them for local virus scanning.&lt;br /&gt;
&lt;br /&gt;
Exim will send requests to the clamd server in much the same was as spamd does - if clamd classifies a message as containing a virus, Exim will reject delivery of the message and instaed quarantine it.&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;&lt;li/&gt;Install ClamAV from the FreeBSD ports tree:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;root@win&amp;#160;/root#&amp;#160;cd&amp;#160;/usr/ports/security/clamav&lt;br /&gt;
root@win&amp;#160;/usr/ports/security/clamav#&amp;#160;make&amp;#160;install&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;li/&gt;Configure ClamAV to start at boot time.&lt;br /&gt;
&lt;br /&gt;
Edit /etc/rc.conf to include:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;clamav_clamd_enable=&quot;YES&quot;&lt;br /&gt;
clamav_freshclam_enable=&quot;YES&quot;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;li/&gt;Configure clamd.&lt;br /&gt;
&lt;br /&gt;
Edit /usr/local/etc/clamd.conf to include the following:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;LogFile&amp;#160;/var/log/clamav/clamd.log&lt;br /&gt;
PidFile&amp;#160;/var/run/clamav/clamd.pid&lt;br /&gt;
DatabaseDirectory&amp;#160;/var/db/clamav&lt;br /&gt;
LocalSocket&amp;#160;/var/run/clamav/clamd&lt;br /&gt;
FixStaleSocket&lt;br /&gt;
User&amp;#160;clamav&lt;br /&gt;
AllowSupplementaryGroups&lt;br /&gt;
ScanMail&lt;br /&gt;
ScanArchive&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;li/&gt;Start clamd and freshclam.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;root@win&amp;#160;/root#&amp;#160;cd&amp;#160;/usr/local/etc/rc.d&lt;br /&gt;
root@win&amp;#160;/usr/local/etc/rc.d#&amp;#160;./clamav-clamd&amp;#160;start&lt;br /&gt;
Starting&amp;#160;clamav_clamd.&lt;br /&gt;
root@win&amp;#160;/usr/local/etc/rc.d#&amp;#160;./clamav-freshclam&amp;#160;start&lt;br /&gt;
Starting&amp;#160;clamav_freshclam.&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Note:&lt;/strong&gt;&lt;br /&gt;
You may see the following message on first running clamd:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;LibClamAV&amp;#160;Warning&amp;#58;&amp;#160;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&lt;br /&gt;
LibClamAV&amp;#160;Warning&amp;#58;&amp;#160;&amp;#42;&amp;#42;&amp;#42;&amp;#160;&amp;#160;The&amp;#160;virus&amp;#160;database&amp;#160;is&amp;#160;older&amp;#160;than&amp;#160;7&amp;#160;days.&amp;#160;&amp;#160;&amp;#42;&amp;#42;&amp;#42;&lt;br /&gt;
LibClamAV&amp;#160;Warning&amp;#58;&amp;#160;&amp;#42;&amp;#42;&amp;#42;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;Please&amp;#160;update&amp;#160;it&amp;#160;IMMEDIATELY!&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#42;&amp;#42;&amp;#42;&lt;br /&gt;
LibClamAV&amp;#160;Warning&amp;#58;&amp;#160;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#42;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
As long as you&#039;re running freshclam, you can safely ignore this message.  Freshclam should update your definitions automatically.  Be sure to configure freshclam to update the virus definitions regularly.&lt;br /&gt;
&lt;/ol&gt;&lt;br /&gt;
&lt;br /&gt;
ClamAV should be configured now and ready to accept request to check for malware from the Exim MTA.&lt;br /&gt;
&lt;br /&gt;
We can now move on finally to install and configure Exim.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Installing and Configuring Exim&lt;/strong&gt;&lt;br /&gt;
Exim configuration can be very complicated.  This guide will only deal with the configuration of Exim so it accepts mail on a domain &#039;mail.example.com&#039;, scans the mail for malware/spam  - quarantining anything it finds as malware/spam and accepts authentication requests correctly.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Important:&lt;/strong&gt;&lt;br /&gt;
Ensure your mail server&#039;s DNS is configured correctly and preferably has a reverse DNS record (rDNS) set up.  Many mail servers will not deliver mail correctly to/from your mail server without rDNS.&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;&lt;li/&gt;Install Exim from the FreeBSD ports tree:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;&amp;#91;12&amp;#58;10&amp;#58;57&amp;#93;&amp;#160;root@win&amp;#160;/root#&amp;#160;cd&amp;#160;/usr/ports/mail/exim&lt;br /&gt;
&amp;#91;12&amp;#58;12&amp;#58;30&amp;#93;&amp;#160;root@win&amp;#160;/usr/ports/mail/exim#&amp;#160;&amp;#160;make&amp;#160;-DWITH_CONTENT_SCAN&amp;#160;-DWITH_SASLAUTHD&amp;#160;install&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;li/&gt;Stop the Sendmail daemon if it&#039;s already running:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;root@win&amp;#160;/root#&amp;#160;cd&amp;#160;/etc/rc.d&lt;br /&gt;
root@win&amp;#160;/etc/rc.d#&amp;#160;./sendmail&amp;#160;stop&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;li/&gt;Configure Exim to run at boot time.&lt;br /&gt;
&lt;br /&gt;
Edit /etc/rc.conf to include:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;sendmail_enable=&quot;NO&quot;&lt;br /&gt;
sendmail_submit_enable=&quot;NO&quot;&lt;br /&gt;
sendmail_outbound_enable=&quot;NO&quot;&lt;br /&gt;
sendmail_msp_queue_enable=&quot;NO&quot;&lt;br /&gt;
exim_enable=&quot;YES&quot;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
This has the effect of disabling sendmail at boot time - the default FreeBSD MTA - and running Exim instead.&lt;br /&gt;
&lt;br /&gt;
&lt;li/&gt;Configure mailer.conf to use Exim as the default MTA.&lt;br /&gt;
&lt;br /&gt;
Edit /etc/mail/mailer.conf to read:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;sendmail&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;/usr/local/sbin/exim&lt;br /&gt;
send-mail&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;/usr/local/sbin/exim&lt;br /&gt;
mailq&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;/usr/local/sbin/exim&amp;#160;-bp&lt;br /&gt;
newaliases&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;/usr/bin/true&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
This will allow any FreeBSD base system mail related commands to use Exim instead of Sendmail.&lt;br /&gt;
&lt;/ol&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Configuring Exim&lt;/strong&gt;&lt;br /&gt;
We now move on to configuring Exim.&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;Set the primary hostname.&lt;br /&gt;
&lt;br /&gt;
Edit /usr/local/etc/exim/configure.&lt;br /&gt;
&lt;br /&gt;
Find and edit the &#039;primary_hostname&#039; line for your domain:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;primary_hostname&amp;#160;=&amp;#160;example.com&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
This configures Exim to accept mail primarily for the &#039;example.com&#039; domain - ie foobar@example.com.&lt;br /&gt;
&lt;br /&gt;
&lt;li/&gt;Find and edit the following lines to read:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;av_scanner&amp;#160;=&amp;#160;clamd&amp;#58;/var/run/clamav/clamd&lt;br /&gt;
spamd_address&amp;#160;=&amp;#160;127.0.0.1&amp;#160;783&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;li/&gt;Configure the malware and spam Access Control Lists (ACLs).&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;How malware/spam checking works in this system:&lt;/strong&gt;&lt;br /&gt;
We add a check in the acl_check_data ACL for spam and malware.  Exim will request each email is checked for spam/malware by the relevant daemon - spamd for spam, clamd for malware.  If the message is classified as spam/malware by the relevant daemons, Exim will add a header to the message &#039;X-Quarantine-Me-Spam&#039; (similar for malware).&lt;br /&gt;
&lt;br /&gt;
Later on when it comes to actually delivering (termed &#039;routing&#039; in Exim terminology), we add two routers to test for the existence of the headers that are added in the acl_check_data ACL if a message is found to be spam/malware.  If the headers are found by the malware/spam routers, the message is not delivered but instead copied to a quarantine location on disk.&lt;br /&gt;
&lt;br /&gt;
This quarantine location can then be checked later by an admin to check if anything is amiss - ie regular non spam/malware mail that should really have been delivered.&lt;br /&gt;
&lt;br /&gt;
Once you&#039;re satisfied the configuration is working as it should - ie after a few months of operation - and not finding false positives, you can change the malware/spam acl checks to just deny instead of adding the quarantine headers.  Having said that, I still opt to just quarantine malware/spam and remove it at a later date.&lt;br /&gt;
&lt;br /&gt;
On to configuring the data ACL:&lt;br /&gt;
&lt;br /&gt;
Modify the acl_check_data ACL to read/include:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;acl_check_data&amp;#58;&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;#&amp;#160;Deny&amp;#160;if&amp;#160;the&amp;#160;message&amp;#160;contains&amp;#160;a&amp;#160;virus.&amp;#160;Before&amp;#160;enabling&amp;#160;this&amp;#160;check,&amp;#160;you&lt;br /&gt;
&amp;#160;&amp;#160;#&amp;#160;must&amp;#160;install&amp;#160;a&amp;#160;virus&amp;#160;scanner&amp;#160;and&amp;#160;set&amp;#160;the&amp;#160;av_scanner&amp;#160;option&amp;#160;above.&lt;br /&gt;
&amp;#160;&amp;#160;#&lt;br /&gt;
&amp;#160;&amp;#160;#&amp;#160;defer_ok&amp;#160;-&amp;#160;pass&amp;#160;this&amp;#160;message&amp;#160;if&amp;#160;scanner&amp;#160;is&amp;#160;down&amp;#160;etc&amp;#58;&lt;br /&gt;
&amp;#160;&amp;#160;warn&amp;#160;&amp;#160;message&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;=&amp;#160;X-Quarantine-Me-Malware&amp;#58;&amp;#160;$malware_name&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;log_message&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;=&amp;#160;malware&amp;#58;&amp;#160;$malware_name&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;demime&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;=&amp;#160;&amp;#42;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;malware&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;=&amp;#160;&amp;#42;/defer_ok&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;#&amp;#160;Add&amp;#160;headers&amp;#160;to&amp;#160;a&amp;#160;message&amp;#160;if&amp;#160;it&amp;#160;is&amp;#160;judged&amp;#160;to&amp;#160;be&amp;#160;spam.&amp;#160;Before&amp;#160;enabling&amp;#160;this,&lt;br /&gt;
&amp;#160;&amp;#160;#&amp;#160;you&amp;#160;must&amp;#160;install&amp;#160;SpamAssassin.&amp;#160;You&amp;#160;may&amp;#160;also&amp;#160;need&amp;#160;to&amp;#160;set&amp;#160;the&amp;#160;spamd_address&lt;br /&gt;
&amp;#160;&amp;#160;#&amp;#160;option&amp;#160;above.&lt;br /&gt;
&amp;#160;&amp;#160;#&lt;br /&gt;
&amp;#160;&amp;#160;warn&amp;#160;&amp;#160;&amp;#160;&amp;#160;message&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;=&amp;#160;X-Quarantine-Me-Spam&amp;#58;&amp;#160;SA&amp;#160;score&amp;#160;$spam_score\n\&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;X-SA-Report&amp;#58;&amp;#160;$spam_report&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;log_message&amp;#160;&amp;#160;&amp;#160;=&amp;#160;Spam&amp;#160;score&amp;#160;$spam_score&amp;#160;&amp;#62;&amp;#160;5&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;spam&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;=&amp;#160;spamd/defer_ok&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;condition&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;=&amp;#160;${if&amp;#160;&amp;#62;{$spam_score_int}{50}{1}{0}}&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;#&amp;#160;Accept&amp;#160;the&amp;#160;message.&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;accept&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;At the top of the routers section&lt;/strong&gt;, modify to read/include:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;begin&amp;#160;routers&lt;br /&gt;
&lt;br /&gt;
check_malware&amp;#58;&lt;br /&gt;
&amp;#160;&amp;#160;driver&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;=&amp;#160;redirect&lt;br /&gt;
&amp;#160;&amp;#160;condition&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;=&amp;#160;${if&amp;#160;def&amp;#58;h_X-Quarantine-Me-Malware&amp;#58;&amp;#160;{1}{0}}&lt;br /&gt;
&amp;#160;&amp;#160;headers_add&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;=&amp;#160;X-Quarantined-Malware&amp;#58;&amp;#160;$h_X-Quarantine-Me-Malware&amp;#58;&lt;br /&gt;
&amp;#160;&amp;#160;headers_remove&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;=&amp;#160;X-Quarantine-Me-Malware&lt;br /&gt;
&amp;#160;&amp;#160;data&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;=&amp;#160;/var/quarantine/malware/malware.$tod_logfile&lt;br /&gt;
&amp;#160;&amp;#160;file_transport&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;=&amp;#160;address_file&lt;br /&gt;
&lt;br /&gt;
check_spam&amp;#58;&lt;br /&gt;
&amp;#160;&amp;#160;driver&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;=&amp;#160;redirect&lt;br /&gt;
&amp;#160;&amp;#160;condition&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;=&amp;#160;${if&amp;#160;def&amp;#58;h_X-Quarantine-Me-Spam&amp;#58;&amp;#160;{1}{0}}&lt;br /&gt;
&amp;#160;&amp;#160;headers_add&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;=&amp;#160;X-Quarantined-Spam&amp;#58;&amp;#160;$h_X-Quarantine-Me-Spam&amp;#58;&lt;br /&gt;
&amp;#160;&amp;#160;headers_remove&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;=&amp;#160;X-Quarantine-Me-Spam&lt;br /&gt;
&amp;#160;&amp;#160;data&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;=&amp;#160;/var/quarantine/spam/spam.$tod_logfile&lt;br /&gt;
&amp;#160;&amp;#160;file_transport&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;=&amp;#160;address_file&lt;br /&gt;
&lt;br /&gt;
	no_more&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Modify the authenticators section to read:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;begin&amp;#160;authenticators&lt;br /&gt;
plain&amp;#58;&lt;br /&gt;
	driver&amp;#160;=&amp;#160;plaintext&lt;br /&gt;
	public_name&amp;#160;=&amp;#160;PLAIN&lt;br /&gt;
	server_condition&amp;#160;=&amp;#160;${if&amp;#160;saslauthd{{$2}{$3}}{1}{0}}&lt;br /&gt;
&lt;br /&gt;
login&amp;#58;&lt;br /&gt;
	driver&amp;#160;=&amp;#160;plaintext&lt;br /&gt;
	public_name&amp;#160;=&amp;#160;LOGIN&lt;br /&gt;
	server_prompts&amp;#160;=&amp;#160;&quot;Username&amp;#58;&amp;#58;&amp;#160;&amp;#58;&amp;#160;Password&amp;#58;&amp;#58;&quot;&lt;br /&gt;
	server_condition&amp;#160;=&amp;#160;${if&amp;#160;saslauthd{{$1}{$2}}{1}{0}}&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Save the /usr/local/etc/exim/configuration file.&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;li/&gt;Create the quarantine directories and change ownership to mailnull:mail:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;root@win&amp;#160;/root#&amp;#160;mkdir&amp;#160;-p&amp;#160;/var/quarantine/{malware,spam}&lt;br /&gt;
root@win&amp;#160;/root#&amp;#160;chown&amp;#160;mailnull&amp;#58;mail&amp;#160;/var/quarantine/{malware,spam}&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;li/&gt;Restart Exim to suck in the new config options:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;root@win&amp;#160;/root#&amp;#160;/usr/local/etc/rc.d/exim&amp;#160;restart&lt;br /&gt;
Stopping&amp;#160;exim.&lt;br /&gt;
Starting&amp;#160;exim.&lt;/div&gt;&lt;br /&gt;
&lt;/ol&gt;&lt;br /&gt;
&lt;br /&gt;
Exim should now be set to check for malware/spam and to authenticate users.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Testing Exim configuration&lt;/strong&gt;&lt;br /&gt;
Finally we can move on to test that our config works correctly for spam/malware checking and for authenticating users.&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;&lt;li/&gt;Testing Exim&#039;s malware/spam scanning.&lt;br /&gt;
&lt;br /&gt;
The easiest option is to send an email to your mailserver with specially crafted malware/spam signatures included in the body of the message.  When spamd/clamd see these signature strings in the body of the messages, they should classify the message as spam/malware and Exim in turn will quarantine the messages.&lt;br /&gt;
&lt;br /&gt;
The official EICAR malware/virus testing signature is as follows:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;X5O%@AP&amp;#91;4\PZX54&amp;#40;P^&amp;#41;7CC&amp;#41;7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILEspamcH+H&amp;#42;&lt;/div&gt;&lt;br /&gt;
See here for the official string:&lt;br /&gt;
&lt;a href=&quot;http://www.eicar.org/anti_virus_test_file.htm&quot;  title=&quot;http://www.eicar.org/anti_virus_test_file.htm&quot;&gt;&lt;br /&gt;
http://www.eicar.org/anti_virus_test_file.htm&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
The official GTUBE spam testing signature is as follows:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;XJS&amp;#42;C4JDBQADN1.NSBN3&amp;#42;2IDNEN&amp;#42;GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL&amp;#42;C.34X&lt;/div&gt;&lt;br /&gt;
See here for the official string:&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://spamassassin.apache.org/gtube/&quot;  title=&quot;http://spamassassin.apache.org/gtube/&quot;&gt;http://spamassassin.apache.org/gtube/&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Note:&lt;/strong&gt;&lt;br /&gt;
Another option for testing spam/malware scanning is to run exim from the commandline using the command &#039;exim -bh 127.0.0.1&#039;.  This will run an SMTP session from the commandline (think telnet) and allow you to inject your own specially crafted message using the signatures above.  This requires you enter a valid SMTP session, something like:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;HELO&amp;#160;example.com&lt;br /&gt;
MAIL&amp;#160;FROM&amp;#58;foo@example.com&lt;br /&gt;
RCPT&amp;#160;TO&amp;#58;foo@example.com&lt;br /&gt;
DATA&lt;br /&gt;
X5O%@AP&amp;#91;4\PZX54&amp;#40;P^&amp;#41;7CC&amp;#41;7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILEspamcH+H&amp;#42;&lt;br /&gt;
.&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
This would simulate the injection of a mail message with a virus in it and in &#039;exim -bh&#039; mode you can see a lot of useful debugging info to verify everything works ok.&lt;br /&gt;
&lt;br /&gt;
&lt;li/&gt;Testing Exim&#039;s Authentication configuration.&lt;br /&gt;
&lt;br /&gt;
We can now test that ASMTP is working.  For this you can either run exim in one of it&#039;s many excellent debugging modes or you can simply configure a remote email client to use ASMTP.  This guide will use the commandline to test ASMTP.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Important:&lt;/strong&gt;&lt;br /&gt;
Before attempting this method please read &lt;a href=&quot;http://www.exim.org/exim-html-4.10/doc/html/spec_32.html#IX1630&quot; target=&quot;_blank&quot;&gt;the exim documentation on how ASMTP works&lt;/a&gt;.  The following assumes you have read and understood that text.&lt;br /&gt;
&lt;br /&gt;
First create a simple perl script called &#039;encode&#039; in /usr/local/etc/exim/ and make sure it is executable:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;root@win&amp;#160;/usr/local/etc/exim#&amp;#160;cat&amp;#160;encode&lt;br /&gt;
#!/usr/bin/perl&lt;br /&gt;
use&amp;#160;MIME&amp;#58;&amp;#58;Base64;&lt;br /&gt;
printf&amp;#160;&amp;#40;&quot;%s&quot;,&amp;#160;encode_base64&amp;#40;eval&amp;#160;&quot;&quot;$ARGV&amp;#91;0&amp;#93;&quot;&quot;&amp;#41;&amp;#41;;&lt;br /&gt;
root@darkstar&amp;#160;/usr/local/etc/exim#&amp;#160;chmod&amp;#160;+x&amp;#160;encode&lt;br /&gt;
root@darkstar&amp;#160;/usr/local/etc/exim#&amp;#160;ls&amp;#160;-al&amp;#160;encode&lt;br /&gt;
-rwxr-xr-x&amp;#160;&amp;#160;1&amp;#160;root&amp;#160;&amp;#160;wheel&amp;#160;&amp;#160;85&amp;#160;Apr&amp;#160;23&amp;#160;12&amp;#58;25&amp;#160;encode&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Now decide which user account on your server you wish to test ASMTP with.  It must be an account you know the password for obviously.  I created an account called &#039;dummy&#039; and set the password to &#039;dummy&#039; as well - if you do this remember to remove the account or disable it as soon as you&#039;ve finished testing.&lt;br /&gt;
&lt;br /&gt;
Encode the user:password pair into base64 MIME using the &#039;encode&#039; script we created above:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;root@darkstar&amp;#160;/usr/local/etc/exim#&amp;#160;./encode&amp;#160;&quot;\0dummy\0dummy&quot;&lt;br /&gt;
AGR1bW15AGR1bW15&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Now enter into Exim&#039;s fake SMTP session command-line mode and just for good measure do it in authentication debug mode as well:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;root@win&amp;#160;/root#&amp;#160;&amp;#160;exim&amp;#160;-d+auth&amp;#160;-bh&amp;#160;127.0.0.1&lt;br /&gt;
Exim&amp;#160;version&amp;#160;4.66&amp;#160;&amp;#40;FreeBSD&amp;#160;6.1&amp;#41;&amp;#160;uid=0&amp;#160;gid=0&amp;#160;pid=3056&amp;#160;D=fbb95cfd&lt;br /&gt;
Probably&amp;#160;Berkeley&amp;#160;DB&amp;#160;version&amp;#160;1.8x&amp;#160;&amp;#40;native&amp;#160;mode&amp;#41;&lt;br /&gt;
Support&amp;#160;for&amp;#58;&amp;#160;crypteq&amp;#160;iconv&amp;#40;&amp;#41;&amp;#160;IPv6&amp;#160;use_setclassresources&amp;#160;PAM&amp;#160;Perl&amp;#160;OpenSSL&amp;#160;Content_Scanning&amp;#160;Old_Demime&lt;br /&gt;
Lookups&amp;#58;&amp;#160;lsearch&amp;#160;wildlsearch&amp;#160;nwildlsearch&amp;#160;iplsearch&amp;#160;cdb&amp;#160;dbm&amp;#160;dbmnz&amp;#160;dnsdb&amp;#160;dsearch&amp;#160;nis&amp;#160;nis0&amp;#160;passwd&lt;br /&gt;
Authenticators&amp;#58;&amp;#160;cram_md5&amp;#160;plaintext&amp;#160;spa&lt;br /&gt;
Routers&amp;#58;&amp;#160;accept&amp;#160;dnslookup&amp;#160;ipliteral&amp;#160;manualroute&amp;#160;queryprogram&amp;#160;redirect&lt;br /&gt;
Transports&amp;#58;&amp;#160;appendfile/maildir/mailstore/mbx&amp;#160;autoreply&amp;#160;lmtp&amp;#160;pipe&amp;#160;smtp&lt;br /&gt;
Fixed&amp;#160;never_users&amp;#58;&amp;#160;0&lt;br /&gt;
Size&amp;#160;of&amp;#160;off_t&amp;#58;&amp;#160;8&lt;br /&gt;
changed&amp;#160;uid/gid&amp;#58;&amp;#160;forcing&amp;#160;real&amp;#160;=&amp;#160;effective&lt;br /&gt;
&amp;#160;&amp;#160;uid=0&amp;#160;gid=0&amp;#160;pid=3056&lt;br /&gt;
&amp;#160;&amp;#160;auxiliary&amp;#160;group&amp;#160;list&amp;#58;&amp;#160;0&lt;br /&gt;
seeking&amp;#160;password&amp;#160;data&amp;#160;for&amp;#160;user&amp;#160;&quot;mailnull&quot;&amp;#58;&amp;#160;using&amp;#160;cached&amp;#160;result&lt;br /&gt;
getpwnam&amp;#40;&amp;#41;&amp;#160;succeeded&amp;#160;uid=26&amp;#160;gid=26&lt;br /&gt;
seeking&amp;#160;password&amp;#160;data&amp;#160;for&amp;#160;user&amp;#160;&quot;root&quot;&amp;#58;&amp;#160;cache&amp;#160;not&amp;#160;available&lt;br /&gt;
getpwnam&amp;#40;&amp;#41;&amp;#160;succeeded&amp;#160;uid=0&amp;#160;gid=0&lt;br /&gt;
configuration&amp;#160;file&amp;#160;is&amp;#160;/usr/local/etc/exim/configure&lt;br /&gt;
log&amp;#160;selectors&amp;#160;=&amp;#160;00000ffc&amp;#160;00089001&lt;br /&gt;
trusted&amp;#160;user&lt;br /&gt;
admin&amp;#160;user&lt;br /&gt;
changed&amp;#160;uid/gid&amp;#58;&amp;#160;privilege&amp;#160;not&amp;#160;needed&lt;br /&gt;
&amp;#160;&amp;#160;uid=26&amp;#160;gid=6&amp;#160;pid=3056&lt;br /&gt;
&amp;#160;&amp;#160;auxiliary&amp;#160;group&amp;#160;list&amp;#58;&amp;#160;6&amp;#160;6&lt;br /&gt;
seeking&amp;#160;password&amp;#160;data&amp;#160;for&amp;#160;user&amp;#160;&quot;mailnull&quot;&amp;#58;&amp;#160;cache&amp;#160;not&amp;#160;available&lt;br /&gt;
getpwnam&amp;#40;&amp;#41;&amp;#160;succeeded&amp;#160;uid=26&amp;#160;gid=26&lt;br /&gt;
originator&amp;#58;&amp;#160;uid=0&amp;#160;gid=0&amp;#160;login=root&amp;#160;name=Charlie&amp;#160;Root&lt;br /&gt;
sender&amp;#160;address&amp;#160;=&amp;#160;root@win.munk.me.uk&lt;br /&gt;
sender_fullhost&amp;#160;=&amp;#160;&amp;#91;127.0.0.1&amp;#93;&lt;br /&gt;
sender_rcvhost&amp;#160;=&amp;#160;&amp;#91;127.0.0.1&amp;#93;&lt;br /&gt;
&lt;br /&gt;
&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#160;SMTP&amp;#160;testing&amp;#160;session&amp;#160;as&amp;#160;if&amp;#160;from&amp;#160;host&amp;#160;127.0.0.1&lt;br /&gt;
&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#160;but&amp;#160;without&amp;#160;any&amp;#160;ident&amp;#160;&amp;#40;RFC&amp;#160;1413&amp;#41;&amp;#160;callback.&lt;br /&gt;
&amp;#42;&amp;#42;&amp;#42;&amp;#42;&amp;#160;This&amp;#160;is&amp;#160;not&amp;#160;for&amp;#160;real!&lt;br /&gt;
&lt;br /&gt;
host&amp;#160;in&amp;#160;hosts_connection_nolog?&amp;#160;no&amp;#160;&amp;#40;option&amp;#160;unset&amp;#41;&lt;br /&gt;
LOG&amp;#58;&amp;#160;smtp_connection&amp;#160;MAIN&lt;br /&gt;
&amp;#160;&amp;#160;SMTP&amp;#160;connection&amp;#160;from&amp;#160;&amp;#91;127.0.0.1&amp;#93;&lt;br /&gt;
host&amp;#160;in&amp;#160;host_lookup?&amp;#160;yes&amp;#160;&amp;#40;matched&amp;#160;&quot;&amp;#42;&quot;&amp;#41;&lt;br /&gt;
looking&amp;#160;up&amp;#160;host&amp;#160;name&amp;#160;for&amp;#160;127.0.0.1&lt;br /&gt;
DNS&amp;#160;lookup&amp;#160;of&amp;#160;1.0.0.127.in-addr.arpa&amp;#160;&amp;#40;PTR&amp;#41;&amp;#160;succeeded&lt;br /&gt;
IP&amp;#160;address&amp;#160;lookup&amp;#160;yielded&amp;#160;localhost.munk.me.uk&lt;br /&gt;
gethostbyname2&amp;#160;looked&amp;#160;up&amp;#160;these&amp;#160;IP&amp;#160;addresses&amp;#58;&lt;br /&gt;
&amp;#160;&amp;#160;name=localhost.munk.me.uk&amp;#160;address=&amp;#58;&amp;#58;1&lt;br /&gt;
&amp;#160;&amp;#160;name=localhost.munk.me.uk&amp;#160;address=127.0.0.1&lt;br /&gt;
checking&amp;#160;addresses&amp;#160;for&amp;#160;localhost.munk.me.uk&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#58;&amp;#58;1&lt;br /&gt;
&amp;#160;&amp;#160;127.0.0.1&amp;#160;OK&lt;br /&gt;
sender_fullhost&amp;#160;=&amp;#160;localhost.munk.me.uk&amp;#160;&amp;#91;127.0.0.1&amp;#93;&lt;br /&gt;
sender_rcvhost&amp;#160;=&amp;#160;localhost.munk.me.uk&amp;#160;&amp;#40;&amp;#91;127.0.0.1&amp;#93;&amp;#41;&lt;br /&gt;
set_process_info&amp;#58;&amp;#160;&amp;#160;3056&amp;#160;handling&amp;#160;incoming&amp;#160;connection&amp;#160;from&amp;#160;localhost.munk.me.uk&amp;#160;&amp;#91;127.0.0.1&amp;#93;&lt;br /&gt;
host&amp;#160;in&amp;#160;host_reject_connection?&amp;#160;no&amp;#160;&amp;#40;option&amp;#160;unset&amp;#41;&lt;br /&gt;
host&amp;#160;in&amp;#160;sender_unqualified_hosts?&amp;#160;no&amp;#160;&amp;#40;option&amp;#160;unset&amp;#41;&lt;br /&gt;
host&amp;#160;in&amp;#160;recipient_unqualified_hosts?&amp;#160;no&amp;#160;&amp;#40;option&amp;#160;unset&amp;#41;&lt;br /&gt;
host&amp;#160;in&amp;#160;helo_verify_hosts?&amp;#160;no&amp;#160;&amp;#40;option&amp;#160;unset&amp;#41;&lt;br /&gt;
host&amp;#160;in&amp;#160;helo_try_verify_hosts?&amp;#160;no&amp;#160;&amp;#40;option&amp;#160;unset&amp;#41;&lt;br /&gt;
host&amp;#160;in&amp;#160;helo_accept_junk_hosts?&amp;#160;no&amp;#160;&amp;#40;option&amp;#160;unset&amp;#41;&lt;br /&gt;
SMTP&amp;#62;&amp;#62;&amp;#160;220&amp;#160;win.munk.me.uk&amp;#160;ESMTP&amp;#160;Exim&amp;#160;4.66&amp;#160;Wed,&amp;#160;17&amp;#160;Jan&amp;#160;2007&amp;#160;19&amp;#58;24&amp;#58;22&amp;#160;+0000&lt;br /&gt;
220&amp;#160;win.munk.me.uk&amp;#160;ESMTP&amp;#160;Exim&amp;#160;4.66&amp;#160;Wed,&amp;#160;17&amp;#160;Jan&amp;#160;2007&amp;#160;19&amp;#58;24&amp;#58;22&amp;#160;+0000&lt;br /&gt;
smtp_setup_msg&amp;#160;entered&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
When you get to this point you are ready to start an SMTP &#039;conversation&#039; with Exim.  First introduce yourself to Exim using the SMTP &#039;EHLO localhost&#039; command:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;EHLO&amp;#160;localhost&lt;br /&gt;
SMTP&amp;#60;&amp;#60;&amp;#160;EHLO&amp;#160;localhost&lt;br /&gt;
sender_fullhost&amp;#160;=&amp;#160;localhost.munk.me.uk&amp;#160;&amp;#40;localhost&amp;#41;&amp;#160;&amp;#91;127.0.0.1&amp;#93;&lt;br /&gt;
sender_rcvhost&amp;#160;=&amp;#160;localhost.munk.me.uk&amp;#160;&amp;#40;&amp;#91;127.0.0.1&amp;#93;&amp;#160;helo=localhost&amp;#41;&lt;br /&gt;
set_process_info&amp;#58;&amp;#160;&amp;#160;3103&amp;#160;handling&amp;#160;incoming&amp;#160;connection&amp;#160;from&amp;#160;localhost.munk.me.uk&amp;#160;&amp;#40;localhost&amp;#41;&amp;#160;&amp;#91;127.0.0.1&amp;#93;&lt;br /&gt;
host&amp;#160;in&amp;#160;pipelining_advertise_hosts?&amp;#160;yes&amp;#160;&amp;#40;matched&amp;#160;&quot;&amp;#42;&quot;&amp;#41;&lt;br /&gt;
host&amp;#160;in&amp;#160;auth_advertise_hosts?&amp;#160;yes&amp;#160;&amp;#40;matched&amp;#160;&quot;&amp;#42;&quot;&amp;#41;&lt;br /&gt;
host&amp;#160;in&amp;#160;tls_advertise_hosts?&amp;#160;no&amp;#160;&amp;#40;option&amp;#160;unset&amp;#41;&lt;br /&gt;
250-win.munk.me.uk&amp;#160;Hello&amp;#160;localhost.munk.me.uk&amp;#160;&amp;#91;127.0.0.1&amp;#93;&lt;br /&gt;
250-SIZE&amp;#160;52428800&lt;br /&gt;
250-PIPELINING&lt;br /&gt;
250-AUTH&amp;#160;PLAIN&amp;#160;LOGIN&lt;br /&gt;
250&amp;#160;HELP&lt;br /&gt;
SMTP&amp;#62;&amp;#62;&amp;#160;250-win.munk.me.uk&amp;#160;Hello&amp;#160;localhost.munk.me.uk&amp;#160;&amp;#91;127.0.0.1&amp;#93;&lt;br /&gt;
250-SIZE&amp;#160;52428800&lt;br /&gt;
250-PIPELINING&lt;br /&gt;
250-AUTH&amp;#160;PLAIN&amp;#160;LOGIN&lt;br /&gt;
250&amp;#160;HELP&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
In response to your &#039;EHLO localhost&#039; command, Exim returns more debug information but most importantly for us it also indicates what authentication options it offers in this line:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;250-AUTH&amp;#160;PLAIN&amp;#160;LOGIN&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
This indicates that currently acceptable AUTH methods are PLAIN and LOGIN.&lt;br /&gt;
&lt;br /&gt;
We can then test the PLAIN login method using the &quot;\0dummy\0dummy&quot; user:password pair we encoded above:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;AUTH&amp;#160;PLAIN&amp;#160;AGR1bW15AGR1bW15&lt;br /&gt;
SMTP&amp;#60;&amp;#60;&amp;#160;AUTH&amp;#160;PLAIN&amp;#160;AGR1bW15AGR1bW15&lt;br /&gt;
Running&amp;#160;pwcheck&amp;#160;authentication&amp;#160;for&amp;#160;user&amp;#160;&quot;dummy&quot;&lt;br /&gt;
pwcheck&amp;#58;&amp;#160;success&amp;#160;&amp;#40;NULL&amp;#41;&lt;br /&gt;
plain&amp;#160;authenticator&amp;#58;&lt;br /&gt;
&amp;#160;&amp;#160;$1&amp;#160;=&lt;br /&gt;
&amp;#160;&amp;#160;$2&amp;#160;=&amp;#160;dummy&lt;br /&gt;
&amp;#160;&amp;#160;$3&amp;#160;=&amp;#160;dummy&lt;br /&gt;
expanded&amp;#160;string&amp;#58;&amp;#160;1&lt;br /&gt;
SMTP&amp;#62;&amp;#62;&amp;#160;235&amp;#160;Authentication&amp;#160;succeeded&lt;br /&gt;
235&amp;#160;Authentication&amp;#160;succeeded&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
This indicates that authentication for &#039;dummy:dummy&#039; would succeed and mail would be relayed (pending further conditional checks by Exim).&lt;br /&gt;
&lt;/ol&gt;&lt;br /&gt;
&lt;br /&gt;
So we now have a working Exim with support for spam/malware checking and authentication over SMTP. 
    </content:encoded>

    <pubDate>Wed, 17 Jan 2007 20:19:00 +0000</pubDate>
    <guid isPermaLink="false">http://freebsd.munk.me.uk/archives/212-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/2.5/</creativeCommons:license>
</item>
<item>
    <title>Block Brute Force Attacks Against sshd and proftpd Using blockhosts</title>
    <link>http://freebsd.munk.me.uk/archives/209-Block-Brute-Force-Attacks-Against-sshd-and-proftpd-Using-blockhosts.html</link>
            <category>FTP</category>
            <category>Security</category>
            <category>SSH</category>
    
    <comments>http://freebsd.munk.me.uk/archives/209-Block-Brute-Force-Attacks-Against-sshd-and-proftpd-Using-blockhosts.html#comments</comments>
    <wfw:comment>http://freebsd.munk.me.uk/wfwcomment.php?cid=209</wfw:comment>

    <slash:comments>4</slash:comments>
    <wfw:commentRss>http://freebsd.munk.me.uk/rss.php?version=2.0&amp;type=comments&amp;cid=209</wfw:commentRss>
    

    <author>nospam@example.com (munk)</author>
    <content:encoded>
    For a long time now I&#039;ve had a lot of problems with brute force attacks against sshd and proftpd - attacks where a host will attempt to login with a dictionary of common usernames and passwords, trying each one until they find a combination that works.  Apart from being a security issue, this uses up a lot of bandwidth so it&#039;s worth taking some measures to block these kind of attacks.&lt;br /&gt;
&lt;br /&gt;
Both sshd and ftpd services have their own individual means for blocking individual connections, but unfortunately neither have an inbuilt method for detecting brute force attacks - counting how many failed login attempts are made from each individual IP address and then blocking that IP address if the number of failed login attempts is more than a certain number.  This is where a 3rd party utility is required.&lt;br /&gt;
&lt;br /&gt;
There are a few utilities that can mitigate brute force attacks on services.  For a while now I&#039;ve used &lt;a href=&quot;http://denyhosts.sourceforge.net/&quot;  title=&quot;DenyHosts&quot;&gt;DenyHosts&lt;/a&gt; successfully to block sshd brute force attacks.  DenyHosts works by constantly monitoring sshd logfiles and keeping track of how many failed logins have occured per IP address over time.  If the number of failed logins reaches a certain threshold, DenyHosts adds an entry in /etc/hosts.allow that effectively blocks the IP address, stopping that host from connecting to the sshd service any more.&lt;br /&gt;
&lt;br /&gt;
DenyHosts is great, but unfortunately it&#039;s aimed only at blocking sshd brute force attacks and I need to protect the ftpd service as well as just sshd - and in future maybe adapt to block other services.  With this in mind I decided to move to using a very similar script called &lt;a href=&quot;http://www.aczoom.com/tools/blockhosts/&quot;  title=&quot;BlockHosts&quot;&gt;BlockHosts&lt;/a&gt; (the documentation for BlockHosts actually mentions that it was inspired by DenyHosts).  BlockHosts can scan a list of service logfiles in one go instead of just a single logfile as with DenyHosts, so is ideal for monitoring a number of different services for brute force attacks.&lt;br /&gt;
&lt;br /&gt;
The following describes how to install and configure BlockHosts on FreeBSD so it&#039;s executed every time the sshd or proftpd services are accessed using TCP_WRAPPERS - ie modifying /etc/hosts.allow so the blockhosts script is run each time sshd or proftpd are accessed.  The BlockHosts script will then check if this current connection attempt is part of a brute force attack and if so, add a blocking rule to /etc/hosts.allow to deny further access.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight:bold&quot;&gt;Installation of BlockHosts&lt;/span&gt;&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;&lt;a href=&quot;http://www.aczoom.com/cms/blockhosts/download&quot;  title=&quot;BlockHosts download page&quot;&gt;Download blockhosts from the download page&lt;/a&gt;, extract the distribution (note please check the download link for the latest version, the version below was latest at time of writing):&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;root@users&amp;#160;/home/munk/bin/python/blockhosts#&amp;#160;wget&amp;#160;http&amp;#58;//www.aczoom.com/tools/blockhosts/BlockHosts-1.0.5.tar.gz&lt;br /&gt;
root@users&amp;#160;/home/munk/bin/python/blockhosts#&amp;#160;tar&amp;#160;zxvf&amp;#160;BlockHosts-1.0.5.tar.gz&lt;br /&gt;
BlockHosts-1.0.5/&lt;br /&gt;
BlockHosts-1.0.5/Makefile&lt;br /&gt;
...&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;li&gt;Change to BlockHosts directory:&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;root@users&amp;#160;/home/munk/bin/python/blockhosts#&amp;#160;cd&amp;#160;BlockHosts-1.0.5&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;li&gt;Edit and save blockhosts.py to read:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;CONFIG_FILE&amp;#160;=&amp;#160;&quot;/usr/local/etc/blockhosts.cfg&quot;&lt;br /&gt;
...&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&quot;LOGFILES&quot;&amp;#58;&amp;#160;&amp;#40;&amp;#160;&quot;/var/log/auth.log&quot;,&amp;#160;&amp;#41;,&lt;/div&gt;&lt;br /&gt;
&lt;span style=&quot;font-weight:bold&quot;&gt;Note:&lt;/span&gt; may seem a bit odd editing the blockhosts.py script before it&#039;s installed - the reason for this is that the installation locations used by setup.py below are taken from blockhosts.py, so by modifying blockhosts.py like this we get the config file installed into /usr/local/etc/ (FreeBSD default for 3rd party software) instead of into /etc (default for linux 3rd party software).&lt;br /&gt;
&lt;br /&gt;
&lt;li&gt;Install blockhosts:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;root@users&amp;#160;/home/munk/bin/python/blockhosts/BlockHosts-1.0.5#&amp;#160;python&amp;#160;setup.py&amp;#160;-v&amp;#160;install&lt;br /&gt;
running&amp;#160;install&lt;br /&gt;
running&amp;#160;build&lt;br /&gt;
running&amp;#160;build_scripts&lt;br /&gt;
creating&amp;#160;build&lt;br /&gt;
creating&amp;#160;build/scripts-2.4&lt;br /&gt;
copying&amp;#160;and&amp;#160;adjusting&amp;#160;blockhosts.py&amp;#160;-&amp;#62;&amp;#160;build/scripts-2.4&lt;br /&gt;
changing&amp;#160;mode&amp;#160;of&amp;#160;build/scripts-2.4/blockhosts.py&amp;#160;from&amp;#160;644&amp;#160;to&amp;#160;755&lt;br /&gt;
running&amp;#160;install_scripts&lt;br /&gt;
copying&amp;#160;build/scripts-2.4/blockhosts.py&amp;#160;-&amp;#62;&amp;#160;/usr/local/bin&lt;br /&gt;
changing&amp;#160;mode&amp;#160;of&amp;#160;/usr/local/bin/blockhosts.py&amp;#160;to&amp;#160;755&lt;br /&gt;
running&amp;#160;install_data&lt;br /&gt;
copying&amp;#160;blockhosts.cfg&amp;#160;-&amp;#62;&amp;#160;/usr/local/etc&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
This installs the blockhosts.py script into /usr/local/bin and the config file blockhosts.cfg into /usr/local/etc.  Make sure to run &#039;rehash&#039; to reread the binary paths again so blockhosts.py will run from anywhere:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;root@users&amp;#160;/home/munk/bin/python/blockhosts/BlockHosts-1.0.5#&amp;#160;rehash&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;li&gt;Edit and save the /usr/local/etc/blockhosts.cfg file so it reads:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;LOGFILES&amp;#160;=&amp;#160;&amp;#91;&amp;#160;&quot;/var/log/auth.log&quot;,&amp;#160;&quot;/var/log/ftp.log&quot;&amp;#160;&amp;#93;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight:bold&quot;&gt;Important:&lt;/span&gt;&lt;br /&gt;
Add the logfiles you want blockhosts to monitor for brute force attacks here.  /var/log/auth.log is standard for sshd, /var/log/ftp.log is maybe not standard for all ftpd, this is just what I have setup here.&lt;br /&gt;
&lt;br /&gt;
At this point it&#039;s best to read through the documentation for blockhosts completely - the README, INSTALL and the blockhosts.py script itself.  The following section is pretty much copy/pasted from what&#039;s mentioned in there.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;li&gt;Edit and save /etc/hosts.allow to include the section that blockhosts.py will modify.  Make sure you allow your own IP blocks first and any trusted IPs so they don&#039;t get blocked accidentally:&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;GOTCHA LOOKOUT!&lt;/strong&gt;&lt;br /&gt;
One gotcha to watch out for in this is the line:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;ALL&amp;#160;&amp;#58;&amp;#160;ALL&amp;#160;&amp;#58;&amp;#160;allow&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
You &lt;strong&gt;MUST&lt;/strong&gt; remove this line - replace it with your IP block instead so you don&#039;t get locked out from your own address range.  If this line isn&#039;t removed/commented out, anything below it just isn&#039;t read/executed and blockhosts won&#039;t work.&lt;br /&gt;
&lt;br /&gt;
This is how my /etc/hosts.allow looks:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;#######################################################################&lt;br /&gt;
#&amp;#160;blockhosts&lt;br /&gt;
#######################################################################&lt;br /&gt;
#&amp;#160;----&lt;br /&gt;
#&amp;#160;see&amp;#160;&quot;man&amp;#160;5&amp;#160;hosts_access&quot;&amp;#160;for&amp;#160;details&amp;#160;of&amp;#160;the&amp;#160;format&amp;#160;of&amp;#160;IP&amp;#160;addresses,&lt;br /&gt;
#services,&amp;#160;allow/deny&amp;#160;options.&amp;#160;Also&amp;#160;see&amp;#160;&quot;man&amp;#160;hosts_options&quot;&lt;br /&gt;
#order&amp;#160;of&amp;#160;lines&amp;#160;in&amp;#160;this&amp;#160;file&amp;#160;is&amp;#160;important,&amp;#160;first&amp;#160;matched&amp;#160;IP&amp;#160;address&amp;#160;line&lt;br /&gt;
#is&amp;#160;rule&amp;#160;applied&amp;#160;by&amp;#160;hosts_access&lt;br /&gt;
#&lt;br /&gt;
#&amp;#160;permanent&amp;#160;whitelist&amp;#160;addresses&amp;#160;-&amp;#160;these&amp;#160;should&amp;#160;always&amp;#160;be&amp;#160;allowed&amp;#160;access&lt;br /&gt;
&lt;br /&gt;
ALL&amp;#160;&amp;#58;&amp;#160;213.152.51.192/255.255.255.248&amp;#160;&amp;#58;&amp;#160;allow&lt;br /&gt;
#&amp;#160;ALL&amp;#58;&amp;#160;127.0.0.1&amp;#160;&amp;#160;&amp;#58;&amp;#160;allow&lt;br /&gt;
#&amp;#160;ALL&amp;#58;&amp;#160;192.168.0.&amp;#160;&amp;#58;&amp;#160;allow&lt;br /&gt;
&lt;br /&gt;
#&amp;#160;permanent&amp;#160;blacklist&amp;#160;addresses&amp;#160;-&amp;#160;these&amp;#160;should&amp;#160;always&amp;#160;be&amp;#160;denied&amp;#160;access&lt;br /&gt;
&lt;br /&gt;
#&amp;#160;ALL&amp;#58;&amp;#160;10.&amp;#160;&amp;#160;&amp;#58;&amp;#160;deny&lt;br /&gt;
#&amp;#160;ALL&amp;#58;&amp;#160;192.&amp;#160;&amp;#58;&amp;#160;deny&lt;br /&gt;
#&amp;#160;ALL&amp;#58;&amp;#160;172.&amp;#160;&amp;#58;&amp;#160;deny&lt;br /&gt;
&lt;br /&gt;
#&amp;#160;----------------------------------------&lt;br /&gt;
#&amp;#160;next&amp;#160;section&amp;#160;is&amp;#160;the&amp;#160;blockhosts&amp;#160;section&amp;#160;-&amp;#160;it&amp;#160;will&amp;#160;add/delete&amp;#160;entries&amp;#160;in&lt;br /&gt;
#&amp;#160;between&amp;#160;the&amp;#160;two&amp;#160;marker&amp;#160;lines&amp;#160;&amp;#40;#----&amp;#160;BlockHosts&amp;#160;Additions&amp;#41;&lt;br /&gt;
&lt;br /&gt;
#----&amp;#160;BlockHosts&amp;#160;Additions&lt;br /&gt;
#----&amp;#160;BlockHosts&amp;#160;Additions&lt;br /&gt;
&lt;br /&gt;
#&amp;#160;----------------------------------------&lt;br /&gt;
#&amp;#160;finally,&amp;#160;the&amp;#160;command&amp;#160;to&amp;#160;execute&amp;#160;the&amp;#160;blockhosts&amp;#160;script,&amp;#160;based&amp;#160;on&lt;br /&gt;
#&amp;#160;connection&amp;#160;to&amp;#160;particular&amp;#160;service&amp;#160;or&amp;#160;services,&amp;#160;for&amp;#160;example,&amp;#160;for&lt;br /&gt;
#&amp;#160;sshd&amp;#160;and&amp;#160;proftpd&amp;#160;-&amp;#160;if&amp;#160;using&amp;#160;vsftpd,&amp;#160;pure-ftpd,&amp;#160;be&amp;#160;sure&amp;#160;to&amp;#160;use&amp;#160;those&lt;br /&gt;
#&amp;#160;words&amp;#160;instead&amp;#58;&lt;br /&gt;
&lt;br /&gt;
sshd,&amp;#160;proftpd&amp;#58;&amp;#160;ALL&amp;#58;&amp;#160;spawn&amp;#160;&amp;#40;/usr/local/bin/blockhosts.py&amp;#160;--verbose&amp;#160;--echo&amp;#160;&quot;%c-%s&quot;&amp;#160;&amp;#62;&amp;#62;&amp;#160;/var/log/blockhosts.log&amp;#160;2&amp;#62;&amp;amp;1&amp;#160;&amp;#41;&amp;amp;&amp;#160;&amp;#58;&amp;#160;allow&lt;br /&gt;
&lt;br /&gt;
#&amp;#160;remove&amp;#58;&amp;#160;&amp;#160;&amp;#160;&amp;#62;&amp;#62;&amp;#160;/var/log/blockhosts.log&amp;#160;2&amp;#62;&amp;amp;1&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;if&amp;#160;logging&amp;#160;to&lt;br /&gt;
#&amp;#160;blockhosts.log&amp;#160;is&amp;#160;not&amp;#160;needed&amp;#160;-&amp;#160;it&amp;#160;will&amp;#160;still&amp;#160;log&amp;#160;to&amp;#160;syslog&amp;#160;&amp;#40;minimally&amp;#41;&lt;br /&gt;
#&amp;#160;see&amp;#160;examples&amp;#160;below&lt;br /&gt;
#&amp;#160;--&lt;br /&gt;
#&amp;#160;See&amp;#160;&quot;man&amp;#160;hosts.allow&quot;&amp;#160;for&amp;#160;info&amp;#160;on&amp;#160;%c&amp;#160;and&amp;#160;%s&amp;#160;identifiers&lt;br /&gt;
#----&lt;br /&gt;
#&amp;#160;for&amp;#160;non-verbose,&amp;#160;with&amp;#160;identification,&amp;#160;to&amp;#160;syslog&amp;#160;only&amp;#160;&amp;#40;/var/log/messages&amp;#41;&amp;#58;&lt;br /&gt;
#sshd,&amp;#160;proftpd,&amp;#160;in.proftpd&amp;#58;&amp;#160;ALL&amp;#58;&amp;#160;spawn&amp;#160;/usr/bin/blockhosts.py&amp;#160;--echo&amp;#160;&quot;%c-%s&quot;&amp;#160;&amp;amp;&amp;#160;&amp;#58;&amp;#160;allow&lt;br /&gt;
#----&lt;br /&gt;
#&amp;#160;minimal&amp;#160;logging,&amp;#160;to&amp;#160;syslog&amp;#160;&amp;#40;usually&amp;#160;goes&amp;#160;to&amp;#160;/var/log/messages&amp;#41;&amp;#58;&lt;br /&gt;
#sshd,&amp;#160;proftpd,&amp;#160;in.proftpd&amp;#58;&amp;#160;ALL&amp;#58;&amp;#160;spawn&amp;#160;/usr/bin/blockhosts.py&amp;#160;&amp;amp;&amp;#160;&amp;#58;&amp;#160;allow&lt;br /&gt;
#----&lt;br /&gt;
#&amp;#160;To&amp;#160;test&amp;#160;hosts.allow,&amp;#160;and&amp;#160;to&amp;#160;find&amp;#160;out&amp;#160;exact&amp;#160;names&amp;#160;of&amp;#160;SSH/FTP&amp;#160;services,&lt;br /&gt;
#&amp;#160;add&amp;#160;this&amp;#160;line&amp;#160;to&amp;#160;the&amp;#160;beginning&amp;#160;of&amp;#160;hosts.allow,&amp;#160;use&amp;#160;ssh/ftp&amp;#160;to&amp;#160;connect&lt;br /&gt;
#&amp;#160;to&amp;#160;your&amp;#160;server,&amp;#160;and&amp;#160;then&amp;#160;look&amp;#160;at&amp;#160;the&amp;#160;log&amp;#160;&amp;#40;/var/log/messages&amp;#160;or&lt;br /&gt;
#&amp;#160;blockhosts.log&amp;#41;&amp;#160;to&amp;#160;see&amp;#160;the&amp;#160;name&amp;#160;of&amp;#160;the&amp;#160;invoked&amp;#160;service.&lt;br /&gt;
#&amp;#160;IMPORTANT&amp;#58;&amp;#160;after&amp;#160;your&amp;#160;test&amp;#160;is&amp;#160;done,&amp;#160;remove&amp;#160;this&amp;#160;line&amp;#160;from&amp;#160;hosts.allow!&lt;br /&gt;
#&amp;#160;Otherwise&amp;#160;everyone&amp;#160;will&amp;#160;always&amp;#160;have&amp;#160;access.&lt;br /&gt;
#ALL&amp;#160;&amp;#58;&amp;#160;ALL&amp;#58;&amp;#160;spawn&amp;#160;&amp;#40;/usr/bin/blockhosts.py&amp;#160;--verbose&amp;#160;--echo&amp;#160;&quot;%c-%s&quot;&amp;#160;&amp;#62;&amp;#62;&amp;#160;/var/log/blockhosts.log&amp;#160;2&amp;#62;&amp;amp;1&amp;#160;&amp;#41;&amp;amp;&amp;#160;&amp;#58;&amp;#160;allow&lt;br /&gt;
#######################################################################&lt;br /&gt;
#&amp;#160;blockhosts&lt;br /&gt;
#######################################################################&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight:bold&quot;&gt;Important Note for ProFTPD users:&lt;/span&gt;&lt;br /&gt;
The following sections describes the configuration needed when using proftpd via inetd.  If you are using ProFTPD in standalone mode, you need to use the proftpd mod_wrap/mod_wrap_file functionality to have proftpd read and honour the TCP_WRAPPERS//etc/hosts.allow file(s) when denying/allowing hosts.  Additionally you need to specifiy the configure flag --enable-wrapper-options when building proftpd.  For a heavily used server, this might be worth doing but personally I don&#039;t get that many connections that I need to worry about inetd being overloaded so I can just go down the (easier to configure for blockhosts) inetd path.&lt;br /&gt;
&lt;br /&gt;
&lt;li&gt;Ensure proftpd is configured to run correctly via inetd.&lt;br /&gt;
&lt;br /&gt;
Edit and save /usr/local/etc/proftpd.conf to read:&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;ServerType&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;inetd&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight:bold&quot;&gt;Important:&lt;/span&gt; remember to delete or rename /usr/local/etc/rc.d/proftpd.sh so it&#039;s not run at boot time - the proftpd daemon doesn&#039;t need to be started at boot if you&#039;re using inetd, inetd handles all the proftpd connections, see below:&lt;br /&gt;
&lt;br /&gt;
Edit and save /etc/inetd.conf to read:&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;ftp&amp;#160;stream&amp;#160;&amp;#160;tcp&amp;#160;nowait&amp;#160;&amp;#160;root&amp;#160;&amp;#160;&amp;#160;&amp;#160;/usr/local/sbin/in.proftpd&amp;#160;proftpd&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
then restart inetd:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;root@users&amp;#160;/usr/local/etc#&amp;#160;kill&amp;#160;-HUP&amp;#160;`cat&amp;#160;/var/run/inetd.pid&amp;#160;`&lt;/div&gt;&lt;br /&gt;
This forces inetd to restart, rereading the config file changes made to /etc/inetd.conf.  ftp connections will now be handled by proftpd via inetd.&lt;br /&gt;
&lt;/ol&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We&#039;re now ready to run blockhosts.py for the first time.  BlockHosts will parse each logfile mentioned in blockhosts.cfg and check for any brute force attacks and if it finds any, blocks will be added to the /etc/hosts.allow file.  &lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight:bold&quot;&gt;Note:&lt;/span&gt; This initial check does not take into account the period over which failed logins took place, so any IP that has more than the default 7 failed login entries will look like a brute force attacker.  However, the ban BlockHosts adds will only last for the default 12 hours so this shouldn&#039;t cause a huge issue - just be aware of this and check the IPs that are added on the first run.&lt;br /&gt;
&lt;br /&gt;
For the very first time it&#039;s a good idea to try a &#039;dry run&#039; just to see what blockhosts finds and what it&#039;d do, without actually doing anything to the /etc/hosts.allow file.  To do this, run blockhosts with the &#039;--dry-run&#039; flag:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;root@users&amp;#160;/usr/local/etc#&amp;#160;/usr/local/bin/blockhosts.py&amp;#160;--verbose&amp;#160;--dry-run&lt;br /&gt;
blockhosts&amp;#160;1.0.5&amp;#160;started&amp;#58;&amp;#160;2006-12-30&amp;#160;14&amp;#58;15&amp;#58;30&lt;br /&gt;
&amp;#160;...&amp;#160;will&amp;#160;discard&amp;#160;all&amp;#160;host&amp;#160;entries&amp;#160;older&amp;#160;than&amp;#160;&amp;#160;2006-12-30&amp;#160;02&amp;#58;15&lt;br /&gt;
&amp;#160;...&amp;#160;load&amp;#160;blockfile&amp;#58;&amp;#160;/etc/hosts.allow&lt;br /&gt;
&amp;#160;...&amp;#160;found&amp;#160;both&amp;#160;markers,&amp;#160;count&amp;#160;of&amp;#160;hosts&amp;#160;being&amp;#160;watched&amp;#58;&amp;#160;0&lt;br /&gt;
&amp;#160;&amp;#160;Warning&amp;#58;&amp;#160;no&amp;#160;offset&amp;#160;found,&amp;#160;will&amp;#160;read&amp;#160;from&amp;#160;beginning&amp;#160;in&amp;#160;logfile&amp;#58;&amp;#160;/var/log/auth.log&lt;br /&gt;
&amp;#160;...&amp;#160;securelog,&amp;#160;loading&amp;#160;file,&amp;#160;offset&amp;#58;&amp;#160;/var/log/auth.log&amp;#160;0&lt;br /&gt;
&amp;#160;&amp;#160;Warning&amp;#58;&amp;#160;no&amp;#160;offset&amp;#160;found,&amp;#160;will&amp;#160;read&amp;#160;from&amp;#160;beginning&amp;#160;in&amp;#160;logfile&amp;#58;&amp;#160;/var/log/ftp.log&lt;br /&gt;
&amp;#160;...&amp;#160;securelog,&amp;#160;loading&amp;#160;file,&amp;#160;offset&amp;#58;&amp;#160;/var/log/ftp.log&amp;#160;0&lt;br /&gt;
&amp;#160;...&amp;#160;updates&amp;#58;&amp;#160;counts&amp;#58;&amp;#160;hosts&amp;#160;to&amp;#160;block&amp;#58;&amp;#160;9;&amp;#160;hosts&amp;#160;being&amp;#160;watched&amp;#58;&amp;#160;21&lt;br /&gt;
#----&amp;#160;BlockHosts&amp;#160;Additions&lt;br /&gt;
ALL&amp;#58;&amp;#160;&amp;#160;203.88.192.225&amp;#160;&amp;#58;&amp;#160;deny&lt;br /&gt;
ALL&amp;#58;&amp;#160;&amp;#160;&amp;#160;&amp;#160;200.71.192.7&amp;#160;&amp;#58;&amp;#160;deny&lt;br /&gt;
ALL&amp;#58;&amp;#160;&amp;#160;212.227.81.146&amp;#160;&amp;#58;&amp;#160;deny&lt;br /&gt;
ALL&amp;#58;&amp;#160;&amp;#160;&amp;#160;&amp;#160;218.25.62.75&amp;#160;&amp;#58;&amp;#160;deny&lt;br /&gt;
ALL&amp;#58;&amp;#160;&amp;#160;200.46.108.164&amp;#160;&amp;#58;&amp;#160;deny&lt;br /&gt;
ALL&amp;#58;&amp;#160;&amp;#160;&amp;#160;&amp;#160;201.57.163.2&amp;#160;&amp;#58;&amp;#160;deny&lt;br /&gt;
ALL&amp;#58;&amp;#160;&amp;#160;205.129.191.11&amp;#160;&amp;#58;&amp;#160;deny&lt;br /&gt;
ALL&amp;#58;&amp;#160;&amp;#160;&amp;#160;&amp;#160;200.68.51.91&amp;#160;&amp;#58;&amp;#160;deny&lt;br /&gt;
ALL&amp;#58;&amp;#160;&amp;#160;&amp;#160;&amp;#160;82.38.68.217&amp;#160;&amp;#58;&amp;#160;deny&lt;br /&gt;
&lt;br /&gt;
#bh&amp;#58;&amp;#160;ip&amp;#58;&amp;#160;&amp;#160;&amp;#160;85.184.10.200&amp;#160;&amp;#58;&amp;#160;&amp;#160;&amp;#160;1&amp;#160;&amp;#58;&amp;#160;2006-12-30-14-15&lt;br /&gt;
#bh&amp;#58;&amp;#160;ip&amp;#58;&amp;#160;&amp;#160;84.158.231.209&amp;#160;&amp;#58;&amp;#160;&amp;#160;&amp;#160;1&amp;#160;&amp;#58;&amp;#160;2006-12-30-14-15&lt;br /&gt;
#bh&amp;#58;&amp;#160;ip&amp;#58;&amp;#160;&amp;#160;&amp;#160;&amp;#160;82.38.68.217&amp;#160;&amp;#58;&amp;#160;&amp;#160;11&amp;#160;&amp;#58;&amp;#160;2006-12-30-14-15&lt;br /&gt;
#bh&amp;#58;&amp;#160;ip&amp;#58;&amp;#160;&amp;#160;&amp;#160;&amp;#160;82.153.28.16&amp;#160;&amp;#58;&amp;#160;&amp;#160;&amp;#160;2&amp;#160;&amp;#58;&amp;#160;2006-12-30-14-15&lt;br /&gt;
#bh&amp;#58;&amp;#160;ip&amp;#58;&amp;#160;&amp;#160;&amp;#160;67.113.225.66&amp;#160;&amp;#58;&amp;#160;&amp;#160;&amp;#160;1&amp;#160;&amp;#58;&amp;#160;2006-12-30-14-15&lt;br /&gt;
#bh&amp;#58;&amp;#160;ip&amp;#58;&amp;#160;&amp;#160;&amp;#160;59.108.34.228&amp;#160;&amp;#58;&amp;#160;&amp;#160;&amp;#160;2&amp;#160;&amp;#58;&amp;#160;2006-12-30-14-15&lt;br /&gt;
#bh&amp;#58;&amp;#160;ip&amp;#58;&amp;#160;&amp;#160;222.68.192.132&amp;#160;&amp;#58;&amp;#160;&amp;#160;&amp;#160;2&amp;#160;&amp;#58;&amp;#160;2006-12-30-14-15&lt;br /&gt;
#bh&amp;#58;&amp;#160;ip&amp;#58;&amp;#160;&amp;#160;&amp;#160;&amp;#160;218.25.62.75&amp;#160;&amp;#58;&amp;#160;&amp;#160;20&amp;#160;&amp;#58;&amp;#160;2006-12-30-14-15&lt;br /&gt;
#bh&amp;#58;&amp;#160;ip&amp;#58;&amp;#160;&amp;#160;217.83.162.157&amp;#160;&amp;#58;&amp;#160;&amp;#160;&amp;#160;1&amp;#160;&amp;#58;&amp;#160;2006-12-30-14-15&lt;br /&gt;
#bh&amp;#58;&amp;#160;ip&amp;#58;&amp;#160;&amp;#160;212.227.81.146&amp;#160;&amp;#58;&amp;#160;29499&amp;#160;&amp;#58;&amp;#160;2006-12-30-14-15&lt;br /&gt;
#bh&amp;#58;&amp;#160;ip&amp;#58;&amp;#160;&amp;#160;&amp;#160;210.1.132.178&amp;#160;&amp;#58;&amp;#160;&amp;#160;&amp;#160;4&amp;#160;&amp;#58;&amp;#160;2006-12-30-14-15&lt;br /&gt;
#bh&amp;#58;&amp;#160;ip&amp;#58;&amp;#160;&amp;#160;205.129.191.11&amp;#160;&amp;#58;&amp;#160;&amp;#160;20&amp;#160;&amp;#58;&amp;#160;2006-12-30-14-15&lt;br /&gt;
#bh&amp;#58;&amp;#160;ip&amp;#58;&amp;#160;&amp;#160;&amp;#160;204.141.87.14&amp;#160;&amp;#58;&amp;#160;&amp;#160;&amp;#160;3&amp;#160;&amp;#58;&amp;#160;2006-12-30-14-15&lt;br /&gt;
#bh&amp;#58;&amp;#160;ip&amp;#58;&amp;#160;&amp;#160;203.88.192.225&amp;#160;&amp;#58;&amp;#160;448&amp;#160;&amp;#58;&amp;#160;2006-12-30-14-15&lt;br /&gt;
#bh&amp;#58;&amp;#160;ip&amp;#58;&amp;#160;&amp;#160;202.108.40.109&amp;#160;&amp;#58;&amp;#160;&amp;#160;&amp;#160;1&amp;#160;&amp;#58;&amp;#160;2006-12-30-14-15&lt;br /&gt;
#bh&amp;#58;&amp;#160;ip&amp;#58;&amp;#160;&amp;#160;&amp;#160;&amp;#160;201.57.163.2&amp;#160;&amp;#58;&amp;#160;2867&amp;#160;&amp;#58;&amp;#160;2006-12-30-14-15&lt;br /&gt;
#bh&amp;#58;&amp;#160;ip&amp;#58;&amp;#160;&amp;#160;&amp;#160;&amp;#160;200.71.192.7&amp;#160;&amp;#58;&amp;#160;761&amp;#160;&amp;#58;&amp;#160;2006-12-30-14-15&lt;br /&gt;
#bh&amp;#58;&amp;#160;ip&amp;#58;&amp;#160;&amp;#160;&amp;#160;&amp;#160;200.68.51.91&amp;#160;&amp;#58;&amp;#160;&amp;#160;10&amp;#160;&amp;#58;&amp;#160;2006-12-30-14-15&lt;br /&gt;
#bh&amp;#58;&amp;#160;ip&amp;#58;&amp;#160;&amp;#160;200.46.108.164&amp;#160;&amp;#58;&amp;#160;170&amp;#160;&amp;#58;&amp;#160;2006-12-30-14-15&lt;br /&gt;
#bh&amp;#58;&amp;#160;ip&amp;#58;&amp;#160;&amp;#160;200.105.255.90&amp;#160;&amp;#58;&amp;#160;&amp;#160;&amp;#160;7&amp;#160;&amp;#58;&amp;#160;2006-12-30-14-15&lt;br /&gt;
#bh&amp;#58;&amp;#160;ip&amp;#58;&amp;#160;&amp;#160;152.104.125.14&amp;#160;&amp;#58;&amp;#160;&amp;#160;&amp;#160;3&amp;#160;&amp;#58;&amp;#160;2006-12-30-14-15&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
From this you can see nicely what blockhosts makes of the service logfiles and the addresses that have tried to connect unsuccessfully.  On my host, as you can see above, there are a few that are obviously dodgy (I would only expect a max of maybe 8 connections per ip per month, so clearly 29,499 connections is just &lt;span style=&quot;font-style:italic&quot;&gt;wrong&lt;/span&gt;!).&lt;br /&gt;
&lt;br /&gt;
Once you&#039;re happy that the output is correct, run blockhosts again without the &#039;--dry-run&#039; flag and the /etc/hosts.allow file will be modified.  Also from now on the logfiles will only be read from the last recorded offset which saves a lot of time if your logfiles are very big.&lt;br /&gt;
&lt;br /&gt;
Big thanks to the BlockHosts author Avinash Chopde ! 
    </content:encoded>

    <pubDate>Sat, 30 Dec 2006 11:52:15 +0000</pubDate>
    <guid isPermaLink="false">http://freebsd.munk.me.uk/archives/209-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/2.5/</creativeCommons:license>
</item>
<item>
    <title>FreeBSD 6.2 To Include Security Event Auditing</title>
    <link>http://freebsd.munk.me.uk/archives/206-FreeBSD-6.2-To-Include-Security-Event-Auditing.html</link>
            <category>FreeBSD</category>
            <category>Security</category>
    
    <comments>http://freebsd.munk.me.uk/archives/206-FreeBSD-6.2-To-Include-Security-Event-Auditing.html#comments</comments>
    <wfw:comment>http://freebsd.munk.me.uk/wfwcomment.php?cid=206</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://freebsd.munk.me.uk/rss.php?version=2.0&amp;type=comments&amp;cid=206</wfw:commentRss>
    

    <author>nospam@example.com (munk)</author>
    <content:encoded>
    Just read an interesting article about &lt;a href=&quot;http://www.securityfocus.com/columnists/422/&quot;  title=&quot;Security Event Auditing in FreeBSD 6.2&quot;&gt; the addition of &#039;Security Event Auditing&#039; in FreeBSD 6.2&lt;/a&gt;.  Until now FreeBSD hasn&#039;t had any really useful security auditing other than using &#039;accounting&#039; to log all syscalls which at best was confusing when it came to working out who did what when and how.&lt;br /&gt;
&lt;br /&gt;
At one time &lt;a href=&quot;http://freebsd.munk.me.uk/archives/112-Installed-and-Configured-lrexec-module-For-Logging-System-Calls.html#extended&quot;  title=&quot;lrexec kernel module security logging on FreeBSD&quot;&gt;I installed a kernel module lrexec to log all system exec calls&lt;/a&gt;, but this was also quite a handful to configure scripts so they reported only on certain users.  Hopefully this new security auditing daemon will make security auditing a lot easier on FreeBSD.  &lt;br /&gt;
&lt;br /&gt;
Read the article for more info on what&#039;s new:&lt;br /&gt;
&lt;a href=&quot;http://www.securityfocus.com/columnists/422/&quot;  title=&quot;Security Event Auditing in FreeBSD 6.2&quot;&gt; Security Event Auditing in FreeBSD 6.2&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Also of interest is the new addition to the FreeBSD handbook on security auditing:&lt;br /&gt;
&lt;a href=&quot;http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/audit.html&quot;  title=&quot;Security event auditing in FreeBSD handbook&quot;&gt;FreeBSD Handbook: Security Event Auditing&lt;/a&gt; 
    </content:encoded>

    <pubDate>Tue, 14 Nov 2006 16:38:39 +0000</pubDate>
    <guid isPermaLink="false">http://freebsd.munk.me.uk/archives/206-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/2.5/</creativeCommons:license>
</item>
<item>
    <title>Modsecurity 2.0 Released</title>
    <link>http://freebsd.munk.me.uk/archives/203-Modsecurity-2.0-Released.html</link>
            <category>Apache</category>
            <category>Security</category>
    
    <comments>http://freebsd.munk.me.uk/archives/203-Modsecurity-2.0-Released.html#comments</comments>
    <wfw:comment>http://freebsd.munk.me.uk/wfwcomment.php?cid=203</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://freebsd.munk.me.uk/rss.php?version=2.0&amp;type=comments&amp;cid=203</wfw:commentRss>
    

    <author>nospam@example.com (munk)</author>
    <content:encoded>
    A new version of mod_security has just been released - 2.0 - complete with a total rewrite that includes a number of new features.  &lt;a href=&quot;http://www.theregister.co.uk/2006/10/19/modsecurity_2_release/&quot;  title=&quot;modsecurity mod_security releases 2.0&quot;&gt;El reg is running an article on the new release which includes an interview with ModSecurity&#039;s author Ivan Ristic&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
mod_security is an apache module for monitoring requests made to a web server and acting on those requests according to rules - useful for blocking malicious bots, stopping web spammers and so on.  I&#039;ve been using it for a few years now and it handles blocking of weblog spammers and trojan worms/bots very well, though it has to be said the configuration isn&#039;t the simplest of all time.&lt;br /&gt;
&lt;br /&gt;
Hopefully this configuration issue might be made easier with the also newly released &lt;a href=&quot;http://www.modsecurity.org/projects/console/index.html&quot;  title=&quot;modsecurity console&quot;&gt;modsecurity console&lt;/a&gt;, although reading through that page it doesn&#039;t seem to mention anything about using it to configure mod_security...  Will have a look at it later and see what&#039;s what.&lt;br /&gt;
&lt;br /&gt;
A list of the new features or improved features in ModSecurity 2.0 - taken from the article above:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Five processing phases (where there were only two in 1.9.x). These are: request headers, request body, response headers, response body, and logging. Those users who wanted to do things at the earliest possible moment can do them now.&lt;/li&gt;&lt;br /&gt;
&lt;li&gt;Per-rule transformation options (previously normalisation was implicit and hard-coded). Many new transformation functions were added.&lt;/li&gt;&lt;br /&gt;
&lt;li&gt;Transaction variables. This can be used to store pieces of data, create a transaction anomaly score, and so on.&lt;/li&gt;&lt;br /&gt;
&lt;li&gt;Data persistence (can be configured any way you want although most people will want to use this feature to track IP addresses, application sessions, and application users).&lt;/li&gt;&lt;br /&gt;
&lt;li&gt;Support for anomaly scoring and basic event correlation (counters can be automatically decreased over time; variables can be expired).&lt;/li&gt;&lt;br /&gt;
&lt;li&gt;Support for web applications and session IDs.&lt;/li&gt;&lt;br /&gt;
&lt;li&gt;Regular Expression back-references (allows one to create custom variables using transaction content).&lt;/li&gt;&lt;br /&gt;
&lt;li&gt;There are now many functions that can be applied to the variables (where previously one could only use regular expressions).&lt;/li&gt;&lt;br /&gt;
&lt;li&gt;XML support (parsing, validation, XPath).&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;br /&gt;
The article is well worth reading if you already use ModSecurity - particularly if you&#039;re interested in moving from just simple blocking and logging of requests as in mod_security 1.0 to a more sophisticated web application firewalling system - mod_security 2.0.  2.0 includes a pseudo web app firewalling programming language making it easy to manipulate and process HTTP in a stateful manner - tracking HTTP sessions per IP in real time for example or perhaps watching for anomalous web activity and then flagging any IP that transgresses behaviour deemed as acceptable and watching for that IP in the future. 
    </content:encoded>

    <pubDate>Fri, 20 Oct 2006 14:24:52 +0000</pubDate>
    <guid isPermaLink="false">http://freebsd.munk.me.uk/archives/203-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/2.5/</creativeCommons:license>
</item>
<item>
    <title>Password generation using a base rule</title>
    <link>http://freebsd.munk.me.uk/archives/196-Password-generation-using-a-base-rule.html</link>
            <category>Security</category>
    
    <comments>http://freebsd.munk.me.uk/archives/196-Password-generation-using-a-base-rule.html#comments</comments>
    <wfw:comment>http://freebsd.munk.me.uk/wfwcomment.php?cid=196</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://freebsd.munk.me.uk/rss.php?version=2.0&amp;type=comments&amp;cid=196</wfw:commentRss>
    

    <author>nospam@example.com (munk)</author>
    <content:encoded>
    Just stumbled across &lt;a href=&quot;http://www.lifehacker.com/software/passwords/geek-to-live--choose-and-remember-great-passwords-184773.php&quot;  title=&quot;Choosing and remembering great passwords&quot;&gt;this article on lifehacker about choosing and remembering great passwords&lt;/a&gt;.  The gist of it is you choose a base &#039;rule&#039; and then tack on a password that&#039;s unique to the system that you&#039;re using.&lt;br /&gt;
&lt;br /&gt;
For example if your mother&#039;s maiden name was Cameron Jane Diaz, you might use cjd5 as the &#039;base&#039;.  Then you&#039;d create a password based on the system you&#039;re using - so for amazon you might make tack on 1m1zon - making the passwd cjd51m1zon.  Not a bad password in and of itself.&lt;br /&gt;
&lt;br /&gt;
One downside to the &#039;base rule&#039; system as someone pointed out in the comments to that article - it&#039;s a bit like having just one password with lots of variations on the theme.  Someone finds out the &#039;base&#039; password rule and it&#039;d be a lot easier cracking the rest of the passwords.  I&#039;d disagree that that&#039;s a bad thing though; as long as you keep the end bit of the password unique and long enough, the passwords are still hardened enough to resist an attack even if someone does find out the &#039;base rule&#039; - for example cracking &#039;1m1zon&#039; wouldn&#039;t be trivial.&lt;br /&gt;
&lt;br /&gt;
Worth reading the article though if you tend to use a single password for almost everything:&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.lifehacker.com/software/passwords/geek-to-live--choose-and-remember-great-passwords-184773.php&quot;  title=&quot;Choosing and remembering great passwords&quot;&gt;Choose and remember great passwords (Lifehacker)&lt;/a&gt; 
    </content:encoded>

    <pubDate>Sun, 01 Oct 2006 21:11:57 +0000</pubDate>
    <guid isPermaLink="false">http://freebsd.munk.me.uk/archives/196-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/2.5/</creativeCommons:license>
</item>
<item>
    <title>Solving permission problems with parsepath.pl</title>
    <link>http://freebsd.munk.me.uk/archives/175-Solving-permission-problems-with-parsepath.pl.html</link>
            <category>Apache</category>
            <category>FreeBSD</category>
            <category>General</category>
            <category>Perl</category>
            <category>PHP</category>
            <category>Security</category>
            <category>Shell</category>
            <category>SSH</category>
    
    <comments>http://freebsd.munk.me.uk/archives/175-Solving-permission-problems-with-parsepath.pl.html#comments</comments>
    <wfw:comment>http://freebsd.munk.me.uk/wfwcomment.php?cid=175</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://freebsd.munk.me.uk/rss.php?version=2.0&amp;type=comments&amp;cid=175</wfw:commentRss>
    

    <author>nospam@example.com (munk)</author>
    <content:encoded>
    &lt;a href=&quot;http://sial.org/howto/debug/unix/parsepath&quot;  title=&quot;parsepath.pl - a script for solving file permission problems&quot;&gt;parsepath.pl&lt;/a&gt; is a brilliant perl script for fixing permissions problems on Unix based platforms by &lt;a href=&quot;http://sial.org/&quot;  title=&quot;Jeremy Mates&quot;&gt;Jeremy Mates&lt;/a&gt;.   Probably the most common type of permission problem from a sysadmin/webmaster&#039;s viewpoint is uploading a file to a directory in a website&#039;s document root folder and then trying to access the file or script in a web browser only to get the dreaded 403 error message:&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;Forbidden&lt;br /&gt;
You don&#039;t have permission to access /foo/bar/test.php on this server.&lt;br /&gt;
&lt;/blockquote&gt;&lt;br /&gt;
&lt;br /&gt;
Most time the solution is very simple, just change the permissions on &#039;test.php&#039; to make sure the user the webserver runs as can read the file correctly - the simplest and most common method being to change the mode of the file to &#039;755&#039;:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;chmod&amp;#160;755&amp;#160;test.php&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Unfortunately sometimes it&#039;s not that easy and many times you see users asking &#039;I&#039;m getting &#039;access denied&#039; errors even though I&#039;ve changed the perms to 755&#039;.  The problem is that one of the subdirectories that the &#039;test.php&#039; file lives in has permissions set so that the webserver can&#039;t read the file properly.  Now that&#039;s where the headache comes in :)&lt;br /&gt;
&lt;br /&gt;
However, &lt;a href=&quot;http://sial.org/howto/debug/unix/parsepath&quot;  title=&quot;parsepath.pl - a script for solving file permission problems&quot;&gt;parsepath.pl&lt;/a&gt; can take the headache out of fixing permissions problems.&lt;br /&gt;
&lt;br /&gt;
Say you have a website document root directory tree /usr/local/www/web/www.munk.me.uk/foo/bar and you upload a web script &#039;test.php&#039; into that directory.  You try and access the file in a webbrowser but get the 403 permission denied error above.  First off you check the permissions on the file itself:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;&amp;#91;23&amp;#58;58&amp;#58;17&amp;#93;&amp;#160;root@users&amp;#160;/usr/local/www/web/www.munk.me.uk/foo/bar#&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;;&amp;#160;ls&amp;#160;-l&lt;br /&gt;
total&amp;#160;0&lt;br /&gt;
-rwxr-xr-x&amp;#160;&amp;#160;1&amp;#160;www&amp;#160;www&amp;#160;&amp;#160;0&amp;#160;Sep&amp;#160;&amp;#160;4&amp;#160;23&amp;#58;39&amp;#160;test.php&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
That looks ok, with permissions 755 and the owner/group set to &#039;www&#039; the webserver user &#039;www&#039; should be able to read the file ok.  So in this case the problem must be with the permissions on one of the parent subdirectories.  The old method of working out the perms would be either to trawl one by one through each directory checking the perms on each subdirectory or to change the permissions recursively on the document root folder so all subfolders have the read bit set for the webserver user/group.&lt;br /&gt;
&lt;br /&gt;
With parsepath.pl things are a lot simpler though - just run the following command:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;&amp;#91;0&amp;#58;03&amp;#58;21&amp;#93;&amp;#160;root@users&amp;#160;/usr/local/www/web/www.munk.me.uk/foo/bar#&amp;#160;parsepath.pl&amp;#160;user=www&amp;#160;+r&amp;#160;test.php&lt;br /&gt;
!&amp;#160;group=www&amp;#160;+rx&amp;#160;fails&amp;#58;&amp;#160;d&amp;#160;0700&amp;#160;root&amp;#58;www&amp;#160;/usr/local/www/web/www.munk.me.uk/foo&lt;br /&gt;
!&amp;#160;unix-other&amp;#160;+rx&amp;#160;fails&amp;#58;&amp;#160;d&amp;#160;0750&amp;#160;root&amp;#58;wheel&amp;#160;/usr/local/www/web/www.munk.me.uk/foo/bar&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
With this command parsepath.pl  recurses through each subdirectory below the file/path you feed it on the commandline and tells you the permissions problems - if any - for the user &#039;www&#039; (the user=www argument) to read (the +r argument) the file &#039;test.php&#039;.&lt;br /&gt;
&lt;br /&gt;
In the output, we&#039;re told that permissions to read the test.php by the user www fails on two counts:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;#&amp;#160;the&amp;#160;group&amp;#160;bit&amp;#160;on&amp;#160;the&amp;#160;folder&amp;#160;&#039;foo&#039;&amp;#160;doesn&#039;t&amp;#160;have&amp;#160;the&amp;#160;+rx&amp;#160;flag&amp;#160;set&amp;#58;&lt;br /&gt;
!&amp;#160;group=www&amp;#160;+rx&amp;#160;fails&amp;#58;&amp;#160;d&amp;#160;0700&amp;#160;root&amp;#58;www&amp;#160;/usr/local/www/web/www.munk.me.uk/foo&lt;br /&gt;
&lt;br /&gt;
#&amp;#160;the&amp;#160;other&amp;#160;bit&amp;#160;on&amp;#160;the&amp;#160;folder&amp;#160;&#039;bar&#039;&amp;#160;doesn&#039;t&amp;#160;have&amp;#160;the&amp;#160;+rx&amp;#160;flag&amp;#160;set&amp;#58;&lt;br /&gt;
!&amp;#160;unix-other&amp;#160;+rx&amp;#160;fails&amp;#58;&amp;#160;d&amp;#160;0750&amp;#160;root&amp;#58;wheel&amp;#160;/usr/local/www/web/www.munk.me.uk/foo/bar&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
With this information it&#039;s easy enough to go in and make the changes necessary to fix the problem using &#039;chmod g+rx foo foo/bar&#039;.&lt;br /&gt;
&lt;br /&gt;
There are other ways of invoking parsepath.pl though.  Running it just with a file/path as an argument it&#039;ll tell you the permissions on each subdirectory under it:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;&amp;#91;0&amp;#58;10&amp;#58;33&amp;#93;&amp;#160;root@users&amp;#160;/usr/local/www/web/www.munk.me.uk/foo/bar#&amp;#160;&lt;br /&gt;
&amp;#62;&amp;#160;parsepath.pl&amp;#160;/usr/local/www/web/www.munk.me.uk/foo/bar/test.php&lt;br /&gt;
%&amp;#160;/usr/local/www/web/www.munk.me.uk/foo/bar/test.php&lt;br /&gt;
d&amp;#160;0755&amp;#160;root&amp;#58;wheel&amp;#160;/&lt;br /&gt;
d&amp;#160;0755&amp;#160;root&amp;#58;wheel&amp;#160;/usr&lt;br /&gt;
d&amp;#160;0755&amp;#160;root&amp;#58;wheel&amp;#160;/usr/local&lt;br /&gt;
d&amp;#160;0755&amp;#160;root&amp;#58;wheel&amp;#160;/usr/local/www&lt;br /&gt;
d&amp;#160;0770&amp;#160;www&amp;#58;wheel&amp;#160;/usr/local/www/web&lt;br /&gt;
d&amp;#160;0750&amp;#160;www&amp;#58;www&amp;#160;/usr/local/www/web/www.munk.me.uk&lt;br /&gt;
d&amp;#160;0700&amp;#160;root&amp;#58;www&amp;#160;/usr/local/www/web/www.munk.me.uk/foo&lt;br /&gt;
d&amp;#160;0750&amp;#160;root&amp;#58;wheel&amp;#160;/usr/local/www/web/www.munk.me.uk/foo/bar&lt;br /&gt;
f&amp;#160;0755&amp;#160;root&amp;#58;www&amp;#160;/usr/local/www/web/www.munk.me.uk/foo/bar/test.php&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
which can is better to see a whole tree in one go.  &lt;br /&gt;
&lt;br /&gt;
No permissions were harmed in the making of this article!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;ll include the parsepath.pl script in the extended article just in case the original ever gets lost - big credit of course goes to the author of the script, &lt;a href=&quot;http://sial.org/&quot;  title=&quot;Jeremy Mates&quot;&gt;Jeremy Mates&lt;/a&gt;.  His site is actually very interesting from a sysadmin&#039;s point of view containing lots of interesting admin scripts and thoughts on system administration in general - spent quite a while grazing through his stuff there - cheers Jeremy.&lt;br /&gt;
 &lt;br /&gt;&lt;a href=&quot;http://freebsd.munk.me.uk/archives/175-Solving-permission-problems-with-parsepath.pl.html#extended&quot;&gt;Continue reading &quot;Solving permission problems with parsepath.pl&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Mon, 04 Sep 2006 22:41:00 +0000</pubDate>
    <guid isPermaLink="false">http://freebsd.munk.me.uk/archives/175-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/2.5/</creativeCommons:license>
</item>
<item>
    <title>Snort upgrade to 2.6.0 fails in make build on FreeBSD 4.11</title>
    <link>http://freebsd.munk.me.uk/archives/173-Snort-upgrade-to-2.6.0-fails-in-make-build-on-FreeBSD-4.11.html</link>
            <category>FreeBSD</category>
            <category>FreeBSD PRs</category>
            <category>Ports</category>
            <category>Security</category>
            <category>Snort</category>
    
    <comments>http://freebsd.munk.me.uk/archives/173-Snort-upgrade-to-2.6.0-fails-in-make-build-on-FreeBSD-4.11.html#comments</comments>
    <wfw:comment>http://freebsd.munk.me.uk/wfwcomment.php?cid=173</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://freebsd.munk.me.uk/rss.php?version=2.0&amp;type=comments&amp;cid=173</wfw:commentRss>
    

    <author>nospam@example.com (munk)</author>
    <content:encoded>
    &lt;strong&gt;UPDATE:&lt;/strong&gt;&lt;br /&gt;
Yay this is now fixed, seemed to be a fairly simple solution too. All good!&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/102922&quot; &gt;http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/102922&lt;br /&gt;
&lt;/a&gt;&lt;br /&gt;
&lt;hr/&gt;&lt;br /&gt;
A few days ago I went to upgrade snort to the latest version (from 2.4.5 to 2.6.0) and it failed at the &#039;make build&#039; stage.  I&#039;ve just had a chance to look into the problem and it appears to be to do with the build of the dynamic rule processing functionality.  A temporary workaround is to build snort with the &#039;-DWITHOUT_DYNAMIC&#039; flag on FreeBSD:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;cd&amp;#160;/usr/ports/security/snort&lt;br /&gt;
make&amp;#160;-DWITHOUT_DYNAMIC&amp;#160;clean&amp;#160;install&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Hopefully a full fix will be found in the next few weeks.  I&#039;m about to submit a problem report (PR) once the maintainer&#039;s had a chance to look it over, I&#039;ll cc it to the snort-users mailing list as well in the hope someone there will have a better idea what the problem is.&lt;br /&gt;
&lt;br /&gt;
The PR is included in the extended article.&lt;br /&gt;
 &lt;br /&gt;&lt;a href=&quot;http://freebsd.munk.me.uk/archives/173-Snort-upgrade-to-2.6.0-fails-in-make-build-on-FreeBSD-4.11.html#extended&quot;&gt;Continue reading &quot;Snort upgrade to 2.6.0 fails in make build on FreeBSD 4.11&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Sat, 02 Sep 2006 18:12:54 +0000</pubDate>
    <guid isPermaLink="false">http://freebsd.munk.me.uk/archives/173-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/2.5/</creativeCommons:license>
</item>
<item>
    <title>Apachectl Leaks Sensitive in phpinfo() PHP Calls</title>
    <link>http://freebsd.munk.me.uk/archives/165-Apachectl-Leaks-Sensitive-in-phpinfo-PHP-Calls.html</link>
            <category>Apache</category>
            <category>PHP</category>
            <category>Security</category>
    
    <comments>http://freebsd.munk.me.uk/archives/165-Apachectl-Leaks-Sensitive-in-phpinfo-PHP-Calls.html#comments</comments>
    <wfw:comment>http://freebsd.munk.me.uk/wfwcomment.php?cid=165</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://freebsd.munk.me.uk/rss.php?version=2.0&amp;type=comments&amp;cid=165</wfw:commentRss>
    

    <author>nospam@example.com (munk)</author>
    <content:encoded>
    Quite a while ago I posted a question to the freebsd-isp mailing list about a minor modification that could be added to the apachectl apache startup shell script to stop it from displaying a lot of sensitive information when PHP and other CGI applications display apache&#039;s environment information to users.  A bit mouthful - the gist of it is that when you use apachectl to start/stop apache from a shell, the environment variables of the shell user that invokes the apachectl script become available to CGI applications by default.&lt;br /&gt;
&lt;br /&gt;
For example in my case the following types of sensitive environmental information is available by default when someone runs phpinfo.php on my server:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;_ENV&amp;#91;&quot;USER&quot;&amp;#93;	root&lt;br /&gt;
_ENV&amp;#91;&quot;MAIL&quot;&amp;#93;	/var/mail/root&lt;br /&gt;
_ENV&amp;#91;&quot;qbertconf&quot;&amp;#93;	/home/munk/eggdrop/bots/qbert/qbert.conf&lt;br /&gt;
_ENV&amp;#91;&quot;webcpdevcvs&quot;&amp;#93;	/home/munk/cvs/ver2&lt;br /&gt;
_ENV&amp;#91;&quot;alllog&quot;&amp;#93;	/var/log/all.log&lt;br /&gt;
_ENV&amp;#91;&quot;apacheerrlog&quot;&amp;#93;	/var/log/httpd-error.log&lt;br /&gt;
_ENV&amp;#91;&quot;SHLVL&quot;&amp;#93;	2&lt;br /&gt;
_ENV&amp;#91;&quot;VENDOR&quot;&amp;#93;	intel&lt;br /&gt;
_ENV&amp;#91;&quot;snortruledir&quot;&amp;#93;	/usr/local/share/snort&lt;br /&gt;
_ENV&amp;#91;&quot;PHP4_OPTFILE&quot;&amp;#93;	/root/php4_options&lt;br /&gt;
_ENV&amp;#91;&quot;IRCNICK&quot;&amp;#93;	munk&lt;br /&gt;
_ENV&amp;#91;&quot;HOME&quot;&amp;#93;	/root&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
and so on along with all the other environment variables I have set in my default root shell - not really what I want displayed to all and sundry :P  To see this yourself on your own server, try running phpinfo() from a php script:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;&amp;#60;?php&amp;#160;phpinfo&amp;#40;&amp;#41;;&amp;#160;?&amp;#62;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Anyway the solution I found is to &#039;sanitize&#039; the environment when the apachectl script starts up the apache httpd process by using the following simple line in apachectl:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;HTTPD=`echo&amp;#160;/usr/bin/env&amp;#160;-i&amp;#160;$HTTPD`&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://lists.freebsd.org/pipermail/freebsd-isp/2003-November/001246.html&quot;&gt;A problem report I was considering sending to the FreeBSD ports team&lt;/a&gt; is included in the extended article below - I didn&#039;t bother sending it in the end because it&#039;s not really a FreeBSD issue.  Not sure why I didn&#039;t send it to the Apache mailing list though, I thought I did but I can&#039;t find it now. Ho hum.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;&lt;a href=&quot;http://freebsd.munk.me.uk/archives/165-Apachectl-Leaks-Sensitive-in-phpinfo-PHP-Calls.html#extended&quot;&gt;Continue reading &quot;Apachectl Leaks Sensitive in phpinfo() PHP Calls&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Sat, 15 Jan 2005 10:27:36 +0000</pubDate>
    <guid isPermaLink="false">http://freebsd.munk.me.uk/archives/165-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/2.5/</creativeCommons:license>
</item>
<item>
    <title>FreeBSD Security Advisory - Overflow error in fetch</title>
    <link>http://freebsd.munk.me.uk/archives/161-FreeBSD-Security-Advisory-Overflow-error-in-fetch.html</link>
            <category>Security</category>
    
    <comments>http://freebsd.munk.me.uk/archives/161-FreeBSD-Security-Advisory-Overflow-error-in-fetch.html#comments</comments>
    <wfw:comment>http://freebsd.munk.me.uk/wfwcomment.php?cid=161</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://freebsd.munk.me.uk/rss.php?version=2.0&amp;type=comments&amp;cid=161</wfw:commentRss>
    

    <author>nospam@example.com (munk)</author>
    <content:encoded>
    &lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;=============================================================================&lt;br /&gt;
FreeBSD-SA-04&amp;#58;16.fetch&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;Security&amp;#160;Advisory&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;The&amp;#160;FreeBSD&amp;#160;Project&lt;br /&gt;
&lt;br /&gt;
Topic&amp;#58;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;Overflow&amp;#160;error&amp;#160;in&amp;#160;fetch&lt;br /&gt;
&lt;br /&gt;
Category&amp;#58;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;core&lt;br /&gt;
Module&amp;#58;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;fetch&lt;br /&gt;
Announced&amp;#58;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;2004-11-18&lt;br /&gt;
Credits&amp;#58;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;Colin&amp;#160;Percival&lt;br /&gt;
Affects&amp;#58;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;All&amp;#160;FreeBSD&amp;#160;versions.&lt;br /&gt;
Corrected&amp;#58;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;2004-11-18&amp;#160;12&amp;#58;02&amp;#58;13&amp;#160;UTC&amp;#160;&amp;#40;RELENG_5,&amp;#160;5.3-STABLE&amp;#41;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;2004-11-18&amp;#160;12&amp;#58;03&amp;#58;05&amp;#160;UTC&amp;#160;&amp;#40;RELENG_5_3,&amp;#160;5.3-RELEASE-p1&amp;#41;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;2004-11-18&amp;#160;12&amp;#58;04&amp;#58;29&amp;#160;UTC&amp;#160;&amp;#40;RELENG_5_2,&amp;#160;5.2.1-RELEASE-p12&amp;#41;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;2004-11-18&amp;#160;12&amp;#58;05&amp;#58;36&amp;#160;UTC&amp;#160;&amp;#40;RELENG_5_1,&amp;#160;5.1-RELEASE-p18&amp;#41;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;2004-11-18&amp;#160;12&amp;#58;05&amp;#58;50&amp;#160;UTC&amp;#160;&amp;#40;RELENG_5_0,&amp;#160;5.0-RELEASE-p22&amp;#41;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;2004-11-18&amp;#160;12&amp;#58;02&amp;#58;29&amp;#160;UTC&amp;#160;&amp;#40;RELENG_4,&amp;#160;4.10-STABLE&amp;#41;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;2004-11-18&amp;#160;12&amp;#58;06&amp;#58;06&amp;#160;UTC&amp;#160;&amp;#40;RELENG_4_10,&amp;#160;4.10-RELEASE-p4&amp;#41;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;2004-11-18&amp;#160;12&amp;#58;06&amp;#58;22&amp;#160;UTC&amp;#160;&amp;#40;RELENG_4_9,&amp;#160;4.9-RELEASE-p13&amp;#41;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;2004-11-18&amp;#160;12&amp;#58;06&amp;#58;36&amp;#160;UTC&amp;#160;&amp;#40;RELENG_4_8,&amp;#160;4.8-RELEASE-p26&amp;#41;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;2004-11-18&amp;#160;12&amp;#58;06&amp;#58;52&amp;#160;UTC&amp;#160;&amp;#40;RELENG_4_7,&amp;#160;4.7-RELEASE-p28&amp;#41;&lt;br /&gt;
FreeBSD&amp;#160;only&amp;#58;&amp;#160;&amp;#160;&amp;#160;YES&lt;br /&gt;
&lt;br /&gt;
For&amp;#160;general&amp;#160;information&amp;#160;regarding&amp;#160;FreeBSD&amp;#160;Security&amp;#160;Advisories,&lt;br /&gt;
including&amp;#160;descriptions&amp;#160;of&amp;#160;the&amp;#160;fields&amp;#160;above,&amp;#160;security&amp;#160;branches,&amp;#160;and&amp;#160;the&lt;br /&gt;
following&amp;#160;sections,&amp;#160;please&amp;#160;visit&lt;br /&gt;
&amp;#60;URL&amp;#58;http&amp;#58;//www.freebsd.org/security/&amp;#62;.&lt;br /&gt;
&lt;br /&gt;
I.&amp;#160;&amp;#160;&amp;#160;Background&lt;br /&gt;
&lt;br /&gt;
The&amp;#160;fetch&amp;#40;1&amp;#41;&amp;#160;utility&amp;#160;is&amp;#160;a&amp;#160;tool&amp;#160;for&amp;#160;fetching&amp;#160;files&amp;#160;via&amp;#160;FTP,&amp;#160;HTTP,&amp;#160;and&amp;#160;HTTPS.&lt;br /&gt;
&lt;br /&gt;
II.&amp;#160;&amp;#160;Problem&amp;#160;Description&lt;br /&gt;
&lt;br /&gt;
An&amp;#160;integer&amp;#160;overflow&amp;#160;condition&amp;#160;in&amp;#160;the&amp;#160;processing&amp;#160;of&amp;#160;HTTP&amp;#160;headers&amp;#160;can&amp;#160;result&lt;br /&gt;
in&amp;#160;a&amp;#160;buffer&amp;#160;overflow.&lt;br /&gt;
&lt;br /&gt;
III.&amp;#160;Impact&lt;br /&gt;
&lt;br /&gt;
A&amp;#160;malicious&amp;#160;server&amp;#160;or&amp;#160;CGI&amp;#160;script&amp;#160;can&amp;#160;respond&amp;#160;to&amp;#160;an&amp;#160;HTTP&amp;#160;or&amp;#160;HTTPS&amp;#160;request&amp;#160;in&lt;br /&gt;
such&amp;#160;a&amp;#160;manner&amp;#160;as&amp;#160;to&amp;#160;cause&amp;#160;arbitrary&amp;#160;portions&amp;#160;of&amp;#160;the&amp;#160;client&#039;s&amp;#160;memory&amp;#160;to&amp;#160;be&lt;br /&gt;
overwritten,&amp;#160;allowing&amp;#160;for&amp;#160;arbitrary&amp;#160;code&amp;#160;execution.&lt;br /&gt;
&lt;br /&gt;
IV.&amp;#160;&amp;#160;Workaround&lt;br /&gt;
&lt;br /&gt;
There&amp;#160;is&amp;#160;no&amp;#160;known&amp;#160;workaround&amp;#160;for&amp;#160;the&amp;#160;affected&amp;#160;application,&amp;#160;although&lt;br /&gt;
the&amp;#160;ftp&amp;#40;1&amp;#41;&amp;#160;application&amp;#160;in&amp;#160;the&amp;#160;FreeBSD&amp;#160;base&amp;#160;system,&amp;#160;and&amp;#160;several&lt;br /&gt;
applications&amp;#160;in&amp;#160;the&amp;#160;FreeBSD&amp;#160;Ports&amp;#160;collection&amp;#160;provide&amp;#160;similar&lt;br /&gt;
functionality&amp;#160;and&amp;#160;could&amp;#160;be&amp;#160;used&amp;#160;in&amp;#160;place&amp;#160;of&amp;#160;fetch&amp;#40;1&amp;#41;.&lt;br /&gt;
&lt;br /&gt;
V.&amp;#160;&amp;#160;&amp;#160;Solution&lt;br /&gt;
&lt;br /&gt;
Perform&amp;#160;one&amp;#160;of&amp;#160;the&amp;#160;following&amp;#58;&lt;br /&gt;
&lt;br /&gt;
1&amp;#41;&amp;#160;Upgrade&amp;#160;your&amp;#160;vulnerable&amp;#160;system&amp;#160;to&amp;#160;4-STABLE&amp;#160;or&amp;#160;5-STABLE,&amp;#160;or&amp;#160;to&amp;#160;the&lt;br /&gt;
RELENG_5_3,&amp;#160;RELENG_5_2,&amp;#160;RELENG_4_10,&amp;#160;or&amp;#160;RELENG_4_8&amp;#160;security&amp;#160;branch&amp;#160;dated&lt;br /&gt;
after&amp;#160;the&amp;#160;correction&amp;#160;date.&lt;br /&gt;
&lt;br /&gt;
2&amp;#41;&amp;#160;To&amp;#160;patch&amp;#160;your&amp;#160;present&amp;#160;system&amp;#58;&lt;br /&gt;
&lt;br /&gt;
The&amp;#160;following&amp;#160;patches&amp;#160;have&amp;#160;been&amp;#160;verified&amp;#160;to&amp;#160;apply&amp;#160;to&amp;#160;FreeBSD&amp;#160;4.8,&amp;#160;4.10,&lt;br /&gt;
5.2,&amp;#160;and&amp;#160;5.3&amp;#160;systems.&lt;br /&gt;
&lt;br /&gt;
a&amp;#41;&amp;#160;Download&amp;#160;the&amp;#160;relevant&amp;#160;patch&amp;#160;from&amp;#160;the&amp;#160;location&amp;#160;below,&amp;#160;and&amp;#160;verify&amp;#160;the&lt;br /&gt;
detached&amp;#160;PGP&amp;#160;signature&amp;#160;using&amp;#160;your&amp;#160;PGP&amp;#160;utility.&lt;br /&gt;
&lt;br /&gt;
#&amp;#160;ftp&amp;#160;ftp&amp;#58;//ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-04&amp;#58;16/fetch.patch&lt;br /&gt;
#&amp;#160;ftp&amp;#160;ftp&amp;#58;//ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-04&amp;#58;16/fetch.patch.asc&lt;br /&gt;
&lt;br /&gt;
b&amp;#41;&amp;#160;Execute&amp;#160;the&amp;#160;following&amp;#160;commands&amp;#160;as&amp;#160;root&amp;#58;&lt;br /&gt;
&lt;br /&gt;
#&amp;#160;cd&amp;#160;/usr/src&lt;br /&gt;
#&amp;#160;patch&amp;#160;&amp;#60;&amp;#160;/path/to/patch&lt;br /&gt;
#&amp;#160;cd&amp;#160;/usr/src/usr.bin/fetch&lt;br /&gt;
#&amp;#160;make&amp;#160;obj&amp;#160;&amp;amp;&amp;amp;&amp;#160;make&amp;#160;depend&amp;#160;&amp;amp;&amp;amp;&amp;#160;make&amp;#160;&amp;amp;&amp;amp;&amp;#160;make&amp;#160;install&lt;br /&gt;
&lt;br /&gt;
3&amp;#41;&amp;#160;IMPORTANT&amp;#160;NOTE&amp;#160;to&amp;#160;users&amp;#160;of&amp;#160;FreeBSD&amp;#160;Update&amp;#58;&lt;br /&gt;
&lt;br /&gt;
FreeBSD&amp;#160;Update&amp;#160;&amp;#40;security/freebsd-update&amp;#160;in&amp;#160;the&amp;#160;FreeBSD&amp;#160;Ports&amp;#160;collection&amp;#41;&lt;br /&gt;
is&amp;#160;a&amp;#160;binary&amp;#160;security&amp;#160;update&amp;#160;system&amp;#160;for&amp;#160;the&amp;#160;FreeBSD&amp;#160;base&amp;#160;system.&amp;#160;&amp;#160;It&amp;#160;is&lt;br /&gt;
not&amp;#160;supported&amp;#160;or&amp;#160;endorsed&amp;#160;by&amp;#160;the&amp;#160;FreeBSD&amp;#160;Security&amp;#160;team,&amp;#160;but&amp;#160;its&amp;#160;author&lt;br /&gt;
has&amp;#160;requested&amp;#160;that&amp;#160;the&amp;#160;following&amp;#160;note&amp;#160;be&amp;#160;included&amp;#160;in&amp;#160;this&amp;#160;advisory&amp;#58;&lt;br /&gt;
&lt;br /&gt;
&amp;#160;FreeBSD&amp;#160;Update&amp;#160;uses&amp;#160;the&amp;#160;fetch&amp;#40;1&amp;#41;&amp;#160;utility&amp;#160;for&amp;#160;downloading&amp;#160;security&lt;br /&gt;
&amp;#160;updates&amp;#160;to&amp;#160;the&amp;#160;FreeBSD&amp;#160;base&amp;#160;system.&amp;#160;&amp;#160;While&amp;#160;these&amp;#160;updates&amp;#160;are&lt;br /&gt;
&amp;#160;cryptographically&amp;#160;signed,&amp;#160;and&amp;#160;FreeBSD&amp;#160;Update&amp;#160;is&amp;#160;therefore&amp;#160;immune&amp;#160;from&lt;br /&gt;
&amp;#160;most&amp;#160;attacks,&amp;#160;it&amp;#160;is&amp;#160;exposed&amp;#160;to&amp;#160;this&amp;#160;vulnerability&amp;#160;since&amp;#160;the&amp;#160;files&lt;br /&gt;
&amp;#160;must&amp;#160;be&amp;#160;fetched&amp;#160;before&amp;#160;their&amp;#160;integrity&amp;#160;can&amp;#160;be&amp;#160;verified.&lt;br /&gt;
&lt;br /&gt;
&amp;#160;As&amp;#160;a&amp;#160;workaround,&amp;#160;FreeBSD&amp;#160;Update&amp;#160;can&amp;#160;be&amp;#160;made&amp;#160;to&amp;#160;use&amp;#160;the&amp;#160;ftp&amp;#40;1&amp;#41;&amp;#160;utility&lt;br /&gt;
&amp;#160;for&amp;#160;downloading&amp;#160;updates&amp;#160;as&amp;#160;follows&amp;#58;&lt;br /&gt;
&lt;br /&gt;
&amp;#160;#&amp;#160;sed&amp;#160;-i.bak&amp;#160;-e&amp;#160;&#039;s/fetch&amp;#160;-qo/ftp&amp;#160;-o/&#039;&amp;#160;/usr/local/sbin/freebsd-update&lt;br /&gt;
&amp;#160;#&amp;#160;freebsd-update&amp;#160;fetch&lt;br /&gt;
&amp;#160;#&amp;#160;mv&amp;#160;/usr/local/sbin/freebsd-update.bak&amp;#160;/usr/local/sbin/freebsd-update&lt;br /&gt;
&amp;#160;#&amp;#160;freebsd-update&amp;#160;install&lt;br /&gt;
&lt;br /&gt;
VI.&amp;#160;&amp;#160;Correction&amp;#160;details&lt;br /&gt;
&lt;br /&gt;
The&amp;#160;following&amp;#160;list&amp;#160;contains&amp;#160;the&amp;#160;revision&amp;#160;numbers&amp;#160;of&amp;#160;each&amp;#160;file&amp;#160;that&amp;#160;was&lt;br /&gt;
corrected&amp;#160;in&amp;#160;FreeBSD.&lt;br /&gt;
&lt;br /&gt;
Branch&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;Revision&lt;br /&gt;
&amp;#160;Path&lt;br /&gt;
-&amp;#160;-------------------------------------------------------------------------&lt;br /&gt;
RELENG_4&lt;br /&gt;
&amp;#160;src/usr.bin/fetch/fetch.c&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;1.10.2.28&lt;br /&gt;
RELENG_4_10&lt;br /&gt;
&amp;#160;src/UPDATING&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;1.73.2.90.2.5&lt;br /&gt;
&amp;#160;src/sys/conf/newvers.sh&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;1.44.2.34.2.6&lt;br /&gt;
&amp;#160;src/usr.bin/fetch/fetch.c&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;1.10.2.23.2.1&lt;br /&gt;
RELENG_4_9&lt;br /&gt;
&amp;#160;src/UPDATING&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;1.73.2.89.2.14&lt;br /&gt;
&amp;#160;src/sys/conf/newvers.sh&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;1.44.2.32.2.14&lt;br /&gt;
&amp;#160;src/usr.bin/fetch/fetch.c&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;1.10.2.21.2.1&lt;br /&gt;
RELENG_4_8&lt;br /&gt;
&amp;#160;src/UPDATING&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;1.73.2.80.2.29&lt;br /&gt;
&amp;#160;src/sys/conf/newvers.sh&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;1.44.2.29.2.27&lt;br /&gt;
&amp;#160;src/usr.bin/fetch/fetch.c&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;1.10.2.20.2.1&lt;br /&gt;
RELENG_4_7&lt;br /&gt;
&amp;#160;src/UPDATING&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;1.73.2.74.2.32&lt;br /&gt;
&amp;#160;src/sys/conf/newvers.sh&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;1.44.2.26.2.30&lt;br /&gt;
&amp;#160;src/usr.bin/fetch/fetch.c&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;1.10.2.18.2.1&lt;br /&gt;
RELENG_5&lt;br /&gt;
&amp;#160;src/usr.bin/fetch/fetch.c&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;1.72.2.2&lt;br /&gt;
RELENG_5_3&lt;br /&gt;
&amp;#160;src/UPDATING&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;1.342.2.13.2.4&lt;br /&gt;
&amp;#160;src/sys/conf/newvers.sh&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;1.62.2.15.2.6&lt;br /&gt;
&amp;#160;src/usr.bin/fetch/fetch.c&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;1.72.2.1.2.1&lt;br /&gt;
RELENG_5_2&lt;br /&gt;
&amp;#160;src/UPDATING&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;1.282.2.20&lt;br /&gt;
&amp;#160;src/sys/conf/newvers.sh&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;1.56.2.19&lt;br /&gt;
&amp;#160;src/usr.bin/fetch/fetch.c&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;1.62.4.1&lt;br /&gt;
RELENG_5_1&lt;br /&gt;
&amp;#160;src/UPDATING&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;1.251.2.20&lt;br /&gt;
&amp;#160;src/sys/conf/newvers.sh&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;1.50.2.20&lt;br /&gt;
&amp;#160;src/usr.bin/fetch/fetch.c&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;1.62.2.1&lt;br /&gt;
RELENG_5_0&lt;br /&gt;
&amp;#160;src/UPDATING&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;1.229.2.28&lt;br /&gt;
&amp;#160;src/sys/conf/newvers.sh&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;1.48.2.23&lt;br /&gt;
&amp;#160;src/usr.bin/fetch/fetch.c&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;1.58.2.1&lt;br /&gt;
-&amp;#160;-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
VII.&amp;#160;References&lt;br /&gt;
&lt;br /&gt;
&amp;#60;other&amp;#160;info&amp;#160;on&amp;#160;vulnerability&amp;#62;&lt;/div&gt; 
    </content:encoded>

    <pubDate>Thu, 18 Nov 2004 14:58:26 +0000</pubDate>
    <guid isPermaLink="false">http://freebsd.munk.me.uk/archives/161-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/2.5/</creativeCommons:license>
</item>
<item>
    <title>FreeBSD Security Advisory - Boundary checking errors in syscons</title>
    <link>http://freebsd.munk.me.uk/archives/159-FreeBSD-Security-Advisory-Boundary-checking-errors-in-syscons.html</link>
            <category>FreeBSD</category>
            <category>Security</category>
    
    <comments>http://freebsd.munk.me.uk/archives/159-FreeBSD-Security-Advisory-Boundary-checking-errors-in-syscons.html#comments</comments>
    <wfw:comment>http://freebsd.munk.me.uk/wfwcomment.php?cid=159</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://freebsd.munk.me.uk/rss.php?version=2.0&amp;type=comments&amp;cid=159</wfw:commentRss>
    

    <author>nospam@example.com (munk)</author>
    <content:encoded>
    Another freebsd related sec advisory, only applicable to admins who have users who login to FreeBSD systems &lt;b&gt;locally&lt;/b&gt; - ie on ttyv* local consoles.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;=============================================================================&lt;br /&gt;
FreeBSD-SA-04&amp;#58;15.syscons&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;Security&amp;#160;Advisory&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;The&amp;#160;FreeBSD&amp;#160;Project&lt;br /&gt;
&lt;br /&gt;
Topic&amp;#58;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;Boundary&amp;#160;checking&amp;#160;errors&amp;#160;in&amp;#160;syscons&lt;br /&gt;
&lt;br /&gt;
Category&amp;#58;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;core&lt;br /&gt;
Module&amp;#58;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;sys_dev_syscons&lt;br /&gt;
Announced&amp;#58;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;2004-10-04&lt;br /&gt;
Credits&amp;#58;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;Christer&amp;#160;Oberg&lt;br /&gt;
Affects&amp;#58;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;FreeBSD&amp;#160;5.x&amp;#160;releases&lt;br /&gt;
Corrected&amp;#58;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;2004-09-30&amp;#160;17&amp;#58;49&amp;#58;15&amp;#160;UTC&amp;#160;&amp;#40;RELENG_5,&amp;#160;5.3-BETA6&amp;#41;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;2004-10-04&amp;#160;17&amp;#58;04&amp;#58;25&amp;#160;UTC&amp;#160;&amp;#40;RELENG_5_2,&amp;#160;5.2.1-RELEASE-p11&amp;#41;&lt;br /&gt;
CVE&amp;#160;Name&amp;#58;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;CAN-2004-0919&lt;br /&gt;
FreeBSD&amp;#160;only&amp;#58;&amp;#160;&amp;#160;&amp;#160;YES&lt;br /&gt;
&lt;br /&gt;
For&amp;#160;general&amp;#160;information&amp;#160;regarding&amp;#160;FreeBSD&amp;#160;Security&amp;#160;Advisories,&lt;br /&gt;
including&amp;#160;descriptions&amp;#160;of&amp;#160;the&amp;#160;fields&amp;#160;above,&amp;#160;security&amp;#160;branches,&amp;#160;and&amp;#160;the&lt;br /&gt;
following&amp;#160;sections,&amp;#160;please&amp;#160;visit&lt;br /&gt;
&amp;#60;URL&amp;#58;http&amp;#58;//www.freebsd.org/security/&amp;#62;.&lt;br /&gt;
&lt;br /&gt;
I.&amp;#160;&amp;#160;&amp;#160;Background&lt;br /&gt;
&lt;br /&gt;
syscons&amp;#40;4&amp;#41;&amp;#160;is&amp;#160;the&amp;#160;default&amp;#160;console&amp;#160;driver&amp;#160;for&amp;#160;FreeBSD.&amp;#160;&amp;#160;Using&amp;#160;the&lt;br /&gt;
physical&amp;#160;keyboard&amp;#160;and&amp;#160;screen,&amp;#160;it&amp;#160;provides&amp;#160;multiple&amp;#160;virtual&amp;#160;terminals&lt;br /&gt;
which&amp;#160;appear&amp;#160;as&amp;#160;if&amp;#160;they&amp;#160;were&amp;#160;separate&amp;#160;terminals.&amp;#160;&amp;#160;One&amp;#160;virtual&amp;#160;terminal&lt;br /&gt;
is&amp;#160;considered&amp;#160;current&amp;#160;and&amp;#160;exclusively&amp;#160;occupies&amp;#160;the&amp;#160;screen&amp;#160;and&amp;#160;the&lt;br /&gt;
keyboard;&amp;#160;the&amp;#160;other&amp;#160;virtual&amp;#160;terminals&amp;#160;are&amp;#160;placed&amp;#160;in&amp;#160;the&amp;#160;background.&lt;br /&gt;
&lt;br /&gt;
II.&amp;#160;&amp;#160;Problem&amp;#160;Description&lt;br /&gt;
&lt;br /&gt;
The&amp;#160;syscons&amp;#160;CONS_SCRSHOT&amp;#160;ioctl&amp;#40;2&amp;#41;&amp;#160;does&amp;#160;insufficient&amp;#160;validation&amp;#160;of&lt;br /&gt;
its&amp;#160;input&amp;#160;arguments.&amp;#160;&amp;#160;In&amp;#160;particular,&amp;#160;negative&amp;#160;coordinates&amp;#160;or&amp;#160;large&lt;br /&gt;
coordinates&amp;#160;may&amp;#160;cause&amp;#160;unexpected&amp;#160;behavior.&lt;br /&gt;
&lt;br /&gt;
III.&amp;#160;Impact&lt;br /&gt;
&lt;br /&gt;
It&amp;#160;may&amp;#160;be&amp;#160;possible&amp;#160;to&amp;#160;cause&amp;#160;the&amp;#160;CONS_SCRSHOT&amp;#160;ioctl&amp;#160;to&amp;#160;return&amp;#160;portions&amp;#160;of&lt;br /&gt;
kernel&amp;#160;memory.&amp;#160;&amp;#160;Such&amp;#160;memory&amp;#160;might&amp;#160;contain&amp;#160;sensitive&amp;#160;information,&amp;#160;such&amp;#160;as&lt;br /&gt;
portions&amp;#160;of&amp;#160;the&amp;#160;file&amp;#160;cache&amp;#160;or&amp;#160;terminal&amp;#160;buffers.&amp;#160;&amp;#160;This&amp;#160;information&amp;#160;might&lt;br /&gt;
be&amp;#160;directly&amp;#160;useful,&amp;#160;or&amp;#160;it&amp;#160;might&amp;#160;be&amp;#160;leveraged&amp;#160;to&amp;#160;obtain&amp;#160;elevated&lt;br /&gt;
privileges&amp;#160;in&amp;#160;some&amp;#160;way.&amp;#160;&amp;#160;For&amp;#160;example,&amp;#160;a&amp;#160;terminal&amp;#160;buffer&amp;#160;might&amp;#160;include&amp;#160;a&lt;br /&gt;
user-entered&amp;#160;password.&lt;br /&gt;
&lt;br /&gt;
IV.&amp;#160;&amp;#160;Workaround&lt;br /&gt;
&lt;br /&gt;
There&amp;#160;is&amp;#160;no&amp;#160;known&amp;#160;workaround.&amp;#160;&amp;#160;However,&amp;#160;this&amp;#160;bug&amp;#160;is&amp;#160;only&amp;#160;exploitable&lt;br /&gt;
by&amp;#160;users&amp;#160;who&amp;#160;have&amp;#160;access&amp;#160;to&amp;#160;the&amp;#160;physical&amp;#160;console&amp;#160;or&amp;#160;can&amp;#160;otherwise&amp;#160;open&lt;br /&gt;
a&amp;#160;/dev/ttyv&amp;#42;&amp;#160;device&amp;#160;node.&lt;br /&gt;
&lt;br /&gt;
V.&amp;#160;&amp;#160;&amp;#160;Solution&lt;br /&gt;
&lt;br /&gt;
Perform&amp;#160;one&amp;#160;of&amp;#160;the&amp;#160;following&amp;#58;&lt;br /&gt;
&lt;br /&gt;
1&amp;#41;&amp;#160;Upgrade&amp;#160;your&amp;#160;vulnerable&amp;#160;system&amp;#160;to&amp;#160;the&amp;#160;RELENG_5_2&amp;#160;security&amp;#160;branch&lt;br /&gt;
dated&amp;#160;after&amp;#160;the&amp;#160;correction&amp;#160;date.&lt;br /&gt;
&lt;br /&gt;
2&amp;#41;&amp;#160;To&amp;#160;patch&amp;#160;your&amp;#160;present&amp;#160;system&amp;#58;&lt;br /&gt;
&lt;br /&gt;
The&amp;#160;following&amp;#160;patches&amp;#160;have&amp;#160;been&amp;#160;verified&amp;#160;to&amp;#160;apply&amp;#160;to&amp;#160;FreeBSD&amp;#160;5.2&lt;br /&gt;
systems.&lt;br /&gt;
&lt;br /&gt;
a&amp;#41;&amp;#160;Download&amp;#160;the&amp;#160;relevant&amp;#160;patch&amp;#160;from&amp;#160;the&amp;#160;location&amp;#160;below,&amp;#160;and&amp;#160;verify&amp;#160;the&lt;br /&gt;
detached&amp;#160;PGP&amp;#160;signature&amp;#160;using&amp;#160;your&amp;#160;PGP&amp;#160;utility.&lt;br /&gt;
&lt;br /&gt;
#&amp;#160;fetch&amp;#160;ftp&amp;#58;//ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-04&amp;#58;15/syscons.patch&lt;br /&gt;
#&amp;#160;fetch&amp;#160;ftp&amp;#58;//ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-04&amp;#58;15/syscons.patch.asc&lt;br /&gt;
&lt;br /&gt;
b&amp;#41;&amp;#160;Apply&amp;#160;the&amp;#160;patch.&lt;br /&gt;
&lt;br /&gt;
#&amp;#160;cd&amp;#160;/usr/src&lt;br /&gt;
#&amp;#160;patch&amp;#160;&amp;#60;&amp;#160;/path/to/patch&lt;br /&gt;
&lt;br /&gt;
c&amp;#41;&amp;#160;Recompile&amp;#160;your&amp;#160;kernel&amp;#160;as&amp;#160;described&amp;#160;in&lt;br /&gt;
&amp;#60;URL&amp;#58;http&amp;#58;//www.freebsd.org/handbook/kernelconfig.html&amp;#62;&amp;#160;and&amp;#160;reboot&amp;#160;the&lt;br /&gt;
system.&lt;br /&gt;
&lt;br /&gt;
VI.&amp;#160;&amp;#160;Correction&amp;#160;details&lt;br /&gt;
&lt;br /&gt;
The&amp;#160;following&amp;#160;list&amp;#160;contains&amp;#160;the&amp;#160;revision&amp;#160;numbers&amp;#160;of&amp;#160;each&amp;#160;file&amp;#160;that&amp;#160;was&lt;br /&gt;
corrected&amp;#160;in&amp;#160;FreeBSD.&lt;br /&gt;
&lt;br /&gt;
Branch&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;Revision&lt;br /&gt;
&amp;#160;Path&lt;br /&gt;
-&amp;#160;-------------------------------------------------------------------------&lt;br /&gt;
RELENG_5_2&lt;br /&gt;
&amp;#160;src/UPDATING&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;1.282.2.19&lt;br /&gt;
&amp;#160;src/sys/conf/newvers.sh&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;1.56.2.18&lt;br /&gt;
&amp;#160;src/sys/dev/syscons/syscons.c&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;1.409.2.1&lt;br /&gt;
-&amp;#160;-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
VII.&amp;#160;References&lt;br /&gt;
&lt;br /&gt;
&amp;#60;URL&amp;#58;http&amp;#58;//cvsweb.freebsd.org/src/sys/dev/syscons/syscons.c.diff?r1=1.428&amp;amp;r2=1.429&amp;#62;&lt;/div&gt;&lt;br /&gt;
 
    </content:encoded>

    <pubDate>Tue, 05 Oct 2004 00:18:07 +0000</pubDate>
    <guid isPermaLink="false">http://freebsd.munk.me.uk/archives/159-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/2.5/</creativeCommons:license>
</item>
<item>
    <title>FreeBSD Security Advisory - Various CVS Server Related Vulnerabilities</title>
    <link>http://freebsd.munk.me.uk/archives/158-FreeBSD-Security-Advisory-Various-CVS-Server-Related-Vulnerabilities.html</link>
            <category>FreeBSD</category>
            <category>Security</category>
    
    <comments>http://freebsd.munk.me.uk/archives/158-FreeBSD-Security-Advisory-Various-CVS-Server-Related-Vulnerabilities.html#comments</comments>
    <wfw:comment>http://freebsd.munk.me.uk/wfwcomment.php?cid=158</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://freebsd.munk.me.uk/rss.php?version=2.0&amp;type=comments&amp;cid=158</wfw:commentRss>
    

    <author>nospam@example.com (munk)</author>
    <content:encoded>
    I.   Background&lt;br /&gt;
&lt;br /&gt;
The Concurrent Versions System (CVS) is a version control system.  It&lt;br /&gt;
may be used to access a repository locally, or to access a `remote&lt;br /&gt;
repository&#039; using a number of different methods.  When accessing a&lt;br /&gt;
remote repository, the target machine runs the CVS server to fulfill&lt;br /&gt;
client requests.&lt;br /&gt;
&lt;br /&gt;
II.  Problem Description&lt;br /&gt;
&lt;br /&gt;
A number of vulnerabilities were discovered in CVS by Stefan Esser,&lt;br /&gt;
Sebastian Krahmer, and Derek Price.&lt;br /&gt;
&lt;br /&gt;
 . Insufficient input validation while processing &quot;Entry&quot; lines.&lt;br /&gt;
   (CAN-2004-0414)&lt;br /&gt;
&lt;br /&gt;
 . A double-free resulting from erroneous state handling while&lt;br /&gt;
   processing &quot;Argumentx&quot; commands. (CAN-2004-0416)&lt;br /&gt;
&lt;br /&gt;
 . Integer overflow while processing &quot;Max-dotdot&quot; commands.&lt;br /&gt;
   (CAN-2004-0417)&lt;br /&gt;
&lt;br /&gt;
 . Erroneous handling of empty entries handled while processing&lt;br /&gt;
   &quot;Notify&quot; commands. (CAN-2004-0418)&lt;br /&gt;
&lt;br /&gt;
 . A format string bug while processing CVS wrappers.&lt;br /&gt;
&lt;br /&gt;
 . Single-byte buffer underflows while processing configuration files&lt;br /&gt;
   from CVSROOT.&lt;br /&gt;
&lt;br /&gt;
 . Various other integer overflows.&lt;br /&gt;
&lt;br /&gt;
Additionally, iDEFENSE reports an undocumented command-line flag used&lt;br /&gt;
in debugging does not perform input validation on the given path&lt;br /&gt;
names.&lt;br /&gt;
&lt;br /&gt;
III. Impact&lt;br /&gt;
&lt;br /&gt;
CVS servers (&quot;cvs server&quot; or :pserver: modes) are affected by these&lt;br /&gt;
vulnerabilities.  They vary in impact but include information disclosure&lt;br /&gt;
(the iDEFENSE-reported bug), denial-of-service (CAN-2004-0414,&lt;br /&gt;
CAN-2004-0416, CAN-2004-0417 and other bugs), or possibly arbitrary code&lt;br /&gt;
execution (CAN-2004-0418).  In very special situations where the&lt;br /&gt;
attacker may somehow influence the contents of CVS configuration files&lt;br /&gt;
in CVSROOT, additional attacks may be possible.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
See the extended article for the complete advisory.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;&lt;a href=&quot;http://freebsd.munk.me.uk/archives/158-FreeBSD-Security-Advisory-Various-CVS-Server-Related-Vulnerabilities.html#extended&quot;&gt;Continue reading &quot;FreeBSD Security Advisory - Various CVS Server Related Vulnerabilities&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Mon, 20 Sep 2004 16:19:31 +0000</pubDate>
    <guid isPermaLink="false">http://freebsd.munk.me.uk/archives/158-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/2.5/</creativeCommons:license>
</item>
<item>
    <title>Using mod_security to Block Serendipity Weblog / Blog Comment Spam</title>
    <link>http://freebsd.munk.me.uk/archives/154-Using-mod_security-to-Block-Serendipity-Weblog-Blog-Comment-Spam.html</link>
            <category>Apache</category>
            <category>Security</category>
    
    <comments>http://freebsd.munk.me.uk/archives/154-Using-mod_security-to-Block-Serendipity-Weblog-Blog-Comment-Spam.html#comments</comments>
    <wfw:comment>http://freebsd.munk.me.uk/wfwcomment.php?cid=154</wfw:comment>

    <slash:comments>6</slash:comments>
    <wfw:commentRss>http://freebsd.munk.me.uk/rss.php?version=2.0&amp;type=comments&amp;cid=154</wfw:commentRss>
    

    <author>nospam@example.com (munk)</author>
    <content:encoded>
    Have been seeing quite a bit of comment spam recently on this weblog, mainly pimping online pharmacies.  Needless to say this is not wanted.  &lt;br /&gt;
&lt;br /&gt;
After the fourth lot of spam in not that many days I&#039;ve added a few lines to the &lt;a href=&quot;http://www.modsecurity.org/&quot;&gt;mod_security&lt;/a&gt; section in my httpd.conf file to stop apache from allowing access if the POST payload contains certain keywords:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;SecFilterSelective&amp;#160;POST_PAYLOAD&amp;#160;&quot;BLOCKED&amp;#160;KEYWORDS&amp;#160;GO&amp;#160;HERE!!!&quot;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
You get the gist, adding the keywords would freeze me out so won&#039;t bother with that :P&lt;br /&gt;
&lt;br /&gt;
Before I considered mod_security though I was wondering how a &lt;a href=&quot;http://www.spamassassin.org/&quot;&gt;spamassassin&lt;/a&gt; plugin might work with Serendipity - a plugin that would forward comments to a spamd daemon for spam checking before accepting the comment.  Not too sure how spamd handles data that doesn&#039;t contain mail headers, I guess it should still parse it ok and return a score. No doubt this won&#039;t get pursued any further seeing as this mod_security fix should do the trick. 
    </content:encoded>

    <pubDate>Fri, 03 Sep 2004 06:53:17 +0000</pubDate>
    <guid isPermaLink="false">http://freebsd.munk.me.uk/archives/154-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/2.5/</creativeCommons:license>
</item>
<item>
    <title>Attempts To Exploit My_ eGallery Vulnerability Target Random Sites</title>
    <link>http://freebsd.munk.me.uk/archives/153-Attempts-To-Exploit-My_-eGallery-Vulnerability-Target-Random-Sites.html</link>
            <category>Apache</category>
            <category>PHP</category>
            <category>Security</category>
            <category>WWW</category>
    
    <comments>http://freebsd.munk.me.uk/archives/153-Attempts-To-Exploit-My_-eGallery-Vulnerability-Target-Random-Sites.html#comments</comments>
    <wfw:comment>http://freebsd.munk.me.uk/wfwcomment.php?cid=153</wfw:comment>

    <slash:comments>3</slash:comments>
    <wfw:commentRss>http://freebsd.munk.me.uk/rss.php?version=2.0&amp;type=comments&amp;cid=153</wfw:commentRss>
    

    <author>nospam@example.com (munk)</author>
    <content:encoded>
    This is &lt;a href=&quot;http://www.securityfocus.com/bid/9113/info/&quot;&gt;by no means a new attempt &lt;/a&gt;to exploit a vulnerability in a PHP web application, but since I started using snort as a full time intrusion detection system I&#039;ve picked up countless attempts to exploit a vulnerability in an online PHP photo gallery called &lt;a href=&quot;http://lottasophie.sourceforge.net/&quot;&gt;My_ eGallery&lt;/a&gt;.  The annoying thing about this is that I&#039;ve never had this gallery system installed on any of the sites I maintain - particularly the one that keeps getting hit - but they continue to try their exploits.  Read on for more... &lt;br /&gt;&lt;a href=&quot;http://freebsd.munk.me.uk/archives/153-Attempts-To-Exploit-My_-eGallery-Vulnerability-Target-Random-Sites.html#extended&quot;&gt;Continue reading &quot;Attempts To Exploit My_ eGallery Vulnerability Target Random Sites&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Thu, 26 Aug 2004 06:21:27 +0000</pubDate>
    <guid isPermaLink="false">http://freebsd.munk.me.uk/archives/153-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/2.5/</creativeCommons:license>
</item>
<item>
    <title>Script Kiddies Redirected to NSA Kiddies site</title>
    <link>http://freebsd.munk.me.uk/archives/152-Script-Kiddies-Redirected-to-NSA-Kiddies-site.html</link>
            <category>Apache</category>
            <category>Security</category>
    
    <comments>http://freebsd.munk.me.uk/archives/152-Script-Kiddies-Redirected-to-NSA-Kiddies-site.html#comments</comments>
    <wfw:comment>http://freebsd.munk.me.uk/wfwcomment.php?cid=152</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://freebsd.munk.me.uk/rss.php?version=2.0&amp;type=comments&amp;cid=152</wfw:commentRss>
    

    <author>nospam@example.com (munk)</author>
    <content:encoded>
    Ok, I&#039;m really bored now.  Some morons have been trying to exploit a hole in an online PHP gallery system called E_Gallery for weeks now.  The thing is I don&#039;t have and never have had E_Gallery on my system - at least not in the location they&#039;re trying to &#039;exploit&#039;.&lt;br /&gt;
&lt;br /&gt;
This really pisses me off, why can&#039;t people bother to check whether the thing they&#039;re trying to exploit actually &lt;i&gt;exists&lt;/i&gt; on the system they&#039;re trying to exploit before wasting bandwidth trying to exploit it???  Bloody idiot script kiddies.  &lt;br /&gt;
&lt;br /&gt;
Enough&#039;s enough, I&#039;ve just set up this .htaccess file now to redirect them to the NSA kiddies page, let them try and crack something worth cracking:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;RewriteEngine&amp;#160;On&lt;br /&gt;
RewriteRule&amp;#160;^modules/my_&amp;#160;egallery/public/displayCategory.php&amp;#160;\&lt;br /&gt;
http&amp;#58;//www.nsa.gov/kids/intro.htm&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
I&#039;ll write something up about the actual exploit attempts in a separate article.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;UPDATE:&lt;/b&gt;&lt;br /&gt;
Ok this was not a good idea, I&#039;m redirecting hits to the URI to somewhere more interesting (like the location of the backdoor servers they&#039;re trying to install in the first place :P). 
    </content:encoded>

    <pubDate>Thu, 26 Aug 2004 06:04:02 +0000</pubDate>
    <guid isPermaLink="false">http://freebsd.munk.me.uk/archives/152-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/2.5/</creativeCommons:license>
</item>
<item>
    <title>Microsoft Slow To Release Security Fixes</title>
    <link>http://freebsd.munk.me.uk/archives/101-Microsoft-Slow-To-Release-Security-Fixes.html</link>
            <category>Security</category>
    
    <comments>http://freebsd.munk.me.uk/archives/101-Microsoft-Slow-To-Release-Security-Fixes.html#comments</comments>
    <wfw:comment>http://freebsd.munk.me.uk/wfwcomment.php?cid=101</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://freebsd.munk.me.uk/rss.php?version=2.0&amp;type=comments&amp;cid=101</wfw:commentRss>
    

    <author>nospam@example.com (munk)</author>
    <content:encoded>
    Microsoft has yet again been savaged for dragging it&#039;s heels in fixing critical security issues with it&#039;s OS.  In particular the security group Eeye has &lt;a href=&quot;http://www.eeye.com/html/Research/Upcoming/index.html&quot;&gt;a list of several pending security fixes&lt;/a&gt; which it has made known to Microsft a long time ago, but as yet have not been addressed with relevant patches.&lt;br /&gt;
&lt;br /&gt;
The list is very scary for Microsoft users with most of the critical security issues submitted by Eeye being around 6 months old!  Appalling given that people actually *pay* M$ for this software.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/M$ bashing&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 
    </content:encoded>

    <pubDate>Thu, 12 Feb 2004 10:26:41 +0000</pubDate>
    <guid isPermaLink="false">http://freebsd.munk.me.uk/archives/101-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/2.5/</creativeCommons:license>
</item>

</channel>
</rss>