<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><!-- generator="wordpress/2.2.1" --><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>FriedCPU</title>
	<link>http://www.friedcpu.net</link>
	<description>The golden age of Technology... in OUR hands?</description>
	<pubDate>Wed, 25 Feb 2009 19:39:32 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.1</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/friedcpumain" /><feedburner:info uri="friedcpumain" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
		<title>twssbot: An intelligent adapting That’s What She Said joke detector</title>
		<link>http://feedproxy.google.com/~r/friedcpumain/~3/3KfLdBF-mQk/</link>
		<comments>http://www.friedcpu.net/?p=71#comments</comments>
		<pubDate>Wed, 25 Feb 2009 19:37:41 +0000</pubDate>
		<dc:creator>jdong</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.friedcpu.net/?p=71</guid>
		<description><![CDATA[So one of the basic things they hammer you with in a discrete math or statistics course is Bayesian Inference. Now if you are a bored student, you have probably wondered how the heck you can put this stuff to use. Sure &#8220;your spam filter uses it blah blah&#8221; but if your inbox looks like [...]]]></description>
			<content:encoded><![CDATA[<p>So one of the basic things they hammer you with in a discrete math or statistics course is <a href="http://en.wikipedia.org/wiki/Naive_Bayesian_classification">Bayesian Inference</a>. Now if you are a bored student, you have probably wondered how the heck you can put this stuff to use. Sure &#8220;your spam filter uses it blah blah&#8221; but if your inbox looks like mine, you probably don&#8217;t like your spam filter too much.</p>
<p>But if you&#8217;re a The Office fan <strong>AND</strong> a bored student, now we&#8217;re cooking. In a lot of the IRC channels I hang around in, That&#8217;s What She Said (twss) jokes are extremely common. In fact, I even have a /twss alias for making them. So&#8230; I wonder, can I make a bot that recognizes innuendos? After 2 hours of Python coding, the results speak for themselves:</p>
<p><code><br />
14:10 &lt; jdong_&gt; blah blah this isn't funny at all<br />
14:11 &lt; jdong_&gt; I hope you aren't coming in here<br />
14:11 &lt; twssbot&gt; jdong_: That's what she said!<br />
14:11 &lt; jdong_&gt; can you make it straighter?<br />
14:11 &lt; jdong_&gt; That's what she said!<br />
14:11 &lt; twssbot&gt; Autolearning (cancel: 'twssbot: wrong'): can you make it<br />
straighter?<br />
14:12 &lt; jdong_&gt; this is easier to train than I thought<br />
14:12 &lt; jdong_&gt; It just comes naturally<br />
14:12 &lt; twssbot&gt; jdong_: That's what she said!<br />
</code></p>
<p>It still needs some training but already it&#8217;s showing great promise. You can play with it (twss) in <strong>##friedcpu on irc.freenode.net. </strong>Its source is more or less available at <a href="http://jdong.mit.edu/~jdong/pytwss/">bzr branch http://jdong.mit.edu/~jdong/pytwss/</a>. Being a quick hackjob, don&#8217;t expect the code to be that clean or setup to be that intuitive. Sorry.</p>
<p><strong>UPDATE:</strong> I was asked if this is how MIT students spend their free time. Well I can&#8217;t speak on their behalf, but&#8230; probably?</p>
<h2>How does it work</h2>
<p>I won&#8217;t cover how Bayesian classification works, as I trust if you remotely care you would have read the Wikipedia page. As it applies to the bot, it was given examples of &#8220;that&#8217;s what she said&#8221; jokes, and examples of ordinary nonsuggestive sentences as a starting point. Ok, fine, admittedly its initial examples were just the line before someone said TWSS in an IRC channel I log (which was 60MB last year&#8230;), so I expect 50% of that to be random noise.</p>
<p>In addition, the bot can:</p>
<ol>
<li>Be commanded to learn a phrase as an innuendo or a normal sentence through a direct command</li>
<li>Be given feedback (yes or no) by others after it made a joke, so it train itself based on feedback.</li>
<li>Detect when someone in the channel says TWSS, and tries to find and learn the joke made.</li>
</ol>
<p>With these capabilities, I expect it to be able to train and adapt and become better as people correct it more.</p>
<h2> Command Reference</h2>
<p>The bot has a pretty crappy command set that gets the job done. I will attempt to document it here. All commands <strong>MUST</strong> be directed at the bot using <strong>twssbot: command parameters</strong>.</p>
<ul>
<li><strong>twssbot: learn this is long and hard</strong> &#8211;Train the bot that &#8220;this is long and hard&#8221; is an innuendo.</li>
<li><strong>twssbot: forget this is not funny</strong> &#8212; Train the bot that &#8220;this is not funny&#8221; is NOT an innuendo.</li>
<li><strong>twssbot: yes</strong> &#8212; If the bot recently said TWSS, reinforce that the joke it last made was funny.</li>
<li><strong>twssbot: no</strong> &#8212; Opposite of above. Tells the bot the last joke it made was not funny.</li>
<li><strong>twssbot: query some funny sentence</strong> &#8212; Dumps some debugging info about &#8220;some funny sentence&#8221; as a dictionary of conditional probabilities. For example, its reply {&#8217;twss&#8217;: 0.39338996689047478, &#8216;normal&#8217;: 0.7999888342822} tells you that it is 40% confident it is an innuendo and 80% confident it is a normal sentence.</li>
<li>(not a command): Saying &#8220;That&#8217;s what she said&#8221;,&#8221;That&#8217;s what he said&#8221;, &#8220;twss!&#8221;, &#8220;twhs!&#8221;, &#8220;(twhs)&#8221;, &#8220;(twss)&#8221; in a channel causes the bot to take a best guess at the sentence someone found funny. The bot will then tell the channel it is auto-learning that expression.
<ul>
<li>If the trigger phrase was prefixed with a nick (i.e. &#8220;jdong: twss!&#8221;), the bot will ONLY consider things said by the nickname above</li>
<li>If it finds no candidate phrases it will tell the channel it didn&#8217;t get the joke. You should probably manually train it with the <strong>learn</strong> command.</li>
</ul>
</li>
<li><strong>twssbot: wrong</strong> &#8212; Tells the bot that its auto-learn guess (see above) is NOT correct; this rolls back the training above.</li>
</ul>
<p>In addition to commands, the bot also has some tunable parameters:</p>
<ul>
<li><strong>twssbot: threshold 25</strong> &#8212; Sets a confidence-margin percentage between 11 and 49 for triggering. In this example, the bot must be <strong>25% MORE</strong> confident that a sentence is an innuendo than a normal sentence for it to trigger. If you don&#8217;t give a number, it will return the current threshold. Increase this number to reduce false alarms, decrease it for comic relief.</li>
<li><strong>twssbot: trigger_length 3</strong> &#8212; Sets the minimum length (in words) of a line for it to be processed. Sometimes really short statements (a word or two) set off the bot even though it is not suggestive.</li>
</ul>
<h2>Practical Uses</h2>
<p>This bot is silly, pointless, though entertaining. However, I think this same framework for Bayesian classification is really easy to use (see Reverend library link in acknowledgments) and can be  applied in a variety of daily uses:</p>
<ul>
<li>Detecting the language of an article</li>
<li> Detect if something said is on-topic or off-topic for a channel</li>
<li>Label incoming e-mails or RSS feeds</li>
<li>In IRC, detect trolling users or unusual behavior patterns</li>
<li>Making a That&#8217;s What He Said bot (kidding!)</li>
</ul>
<h2>Acknowledgements</h2>
<p>I&#8217;d like to thank the authors of the <a href="http://divmod.org/trac/wiki/DivmodReverend">Reverend</a> library, without whom it would have taken me several more hours to write a (crappier) Bayesian inference library. I&#8217;d also like to thank <a href="http://code.google.com/p/pyircalib/">pyircalib</a> for making such an easy to use IRC library. Both of these were ridiculosuly simple to set up and if you ever want to use Bayesian classifiers or a simple python IRC app, I highly recommend these!</p>
<img src="http://feeds.feedburner.com/~r/friedcpumain/~4/3KfLdBF-mQk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.friedcpu.net/?feed=rss2&amp;p=71</wfw:commentRss>
		<feedburner:origLink>http://www.friedcpu.net/?p=71</feedburner:origLink></item>
		<item>
		<title>Advanced Linux Security Part 1: AppArmor Intro</title>
		<link>http://feedproxy.google.com/~r/friedcpumain/~3/FXwUvxKdz3w/</link>
		<comments>http://www.friedcpu.net/?p=70#comments</comments>
		<pubDate>Fri, 05 Dec 2008 16:52:55 +0000</pubDate>
		<dc:creator>jdong</dc:creator>
		
		<category><![CDATA[Ubuntu]]></category>

		<category><![CDATA[Linux]]></category>

		<category><![CDATA[John's Rants]]></category>

		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.friedcpu.net/?p=70</guid>
		<description><![CDATA[In light of recent &#8220;OS X needs Antivirus&#8221; controversy, I&#8217;ve been trying to get across the point that there&#8217;s more effective measures than AV software for reducing attack vectors to your system. After a bit of arguing back and forth on various discussion boards about this, it seemed apparent that a lot of people who [...]]]></description>
			<content:encoded><![CDATA[<p>In light of recent &#8220;OS X needs Antivirus&#8221; controversy, I&#8217;ve been trying to get across the point that there&#8217;s more effective measures than AV software for reducing attack vectors to your system. After a bit of arguing back and forth on various discussion boards about this, it seemed apparent that a lot of people who care about security aren&#8217;t aware of such technologies, so I am going to write a 4-part tutorial series on various ways you can secure Linux against attacks.</p>
<p>This first part is an introduction to the big-picture idea of what we are trying to do. I&#8217;ll explain in simple terms the problem with traditional privilege models used in most OS&#8217;es today, along with a solution. I will then close off with a simple real-world example to show how simple this can be in practice.</p>
<h2>The Problem</h2>
<p>Exactly what threat are we up against? Well, allow me to describe <a href="http://www.videolan.org/security/sa0811.html" title="VLC buffer overflow" target="_blank">a recent real-world example</a> that has happened too many times in the past:</p>
<p>VLC media player contains an unchecked buffer which allowed an attacker to craft a malicious video file. An attacker sends the victim a video file. The user opens it up and the video file exploits this hole in VLC to read the user&#8217;s SSH private key and send it to the attacker. With this in hand, the attacker is able to log into many of the victim&#8217;s SSH machines.</p>
<h2>What is wrong with this picture?</h2>
<p>The astute reader should be asking in outrage:<strong> </strong><em>What the <strong>HELL</strong> is VLC media player doing reading private SSH keys? <strong>How could the operating system allow this to happen?</strong></em> Well, let&#8217;s use UNIX 101 to see why. This is what VLC looks like running on my system:</p>
<p>jdong     7603  3.0  0.5 378660 23040 pts/1    Sl+  09:24   0:00 vlc</p>
<p>The first column says that I, jdong, own the VLC process. What do the permissions on my SSH key say?</p>
<p>-rw&#8212;&#8212;- 1 jdong jdong 1264 2007-10-01 12:50 /home/jdong/.ssh/id_dsa</p>
<p>Again, I own my SSH key. Note the tight  -rw&#8212;&#8212;- permissions that are required and default on a SSH key: only the owner is allowed to have any access to it. Let&#8217;s read that again:  only the <strong>owner</strong> is allowed to have any access to it. But, VLC&#8217;s process is owned by me, jdong, the same person as the SSH key. The OS puts 2 and 2 together and says that VLC has access to my SSH key.</p>
<p>What this example shows is that the UNIX permissions scheme is not fine-grained enough to allow me to specify the <strong>minimum</strong> amount of access VLC has to my system. Ideally, I&#8217;d like to tell VLC it can read my <em>Videos</em> directory, but NOT my <em>Documents/Tax Forms</em> directory</p>
<h2>The Solution: AntiVirus edition</h2>
<p>What is the AV solution to this problem? Write an AV signature to recognize the malicious video file that caused this exploit. While that sounds good in theory, it should be clear to see why this idea is <strong>ridiculous</strong>. Do we stop terrorists by compiling a big list of pictures of known terrorists, distribute the list to the TSA and if a person at the security checkpoint doesn&#8217;t look like anyone in the list, he&#8217;s not a terrorist? Ok fine, we do, but <strong>how well is THAT working out</strong>?</p>
<p>While this approach can be useful for blacklisting individual types of exploits, what if tomorrow a different hole is found in VLC? You&#8217;d have no protection against that exploit until your AV vendor figures out.</p>
<h2>The Solution: AppArmor Edition:</h2>
<p>The solution I&#8217;d like to propose is to be able to define finer grained permissions that I hinted to earlier. I want to tell Linux: <strong>VLC Media Player can access ~/Videos and its own data. It can write to its preferences directory. It CANNOT touch anything else, launch any other processes, su to root, etc.</strong> A rule like this would universally stop a wide class of exploits against VLC.</p>
<h2>Quick Intro to AppArmor:</h2>
<p>I&#8217;ve used the name of the product but I haven&#8217;t really said what it is. <a href="http://en.wikipedia.org/wiki/Apparmor" title="Wikipedia article" target="_blank">AppArmor</a> is known as a <em>Mandatory Access Control</em> mechanism for Linux. What that means is basically it allows you to specify finer grained permissions on stuff running on your system than the traditional ownership-permissions model. It is Open Source software, and installed by default on Ubuntu and OpenSUSE. It&#8217;s known for being relatively simple to configure for restricting a select set of at-risk services and applications.</p>
<p>AppArmor works inside the kernel based on configuration files known as <em>AppArmor Profiles</em> stored in /etc/apparmor.d. The tricky part of configuring AppArmor is writing a profile that gives the right level of access that allows your program to do its work, but not pose a security threat to the rest of your system.</p>
<h2>What about SELinux?</h2>
<p>RedHat/Fedora users are probably thinking at this point: <em>Wait a minute, isn&#8217;t that what SELinux is?</em> Yes, you&#8217;re right! <a href="http://en.wikipedia.org/wiki/SELinux">SELinux</a> is another framework that&#8217;s in the vanilla kernel and default in RedHat Enterprise Linux and Fedora which accomplishes similar goals to AppArmor. It&#8217;s much more powerful and allows even more fine-grained permissions control, and even offers other neat features like Role-Based Access Control which allows you to have a different set of permissions depending on what you&#8217;re doing at the moment. I plan to cover SELinux in detail at a later time, too.</p>
<h2>Our Example: myscript</h2>
<p>Ok, now that we know what AppArmor is, and why we&#8217;d want to use it, I figure it&#8217;s better to explain the rest in practice instead of all this hypothetical talk. Let&#8217;s try a simple example to illustrate how AppArmor can work to save our rear. Suppose I have a simple Python script called myscript<br />
<code><br />
#!/usr/bin/python<br />
import os<br />
print "Welcome to MyScript!"<br />
foo=raw_input("Please give me the name of a file to md5sum:")<br />
os.system("md5sum "+foo)<br />
</code></p>
<p>Ok, so it&#8217;s supposed to do something useful (calculate md5sums) but is poorly written. Perfect recipe for disaster! Let&#8217;s see what it does when it works:</p>
<p><code><br />
[jdong@droptop:code/myscript]$ ./myscript                         (12-05 10:12)<br />
Welcome to MyScript!<br />
Please give me the name of a file to md5sum:myscript<br />
9149480416db480c99f4f95b79fda227  myscript<br />
</code></p>
<p>Cool! It works! Or does it work TOO well:</p>
<p><code><br />
[jdong@droptop:code/myscript]$ ./myscript                         (12-05 10:16)<br />
Welcome to MyScript!<br />
Please give me the name of a file to md5sum: /dev/null;bash<br />
d41d8cd98f00b204e9800998ecf8427e  /dev/null<br />
jdong@droptop:~/code/myscript$ whoami<br />
jdong</code></p>
<p>Ahh, when <strong> foo; bar</strong> gets passed to os.system, bar is executed as if it were a separate command. Yikes, we spawned an arbitrary shell!</p>
<h2>The Solution: AV Style</h2>
<p>Luckily for me, I am the author of award-winning jdong Antivirus &#8482;, so I incorporate my advanced AV engine in myscript:</p>
<p><code><br />
#!/usr/bin/python<br />
import os</code></p>
<p>print &#8220;Welcome to MyScript!&#8221;<br />
foo=raw_input(&#8221;Please give me the name of a file to md5sum:&#8221;)<br />
if &#8220;;&#8221; in foo:<br />
print &#8220;BZZ! JDONG ANTIVIRUS FOUND MyScript.ShellEscapeExploit!&#8221;<br />
else:<br />
os.system(&#8221;md5sum &#8220;+foo)<br />
Does that work? Let&#8217;s see:</p>
<p><code><br />
[jdong@droptop:code/myscript]$ ./myscript                         (12-05 10:22)<br />
Welcome to MyScript!<br />
Please give me the name of a file to md5sum:/dev/null; bash<br />
BZZ! JDONG ANTIVIRUS FOUND MyScript.ShellEscapeExploit!</code><br />
<code><br />
[jdong@droptop:code/myscript]$ ./myscript                         (12-05 10:27)<br />
Welcome to MyScript!<br />
Please give me the name of a file to md5sum:/dev/null &amp;&amp; bash<br />
d41d8cd98f00b204e9800998ecf8427e  /dev/null<br />
fjdong@droptop:~/code/myscript$ id<br />
uid=1000(jdong) gid=1000(jdong) groups=4(adm),20(dialout),24(cdrom),44(video),46(plugdev),108(lpadmin),116(pulse-access),117(pulse-rt),123(admin),124(sambashare),127(libvirtd),1000(jdong)<br />
</code></p>
<p>Well, the typical problem with AV signature based approaches &#8212; I slightly changed my attack and the signature no longer matches. Note that myscript is doing the same thing wrong, executing bash when it shouldn&#8217;t have the ability to, but a different way. Again, an AV doesn&#8217;t care <strong>what</strong> is being done, just the exact way <strong>how</strong> it is doing it. Even worse,it gets REAL hair when I start talking about files with ; or &amp; in the filename &#8212; at some point the AV will have to trade off between false-positives and completeness of detection.</p>
<h2>The solution, AppArmor style</h2>
<p>Since this is a motivational introduction to Apparmor, I&#8217;ll just present the solution without gory details on how I did it. I&#8217;ll link to some resources for those who want to know <strong>NOW</strong> but next week&#8217;s installment will go through step-by-step a more useful example.</p>
<p>So, instead of blocking bad input, I will use an AppArmor profile to rigorously define what myscript should do. We make the following observations:</p>
<ol>
<li>MyScript uses Python. So, it probably needs access to the Python interpreter and the Python libraries.</li>
<li>MyScript executes md5sum. So, it probably needs access to /usr/bin/md5sum and perhaps /bin/sh because of the way os.system works (not intuitively obvious). It shouldn&#8217;t have to execute anything else.</li>
<li>MyScript NEVER has to write anything but to the screen.</li>
<li>Suppose MyScript is for checksumming my media collection and itself.  Hence, it should only be able to read ~/Videos and ~/code/myscript.</li>
</ol>
<p>With these rules, we can concoct an AppArmor profile, like the one I prepared. This is /etc/apparmor.d/home.jdong.code.myscript.myscript after about 10 minutes of work:</p>
<p><code><br />
# Last Modified: Fri Dec  5 10:41:50 2008<br />
#include &lt;tunables/global&gt;</code></p>
<p><code><br />
/home/jdong/code/myscript/myscript {<br />
#include &lt;abstractions/base&gt;<br />
/usr/bin/python2.5 ixmr,<br />
/home/jdong/code/myscript/* mr,<br />
/home/jdong/Videos/*/ mr,<br />
/home/jdong/Videos/** mr,<br />
/usr/share/pyshared/** mr,<br />
/usr/local/lib/python2.5/** mr,<br />
/usr/local/lib/python2.5/*/ mr,<br />
/usr/lib/python2.5/** mr,<br />
/usr/lib/python2.5/*/ mr,<br />
/var/lib/python-support/*/ mr,<br />
/var/lib/python-support/** mr,<br />
/bin/dash ixmr,<br />
/lib/* mr,<br />
/usr/bin/md5sum ixmr,<br />
/etc/python2.5/** mr,<br />
}</code></p>
<p>Now, what does it do? Let&#8217;s try our normal workflow:</p>
<p><code><br />
[jdong@droptop:code/myscript]$ ./myscript                         (12-05 10:50)<br />
Welcome to MyScript!<br />
Please give me the name of a file to md5sum:myscript<br />
9149480416db480c99f4f95b79fda227  myscript</code></p>
<p>Well, that still works. Shall we try an exploit?</p>
<p><code><br />
[jdong@droptop:code/myscript]$ ./myscript                         (12-05 10:53)<br />
Welcome to MyScript!<br />
Please give me the name of a file to md5sum:myscript; bash<br />
9149480416db480c99f4f95b79fda227  myscript<br />
sh: bash: Permission denied</code></p>
<p>What the heck? Permission denied? /bin/bash is chmodded 755, everyone can access it, right? Not according to AppArmor and dmesg:</p>
<p><code><br />
[ 7487.802336] type=1503 audit(1228492429.848:201): operation="inode_permission" requested_mask="::x" denied_mask="::x" fsuid=1000 name="/bin/bash" pid=9671 profile="/home/jdong/code/myscript/myscript"<br />
</code></p>
<p>So, AppArmor is telling us that myscript has no access to /bin/bash. Attack averted. The observant reader will ask: <em>But you allowed access to /bin/dash, can&#8217;t we still exploit that?</em> Good question, let&#8217;s try!</p>
<p><code><br />
[jdong@droptop:code/myscript]$ ./myscript                         (12-05 10:54)<br />
Welcome to MyScript!<br />
Please give me the name of a file to md5sum:myscript;/bin/dash<br />
9149480416db480c99f4f95b79fda227  myscript</code><br />
<code><br />
ls<br />
^C<br />
^C^C^C^C^C^C^C^Z^Z^Z^Z^C^C<br />
</code></p>
<p>Well&#8230; that did something different. What exactly happened? Let&#8217;s ask dmesg again:</p>
<p><code><br />
[ 7651.571036] type=1503 audit(1228492593.617:202): operation="inode_permission" requested_mask="::rw" denied_mask="::rw" fsuid=1000 name="/dev/tty" pid=9712 profile="/home/jdong/code/myscript/myscript"<br />
[ 7655.969245] type=1503 audit(1228492598.017:203): operation="inode_permission" requested_mask="::x" denied_mask="::x" fsuid=1000 name="/bin/ls" pid=9714 profile="/home/jdong/code/myscript/myscript"</code></p>
<p>In English:</p>
<ul>
<li>dash was started, no error generated of course.</li>
<li>However, apparmor denied its right to open the terminal at /dev/tty to output to the screen, and accept special terminal input such as CTRL-C.</li>
<li>It did hear me say ls,  but AppArmor said it has no access to ls.</li>
</ul>
<p>Well that&#8217;s effective, but no fun! For amusement&#8217;s sake, I&#8217;ve allowed access to /dev/tty so it&#8217;s easier to see what an attacker of myscript has the access to do:</p>
<p><code><br />
[jdong@droptop:code/myscript]$ ./myscript                         (12-05 11:19)<br />
Welcome to MyScript!<br />
Please give me the name of a file to md5sum:/dev/null;/bin/dash<br />
d41d8cd98f00b204e9800998ecf8427e  /dev/null<br />
[%{%}%n%{%}@%{%}%U%m%u%{%}:%{%}%2c%{%}]%(!.#.$) export PS1="#"<br />
#ls<br />
/bin/dash: ls: Permission denied<br />
#echo foo<br />
foo<br />
#echo "foo" &gt; myscript<br />
/bin/dash: cannot create myscript: Permission denied<br />
</code></p>
<p>Well, now that we can see the shell&#8217;s output, we can see that this is really an anticlimactic end to  an exploit. From this shell, we can only run dash again or execute shell built-ins like echo or redirections. Since we don&#8217;t have write access anywhere, we can&#8217;t even overwrite myscript with redirection. Now we&#8217;re having fun, aren&#8217;t we? Let&#8217;s ramp it up: I&#8217;m going to add <strong>rmix</strong> permissions /bin/* and /usr/bin/*, which will allow us to execute the standard UNIX commands , as an ultimate demonstration of AppArmor&#8217;s power:</p>
<p><code><br />
[jdong@droptop:code/myscript]$ ./myscript                         (12-05 11:24)<br />
Welcome to MyScript!<br />
Please give me the name of a file to md5sum:/dev/null;/bin/bash<br />
d41d8cd98f00b204e9800998ecf8427e  /dev/null<br />
bash: /etc/bash.bashrc: Permission denied<br />
bash: /home/jdong/.bashrc: Permission denied<br />
&lt;2m%}%U%m%u%{%}:%{%}%2c%{%}]%(!.#.$) export PS1="$"<br />
$ $ls -al<br />
ls: cannot open directory .: Permission denied<br />
$ls -al myscript<br />
-rwxr-xr-x 1 1000 1000 235 2008-12-05 10:50 myscript<br />
$rm myscript<br />
rm: remove write-protected regular file `myscript'? y<br />
rm: cannot remove `myscript': Permission denied<br />
$echo "foo" &gt; myscript<br />
bash: myscript: Permission denied<br />
$ls /<br />
ls: cannot open directory /: Permission denied<br />
$find /<br />
/<br />
find: `/': Permission denied<br />
$ping google.com<br />
ping: unknown host google.com<br />
$wget http://localhost/<br />
wget: Cannot read /etc/wgetrc (Permission denied).<br />
--2008-12-05 11:26:27--  http://localhost/<br />
Resolving localhost... failed: Name or service not known.<br />
wget: unable to resolve host address `localhost'<br />
$wget http://127.0.0.1/<br />
wget: Cannot read /etc/wgetrc (Permission denied).<br />
--2008-12-05 11:26:35--  http://127.0.0.1/<br />
Connecting to 127.0.0.1:80... failed: Permission denied.<br />
Retrying.<br />
...<br />
$sudo<br />
sudo: uid 1000 does not exist in the passwd file!<br />
$su root<br />
$id<br />
uid=1000 gid=1000 groups=4,20,24,44,46,108,116,117,123,124,127,1000</code></p>
<p>As you can see, even with the ability to execute every command on the system, you STILL can&#8217;t do anything useful. Note that wget and ping don&#8217;t work and su seems to fail silently. dmesg is interesting for those cases:</p>
<p><code><br />
[ 9438.556736] type=1503 audit(1228494380.604:256): operation="socket_create" family="inet" sock_type="dgram" protocol=0 pid=10298 profile="/home/jdong/code/myscript/myscript"</code></p>
<p><code>[ 9453.934059] type=1503 audit(1228494395.980:263): operation="socket_create" family="inet" sock_type="stream" protocol=0 pid=10304 profile="/home/jdong/code/myscript/myscript"<br />
</code></p>
<p><code>[ 9512.316953] type=1503 audit(1228494454.364:291): operation="capable" name="setuid" pid=10317 profile="/home/jdong/code/myscript/myscript"<br />
[ 9512.316958] type=1503 audit(1228494454.364:292): operation="capable" name="setgid" pid=10317 profile="/home/jdong/code/myscript/myscript"</code></p>
<p>In English these 4 errors are showing:</p>
<ol>
<li>socket_create is a POSIX capability to create network sockets. I never granted this privilege in AppArmor to myscript, so MyScript is actually incapable of any network access period.</li>
<li>setuid and setgid are also POSIX capabilties that MyScript doesn&#8217;t have. Therefore, it can&#8217;t even use a freebie su-to-root to elevate its access.</li>
</ol>
<p>Ready to see something even cooler?</p>
<p><code><br />
[jdong@droptop:code/myscript]$ sudo ./myscript                    (12-05 11:28)<br />
Welcome to MyScript!<br />
Please give me the name of a file to md5sum:/dev/null;/bin/bash<br />
d41d8cd98f00b204e9800998ecf8427e  /dev/null<br />
bash: /etc/bash.bashrc: Permission denied<br />
bash: /home/jdong/.bashrc: Permission denied<br />
&lt;2m%}%U%m%u%{%}:%{%}%2c%{%}]%(!.#.$) export PS1="# "<br />
# ls<br />
ls: cannot open directory .: Permission denied<br />
# whoami<br />
whoami: cannot find name for user ID 0<br />
# id<br />
uid=0 gid=0 groups=0<br />
# ls -al myscript<br />
-rwxr-xr-x 1 1000 1000 235 2008-12-05 10:50 myscript<br />
# rm myscript<br />
rm: cannot remove `myscript': Permission denied<br />
# su<br />
# su jdong<br />
# id<br />
uid=0 gid=0 groups=0<br />
# ping google.com<br />
ping: unknown host google.com</code></p>
<p>Yes, you are reading that correctly: even with free root access, myscript still can&#8217;t do anything. Not even root is immune to AppArmor. And without write access to /sys, root can&#8217;t even disable AppArmor.</p>
<h2> In conclusion, and coming soon&#8230;</h2>
<p>I hope this introduction has shown why technologies such as AppArmor and SELinux can provide a robust level of protection against a wide range of threats, better than an AntiVirus program can. I hope it also shows that the general concept and process of doing so is simple. Next time, I will provide a step-by-step walkthrough of a lengthier, more useful example: Bodhi-Zazen recently posted a <a href="http://blog.bodhizazen.net/?p=14" target="_blank">HOWTO on using rbash to restrict shell users to a safe set of commands</a>. I will show how I broke free of the jail in 10 seconds and was snooping around the rest of the system, and how AppArmor can be used to robustly provide users restricted SSH access.</p>
<p>In the meantime, if you really want to get started writing some AppArmor profiles, <a href="http://en.opensuse.org/AppArmor_Geeks">OpenSuse</a> and <a href="https://help.ubuntu.com/community/AppArmor">Ubuntu</a> both have great step-by-step guides.</p>
<p>What do I protect with AppArmor? I have rigorous profiles defined for:</p>
<ul>
<li>Skype</li>
<li>Firefox</li>
<li>my fetchmail script</li>
<li>my script-rich irssi client</li>
<li>Apache</li>
<li>dnsmasq</li>
</ul>
<p>These are the services I&#8217;ve identified to be at the greatest risk on my system for this class of exploits.</p>
<img src="http://feeds.feedburner.com/~r/friedcpumain/~4/FXwUvxKdz3w" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.friedcpu.net/?feed=rss2&amp;p=70</wfw:commentRss>
		<feedburner:origLink>http://www.friedcpu.net/?p=70</feedburner:origLink></item>
		<item>
		<title>Reflections on RedHat/Fedora compromise</title>
		<link>http://feedproxy.google.com/~r/friedcpumain/~3/2ONaZ0wywJs/</link>
		<comments>http://www.friedcpu.net/?p=68#comments</comments>
		<pubDate>Sat, 23 Aug 2008 03:11:28 +0000</pubDate>
		<dc:creator>jdong</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.friedcpu.net/?p=68</guid>
		<description><![CDATA[If you&#8217;re like me, you&#8217;ve heard by now about the weeklong downtime of Fedora infrastructure and today&#8217;s formal announcement that Fedora and RedHat&#8217;s infrastructure has been breached. After reading more into the details and timeline, I think Redhat/Fedora did everything right, and what happened was simply an unfortunate incident, and the aftermath was handled well.
What [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re like me, you&#8217;ve heard by now about the weeklong downtime of Fedora infrastructure and today&#8217;s formal announcement that Fedora and RedHat&#8217;s infrastructure has been breached. After reading more into the details and timeline, I think Redhat/Fedora did everything right, and what happened was simply an unfortunate incident, and the aftermath was handled well.</p>
<p>What I wonder is how many other distros:</p>
<p>(1) Use a FIPS 140-2  hardware crypto signing key to protect key material from compromise</p>
<p>(2) Have as big  of an attacker base as Fedora/RHEL</p>
<p>(3) Would&#8217;ve caught the breach so quickly</p>
<p>(4) Would&#8217;ve restored services so quickly</p>
<p>If there&#8217;s one thing to criticize about this whole incident, it&#8217;s the lack of details from RedHat. I&#8217;d be interested in learning more about the technical details behind this attack, but I bet RedHat is planning legal action that prevents these details from coming out at the moment.</p>
<p>In any case, I&#8217;d like to just say that I&#8217;ve not lost any trust in RedHat&#8217;s information security procedures. If anything, the way this incident was detected and handled has bolstered my trust in those talented folks. Good luck to the team on restoring their services smoothly and bringing justice to the attackers.</p>
<img src="http://feeds.feedburner.com/~r/friedcpumain/~4/2ONaZ0wywJs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.friedcpu.net/?feed=rss2&amp;p=68</wfw:commentRss>
		<feedburner:origLink>http://www.friedcpu.net/?p=68</feedburner:origLink></item>
		<item>
		<title>Yes, I got an iPhone 3G…</title>
		<link>http://feedproxy.google.com/~r/friedcpumain/~3/EJ02vLlSEgE/</link>
		<comments>http://www.friedcpu.net/?p=67#comments</comments>
		<pubDate>Sun, 17 Aug 2008 21:13:49 +0000</pubDate>
		<dc:creator>jdong</dc:creator>
		
		<category><![CDATA[John's Rants]]></category>

		<guid isPermaLink="false">http://www.friedcpu.net/?p=67</guid>
		<description><![CDATA[Our family AT&#38;T contract was up for renewal and I went phone-shopping two weeks ago. Actually, my 8-year-old little sister was bugging us to get a cell phone for her (I will rant about this separately). At any rate, after looking through their selection of phones, I noticed that the ones I liked were all [...]]]></description>
			<content:encoded><![CDATA[<p>Our family AT&amp;T contract was up for renewal and I went phone-shopping two weeks ago. Actually, my 8-year-old little sister was bugging us to get a cell phone for her (I will rant about this separately). At any rate, after looking through their selection of phones, I noticed that the ones I liked were all close to the $150 mark anyway, so I might as well get an iPhone which does so much more.</p>
<p>I choose the $199 black 8GB model, which took about a week for them to order and ship to the store. It&#8217;s almost my first full week with the phone and I&#8217;d just like to talk a bit about my experience with the phone. I know everyone is sick and tired of iPhone 3G reviews so I&#8217;ll keep it short and crisp.</p>
<p> <a href="http://www.friedcpu.net/?p=67#more-67" class="more-link">(more&#8230;)</a></p>
<img src="http://feeds.feedburner.com/~r/friedcpumain/~4/EJ02vLlSEgE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.friedcpu.net/?feed=rss2&amp;p=67</wfw:commentRss>
		<feedburner:origLink>http://www.friedcpu.net/?p=67</feedburner:origLink></item>
		<item>
		<title>I’m back!</title>
		<link>http://feedproxy.google.com/~r/friedcpumain/~3/xXgLs01FRLE/</link>
		<comments>http://www.friedcpu.net/?p=66#comments</comments>
		<pubDate>Sun, 17 Aug 2008 20:03:51 +0000</pubDate>
		<dc:creator>jdong</dc:creator>
		
		<category><![CDATA[John's Rants]]></category>

		<guid isPermaLink="false">http://www.friedcpu.net/?p=66</guid>
		<description><![CDATA[Well after an eternal (in internet time) hiatus I figured it&#8217;s worth our effort to start this blog back up. We had some great content but all got distracted doing other stuff. In the coming days I&#8217;ll try to post enough flamebait to get our traffic back again  
Spoiler Alert: The next post from [...]]]></description>
			<content:encoded><![CDATA[<p>Well after an eternal (in internet time) hiatus I figured it&#8217;s worth our effort to start this blog back up. We had some great content but all got distracted doing other stuff. In the coming days I&#8217;ll try to post enough flamebait to get our traffic back again <img src='http://www.friedcpu.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Spoiler Alert: The next post from me may contain some Linux rants and Apple fanboyism. Or not.</p>
<img src="http://feeds.feedburner.com/~r/friedcpumain/~4/xXgLs01FRLE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.friedcpu.net/?feed=rss2&amp;p=66</wfw:commentRss>
		<feedburner:origLink>http://www.friedcpu.net/?p=66</feedburner:origLink></item>
		<item>
		<title>Chumby Is Very Cool, But It’s Not Perfect</title>
		<link>http://feedproxy.google.com/~r/friedcpumain/~3/LNL2QuGXDWY/</link>
		<comments>http://www.friedcpu.net/?p=65#comments</comments>
		<pubDate>Thu, 20 Mar 2008 01:51:06 +0000</pubDate>
		<dc:creator>Casey Hendley</dc:creator>
		
		<category><![CDATA[Linux]]></category>

		<category><![CDATA[FOSS]]></category>

		<category><![CDATA[Casey's Rants]]></category>

		<guid isPermaLink="false">http://www.friedcpu.net/?p=65</guid>
		<description><![CDATA[I received my Chumby yesterday and it is definitely a neat little device with a fair price tag. So when I say it&#8217;s not perfect, I mean exactly that.
According to a post on the Chumby forums by a Chumby employee, &#8220;the device has a 266MHz Freescale ARM9 with 133MHz bus, 32MB SDRAM and 64MB of [...]]]></description>
			<content:encoded><![CDATA[<p>I received my <a href="http://www.chumby.com" title="Chumby" target="_blank">Chumby</a> yesterday and it is definitely a neat little device with a fair price tag. So when I say it&#8217;s not perfect, I mean exactly that.</p>
<p>According to a post on the Chumby forums by a Chumby employee, &#8220;the device has a 266MHz Freescale ARM9 with 133MHz bus, 32MB SDRAM and 64MB of NAND Flash.&#8221; It also has two external powered USB ports and a headphone jack on the rear of the unit, along with the power connector and a power button (be careful grabbing it by the back when moving it; I&#8217;ve turned it off accidentally once). Another interesting thing to note is that the unit&#8217;s wifi is actually a USB 802.11g dongle on the <em>inside</em> of the device, which means you can replace it if need be. There is also a second powered USB port on the inside which is not in use. Lots of room for expansion on this thing.</p>
<p>The other great thing about the Chumby, before we go into my personal experience with it, is that 100% of the software running the thing is either GPLv2 or LGPLv2.</p>
<p>Inside the shipping carton was a plastic sleeve sealed with a Chumby logo sticker, and inside that was the burlap or canvas bag that contained the Chumby and all its accessories.  The entire package has a &#8220;recycled materials&#8221; feel to it, from the coarse fabric bags that contain the product to the recycled paper manual. If you&#8217;re the sort of person who uses the phrase &#8220;carbon footprint&#8221; in normal conversation, you will likely be pleased at the packaging in which the Chumby arrives.</p>
<p align="center"><a href="http://www.flickr.com/photos/elcasey1917/2346713372/" title="chumby.jpg by el.casey1917, on Flickr"><img src="http://farm4.static.flickr.com/3204/2346713372_ac01b64c2b.jpg" alt="chumby.jpg" height="375" width="500" /></a></p>
<p align="left">Being the type of person I am, I immediately discovered a velcro-sealed pouch in the bottom of the unit that contained a connector for a 9V battery, one of which I happened to have laying on my desk. The Chumby powered up right away and I set about watching the introductory video that plays on first boot. Shortly thereafter the problems set in.</p>
<p align="left">Now to be fair, I should say up front that I wasn&#8217;t thinking about some things. Like how a puny 9V battery isn&#8217;t going to power something with an LCD display for very long&#8230;and it didn&#8217;t. However, going back to my bedroom and plugging it in near the night stand that is now its permanent home, I was having a lot of trouble getting a wireless signal.</p>
<p align="left">My wireless router is probably 30&#8242; in a straight line from the Chumby and the signal has to go through one or two internal walls to reach the Chumby if my door is closed, which it usually is (roommates). It grabbed a signal and an IP address early on, but then would fail to reboot properly. Upon trying to regain connectivity, it would fail &#8212; over and over and over. I took the unit out to my work area and plugged it in so it was within a couple feet of the WAP, where it proceeded to function flawlessly (except when I had it on rapidly-draining 9V power only, when it would make awful stuttering static noises and shut down).</p>
<p align="left">Eventually I got it to grab a signal from my bedroom and it hasn&#8217;t lost it again (about 25 hours now).  So just be aware that you may experience some issues when you first get it out of the box. Not sure if it just needs burn-in time or what, but it&#8217;s run beautifully since.</p>
<p align="left">After you activate the Chumby, a process which consists of tapping the screen to replicate a pattern shown on the Chumby site, you can begin to have fun with it. There are several hundred widgets available already, including 67 clocks, and you can have multiple &#8220;channels&#8221; containing unique widgets. I currently have a &#8220;Clocks&#8221; channel with about 10 of my favorite clock designs (a bunch of BBC TV clocks from the 80s, a Nixie tube clock and some other retro stuff), a &#8220;Productivity&#8221; channel with a Google calendar applet and a mail checker, and the stock &#8220;Default&#8221; channel where I literally dump anything and everything that looks remotely interesting.</p>
<p align="left"> &#8220;Neat, it&#8217;s a $179 clock. Big deal,&#8221; I hear you saying. It&#8217;s a bit more than that. Admittedly, I don&#8217;t use the news and RSS widgets as much as most people probably will. Why not? Well I usually have my MacBook sitting right here next to me, so I prefer to read news on the Mac&#8217;s larger screen. But I&#8217;ve been able to offload 100% of my internet radio needs to the Chumby. It has a built-in SHOUTcast browser, Mediafly podcasts, &#8220;Radio Free Chumby&#8221; which has a load of FM stations that broadcast via web and you can even plug your iPod directly into one of its two USB ports and play songs from it.</p>
<p align="left">All of the widgets are Flash 7 movies, so it&#8217;s possible to author a widget with anything that can produce Flash, not just Macromedia&#8217;s proprietary (and usually Linux-hating) tools. This is good news, and I can&#8217;t congratulate the Chumby team enough for making such good choices when it came to licensing and implementation of widgets.</p>
<p align="left">The unit can be converted to use wired ethernet with very little work and at least two particular models of 10/100 dongles, a Linksys and a Trendnet, are known to work with it. You can ssh into the unit easily enough, by activating what amounts to an easter egg, as well as perform all sorts of other hacks. These are detailed <a href="http://wiki.chumby.com/mediawiki/index.php/Chumby_tricks" title="Chumby Tricks" target="_blank">on Chumby&#8217;s own wiki</a>. It runs its own webserver which can be accessed by entering its IP into a web browser, but the only content is a summary of wifi information.</p>
<p align="left">Now, to delve into some of my complaints with Chumby:</p>
<p align="left">The touch screen is a bit &#8220;meh.&#8221; It works, and it works well enough, but sometimes I find myself having to press a button five or six times before it finally registers, and this occurs whether I use my thumb or my forefinger, pad or fingernail. This seems to be exacerbated when I&#8217;m laying down (start using one, you&#8217;ll see what I mean) but sometimes even if I&#8217;m sitting up and holding it directly in front of me it still gets iffy. It works for the most part and you can recalibrate the touchscreen as and when necessary.</p>
<p align="left">Centralized widget control is the other issue. All widgets for general consumption have to be approved by Chumby and placed on the Chumby Network. This isn&#8217;t so bad, but it smacks of Apple&#8217;s &#8220;all your iPhone applications are belong to us&#8221; nonsense they tried to pull (looks like they can&#8217;t really enforce this, however, which is good news). I like quality control, but I like choice, too.</p>
<p align="left">&#8220;Seeing extra widgets<span style="color: #094fa6; font-weight: bold"></span> on your chumby that aren&#8217;t shown in your channel above? These are added by Chumby Industries and content partners. Sharing these promotional widgets with you is how the Chumby Network stays FREE.&#8221;  That was a message that gave me some cause for concern. I understand that bandwidth isn&#8217;t free, but I <em>did </em>pay $180 for this thing. Having seen some of these nefarious widgets, I have to say that they&#8217;re really not so bad. The ad content disappears in under 30 seconds and you&#8217;re not forced to watch the advertisment videos&#8230;this is a good compromise and I&#8217;m certainly not begrudging Chumby Industries their meal ticket.</p>
<p align="left">As you can see, my complaints with the device are minor. I was pleasantly surprised by how little about the thing irked me at all. Instead of having to grumble about ads, centralized control and a flaky touchscreen, I&#8217;ve just been enjoying the hell out of it instead. I think you will, too, if you get one. The only way to really experience it is to use one. I&#8217;m glad I bought mine. (4.5/5 rating)</p>
<p align="left">You can find <a href="http://www.youtube.com/results?search_query=chumby&amp;search_type=" title="Chumby Vids on YouTube">a bunch of videos</a> of Chumby unboxings and other things that are probably way better than the one I tried to shoot on, where else, YouTube.</p>
<img src="http://feeds.feedburner.com/~r/friedcpumain/~4/LNL2QuGXDWY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.friedcpu.net/?feed=rss2&amp;p=65</wfw:commentRss>
		<feedburner:origLink>http://www.friedcpu.net/?p=65</feedburner:origLink></item>
		<item>
		<title>xclip - Use the Clipboard From the Command Line</title>
		<link>http://feedproxy.google.com/~r/friedcpumain/~3/wkXz3lXVOwM/</link>
		<comments>http://www.friedcpu.net/?p=64#comments</comments>
		<pubDate>Tue, 12 Feb 2008 06:19:16 +0000</pubDate>
		<dc:creator>Casey Hendley</dc:creator>
		
		<category><![CDATA[CLI]]></category>

		<category><![CDATA[Linux]]></category>

		<category><![CDATA[FOSS]]></category>

		<category><![CDATA[Casey's Rants]]></category>

		<guid isPermaLink="false">http://www.friedcpu.net/?p=64</guid>
		<description><![CDATA[Yesterday morning I had a bit of a strange question (so I thought), although it turned out to be a good one. &#8220;Is there any way to pipe or redirect output from the console to the clipboard?&#8221; I asked my good pal jdong if there was indeed a way to do this. He quickly turned [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday morning I had a bit of a strange question (so I thought), although it turned out to be a good one. &#8220;Is there any way to pipe or redirect output from the console to the clipboard?&#8221; I asked my good pal <a href="https://launchpad.net/~jdong" title="John Dong in Launchpad" target="_blank">jdong</a> if there was indeed a way to do this. He quickly turned me onto <a href="http://www.debian-administration.org/articles/565" title="Debian xclip" target="_blank">this Debian page </a>where I discovered a neat little application called <em>xclip</em>.</p>
<p>You can read the nuts and bolts of its usage on the Debian page, but it&#8217;s quite easy. I&#8217;ll use an example based on what I originally wanted it for (being able to paste file listings of various directories into a pastebin or document):</p>
<p><code>ls -al /media/storage2/Comedy/* | xclip</code></p>
<p>You can retrieve what went into the &#8220;clipboard&#8221; by running <code>xclip -o</code>, which will paste back into the terminal whatever you copied using the example above.</p>
<p>Unfortunately what it did not do was save the output to the regular &#8220;X&#8221; clipboard (where items normally go when you highlight and do a Ctrl+v or Ctrl+x in the GUI or Ctrl+Shift+c/x in the console), which is what I was expecting, but this is easily remedied. In order to do that, we must run the following:</p>
<p><code>ls -al /media/storage2/Comedy/* | xclip -selection c</code>.<br />
(To paste from the X clipboard it&#8217;s simply a matter of running <code>xclip -selection o</code>, but you can also just use Ctrl+Shift+v)</p>
<p><em>xclip</em> supports a lot of extended features such as split clipboards (which I&#8217;m still not quite sure what those are), but I mainly wanted to use it for grabbing file listings. So all I did was make an alias by running:</p>
<p><code></code><code></code><code>alias xclip='xclip -selection c'</code></p>
<p>Now when I pipe output to <em>xclip</em> I can quickly switch to my web browser or document, hit Ctrl+v and my console output appears in a pastebin or whatever else i&#8217;m working on. It&#8217;s quite handy for both writing technical documents and for troubleshooting. Pastebin is the darling of IRC idlers, and this just made it easier.</p>
<p>I didn&#8217;t bother with aliasing &#8220;<code>xclip -selection o</code>&#8221; simply because I can just use Ctrl+Shift+v and paste back into the console from the X clipboard as mentioned above.</p>
<p>Hopefully that wasn&#8217;t too confusing. Use it a few times and it becomes a lot more intuitive. I certainly like it, especially for large outputs that would exceed the scrollback buffer (I use the Awn Terminal Applet constantly, which has a small buffer).</p>
<img src="http://feeds.feedburner.com/~r/friedcpumain/~4/wkXz3lXVOwM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.friedcpu.net/?feed=rss2&amp;p=64</wfw:commentRss>
		<feedburner:origLink>http://www.friedcpu.net/?p=64</feedburner:origLink></item>
		<item>
		<title>Getting Back To Basics</title>
		<link>http://feedproxy.google.com/~r/friedcpumain/~3/oz1lnrnvjvM/</link>
		<comments>http://www.friedcpu.net/?p=63#comments</comments>
		<pubDate>Tue, 12 Feb 2008 02:31:03 +0000</pubDate>
		<dc:creator>Casey Hendley</dc:creator>
		
		<category><![CDATA[CLI]]></category>

		<category><![CDATA[Ubuntu]]></category>

		<category><![CDATA[Linux]]></category>

		<category><![CDATA[FOSS]]></category>

		<category><![CDATA[Casey's Rants]]></category>

		<guid isPermaLink="false">http://www.friedcpu.net/?p=63</guid>
		<description><![CDATA[While Ubuntu does a very good job providing graphical alternatives to traditional console applications and utilities, I remain a staunch proponent of the console, as those who know me can attest. I could even go as far as saying that I&#8217;m a &#8220;zealous proponent&#8221; of the console, but I do use plenty of graphical applications, [...]]]></description>
			<content:encoded><![CDATA[<p>While Ubuntu does a very good job providing graphical alternatives to traditional console applications and utilities, I remain a staunch proponent of the console, as those who know me can attest. I could even go as far as saying that I&#8217;m a &#8220;zealous proponent&#8221; of the console, but I do use plenty of graphical applications, whether for aesthetics or for ease of use or for functionality. I don&#8217;t particularly favor one or the other.</p>
<p>However, in many cases, the console is much, much faster <em>if you know what you&#8217;re doing</em>. A friend of mine said to me just tonight, &#8220;you have a tendency to insist CLI is better just because you&#8217;ve spent the time learning how to use it.&#8221; He&#8217;s exactly right. I&#8217;ve spent countless hours reading man pages, howtos, tutorials and change logs because I realized early on in my UNIX-like OS &#8220;career,&#8221; that the console could open up some very powerful opportunities for me if I only took the time to learn how to use it effectively.</p>
<p>Older hardware can also benefit immensely from a console-heavy environment, although it need not be entirely text-based. But when you have a 300MHz Pentium II with 128MB RAM you probably don&#8217;t want to run a full GNOME desktop, Azureus and Amarok. But with command line utilities and a bit of know-how you can still use that machine very effectively (I even had good success selling PII 300MHz with 128MB RAM and Windows XP as &#8220;web/email laptops&#8221; in 2004, so imagine what you can do with a bit of Linux console magic!) .</p>
<p>Some of my favorite console applications, both old and new, include <em>irssi</em>, the IRC client I absolutely cannot live without, <em>rtorrent, mplayer, screen </em>(which is incredibly powerful and useful when combined with other CLI apps), <em>finch </em>and, of course, <em>ssh</em>. We&#8217;ll explore these and others in a series of article I intended to write and I&#8217;ll do my best to provide links to the wealth of other sites that provide much better articles than I ever could. I hope to learn a lot more myself during the process, so you won&#8217;t  be going it alone!</p>
<p>I am <em>not</em> a console expert. I&#8217;ve only been using Ubuntu for just over 16 months, although I did mess around with several versions of Red Hat in the late 1990s, when Linux did not support internal modems much at all, and I didn&#8217;t own an external serial modem. Somewhat ironically, I became reintroduced to the console courtesy of Mac OS X which I began using in 2005 and by the time I began using Linux again in earnest I was hooked. Now I know enough to get around in the console of most Linux distribution, BSD and Solaris. But I have much, much more to learn.</p>
<p>So stay tuned for several updates per week in which I investigate new console applications and utilities. You&#8217;ll be a &#8220;console snob&#8221; in no time! <img src='http://www.friedcpu.net/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /></p>
<img src="http://feeds.feedburner.com/~r/friedcpumain/~4/oz1lnrnvjvM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.friedcpu.net/?feed=rss2&amp;p=63</wfw:commentRss>
		<feedburner:origLink>http://www.friedcpu.net/?p=63</feedburner:origLink></item>
		<item>
		<title>A short review of the Hauppauge 274</title>
		<link>http://feedproxy.google.com/~r/friedcpumain/~3/IA33Rn47RUw/</link>
		<comments>http://www.friedcpu.net/?p=59#comments</comments>
		<pubDate>Tue, 14 Aug 2007 20:00:41 +0000</pubDate>
		<dc:creator>Bryan</dc:creator>
		
		<category><![CDATA[Bryan's Rants]]></category>

		<guid isPermaLink="false">http://www.friedcpu.net/?p=59</guid>
		<description><![CDATA[Well I just got my first real, minor PVR setup going today. I opted for the Hauppage 274-PVR, it was cheap, very cheap even. It ran me 53$ from newegg. there really isn&#8217;t much to review&#8230; I mean it just worked and does what it&#8217;s supposed to, quick install. the card is _tiny_ so I [...]]]></description>
			<content:encoded><![CDATA[<p>Well I just got my first real, minor PVR setup going today. I opted for the Hauppage 274-PVR, it was cheap, very cheap even. It ran me 53$ from <a href="http://www.newegg.com/Product/Product.asp?Item=N82E16815116633" target="_blank">newegg</a>. there really isn&#8217;t much to review&#8230; I mean it just worked and does what it&#8217;s supposed to, quick install. the card is _tiny_ so I had no problem wedging it under my passively cooled monster of a graphics Card (Biostar Nvidia 7300GT 256mb) IVTV, which comes stop with ubuntu, including the needed firmware picked it up first restart, no self compiling, it just worked. I easily set up the card in MythTV (Selfcompiled from SVN, easy stuff, long build though&#8230;) and within minutes I was watching and recording my favorite shows. The picture quality to cost ratio is amazing, I get the quality of standard rips you would see around the net with damned near instant hardware encoding. I have basic non digital cable anyway&#8230; so perfect picture was not much of a concern. My only real problem is on gutsy, with the latest nvidia drivers (tried with glx-new as well) and compiz fusion going, running myth frontend crashes X&#8230; a but of a pain, but no real bother. I wrote a short script to kill compiz and run metacity, while killing avant, cairo clock, etc. All nicely called /usr/bin/mythprep  I&#8217;ll finish up with some screens of my myth install.</p>
<p><a href="http://www.friedcpu.net/wp-admin/upload.php?style=inline&amp;tab=browse&amp;post_id=59&amp;_wpnonce=2c8bb04cb6&amp;ID=62&amp;action=view&amp;paged" id="file-link-62" title="My Lineup" class="file-link image">  			</a><a href="http://www.friedcpu.net/wp-content/uploads/2007/08/screenshot.png" title="Welcome Page"><img src="http://www.friedcpu.net/wp-content/uploads/2007/08/screenshot.thumbnail.png" alt="Welcome Page" /></a><a href="http://www.friedcpu.net/wp-content/uploads/2007/08/screenshot-1.png" title="My Recorded Shows"><img src="http://www.friedcpu.net/wp-content/uploads/2007/08/screenshot-1.thumbnail.png" alt="My Recorded Shows" /></a><a href="http://www.friedcpu.net/wp-content/uploads/2007/08/screenshot-2.png" title="My Lineup"><img src="http://www.friedcpu.net/wp-content/uploads/2007/08/screenshot-2.thumbnail.png" alt="My Lineup" /></a></p>
<img src="http://feeds.feedburner.com/~r/friedcpumain/~4/IA33Rn47RUw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.friedcpu.net/?feed=rss2&amp;p=59</wfw:commentRss>
		<feedburner:origLink>http://www.friedcpu.net/?p=59</feedburner:origLink></item>
		<item>
		<title>OH HAI I HAS A WEB 2 OH BLOG NOW (and an Apple blog.)</title>
		<link>http://feedproxy.google.com/~r/friedcpumain/~3/gosXJjLlC5s/</link>
		<comments>http://www.friedcpu.net/?p=57#comments</comments>
		<pubDate>Fri, 10 Aug 2007 02:38:11 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
		
		<category><![CDATA[Adam's Rants]]></category>

		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.friedcpu.net/?p=57</guid>
		<description><![CDATA[Well, in the spirit of things, I&#8217;ve decided I&#8217;m going to keep my more Ubuntu oriented postings here, but move my other content to other places.&#160; Nah, I&#8217;m not going to quit authoring on FriedCPU, I just feel that you Ubuntu users out there shouldn&#8217;t have to be subjected to reading about Apple, or any [...]]]></description>
			<content:encoded><![CDATA[<p>Well, in the spirit of things, I&#8217;ve decided I&#8217;m going to keep my more Ubuntu oriented postings here, but move my other content to other places.&nbsp; Nah, I&#8217;m not going to quit authoring on FriedCPU, I just feel that you Ubuntu users out there shouldn&#8217;t have to be subjected to reading about <a href="http://www.apple.com">Apple</a>, or any of those &#8216;web2.0&#8242; services I&#8217;m writing about when what you really want to hear about is the latest Ubuntu gossip, articles, and news.</p>
<p>If you&#8217;re likin&#8217; my more web2.0 posts though, you can continue to read them <a href="http://web2-oh.blogspot.com">here</a>.</p>
<p>EDIT: </p>
<p>If you&#8217;re interested in more Apple posts from me, try <a href="http://thebrainchip.blogspot.com">The Brainchip</a>. </p>
<img src="http://feeds.feedburner.com/~r/friedcpumain/~4/gosXJjLlC5s" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.friedcpu.net/?feed=rss2&amp;p=57</wfw:commentRss>
		<feedburner:origLink>http://www.friedcpu.net/?p=57</feedburner:origLink></item>
	</channel>
</rss>
