<?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>glenscott.net &#187; linux</title>
	<atom:link href="http://www.glenscott.net/category/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.glenscott.net</link>
	<description>Reading, Writing, and Sysadmin.</description>
	<lastBuildDate>Mon, 12 Dec 2011 06:40:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Checking SSL certificate expiry date and issuer: an openssl wrapper in BASH</title>
		<link>http://www.glenscott.net/2011/12/09/checking-ssl-certificate-expiry-date-and-issuer-an-openssl-wrapper-in-bash/</link>
		<comments>http://www.glenscott.net/2011/12/09/checking-ssl-certificate-expiry-date-and-issuer-an-openssl-wrapper-in-bash/#comments</comments>
		<pubDate>Fri, 09 Dec 2011 08:35:45 +0000</pubDate>
		<dc:creator>Glen</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[technical]]></category>

		<guid isPermaLink="false">http://www.glenscott.net/?p=310</guid>
		<description><![CDATA[I manage SSL certificate requests (and renewals) at work and the number of certs in use seems to be growing every year. There&#8217;s a nice cozy 3 year expiry on most of them which means to me just enough time for them to be potentially forgotten and cause a mad scurry come renewal time (or [...]]]></description>
			<content:encoded><![CDATA[<p>I manage SSL certificate requests (and renewals) at work and the number of certs in use seems to be growing every year. There&#8217;s a nice cozy 3 year expiry on most of them which means to me just enough time for them to be potentially forgotten and cause a mad scurry come renewal time (or worse, have them expire and have a service outage as a result).</p>
<p>Our CA has a recently unveiled service which will scan our public IPS and report on detected certificates close to expiry which is handy, but we have a lot of servers on non-routable and / or firewalled addresses, so an internal scan is the only way to cover them all.</p>
<p>There seem to be at least a couple of other published approaches in the google including <a href="http://freecode.com/projects/ssl-cert-check">ssl certificate expiration check</a> and the neat <a href="http://prefetch.net/articles/checkcertificate.html">ssl-cert-check script at prefetch.net</a> which will take a list of servers and express the expiry date. I wanted something slightly different (more minimalist): as we&#8217;re using the excellent <a href="http://www.zabbix.com">zabbix</a> for general system monitoring which especially likes system commands or scripts which take a single parameter and spit out a single return value.</p>
<p>In this case that parameter is a server name or IP address,  returning  either the number of days until SSL cert expiry, or the certificate issuer, depending on which version of the script is called. As I said, we&#8217;re using this with zabbix but this is just a command line script usable for quick on the spot checks or could easily be incorporated into another monitoring / alerting system.</p>
<p>A nice simple method I would probably use if I didn&#8217;t have zabbix would be to incorporate this into a quick and dirty loop script which periodically queries a list of ips or subnets and fires off an email if the &#8216;days to expiry&#8217;  is below a certain value (exactly what zabbix does now). It could be made a bit more elegant perhaps by using a bit of <a href="http://nmap.org">nmap</a> to build a fast list of responding servers to query, but depends what you want, how much time you have, and how much of a stickler you are for efficiency =)</p>
<p><em>(Command line for all scripts is simply: <code>./script-name server.name.or.ip.address</code> )</em></p>
<h3>Script: sslcheck-expiry</h3>
<pre>#!/bin/bash
# Simple SSL cert days-till-expiry check script
# by Glen Scott, www.glenscott.net

openssl_output=$(echo "
GET / HTTP/1.0
EOT" \
 | openssl s_client -connect $1:443 2&gt;&amp;1);

if [[ "$openssl_output" = *"-----BEGIN CERTIFICATE-----"* ]]; then

        cert_expiry_date=$(echo "$openssl_output" \
         | sed -n '/-----BEGIN CERTIFICATE-----/,/-----END CERTIFICATE-----/p' \
         | openssl x509 -enddate \
         | awk -F= ' /notAfter/ { printf("%s\n",$NF); } ');

        seconds_until_expiry=$(echo "$(date --date="$cert_expiry_date" +%s) - $(date +%s)" |bc);
        days_until_expiry=$(echo "$seconds_until_expiry/(60*60*24)" |bc);

        if [[ $days_until_expiry -ge 0 ]]; then

                echo "$days_until_expiry";
                exit 0

        else

                echo "EXPIRED ($days_until_expiry days)";

                exit 0
        fi

else
    echo "NOT_FOUND";
exit 1
</pre>
<h3>Checking the issuer as well as the expiry</h3>
<p>Because we have a bunch of servers setup for dev, test or other purposes with self signed &#8220;snake oil&#8221; certs and I dont really care about the certs on those, I wanted a method to determine the issuer. (Zabbix then has some logic which only bothers to email us if a cert is about to expire AND is from a real CA.)</p>
<h3>Script: sslcheck-issuer-o</h3>
<p>Returns the &#8220;O&#8221; (Organisation) value from the issuer string.</p>
<pre>#!/bin/bash
# Simple SSL cert get-issuer-O
# by Glen Scott, www.glenscott.net

openssl_output=$(echo "
GET / HTTP/1.0
EOT" \
 | openssl s_client -connect $1:443 2&gt;&amp;1);

if [[ "$openssl_output" = *"-----BEGIN CERTIFICATE-----"* ]]; then

        cert_issuer=$(echo "$openssl_output" \
         | sed -n '/-----BEGIN CERTIFICATE-----/,/-----END CERTIFICATE-----/p' \
         | openssl x509 -noout -issuer -nameopt sname \
         | tr '/' '\n' | grep O= | cut -c3- );

                echo "$cert_issuer";
                exit 0
else
    echo "NOT_FOUND";
exit 1
fi
</pre>
<h3>Script: sslcheck-issuer-cn</h3>
<p>If for some reason you want the CN value from the issuer string, use this instead.</p>
<pre> 
#!/bin/bash
# Simple SSL cert get-issuer-CN
# by Glen Scott, www.glenscott.net

openssl_output=$(echo "
GET / HTTP/1.0
EOT" \
 | openssl s_client -connect $1:443 2&gt;&amp;1);

if [[ "$openssl_output" = *"-----BEGIN CERTIFICATE-----"* ]]; then

        cert_issuer=$(echo "$openssl_output" \
         | sed -n '/-----BEGIN CERTIFICATE-----/,/-----END CERTIFICATE-----/p' \
         | openssl x509 -noout -issuer -nameopt sname \
         | tr '/' '\n' | grep CN= | cut -c4- );

                echo "$cert_issuer";
                exit 0

else
    echo "NOT_FOUND";
exit 1
fi
</pre>
<h3>Additional notes:</h3>
<p>All scripts use the <strong>openssl s_client</strong> function to connect to the first string (assuming IP or server name) on default port 443. It echoes some HTTP GET requests and an EOT, otherwise openssl will sit there until timeout waiting for something to happen. If the remote connection sends a certificate down the pipe (identified by the presence of &#8220;&#8221;&#8212;&#8211;BEGIN CERTIFICATE&#8212;&#8211;&#8221;) it will process it, otherwise it returns the value &#8216;NOT FOUND&#8217;, which is a catch all for no certificate, a malformed certificate, a network timeout and so on.</p>
<p>A quick glance at these will reveal a lot of duplication: indeed the last two only differ by one line. This is on purpose; I actually started out building a do-everything script with a switch to determine behavior (like <a href="http://freecode.com/projects/ssl-cert-check">this</a> script I subsequently found). This would be a lot more efficient in terms of network requests, you could retrieve the cert once and analyse it in multiple ways. Unfortunately it turns out zabbix really only likes dealing with the one parameter &#8211; a minor issue for which I will forgive it &#8211; so I&#8217;ve broken this out into three smaller scripts.</p>
<p>OpenSSL will only return the date in a format like <em>&#8220;Sat Jan 1 17:15:00 WAST 2010&#8243;.</em> I was starting to figure out how to chop it up into a usable format like DDMMYYYY using sed, awk, cut and the rest but discovered  to my surprise that the unix date utility understands the string just fine as is. The date is converted to seconds since epoch and the &#8216;bc&#8217; utility does some math on it, returning a rounded value in days.</p>
<p>Instead of awk in the last two I&#8217;ve used a handy-dandy utility called, simply, &#8216;text replace&#8217; (tr). I actually don&#8217;t use awk, sed and regular expressions much and am correspondingly unfamiliar with the syntax, thus was happy to discover and use this nifty shortcut. It&#8217;s not as powerful as sed/awk but is great for a simple character replace like this, especially when the process of trying to manipulate both kinds of slashes in the issuer string and replace them with newlines <code>'\n'</code> is frying my brain.</p>
<p>As always, your mileage may vary, particularly regarding any differences in the basic syntax of the various utilities across platforms (I&#8217;m using RHEL). &#8217;date&#8217; for example is very forgiving here, this might not be the same everywhere. I&#8217;ve also had issues in the past with the syntax of SED on OSX.</p>
<p>Hope someone finds this helpful, and I will write up a brief post on using zabbix to manage SSL cert expiry at some point as well.</p>
        <br><br><font size=1"><i><center>Visit <a href="http://www.glenscott.net">glenscott.net</a> for more content. Some rights reserved: Except where specified otherwise, the content of this feed is licensed under a <a href="http://creativecommons.org/licenses/by-nc-nd/3.0/">Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 License. <br><img width="44" height="15" src="http://www.glenscott.net/misc/creative_commons_by-nc-nd_88x31.png"></a></center></i></font>                              ]]></content:encoded>
			<wfw:commentRss>http://www.glenscott.net/2011/12/09/checking-ssl-certificate-expiry-date-and-issuer-an-openssl-wrapper-in-bash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to fix Huawei E620 USB 3G Modem in Ubuntu 9.10 Karmic Koala</title>
		<link>http://www.glenscott.net/2009/12/01/how-to-fix-huawei-e620-usb-3g-modem-in-ubuntu-9-10-karmic-koala/</link>
		<comments>http://www.glenscott.net/2009/12/01/how-to-fix-huawei-e620-usb-3g-modem-in-ubuntu-9-10-karmic-koala/#comments</comments>
		<pubDate>Tue, 01 Dec 2009 15:30:17 +0000</pubDate>
		<dc:creator>Glen</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[technical]]></category>

		<guid isPermaLink="false">http://www.glenscott.net/?p=211</guid>
		<description><![CDATA[I recently upgraded my laptop to Ubuntu 9.10 (Karmic Koala) and among a few other niggles (mostly related to intel video support, or lack thereof) it completely broke support for my Huawei 3G (E620) modem. Fortunately the fix is fairly straightforward: install a new kernel. I went with the latest (v2.6.32 release candidate available over [...]]]></description>
			<content:encoded><![CDATA[<p>I recently upgraded my laptop to Ubuntu 9.10 (Karmic Koala) and among a few other niggles (mostly related to intel video support, or lack thereof) it completely broke support for my Huawei 3G (E620) modem. Fortunately the fix is fairly straightforward:<em> install a new kernel</em>. I went with the latest (v2.6.32 release candidate available <a href="http://kernel.ubuntu.com/~kernel-ppa/mainline/">over here at kernel.ubuntu.org</a> ) and the problem is solved.</p>
<p>If you want the gory details, check <a href="https://bugs.launchpad.net/ubuntu/+source/linux/+bug/446146">the thread over at bugs.launchpad.net</a>. I&#8217;ll distil the useful bits below.</p>
<p>After the upgrade, my huawei 3G modem stopped being detected by <a href="http://projects.gnome.org/NetworkManager/">NetworkManager</a>. I&#8217;d see the fake &#8216;ZeroCD&#8217; drive try to map itself and occasionally a gnome message box would be thrown up about a failed mount attempt, but no modem.</p>
<p>A look in the logs revealed /var/log/messages filling up with lines like this:</p>
<pre>kernel: option 3-1:1.2: GSM modem (1-port) converter detected
kernel: usb 3-1: GSM modem (1-port) converter now attached to ttyUSB0
kernel: option 3-1:1.1: GSM modem (1-port) converter detected
kernel: usb 3-1: GSM modem (1-port) converter now attached to ttyUSB1
kernel: option 3-1:1.0: GSM modem (1-port) converter detected
kernel: usb 3-1: GSM modem (1-port) converter now attached to ttyUSB2
kernel: option1 ttyUSB2: GSM modem (1-port) converter now disconnected from ttyUSB2
kernel: option 3-1:1.0: device disconnected
kernel: option1 ttyUSB1: GSM modem (1-port) converter now disconnected from ttyUSB1
kernel: option 3-1:1.1: device disconnected
kernel: option1 ttyUSB0: GSM modem (1-port) converter now disconnected from ttyUSB0
kernel: option 3-1:1.2: device disconnected</pre>
<p>
<p>
So the modem was being disconnected and reconnected at least a couple of times a second for some reason, and the storage device was not appearing at all.</p>
<p>I tried the <a href="http://www.draisberghof.de/usb_modeswitch/">usb_modeswitch</a> tool which is supposed to jolt misbehaving HUAWEI (and other brand) devices out of their stupor with some undocumented SCSI/USB commands, but no success this time.</p>
<p>After a bit of googling, it turns out this is (was) a <a href="https://bugs.launchpad.net/ubuntu/+source/linux/+bug/446146">known bug</a> in the way the more recent linux kernel handles the combination USB Modem/Storage device hardware (and was allowed to remain in a major release of Ubuntu which is a bit unfortunate as it seems these types of USB modems are pretty common).</p>
<p>There are a couple of fixes pending an official update: either install a patched version of the kernel, or temporarily disable the USB Storage kernel module which looks pretty easy and apparently worked for a few people:</p>
<pre><strong># rmmod usb-storage</strong></pre>
<p>
<p>
Untested by me: Your mileage may vary.Â  Be warned that even if this works, by unloading the usb-storage kernel module you will lose support for any USB based storage devices, so this is strictly a temporary workaround. I thought I&#8217;d try the more permanent and possibly dangerous (?) kernel solution first, which worked.</p>
<h3>Steps to upgrade your kernel to a compatible version:</h3>
<ol>
<li>Check your current version with the <strong>uname -a</strong> command. My post-9.10-Karmic upgrade version was:<em> 2.6.31-14-generic #48-Ubuntu SMPÂ  x86_64 GNU/Linux</em></li>
<li>Go to <a href="http://kernel.ubuntu.com/~kernel-ppa/mainline/">http://kernel.ubuntu.com/~kernel-ppa/mainline/</a> and download the .deb files for the kernel headers (&#8220;all&#8221;) and the kernel for your architecture (&#8220;amd64&#8243; or &#8220;i386&#8243;). If you don&#8217;t have any kind of internet on the affected ubuntu box, grab them via another connected machine and copy them via removable media (windows or mac should be fine for just getting the files). You want the &#8220;linux-header&#8221; and &#8220;linux-image&#8221; files from within the folder with the latest (hopefully stable) version number. You can ignore the source file for now.</li>
<li>Go to a command prompt, change to the folder where the downloaded .deb files are located, and execute the following, substituting the .deb file names for the versions you have (make sure you install the headers first).</li>
<li>
<pre>sudo dpkg -i ./linux-headers-2.6.32-020632rc8_2.6.32-020632rc8_all.deb</pre>
</li>
<li>
<pre>sudo dpkg -i ./linux-image-2.6.32-020632rc8-generic_2.6.32-020632rc8_amd64.deb</pre>
</li>
</ol>
<p>After this, provided everything worked, you&#8217;re a reboot away from your modem working again. After the boot, <strong>uname -a</strong> should reveal the newly installed kernel version. Mine is: <em>2.6.32-020632rc8-generic #020632rc8 SMP</em></p>
<p>Once plugged in, the modem worked instantly and my mobile broadband account connected fine. Hooray!</p>
<p>While <strong>lsusb</strong> output looked the same as before:</p>
<pre>Bus 006 Device 004: ID 12d1:1001 Huawei Technologies Co., Ltd. E620 USB Modem</pre>
<p>
<p>
My /var/log/messages also looked a lot healthier:</p>
<pre>kernel: USB Serial support registered for GSM modem (1-port)
kernel: option 6-2:1.0: GSM modem (1-port) converter detected
kernel: usb 6-2: GSM modem (1-port) converter now attached to ttyUSB0
kernel: option 6-2:1.1: GSM modem (1-port) converter detected
kernel: usb 6-2: GSM modem (1-port) converter now attached to ttyUSB1
kernel: option 6-2:1.2: GSM modem (1-port) converter detected
kernel: usb 6-2: GSM modem (1-port) converter now attached to ttyUSB2
kernel: usbcore: registered new interface driver option
kernel: option: v0.7.2:USB Driver for GSM modems
kernel: scsi 8:0:0:0: CD-ROMÂ Â Â Â Â Â Â Â Â Â Â  HUAWEIÂ Â  Mass StorageÂ Â Â Â  2.31 PQ: 0 ANSI: 2
kernel: scsi 8:0:0:1: Direct-AccessÂ Â Â Â  HUAWEIÂ Â  SD StorageÂ Â Â Â Â Â  2.31 PQ: 0 ANSI: 2
kernel: sr0: scsi-1 drive
kernel: Uniform CD-ROM driver Revision: 3.20
kernel: sr 8:0:0:0: Attached scsi generic sg1 type 5
kernel: sd 8:0:0:1: Attached scsi generic sg2 type 0
kernel: sd 8:0:0:1: [sdb] Attached SCSI removable disk</pre>
<p>
<p>
Additionally, with the new kernel, both the pseudo cdrom, the 3G modem, and presumably the SD storage (though I don&#8217;t use it) are working at the same time. So, problem solved.</p>
<p>(Another improvement I noticed with the new version of ubuntu/kernel is I can disconnect the wireless broadband account via networkmanager without nasty gnome freeze-ups. Not sure what the culprit was for this: I worked around by disconnecting the hardware to avoid freezes, but looks like this too is now solved).</p>
        <br><br><font size=1"><i><center>Visit <a href="http://www.glenscott.net">glenscott.net</a> for more content. Some rights reserved: Except where specified otherwise, the content of this feed is licensed under a <a href="http://creativecommons.org/licenses/by-nc-nd/3.0/">Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 License. <br><img width="44" height="15" src="http://www.glenscott.net/misc/creative_commons_by-nc-nd_88x31.png"></a></center></i></font>                              ]]></content:encoded>
			<wfw:commentRss>http://www.glenscott.net/2009/12/01/how-to-fix-huawei-e620-usb-3g-modem-in-ubuntu-9-10-karmic-koala/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Ubuntu Netbook Remix on Asus eeepc / eee pc</title>
		<link>http://www.glenscott.net/2008/12/11/ubuntu-netbook-remix-on-asus-eeepc-eee-pc/</link>
		<comments>http://www.glenscott.net/2008/12/11/ubuntu-netbook-remix-on-asus-eeepc-eee-pc/#comments</comments>
		<pubDate>Thu, 11 Dec 2008 06:53:07 +0000</pubDate>
		<dc:creator>Glen</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[netbook]]></category>
		<category><![CDATA[technical]]></category>

		<guid isPermaLink="false">http://www.glenscott.net/?p=108</guid>
		<description><![CDATA[Following my previous post on restoring the default xandros install to the eeepc, it didn&#8217;t take me long to move to (and ultimately settle on) Ubuntu. Its not perfect but a hell of a lot better than stock Xandros. I had a play with the stock ASUS install for a while, but it was less [...]]]></description>
			<content:encoded><![CDATA[<p>Following <a href="http://www.glenscott.net/2008/11/12/restore-an-eee-pc-701-back-to-factory-xandros-from-a-usb-stick-with-no-asus-support-dvd/">my previous post on restoring the default xandros install to the eeepc</a>, it didn&#8217;t take me long to move to (and ultimately settle on) Ubuntu. Its not perfect but a hell of a lot better than stock Xandros.</p>
<p>I had a play with the stock ASUS install for a while, but it was less than exciting. What finally killed it for me was the broken Xandros wireless networking. To get WPA you need to do an update (via the wired connection) and after the update it still didn&#8217;t work for me. I finally learned that due to some scripting errors by the eee pc xandros developers WPA still breaks if there are certain characters in the password. Rather than do the script editing dance to fix a distro I was already feeling lackluster about I decided to move on to Ubuntu.</p>
<p>Installation of Ubuntu is a total breeze and everything you need plus instructions is over here : <a href="http://www.ubuntu-eee.com/">http://www.ubuntu-eee.com/</a>. I won&#8217;t go over it here but to summarize:</p>
<ol>
<li>Grab the .ISO (less than 700MB, I used the torrent)</li>
<li>Get the <a href="http://unetbootin.sourceforge.net/">unetbootin netboot install utility</a> (sourceforge)</li>
<li>Blast the .ISO onto your 1GB usb drive</li>
<li>Fire up your eeepc, do the usual ESC to choose boot device, and you&#8217;re away.</li>
</ol>
<p>Up until the install I wasn&#8217;t aware of the existence of the <a href="http://www.canonical.com/projects/ubuntu/nbr">ubuntu netbook interface remix</a>: its essentially a touchscreen friendly netbook menu/window manager and very cool. Its the first real argument I&#8217;ve seen that might sway me towards installing a <a href="http://jkkmobile.blogspot.com/2007/12/asus-eee-pc-with-touch-screen.html">third party aftermarket touchscreen</a>.</p>
<p>There are a couple of things that needed changing from the stock install, most importantly the broken SD Card mount function. Fortunately this is dead easy to fix (and it is maybe already sorted in the latest release even as I type this).</p>
<h3>Run an update</h3>
<p>Before doing any tinkering, its worth allowing ubuntu to run a package update via the synaptic package manager / built in updater / cmd line &#8220;apt-get update, apt get upgrade&#8221;. This is dead easy: do it first =)</p>
<h3>Fixing the SD Card mount</h3>
<p>This is a minor annoyance, possibly already fixed if there is a new release out, but very easy to fix.</p>
<ol>
<li>Fire up a terminal window (under accessories)</li>
<li>
<pre><strong>sudo gedit /etc/fstab</strong></pre>
</li>
<li>Comment out (put a hash at the start of) the last line which refers to the cdrom.</li>
<li>Save and exit.</li>
</ol>
<p>This is a minor oversight by the distribution chefs and takes about five minutes to fix. After doing that the SD card mount works seamlessly.</p>
<h3>Getting your Divx/Xvid going</h3>
<p>The next thing you&#8217;ll probably want to do is install media codecs so you can play your divx/xvids files on the go. This is as simple as firing off the media player while you have an active net connection and telling it to download the codecs from the apt repository (just search for &#8216;xvid&#8217;).</p>
<p>Another package I needed which didn&#8217;t come preinstalled was the VPN client. Standard ubuntu procedure applies here, as in the following packages should be installed:</p>
<ul>
<li>pptp-client</li>
</ul>
<ul>
<li>gnome-network-manager</li>
</ul>
<p>After that a command line network manager restart command purports to give you the VPN options in your network menu, but I needed to reboot before mine appeared. After all this was installed, my netbook connected ot the WPA network and through again to the PPTP VPN no worries.</p>
<h3>Currently <span style="text-decoration: line-through;">Unresolved</span> Resolved Issue 1: hibernation is busted.</h3>
<p><em><span style="text-decoration: line-through;">I won&#8217;t go into detail, but even after installing the hibernate package and going in with a <a href="http://gparted.sourceforge.net/">gparted</a> usb boot to match the swap partition size to my installed RAM size (512mb), hibernation is still broken. I don&#8217;t get the &#8220;Insufficient SWAP&#8221; type error messages now and it appears to be hibernating, but powering it back on results in a fresh boot rather than a restore from hibernation.</span></em></p>
<p><em><span style="text-decoration: line-through;">For the time being I&#8217;m resorting to leaving it in suspend and making sure I keep it charged if its not being used for a few days.</span></em></p>
<p><strong>UPDATE:</strong> following the instructions for file-based hibernation in <a href="http://wiki.geteasypeasy.com/Fix:_hibernate">this excellent article at ubuntu-eee.com</a> has things working perfectly.</p>
<h3>Currently <span style="text-decoration: line-through;">Unresolved</span> Resolved Issue 2: Webcam is busted</h3>
<p><span style="text-decoration: line-through;"><em>Firing up the built-in &#8216;cheese&#8217; app doesn&#8217;t give me any webcam goodness, only static. This is probably some default setting gone awry in a config file: once again I havent done much (any) research on this so it might be a simple fix. I haven&#8217;t tried Skype with it yet either.</em></span></p>
<p><strong>UPDATE:</strong> Somehow the webcam had become disabled in the BIOS between the Xandros install and the Ubuntu install. Re-enabling it fixed all. Doh.</p>
<h3>Currently Unresolved Issue 3: Some windows don&#8217;t fit the screen</h3>
<p>This can be gotten around to an extent by the hold-down-alt-when-clicking trick, but what I really want is a VGA utility like the one included in the stock distro which allows a bigger virtual screen size. There might be something out there, but I haven&#8217;t give it a proper look yet.</p>
<p>I&#8217;ll post an update if I manage to resolve any of these items (before going on holiday in a few weeks =) )</p>
        <br><br><font size=1"><i><center>Visit <a href="http://www.glenscott.net">glenscott.net</a> for more content. Some rights reserved: Except where specified otherwise, the content of this feed is licensed under a <a href="http://creativecommons.org/licenses/by-nc-nd/3.0/">Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 License. <br><img width="44" height="15" src="http://www.glenscott.net/misc/creative_commons_by-nc-nd_88x31.png"></a></center></i></font>                              ]]></content:encoded>
			<wfw:commentRss>http://www.glenscott.net/2008/12/11/ubuntu-netbook-remix-on-asus-eeepc-eee-pc/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Restore an Eee PC 701 back to factory Xandros from a USB stick with no ASUS Support DVD</title>
		<link>http://www.glenscott.net/2008/11/12/restore-an-eee-pc-701-back-to-factory-xandros-from-a-usb-stick-with-no-asus-support-dvd/</link>
		<comments>http://www.glenscott.net/2008/11/12/restore-an-eee-pc-701-back-to-factory-xandros-from-a-usb-stick-with-no-asus-support-dvd/#comments</comments>
		<pubDate>Wed, 12 Nov 2008 15:13:30 +0000</pubDate>
		<dc:creator>Glen</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[netbook]]></category>
		<category><![CDATA[technical]]></category>

		<guid isPermaLink="false">http://www.glenscott.net/?p=93</guid>
		<description><![CDATA[My recently aquired (used) asus eee pc 701 came with XP installed and no support CD/DVD. I wanted to get rid of XP and have a play with the stock linux O/S instead: I expected this to be an easy gimmie, but it was not, and ate up an evenings worth of my time googling [...]]]></description>
			<content:encoded><![CDATA[<p>My recently aquired (used) asus eee pc 701 came with XP installed and no support CD/DVD. I wanted to get rid of XP and have a play with the stock linux O/S instead: I expected this to be an easy gimmie, but it was not, and ate up an evenings worth of my time googling around for solutions so I&#8217;m going to lay out the shortcuts here to hopefully save someone else the pain.</p>
<p>As mentioned, the eeepc I acquired had XP installed (nlited) and no recovery DVD, so no option of using the built in rescue partition to restore the EEEPC back to the factory state. (Apparently you can hit F9 normally and it takes to to a <em>&#8216;restore me from hidden partiton&#8217;</em> type GRUB menu). I figured this wouldn&#8217;t be a problem, I&#8217;d just go to the Asus support site and grab the image. Its linux, right, should be able to get the firmware images easily from the manufacturer, right?</p>
<p>Wrong.</p>
<p>I <em>ransacked </em>the <a href="http://support.asus.com">official eeepc.asus.com support site</a> looking for what I needed: at the other end of the search I can honestly say I found zero useful material or info there. (Don&#8217;t even bother visiting it, you&#8217;re better off going straight to google for this). The support/download section had BIOS updates and the like, but nothing to help with a reinstall. Even searching the forums for what I imagined to be blatantly obvious issues (eg: where do I download the restore cd?) came up with bupkis.</p>
<p>I concluded, to my chagrin, Asus has decided to withhold the support software (a linux distro?) for whatever reason, and the forums were evidently being policed according to this policy, removing any useful information pertaining to it. I expected to find at least a link to an outside site, as google was telling me about various helpful torrents: not finding even a whisper of this on the official support forums smells like seafood.</p>
<p>After a bit of googling and torrent searching I found a few ISO images which purported to be eeepc 701 flavored including a copy of Ubuntu, but I couldn&#8217;t get them to run from USB key: <a href="http://en.wikipedia.org/wiki/SYSLINUX">syslinux</a> made the drive bootable but either the kernel options were wrong and linux would not boot, or I could get it to boot by plugging in manual options (specifying location of initrd etc) but only made it partway into a boot before falling over and restarting. (I didn&#8217;t bother noting or chasing down those errors as I didn&#8217;t particularly fancy my mission this evening to be going down the road of fixing boot issues in roll-your-own livecds booting from USB sticks). I realise I&#8217;ll probably have to suss this out properly for installing Ubuntu and other flavors down the road, but for now I just wanted the <em>stock </em>Xandros system restore.</p>
<p>I eventually found some downloads which solved the problem.</p>
<h3>Heres the process in WinXP:</h3>
<ol>
<li>The first thing you need is the <span class="largefilename">EeePC 901 ASUS Linux USB Flash Utility available from eeefiles.com (<em>Link updated! </em></span><em>h<a href="http://www.netbookfiles.com/574/eee-pc-8g-xp-asus-usb-flash-utility-version-v1131/">ttp://www.netbookfiles.com/574/eee-pc-8g-xp-asus-usb-flash-utility-version-v1131/</a></em> )<span class="largefilename">. I guess this is the version which comes on the support DVD, but I don&#8217;t have that and it wasn&#8217;t available from the official site, so&#8230; (By the way, thanks a lot Asus, making me resort to downloading from a third party site instead of a trusted source).</span></li>
<li>The next file you&#8217;ll need is the Xandros Eee Pc 701 Edition ISO. Get it from the <a href="http://sourceforge.net/project/showfiles.php?group_id=215613">eeepc 701 community project on sourceforge</a>.</li>
<li>Once you&#8217;ve downloaded both of the above its all pretty much downhill!</li>
<li>Now either burn the ISO to a physical disk, or mount the image using a program like <a href="http://www.daemon-tools.cc">daemontools</a>.</li>
<li>Plug in your 2GB+ USB stick</li>
<li>Run the USB Flash utility, select the detected USB drive,wait for it to format. If prompted, remove and re-insert the stick after the format. It will ask for the linux disk (either insert the physical copy you burned or mount the ISO into a drive).</li>
<li>Linux will copy (it takes a few minutes) and at the end you should have a bootable restore on the USB drive.</li>
<li>Power on the eeepc, hit F2 for BIOS options, go to &#8220;Advanced&#8221; and set the &#8220;OS Installation&#8221; to &#8220;Start&#8221;. F10 to Save and exit.</li>
<li>Put the USB drive in your eeepc, reboot, hit escape on POST to get to the boot menu, and you&#8217;re off.</li>
<li>Xandros will install (took about ten minutes on mine). Remember to go back into the BIOS and set &#8220;OS Installation&#8221; to &#8220;Finished&#8221; once its finished.</li>
</ol>
<p>That really shouldn&#8217;t have taken me a whole evening of googling to get done =</p>
        <br><br><font size=1"><i><center>Visit <a href="http://www.glenscott.net">glenscott.net</a> for more content. Some rights reserved: Except where specified otherwise, the content of this feed is licensed under a <a href="http://creativecommons.org/licenses/by-nc-nd/3.0/">Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 License. <br><img width="44" height="15" src="http://www.glenscott.net/misc/creative_commons_by-nc-nd_88x31.png"></a></center></i></font>                              ]]></content:encoded>
			<wfw:commentRss>http://www.glenscott.net/2008/11/12/restore-an-eee-pc-701-back-to-factory-xandros-from-a-usb-stick-with-no-asus-support-dvd/feed/</wfw:commentRss>
		<slash:comments>43</slash:comments>
		</item>
		<item>
		<title>Simple quick and dirty linux to smb copy backup script using smbfs</title>
		<link>http://www.glenscott.net/2008/05/10/simple-quick-and-dirty-linux-to-smb-copy-backup-script-using-smbfs/</link>
		<comments>http://www.glenscott.net/2008/05/10/simple-quick-and-dirty-linux-to-smb-copy-backup-script-using-smbfs/#comments</comments>
		<pubDate>Sat, 10 May 2008 14:39:06 +0000</pubDate>
		<dc:creator>Glen</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[technical]]></category>

		<guid isPermaLink="false">http://www.glenscott.net/?p=37</guid>
		<description><![CDATA[I recently wrote this bash script for the purpose of a simple selective backup on one of our linux servers. It tars up a bunch of files and copies them to a windows / SMB server elsewhere on the network (where it is then backed up to tape as per everything else on that server). [...]]]></description>
			<content:encoded><![CDATA[<p>I recently wrote this bash script for the purpose of a simple selective backup on one of our linux servers. It tars up a bunch of files and copies them to a windows / SMB server elsewhere on the network (where it is then backed up to tape as per everything else on that server). I know there are many different examples of this type of script on the interweb already, but someone might find this version helpful as well.</p>
<p>There seems to be a few different ways to get the SMB bit done but I ended up using smbfs: you&#8217;ll need this on your system for this script to work. If you don&#8217;t have it and you&#8217;re using a package manager it should be pretty simple to get, a bit of <strong><code>apt-get install smbfs</code></strong> should do the trick.</p>
<p>Note: I am aware of various security issues with running scripts as root, storing passwords in scripts, and this sort of thing. Since this is a <strong>super simple backup script</strong>, I&#8217;m doing it anyway : Complaints department is /dev/null ;)</p>
<p><strong>Script 1: </strong>this is a super simple version. It tars and copies some folders to the remote share and thats it.</p>
<p><code><br />
#!/bin/bash</code></p>
<p><code>#simple backup script<br />
#by Glen Scott, glenscott.net</code></p>
<p><code># set smb server and auth vars<br />
sharename="//ourserver/ourshare"<br />
username="ourdomain\ourbackupuser"<br />
password="passwordgoeshere"</code></p>
<p><code>backuplocation="/backups/*"<br />
savepath="/root/"<br />
filename=$(hostname).backup.$(date +%a).tar<br />
mountpoint="/mnt/smb"</code></p>
<p><code>#tar up the backup folder<br />
tar -cf $savepath$filename $backuplocation</code></p>
<p><code>#connect to the share<br />
mount.smbfs $sharename $mountpoint -o username=$username,password=$password</code></p>
<p><code># move the tar<br />
mv -f $savepath$filename $mountpoint</code></p>
<p><code># disconnect the share<br />
umount $mountpoint</code></p>
<p><code>#all done!</code></p>
<p><strong>Script 2:</strong> this is the second version I made for another box. It needed a mysql database backed up as well so I added a few lines in for that. I also took the chance to add a quick working folders checker / creator, tidy it up a bit and comment everything.</p>
<p><code><br />
#!/bin/bash</code></p>
<p><code># simple backup script<br />
# by Glen Scott, glenscott.net</code></p>
<p><code># this is a simple script to tar.gz certain folder locations and copy them to a SMB share<br />
# this script should be run periodically from crontab<br />
# you will need smbfs installed on your system or modify the samba mount method</code></p>
<p><code># set smb server and auth vars<br />
sharename="//ourserver/ourshare"<br />
username="ourdomain\ourbackupuser"<br />
password="passwordgoeshere"</code></p>
<p><code>#set mysql details<br />
mysqlhost="localhost"<br />
mysqlusername="root"<br />
mysqlpasswd="mysqlpasswordhere"</code></p>
<p><code>#set which folder locations we want to backup, inc trailing slashes<br />
#add more here and append to the appropriate tar line further down the script if needed</code></p>
<p><code>location1="/var/"<br />
location2="/backup/"</code></p>
<p><code>#set temp files and folders<br />
backuptemp="/backuptmp/"<br />
savepath="/root/backup/"<br />
filename=$(hostname).backup.$(date +%a).tar.gz<br />
mountpoint="/mnt/smb"</code></p>
<p><code># make sure our working folders are present and accounted for</code></p>
<p><code>if [ ! -d "${backuptemp}" ]<br />
then<br />
mkdir $backuptemp<br />
fi</code></p>
<p><code>if [ ! -d "${savepath}" ]<br />
then<br />
mkdir $savepath<br />
fi</code></p>
<p><code>if [ ! -d "${mountpoint}" ]<br />
then<br />
mkdir $mountpoint<br />
fi</code></p>
<p><code># tar up the files we want into the backup temp<br />
tar -cf ${backuptemp}files.tar $location1 $location2</code></p>
<p><code>#dump the local mysql db into the backup temp<br />
mysqldump "-h${mysqlhost}" "-u${mysqluser}" "-p${mysqlpasswd}" --all-databases --lock-tables &gt; ${backuptemp}mysqldump.sql</code></p>
<p><code>#tar up the backup temp folder<br />
tar -czf $savepath$filename $backuptemp</code></p>
<p><code>#connect the smb share to our mount point<br />
mount.smbfs $sharename $mountpoint -o username=$username,password=$password</code></p>
<p><code># copy the tar (could also move it but whatever you like)<br />
cp -f $savepath$filename $mountpoint<br />
</code><br />
<code># disconnect the share<br />
umount $mountpoint</code></p>
<p><code>#all done</code></p>
<p>As long as you have smbfs installed, the above should work fine.</p>
<p><strong>A word on smbfs:</strong> without it the above script will fail. You can probably install smbfs quite easily on your system with the command <code>apt-get install smbfs</code> (or <a href="http://en.wikipedia.org/wiki/Yellow_dog_Updater,_Modified">yum</a> if you&#8217;re using redhat/fedora, or whatever your flavor of package manager happens to be). I use debian, so apt-get works just fine for me.</p>
<p><strong>A word on Crontab:</strong> You&#8217;ll need to add the script to your local cron to get regular backups.</p>
<p>I won&#8217;t go into hideous details about how crontab works, theres <a href="http://www.google.com/search?q=cron+job">plenty of that on the net already</a>. To keep it simple, if your distro supports it (most should) you can put a <a href="http://www.google.com/search?q=symlink">symlink</a> to the script in /etc/cron.daily or /etc/cron.weekly which will give you a simple schedule.</p>
<p>If you want something a bit more complicated, you&#8217;ll have to mess with the crontab. I&#8217;m aware there are commands to get this done but I&#8217;ve always just edited the system crontab directly. Mine runs twice a week, on wednesdays and fridays, so my crontab line looks like this:</p>
<p><code># m h dom mon dow user    command<br />
0  2    * * 3,5 root    /root/backupscript</code></p>
<p>Righto, thats it.</p>
<p><strong>UPDATE: </strong>I notice a mutated version of this script has been <a href="http://www.linuxquestions.org/questions/linux-newbie-8/crontab-not-working-654561/">posted in this forum thread</a> over at <a href="http://www.linuxquestions.org/questions/index.php">linuxquestions.org</a> &#8211; cool! Check it out over there if you want to see what someone else has done with it.</p>
        <br><br><font size=1"><i><center>Visit <a href="http://www.glenscott.net">glenscott.net</a> for more content. Some rights reserved: Except where specified otherwise, the content of this feed is licensed under a <a href="http://creativecommons.org/licenses/by-nc-nd/3.0/">Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 License. <br><img width="44" height="15" src="http://www.glenscott.net/misc/creative_commons_by-nc-nd_88x31.png"></a></center></i></font>                              ]]></content:encoded>
			<wfw:commentRss>http://www.glenscott.net/2008/05/10/simple-quick-and-dirty-linux-to-smb-copy-backup-script-using-smbfs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quad boot with Linux, XP and Encrypted Vista on the Lenovo x61 Tablet</title>
		<link>http://www.glenscott.net/2008/03/30/quad-boot-with-linux-xp-and-encrypted-vista-on-the-lenovo-x61-tablet/</link>
		<comments>http://www.glenscott.net/2008/03/30/quad-boot-with-linux-xp-and-encrypted-vista-on-the-lenovo-x61-tablet/#comments</comments>
		<pubDate>Sun, 30 Mar 2008 14:23:45 +0000</pubDate>
		<dc:creator>Glen</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[technical]]></category>

		<guid isPermaLink="false">http://www.glenscott.net/?p=20</guid>
		<description><![CDATA[In this post I&#8217;m going to briefly discuss the issues I&#8217;ve had getting my new X61 notebook booting with 4 OS&#8217;s, (Windows Vista, Windows XP, Ubuntu, Backtrack) encrypted. Preamble: Our new staff laptops are pretty fantastic. Faculty has an initiative subsidizing the cost of deploying tablet notebooks to all schools in Computing and Health Science. [...]]]></description>
			<content:encoded><![CDATA[<p>In this post I&#8217;m going to briefly discuss the issues I&#8217;ve had getting my new X61 notebook booting with 4 OS&#8217;s, (Windows Vista, Windows XP, Ubuntu, Backtrack) encrypted.</p>
<p><strong>Preamble:</strong> <em>Our new staff laptops are pretty fantastic. Faculty has an initiative subsidizing the cost of deploying tablet notebooks to all schools in Computing and Health Science. I already had one of the few X41s which were wasting away in storage when I arrived: nobody seemed to want to use them becuase they apparently underperformed. I dusted one off and moved from the T42 I was using to the X41, and found the reduced footprint/weight to more than make up for any loss of grunt.</em></p>
<p>So the new machines have landed, and they&#8217;re the very capable <a href="http://www.notebookreview.com/default.asp?newsID=3765">Lenovo X61</a>. I&#8217;ve had one for a month or so running alongside the X41. I would have made the transition without delay, as the new hardware is better in many respects, and I&#8217;m not that biased against Vista that I would avoid upgrading for that reason alone (Vista is mandatory on these new machines to increase staff exposure to the O/S), but theres been a major sticking point, and thats support for my favorite XP encryption solution, <a title="Free open-source disk encryption software for Windows Vista/XP, Mac OS X, and Linux" href="http://www.truecrypt.org/">Truecrypt</a> with <a title="Obsolete, but you can follow the link anyway if you like ;)" href="http://www.truecrypt.org/third-party-projects/tcgina/">TCGINA</a>.</p>
<p>I&#8217;ve had at least one laptop stolen in recent years, and while no important data was lost / exposed via the theft, I now have a heightened awareness of the danger of carrying unencrypted data around. TCGINA does a great job in XP of hooking into the login process and pre-mounting your encrypted storage even before the user profiles are loaded, which means that data can be stored there as well. This effectively means that your desktop folder, my documents,  IM data, browser (IE or FF)  favorites and history and the like are all stored safely. If the device is lost or stolen, without your password, that sensitive file you left on the desktop isn&#8217;t sitting there exposed on an unencrypted diak waiting to be harvested by a forensic undelete utility.</p>
<p><strong>Truecrypt 4 with TCGINA is broken on Vista</strong></p>
<p>Vista takes a different (non GINA) approach to handling the login process , so TCGINA no longer gets it done. This was a real headache: I needed to be using Vista for work but wasn&#8217;t comfortable with an unencrypted portable system. (This is before TrueCrypt5 was released &#8211; more on this shortly). The X61 has a <a href="http://en.wikipedia.org/wiki/Trusted_Platform_Module">TPM</a> and thus (any big brother TPM/Vista backdoor conspiracy theories aside) <a href="http://en.wikipedia.org/wiki/BitLocker_Drive_Encryption">bitlocker</a> should have been an option, but because of the partitioning setup on my notebook, it isn&#8217;t. This is because bitlocker works by creating a separate primary partition (size ~1gb or so) on your drive to stick its bootloader and encryption software.</p>
<p>Problem was, I already had the maximum 4x primary partitions. I&#8217;m never satisfied, so after installing Vista I went in with a linux livecd and <a title="The Gnome Partition Editor" href="http://gparted.sourceforge.net/">gparted</a> (gnome partition GUI, like travelling first class compared to being jammed in the luggage bay using fdisk) and sliced it up so I could have three additional OS&#8217;s booting natively. These were <a href="http://www.ubuntu.com/">Ubuntu</a>, Backtrack 3 Beta, and WinXP SP2 &#8211; (the latter being <a title="Dual Booting Vista and XP" href="http://www.google.com/search?q=vista+xp+dual+boot">a real adventure to get co-habitating peacefully with the others</a>, due to an unfortunate tendency to blat whatever bootloader I was using with its own apon install).</p>
<p>Eventually it all worked, with GRUB on the boot partition loading up whichever of my 4 OS/s I wanted. On a side note, whenever I messed with the size of the Vista partition (gparted handles ntfs partition resizing fine) Vista would fail to load until I went in with the vista boot dvd and ran the very simple repair/rescue procedure. Did this each time, and then it was fine.</p>
<p>(I&#8217;m aware that alternative bootloaders such as <a href="http://www.ranish.com/part/xosl.htm">XOSL</a> can supposedly work some magic when it comes to maximum / types of partitions and the O/S&#8217;s loaded from them, but I have yet to try it. )</p>
<p>So having reached this stage things were mostly groovy, my 4 OS&#8217;s on one machine, but with no encryption whatsoever. At this point, I would have been happy to have it on the Primary O/S only (Vista) as the others were mainly for testing and would be unlikely to have any sensitive data on there, but even that seemed out of reach due to the TCGINA/Vista broken-ness.</p>
<p>So what to do?<br />
<strong>Answer: Truecrypt 5 rocks and is not broken on Vista<br />
</strong><br />
Midway through pondering how I was going to find a solution, a rescue came along: TrueCrypt 5 was released with a major <em>major </em>feature added: the ability to encrypt entire system &amp; boot partitions.</p>
<p>This was pretty much holy grail stuff to me at that point.</p>
<p>I wasted no time in firing up the new Truecrypt on Vista to see if the promises were true. Summary: some of them are. Its good, but not perfect. It didn&#8217;t work &#8220;out of the box&#8221; (but then bitlocker didn&#8217;t work at all): There were hiccups because I had GRUB as my primary bootloader (TC5 refuses to deal with anything but the windows bootloader) and I was unable to encrypt my entire disk, as I initially thought I&#8217;d be able to do, because my partition setup included logical partitions (this scenario throws an error <em>after </em>you try to process a whole disk which contains logical partitions).</p>
<p>So to get it working? First, I had to nuke GRUB from the primary partition, and set it up on the secondary so I could still access my linux installs.  This was pretty simple: I booted into  Ubuntu (which is where my grub config lives) and installed it on the second partition via some simple GRUB commands which I googled and now cant remember (partition 2 happens to be where XP is installed), then booted up with my vista dvd and let it replace the primary bootloader.</p>
<p>It is probably worth noting that I also had the <a title="livecd pen-test and security auditing suite" href="http://www.remote-exploit.org/backtrack.html">Backtrack</a> distro* installed on one of the logical partitions (along with a swap partition and an independently encrypted truecrypt partition), and GRUB could load Backtrack fine throughout this process, as its location didn&#8217;t change. (sda6).</p>
<p>After that it was as simple as running the truecrypt system/boot encryption wizard from Vista again, allowing it to create a recovery CD (backup of the volume headers in case of corruption or a changed, forgotten password) and waiting for a couple of hours while it processed my vista system partition, live.</p>
<p>Voila &#8211; it works. My Vista partition is now secure, and my other OS&#8217;s boot fine, albeit unencrypted. The next step is to reorganize everything so I can get rid of the logical partitions and hence do a proper whole-disk encryption to cover both my Windows and Linux installs. I&#8217;m sure theres a post in that.</p>
<p><em>* Backtrack is a Slackware based livecd distro loaded with a plethora of security tools. Since my primary laptop is usually of the subnotebook/ultraportable breed and hence doesn&#8217;t usually include a CD/DVD drive, I&#8217;ve previously installed backtrack to a USB key and booted off that, but its easier to have it integrated as a boot option, epecially with nice large hard drives making the 3GB or so loss of usable space hardly noticable.</em></p>
<h2><strong>UPDATE: </strong>I have since received a few queries about this article via email and clarified it a bit, so I&#8217;ll post the emails and responses below.</h2>
<p><!-- 		@page { size: 21cm 29.7cm; margin: 2cm } 		P { margin-bottom: 0.21cm } --></p>
<blockquote><p><strong>John: </strong><em><span style="color: #993300;">Hello,<br />
i read your article Quad boot with Linux, XP and Encrypted Vista on the Lenovo<br />
x61 Tablet, but there is not much details. My problem is that i have 2 primary<br />
partitions, 1. is winxp, second is linux. I have grub loader. So my problem is<br />
after i will encrypt my windows primary partition + use pre boot lock stuff from TC, how my grub loader will work? Because if i understand well TC boot lock will delete MBR a put own code overthere.<br />
Thanks for your reply. </span></em></p></blockquote>
<p><!-- 		@page { size: 21cm 29.7cm; margin: 2cm } 		P { margin-bottom: 0.21cm } --></p>
<p><span style="color: #000000;">Hi John</span></p>
<p><span style="color: #000000;">I have not encrypted WinXP with Truecrypt yet, only Vista, however I </span><span style="color: #000000;">suppose it is more or less the same. </span></p>
<p><span style="color: #000000;">To answer your question: When you encrypt your windows partition it will </span><span style="color: #000000;"> install the TC bootloader on the MBR, and yes it will overwrite GRUB. </span><span style="color: #000000;"> </span></p>
<p><span style="color: #000000;">What you need to do is install GRUB on your linux partition before</span><span style="color: #000000;"> running</span><span style="color: #000000;"> truecrypt in windows. You will need to boot into linux and run some </span><span style="color: #000000;"> &#8220;grub&#8221; </span><span style="color: #000000;"> commands (suggest you google them) to install it to another</span><span style="color: #000000;"> partition/drive. (It is ok to have the grub bootloader installed on two</span><span style="color: #000000;"> drives at once). Once you have encrypted your windows system partition, </span><span style="color: #000000;"> the Truecrypt bootloader will detect any other bootable drives on the </span><span style="color: #000000;"> system and give you the option of booting from them instead of your</span><span style="color: #000000;"> encrypted windows when you start up. (They will not be encrypted or</span><span style="color: #000000;"> otherwise protected by truecrypt, but they will be bootable)</span></p>
<blockquote><p><span style="color: #800000;"><strong>John:</strong> </span><em><span style="color: #800000;">Ok till that part its clean, u mean just install grub not into MBR but on</span><span style="color: #800000;"> the linux partition where the linux is. Dont understand what u mean by</span><span style="color: #800000;"> grub</span><span style="color: #800000;"> will be installed on two drives at once, u mean MBR + linux partition?</span></em></p></blockquote>
<p>Yes, you install the grub bootloader onto your linux partition. After that grub will be *temporarily* installed two places at once, but only until you run fixboot+fixmbr, after that the Windows bootloader will be restored to the primary drive/partition.</p>
<p><span style="color: #000000;">If I recall correctly, truecrypt will not do full system encryption</span><span style="color: #000000;"> while</span><span style="color: #000000;"> you have GRUB on the primary MBR, so once you have installed GRUB on</span><span style="color: #000000;"> you</span><span style="color: #000000;">r linux parition/drive, you need to replace it on the primary with the</span><span style="color: #000000;"> default WinXP bootloader (easiest way is to go in with the WinXP boot</span><span style="color: #000000;"> cd,</span><span style="color: #000000;"> go to the recovery console and use the &#8220;fixboot&#8221; and &#8220;fixmbr&#8221; commands). </span><span style="color: #000000;"> Once you have done this, boot back into windows (should go straight on</span><span style="color: #000000;"> with</span><span style="color: #000000;"> no sign of grub) and TC should encrypt your windows system partition</span><span style="color: #800000;"><span style="color: #000000;"> fine.</span></span></p>
<p><em></em></p>
<blockquote><p><strong><span style="color: #800000;">John: </span></strong><em><span style="color: #800000;">Here is a place where i completly got lost. What do u mean by primary MBR?</span><span style="color: #800000;"> Ok anyway why do i have to put grub to primary? Didnt u say that its</span><span style="color: #800000;"> enought</span> <span style="color: #800000;"> to install grub on linux partition, and simply overwrite MBR by truecrypt?</span><span style="color: #800000;"> Why do i have to do fixmbr and stuf&#8230;</span></em></p></blockquote>
<p>fixmbr and fixboot are the microsoft command line tools for restoring the default windows bootloader. You need to do this because truecrypt will not encrypt a windows partition which has grub installed as its primary bootloader.  Truecrypt then replaces the windows bootloader with its own bootloader which will then launch windows (encrypted) and also any other bootable drives/partions (ie your linux one with GRUB installed) that it finds.</p>
<p>So a basic sequence of things you would do:</p>
<ol>
<li> Boot into your linux install and install the grub bootloader onto the linux drive/partition</li>
<li>Boot into windows recovery console (winxp cd) and restore the default bootloader (fixboot/fixmbr)</li>
<li>Take cd out and boot up normally &#8211; grub should be gone and you will get into windows.</li>
<li>Run truecrypt and encrypt windows partition</li>
<li>Next time you boot up, TC bootloader is there and you can boot straight into windows or grub/linux.</li>
</ol>
<p>Hope this answers your question!</p>
<blockquote><p><span style="color: #800000;"><strong>John: </strong></span><em><span style="color: #800000;">Thanks a lot, &#8211;=John=&#8211;</span></em></p></blockquote>
<p>Hope this helps anyone else as wellÂ  =) &#8211; Glen<em><br />
</em></p>
        <br><br><font size=1"><i><center>Visit <a href="http://www.glenscott.net">glenscott.net</a> for more content. Some rights reserved: Except where specified otherwise, the content of this feed is licensed under a <a href="http://creativecommons.org/licenses/by-nc-nd/3.0/">Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 License. <br><img width="44" height="15" src="http://www.glenscott.net/misc/creative_commons_by-nc-nd_88x31.png"></a></center></i></font>                              ]]></content:encoded>
			<wfw:commentRss>http://www.glenscott.net/2008/03/30/quad-boot-with-linux-xp-and-encrypted-vista-on-the-lenovo-x61-tablet/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The Linux Student Development Server: Part 2</title>
		<link>http://www.glenscott.net/2007/09/23/the-linux-student-development-server-part-2/</link>
		<comments>http://www.glenscott.net/2007/09/23/the-linux-student-development-server-part-2/#comments</comments>
		<pubDate>Sat, 22 Sep 2007 18:45:15 +0000</pubDate>
		<dc:creator>Glen</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[technical]]></category>

		<guid isPermaLink="false">http://www.glenscott.net/2007/09/23/the-linux-student-development-server-part-2/</guid>
		<description><![CDATA[After much prodding and poking, the dev server launched, albeit dissatisfactorily: due to various issues I&#8217;ve decided to treat this first round as a prototype and create a fresh instance of the server, setting it up from scratch again, employing what I&#8217;ve learned from round one to get it working properly. Fortunately demand for the [...]]]></description>
			<content:encoded><![CDATA[<p>After much prodding and poking, the dev server launched, albeit dissatisfactorily: due to various issues I&#8217;ve decided to treat this first round as a prototype and create a fresh instance of the server, setting it up from scratch again, employing what I&#8217;ve learned from round one to get it working properly. Fortunately demand for the service has been low this semester (as the Unix and C unit is not in fact running) and we were able to relocate students from other units to the old dev server which was kept running for just that eventuality.</p>
<p>By far the most time consuming and painful task has been configuring samba / kerberos for AD. Given that this is mostly because of my inexperience in this area: but the entire process seems a lot more painful than it should be. Next time around will certainly be smoother, mostly through what I&#8217;ve learned about the available tools such as kinit and net.</p>
<p><strong>Some gotchas:</strong></p>
<p>AllowGroups in sshd_config gave me more hassle than it should have.</p>
<p>Firstly, AllowGroups is CASE sensitive in a funky manner. What I mean by this is, regardless of the actual case of the group according to the active directory, it only works for sshd if the group is specified all lowercase.  If not, the group isn&#8217;t recognised.</p>
<p>It took me a while to figure out the next reason AllowGroups was not working:  it didn&#8217;t like co-existing with AllowUsers. To my mind this is a no-brainer, both directives should work. However, once I commented out AllowUsers, the groups started authenticating properly. To maintain access for my local admin users, I added their local group to AllowGroups, so AllowUsers is no longer required.</p>
<p>A puzzlement with account creation which was pretty funny when I discovered the reason: I had left the session PAM module active for samba: every user who browsed the samba share was being created a user account. I twigged to this when I accessed it myself and watched local accounts created both for my user account and my workstation account. Since I don&#8217;t want accounts created via samba I split the session, auth, account sections off into seperate PAM files for finer control and made sure samba wasn&#8217;t using session anymore.</p>
<p>Once the assorted hassles with AD auth are sorted and behaving as planned, I&#8217;ll actually be able to get started on some of the other items in the list. When its all done I&#8217;m certainly going to generate some fat HOWTO documentation for my department to east the struggles of the next tech who needs to deal with it.</p>
        <br><br><font size=1"><i><center>Visit <a href="http://www.glenscott.net">glenscott.net</a> for more content. Some rights reserved: Except where specified otherwise, the content of this feed is licensed under a <a href="http://creativecommons.org/licenses/by-nc-nd/3.0/">Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 License. <br><img width="44" height="15" src="http://www.glenscott.net/misc/creative_commons_by-nc-nd_88x31.png"></a></center></i></font>                              ]]></content:encoded>
			<wfw:commentRss>http://www.glenscott.net/2007/09/23/the-linux-student-development-server-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Linux Student Development Server: Part 1</title>
		<link>http://www.glenscott.net/2007/08/06/the-linux-student-development-server-part-1/</link>
		<comments>http://www.glenscott.net/2007/08/06/the-linux-student-development-server-part-1/#comments</comments>
		<pubDate>Mon, 06 Aug 2007 03:27:07 +0000</pubDate>
		<dc:creator>Glen</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[technical]]></category>

		<guid isPermaLink="false">http://www.glenscott.net/archives/15</guid>
		<description><![CDATA[A few weeks ago I was tasked with establishing a *nix based server at work for the purposes of development access (first year Unix and C Students). Up front this sounds fairly simple (install a distro, openssh, install the dev tools, create accounts, voila) but in practice there are a number of other considerations which [...]]]></description>
			<content:encoded><![CDATA[<p>A few weeks ago I was tasked with establishing a *nix based server at work for the purposes of development access (first year Unix and C Students).<br />
Up front this sounds fairly simple (install a distro, openssh, install the dev tools, create accounts, voila) but in practice there are a number of other considerations which makes the task somewhat more involved. Now I&#8217;ve set up plenty of linux boxes before, but this will be one of the few intended for general use by a number of unknown people &#8211; eg not simply for access by a small number of trusted admin only.</p>
<p>Firstly, as this box is to be shell-accessible by students, it needs to be as idiot-proof as possible while still allowing reasonable access to a development environment. This means limitations on runaway forks, inode creation, et cetera.</p>
<p>This machine will need to authenticate and create users based on pre-existing groups in the Active Directory. As we do not have schema access there will be no installation of extensions to the AD for unix support. I am personally against this approach anyway: For simple authentication of users, directly modifying the AD schema seems excessive.</p>
<p>Security is also another fairly prominent concern : I am well aware that once a potentially malicious (or simply curious) user has access to a local account, without  appropriate countermeasures and vigilance by the keepers of root, a security breach is quite likely. One of the core study streams at the School of Computer and Information Science where I work is Computer and Network Security: consequently we have a number of potential users fairly au-fait in that area: so adequate security on a system they will be accessing is quite important.</p>
<p>Security concerns currently on my list:</p>
<ul>
<li>Preventing local system exploits</li>
<li>Constraining system resource abuse</li>
<li>Preventing unauthorised network access*</li>
</ul>
<p>* As this machine will have internet access outside the firewall scope of other networks accessible to the students (wireless, computer labs etc) an important consideration is preventing its use to circumvent network access restrictions (for example via a userland proxy or chat bot, or unrestricted SMTP). As the development machine is located in a secure DMZ, compromise from the outside due to an insecure listening process of some kind started either accidentally or maliciously by a user is of less concern to interneal network security in general, but measures should still be taken to prevent this sort of thing.</p>
<p>For the time being, no X environment is required, which will save me some work in the short term until I can look at it later in the &#8216;optional extras&#8217; category.</p>
<p>Items on the agenda to setup:</p>
<ul>
<li>User Authentication and auto local account / home directory creation via Active Directory</li>
<li>C dev environment</li>
<li>Tomcat based java dev environment</li>
<li>Access via: SSH, FTP, HTTP, SMB (latter 2 with intelligently mapped user paths)</li>
<li>Local system firewalling according to security policy</li>
<li>Auditing of local user logins</li>
<li>Tripwire integrity auditing</li>
<li>Backups of config, tripwire db, user homes, and MSQL db to active directory based server</li>
</ul>
<p>In Part 2 I will cover a few of the items in the list including User Auth via AD, C Dev environment, SSH setup, and any incidentals I encountered along the way.</p>
        <br><br><font size=1"><i><center>Visit <a href="http://www.glenscott.net">glenscott.net</a> for more content. Some rights reserved: Except where specified otherwise, the content of this feed is licensed under a <a href="http://creativecommons.org/licenses/by-nc-nd/3.0/">Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 License. <br><img width="44" height="15" src="http://www.glenscott.net/misc/creative_commons_by-nc-nd_88x31.png"></a></center></i></font>                              ]]></content:encoded>
			<wfw:commentRss>http://www.glenscott.net/2007/08/06/the-linux-student-development-server-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

