<?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; sysadmin</title>
	<atom:link href="http://www.glenscott.net/category/sysadmin/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>Windows Mobile 5/6 Networking Profiles, Proxy and VPN setup</title>
		<link>http://www.glenscott.net/2008/11/04/windows-mobile-56-networking-profiles-proxy-and-vpn-setup/</link>
		<comments>http://www.glenscott.net/2008/11/04/windows-mobile-56-networking-profiles-proxy-and-vpn-setup/#comments</comments>
		<pubDate>Tue, 04 Nov 2008 15:53:58 +0000</pubDate>
		<dc:creator>Glen</dc:creator>
				<category><![CDATA[mobile devices]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[technical]]></category>

		<guid isPermaLink="false">http://www.glenscott.net/?p=35</guid>
		<description><![CDATA[After the last rant on Windows Mobile networking, I&#8217;ll go over a few actual solutions to the issues I encountered: hopefully a few people may find this more helpful. Note that the following explanations, definitions of features and so on are the product of my own observation and experimentation with various WM5 and WM6 mobile [...]]]></description>
			<content:encoded><![CDATA[<p>After <a href="http://www.glenscott.net/2007/11/16/a-hall-of-mirrors-configuring-windows-mobile-networking-and-the-gremlins-therein/">the last rant on Windows Mobile networking</a>, I&#8217;ll go over a few actual solutions to the issues I encountered: hopefully a few people may find this more helpful.</p>
<p>Note that the following explanations, definitions of features and so on are the product of my own observation and experimentation with various WM5 and WM6 mobile devices. I have found some documentation on their functions but the majority of information I have discovered through trial and error. If there is some official documentation somewhere which contradicts what I say here (and I wouldn&#8217;t be at all surprised) then so be it: what I can say for sure is mine <em>works</em>.</p>
<p>That said, Windows Mobile networking is in my experience notoriously flaky and even though the stuff here works for my device, your mileage may vary considerably.</p>
<p>Ok, lets get into it.</p>
<blockquote><p><span style="color: #ff0000;"><strong>Golden rule:</strong> <em>Anytime you change <strong>anything at all</strong> in the networking profiles, after you have saved the changes, disable and re-enable the wireless network/adapter. I have a control utility for this on my device &#8211; (<a href="http://wiki.xda-developers.com/index.php?pagename=HTC_Hermes">HTC Hermes</a>) &#8211; but this will vary between devices. Following this stepÂ  every time I change anything has reduced my frustrations considerably &#8211; <strong>not </strong>doing this means settings often just don&#8217;t take effect, and after doing this sometimes things just start working.</em></span></p></blockquote>
<h3>A quick explanation of terms I&#8217;ve used:</h3>
<ul>
<li><em>&#8220;Config Profiles&#8221; </em>refer to the named settings you can create and assign to different networks in &#8220;Network Management&#8221; (Start -&gt; Settings -&gt; Connections -&gt; Connections -&gt; Advanced -&gt; Select Networks) &#8211; Some of the existing config profiles are &#8216;My ISP&#8221; and &#8220;My Workplace&#8221; (and you will have others automatically created for your ISP if you have mobile internet access on your SIM card via a 3G or GPRS network).</li>
</ul>
<h3>Explanation of how WM decides which network to use (And hence which attached config profile is used to decide how to connect)</h3>
<p>Windows mobile networking is whack (but you knew that already, right?). Here&#8217;s how it breaks down: It decides how to handle a http network request based on whether there are any <em><strong>decimals </strong></em>(periods) in the dns name.</p>
<p>By its logic, anything with a decimal/period is &#8216;internet&#8217; and anything without a decimal/period is &#8216;work&#8217;.</p>
<p><strong>So: </strong></p>
<ol>
<li>&#8220;<strong>http://bogus.internal</strong>&#8221; is handled with the config profile attached to the<em>&#8220;Internet&#8221;</em> network</li>
<li>&#8220;<strong>http://bogus</strong>&#8221; is handled with the config profile attached to the<em>&#8220;Private Network&#8221;</em> network</li>
</ol>
<p>You can create multiple different named config profiles and assign any of them to either <em>&#8220;Internet&#8221;</em> or <em>&#8220;Private Network&#8221;</em>.</p>
<p>An important thing to note is, a config cannot have a VPN server added to it (or use an already setup VPN) when applied to the &#8216;Internet&#8217; network. If you want to use a VPN you&#8217;ll have to do it through the &#8216;Work&#8217; network (see exceptions hint below).</p>
<h3>Explanation of the &#8216;Exceptions&#8217; settings.</h3>
<p>Now &#8211; anything in the &#8216;Exceptions&#8217; list goes through the &#8220;My Work&#8221; profile regardless of whether the dns name has decimals in it to not. The good news is you can use wildcards here to force a wide range of sites through the &#8216;My Work&#8217; profile if you want &#8211; hint: <strong>http:/*.*</strong> and <strong>https://*.*</strong> . I didn&#8217;t end up using this for my solution, but you might find it useful.</p>
<p>I&#8217;m sure this flavor of networking makes sense to some software engineer in Microsoft land, but to me it just spells confusion. Once I worked out what was actually going on, I figured out some shortcuts/config hacks which can be used to railroad the networking into doing more or less what you tell it to.</p>
<h3>So here&#8217;s what I&#8217;ve done to make mine work:</h3>
<p>First, I access everything using its FQDN &#8211; no dotless machinename shortcuts. This makes sure everything is using the profile assigned to &#8220;Internet&#8221; (regardless of whether I&#8217;m on a work network or not).</p>
<p>Make sure the &#8216;Exceptions&#8217; section has no entries.</p>
<p>Next, tell windows mobile that every wireless network you connect to is &#8220;The Internet&#8221;. Forget about the &#8220;Work&#8221; option . As far as my usage goes, that option is useless. All the wireless networks I connect to are set to &#8220;Internet&#8221;. If you have already added a wireless network and don&#8217;t know if its tagged to &#8220;Work&#8221; or &#8220;Internet, you can go into settings -&gt; wireless networks, find existing networks, and change which network it connects to.</p>
<p>Next, create a couple of new custom network configs, as follows:</p>
<ul>
<li>&#8216;Direct Connection&#8217; &#8211; this does as it says, and contains no settings for proxy or vpn.</li>
<li>&#8216;Proxy Connection&#8217; &#8211; this has my work proxy server entered</li>
</ul>
<p>You do this via Settings &#8211;&gt; connections (tab) &#8211;&gt; connections (icon) &#8211;&gt; Advanced (tab), Select Networks (button). Here you can edit existing or create new config profiles.</p>
<blockquote><p><span style="color: #333399;"><em>Incidentally, my workplace uses VPNs to grant authenticated access to the wireless network &#8211; so not allowing a VPN connection to a host on a &#8220;private network&#8221; just breaks everything.</em></span></p></blockquote>
<p>Once you&#8217;ve done that and entered your proxy authentication credentials in the appropriate places, you&#8217;re ready to go. Whenever you want to change how you&#8217;re connecting to the net go to network settings, and change &#8220;internet&#8221; to one of your created profiles. Remember to start/stop the wireless to force the change, and your next network access should be using either direct, proxy, (or VPN &#8211; see below), whichever you&#8217;ve chosen.</p>
<p>By doing this you lose any pretense of windows Mobile networking transparently working from whichever location / network you are connected to, but it never worked properly for me anyway, and at least this way you have some control back.</p>
<h3>Connecting to a VPN</h3>
<p>The above covered getting web access only, either direct or via a proxy. To get a VPN connection active (eg for skype and the like) heres what you have to do instead:</p>
<ol>
<li>Assign a config profile to the &#8216;work&#8217; network</li>
<li>Add a VPN connection to the config profile you used. You can add VPN connections to a config profile by assigning it to to the &#8220;Internet&#8221; connection, hitting OK, going back to the &#8216;Tasks&#8217; tab and clicking the &#8216;Add a new VPN server connection&#8217;.</li>
<li>Add the appropriate wildcard exceptions (to the &#8216;exceptions&#8217; section) to trigger the VPN connection for every hostname.</li>
</ol>
<p>Once I get a VPN up at my work from inside the wireless I can make direct connections to outside hosts, for example using <a href="http://www.pocketputty.net/">PocketPutty</a>. Be warned though that even if it does connect, Windows Mobile likes to shut down the VPN connection once it decides it is no longer in use, eg after you haven&#8217;t looked at web pages for a while, regardless of whatever else you are doing on the network, (say in a live SSH session). Parking pocket IE on a web page with an auto-refresh might possibly fool it into keeping the VPN alive, but I haven&#8217;t experimented with that yet.</p>
<p>Hopefully there is some useful info in here and it eases the pain of getting your mobile device networking in a saner fashion.</p>
<p><em>This is a fairly quick covering of networking with WM5/6 and its highly likely there are holes, inaccuracies and/or bits left out:Â  If anyone has queries, corrections or extra to add, go ahead and comment or hit up the contact form for direct email.</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/11/04/windows-mobile-56-networking-profiles-proxy-and-vpn-setup/feed/</wfw:commentRss>
		<slash:comments>3</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>A hall of mirrors: configuring Windows Mobile Networking and the gremlins therein</title>
		<link>http://www.glenscott.net/2007/11/16/a-hall-of-mirrors-configuring-windows-mobile-networking-and-the-gremlins-therein/</link>
		<comments>http://www.glenscott.net/2007/11/16/a-hall-of-mirrors-configuring-windows-mobile-networking-and-the-gremlins-therein/#comments</comments>
		<pubDate>Fri, 16 Nov 2007 12:12:07 +0000</pubDate>
		<dc:creator>Glen</dc:creator>
				<category><![CDATA[mobile devices]]></category>
		<category><![CDATA[rant]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[technical]]></category>

		<guid isPermaLink="false">http://www.glenscott.net/2008/02/16/a-hall-of-mirrors-configuring-windows-mobile-networking-and-the-gremlins-therein/</guid>
		<description><![CDATA[The time is apon me for a bit of a rant about Windows Mobile, specifically with regards to its approach to networking profiles. I&#8217;ve been spoiling for a write up on the topic for a while: ever since the PocketPC days, networking on PDAs with windows O/S has been, at least for this techie, a [...]]]></description>
			<content:encoded><![CDATA[<p>The time is apon me for a bit of a rant about Windows Mobile, specifically with regards to its  approach to networking profiles. I&#8217;ve been spoiling for a write up on the topic for a while: ever since the PocketPC days, networking on PDAs with windows O/S has been, at least for this techie, a giant pain in the ass.</p>
<p>It should be noted that most of this gripe is based on experiences with Pocket PC 2003 and its predecessors.  WM5 and WM6 are recent additions to the fold for me, and a number of the mentioned issues seem to be, if not solved, at least partially smoothed over.</p>
<p>So far, so far the strongest argument I&#8217;ve yet encountered for blowing Windows Mobile away in favor of some flavor of embedded linux is the WM implementation of networking. A real shame because aside from that, WM more or less seems to get it right &#8211; decent information management, desktop / remote email sync (when you can get past the networking hurdles), and with third party tools, enough access to the internals to keep a techie happy. Except the networking interface.</p>
<p>Windows mobile networking has generally confused me. As a network admin, I&#8217;ve dealt with plenty of odd setups, but Windows Mobile truly does take the cake. After a few hours of mind games you&#8217;ll likely be begging for a simple &#8216;do what your told&#8217; setup as opposed to the &#8216;second guess you because we know better&#8217; philosophy that WM6 seems to adopt.</p>
<p>I have messed around with these devices for longer than I should admit.  Many a time I&#8217;ve had everything working &#8211; for a while. Then it stops, develops amnesia, stumbles about disoriented. Losing wireless has the device utterly, and inexplicably confused, and too often for happenstance a hard reset will get things going again &#8211; <em>with the exact same config. </em></p>
<p>Indeed, there  seems to be a new definition of logic when it comes to how networking should function, and often a setting will seem to have no effect, or the result will be inconsistent. It will work for a while then stop. One application will work fine, but another will not. Changing a seemingly unrelated networking parameter has ramifications: things start working in an unexpected fashion or not at all.</p>
<p>The approach seems to be akin to a puzzle game with a random element as opposed to a tool designed to achieve an outcome.  Sometimes it will work, sometimes will not. The same inputs to the black box will not always render the same output.</p>
<p>Now I&#8217;ve had a bit of a dubiously qualified rave, making vague accusations and pointing my finger about the place at indistinct phantoms, here are some actual specifics I have encountered.</p>
<p>Most, if not all of the headaches come from the implementation of multiple networking profiles &#8211; &#8220;My Work&#8221;, and &#8220;The Internet&#8221;. Now this multiple config setup could have been cool, if they hadn&#8217;t crippled them both in subtle and painful ways. Setting them up in seemingly logical configs does not work (ie you expect to connect to a network, access that network through a proxy if specified, access it directly if not).</p>
<p>After many many hours of trial and error I found some answers on the net which pretty much confirmed there wasn&#8217;t much to be done except half baked workarounds. I&#8217;ll outline the situation briefly; Its been a while since I struggled with them properly, but heres the gist:</p>
<ul>
<li> Options for the different networking areas are buried, entwined, and otherwise concealed within layers of subterfuge &#8211; idiosyncratic ways to get to oddly named tabs and mislabeled options, labels and check boxes. I can only assume this is to prevent joe businessman getting into the settings to mess them up, but they do equally well at confusing IT techs who expect some kind of consistency with other configuration standards. I&#8217;ve been hoping since the pocket PC days that they would throw all this out and start again, but sadly WM6 seems to have retained most of it.</li>
</ul>
<ul>
<li>&#8220;My Work&#8221; traffic is defined by the device as any server accessed without a period-delimited dns entry. Whaa&#8230; So &#8216;ourmailserver&#8217; would be accessed through whatever the &#8216;My Work&#8221; profile uses, but &#8216;ourmailserver.internaldomain&#8217; won&#8217;t be. You don&#8217;t get an option to change this. Also, its not specified or appear to be documented anywhere obvious on the device.</li>
</ul>
<ul>
<li>To get to the internet via a connection associated with the &#8216;My Work&#8217; profile, you must have a proxy server entered. You do not get a choice. No proxy, no internet, regardless of whether you happen to have direct access or not.</li>
</ul>
<ul>
<li>You can specify a list of addresses NOT to use the proxy/internet profile for. (Exceptions). This seemed to be a workaround to get access to the net via VPN from the wireless network on campus (see below).</li>
</ul>
<ul>
<li>Activesyncing the device with a PC seems to arbitrarily replace the proxy settings on the device with the proxy settings of IE from the PC being synched. It took me a while to figure out this is why my old bosses settings would work for a while on his GPRS plan (which uses a proxy server on the ISP&#8217;s network), then die (after he docked his pda and the settings were replaced).</li>
</ul>
<ul>
<li> VPN-ing only seemed to be allowed through an &#8216;internet&#8217; connection. (this might have changed in WM6 &#8211; except&#8230; well see the next point). In WM5 The device assumes you will never be connecting to a VPN from the &#8216;My Work&#8217; network. Wrong in our case, as we connect to a VPN internally when using wireless &#8211; 99% of how the PDA works. To get this working, the wildcard exceptions workaround needed to be used.</li>
</ul>
<ul>
<li>VPN in WM6 &#8211; what VPN? It doesnt work. Sets up fine, then never offers to connect, and attempts to connect manually fail silently. Less than ideal. Fortuantely re-jigging the new devices to use our internal proxy seems to work for most functionality.</li>
</ul>
<ul>
<li>Pocket IE is hardwired to obey the O/S proxy settings. Often I was unable to access web pages because  of some internal device proxy confusion based in the proxy settings (third party tools would show clean pings and connections possible to the proxy server and / or the destination server). It is notable that I could often get pocket mozilla (minimo) and pocket opera to load pages when pocket IE would not.</li>
</ul>
<ul>
<li> Pocket MSN seems very sensitive to proxy settings. I have only ever had it working when the device has a direct connection to the net, wither via activesyncing to a PC which has a direct connection, or using GPRS.</li>
</ul>
<p>Complaining like this smacks of heresay, because its hard to be specific about just where and in what manner things are broken. The place is like a wall of mirrors &#8211; and the diatribe sounds like someone ranting on without qualification. It sounds like the ravings of a lunatic, of a n00b, of a crazy man.</p>
<p>In truth, a lot of the complaints I have had seem vapous unless you&#8217;ve experienced them yourself. I know &#8211; I know these problems exist because I&#8217;ve sat for hours struggling with the damn things, and I&#8217;ve managed to set up plenty of networking devices before, and they work, so I have to lay it back on the device in question rather than any outstanding incompetence on my part.</p>
<p>I think the problem is this: if you add to the various configuration craziness mentioned before the fact that wireless can be flaky, you have a test environment with shifting terrain which makes it difficult to baseline and describe properly, let alone start mapping out solutions. Regardless, Windows Mobile devices are set to become part of the widespread IT landscape at my workplace very soon, and it will be at least partly up to yours truly to ensure it happens as smoothly as possible, so a-testing I must go.</p>
<p><strong>UPDATE:</strong> I have posted a few solutions to some of these issues in the post <a href="http://www.glenscott.net/2008/11/04/windows-mobile-56-networking-profiles-proxy-and-vpn-setup/">Windows Mobile 5/6 Networking Profiles, Proxy and VPN setup.</a></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/11/16/a-hall-of-mirrors-configuring-windows-mobile-networking-and-the-gremlins-therein/feed/</wfw:commentRss>
		<slash:comments>0</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>

