<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Anthony's Blog &#187; mail</title>
	<atom:link href="http://www.anthonyldechiaro.com/blog/archives/category/linux/mail/feed" rel="self" type="application/rss+xml" />
	<link>http://www.anthonyldechiaro.com/blog</link>
	<description>Thoughts, ideas, and ramblings of a crazed mind</description>
	<lastBuildDate>Fri, 05 Jun 2009 00:01:13 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Remote monitoring with apticron and logcheck</title>
		<link>http://www.anthonyldechiaro.com/blog/archives/272</link>
		<comments>http://www.anthonyldechiaro.com/blog/archives/272#comments</comments>
		<pubDate>Tue, 10 Mar 2009 19:27:13 +0000</pubDate>
		<dc:creator>Anthony</dc:creator>
				<category><![CDATA[admin]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[monitoring]]></category>
		<category><![CDATA[reporting]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://www.anthonyldechiaro.com/blog/?p=272</guid>
		<description><![CDATA[I wanted to write a brief posting on some basic ways to help remotely administer Ubuntu/Debian boxes.  Over the past few months I&#8217;ve been tinkering with various methods of handling this and what I&#8217;ve come up with seems to work fairly well.  It basically consists of two applications: apticron, which monitors repositories for package updates, [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">I wanted to write a brief posting on some basic ways to help remotely administer Ubuntu/Debian boxes.  Over the past few months I&#8217;ve been tinkering with various methods of handling this and what I&#8217;ve come up with seems to work fairly well.  It basically consists of two applications: apticron, which monitors repositories for package updates, and logcheck, which monitors logs in for any security or other noteworthy entries.</p>
<p style="text-align: justify;">Apticron is very easy to set up, it&#8217;s in the repositories and requires basically no configuration.  It will drop a script in /etc/cron.daily and that is about it, emailing any reports to root.  Of course this can be modified through a .forward or an entry in /etc/aliases.</p>
<p style="text-align: justify;">Logcheck is fairly simple to set up as well &#8211; it is also in the repositories.  Once installed, edit the /etc/logcheck/logcheck.conf file to configure.  The first thing you will want to set is the REPORTLEVEL setting, options are &#8220;workstation&#8221;, &#8220;server&#8221; (default value), or &#8220;paranoid&#8221;.  I use server on mine, which gives a good amount of detail. I would advise against using paranoid unless the server is extremely locked down and users do not typically login.  Workstation is good for a desktop environment.  The only other variable I edited was SENDMAILTO.  Logcheck works by basically comparing each  logentry against a set of regular expressions and generate a report if it does not match.  I had to modify one or two regex&#8217;s slightly to fix false positives, if you want my changes just ask and I&#8217;ll send them over.</p>
<p style="text-align: justify;">One other small gem I want to mention : <a href="http://members.dslextreme.com/users/billw/gkrellm/gkrellm.html" target="_blank">gkrellm</a>.  I use this on both my desktop and server, it is invaluable for providing real-time system performance metrics.  Sure, it does not have any logging capabilities and thus unsuitable in a large-scale environment but for keeping an eye on one or two boxes it fits the bill quite nicely.</p>
 <img src="http://www.anthonyldechiaro.com/blog/wp-content/plugins/feed-statistics.php?view=1&post_id=272" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.anthonyldechiaro.com/blog/archives/272/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Postfix Authenticated SMTP Relayhost</title>
		<link>http://www.anthonyldechiaro.com/blog/archives/71</link>
		<comments>http://www.anthonyldechiaro.com/blog/archives/71#comments</comments>
		<pubDate>Fri, 17 Oct 2008 12:43:15 +0000</pubDate>
		<dc:creator>Anthony</dc:creator>
				<category><![CDATA[admin]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[relaying]]></category>
		<category><![CDATA[smtp]]></category>

		<guid isPermaLink="false">http://www.anthonyldechiaro.com/blog/?p=71</guid>
		<description><![CDATA[Setting up a authenticated SMTP relayhost with Postfix on Ubuntu.]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">This question stumped me for awhile several years back, at the time I was working from home and my ISP would block SMTP relaying to any host other then their own (as most typically do).  I already had a free <a href="http://www.dyndns.com/services/dns/dyndns/" target="_blank">Dynamic DNS</a> account with DynDNS  and decided to add their inexpensive <a href="http://www.dyndns.com/services/mailhop/outbound.html">Mailhop Outbound</a> service which worked great and solved all my problems for a whole $15/year<strong>*</strong>.  Thinking about it more I figured it would be make sense to utilize it further and have my Linux server relay any emails to my cellphone/Blackberry, especially any mdadm monitoring alerts for my RAID-5 array.  However I was having difficulting locating quality documentation configuring relayhost SMTP authentication in sendmail.  It&#8217;s a simple setup now with Postfix (and probably sendmail too), but at the time I was running Fedora Core and just switched to the brand-new Warty release (I wasn&#8217;t kidding when I said some time ago).</p>
<p style="text-align: left;">Here are some basic configuration steps.  We will be using <span style="text-decoration: underline;">mail.myrelayhost.com</span> and testing delivery to <span style="text-decoration: underline;">bob@aol.com</span> as an example.  I have not tested this with DynDNS relaying in some time now but I see no reason that would prevent it from working if you use their service.  <strong><span style="text-decoration: underline;">Note</span></strong>: These commands must be run with root permissions via sudo.</p>
<p style="text-align: left;"><span id="more-71"></span></p>
<p style="text-align: left;"><strong><span style="text-decoration: underline;">Configuration</span></strong></p>
<ol>
<li>Setup a password maps file <span style="text-decoration: underline;">/etc/postfix/sasl_passwd</span> with the following:
<pre>mail.myrelayhost.com    username:password</pre>
</li>
<li>Secure it with the following:
<pre>chown root:root /etc/postfix/sasl_passwd
chmod 600 /etc/postfix/sasl_passwd
postmap /etc/postfix/sasl_passwd</pre>
</li>
<li>Edit <span style="text-decoration: underline;">/etc/postfix/main.cf</span>, adding/or editing the following:
<pre>relayhost = mail.myrelayhost.com:port
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd</pre>
<p>You can also edit <span style="text-decoration: underline;">/etc/mailname</span> to change the domain/hostname outbound emails appeared to be delivered from (assuming main.cf has an entry &#8220;myorigin = /etc/mailname&#8221; which should be there by default)</li>
<li>Reload postfix: [ postfix reload ]</li>
<li>SASL libraries may need to be installed.  On my Hardy machines, I have the following packages installed:
<pre>root@eternal:~# dpkg -l *sasl* | grep -G '^ii'
ii  libgsasl7                                 0.2.21-1                            GNU SASL library
ii  libsasl2-2                                2.1.22.dfsg1-18ubuntu2              Cyrus SASL - authentication abstraction libr
ii  libsasl2-modules                          2.1.22.dfsg1-18ubuntu2              Cyrus SASL - pluggable authentication module</pre>
</li>
<li><strong>Optional:</strong> Since we are going this far it makes sense to configure <span style="text-decoration: underline;">/etc/aliases</span> as well.  This will allow us to forward the mail delivered to a local user to an external address instead:
<pre>root@eternal:~# cat /etc/aliases
# Added by installer for initial user
root:   rigel@mydomain.net
adechiaro:  adechiaro@mydomain.net</pre>
</li>
</ol>
<p><span style="text-decoration: underline;"><strong>Testing/Debugging Steps</strong></span></p>
<ol>
<li>Check to see if Postfix recognizes your password maps (should return your username/password):
<pre>postmap -q mail.myrelayhost.com /etc/postfix/sasl_passwd</pre>
</li>
<li style="text-align: justify;">Do a basic outbound email delivery test to a working email account:
<pre>echo "relaying works!" | mailx bob@aol.com</pre>
<p>Check /var/log/mail.log (or similar) to see if the message was delivered correctly:</p>
<pre>Oct 18 13:01:04 eternal postfix/pickup[6410]: A88AF25E79: uid=1000 from=&lt;anthony&gt;
Oct 18 13:01:04 eternal postfix/cleanup[6507]: A88AF25E79: message-id=&lt;20081025170104.A88AF25E79@eternal&gt;
Oct 18 13:01:04 eternal postfix/qmgr[6411]: A88AF25E79: from=&lt;anthony@eternal&gt;, size=397, nrcpt=1 (queue active)
Oct 18 13:01:05 eternal postfix/smtp[6521]: A88AF25E79: to=&lt;bob@aol.com&gt;, relay=myrelayhost.com[208.67.217.132]:25, delay=0.55, delays=0.03/0.01/0.22/0.29, dsn=2.0.0, status=sent (250 OK id=1KtmVL-0000ol-RU)
Oct 18 13:01:05 eternal postfix/qmgr[6411]: A88AF25E79: removed</pre>
</li>
<li style="text-align: justify;">If getting SASL authentication errors, check your postfix options (either postconf command or main.cf file).  By default Postfix will not send cleartext passwords.  If your host only allows PLAIN or LOGIN methods, you will need to remove noplaintext from the SASL security options:
<pre>postconf -e smtp_sasl_security_options=noanonymous
postfix reload</pre>
</li>
<li>If you are using GMail SMTP (or other large-scale host which uses load balancing) I&#8217;ve read the following might be necessary:
<pre>postconf -e smtp_cname_overrides_servername=no</pre>
<p style="text-align: justify;">If this resolves the problem, it&#8217;s due to the fact the server you specify in sasl_passwd might actually get delivered to a server with a different hostname.  Port 587 may be necessary for GMail as well.</p>
</li>
</ol>
<h6><strong><strong>*No affiliation with DynDNS, except for being a satified customer</strong></strong></h6>
<p><span style="text-decoration: underline;"><strong>Update (Nov 02):</strong></span> I also found an application called ssmtp which does a similar thing, it may be easier to configure and use although I have no experience with it.  You can see how to configure it <a title="how to configure ssmtp" href="http://tombuntu.com/index.php/2008/10/21/sending-email-from-your-system-with-ssmtp/">here</a>.<strong> </strong></p>
<p><span style="text-decoration: underline;"><strong>Update 2 (Nov 12):</strong></span> Just recently saw an <a href="http://ubuntu-tutorials.com/2008/11/11/relaying-postfix-smtp-via-smtpgmailcom/" target="_blank">article</a> from my ubuntu-tutorials.com RSS feed on SMTP relaying with Postfix through GMail.</p>
 <img src="http://www.anthonyldechiaro.com/blog/wp-content/plugins/feed-statistics.php?view=1&post_id=71" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.anthonyldechiaro.com/blog/archives/71/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
