<?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 - Ports</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 - Ports - FreeBSD System Administration</title>
        <link>http://freebsd.munk.me.uk/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>Command Line Web Browsing With WWW::Mechanize::Shell</title>
    <link>http://freebsd.munk.me.uk/archives/179-Command-Line-Web-Browsing-With-WWWMechanizeShell.html</link>
            <category>Perl</category>
            <category>Ports</category>
            <category>Shell</category>
    
    <comments>http://freebsd.munk.me.uk/archives/179-Command-Line-Web-Browsing-With-WWWMechanizeShell.html#comments</comments>
    <wfw:comment>http://freebsd.munk.me.uk/wfwcomment.php?cid=179</wfw:comment>

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

    <author>nospam@example.com (munk)</author>
    <content:encoded>
    &lt;span style=&quot;font-weight:bold&quot;&gt;Introduction&lt;/span&gt;&lt;br /&gt;
The perl module &lt;a href=&quot;http://search.cpan.org/~corion/WWW-Mechanize-Shell/&quot;  title=&quot;WWW::Mechanize::Shell On CPAN&quot;&gt;WWW::Mechanize::Shell&lt;/a&gt; is a brilliant tool for browsing websites at a very low level - think somewhere in between using telnet and using a command line based browser like lynx or links or w3m and you&#039;ll be close.  WWW::Mechanize::Shell is more than that though, it allows you to script a complete HTTP session so it can be replayed back at a later date without any interaction using WWW::Mechanize::Shell&#039;s parent perl module WWW::Mechanize - great for automatically submitting HTML forms/ POST data regularly via a cron job for example.&lt;br /&gt;
&lt;br /&gt;
In this article I&#039;ll be talking about installing WWW::Mechanize::Shell, look at a typical WWW::Mechanize::Shell browsing session and look at some examples of how I use WWW::Mechanize::Shell to make things easier.  Finally the article will end with a real world example - using mechshell to automate logging into FreshPorts and updating a watch list.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight:bold&quot;&gt;Installing WWW::Mechanize::Shell&lt;/span&gt;&lt;br /&gt;
As the name suggests, WWW::Mechanize::Shell is a perl module whose &#039;parent&#039; is the &lt;a href=&quot;http://search.cpan.org/~petdance/WWW-Mechanize/&quot;  title=&quot;WWW::Mechanize at CPAN&quot;&gt;WWW::Mechanize&lt;/a&gt; module written by Andy Lester (WWW::Mechanize::Shell itself is written by Max Maischein at time of original writing).  WWW::Mechanize does all the work in the background - WWW::Mechanize::Shell just makes it easy to interact in a HTTP session.  WWW::Mechanize::Shell and all it&#039;s dependencies can be installed from the 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@users&amp;#160;/root#&amp;#160;cd&amp;#160;/usr/ports/www/p5-WWW-Mechanize-Shell/&lt;br /&gt;
root@users&amp;#160;/home/munk/ports/www/p5-WWW-Mechanize-Shell#&amp;#160;make&amp;#160;install&lt;br /&gt;
root@users&amp;#160;/home/munk/ports/www/p5-WWW-Mechanize-Shell#&amp;#160;rehash&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight:bold&quot;&gt;Getting Started Using WWW::Mechanize::Shell&lt;/span&gt;&lt;br /&gt;
Once installed, start up the WWW::Mechanize::Shell using the following you can use the following commandline:&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;/root#&amp;#160;perl&amp;#160;-MWWW&amp;#58;&amp;#58;Mechanize&amp;#58;&amp;#58;Shell&amp;#160;-eshell&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
To make things easier though I use a CSH shell alias which aliases &#039;mechshell&#039; to the command 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@users&amp;#160;/root#&amp;#160;grep&amp;#160;mechshell&amp;#160;$cshrc&lt;br /&gt;
alias&amp;#160;mechshell&amp;#160;perl&amp;#160;-MWWW&amp;#58;&amp;#58;Mechanize&amp;#58;&amp;#58;Shell&amp;#160;-eshell&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight:bold&quot;&gt;Examples of WWW::Mechanize Usage&lt;/span&gt;&lt;br /&gt;
I usually use WWW::Mechanize when I want to manipulate data from websites that require a stateful HTTP session - ie a browsing session where there&#039;s more than one URL you have to visit to complete the &#039;session&#039;.  Usually these kind of stateful sessions involve logging into the website first, then browsing to another page to obtain the data and then I have the WWW::Mechanize perl script handle the data and return any results on the commandline.&lt;br /&gt;
&lt;br /&gt;
Some examples of scripts that I&#039;ve use WWW::Mechanize with:&lt;br /&gt;
&lt;br /&gt;
eclipse_flex_speed.pl&lt;br /&gt;
My ISP (Eclipse UK) used to allow you to &#039;flex&#039; your internet speed from 256k up to 2Mbps.  They ran an offer for a while where you could flex to the max for 3 months - unfortunately you could only flex for 12 hours at a time, which meant logging into the control panel every 12hrs, selecting the maximum speed and then submitting the form.  PITA basically.&lt;br /&gt;
&lt;br /&gt;
Instead I wrote eclipse_flex_speed.pl to automatically login to the Eclipse control panel, &#039;click&#039; the 2Mbps radio button and then submit the form so my speed got flexed automagically.  I then added the script as a cron job to autorun every 12hours, saving the haslle of doing it all manually!&lt;br /&gt;
&lt;br /&gt;
aod_get.pl&lt;br /&gt;
The BBC website allows you to listen to streams of all BBC radio broadcasts for up to a week after they&#039;ve been aired live.  The problem is that the web interface you listen to the stream on in your web browser only allows you to skip 5 or 15 minutes ahead in time and doesn&#039;t allow you to go to specific times in the stream.  To get around this you can obtain the URL of the real player stream and open it in a standalone real player - doing this you can go to any point in the stream easily.  Trouble is finding the URL of the stream isn&#039;t that easy and involves viewing the source HTML of the web UI and copy/pasting a partial URL.&lt;br /&gt;
&lt;br /&gt;
I started to write a WWW::Mechanize script to automate the &#039;screen scraping&#039; of all the available feeds from the BBC Audio On Demand site and listing them on one single HTML page linking the name of the feed to the real player feed URL.  As it goes though, someone else - Dave Cross - already had the same idea and wrote &lt;a href=&quot;http://blog.dave.org.uk/archives/000652.html&quot;&gt;a great script for scraping the BBC feeds&lt;/a&gt; automatically.  I now run this in a cronjob once a week.&lt;br /&gt;
&lt;br /&gt;
torrentflux_ctl.pl&lt;br /&gt;
This is a script for starting and stopping all torrents under the control of the torrentflux web based bittorrent client.  The script logs in as the torrent owner and then stops or starts all the torrents for that user - basically just does a GET of a URL that causes torrentflux to stop or start all torrents.  Crude but effective.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight:bold&quot;&gt;Real world example - Automating the update of FreshPorts watch list&lt;/span&gt;&lt;br /&gt;
Below is a real world example usage of WWW::Mechanize::Shell - automating the procedure of updating your watch list on &lt;a href=&quot;http://www.freshports.org/about.php&quot;  title=&quot;About FreshPorts&quot;&gt;Freshports.org&lt;/a&gt;.  I&#039;ve included comments as &#039;# this is a comment&#039; to help explain what each command is doing.&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;Start&amp;#160;up&amp;#160;mechshell&amp;#160;-&amp;#160;alias&amp;#160;for&amp;#160;&#039;perl&amp;#160;-MWWW&amp;#58;&amp;#58;Mechanize&amp;#58;&amp;#58;Shell&amp;#160;-eshell&#039;&amp;#58;&lt;br /&gt;
munk@users&amp;#160;/home/munk#&amp;#160;mechshell&lt;br /&gt;
&lt;br /&gt;
#&amp;#160;Request&amp;#160;the&amp;#160;URL&amp;#160;http&amp;#58;//www.freshports.org/login.php.&lt;br /&gt;
#&amp;#160;Note&amp;#160;the&amp;#160;HTTP&amp;#160;response&amp;#160;&#039;&amp;#40;200&amp;#41;&#039;&amp;#160;is&amp;#160;displayed&amp;#160;underneath&lt;br /&gt;
#&amp;#160;to&amp;#160;indicate&amp;#160;the&amp;#160;page&amp;#160;was&amp;#160;fetched&amp;#160;successfully&amp;#58;&lt;br /&gt;
&amp;#40;no&amp;#160;url&amp;#41;&amp;#62;get&amp;#160;http&amp;#58;//www.freshports.org/login.php&lt;br /&gt;
Retrieving&amp;#160;http&amp;#58;//www.freshports.org/login.php&amp;#40;200&amp;#41;&lt;br /&gt;
&lt;br /&gt;
#&amp;#160;Use&amp;#160;the&amp;#160;mechshell&amp;#160;&#039;dump&#039;&amp;#160;command&amp;#160;to&amp;#160;dump&amp;#160;the&amp;#160;contents&lt;br /&gt;
#&amp;#160;of&amp;#160;all&amp;#160;forms&amp;#160;found&amp;#160;on&amp;#160;the&amp;#160;login&amp;#160;page&amp;#58;&lt;br /&gt;
http&amp;#58;//www.freshports.org/login.php&amp;#62;dump&lt;br /&gt;
POST&amp;#160;http&amp;#58;//www.freshports.org/login.php?origin=%2F&amp;#160;&amp;#91;l&amp;#93;&lt;br /&gt;
&amp;#160;&amp;#160;custom_settings=1&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#40;hidden&amp;#160;readonly&amp;#41;&lt;br /&gt;
&amp;#160;&amp;#160;LOGIN=1&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#40;hidden&amp;#160;readonly&amp;#41;&lt;br /&gt;
&amp;#160;&amp;#160;UserID=&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#40;text&amp;#41;&lt;br /&gt;
&amp;#160;&amp;#160;Password=&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#40;password&amp;#41;&lt;br /&gt;
&amp;#160;&amp;#160;submit=Login&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#40;submit&amp;#41;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#60;NONAME&amp;#62;=&amp;#60;UNDEF&amp;#62;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#40;reset&amp;#41;&lt;br /&gt;
&lt;br /&gt;
#&amp;#160;There&#039;s&amp;#160;just&amp;#160;a&amp;#160;single&amp;#160;form&amp;#160;on&amp;#160;this&amp;#160;page&amp;#58;&lt;br /&gt;
#&amp;#160;-&amp;#160;the&amp;#160;form&#039;s&amp;#160;&#039;ACTION&#039;&amp;#160;is&amp;#160;set&amp;#160;to&amp;#160;submit&amp;#160;the&amp;#160;form&amp;#160;using&amp;#160;the&amp;#160;POST&amp;#160;method&lt;br /&gt;
#&amp;#160;&amp;#160;&amp;#160;to&amp;#160;the&amp;#160;url&amp;#160;http&amp;#58;//www.freshports.org/login.php?origin=%2F&lt;br /&gt;
#&amp;#160;The&amp;#160;form&amp;#160;contains&amp;#160;the&amp;#160;following&amp;#160;form&amp;#160;fields&amp;#58;&lt;br /&gt;
#&amp;#160;-&amp;#160;2&amp;#160;hidden&amp;#160;fields&lt;br /&gt;
#&amp;#160;-&amp;#160;1&amp;#160;text&amp;#160;field&amp;#160;called&amp;#160;&#039;UserID&#039;&lt;br /&gt;
#&amp;#160;-&amp;#160;1&amp;#160;password&amp;#160;field&amp;#160;called&amp;#160;&#039;Password&#039;&lt;br /&gt;
#&amp;#160;-&amp;#160;1&amp;#160;submit&amp;#160;field&amp;#160;called&amp;#160;&#039;Login&#039;&lt;br /&gt;
&lt;br /&gt;
#&amp;#160;Fill&amp;#160;in&amp;#160;the&amp;#160;&#039;UserID&#039;&amp;#160;and&amp;#160;&#039;Password&#039;&amp;#160;fields&amp;#58;&lt;br /&gt;
http&amp;#58;//www.freshports.org/login.php&amp;#62;value&amp;#160;UserID&amp;#160;munk&lt;br /&gt;
http&amp;#58;//www.freshports.org/login.php&amp;#62;value&amp;#160;Password&amp;#160;xxxxxx&lt;br /&gt;
&lt;br /&gt;
#&amp;#160;And&amp;#160;then&amp;#160;submit&amp;#160;the&amp;#160;form.&amp;#160;&amp;#160;Note&amp;#160;we&amp;#160;can&amp;#160;just&amp;#160;use&amp;#160;the&amp;#160;mechshell&amp;#160;&#039;submit&#039;&lt;br /&gt;
#&amp;#160;command&amp;#160;here&amp;#160;because&amp;#160;there&amp;#160;is&amp;#160;only&amp;#160;a&amp;#160;single&amp;#160;form&amp;#160;on&amp;#160;the&amp;#160;page.&amp;#160;&amp;#160;If&amp;#160;there&amp;#160;were&lt;br /&gt;
#&amp;#160;more&amp;#160;than&amp;#160;one&amp;#160;form&amp;#160;on&amp;#160;the&amp;#160;page&amp;#160;we&amp;#160;would&amp;#160;need&amp;#160;to&amp;#160;specify&amp;#160;which&amp;#160;button&amp;#160;exactly&amp;#160;to&lt;br /&gt;
#&amp;#160;click&amp;#58;&lt;br /&gt;
http&amp;#58;//www.freshports.org/login.php&amp;#62;submit&lt;br /&gt;
200&lt;br /&gt;
&lt;br /&gt;
#&amp;#160;Again&amp;#160;note&amp;#160;that&amp;#160;the&amp;#160;&#039;200&#039;&amp;#160;response&amp;#160;indicates&amp;#160;the&amp;#160;request&amp;#160;was&amp;#160;successful.&lt;br /&gt;
#&amp;#160;Also&amp;#160;note&amp;#160;that&amp;#160;the&amp;#160;next&amp;#160;mechshell&amp;#160;prompt&amp;#160;below&amp;#160;has&amp;#160;changed&amp;#160;from&lt;br /&gt;
#&amp;#160;&#039;http&amp;#58;//www.freshports.org/login.php&amp;#62;&#039;&amp;#160;to&amp;#160;just&amp;#160;&#039;http&amp;#58;//www.freshports.org/&#039;&amp;#160;-&lt;br /&gt;
#&amp;#160;this&amp;#160;indicates&amp;#160;that&amp;#160;the&amp;#160;login&amp;#160;script&amp;#160;has&amp;#160;probably&amp;#160;redirected&amp;#160;us&amp;#160;to&amp;#160;the&lt;br /&gt;
#&amp;#160;freshports&amp;#160;home&amp;#160;page.&lt;br /&gt;
&lt;br /&gt;
#&amp;#160;Now&amp;#160;we&amp;#160;take&amp;#160;a&amp;#160;look&amp;#160;to&amp;#160;check&amp;#160;that&amp;#160;the&amp;#160;login&amp;#160;succeeded&amp;#160;ok.&amp;#160;&amp;#160;To&amp;#160;do&amp;#160;this&amp;#160;we&amp;#160;use&lt;br /&gt;
#&amp;#160;the&amp;#160;mechshell&amp;#160;&#039;content&#039;&amp;#160;command&amp;#160;which&amp;#160;effectively&amp;#160;dumps&amp;#160;the&amp;#160;content&amp;#160;of&amp;#160;the&lt;br /&gt;
#&amp;#160;returned&amp;#160;page&amp;#160;back&amp;#160;at&amp;#160;us&amp;#160;in&amp;#160;a&amp;#160;pager.&lt;br /&gt;
#&amp;#160;What&amp;#160;we&#039;re&amp;#160;looking&amp;#160;for&amp;#160;is&amp;#160;the&amp;#160;text&amp;#160;&#039;Logged&amp;#160;in&amp;#160;as&amp;#160;munk&#039;&amp;#160;which&amp;#160;will&amp;#160;indicate&amp;#160;we&lt;br /&gt;
#&amp;#160;logged&amp;#160;in&amp;#160;ok&amp;#58;&lt;br /&gt;
http&amp;#58;//www.freshports.org/&amp;#62;content&lt;br /&gt;
&amp;#60;!DOCTYPE&amp;#160;HTML&amp;#160;PUBLIC&amp;#160;&quot;-//W3C//DTD&amp;#160;HTML&amp;#160;4.01&amp;#160;Transitional//EN&quot;&amp;#62;&lt;br /&gt;
&amp;#60;HTML&amp;#62;&lt;br /&gt;
&amp;#60;HEAD&amp;#62;&lt;br /&gt;
-snip-&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#60;td&amp;#160;NOWRAP&amp;#62;&amp;#60;FONT&amp;#160;SIZE=&quot;-1&quot;&amp;#62;Logged&amp;#160;in&amp;#160;as&amp;#160;munk&amp;#60;/FONT&amp;#62;&amp;#60;br&amp;#62;&amp;#60;FONT&amp;#160;SIZE=&quot;-1&quot;&amp;#62;&amp;#60;a&amp;#160;href=&quot;http://freebsd.munk.me.uk/customize.php?origin=%2F&quot;&amp;#160;title=&quot;Customize&amp;#160;your&amp;#160;settings&quot;&amp;#62;Customize&amp;#60;/a&lt;br /&gt;
&amp;#62;&amp;#60;/FONT&amp;#62;&amp;#60;br&amp;#62;&amp;#60;FONT&amp;#160;SIZE=&quot;-1&quot;&amp;#62;&amp;#60;a&amp;#160;href=&quot;http://freebsd.munk.me.uk/logout.php&quot;&amp;#160;title=&quot;Logout&amp;#160;of&amp;#160;the&amp;#160;website&quot;&amp;#62;Logout&amp;#60;/a&amp;#62;&amp;#60;/FONT&amp;#62;&amp;#60;br&amp;#62;&amp;#60;FONT&amp;#160;SIZE=&quot;-1&quot;&amp;#62;&amp;#60;a&amp;#160;href=&quot;/my-flagged-commits.php&quot;&amp;#160;title=&quot;Li&lt;br /&gt;
st&amp;#160;of&amp;#160;commits&amp;#160;you&amp;#160;have&amp;#160;flagged&quot;&amp;#62;My&amp;#160;Flagged&amp;#160;Commits&amp;#60;/a&amp;#62;&amp;#60;/FONT&amp;#62;&amp;#60;br&amp;#62;&lt;br /&gt;
-snip-&lt;br /&gt;
&lt;br /&gt;
#&amp;#160;Now&amp;#160;we&#039;re&amp;#160;logged&amp;#160;in&amp;#160;ok&amp;#160;we&amp;#160;can&amp;#160;continue&amp;#160;to&amp;#160;upload&amp;#160;the&amp;#160;mypkg_info.txt&amp;#160;file&amp;#160;we&lt;br /&gt;
#&amp;#160;created&amp;#160;earlier.&lt;br /&gt;
&lt;br /&gt;
#&amp;#160;First&amp;#160;browse&amp;#160;to&amp;#160;the&amp;#160;pkg_upload.php&amp;#160;page&amp;#58;&lt;br /&gt;
http&amp;#58;//www.freshports.org/&amp;#62;get&amp;#160;http&amp;#58;//www.freshports.org/pkg_upload.php&lt;br /&gt;
Retrieving&amp;#160;http&amp;#58;//www.freshports.org/pkg_upload.php&amp;#40;200&amp;#41;&lt;br /&gt;
&lt;br /&gt;
#&amp;#160;Now&amp;#160;use&amp;#160;&#039;dump&#039;&amp;#160;to&amp;#160;see&amp;#160;a&amp;#160;list&amp;#160;of&amp;#160;form&amp;#160;fields&amp;#160;on&amp;#160;this&amp;#160;page.&lt;br /&gt;
#&amp;#160;Note&amp;#160;that&amp;#160;there&amp;#160;are&amp;#160;2&amp;#160;submit&amp;#160;buttons&amp;#160;on&amp;#160;this&amp;#160;page&amp;#58;&lt;br /&gt;
http&amp;#58;//www.freshports.org/pkg_upload.php&amp;#62;dump&lt;br /&gt;
POST&amp;#160;http&amp;#58;//www.freshports.org/pkg_upload.php&amp;#160;&amp;#40;multipart/form-data&amp;#41;&lt;br /&gt;
&amp;#160;&amp;#160;pkg_info=&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#40;file&amp;#41;&lt;br /&gt;
&amp;#160;&amp;#160;staging=Staging&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#40;submit&amp;#41;&lt;br /&gt;
&amp;#160;&amp;#160;wlid=5393&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#40;option&amp;#41;&amp;#160;&amp;#160;&amp;#160;&amp;#91;&amp;#42;5393/main&amp;#42;&amp;#93;&lt;br /&gt;
&amp;#160;&amp;#160;replaceappend=replace&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#40;radio&amp;#41;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#91;&amp;#42;replace/Replace&amp;#160;list&amp;#160;contents|append/Append&amp;#160;to&amp;#160;list&amp;#160;&amp;#40;duplicates&amp;#160;will&amp;#160;be&amp;#160;removed&amp;#41;&amp;#93;&lt;br /&gt;
&amp;#160;&amp;#160;upload=Upload&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#40;submit&amp;#41;&lt;br /&gt;
&lt;br /&gt;
#&amp;#160;We&amp;#160;need&amp;#160;to&amp;#160;fill&amp;#160;out&amp;#160;the&amp;#160;form&amp;#160;here.&amp;#160;&amp;#160;Uploading&amp;#160;files&amp;#160;with&amp;#160;mechshell&amp;#160;is&amp;#160;as&lt;br /&gt;
#&amp;#160;simple&amp;#160;as&amp;#160;completing&amp;#160;the&amp;#160;correct&amp;#160;file&amp;#160;type&amp;#160;field&amp;#58;&lt;br /&gt;
http&amp;#58;//www.freshports.org/pkg_upload.php&amp;#62;value&amp;#160;pkg_info&amp;#160;/tmp/mypkg_info.txt&lt;br /&gt;
&lt;br /&gt;
#&amp;#160;Ok,&amp;#160;now&amp;#160;we&#039;re&amp;#160;ready&amp;#160;to&amp;#160;submit&amp;#160;the&amp;#160;form.&lt;br /&gt;
#&amp;#160;Note&amp;#160;that&amp;#160;because&amp;#160;there&amp;#160;are&amp;#160;2&amp;#160;submit&amp;#160;buttons&amp;#160;on&amp;#160;this&amp;#160;form,&amp;#160;we&amp;#160;must&amp;#160;explicitly&lt;br /&gt;
#&amp;#160;tell&amp;#160;mechshell&amp;#160;which&amp;#160;button&amp;#160;it&amp;#160;is&amp;#160;that&amp;#160;we&amp;#160;want&amp;#160;to&amp;#160;click&amp;#160;on&amp;#160;-&amp;#160;to&amp;#160;do&amp;#160;that&amp;#160;we&amp;#160;use&lt;br /&gt;
#&amp;#160;the&amp;#160;&#039;click&#039;&amp;#160;command.&amp;#160;&amp;#160;Just&amp;#160;using&amp;#160;&#039;submit&#039;&amp;#160;here&amp;#160;would&amp;#160;possibly&amp;#160;click&amp;#160;on&amp;#160;the&lt;br /&gt;
#&amp;#160;&#039;staging&#039;&amp;#160;button&amp;#160;which&amp;#160;is&amp;#160;not&amp;#160;what&amp;#160;we&amp;#160;want&amp;#160;-&amp;#160;instead&amp;#160;we&amp;#160;use&amp;#160;the&amp;#160;command&lt;br /&gt;
#&amp;#160;&#039;click&amp;#160;upload&#039;&amp;#160;to&amp;#160;indicate&amp;#160;we&amp;#160;want&amp;#160;to&amp;#160;click&amp;#160;on&amp;#160;the&amp;#160;&#039;upload&#039;&amp;#160;button&amp;#58;&lt;br /&gt;
http&amp;#58;//www.freshports.org/pkg_upload.php&amp;#62;click&amp;#160;upload&lt;br /&gt;
&amp;#40;200&amp;#41;&lt;br /&gt;
&lt;br /&gt;
#&amp;#160;Success!&amp;#160;&amp;#160;It&#039;s&amp;#160;a&amp;#160;good&amp;#160;idea&amp;#160;now&amp;#160;to&amp;#160;just&amp;#160;check&amp;#160;that&amp;#160;this&amp;#160;worked&amp;#160;by&amp;#160;browsing&amp;#160;in&lt;br /&gt;
#&amp;#160;a&amp;#160;web&amp;#160;browser&amp;#160;to&amp;#160;your&amp;#160;watch&amp;#160;list&amp;#160;and&amp;#160;checking&amp;#160;the&amp;#160;new&amp;#160;items&amp;#160;were&amp;#160;updated&amp;#160;ok&amp;#160;&amp;#40;of&lt;br /&gt;
#&amp;#160;course&amp;#160;you&amp;#160;can&amp;#160;do&amp;#160;this&amp;#160;in&amp;#160;mechshell&amp;#160;if&amp;#160;you&amp;#160;want&amp;#160;but&amp;#160;I&#039;ll&amp;#160;leave&amp;#160;that&amp;#160;out&amp;#160;here!&amp;#41;.&lt;br /&gt;
&lt;br /&gt;
#&amp;#160;Finally,&amp;#160;the&amp;#160;really&amp;#160;cool&amp;#160;bit.&amp;#160;&amp;#160;The&amp;#160;mechshell&amp;#160;&#039;script&#039;&amp;#160;command&amp;#160;will&amp;#160;dump&amp;#160;out&lt;br /&gt;
#&amp;#160;the&amp;#160;perl&amp;#160;code&amp;#160;required&amp;#160;to&amp;#160;perform&amp;#160;all&amp;#160;of&amp;#160;the&amp;#160;above&amp;#160;actions&amp;#160;again&amp;#160;if&amp;#160;you&amp;#160;copy&lt;br /&gt;
#&amp;#160;them&amp;#160;into&amp;#160;a&amp;#160;perl&amp;#160;script&amp;#58;&lt;br /&gt;
http&amp;#58;//www.freshports.org/pkg_upload.php&amp;#62;script&lt;br /&gt;
#!perl&amp;#160;-w&lt;br /&gt;
use&amp;#160;strict;&lt;br /&gt;
use&amp;#160;WWW&amp;#58;&amp;#58;Mechanize;&lt;br /&gt;
use&amp;#160;WWW&amp;#58;&amp;#58;Mechanize&amp;#58;&amp;#58;FormFiller;&lt;br /&gt;
use&amp;#160;URI&amp;#58;&amp;#58;URL;&lt;br /&gt;
-snip-&lt;br /&gt;
&lt;br /&gt;
#&amp;#160;Also,&amp;#160;if&amp;#160;you&amp;#160;provide&amp;#160;a&amp;#160;filename&amp;#160;as&amp;#160;an&amp;#160;argument&amp;#160;to&amp;#160;the&amp;#160;&#039;script&#039;&amp;#160;command,&lt;br /&gt;
#&amp;#160;mechshell&amp;#160;will&amp;#160;dump&amp;#160;all&amp;#160;the&amp;#160;script&amp;#160;commands&amp;#160;to&amp;#160;that&amp;#160;filename&amp;#58;&lt;br /&gt;
http&amp;#58;//www.freshports.org/pkg_upload.php&amp;#62;script&amp;#160;/tmp/freshports_update.pl&lt;br /&gt;
&lt;br /&gt;
#&amp;#160;Finally,&amp;#160;use&amp;#160;&#039;quit&#039;&amp;#160;to&amp;#160;exit&amp;#160;the&amp;#160;mechshell&amp;#58;&lt;br /&gt;
http&amp;#58;//www.freshports.org/pkg_upload.php&amp;#62;quit&lt;br /&gt;
munk@users&amp;#160;/home/munk#&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Now all that remains is to open up /tmp/freshports_update.pl and tidy the script up so that it&#039;s more suitable for automated use via cron.  For example, any &#039;dump&#039; and &#039;content&#039; commands can be taken out - these would only cause problems anyway if run from a non-interactive shell as used by cron.&lt;br /&gt;
&lt;br /&gt;
We also need to add some code to have the script dump the contents of &#039;pkg_info -qoa&#039; to a temporary file prior to uploading.&lt;br /&gt;
&lt;br /&gt;
The completed &#039;quick and dirty&#039; hack looks like this then:&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;#!/usr/bin/perl&amp;#160;-w&lt;br /&gt;
use&amp;#160;strict;&lt;br /&gt;
use&amp;#160;WWW&amp;#58;&amp;#58;Mechanize;&lt;br /&gt;
use&amp;#160;WWW&amp;#58;&amp;#58;Mechanize&amp;#58;&amp;#58;FormFiller;&lt;br /&gt;
use&amp;#160;URI&amp;#58;&amp;#58;URL;&lt;br /&gt;
&lt;br /&gt;
#&amp;#160;FreshPorts&amp;#160;username/pass&amp;#58;&lt;br /&gt;
my&amp;#160;$user=&quot;munk&quot;;&lt;br /&gt;
my&amp;#160;$pass=&quot;xxxxx&quot;;&lt;br /&gt;
&lt;br /&gt;
#&amp;#160;Temp&amp;#160;location&amp;#160;to&amp;#160;store&amp;#160;output&amp;#160;from&amp;#160;&#039;pkg_info&amp;#160;-qoa&#039;&amp;#58;&lt;br /&gt;
my&amp;#160;$mypkg_info=&quot;/tmp/freshports/mypkg_info.txt&quot;;&lt;br /&gt;
&lt;br /&gt;
#&amp;#160;prepare&amp;#160;file&amp;#160;containing&amp;#160;output&amp;#160;from&amp;#58;&amp;#160;pkg_info&amp;#160;-qoa&lt;br /&gt;
`pkg_info&amp;#160;-qoa&amp;#160;&amp;#62;&amp;#160;$mypkg_info`;&lt;br /&gt;
&lt;br /&gt;
#&amp;#160;Prepare&amp;#160;WWW&amp;#58;&amp;#58;Mechanize&amp;#58;&lt;br /&gt;
my&amp;#160;$agent&amp;#160;=&amp;#160;WWW&amp;#58;&amp;#58;Mechanize-&amp;#62;new&amp;#40;&amp;#160;autocheck&amp;#160;=&amp;#62;&amp;#160;1&amp;#160;&amp;#41;;&lt;br /&gt;
my&amp;#160;$formfiller&amp;#160;=&amp;#160;WWW&amp;#58;&amp;#58;Mechanize&amp;#58;&amp;#58;FormFiller-&amp;#62;new&amp;#40;&amp;#41;;&lt;br /&gt;
$agent-&amp;#62;env_proxy&amp;#40;&amp;#41;;&lt;br /&gt;
&lt;br /&gt;
#&amp;#160;Login&amp;#160;to&amp;#160;FreshPorts&amp;#58;&lt;br /&gt;
$agent-&amp;#62;get&amp;#40;&#039;http&amp;#58;//www.freshports.org/login.php&#039;&amp;#41;;&lt;br /&gt;
$agent-&amp;#62;form_number&amp;#40;1&amp;#41;&amp;#160;if&amp;#160;$agent-&amp;#62;forms&amp;#160;and&amp;#160;scalar&amp;#160;@{$agent-&amp;#62;forms};&lt;br /&gt;
{&amp;#160;local&amp;#160;$^W;&amp;#160;$agent-&amp;#62;current_form-&amp;#62;value&amp;#40;&#039;UserID&#039;,&amp;#160;$user&amp;#41;;&amp;#160;};&lt;br /&gt;
{&amp;#160;local&amp;#160;$^W;&amp;#160;$agent-&amp;#62;current_form-&amp;#62;value&amp;#40;&#039;Password&#039;,&amp;#160;$pass&amp;#41;;&amp;#160;};&lt;br /&gt;
$agent-&amp;#62;submit&amp;#40;&amp;#41;;&lt;br /&gt;
&lt;br /&gt;
#&amp;#160;Submit&amp;#160;pkg_info&amp;#160;details&amp;#160;to&amp;#160;FreshPorts&amp;#160;pkg_upload&amp;#160;page&amp;#58;&lt;br /&gt;
$agent-&amp;#62;get&amp;#40;&#039;http&amp;#58;//www.freshports.org/pkg_upload.php&#039;&amp;#41;;&lt;br /&gt;
$agent-&amp;#62;form_number&amp;#40;1&amp;#41;&amp;#160;if&amp;#160;$agent-&amp;#62;forms&amp;#160;and&amp;#160;scalar&amp;#160;@{$agent-&amp;#62;forms};&lt;br /&gt;
{&amp;#160;local&amp;#160;$^W;&amp;#160;$agent-&amp;#62;current_form-&amp;#62;value&amp;#40;&#039;pkg_info&#039;,&amp;#160;$mypkg_info&amp;#41;;&amp;#160;};&lt;br /&gt;
$agent-&amp;#62;click&amp;#40;&#039;upload&#039;&amp;#41;;&lt;br /&gt;
&lt;br /&gt;
#&amp;#160;Remove&amp;#160;temporary&amp;#160;file&amp;#58;&lt;br /&gt;
`rm&amp;#160;$mypkg_info`;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
After saving the script and making the file executable, an entry can then be added to cron to have the script auto update the list of ports at freshports once a week - or however often you require it to be updated, once a week is more than enough for me.  Sorted! :) 
    </content:encoded>

    <pubDate>Wed, 15 Aug 2007 12:46:00 +0000</pubDate>
    <guid isPermaLink="false">http://freebsd.munk.me.uk/archives/179-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/2.5/</creativeCommons:license>
</item>
<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>Portupgrade fails to upgrade dependencies</title>
    <link>http://freebsd.munk.me.uk/archives/199-Portupgrade-fails-to-upgrade-dependencies.html</link>
            <category>Perl</category>
            <category>Ports</category>
    
    <comments>http://freebsd.munk.me.uk/archives/199-Portupgrade-fails-to-upgrade-dependencies.html#comments</comments>
    <wfw:comment>http://freebsd.munk.me.uk/wfwcomment.php?cid=199</wfw:comment>

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

    <author>nospam@example.com (munk)</author>
    <content:encoded>
    When using portupgrade to upgrade ports recursively, occasionally you get a problem where portupgrade fails to upgrade a dependency of a port that&#039;s being upgraded.    This seems to happen most often with perl ports - p5-* ports - probably because perl packages/ports use the most dependencies of all with being modular in design anyway.&lt;br /&gt;
&lt;br /&gt;
An example is when I just went to run the weekly &#039;portupgrade -arR&#039; and whilst upgrading p5-PathTools-3.21, portupgrade found that another port - p5-Scalar-List-Utils-1.18 - also needed upgrading.  Unfortunately the upgrade of that port failed with the following error:&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;#62;&amp;#160;&amp;#160;Checking&amp;#160;if&amp;#160;lang/p5-Scalar-List-Utils&amp;#160;already&amp;#160;installed&lt;br /&gt;
===&amp;#62;&amp;#160;&amp;#160;&amp;#160;p5-Scalar-List-Utils-1.18,1&amp;#160;is&amp;#160;already&amp;#160;installed&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;You&amp;#160;may&amp;#160;wish&amp;#160;to&amp;#160;``make&amp;#160;deinstall&#039;&#039;&amp;#160;and&amp;#160;install&amp;#160;this&amp;#160;port&amp;#160;again&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;by&amp;#160;``make&amp;#160;reinstall&#039;&#039;&amp;#160;to&amp;#160;upgrade&amp;#160;it&amp;#160;properly.&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;If&amp;#160;you&amp;#160;really&amp;#160;wish&amp;#160;to&amp;#160;overwrite&amp;#160;the&amp;#160;old&amp;#160;port&amp;#160;of&amp;#160;lang/p5-Scalar-List-Utils&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;without&amp;#160;deleting&amp;#160;it&amp;#160;first,&amp;#160;set&amp;#160;the&amp;#160;variable&amp;#160;&quot;FORCE_PKG_REGISTER&quot;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;in&amp;#160;your&amp;#160;environment&amp;#160;or&amp;#160;the&amp;#160;&quot;make&amp;#160;install&quot;&amp;#160;command&amp;#160;line.&lt;br /&gt;
&amp;#42;&amp;#42;&amp;#42;&amp;#160;Error&amp;#160;code&amp;#160;1&lt;br /&gt;
&lt;br /&gt;
Stop&amp;#160;in&amp;#160;/home/munk/ports/lang/p5-Scalar-List-Utils.&lt;br /&gt;
&amp;#42;&amp;#42;&amp;#42;&amp;#160;Error&amp;#160;code&amp;#160;1&lt;br /&gt;
&lt;br /&gt;
Stop&amp;#160;in&amp;#160;/home/munk/ports/devel/p5-PathTools.&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
The problem is that any already installed dependencies - regardless of whether they need upgrading or not - are seen by portupgrade as being installed already and so it refuses to upgrade.  Hence if the port you&#039;re trying to upgrade has a dependency that *also* needs upgrading, this will fail.  Adding &#039;-f&#039; onto the portupgrade line makes no difference.&lt;br /&gt;
&lt;br /&gt;
One solution is to set the environment variable &#039;FORCE_PKG_REGISTER&#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;setenv&amp;#160;FORCE_PKG_REGISTER&amp;#160;1&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
and then run the portupgrade command again.  The installed status of the dependencies are then effectively ignored and the port dependencies are forcibly installed.  Not sure why portupgrade doesn&#039;t upgrade any dependencies automatically - I would have thought any dependencies of a port would be automatically checked for upgrades and upgraded if necessary.  Maybe I&#039;m missing something. 
    </content:encoded>

    <pubDate>Sun, 24 Dec 2006 15:01:00 +0000</pubDate>
    <guid isPermaLink="false">http://freebsd.munk.me.uk/archives/199-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/2.5/</creativeCommons:license>
</item>
<item>
    <title>Stunnel upgrade causes portupgrade to stall</title>
    <link>http://freebsd.munk.me.uk/archives/194-Stunnel-upgrade-causes-portupgrade-to-stall.html</link>
            <category>Ports</category>
    
    <comments>http://freebsd.munk.me.uk/archives/194-Stunnel-upgrade-causes-portupgrade-to-stall.html#comments</comments>
    <wfw:comment>http://freebsd.munk.me.uk/wfwcomment.php?cid=194</wfw:comment>

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

    <author>nospam@example.com (munk)</author>
    <content:encoded>
    I usually run &#039;portupgrade -arR&#039; once a week and leave it to itself to get on with it.  Unfortunately sometimes I come back and find only a couple of ports have been upgraded and portupgrade has stalled waiting for me to enter some input about something or other.  The usual suspect is the upgrade of stunnel - stunnel asks you at the deinstallation stage whether it should remove the &#039;stunnel&#039; user and group and the portupgrade won&#039;t proceed until you&#039;ve answered yes or no.&lt;br /&gt;
&lt;br /&gt;
This is all well and good if you&#039;re permanantly deleting the port, you don&#039;t really want unnecessary users and groups left on your system.  However in the case of portupgrade, the user/group will be used again so asking if you want to remove the user/group doesn&#039;t really need an answer - just leave the user/group alone and get on with it already!&lt;br /&gt;
&lt;br /&gt;
I had a quick google for &#039;stunnel portupgrade user groups&#039; and found someone who&#039;d had the same problem.  The solution the guy mentioned is to set the option PACKAGE_BUILDING for the stunnel port in the portupgrade config file - /usr/local/etc/pkgtools.conf:&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;&#039;security/stunnel&#039;&amp;#160;=&amp;#62;&amp;#160;&amp;#91;&amp;#160;&#039;PACKAGE_BUILDING=1&#039;&amp;#160;&amp;#93;,&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Unfortunately as yet this doesn&#039;t seem to work - neither does setting &#039;BATCH&#039; which usually does the trick anyway (the guy complaining about hte issue noted that BATCH didn&#039;t work for him, whist PACKAGE_BUILDING did.  Neither works for me :().  Anyway I&#039;ll probably spend a few minutes looking into it and see if I can sort it... in the mean time if anyone has any ideas let me know in the comments :)&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;UPDATE:&lt;/strong&gt;&lt;br /&gt;
Mmm ok, had a quick look into the problem and it looks like portupgrade isn&#039;t taking any of the flags set in pkgtools.conf - at the start of the upgrade it says &#039;BATCH=1&#039; is set, but when the deinstall script runs the value of BATCH is reset to empty for some reason.&lt;br /&gt;
&lt;br /&gt;
UPDATE2: I think the problem is because whilst portupgrade honours the env variables set in pkgtools.conf, the pkg-deinstall script for stunnel doesn&#039;t inherit any env variables because it&#039;s invoked from pkg_delete.  The only solution I can think of off top of head is to export the BATCH variable on the commandline along the lines of:&lt;br /&gt;
&lt;br /&gt;
setenv BATCH 1&lt;br /&gt;
&lt;br /&gt;
just before running portupgrade.  PITA (works though, just tested it:). 
    </content:encoded>

    <pubDate>Sat, 30 Sep 2006 21:00:24 +0000</pubDate>
    <guid isPermaLink="false">http://freebsd.munk.me.uk/archives/194-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/2.5/</creativeCommons:license>
</item>
<item>
    <title>Strategy for Upgrading Ports</title>
    <link>http://freebsd.munk.me.uk/archives/188-Strategy-for-Upgrading-Ports.html</link>
            <category>Ports</category>
    
    <comments>http://freebsd.munk.me.uk/archives/188-Strategy-for-Upgrading-Ports.html#comments</comments>
    <wfw:comment>http://freebsd.munk.me.uk/wfwcomment.php?cid=188</wfw:comment>

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

    <author>nospam@example.com (munk)</author>
    <content:encoded>
    Just read a great article called &lt;a href=&quot;http://bsdpants.blogspot.com/2006/08/top-ten-rules-for-using-ports-system.html&quot;  title=&quot;Top ten rules for using ports&quot;&gt;Top ten rules for using ports&lt;/a&gt; on BSDPants - &lt;a href=&quot;http://bsdpants.blogspot.com/&quot;  title=&quot;BSDPants&quot;&gt;BSDPants &lt;/a&gt;looks like a good blog btw if you&#039;re into FreeBSD, check it out.  Got me to thinking about my strategy for upgrading my ports.&lt;br /&gt;
&lt;br /&gt;
My port upgrade strategy - in order of prioritization - is:&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;&lt;li/&gt;Get a daily &lt;a href=&quot;http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/security-portaudit.html&quot;  title=&quot;Portaudit&quot;&gt;portaudit&lt;/a&gt; report of any ports that have security problems.  Upgrade those ports as soon as I get the report.&lt;br /&gt;
Portaudit is a tool that checks each port you have installed against a list of ports that have security problems.  If any of your ports match up with the ports on the security list, they&#039;re flagged as being insecure and you receive a notification of this when the periodic script is run.&lt;br /&gt;
&lt;br /&gt;
&lt;li/&gt;On a daily basis, have a script - cvsup_cron.sh - run the following.  I&#039;ll add the script in the extended body, but essentially all it does is:&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;cvsup&amp;#160;the&amp;#160;ports&amp;#160;tree&amp;#160;to&amp;#160;latest&amp;#160;ver&amp;#58;&lt;br /&gt;
/usr/local/bin/cvsup&amp;#160;-g&amp;#160;-L&amp;#160;0&amp;#160;/etc/supfile-ports-all&lt;br /&gt;
&lt;br /&gt;
#&amp;#160;Use&amp;#160;portupgrade&amp;#160;to&amp;#160;fetch&amp;#160;any&amp;#160;distfiles&amp;#160;for&amp;#160;any&amp;#160;ports&amp;#160;that&amp;#160;have&amp;#160;been&amp;#160;updated&amp;#58;&lt;br /&gt;
/usr/local/sbin/portupgrade&amp;#160;-arRF&lt;br /&gt;
&lt;br /&gt;
#&amp;#160;Then&amp;#160;output&amp;#160;a&amp;#160;list&amp;#160;of&amp;#160;all&amp;#160;those&amp;#160;ports&amp;#58;&lt;br /&gt;
/usr/local/sbin/portversion&amp;#160;-vl&amp;#160;&quot;&amp;#60;&quot;&lt;/div&gt;&lt;br /&gt;
This updates my ports tree to the latest, fetches any distfiles for newly updated ports and then prints out a list of those ports that are out of date.  Fetching the updated distfiles just makes upgrading faster when I&#039;m sat there in front of the console doing the work - instead of waiting ages for distfiles to download, the distfiles are already there waiting to be installed.&lt;br /&gt;
&lt;br /&gt;
&lt;li/&gt;From the daily cvsup_cron.sh script output, if there are any services/servers that need updating, I&#039;ll update those immediately.  Why?  Well on a Saturday I upgrade all the out of date ports in one go using the &#039;-arR&#039; flags with portupgrade.  This recursively upgrades all the out of date ports and those that rely on them, but if any of those are services then there&#039;s a chance that the service will be taken down by the upgrade process.  By upgrading any services seperately I can make sure the services are restarted immediately instead of waiting for the &#039;portupgrade -arR&#039; process to finish (I usually go off and do something else anyway whilst that&#039;s going on:).&lt;br /&gt;
&lt;br /&gt;
&lt;li/&gt;Finally on a Saturday as mentioned above, I upgrade every port that&#039;s out of date automatically using &#039;portupgrade -arR&#039;.  I like to try and read /usr/ports/UPDATING first for any info on what might go wrong, but I have to admit I don&#039;t usually read it until something&#039;s already gone wrong - doh.&lt;/ol&gt;Until a year or so ago I just used to run &#039;portupgrade -arRi&#039; once a week - which upgrades everything but prompts you for responses.  This gave me the chance to read up on what had changed on each port before saying &#039;yes&#039; to the upgrade.  However this gets very tedious after a while since most ports never really need any special attention and are only being upgraded with minor patches that don&#039;t affect the service it provides significantly.  As a result I moved to checking which ports had changed daily, upgrading services immediately, then upgrading everything else automatically using &#039;portupgrade -arR&#039; every Saturday.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Freshports Daily Watch List Notifications&lt;/strong&gt;&lt;br /&gt;
I should also mention the excellent &lt;a href=&quot;http://www.freshports.org/faq.php&quot;  title=&quot;FAQ entries on Watch List service at Freshports.org&quot;&gt;watch list service at freshports.org&lt;/a&gt; - you create a watch list of all the ports you currently have on your system and then opt to get daily email notification when any of those ports are updated.  This is a very handy thing in combination with the strategy above - the notification email includes the cvs commit message for the ports that have changed so you know how urgent the update is and whether you should do something about it immediately or let it wait for the weekly update.&lt;br /&gt;
&lt;br /&gt;
Read the FAQ article linked in the previous paragraph for more info on watch lists - easiest thing is to just register on the freshports.org site and get stuck in though.&lt;br /&gt;
&lt;br /&gt;
I&#039;ve been meaning to write a script to update my watch list at freshports automatically - it will get done eventually and I&#039;ll post about it here when it happens.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;ll include the cvsup_cron.sh script in the extended article, it requires the &#039;fastest_cvsup&#039; port to be installed - a useful script for working out which cvsup server is fastest/closest in terms of ping speeds, worth installing if you haven&#039;t got it already.&lt;br /&gt;
 &lt;br /&gt;&lt;a href=&quot;http://freebsd.munk.me.uk/archives/188-Strategy-for-Upgrading-Ports.html#extended&quot;&gt;Continue reading &quot;Strategy for Upgrading Ports&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Sat, 16 Sep 2006 12:38:31 +0000</pubDate>
    <guid isPermaLink="false">http://freebsd.munk.me.uk/archives/188-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/2.5/</creativeCommons:license>
</item>
<item>
    <title>Stop Ports Being Upgraded By Portupgrade</title>
    <link>http://freebsd.munk.me.uk/archives/183-Stop-Ports-Being-Upgraded-By-Portupgrade.html</link>
            <category>Ports</category>
    
    <comments>http://freebsd.munk.me.uk/archives/183-Stop-Ports-Being-Upgraded-By-Portupgrade.html#comments</comments>
    <wfw:comment>http://freebsd.munk.me.uk/wfwcomment.php?cid=183</wfw:comment>

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

    <author>nospam@example.com (munk)</author>
    <content:encoded>
    Sometimes you don&#039;t always want &lt;a href=&quot;http://www.onlamp.com/pub/a/bsd/2003/08/28/FreeBSD_Basics.html&quot;  class=&quot;bb-url&quot;&gt;portupgrade&lt;/a&gt; to upgrade a port that&#039;s installed - for example if you need some software to be a certain version for compatibility or perhaps because the later version of the software suggested by portupgrade is broken on your system.&lt;br /&gt;
&lt;br /&gt;
You can stop a port being upgraded by portupgrade by modifying the /usr/local/etc/pkgtools.conf file and adding the port to the list of &#039;HOLD_PKGS&#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;&amp;#160;&amp;#160;HOLD_PKGS&amp;#160;=&amp;#160;&amp;#91;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&#039;www/p5-WWW-Mechanize&#039;,&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#93;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
In this case the line about the www/p5-WWW-Mechanize port tells portupgrade and it&#039;s associated tools - portinstall and portversion for example - to hold back making any changes to that port - it&#039;s effectively ignored by portupgrade.  You can see the effect when I run portversion to find which ports are out of date:&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;portversion&amp;#160;-vl&amp;#160;&quot;&amp;#60;&quot;&lt;br /&gt;
...&lt;br /&gt;
p5-WWW-Mechanize-1.18&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#60;&amp;#160;&amp;#160;&amp;#91;held&amp;#93;&amp;#160;needs&amp;#160;updating&amp;#160;&amp;#40;port&amp;#160;has&amp;#160;1.20&amp;#41;&lt;br /&gt;
...&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
You can see portversion adds the text &#039;[held]&#039; to the output message for p5-WWW-Mechanize indicating that the port won&#039;t be upgraded, even though it&#039;s out of date and a newer version exists.&lt;br /&gt;
&lt;br /&gt;
It&#039;s worth reading through the /usr/local/etc/pkgtools.conf file for more useful tips on how to adapt portupgrade to suit your system setup. 
    </content:encoded>

    <pubDate>Fri, 15 Sep 2006 20:43:00 +0000</pubDate>
    <guid isPermaLink="false">http://freebsd.munk.me.uk/archives/183-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/2.5/</creativeCommons:license>
</item>
<item>
    <title>Customizing FreeBSD Port Installations With Patch Files</title>
    <link>http://freebsd.munk.me.uk/archives/178-Customizing-FreeBSD-Port-Installations-With-Patch-Files.html</link>
            <category>Ports</category>
            <category>Serendipity</category>
    
    <comments>http://freebsd.munk.me.uk/archives/178-Customizing-FreeBSD-Port-Installations-With-Patch-Files.html#comments</comments>
    <wfw:comment>http://freebsd.munk.me.uk/wfwcomment.php?cid=178</wfw:comment>

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

    <author>nospam@example.com (munk)</author>
    <content:encoded>
    -&lt;br /&gt;
&lt;em&gt;This article presumes the reader has a good working knowledge of the FreeBSD ports system.  For more information see &lt;a href=&quot;http://www.freebsd.org/cgi/man.cgi?query=ports&amp;sektion=7&quot;  title=&quot;ports(7) manpage&quot;&gt;the ports manpage&lt;/a&gt;, &lt;a href=&quot;http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/ports-using.html&quot;  title=&quot;Using the FreeBSD ports&quot;&gt;the FreeBSD handbooks section on ports&lt;/a&gt; and &lt;a href=&quot;http://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/index.html&quot;  title=&quot;FreeBSD Porters Handbook&quot;&gt;the FreeBSD porters handbook&lt;/a&gt;.&lt;/em&gt;&lt;br /&gt;
-&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/ports-using.html&quot;  title=&quot;Using the FreeBSD ports&quot;&gt;The FreeBSD ports tree&lt;/a&gt; is great, but when it comes to making changes to the files that are installed by a port you have to be careful so as not to lose any changes when you upgrade.  Say you install a port like the &lt;a href=&quot;http://s9y.org&quot;  title=&quot;Serendipity Weblog&quot;&gt;Serendipity weblog software&lt;/a&gt;, then go to &lt;a href=&quot;http://s9y.org/121.html&quot;  title=&quot;Editing Serendipity Weblog templates&quot;&gt;modify a template&lt;/a&gt;.  Everything works great but unfortunately when you next use &lt;a href=&quot;http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/ports-using.html#PORTUPGRADE&quot;  title=&quot;Upgrading FreeBSD ports using portupgrade&quot;&gt;portupgrade&lt;/a&gt; you find the changes you made were all clobbered by the upgrade!  Not good.&lt;br /&gt;
&lt;br /&gt;
There are a few solutions to this problem, but probably the most natural method - in terms of keeping with the ports system and your own changes in harmony - is to create your own custom patch files and place them inside the &lt;a href=&quot;http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/ports-using.html#PORTS-SKELETON&quot;  title=&quot;Port files directory&quot;&gt;port&#039;s &#039;files&#039; directory&lt;/a&gt;.  This way when you install or upgrade a port, the files you want patching to include your modifications will automatically be patched.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a simple example using this weblog, Serendipity.  I want to modify the template I&#039;m using so it includes a &lt;a href=&quot;http://www.google.com/analytics/&quot;  title=&quot;Google Analytics&quot;&gt;Google Analytics&lt;/a&gt; tracker in each and every page to help track web usage.  The easiest way to do this is to modify the index.tpl file so it includes the analytics tracker code just before the closing &amp;lt;/body&amp;gt; tag of the index.tpl file.&lt;br /&gt;
&lt;br /&gt;
To make the changes permanent after an upgrade, instead of just going ahead and modifying the &#039;live&#039; index.tpl that&#039;s already installed I&#039;m going to make the changes to the index.tpl file located in the serendipity ports working directory &#039;work&#039; and then create a patch file that will transform the original index.tpl to the modified index.tpl.  &lt;br /&gt;
&lt;br /&gt;
To do this step by step:&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;&lt;li/&gt;Ensure the working directory for serendipity is available - to do this run &#039;make extract&#039; to extract the distfile&#039;s contents into the &#039;work&#039; 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/ports/www/serendipity#&amp;#160;cd&amp;#160;/usr/ports/www/serendipity/&lt;br /&gt;
root@users&amp;#160;/home/munk/ports/www/serendipity#&amp;#160;make&amp;#160;extract&lt;br /&gt;
===&amp;#62;&amp;#160;&amp;#160;Found&amp;#160;saved&amp;#160;configuration&amp;#160;for&amp;#160;serendipity-1.0.1&lt;br /&gt;
===&amp;#62;&amp;#160;&amp;#160;Extracting&amp;#160;for&amp;#160;serendipity-1.0.1&lt;br /&gt;
=&amp;#62;&amp;#160;MD5&amp;#160;Checksum&amp;#160;OK&amp;#160;for&amp;#160;serendipity-1.0.1.tar.gz.&lt;br /&gt;
=&amp;#62;&amp;#160;SHA256&amp;#160;Checksum&amp;#160;OK&amp;#160;for&amp;#160;serendipity-1.0.1.tar.gz.&lt;/div&gt;&lt;br /&gt;
&lt;li/&gt; Move into the template directory and create a copy of the file you want to modify, naming it &amp;lt;file&amp;gt;.orig, where &amp;lt;file&amp;gt; is the name of the file to be modified:&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/ports/www/serendipity#&amp;#160;cd&amp;#160;work/serendipity/templates/contest/&lt;br /&gt;
root@users&amp;#160;/home/munk/ports/www/serendipity/work/serendipity/templates/contest#&amp;#160;cp&amp;#160;index.tpl&amp;#160;&lt;br /&gt;
index.tpl.orig&lt;/div&gt;&lt;br /&gt;
&lt;li/&gt;Make the changes to the file you&#039;re modifying - note NOT the &lt;file&gt;.orig file! - in this case I need to make changes to index.tpl to add the following before the ending &lt;/body&gt; tag:&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;script&amp;#160;src=&quot;http&amp;#58;//www.google-analytics.com/urchin.js&quot;&amp;#160;type=&quot;text/javascript&quot;&amp;#62;&lt;br /&gt;
&amp;#60;/script&amp;#62;&lt;br /&gt;
&amp;#60;script&amp;#160;type=&quot;text/javascript&quot;&amp;#62;&lt;br /&gt;
_uacct&amp;#160;=&amp;#160;&quot;UA-XXXXXX-1&quot;;&lt;br /&gt;
urchinTracker&amp;#40;&amp;#41;;&lt;br /&gt;
&amp;#60;/script&amp;#62;&lt;/div&gt;&lt;br /&gt;
&lt;li/&gt;Create a patch file in the &#039;files&#039; directory of the port containing the unified diffs between the original file and the modified file.  &lt;br /&gt;
&lt;strong&gt;Notes:&lt;/strong&gt;&lt;br /&gt;
&lt;ol&gt;&lt;li/&gt;The name of the patch file MUST begin with &#039;patch-&#039; to be treated as a patch file.  The rest of the filename should reasonably indicate what the patch file contains.  In my case I&#039;ll call the patch file &#039;patch-templates_contest_index.tpl&#039;.&lt;br /&gt;
&lt;li/&gt;The patch must be made relative to the directory into which the port&#039;s distfile was extracted - if in doubt check over other port&#039;s patch files to see how they do it!&lt;br /&gt;
&lt;li/&gt;Make sure the .orig file is first in the diff command&lt;/ol&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/ports/www/serendipity/work/serendipity/templates/contest#&amp;#160;cd&amp;#160;../..&lt;br /&gt;
root@users&amp;#160;/home/munk/ports/www/serendipity/work/serendipity#&amp;#160;diff&amp;#160;-u&amp;#160;templates/contest/index.tpl.orig&amp;#160;templates/contest/index.tpl&amp;#160;&amp;#62;&amp;#160;usr/ports/www/serendipity/files/patch-templates_contest_index.tpl&lt;br /&gt;
root@users&amp;#160;/home/munk/ports/www/serendipity/work/serendipity#&amp;#160;cat&amp;#160;/usr/ports/www/serendipity/files/patch-templates_contest_index.tpl&lt;br /&gt;
---&amp;#160;templates/contest/index.tpl.orig&amp;#160;&amp;#160;&amp;#160;&amp;#160;Thu&amp;#160;Sep&amp;#160;&amp;#160;7&amp;#160;03&amp;#58;13&amp;#58;56&amp;#160;2006&lt;br /&gt;
+++&amp;#160;templates/contest/index.tpl&amp;#160;Thu&amp;#160;Sep&amp;#160;&amp;#160;7&amp;#160;03&amp;#58;14&amp;#58;08&amp;#160;2006&lt;br /&gt;
@@&amp;#160;-52,6&amp;#160;+52,13&amp;#160;@@&lt;br /&gt;
&amp;#160;&amp;#60;div&amp;#160;id=&quot;copyright&quot;&amp;#62;Design&amp;#160;&amp;#60;a&amp;#160;href=&quot;http&amp;#58;//garv.in/&quot;&amp;#62;Garvin&amp;#160;Hicking&amp;#60;/a&amp;#62;,&amp;#160;Icons&amp;#160;&lt;br /&gt;
&amp;#60;a&amp;#160;href=&quot;http&amp;#58;//tango-project.org/&quot;&amp;#62;Tango&amp;#160;Project&amp;#60;/a&amp;#62;&amp;#60;/div&amp;#62;&lt;br /&gt;
&lt;br /&gt;
&amp;#160;{if&amp;#160;$is_embedded&amp;#160;!=&amp;#160;true}&lt;br /&gt;
+&amp;#60;script&amp;#160;src=&quot;http&amp;#58;//www.google-analytics.com/urchin.js&quot;&lt;br /&gt;
+type=&quot;text/javascript&quot;&amp;#62;&lt;br /&gt;
+&amp;#60;/script&amp;#62;&lt;br /&gt;
+&amp;#60;script&amp;#160;type=&quot;text/javascript&quot;&amp;#62;&lt;br /&gt;
+_uacct&amp;#160;=&amp;#160;&quot;UA-669467-1&quot;;&lt;br /&gt;
+urchinTracker&amp;#40;&amp;#41;;&lt;br /&gt;
+&amp;#60;/script&amp;#62;&lt;br /&gt;
&amp;#160;&amp;#60;/body&amp;#62;&lt;br /&gt;
&amp;#160;&amp;#60;/html&amp;#62;&lt;br /&gt;
&amp;#160;{/if}&lt;/div&gt;&lt;/ol&gt;&lt;br /&gt;
&lt;br /&gt;
Now if all went well we should be able to run portupgrade on the installed port - or just run &#039;make install&#039; in the port directory if it&#039;s not installed yet - and the modifications to the index.tpl file should be made automatically.&lt;br /&gt;
&lt;br /&gt;
Admittedly this is a slightly complicated process and there are other easier ways of keeping a file after an upgrade - for example modify pkgtools.conf to make portupgrade execute commands after the port is installed to copy over the files you want updating.  However this method isn&#039;t as reliable as the patch file method.  If any changes are made to the files you&#039;re overwriting, portupgrade will never let you know about it - whereas with the patch file method, if one of the files you&#039;re wanting to modify has changed in the distribution tarball, then in all likelyhood the upgrade will fail becaue the patch process fails.  This allows you to look at the files that have changed in the distribution and change your patch file appropriately.&lt;br /&gt;
&lt;br /&gt;
 
    </content:encoded>

    <pubDate>Thu, 07 Sep 2006 01:29:28 +0000</pubDate>
    <guid isPermaLink="false">http://freebsd.munk.me.uk/archives/178-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/2.5/</creativeCommons:license>
</item>
<item>
    <title>Samba Upgrade to 3.0.23c and Login Failures</title>
    <link>http://freebsd.munk.me.uk/archives/176-Samba-Upgrade-to-3.0.23c-and-Login-Failures.html</link>
            <category>FreeBSD</category>
            <category>Ports</category>
    
    <comments>http://freebsd.munk.me.uk/archives/176-Samba-Upgrade-to-3.0.23c-and-Login-Failures.html#comments</comments>
    <wfw:comment>http://freebsd.munk.me.uk/wfwcomment.php?cid=176</wfw:comment>

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

    <author>nospam@example.com (munk)</author>
    <content:encoded>
    I just went to upgrade &lt;a href=&quot;http://www.samba.org/&quot;  title=&quot;Samba Network File System&quot;&gt;Samba&lt;/a&gt; to the latest FreeBSD port release - 3.0.23c.  The portupgrade went smoothly but when I went to restart the samba daemon, I found I was locked out of the network shares on the FreeBSD machine when trying to login/access them from Windows.&lt;br /&gt;
&lt;br /&gt;
Reading in /usr/ports/UPDATING revealed the problem:&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;20060904&amp;#58;&lt;br /&gt;
&amp;#160;&amp;#160;AFFECTS&amp;#58;&amp;#160;users&amp;#160;of&amp;#160;net/samba3&lt;br /&gt;
&amp;#160;&amp;#160;AUTHOR&amp;#58;&amp;#160;timur@gnu.org&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;Reviosion&amp;#160;of&amp;#160;Samba&amp;#160;3.0.23c&amp;#160;port&amp;#160;had&amp;#160;changed&amp;#160;location&amp;#160;of&amp;#160;the&amp;#160;directory,&lt;br /&gt;
&amp;#160;&amp;#160;where&amp;#160;Samba&amp;#160;stores&amp;#160;it&#039;s&amp;#160;smbpasswd&amp;#160;files&amp;#160;from&amp;#160;$PREFIX/private&amp;#160;to&amp;#160;a&amp;#160;more&lt;br /&gt;
&amp;#160;&amp;#160;common&amp;#160;$PREFIX/etc/samba.&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;You&amp;#160;need&amp;#160;to&amp;#160;move&amp;#160;&amp;#42;.tdb&amp;#160;files&amp;#160;from&amp;#160;an&amp;#160;old&amp;#160;to&amp;#160;new&amp;#160;location&amp;#160;and&amp;#160;remove&amp;#160;old&lt;br /&gt;
&amp;#160;&amp;#160;directory&amp;#160;if&amp;#160;you&amp;#160;use&amp;#160;tdbsam&amp;#160;backend&amp;#160;for&amp;#160;Samba&amp;#160;user&amp;#160;authentication.&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
The location of the samba password dbs changed!  Small sigh of relief, moved the db files over and everything worked as normal.&lt;br /&gt;
&lt;br /&gt;
Pays to read /usr/ports/UPDATING! 
    </content:encoded>

    <pubDate>Tue, 05 Sep 2006 20:10:02 +0000</pubDate>
    <guid isPermaLink="false">http://freebsd.munk.me.uk/archives/176-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>Rolling back the ports tree to an earlier time</title>
    <link>http://freebsd.munk.me.uk/archives/172-Rolling-back-the-ports-tree-to-an-earlier-time.html</link>
            <category>FreeBSD</category>
            <category>Ports</category>
    
    <comments>http://freebsd.munk.me.uk/archives/172-Rolling-back-the-ports-tree-to-an-earlier-time.html#comments</comments>
    <wfw:comment>http://freebsd.munk.me.uk/wfwcomment.php?cid=172</wfw:comment>

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

    <author>nospam@example.com (munk)</author>
    <content:encoded>
    Upgrading a port can be a real annoyance when it turns out the upgraded port doesn&#039;t actually work too well or has bugs that make it unusable.  This has happened to me on a number of times and I&#039;ve resorted to &#039;rolling back&#039; the port to an eariler version / date that I know will work ok.&lt;br /&gt;
&lt;br /&gt;
In essence you simply roll back the ports tree to an earlier date in time using &lt;a href=&quot;http://www.freebsd.org/handbook/cvsup.html&quot;  title=&quot;Using FreeBSD cvsup&quot;&gt;cvsup&lt;/a&gt;&#039;s date tagline in the &lt;a href=&quot;http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/cvsup.html#CVSUP-CONFIG&quot;  title=&quot;cvsup supfile configuration&quot;&gt;cvsup ports supfile&lt;/a&gt; you use:&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;One&amp;#160;day&amp;#160;ago&amp;#58;&lt;br /&gt;
&amp;#42;default&amp;#160;date=2006.09.01.00.00.00&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
This way when cvsup fetches the ports tree, the tree that was in place at the date specified will be grabbed instead of the current most up to date tree.&lt;br /&gt;
&lt;br /&gt;
Of course this has the problem of reverting *all* ports to the earlier date, so another cvsup would be required without the &#039;date&#039; tagline in the supfile to bring the ports tree back up to the current date.  &lt;br /&gt;
&lt;br /&gt;
Other options to avoid clobbering the whole ports tree:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;li/&gt;Modify the &#039;prefix&#039; tagline in the cvsup file to be different to /usr/ports:&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;default&amp;#160;prefix=/tmp/usr&lt;/div&gt;&lt;br /&gt;
This will set cvsup to download the old ports tree into /tmp/usr/ports and from there you can copy over the particular port you&#039;re interested in into /usr/ports.&lt;br /&gt;
&lt;br /&gt;
&lt;li/&gt;Use &lt;a href=&quot;http://www.freebsd.org/cgi/cvsweb.cgi/ports/&quot;  title=&quot;FreeBSD cvsweb ports tree&quot;&gt;cvsweb &lt;/a&gt;to work out which files changed since the port last worked correctly and download the known working good files into the port&#039;s directory.  Rebuilding the port from those files should do the trick to get the port rolled back.  In fact it might be easier to use the excellent &lt;a href=&quot;http://www.freshports.org/&quot;  title=&quot;Freshports&quot;&gt;FreshPorts site&lt;/a&gt; to see more easily which files were touched since the last known working good version of the port.&lt;/ul&gt;&lt;br /&gt;
&lt;br /&gt;
This article has lots of advice on rolling back ports:&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://ezine.daemonnews.org/200406/ports-things-go-wrong.html&quot;  title=&quot;Rolling back ports in FreeBSD&quot;&gt;Rolling back ports to an earlier time&lt;/a&gt; 
    </content:encoded>

    <pubDate>Sat, 02 Sep 2006 16:41:13 +0000</pubDate>
    <guid isPermaLink="false">http://freebsd.munk.me.uk/archives/172-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/2.5/</creativeCommons:license>
</item>
<item>
    <title>Portupgrade Taking Too Long?</title>
    <link>http://freebsd.munk.me.uk/archives/162-Portupgrade-Taking-Too-Long.html</link>
            <category>Ports</category>
    
    <comments>http://freebsd.munk.me.uk/archives/162-Portupgrade-Taking-Too-Long.html#comments</comments>
    <wfw:comment>http://freebsd.munk.me.uk/wfwcomment.php?cid=162</wfw:comment>

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

    <author>nospam@example.com (munk)</author>
    <content:encoded>
    I run portupgrade on a weekly basis to keep all the applications installed up to date.  This week however the process appeared to change and things ground to a very slow ugly halt!  Read the extended article to find out about recent changes to the portupgrade process.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;&lt;a href=&quot;http://freebsd.munk.me.uk/archives/162-Portupgrade-Taking-Too-Long.html#extended&quot;&gt;Continue reading &quot;Portupgrade Taking Too Long?&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Sat, 20 Nov 2004 14:01:07 +0000</pubDate>
    <guid isPermaLink="false">http://freebsd.munk.me.uk/archives/162-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/2.5/</creativeCommons:license>
</item>

</channel>
</rss>