<?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>Racker Hacker &#187; email</title>
	<atom:link href="http://rackerhacker.com/tag/email/feed/" rel="self" type="application/rss+xml" />
	<link>http://rackerhacker.com</link>
	<description>Words of wisdom from a server administrator</description>
	<lastBuildDate>Wed, 16 May 2012 12:55:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Receive e-mail reports for SELinux AVC denials</title>
		<link>http://rackerhacker.com/2011/09/15/receive-e-mail-reports-for-selinux-avc-denials/</link>
		<comments>http://rackerhacker.com/2011/09/15/receive-e-mail-reports-for-selinux-avc-denials/#comments</comments>
		<pubDate>Fri, 16 Sep 2011 04:17:04 +0000</pubDate>
		<dc:creator>Major Hayden</dc:creator>
				<category><![CDATA[Blog Posts]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[messagebus]]></category>
		<category><![CDATA[red hat]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[selinux]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[systemd]]></category>
		<category><![CDATA[yum]]></category>

		<guid isPermaLink="false">http://rackerhacker.com/?p=2537</guid>
		<description><![CDATA[SELinux isn't a technology that's easy to tackle for newcomers. However, there's been a lot of work to smooth out the rough edges while still keeping a tight grip on what applications and users are allowed to do on a Linux system. One of the biggest efforts has been around setroubleshoot. The purpose behind setroubleshoot [...]<p><a href="http://rackerhacker.com/2011/09/15/receive-e-mail-reports-for-selinux-avc-denials/">Receive e-mail reports for SELinux AVC denials</a> is a post from: Major Hayden's <a href="http://rackerhacker.com">Racker Hacker</a> blog. 
<p>Thanks for following the blog via the RSS feed. Please don't copy my posts or quote portions of them without attribution.</p></p>
]]></description>
			<content:encoded><![CDATA[<p>SELinux isn't a technology that's easy to tackle for newcomers.  However, there's been a lot of work to smooth out the rough edges while still keeping a tight grip on what applications and users are allowed to do on a Linux system.  One of the biggest efforts has been around <a href="https://fedorahosted.org/setroubleshoot/wiki/SETroubleShoot%20Overview">setroubleshoot</a>.</p>
<p>The purpose behind setroubleshoot is to let users know when access has been denied, help them resolve it if necessary, and to reduce overall frustration while working through tight security restrictions in the default SELinux policies.  The GUI frontend for setroubleshoot is great for users who run Linux desktops or those who run servers with a display attached.  Don't worry, you can configure setroubleshoot on remote servers to send alerts elsewhere when a GUI alert isn't an option.</p>
<p>Install a few packages to get started:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">yum install setroubleshoot{-server,-plugins,-doc}</pre></div></div>

<p>Open <code>/etc/setroubleshoot/setroubleshoot.conf</code> in your favorite text editor and adjust the <code>[email]</code> section to fit your server:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">recipients_filepath = /var/lib/setroubleshoot/email_alert_recipients
smtp_port = 25
smtp_host = localhost
from_address = selinux@myserver.com
subject = [MyServer] SELinux AVC Alert</pre></div></div>

<p>You could probably see it coming, but you need to put the e-mail addresses for your recipients into <code>/var/lib/setroubleshoot/email_alert_recipients</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">echo &quot;selinux@mycompany.com&quot; &gt;&gt; /var/lib/setroubleshoot/email_alert_recipients</pre></div></div>

<p>You'll notice that setroubleshoot doesn't have an init script and it doesn't exist in systemd in Fedora 15.  It runs through the <a href="http://en.wikipedia.org/wiki/D-Bus">dbus-daemon</a> and a quick bounce of the messagebus via its init script brings in the necessary components to run setroubleshoot:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">service messagebus restart</pre></div></div>

<p>A really easy (and safe) test is to ask sshd to bind to a non-standard port.  Simply define an additional port on in your <code>/etc/ssh/sshd_config</code> like this:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">Port 22
Port 222</pre></div></div>

<p>When you restart sshd, it will bind to port 22 with success, but it won't be allowed to bind to port 222 (since that's blocked by SELinux as a non-standard port for the <code>ssh_port_t</code> port type).  <strong>DON'T WORRY!</strong> Your sshd server will still be listening on port 22.  If you wait a moment, you'll get an e-mail (perhaps two) that not only notify you of the denial, but they make suggestions for how to fix it:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">SELinux is preventing /usr/sbin/sshd from name_bind access on the tcp_socket port 222.
&nbsp;
*****  Plugin bind_ports (99.5 confidence) suggests  *************************
&nbsp;
If you want to allow /usr/sbin/sshd to bind to network port 222
Then you need to modify the port type.
Do
# semanage port -a -t PORT_TYPE -p tcp 222
   where PORT_TYPE is one of the following: ...</pre></div></div>

<p>For this particular example, the quick fix would be to run:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">semanage port -a -t ssh_port_t -p tcp 222</pre></div></div>

<hr />
<em><br />
Much of this post's information was gathered from the detailed documentation on <a href="http://fedoraproject.org/wiki/Docs/Drafts/SELinux/SETroubleShoot/UserFAQ">Fedora's setroubleshoot User's FAQ</a> as well as <a href="http://danwalsh.livejournal.com/20931.html">Dan Walsh's setroubleshoot blog post</a>.<br />
</em></p>
<p><a href="http://rackerhacker.com/2011/09/15/receive-e-mail-reports-for-selinux-avc-denials/">Receive e-mail reports for SELinux AVC denials</a> is a post from: Major Hayden's <a href="http://rackerhacker.com">Racker Hacker</a> blog. 
<p>Thanks for following the blog via the RSS feed. Please don't copy my posts or quote portions of them without attribution.</p></p>
]]></content:encoded>
			<wfw:commentRss>http://rackerhacker.com/2011/09/15/receive-e-mail-reports-for-selinux-avc-denials/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Sending binary e-mail attachments from the command line with mutt</title>
		<link>http://rackerhacker.com/2011/01/10/sending-binary-e-mail-attachments-from-the-command-line-with-mutt/</link>
		<comments>http://rackerhacker.com/2011/01/10/sending-binary-e-mail-attachments-from-the-command-line-with-mutt/#comments</comments>
		<pubDate>Tue, 11 Jan 2011 01:10:58 +0000</pubDate>
		<dc:creator>Major Hayden</dc:creator>
				<category><![CDATA[Blog Posts]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[mutt]]></category>

		<guid isPermaLink="false">http://rackerhacker.com/?p=2098</guid>
		<description><![CDATA[E-mailing a binary e-mail attachment from a Linux server has always been difficult for me because I never found a reliable method to get it done. I've used uuencode to pipe data into mail on various systems but the attachment is often unreadable by many e-mail clients. Someone finally showed me a simple, fool-proof method [...]<p><a href="http://rackerhacker.com/2011/01/10/sending-binary-e-mail-attachments-from-the-command-line-with-mutt/">Sending binary e-mail attachments from the command line with mutt</a> is a post from: Major Hayden's <a href="http://rackerhacker.com">Racker Hacker</a> blog. 
<p>Thanks for following the blog via the RSS feed. Please don't copy my posts or quote portions of them without attribution.</p></p>
]]></description>
			<content:encoded><![CDATA[<p>E-mailing a binary e-mail attachment from a Linux server has always been difficult for me because I never found a reliable method to get it done.  I've used <code>uuencode</code> to pipe data into <code>mail</code> on various systems but the attachment is often unreadable by many e-mail clients.</p>
<p>Someone finally showed me a simple, fool-proof method to send binary attachments reliably from various Linux systems:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">echo &quot;Cheeseburger&quot; | mutt -s &quot;OHAI!&quot; -a lolcat.jpg -- recipient@domain.com</pre></div></div>

<p>If you e-mail doesn't arrive, remember to consider the size of the file that you're sending and the restrictions of the receiver's e-mail server.  Keep in mind that encoding the binary attachment will cause the size of the e-mail to creep up a bit more (about 1.37x plus a little extra with <a href="http://en.wikipedia.org/wiki/Base64#MIME">Base64</a>).</p>
<p><a href="http://rackerhacker.com/2011/01/10/sending-binary-e-mail-attachments-from-the-command-line-with-mutt/">Sending binary e-mail attachments from the command line with mutt</a> is a post from: Major Hayden's <a href="http://rackerhacker.com">Racker Hacker</a> blog. 
<p>Thanks for following the blog via the RSS feed. Please don't copy my posts or quote portions of them without attribution.</p></p>
]]></content:encoded>
			<wfw:commentRss>http://rackerhacker.com/2011/01/10/sending-binary-e-mail-attachments-from-the-command-line-with-mutt/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Deleting all e-mail messages in your inbox with mutt</title>
		<link>http://rackerhacker.com/2009/06/19/deleting-all-e-mail-messages-in-your-inbox-with-mutt/</link>
		<comments>http://rackerhacker.com/2009/06/19/deleting-all-e-mail-messages-in-your-inbox-with-mutt/#comments</comments>
		<pubDate>Fri, 19 Jun 2009 17:37:58 +0000</pubDate>
		<dc:creator>Major Hayden</dc:creator>
				<category><![CDATA[Blog Posts]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[imap]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[mutt]]></category>

		<guid isPermaLink="false">http://rackerhacker.com/?p=934</guid>
		<description><![CDATA[Occasionally, I'll end up with a mailbox full of random data, alerts, or other useless things. If you have SSH access to the server, you can always clear out your mail spool, but if you connect to an IMAP server, you can use mutt to do the same thing. First, use mutt to connect to [...]<p><a href="http://rackerhacker.com/2009/06/19/deleting-all-e-mail-messages-in-your-inbox-with-mutt/">Deleting all e-mail messages in your inbox with mutt</a> is a post from: Major Hayden's <a href="http://rackerhacker.com">Racker Hacker</a> blog. 
<p>Thanks for following the blog via the RSS feed. Please don't copy my posts or quote portions of them without attribution.</p></p>
]]></description>
			<content:encoded><![CDATA[<p>Occasionally, I'll end up with a mailbox full of random data, alerts, or other useless things.  If you have SSH access to the server, you can always clear out your mail spool, but if you connect to an IMAP server, you can use mutt to do the same thing.</p>
<p>First, use mutt to connect to your server remotely (via IMAP over SSL in this example):</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">mutt -f imaps://mail.yourdomain.com/</pre></div></div>

<p>Once you've connected and logged in, press <strong>SHIFT-D</strong> (uppercase d).  The status bar of mutt should show:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">Delete messages matching:</pre></div></div>

<p>Type in <code>~s .*</code> so that the line looks like:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">Delete messages matching: ~s .*</pre></div></div>

<p>When you press enter, mutt will put a <strong>D</strong> next to all of the messages, which marks them for deletion.  Press <code>q</code> to quit, and then <code>y</code> to confirm the deletion.  After a brief moment, all of those messages will be deleted and mutt will exit.</p>
<p><b>Update:</b> If you review Dmitri's comment below, there's an even faster way to remove all of the messages in a mailbox with mutt.  Just hold shift while pressing D, ~ (tilde), and A to select everything:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">D~A</pre></div></div>

<p><a href="http://rackerhacker.com/2009/06/19/deleting-all-e-mail-messages-in-your-inbox-with-mutt/">Deleting all e-mail messages in your inbox with mutt</a> is a post from: Major Hayden's <a href="http://rackerhacker.com">Racker Hacker</a> blog. 
<p>Thanks for following the blog via the RSS feed. Please don't copy my posts or quote portions of them without attribution.</p></p>
]]></content:encoded>
			<wfw:commentRss>http://rackerhacker.com/2009/06/19/deleting-all-e-mail-messages-in-your-inbox-with-mutt/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

