<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   >
<channel>
    <title>For the good of all of us</title>
    <link>http://www.skytale.net/blog/</link>
    <description></description>
    <dc:language>en</dc:language>
    <generator>Serendipity 1.5.3 - http://www.s9y.org/</generator>
    <pubDate>Sat, 17 Mar 2012 17:58:24 GMT</pubDate>

    <image>
        <url>http://www.skytale.net/blog/templates/default/img/s9y_banner_small.png</url>
        <title>RSS: For the good of all of us - </title>
        <link>http://www.skytale.net/blog/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>Manually converting a Cisco AP to LAP mode</title>
    <link>http://www.skytale.net/blog/archives/37-Manually-converting-a-Cisco-AP-to-LAP-mode.html</link>
            <category>Cisco</category>
            <category>Hardware</category>
    
    <comments>http://www.skytale.net/blog/archives/37-Manually-converting-a-Cisco-AP-to-LAP-mode.html#comments</comments>
    <wfw:comment>http://www.skytale.net/blog/wfwcomment.php?cid=37</wfw:comment>

    <slash:comments>3</slash:comments>
    <wfw:commentRss>http://www.skytale.net/blog/rss.php?version=2.0&amp;type=comments&amp;cid=37</wfw:commentRss>
    

    <author>nospam@example.com (Ralf Ertzinger)</author>
    <content:encoded>
    	&lt;p&gt;Several of Cisco Systems Wireless Access Points can be used in two different deployment scenarios:&lt;/p&gt;

	&lt;ul&gt;
		&lt;li&gt;As standalone APs (or Thick APs)&lt;/li&gt;
		&lt;li&gt;As lightweight APs (or Thin APs/LAPs) connected to a wireless &lt;span class=&quot;caps&quot;&gt;LAN&lt;/span&gt; controller (or &lt;span class=&quot;caps&quot;&gt;WLC&lt;/span&gt;)&lt;/li&gt;
	&lt;/ul&gt;

	&lt;p&gt;Each scenario requires special software on the AP. Converting a Thin AP to Thick is comparatively easy, as this can be done from the &lt;span class=&quot;caps&quot;&gt;WLC&lt;/span&gt; the AP is managed by.&lt;/p&gt;

	&lt;p&gt;Converting in the other direction (Thick to Thin) is a bit more complicated. It requires a so called &lt;span class=&quot;caps&quot;&gt;LWAPP&lt;/span&gt; Upgrade and Recovery image to be installed on the AP, along with some configuration changes. Equipped with this image the AP will be able to find and associate with a &lt;span class=&quot;caps&quot;&gt;WLC&lt;/span&gt;, which will then provide the AP with the &amp;#8220;real&amp;#8221; &lt;span class=&quot;caps&quot;&gt;LAP&lt;/span&gt; &lt;span class=&quot;caps&quot;&gt;IOS&lt;/span&gt; version and appropriate config.&lt;/p&gt;

	&lt;p&gt;Getting the &lt;span class=&quot;caps&quot;&gt;LWAPP&lt;/span&gt; Upgrade image onto the AP can be a bit tricky, though. Cisco offers a tool to help with the process (the Autonomous To Lightweight Mode Upgrade Tool), but this has several drawbacks.&lt;/p&gt;

	&lt;ul&gt;
		&lt;li&gt;It requires Microsoft Windows&lt;/li&gt;
		&lt;li&gt;It comes with it&amp;#8217;s own &lt;span class=&quot;caps&quot;&gt;TFTP&lt;/span&gt; server that does not play nice with other &lt;span class=&quot;caps&quot;&gt;TFTP&lt;/span&gt; software&lt;/li&gt;
		&lt;li&gt;It is a rather finicky piece of software&lt;/li&gt;
	&lt;/ul&gt;

	&lt;p&gt;The latter is, of course, entirely subjective.&lt;/p&gt;

	&lt;p&gt;But there is not much magic in what this tool does, anyway. Converting a Thick AP to Thin mode can be done completly manually. The following is required:&lt;/p&gt;

	&lt;ul&gt;
		&lt;li&gt;A Cisco AP that can be converted to &lt;span class=&quot;caps&quot;&gt;LAP&lt;/span&gt; mode. Not all can, check the documentation&lt;/li&gt;
		&lt;li&gt;A copy of the &lt;span class=&quot;caps&quot;&gt;LWAPP&lt;/span&gt; Upgrade and Recovery image. Available on the Cisco website download section alongside the software for Thick APs. Access to this requires a Cisco support contract.&lt;/li&gt;
		&lt;li&gt;A way to transfer this image to the AP. This usually means a &lt;span class=&quot;caps&quot;&gt;TFTP&lt;/span&gt; server that the AP can reach.&lt;/li&gt;
		&lt;li&gt;Connectivity to the AP. This procedure can be done remotely (via telnet or &lt;span class=&quot;caps&quot;&gt;SSH&lt;/span&gt;), but a serial console connection works, of course. Do not use this procedure if the connection to the AP uses the wireless interface of the AP you want to convert.&lt;/li&gt;
	&lt;/ul&gt;

	&lt;p&gt;Please note:&lt;/p&gt;

	&lt;p&gt;Following this procedure the AP will reboot without a config. It&amp;#8217;s expected that the AP will be able to acquire an IP address on it&amp;#8217;s ethernet port via &lt;span class=&quot;caps&quot;&gt;DHCP&lt;/span&gt; and establish a connection to a &lt;span class=&quot;caps&quot;&gt;WLC&lt;/span&gt;. The AP will not be remotely manageable unless it is able to associate with a &lt;span class=&quot;caps&quot;&gt;WLC&lt;/span&gt;. Keep this in mind before converting an AP in Australia from Europe.&lt;/p&gt;

	&lt;h2&gt;Convertion&lt;/h2&gt;

	&lt;p&gt;The convertion consists of three main steps:&lt;/p&gt;

	&lt;ul&gt;
		&lt;li&gt;Creating a self signed certificate for the AP&lt;/li&gt;
		&lt;li&gt;Install a number of trusted root certificates&lt;/li&gt;
		&lt;li&gt;Install the &lt;span class=&quot;caps&quot;&gt;LWAPP&lt;/span&gt; Upgrade software&lt;/li&gt;
	&lt;/ul&gt;

	&lt;h3&gt;Self signed certificate&lt;/h3&gt;

	&lt;p&gt;Connect to the AP and make sure you have the appropriate privileges:&lt;/p&gt;

&lt;pre&gt;
ap#sh privilege
Current privilege level is 15
&lt;/pre&gt;

	&lt;p&gt;The self signed certificate will contain the &lt;span class=&quot;caps&quot;&gt;MAC&lt;/span&gt; address of the ethernet interface, so this needs to be determined first.&lt;/p&gt;

&lt;pre&gt;
ap#show int F0 | include address
  Hardware is PowerPC405GP Ethernet, address is 0014.6a40.45ab (bia 0014.6a40.45ab)
&lt;/pre&gt;

	&lt;p&gt;Next, some boot parameters need to be set, as well as the clock of the AP. This is necessary for the creation of the self signed certificate as well as acceptance of the root certificates to be installed later.&lt;/p&gt;

	&lt;p&gt;&lt;pre&gt;
ap# conf t
ap(config)# no boot manual
ap(config)# no boot enable-break
ap(config)# no sntp broadcast client
ap(config)# no timezone
ap(config)# end
ap# clock set 17:36:00 17 March 2012
&lt;/pre&gt;&lt;br /&gt;
Next, eventually existing versions of the self signed certificate (&lt;span class=&quot;caps&quot;&gt;SSC&lt;/span&gt;) will be removed. These do not necessarily exist, so getting an error message here denoting this is not critical. Confirmation is required if the keys actually do exist.&lt;/p&gt;

	&lt;p&gt;Afterwards, a new &lt;span class=&quot;caps&quot;&gt;RSA&lt;/span&gt; keypair is generated, and a &lt;span class=&quot;caps&quot;&gt;SSC&lt;/span&gt; based on this keypair. The common name (cn) entered in the certificate subject name consists of the AP family description (C1200 for a 1242AG, for example) and the &lt;span class=&quot;caps&quot;&gt;MAC&lt;/span&gt; address of the ethernet interface as determined above. The other fields of the subject name are static.&lt;/p&gt;

&lt;pre&gt;
ap# conf t
ap(config)# crypto key zeroize rsa CISCO_IOS_SSC_Keys
% The specified RSA keypair does not exist (CISCO_IOS_SSC_Keys).
ap(config)# no crypto ca trustpoint CISCO_IOS_SSC_Cert
% CA trustpoint &amp;#39;CISCO_IOS_SSC_Cert&amp;#39; is not known.
ap(config)# crypto key generate rsa general-keys label CISCO_IOS_SSC_Keys modulus 2048
The name for the keys will be: CISCO_IOS_SSC_Keys
% The key modulus size is 2048 bits
% Generating 2048 bit RSA keys ...[OK]
ap(config)# crypto ca trustpoint CISCO_IOS_SSC_Cert
ap(ca-trustpoint)#enrollment selfsigned
ap(ca-trustpoint)#serial-number none
ap(ca-trustpoint)#fqdn none
ap(ca-trustpoint)#ip-address none
ap(ca-trustpoint)#subject-name cn=C1200-00146a4045ab, ea=support@cisco.com, o=Cisco Systems, C=US, ST=California, L=San Jose
ap(ca-trustpoint)#revocation-check none
ap(ca-trustpoint)#rsakeypair CISCO_IOS_SSC_Keys
ap(ca-trustpoint)#exit
ap(config)#crypto ca enroll CISCO_IOS_SSC_Cert
% The fully-qualified domain name will not be included in the certificate
Generate Self Signed Router Certificate? [yes/no]: yes
Router Self Signed Certificate successfully created
&lt;/pre&gt;

	&lt;h3&gt;Root certificates&lt;/h3&gt;

	&lt;p&gt;Some root and intermediate certificates need to be installed on the AP. There are several of these, owing to the history of the &lt;span class=&quot;caps&quot;&gt;WLC&lt;/span&gt;. Again, an error during certificate removal stating that the certificate does not exist is not fatal. Confirm the removal if prompted so.&lt;/p&gt;

&lt;pre&gt;
ap# conf t
ap(config)#no crypto ca trustpoint airespace-new-root-cert
% CA trustpoint &amp;#39;airespace-new-root-cert&amp;#39; is not known.
ap(config)#no crypto ca trustpoint airespace-device-root-cert
% CA trustpoint &amp;#39;airespace-device-root-cert&amp;#39; is not known.
ap(config)#no crypto ca trustpoint airespace-old-root-cert
% CA trustpoint &amp;#39;airespace-old-root-cert&amp;#39; is not known.
ap(config)#no crypto ca trustpoint cisco-root-cert
% CA trustpoint &amp;#39;cisco-root-cert&amp;#39; is not known.
ap(config)#no crypto ca trustpoint cisco-mfg-root-cert
% CA trustpoint &amp;#39;cisco-mfg-root-cert&amp;#39; is not known.
ap(config)#crypto ca profile enrollment Cisco_IOS_profile
ap(ca-profile-enroll)#authentication terminal
ap(ca-profile-enroll)#enrollment terminal
ap(ca-profile-enroll)#exit
ap(config)#crypto ca trustpoint airespace-new-root-cert
ap(ca-trustpoint)#enrollment profile Cisco_IOS_profile
ap(ca-trustpoint)#revocation-check none
ap(ca-trustpoint)#exit
ap(config)#crypto ca trustpoint airespace-device-root-cert
ap(ca-trustpoint)#enrollment profile Cisco_IOS_profile
ap(ca-trustpoint)#revocation-check none
ap(ca-trustpoint)#exit
ap(config)#crypto ca trustpoint airespace-old-root-cert
ap(ca-trustpoint)#enrollment profile Cisco_IOS_profile
ap(ca-trustpoint)#revocation-check none
ap(ca-trustpoint)#exit
ap(config)#crypto ca trustpoint cisco-root-cert
ap(ca-trustpoint)#enrollment profile Cisco_IOS_profile
ap(ca-trustpoint)#revocation-check none
ap(ca-trustpoint)#exit
ap(config)#crypto ca trustpoint cisco-mfg-root-cert
ap(ca-trustpoint)#enrollment profile Cisco_IOS_profile
ap(ca-trustpoint)#revocation-check none
ap(ca-trustpoint)#exit
&lt;/pre&gt;

	&lt;p&gt;Next, import the certificates.&lt;/p&gt;

	&lt;p&gt;airespace-new-root-cert:&lt;/p&gt;

&lt;pre&gt;
ap(config)#crypto ca authen airespace-new-root-cert
Enter the base 64 encoded CA certificate.
End with a blank line or the word &amp;#34;quit&amp;#34; on a line by itself
-----BEGIN CERTIFICATE-----
MIIEWjCCA4OgAwIBAgIBADANBgkqhkiG9w0BAQQFADCBpjELMAkGA1UEBhMCVVMx
EzARBgNVBAgTCkNhbGlmb3JuaWExETAPBgNVBAcTCFNhbiBKb3NlMRcwFQYDVQQK
Ew5BaXJlc3BhY2UgSW5jLjEUMBIGA1UECxMLRW5naW5lZXJpbmcxGjAYBgNVBAMT
EUFpcmVzcGFjZSBSb290IENBMSQwIgYJKoZIhvcNAQkBFhVzdXBwb3J0QGFpcmVz
cGFjZS5jb20wHhcNMDMwNzMxMTM0MTIyWhcNMTMwNDI5MTM0MTIyWjCBpjELMAkG
A1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExETAPBgNVBAcTCFNhbiBKb3Nl
MRcwFQYDVQQKEw5BaXJlc3BhY2UgSW5jLjEUMBIGA1UECxMLRW5naW5lZXJpbmcx
GjAYBgNVBAMTEUFpcmVzcGFjZSBSb290IENBMSQwIgYJKoZIhvcNAQkBFhVzdXBw
b3J0QGFpcmVzcGFjZS5jb20wgd8wDQYJKoZIhvcNAQEBBQADgc0AMIHJAoHBAMyg
+SMwvUnpR6Q/oqzzpIJ/Zne7ZvRrFja6hO8JZpzK4OrKbx0PupD++li4UCwQ/Hjc
ydEm2I8q0Fmoppv+kDJL1kVTztkTG5mwKCpz2YZV769epUCWIuVLn8QliYh48aUf
9HsW8gwKN6NSYDpasNxFM7DAt8gC3yXwWF3/X0P9rh9Io0vf+ArCfjC+kxvTSQre
yB/2+ZdPFAhVyIE/0zTxuKGJKwoQ2YpEfb8hPmRSDSDnjpMi2hHKekas60FGqwID
AQABo4IBFDCCARAwHQYDVR0OBBYEFFONg2BHjcIPgGYyMunhcHBVKxfqMIHTBgNV
HSMEgcswgciAFFONg2BHjcIPgGYyMunhcHBVKxfqoYGspIGpMIGmMQswCQYDVQQG
EwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTERMA8GA1UEBxMIU2FuIEpvc2UxFzAV
BgNVBAoTDkFpcmVzcGFjZSBJbmMuMRQwEgYDVQQLEwtFbmdpbmVlcmluZzEaMBgG
A1UEAxMRQWlyZXNwYWNlIFJvb3QgQ0ExJDAiBgkqhkiG9w0BCQEWFXN1cHBvcnRA
YWlyZXNwYWNlLmNvbYIBADAMBgNVHRMEBTADAQH/MAsGA1UdDwQEAwIBBjANBgkq
hkiG9w0BAQQFAAOBwQAG42U9Sxn6oMO5jq4jxaMwXkJFIqlhvhtbiFbtLlrkL3rA
JqooBZgkCA0VEhabROQoRy67pXMp8HDbVgEce+nzokA5mjVXpQOE7KA1Pc9J6OwB
lAR0aQvBIHknZIc9JZQ9zWapcm9KeetAHHxol06SXYAjE8EmH2BHY6nZrB/fAJL2
V98atJuQTiLOVRXNRPaKAE4ryGH7wVQNwfOma4zdwcJ8RCAn5iQRmLDgAt6eBtZP
DVOJh5bBwNsSsPWBb+0=
-----END CERTIFICATE-----
quit
Certificate has the following attributes:
Fingerprint: C2176703 8D42BF7F 5240CAD3 F59930A9
% Do you accept this certificate? [yes/no]: yes
Trustpoint CA certificate accepted.
% Certificate successfully imported
&lt;/pre&gt;

	&lt;p&gt;airespace-device-root-cert:&lt;/p&gt;

&lt;pre&gt;
ap(config)#crypto ca authen  airespace-device-root-cert
Enter the base 64 encoded CA certificate.
End with a blank line or the word &amp;#34;quit&amp;#34; on a line by itself
-----BEGIN CERTIFICATE-----
MIIEfzCCA6igAwIBAgIBAzANBgkqhkiG9w0BAQQFADCBpjELMAkGA1UEBhMCVVMx
EzARBgNVBAgTCkNhbGlmb3JuaWExETAPBgNVBAcTCFNhbiBKb3NlMRcwFQYDVQQK
Ew5BaXJlc3BhY2UgSW5jLjEUMBIGA1UECxMLRW5naW5lZXJpbmcxGjAYBgNVBAMT
EUFpcmVzcGFjZSBSb290IENBMSQwIgYJKoZIhvcNAQkBFhVzdXBwb3J0QGFpcmVz
cGFjZS5jb20wHhcNMDUwNDI4MjIzNzEzWhcNMTUwMTI2MjIzNzEzWjCBqDELMAkG
A1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExETAPBgNVBAcTCFNhbiBKb3Nl
MRcwFQYDVQQKEw5BaXJlc3BhY2UgSW5jLjEUMBIGA1UECxMLRW5naW5lZXJpbmcx
HDAaBgNVBAMTE0FpcmVzcGFjZSBEZXZpY2UgQ0ExJDAiBgkqhkiG9w0BCQEWFXN1
cHBvcnRAYWlyZXNwYWNlLmNvbTCB3zANBgkqhkiG9w0BAQEFAAOBzQAwgckCgcEA
qTwBWOcoTnX/hqV6iGrKN0ML7PB1gvVr22rFFFVPsG6qMns+zjyTkQPJO6QMCvky
pstdo/HDxShTv04ZLBv8SEZ+vZMGtJdKEnO/NYrYVA8mHmEromc7aNI5yH4enpZ7
JlTShUW7f3hfTp1Le4ABqi9FXP9FUuzbVmfj/OcJPgaPrjU9Qii0jYtBXZv0ljQt
wUWZh7ab+ktR+2e0oMIef8YmmjlH6x1IXoOxKYsHnl4e2rWgvl4d4BCf8L1HUOMr
AgMBAAGjggE3MIIBMzAMBgNVHRMEBTADAQH/MC4GCWCGSAGG+EIBDQQhFh9BaXJl
c3BhY2UgRGV2aWNlIENBIENlcnRpZmljYXRlMB0GA1UdDgQWBBQKUjuxJXBSO5zq
dH+yrT2Pleo/zDCB0wYDVR0jBIHLMIHIgBRTjYNgR43CD4BmMjLp4XBwVSsX6qGB
rKSBqTCBpjELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExETAPBgNV
BAcTCFNhbiBKb3NlMRcwFQYDVQQKEw5BaXJlc3BhY2UgSW5jLjEUMBIGA1UECxML
RW5naW5lZXJpbmcxGjAYBgNVBAMTEUFpcmVzcGFjZSBSb290IENBMSQwIgYJKoZI
hvcNAQkBFhVzdXBwb3J0QGFpcmVzcGFjZS5jb22CAQAwDQYJKoZIhvcNAQEEBQAD
gcEAoOjVnZvanu0MlgRd/qNwhOxZtcPTcWlNsHBmTgyAYNae42boH588z2iKsEmO
zPpspyhU8tgEZpDJj+yE7y9/DwjJD3GdwPTBJc7RtSVt2T5Rd3vV6H8dx5/MUC3C
AkLAXRaC3uPfdUG4xVtDPBDf4r/S6ALn2SMymiOiB2+GvMBI1Wmzg1msiXmX8CxV
b4/jGHVPYFxDzafIGEewhR2t8NbNYsjeqG5uEkp83L+m/MfhhSodsVKdY7NogwX2
e9Jf
-----END CERTIFICATE-----
quit
Certificate has the following attributes:
Fingerprint: B5B0E363 7834493B DD640D72 122B19AC
Certificate validated - Signed by existing trustpoint CA certificate.
Trustpoint CA certificate accepted.
% Certificate successfully imported
&lt;/pre&gt;

	&lt;p&gt;airespace-old-root-cert:&lt;/p&gt;

&lt;pre&gt;
ap(config)#crypto ca authen airespace-old-root-cert
Enter the base 64 encoded CA certificate.
End with a blank line or the word &amp;#34;quit&amp;#34; on a line by itself
-----BEGIN CERTIFICATE-----
MIIEBjCCAy+gAwIBAgIBADANBgkqhkiG9w0BAQQFADCBjzELMAkGA1UEBhMCVVMx
EzARBgNVBAgTCkNhbGlmb3JuaWExETAPBgNVBAcTCFNhbiBKb3NlMRYwFAYDVQQK
Ew1haXJlc3BhY2UgSW5jMQ0wCwYDVQQLEwRub25lMQswCQYDVQQDEwJjYTEkMCIG
CSqGSIb3DQEJARYVc3VwcG9ydEBhaXJlc3BhY2UuY29tMB4XDTAzMDIxMjIzMzg1
NVoXDTEyMTExMTIzMzg1NVowgY8xCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxp
Zm9ybmlhMREwDwYDVQQHEwhTYW4gSm9zZTEWMBQGA1UEChMNYWlyZXNwYWNlIElu
YzENMAsGA1UECxMEbm9uZTELMAkGA1UEAxMCY2ExJDAiBgkqhkiG9w0BCQEWFXN1
cHBvcnRAYWlyZXNwYWNlLmNvbTCB3zANBgkqhkiG9w0BAQEFAAOBzQAwgckCgcEA
2505ATAFndEFyyeTm5kH+B/1f6kkBlv3Glhl+LnPzLNnk1TUabq4RxyjJ67qAGqs
kEecncI7Z976zA0oMsYQP6WcQeLotCULTSkD61JimpnWGLdHxKlBURq5lbsUkFQE
X0oLn/OH80bV86JJKu0baj3WOdhJJDZqEjTdLbE81Il+LqEBY7zMgi96bQszq1cF
PHhKbaPdHluWz1TGz01ZvBv9bLbnL8spiNy+bU12+4Mfr1aD5OIIIgCp6y477w35
AgMBAAGjge8wgewwHQYDVR0OBBYEFJRX330Ugi0xuyh3LomWGIbaRoS6MIG8BgNV
HSMEgbQwgbGAFJRX330Ugi0xuyh3LomWGIbaRoS6oYGVpIGSMIGPMQswCQYDVQQG
EwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTERMA8GA1UEBxMIU2FuIEpvc2UxFjAU
BgNVBAoTDWFpcmVzcGFjZSBJbmMxDTALBgNVBAsTBG5vbmUxCzAJBgNVBAMTAmNh
MSQwIgYJKoZIhvcNAQkBFhVzdXBwb3J0QGFpcmVzcGFjZS5jb22CAQAwDAYDVR0T
BAUwAwEB/zANBgkqhkiG9w0BAQQFAAOBwQCusDSdwPkqqjpXdbOnnFQhqdAVOJJh
lcA0eQTagdQSD1j64imSI761SpBtcPf3IZLvr6Sw9IhgTjCUu8x3o2CogSkISbh7
XKGqFyGSKlVraODTGtxyZMTE1rIzNFyGJU5JiAlmRc1A8Sdhi8N+cdrZFnclMiNh
cdh6Fvkq98FRy4iSRDvGZlm+pHuYXohmaKHr1Ii79uepSf34dxHVGKgOID2hK+vc
aWPtp7dgeaMiOAyWDLjTJMrdlJ3qOeDvAz0=
-----END CERTIFICATE-----
quit
Certificate has the following attributes:
Fingerprint: 61FD1452 D2803ADC BC4D069C 5FC3C92E
% Do you accept this certificate? [yes/no]: yes
Trustpoint CA certificate accepted.
% Certificate successfully imported
&lt;/pre&gt;

	&lt;p&gt;cisco-mfg-root-cert:&lt;/p&gt;

&lt;pre&gt;
ap(config)#crypto ca authen cisco-mfg-root-cert
Enter the base 64 encoded CA certificate.
End with a blank line or the word &amp;#34;quit&amp;#34; on a line by itself
-----BEGIN CERTIFICATE-----
MIIE2TCCA8GgAwIBAgIKamlnswAAAAAAAzANBgkqhkiG9w0BAQUFADA1MRYwFAYD
VQQKEw1DaXNjbyBTeXN0ZW1zMRswGQYDVQQDExJDaXNjbyBSb290IENBIDIwNDgw
HhcNMDUwNjEwMjIxNjAxWhcNMjkwNTE0MjAyNTQyWjA5MRYwFAYDVQQKEw1DaXNj
byBTeXN0ZW1zMR8wHQYDVQQDExZDaXNjbyBNYW51ZmFjdHVyaW5nIENBMIIBIDAN
BgkqhkiG9w0BAQEFAAOCAQ0AMIIBCAKCAQEAoMX33JaUNRXx9JlOu5tB4X3beRaR
u/NU8kFKlDJiYskj95rnu5t56AcpTjD1rhvFIVZGsPj05o6BuBbMqJuF0kKB23zL
lKkRYRIcXOozIByaFqd925kGauI2r+z4Cv+YZwf0MO6l+IgaqujHPBzO7kj9zVw3
8YaTnj1xdX007ksUqcApewUQ74eeaTEw9Ug2P9irzhXi6FifPmJxBIcmpBViASWq
1d/JyVu4yaEHe75okpOTIKhsvRV100RdRUvsqNpgx9jI1cjtQeH1X1eOUzKTSdXZ
D/g2qgfEMkHFp68dGf/2c5k5WnNnYhM0DR9elXBSZBcG7FNcXNtq6jUAQQIBA6OC
AecwggHjMBIGA1UdEwEB/wQIMAYBAf8CAQAwHQYDVR0OBBYEFNDFIiarT0Zg7K4F
kcfcWtGwR/dsMAsGA1UdDwQEAwIBhjAQBgkrBgEEAYI3FQEEAwIBADAZBgkrBgEE
AYI3FAIEDB4KAFMAdQBiAEMAQTAfBgNVHSMEGDAWgBQn88gVHm6aAgkWrSugiWBf
2nsvqjBDBgNVHR8EPDA6MDigNqA0hjJodHRwOi8vd3d3LmNpc2NvLmNvbS9zZWN1
cml0eS9wa2kvY3JsL2NyY2EyMDQ4LmNybDBQBggrBgEFBQcBAQREMEIwQAYIKwYB
BQUHMAKGNGh0dHA6Ly93d3cuY2lzY28uY29tL3NlY3VyaXR5L3BraS9jZXJ0cy9j
cmNhMjA0OC5jZXIwXAYDVR0gBFUwUzBRBgorBgEEAQkVAQIAMEMwQQYIKwYBBQUH
AgEWNWh0dHA6Ly93d3cuY2lzY28uY29tL3NlY3VyaXR5L3BraS9wb2xpY2llcy9p
bmRleC5odG1sMF4GA1UdJQRXMFUGCCsGAQUFBwMBBggrBgEFBQcDAgYIKwYBBQUH
AwUGCCsGAQUFBwMGBggrBgEFBQcDBwYKKwYBBAGCNwoDAQYKKwYBBAGCNxQCAQYJ
KwYBBAGCNxUGMA0GCSqGSIb3DQEBBQUAA4IBAQAw8zAtjPLKN0pkmSQpCvKGqkLV
I+ii6itvaSN6go4cTAnPpE+rhC836WVg0ZrG2PML9d7QJwBcbx2RvdFOWFEdyeP3
OOfTC9Fovo4ipUsG4eakqjN9GnW6JvNwxmEApcN5JlunGdGTjaubEBEpH6GC/f08
S25l3JNFBemvM2tnIwcGhiLa69yHz1khQhrpz3B1iOAkPV19TpY4gJfVb/Cbcdi6
YBmlsGGGrd1lZva5J6LuL2GbuqEwYf2+rDUU+bgtlwavw+9tzD0865XpgdOKXrbO
+nmka9eiV2TEP0zJ2+iC7AFm1BCIolblPFft6QKoSJFjB6thJksaE5/k3Npf
-----END CERTIFICATE-----
quit
Trustpoint &amp;#39;cisco-mfg-root-cert&amp;#39; is a subordinate CA and holds a non self signed cert
Certificate has the following attributes:
Fingerprint: 6EA241F5 AC9A1148 CC8B4B43 C7C13025
% Do you accept this certificate? [yes/no]: yes
Trustpoint CA certificate accepted.
% Certificate successfully imported
&lt;/pre&gt;

	&lt;p&gt;cisco-root-cert:&lt;/p&gt;

&lt;pre&gt;
ap(config)# crypto ca authen cisco-root-cert
Enter the base 64 encoded CA certificate.
End with a blank line or the word &amp;#34;quit&amp;#34; on a line by itself
-----BEGIN CERTIFICATE-----
MIIDQzCCAiugAwIBAgIQX/h7KCtU3I1CoxW1aMmt/zANBgkqhkiG9w0BAQUFADA1
MRYwFAYDVQQKEw1DaXNjbyBTeXN0ZW1zMRswGQYDVQQDExJDaXNjbyBSb290IENB
IDIwNDgwHhcNMDQwNTE0MjAxNzEyWhcNMjkwNTE0MjAyNTQyWjA1MRYwFAYDVQQK
Ew1DaXNjbyBTeXN0ZW1zMRswGQYDVQQDExJDaXNjbyBSb290IENBIDIwNDgwggEg
MA0GCSqGSIb3DQEBAQUAA4IBDQAwggEIAoIBAQCwmrmrp68Kd6ficba0ZmKUeIhH
xmJVhEAyv8CrLqUccda8bnuoqrpu0hWISEWdovyD0My5jOAmaHBKeN8hF570YQXJ
FcjPFto1YYmUQ6iEqDGYeJu5Tm8sUxJszR2tKyS7McQr/4NEb7Y9JHcJ6r8qqB9q
VvYgDxFUl4F1pyXOWWqCZe+36ufijXWLbvLdT6ZeYpzPEApk0E5tzivMW/VgpSdH
jWn0f84bcN5wGyDWbs2mAag8EtKpP6BrXruOIIt6keO1aO6g58QBdKhTCytKmg9l
Eg6CTY5j/e/rmxrbU6YTYK/CfdfHbBcl1HP7R2RQgYCUTOG/rksc35LtLgXfAgED
o1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUJ/PI
FR5umgIJFq0roIlgX9p7L6owEAYJKwYBBAGCNxUBBAMCAQAwDQYJKoZIhvcNAQEF
BQADggEBAJ2dhISjQal8dwy3U8pORFBi71R803UXHOjgxkhLtv5MOhmBVrBW7hmW
Yqpao2TB9k5UM8Z3/sUcuuVdJcr18JOagxEu5sv4dEX+5wW4q+ffy0vhN4TauYuX
cB7w4ovXsNgOnbFp1iqRe6lJT37mjpXYgyc81WhJDtSd9i7rp77rMKSsH0T8lasz
Bvt9YAretIpjsJyp8qS5UwGH0GikJ3+r/+n6yUA4iGe0OcaEb1fJU9u6ju7AQ7L4
CYNu/2bPPu8Xs1gYJQk0XuPL1hS27PKSb3TkL4Eq1ZKR4OCXPDJoBYVL0fdX4lId
kxpUnwVwwEpxYB5DC2Ae/qPOgRnhCzU=
-----END CERTIFICATE-----
quit
Certificate has the following attributes:
Fingerprint: BE395ABE 078AB112 1725CC1D 46343CB2
% Do you accept this certificate? [yes/no]: yes
Trustpoint CA certificate accepted.
% Certificate successfully imported
&lt;/pre&gt;

	&lt;h3&gt;Image transfer&lt;/h3&gt;

	&lt;p&gt;The &lt;span class=&quot;caps&quot;&gt;LWAPP&lt;/span&gt; Upgrade image is transferred to the AP. This will overwrite any existing images, thus this is the point of no return, in a way. Enter the appropriate data for your environment (IP address, image name) in the &lt;span class=&quot;caps&quot;&gt;TFTP&lt;/span&gt; server section.&lt;/p&gt;

&lt;pre&gt;
ap# arch down /over /create-space tftp://10.200.254.4/images/c1200-rcvk9w8-tar.123-7.JX9.tar
examining image...
Loading images/c1200-rcvk9w8-tar.123-7.JX9.tar from 10.200.254.4 (via BVI1): !
extracting info (273 bytes)
Image info:
    Version Suffix: rcvk9w8-
    Image Name: c1200-rcvk9w8-mx
    Version Directory: c1200-rcvk9w8-mx
    Ios Image Size: 1751552
    Total Image Size: 1751552
    Image Feature: WIRELESS LAN|LWAPP|RECOVERY
    Image Family: C1200
    Wireless Switch Management Version: 3.0.51.0
Extracting files...
c1200-rcvk9w8-mx/ (directory) 0 (bytes)
extracting c1200-rcvk9w8-mx/c1200-rcvk9w8-mx (1741240 bytes)!!!!!!!!!
extracting c1200-rcvk9w8-mx/info (273 bytes)
extracting info.ver (273 bytes)!!
[OK - 1751040 bytes]
Deleting current version...
Deleting flash:/c1200-k9w7-mx.123-8.JA2...done.
New software image installed in flash:/c1200-rcvk9w8-mx
Configuring system to use new image...done.archive download: takes 67 seconds
ap#show archive status
SUCCESS: Upgrade complete.
&lt;/pre&gt;

	&lt;p&gt;Now there is only one thing left to do: remove the startup-config, and reload the AP. On reload the AP will come up with the &lt;span class=&quot;caps&quot;&gt;LAP&lt;/span&gt; software and start searching for a &lt;span class=&quot;caps&quot;&gt;WLC&lt;/span&gt; to join.&lt;/p&gt;

&lt;pre&gt;
ap# wr erase
Erasing the nvram filesystem will remove all configuration files! Continue? [confirm]
[OK]
ap# reload
Proceed with reload? [confirm]
&lt;/pre&gt; 
    </content:encoded>

    <pubDate>Sat, 17 Mar 2012 18:50:20 +0100</pubDate>
    <guid isPermaLink="false">http://www.skytale.net/blog/archives/37-guid.html</guid>
    
</item>
<item>
    <title>Installing RedHat 1.1 (Mother's Day + 0.1)</title>
    <link>http://www.skytale.net/blog/archives/36-Installing-RedHat-1.1-Mothers-Day-+-0.1.html</link>
            <category>Computer</category>
            <category>Linux</category>
            <category>Software</category>
    
    <comments>http://www.skytale.net/blog/archives/36-Installing-RedHat-1.1-Mothers-Day-+-0.1.html#comments</comments>
    <wfw:comment>http://www.skytale.net/blog/wfwcomment.php?cid=36</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.skytale.net/blog/rss.php?version=2.0&amp;type=comments&amp;cid=36</wfw:commentRss>
    

    <author>nospam@example.com (Ralf Ertzinger)</author>
    <content:encoded>
    	&lt;p&gt;Just to see what life was like in the dark ages of Linux distributions I ventured to install the earliest RedHat release I could get my hands on in a &lt;span class=&quot;caps&quot;&gt;QEMU&lt;/span&gt; virtual machine.&lt;/p&gt;

	&lt;p&gt;It turns out that this is easier said than done. RedHat does have an archive of old versions (available at &lt;a href=&quot;http://archive.download.redhat.com&quot;&gt;http://archive.download.redhat.com&lt;/a&gt;), but this is quite incomplete for the earliest version.&lt;/p&gt;

	&lt;p&gt;Fortunately there&amp;#8217;s an installable version of Mother&amp;#8217;s Day 1.1 on &lt;a href=&quot;http://www.ibiblio.org/pub/historic-linux/distributions/redhat/&quot;&gt;ibiblio&lt;/a&gt; (the 1.0 release is incomplete as well), which I used.&lt;/p&gt;

	&lt;p&gt;To make an installable version out of this it&amp;#8217;s recommened to make a local copy of the complete tree, which is easily done with &lt;code&gt;rsync&lt;/code&gt;:&lt;/p&gt;

&lt;pre&gt;
$ rsync -rv --progress www.ibiblio.org::pub/historic-linux/distributions/redhat/mothers-day-1.1 .
&lt;/pre&gt;

	&lt;p&gt;This will create a local directory called &lt;code&gt;mothers-day-1.1&lt;/code&gt; containing all needed files, taking up about 360MB.&lt;/p&gt;

	&lt;p&gt;The installer will need to access the files via a &lt;span class=&quot;caps&quot;&gt;CDROM&lt;/span&gt; or a &lt;span class=&quot;caps&quot;&gt;NFS&lt;/span&gt; share. I opted for the CD method, so let&amp;#8217;s create a CD image:&lt;/p&gt;

&lt;pre&gt;
$ chmod +x mothers-day-1.1/bin/*
$ mkisofs -J -R -o mothers-day-1.1.iso mothers-day-1.1
&lt;/pre&gt;

	&lt;p&gt;This makes all the files in &lt;code&gt;mothers-day-1.1/bin&lt;/code&gt; executable (this is important because the installer will mount the CD and expects to be able to execute these files for the installation) and creates an &lt;span class=&quot;caps&quot;&gt;ISO&lt;/span&gt; image called &lt;code&gt;mothers-day-1.1.iso&lt;/code&gt; containing all files from the &lt;code&gt;mothers-day-1.1&lt;/code&gt; directory.&lt;/p&gt;

	&lt;p&gt;The installer will boot from a floppy disk. The release contains a whole bunch of these, for different hardware configurations (a kernel containing all supported configs would not have fitted on one floppy, so one has to choose the right one). For &lt;span class=&quot;caps&quot;&gt;QEMU&lt;/span&gt; we&amp;#8217;ll need standard &lt;span class=&quot;caps&quot;&gt;IDE&lt;/span&gt; support (easy) and &lt;span class=&quot;caps&quot;&gt;AMD&lt;/span&gt; PCnet support for networking (also easy). The boot image supporting these is located in &lt;code&gt;mothers-day-1.1/images/1211/boot0066.img&lt;/code&gt;. These images were meant to be copied to a 1.44MB floppy disk, but the images are only 800k in size. If the images are passed to &lt;span class=&quot;caps&quot;&gt;QEMU&lt;/span&gt; as they are &lt;span class=&quot;caps&quot;&gt;QEMU&lt;/span&gt; will misinterpret the floppy size, causing the boot loader (&lt;span class=&quot;caps&quot;&gt;LILO&lt;/span&gt;) to fail. So &lt;span class=&quot;caps&quot;&gt;QEMU&lt;/span&gt; needs a little hint.&lt;/p&gt;

&lt;pre&gt;
$ cp mothers-day-1.1/images/1211/boot0066.img boot.img
$ qemu-img resize boot.img 1440k
Image resized
$ cp mothers-day-1.1/images/rootdisk.img .
&lt;/pre&gt;

	&lt;p&gt;This copies the correct boot image to &lt;code&gt;boot.img&lt;/code&gt; and resizes it to the correct size for a 1.44MB floppy. For convinience I also copied the root image disk, too. This disk already has the correct size.&lt;/p&gt;

	&lt;p&gt;All that&amp;#8217;s missing now is a hard disk image to install to. This should not be too large, as the &lt;span class=&quot;caps&quot;&gt;IDE&lt;/span&gt; driver in the kernel has some problems handling this. Fortunately this is the deep past, so 768MB will be plenty.&lt;/p&gt;

&lt;pre&gt;
$ qemu-img create -f qcow2 disk1.img 768MB
&lt;/pre&gt;

	&lt;p&gt;Deep past or not, the installer needs memory, and an amazing (for the time) amount of it. 4MB will not be enough, 8MB will do fine. So, let&amp;#8217;s go.&lt;/p&gt;

&lt;pre&gt;
$ qemu -M pc -m 8 -fda boot.img -drive file=disk1.img,if=ide,media=disk,cache=writeback \
-cdrom mothers-day-1.1.iso -net nic,model=pcnet -net user -boot a
&lt;/pre&gt;

	&lt;p&gt;(This adds the hard disk image in writeback cache mode. This is not recommended from a data security standpoint, as data written by the virtual machine is not immediately committed to host storage, but since this is just a for fun exercise and EXT2 formatting takes ages with the default cache strategy I&amp;#8217;ll pass on data security here)&lt;/p&gt;

	&lt;p&gt;At the &lt;span class=&quot;caps&quot;&gt;LILO&lt;/span&gt; prompt, just press Enter to boot with default options. When prompted, change the floppy to the root disk (&lt;code&gt;change floppy0 rootdisk.img&lt;/code&gt; in the &lt;span class=&quot;caps&quot;&gt;QEMU&lt;/span&gt; monitor mode) and press Enter to continue. The installer will come up (which is quite nice), prompting to change the floppy back to the boot floppy.&lt;/p&gt;

	&lt;p&gt;Select an Express install, say &amp;#8220;No&amp;#8221; to the default package list question, and select CD as the install media. The installer ought to find the CD image on &lt;code&gt;/dev/hdc&lt;/code&gt;, which is correct.&lt;/p&gt;

	&lt;p&gt;There will be no OS/2 on this install, so skip the reboot at the next question.&lt;/p&gt;

	&lt;p&gt;The hard disk will need to be partitioned. The installer should find a hard disk at &lt;code&gt;/dev/hda&lt;/code&gt; (if the installer just presents a list of partitioning programs without a disk device your hard disk image is too large). Partition the disk into one data partition (taking most of the space) and a small swap partition (16MB or so). The installer will ask to reboot if partitions were changed, this is not needed as there were no partitions on the disk to start with.&lt;/p&gt;

	&lt;p&gt;Confirm &lt;code&gt;/dev/hda2&lt;/code&gt; as a swap partition, and select &lt;code&gt;/dev/hda1&lt;/code&gt; for formatting.&lt;/p&gt;

	&lt;p&gt;On the package selection screen select whatever needed (or just everything, it does not really matter :) I&amp;#8217;d recommend at least the Net Utils, everything X and Utils+. And there&amp;#8217;s Doom (but more on that later).&lt;/p&gt;

	&lt;p&gt;When asked for the type of video card select &lt;span class=&quot;caps&quot;&gt;SVGA&lt;/span&gt;, and enter a hostname for the machine.&lt;/p&gt;

	&lt;p&gt;The installer will then format swap and file system, which might take a few seconds. Or even minutes. If you did not change the default caching strategy in the &lt;span class=&quot;caps&quot;&gt;QEMU&lt;/span&gt; call above it will definitely take minutes. Or hours.&lt;/p&gt;

	&lt;p&gt;After the formatting the package installation phase begins. This will also take a few minutes, but at least it has a progress bar. The installer may complain about XF86_SVGA being already installed in the end, this can be ignored.&lt;/p&gt;

	&lt;p&gt;Then the boot kernel is copied from the boot floppy.&lt;/p&gt;

	&lt;p&gt;For the mouse, select &lt;code&gt;microsoft-serial&lt;/code&gt;, connected to &lt;code&gt;/dev/ttyS0&lt;/code&gt;.&lt;/p&gt;

	&lt;p&gt;The X configuration is a bit wonky (and this would not really change for the next decade or more). Decline autoprobe, select &lt;code&gt;clgd5434&lt;/code&gt; as the chipset (this isn&amp;#8217;t correct, but close enough). Enter 4096k of video memory, 10-100 for the clocks, and select the &lt;code&gt;Generic Multisync&lt;/code&gt; monitor. The configurator will tell you that it failed after that, but never mind.&lt;/p&gt;

	&lt;p&gt;Configure networking, entering a host name, domain name and fully qualified host name. Select &lt;code&gt;10.0.2.100&lt;/code&gt; as the IP, &lt;code&gt;10.0.2.0&lt;/code&gt; as the network, &lt;code&gt;255.255.255.0&lt;/code&gt; as the netmask, &lt;code&gt;10.0.2.255&lt;/code&gt; as the broadcast, &lt;code&gt;10.0.2.2&lt;/code&gt; as the gateway and &lt;code&gt;10.0.2.3&lt;/code&gt; as the &lt;span class=&quot;caps&quot;&gt;DNS&lt;/span&gt; server (&lt;span class=&quot;caps&quot;&gt;QEMU&lt;/span&gt; user mode networking is funny).&lt;/p&gt;

	&lt;p&gt;Select no modem, your keymap, local time and your time zone (the list is sorted upside down, for whatever reason).&lt;/p&gt;

	&lt;p&gt;Select to install &lt;span class=&quot;caps&quot;&gt;LILO&lt;/span&gt; in &lt;code&gt;/dev/hda&lt;/code&gt; without specific parameters and without other operating systems.&lt;/p&gt;

	&lt;p&gt;Create a user account (if you want) and select a root password.&lt;/p&gt;

	&lt;p&gt;After that, the installation is finished. Select reboot.&lt;/p&gt;

	&lt;p&gt;The system will be unable to actually reboot, so stop &lt;span class=&quot;caps&quot;&gt;QEMU&lt;/span&gt; after the installer has terminated and start it again:&lt;/p&gt;

&lt;pre&gt;
$ qemu -M pc -m 8 -drive file=disk1.img,if=ide,media=disk -net nic,model=pcnet -net user -serial msmouse
&lt;/pre&gt;

	&lt;p&gt;This invocation is missing the floppy and CD images (they are not needed anymore) and adds a serial mouse.&lt;/p&gt;

	&lt;p&gt;At the boot prompt press Enter, and wait until the system has bootet to the login prompt (which will take all of a few seconds). Look around. If you&amp;#8217;re used to RedHat based systems (or Fedora) most things should look familiar.&lt;/p&gt;

	&lt;p&gt;Next up: getting X to actually work.&lt;/p&gt; 
    </content:encoded>

    <pubDate>Sun, 21 Aug 2011 21:03:51 +0200</pubDate>
    <guid isPermaLink="false">http://www.skytale.net/blog/archives/36-guid.html</guid>
    
</item>
<item>
    <title>GIT pushing to a new bare remote repo</title>
    <link>http://www.skytale.net/blog/archives/35-GIT-pushing-to-a-new-bare-remote-repo.html</link>
            <category>Computer</category>
            <category>Software</category>
    
    <comments>http://www.skytale.net/blog/archives/35-GIT-pushing-to-a-new-bare-remote-repo.html#comments</comments>
    <wfw:comment>http://www.skytale.net/blog/wfwcomment.php?cid=35</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.skytale.net/blog/rss.php?version=2.0&amp;type=comments&amp;cid=35</wfw:commentRss>
    

    <author>nospam@example.com (Ralf Ertzinger)</author>
    <content:encoded>
    	&lt;p&gt;Just a note to myself, as I do not do this often enough to remember.&lt;/p&gt;

	&lt;p&gt;If you have a local &lt;span class=&quot;caps&quot;&gt;GIT&lt;/span&gt; repository (which has no remote so far, as it was only used for local development so far) and want to push it out to a remote repository, and make that repository the default for push and pull operations, here is how it&amp;#8217;s done.&lt;/p&gt;

	&lt;p&gt;This requires &lt;span class=&quot;caps&quot;&gt;GIT&lt;/span&gt; 1.7, and assumes the following:&lt;/p&gt;

	&lt;p&gt;	&lt;ul&gt;
		&lt;li&gt;The local branch tobe pushed is &lt;code&gt;master&lt;/code&gt;&lt;/li&gt;
		&lt;li&gt;The remote repo is accessible via &lt;code&gt;ssh://user@example.com/GIT/project.git&lt;/code&gt; and already contains a freshly created, bare&lt;/li&gt;
	&lt;/ul&gt;
 repo&lt;/p&gt;

	&lt;p&gt;First, add a remote to the local repository.&lt;/p&gt;

&lt;pre&gt;
$ git remote add origin ssh://user@example.com/GIT/project.git
&lt;/pre&gt;

	&lt;p&gt;This, by itself, does not do exacly much except to add a remote repository to your local repo config. The remote repo is called &lt;code&gt;origin&lt;/code&gt;, which is the default name git chooses if you &lt;code&gt;git clone&lt;/code&gt; from a remote repo. The remote repo is not associated with any local branches yet.&lt;/p&gt;

	&lt;p&gt;Second, push the accumulated local commits to the remote repo, designating the remote as the default for future push/pull operations.&lt;/p&gt;

&lt;pre&gt;
$ git push --set-upstream origin master
&lt;/pre&gt;

	&lt;p&gt;This will push the local master branch to the remote origin, creating a master branch there as well, and ties origin to the local master branch as the default for push and pull. Future &lt;code&gt;git pull&lt;/code&gt; and &lt;code&gt;git push&lt;/code&gt; will work without any specifications of local or remote branches.&lt;/p&gt; 
    </content:encoded>

    <pubDate>Tue, 19 Jul 2011 18:27:26 +0200</pubDate>
    <guid isPermaLink="false">http://www.skytale.net/blog/archives/35-guid.html</guid>
    
</item>
<item>
    <title>Building a multi OS USB boot stick, Part 1 (Windows)</title>
    <link>http://www.skytale.net/blog/archives/33-Building-a-multi-OS-USB-boot-stick,-Part-1-Windows.html</link>
            <category>Computer</category>
            <category>Linux</category>
            <category>Software</category>
            <category>Solaris</category>
            <category>Windows</category>
    
    <comments>http://www.skytale.net/blog/archives/33-Building-a-multi-OS-USB-boot-stick,-Part-1-Windows.html#comments</comments>
    <wfw:comment>http://www.skytale.net/blog/wfwcomment.php?cid=33</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.skytale.net/blog/rss.php?version=2.0&amp;type=comments&amp;cid=33</wfw:commentRss>
    

    <author>nospam@example.com (Ralf Ertzinger)</author>
    <content:encoded>
    	&lt;p&gt;Among the things I carry around is always a collection of &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; sticks, for various purposes. One of those is usually dedicated to a Linux rescue system, in order to get somehow broken systems back on their feet.&lt;/p&gt;

	&lt;p&gt;While it is possible these days to access non Linux systems from a booted Linux system any repair work beyond simple text file editing and file copying usually requires OS specific tools to get the job done. Thus it would be nice not only to have a Linux rescue system at hand, but a Windows one as well. And Solaris, while we&amp;#8217;re at it. And possibly some more.&lt;/p&gt;

	&lt;p&gt;&lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; sticks are cheap, at least in this part of the world. 10EUR will get you 4GB off the shelf in almost any electronics store, a little more money will get you 8GB ordered online. So space is not really an issue.&lt;/p&gt;

	&lt;p&gt;Actually installing an operating system in a way that allows it to boot off a removable media requires some specific preparations and tools in each case. This means that a running instance of that specific OS is needed to prepare the installation. This means that to get Windows to boot of an &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; stick a running Windows installation is needed. The same goes for Solaris and Linux.&lt;/p&gt;

	&lt;h3&gt;Preparations&lt;/h3&gt;

	&lt;p&gt;The &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; stick used for this exercise is a 4G Sandisk. This procedure will &lt;strong&gt;delete all data&lt;/strong&gt; currently on the stick, so either make sure there is nothing of any interest on it, or just get a new one.&lt;/p&gt;

	&lt;p&gt;The initial plan is to have Windows, Linux and Solaris boot off the stick. Each OS will get it&amp;#8217;s own partition, to keep possible clashes between the files of each system to a minimum (and because Solaris wants and &lt;span class=&quot;caps&quot;&gt;UFS&lt;/span&gt; partition, but more on that later).&lt;/p&gt;

	&lt;h3&gt;Installing Windows on &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt;&lt;/h3&gt;

	&lt;p&gt;The standard Windows installer does not allow for installation on &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; devices. The standard tool for those tasks is &lt;a href=&quot;http://www.nu2.nu/pebuilder/&quot;&gt;BartPE&lt;/a&gt;, a free tool to create so-called Preinstalled Environments. Those are actually a Microsoft supported way to preinstall an operating system on a PC, which is used by system builders to deliver machines with the OS already installed but not registered. The Microsoft tools to create these environments are not easily available, though, and this is where BartPE came in a few years ago. It&amp;#8217;s original purpose was to create Live CDs of Windows, but booting from &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; was added (experimentally) later.&lt;/p&gt;

	&lt;p&gt;While BartPE is a very valuable tool there is an even better one for this special purpose: &lt;a href=&quot;http://www.ubcd4win.com/&quot;&gt;The Ultimate Boot CD for Windows&lt;/a&gt;, which is basically a BartPE with a lot of useful tools already tacked to the side, and a completely reworked &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; installer.&lt;/p&gt;

	&lt;p&gt;To use &lt;span class=&quot;caps&quot;&gt;UBCD&lt;/span&gt; the following is needed:&lt;/p&gt;

	&lt;ul&gt;
		&lt;li&gt;The &lt;span class=&quot;caps&quot;&gt;UBCD&lt;/span&gt; installer, which weighs in at 255MB and is available from the projects site&lt;/li&gt;
		&lt;li&gt;A Windows XP install CD (32 bit)&lt;/li&gt;
		&lt;li&gt;Service Pack 3 for XP, if the Windows CD does not already include it&lt;/li&gt;
		&lt;li&gt;A license for the Windows version (this is more a legal than a technical problem, but the Windows install on the &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; stick needs a separate license to be legal)&lt;/li&gt;
		&lt;li&gt;Drivers&lt;/li&gt;
	&lt;/ul&gt;

	&lt;p&gt;The last point is especially interesting. &lt;span class=&quot;caps&quot;&gt;UBCD&lt;/span&gt; will take all drivers whichare contained in the Windows XP install CD, which, as everyone knows who tried to install XP on a reasonably recent machine, is not exactly much. While the &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; installed will boot (hopefully), access to hard disk drives on the machine or access to network interfaces may be severely limited due to missing drivers.&lt;/p&gt;

	&lt;p&gt;&lt;span class=&quot;caps&quot;&gt;UBCD&lt;/span&gt; already comes with a largeish selection of updated drivers for mass storage, &lt;span class=&quot;caps&quot;&gt;LAN&lt;/span&gt; and &lt;span class=&quot;caps&quot;&gt;WLAN&lt;/span&gt;, so simply building an image with the default settings has a good chance of working on a large number of modern machines (although the &lt;span class=&quot;caps&quot;&gt;WLAN&lt;/span&gt; drivers are disabled by default).&lt;/p&gt;

	&lt;h4&gt;Install procedure&lt;/h4&gt;

	&lt;ul&gt;
		&lt;li&gt;Make a copy of the Windows XP CD (that is, just copy all the files on it into a folder on the hard disk drive)&lt;/li&gt;
		&lt;li&gt;If the CD did not already contain a Windows copy patched to SP3 download the SP3 install package from Microsoft, and &lt;a href=&quot;http://www.howtohaven.com/system/slipstream-xp-service-pack-3.shtml&quot;&gt;slipstream the Service Pack into the copied files&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;Install &lt;span class=&quot;caps&quot;&gt;UBDC&lt;/span&gt;&lt;/li&gt;
		&lt;li&gt;Start &lt;span class=&quot;caps&quot;&gt;UBCD&lt;/span&gt; and enter the path to the copied Windows CD in the first field&lt;/li&gt;
		&lt;li&gt;Set Media Output to None&lt;/li&gt;
		&lt;li&gt;Click &amp;#8220;Build&amp;#8221;&lt;/li&gt;
	&lt;/ul&gt;

&lt;div class=&quot;serendipity_imageComment_center&quot; style=&quot;width: 509px&quot;&gt;&lt;div class=&quot;serendipity_imageComment_img&quot;&gt;&lt;!-- s9ymdb:31 --&gt;&lt;img class=&quot;serendipity_image_center&quot; width=&quot;509&quot; height=&quot;421&quot;  src=&quot;http://www.skytale.net/blog/uploads/ubcd1.png&quot;  alt=&quot;&quot; /&gt;&lt;/div&gt;&lt;div class=&quot;serendipity_imageComment_txt&quot;&gt;The &lt;span class=&quot;caps&quot;&gt;UBCD&lt;/span&gt; main screen&lt;/div&gt;&lt;/div&gt;

	&lt;p&gt;This will start a build process with the default settings, which are reasonable for a first build. &lt;span class=&quot;caps&quot;&gt;UBCD&lt;/span&gt; is very customizable, most of the options are available by clicking the &amp;#8220;Plugins&amp;#8221; button on the main screen. Describing the various things that can be done here is beyond this text, but the &lt;span class=&quot;caps&quot;&gt;UBCD&lt;/span&gt; home page has details on this.&lt;/p&gt;

	&lt;p&gt;After the build has finished plug in the &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; stick and start &lt;code&gt;ubusb.exe&lt;/code&gt; from the &lt;span class=&quot;caps&quot;&gt;UBCD&lt;/span&gt; install folder. To make things easier make sure no other &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; mass storage devices are connected. Set the options to match those in the screenshot below. Specifically:&lt;/p&gt;

	&lt;ul&gt;
		&lt;li&gt;Make sure the right &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; device is selected&lt;/li&gt;
		&lt;li&gt;Set the partition size to 2048MB (or 2GB)&lt;/li&gt;
		&lt;li&gt;Set the file system to FAT32-&lt;span class=&quot;caps&quot;&gt;LBA&lt;/span&gt;&lt;/li&gt;
		&lt;li&gt;Set the Boot Loader to grub4dos&lt;/li&gt;
		&lt;li&gt;Select the right BartPE folder (although it should pick up the correct one automatically)&lt;/li&gt;
		&lt;li&gt;Don&amp;#8217;t create a CD image&lt;/li&gt;
	&lt;/ul&gt;

&lt;div class=&quot;serendipity_imageComment_center&quot; style=&quot;width: 583px&quot;&gt;&lt;div class=&quot;serendipity_imageComment_img&quot;&gt;&lt;!-- s9ymdb:32 --&gt;&lt;img class=&quot;serendipity_image_center&quot; width=&quot;583&quot; height=&quot;554&quot;  src=&quot;http://www.skytale.net/blog/uploads/ubcd2.png&quot;  alt=&quot;&quot; /&gt;&lt;/div&gt;&lt;div class=&quot;serendipity_imageComment_txt&quot;&gt;&lt;span class=&quot;caps&quot;&gt;UBUSB&lt;/span&gt; main screen&lt;/div&gt;&lt;/div&gt;

	&lt;p&gt;Clicking &amp;#8220;Go&amp;#8221; will start the process of repartitioning, formattingand copying of data to the &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; stick. This may take a while.&lt;/p&gt;

	&lt;p&gt;After the process has finished (hopefully successful) the resulting &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; stick can immediately be tested, because &lt;span class=&quot;caps&quot;&gt;UBCD&lt;/span&gt; comes with a copy of &lt;a href=&quot;http://www.qemu.org&quot;&gt;qemu&lt;/a&gt;, which can emulate a PC. Just click the &amp;#8220;Test USB&amp;#8221; button, and a virtual PC will try to boot off the &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; stick just created.&lt;/p&gt;

&lt;div class=&quot;serendipity_imageComment_center&quot; style=&quot;width: 740px&quot;&gt;&lt;div class=&quot;serendipity_imageComment_img&quot;&gt;&lt;!-- s9ymdb:33 --&gt;&lt;img class=&quot;serendipity_image_center&quot; width=&quot;740&quot; height=&quot;438&quot;  src=&quot;http://www.skytale.net/blog/uploads/ubcd3.png&quot;  alt=&quot;&quot; /&gt;&lt;/div&gt;&lt;div class=&quot;serendipity_imageComment_txt&quot;&gt;&lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; boot menu&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;serendipity_imageComment_center&quot; style=&quot;width: 821px&quot;&gt;&lt;div class=&quot;serendipity_imageComment_img&quot;&gt;&lt;!-- s9ymdb:34 --&gt;&lt;img class=&quot;serendipity_image_center&quot; width=&quot;821&quot; height=&quot;638&quot;  src=&quot;http://www.skytale.net/blog/uploads/ubcd4.png&quot;  alt=&quot;&quot; /&gt;&lt;/div&gt;&lt;div class=&quot;serendipity_imageComment_txt&quot;&gt;Windows booted off the &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; stick in qemu&lt;/div&gt;&lt;/div&gt;

	&lt;p&gt;One down, two to go.&lt;/p&gt; 
    </content:encoded>

    <pubDate>Sun, 21 Mar 2010 18:23:49 +0100</pubDate>
    <guid isPermaLink="false">http://www.skytale.net/blog/archives/33-guid.html</guid>
    
</item>
<item>
    <title>Outgoing TLS verification in exim</title>
    <link>http://www.skytale.net/blog/archives/32-Outgoing-TLS-verification-in-exim.html</link>
            <category>Computer</category>
            <category>Software</category>
    
    <comments>http://www.skytale.net/blog/archives/32-Outgoing-TLS-verification-in-exim.html#comments</comments>
    <wfw:comment>http://www.skytale.net/blog/wfwcomment.php?cid=32</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.skytale.net/blog/rss.php?version=2.0&amp;type=comments&amp;cid=32</wfw:commentRss>
    

    <author>nospam@example.com (Ralf Ertzinger)</author>
    <content:encoded>
    	&lt;p&gt;&lt;a href=&quot;http://www.exim.org&quot;&gt;Exim&lt;/a&gt; is a mail server which suports &lt;span class=&quot;caps&quot;&gt;TLS&lt;/span&gt; for encrypted connections. This is supported for incoming connections as well as outgoing connections.&lt;/p&gt;

	&lt;p&gt;The support for outgoing connections is a bit useless in it&amp;#8217;s default setting, though:&lt;/p&gt;

	&lt;ul&gt;
		&lt;li&gt;If the remote server offers &lt;span class=&quot;caps&quot;&gt;TLS&lt;/span&gt; exim will negotiate an encrypted connection, but will not verify the certificate, rendering the encryption somewhat useless&lt;/li&gt;
		&lt;li&gt;If the remote side does not offer &lt;span class=&quot;caps&quot;&gt;TLS&lt;/span&gt; mail will be sent in plain text.&lt;/li&gt;
	&lt;/ul&gt;

	&lt;p&gt;All in all this is pretty useless from a security point of view. Making exim do the right thing requires some additions to the &lt;span class=&quot;caps&quot;&gt;SMTP&lt;/span&gt; transport (the following is sufficient for the default exim configuration on &lt;a href=&quot;http://www.centos.org&quot;&gt;CentOS&lt;/a&gt; systems):&lt;/p&gt;

&lt;pre&gt;
remote_smtp:
  driver = smtp
  hosts_require_tls = *
  tls_tempfail_tryclear = false
  tls_verify_certificates = /etc/pki/tls/certs
&lt;/pre&gt;

	&lt;p&gt;This forces exim to use &lt;span class=&quot;caps&quot;&gt;TLS&lt;/span&gt; for every outgoing connection (&lt;code&gt;hosts_require_tls = *&lt;/code&gt;), forbids fallback to clear text if &lt;span class=&quot;caps&quot;&gt;TLS&lt;/span&gt; does not work, (&lt;code&gt;tls_tempfail_tryclear = false&lt;/code&gt;) and points to a directory containing a trusted certificates (&lt;code&gt;tls_verify_certificates = /etc/pki/tls/certs&lt;/code&gt;).&lt;/p&gt;

	&lt;p&gt;The last parameter is the main reason for this article, as it does not exactly do what it says on the tin. The exim in CentOS is built against OpenSSL, and the OpenSSL libraries are built with &lt;code&gt;/etc/pki/tls/certs&lt;/code&gt; as the default search path for certificates. The documentation for the parameter says:&lt;/p&gt;

	&lt;p&gt;&lt;cite&gt;The value of this option must be the absolute path to a file containing permitted server certificates, for use when setting up an encrypted connection. Alternatively, if you are using OpenSSL, you can set tls_verify_certificates to the name of a directory containing certificate files. This does not work with GnuTLS; the option must be set to the name of a single file if you are using GnuTLS. The values of $host and $host_address are set to the name and address of the server during the expansion of this option. See chapter 39 for details of &lt;span class=&quot;caps&quot;&gt;TLS&lt;/span&gt;.&lt;/cite&gt;&lt;/p&gt;

	&lt;p&gt;The part missing from this is that the path set with &lt;code&gt;tls_verify_certificates&lt;/code&gt; is searched &lt;strong&gt;in addition&lt;/strong&gt; to the default certificate search path configured for OpenSSL. So if the OpenSSL default search path already contains all the certificates required, &lt;code&gt;tls_verify_certificates&lt;/code&gt; must be set to force exim to verify the certificates, but the value it is set to does not matter. For security reasons it ought to be set to the default OpenSSL search path, though, to prevent someone from maliciously adding more trusted certificates.&lt;/p&gt;

	&lt;p&gt;PS:&lt;br /&gt;
Doing this for a general purpose mail server is probably not a good idea, as many mail servers do not offer &lt;span class=&quot;caps&quot;&gt;TLS&lt;/span&gt;, and even if they do, their certificate may not be signed by a trusted (by the client) certificate authority. The mail server in question here will only send mail to a single host.&lt;/p&gt; 
    </content:encoded>

    <pubDate>Sun, 21 Mar 2010 14:37:01 +0100</pubDate>
    <guid isPermaLink="false">http://www.skytale.net/blog/archives/32-guid.html</guid>
    
</item>
<item>
    <title>Cisco VPN debugging by crystal ball</title>
    <link>http://www.skytale.net/blog/archives/31-Cisco-VPN-debugging-by-crystal-ball.html</link>
            <category>Cisco</category>
            <category>Computer</category>
            <category>Software</category>
    
    <comments>http://www.skytale.net/blog/archives/31-Cisco-VPN-debugging-by-crystal-ball.html#comments</comments>
    <wfw:comment>http://www.skytale.net/blog/wfwcomment.php?cid=31</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.skytale.net/blog/rss.php?version=2.0&amp;type=comments&amp;cid=31</wfw:commentRss>
    

    <author>nospam@example.com (Ralf Ertzinger)</author>
    <content:encoded>
    	&lt;p&gt;In the hope that google picks this up:&lt;/p&gt;

	&lt;p&gt;The problem space is a Cisco &lt;span class=&quot;caps&quot;&gt;PIX&lt;/span&gt; terminating an IPSec &lt;span class=&quot;caps&quot;&gt;VPN&lt;/span&gt; tunnel with a Checkpoint firewall on the other end. The tunnel does not work (the phase 2 setup fails). The Cisco logs the following debug messages:&lt;br /&gt;
&lt;pre&gt;
ISAKMP (0): processing SA payload. message ID = 1911693629
ISAKMP : Checking IPSec proposal 1
ISAKMP: transform 1, ESP_3DES
ISAKMP:   attributes in transform:
ISAKMP:      SA life type in seconds
ISAKMP:      SA life duration (VPI) of  0x0 0x0 0xe 0x10
ISAKMP:      authenticator is HMAC-SHA
ISAKMP:      encaps is 1
ISAKMP (0): atts are acceptable.
ISAKMP : Checking IPSec proposal 1
ISAKMP (0): atts not acceptable. Next payload is 0
ISAKMP (0): SA not acceptable!
ISAKMP (0): sending NOTIFY message 14 protocol 0
return status is IKMP_ERR_NO_RETRANS
&lt;/pre&gt;&lt;/p&gt;

	&lt;p&gt;The log message above was created by an incoming proposal (the remote end proposed a connection to the Cisco &lt;span class=&quot;caps&quot;&gt;PIX&lt;/span&gt;). This is useless and confusing at the same time. An IPSec proposal contains a list of parameters, sent by one end of the connection, specifying the parameters it is willing to use to establish a secure connection. This proposal specifies 3DES as the encryption algorithm, &lt;span class=&quot;caps&quot;&gt;SHA&lt;/span&gt; as a hash function, and a lifetime for the connection of 3600 seconds (after which the connection has to be renegotiated).&lt;/p&gt;

	&lt;p&gt;As can be seen, the &lt;span class=&quot;caps&quot;&gt;PIX&lt;/span&gt; accepts this proposal (as it should), since these parameters match those configured on the &lt;span class=&quot;caps&quot;&gt;PIX&lt;/span&gt; for this connection. It then goes on to check the same proposal again, just to reject it this time.&lt;/p&gt;

	&lt;p&gt;The completely non-obvious solution to this is to disable compression (which the &lt;span class=&quot;caps&quot;&gt;PIX&lt;/span&gt; does not support) on the Checkpoint. Why the &lt;span class=&quot;caps&quot;&gt;PIX&lt;/span&gt; is unable to even give me a hexdump of the offending parameter in the proposal I&amp;#8217;ll probably never know.&lt;/p&gt; 
    </content:encoded>

    <pubDate>Mon, 18 Jan 2010 10:37:14 +0100</pubDate>
    <guid isPermaLink="false">http://www.skytale.net/blog/archives/31-guid.html</guid>
    
</item>
<item>
    <title>Adding new dynamic library dependencies to an existing object</title>
    <link>http://www.skytale.net/blog/archives/28-Adding-new-dynamic-library-dependencies-to-an-existing-object.html</link>
            <category>Computer</category>
            <category>Software</category>
            <category>Solaris</category>
    
    <comments>http://www.skytale.net/blog/archives/28-Adding-new-dynamic-library-dependencies-to-an-existing-object.html#comments</comments>
    <wfw:comment>http://www.skytale.net/blog/wfwcomment.php?cid=28</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.skytale.net/blog/rss.php?version=2.0&amp;type=comments&amp;cid=28</wfw:commentRss>
    

    <author>nospam@example.com (Ralf Ertzinger)</author>
    <content:encoded>
    	&lt;p&gt;Due to some developing I needed a &lt;a href=&quot;http://www.lighttpd.net&quot;&gt;lighttpd&lt;/a&gt; with mod_magnet enabled. mod_magnet is a module which allows inserting of lua code into the request processing stream. This is a cool feature, and I was pleased to see that&lt;/p&gt;

	&lt;ul&gt;
		&lt;li&gt;lighttpd is on the standard Solaris install &lt;span class=&quot;caps&quot;&gt;DVD&lt;/span&gt;&lt;/li&gt;
		&lt;li&gt;mod_magnet is provided&lt;/li&gt;
	&lt;/ul&gt;

	&lt;p&gt;Of course there is this small problem:&lt;/p&gt;

&lt;pre&gt;
2009-12-29 23:29:31: (plugin.c.165) dlopen() failed for: /usr/lighttpd/1.4/lib/mod_magnet.soi
ld.so.1: lighttpd: fatal: relocation error: file /usr/lighttpd/1.4/lib/mod_magnet.so:
symbol luaL_checklstring: referenced symbol not found
&lt;/pre&gt;

	&lt;p&gt;What this means is that there are unresolved symbols remaining in the code after the dymanic loader has done it&amp;#8217;s work, which should not happen. Let&amp;#8217;s look a the dynamic deps of the module.&lt;/p&gt;

&lt;pre&gt;
$ ldd /usr/lighttpd/1.4/lib/mod_magnet.so
        libsendfile.so.1 =&amp;#62;      /lib/libsendfile.so.1
        libm.so.2 =&amp;#62;     /lib/libm.so.2
        libresolv.so.2 =&amp;#62;        /lib/libresolv.so.2
        libnsl.so.1 =&amp;#62;   /lib/libnsl.so.1
        libsocket.so.1 =&amp;#62;        /lib/libsocket.so.1
        libc.so.1 =&amp;#62;     /lib/libc.so.1
        libmd.so.1 =&amp;#62;    /lib/libmd.so.1
        libmp.so.2 =&amp;#62;    /lib/libmp.so.2
        libscf.so.1 =&amp;#62;   /lib/libscf.so.1
        libuutil.so.1 =&amp;#62;         /lib/libuutil.so.1
        libgen.so.1 =&amp;#62;   /lib/libgen.so.1
        libsmbios.so.1 =&amp;#62;        /usr/lib/libsmbios.so.1
&lt;/pre&gt;

	&lt;p&gt;Judging from the name of the missing symbol &lt;code&gt;luaL_checklstring&lt;/code&gt; it ought to come from some kind of lua library. But the listing above does not show any missing libraries, lest of all a lua one.&lt;/p&gt;

	&lt;p&gt;So what happened?&lt;/p&gt;

	&lt;p&gt;Somehow (and I have no idea how) Sun managed to build a mod_magnet without linking it to the lua libraries at the end. Simply speaking, this is broken.&lt;/p&gt;

	&lt;p&gt;Fortunately there is a way to fix this. Sun provides a utility called &lt;code&gt;elfedit(1)&lt;/code&gt; which allows the editing of &lt;span class=&quot;caps&quot;&gt;ELF&lt;/span&gt; file headers (like shared libraries). The lua library which provides the missing symbols is called &lt;code&gt;liblua.so&lt;/code&gt; (no version information). The type of record in an &lt;span class=&quot;caps&quot;&gt;ELF&lt;/span&gt; header which denotes the dynamic libraries needed is called DT_NEEDED. &lt;code&gt;elfedit(1)&lt;/code&gt; takes two parameters: the file to edit, and the file into which to write the modified version.&lt;/p&gt;

	&lt;p&gt;First show the existing DT_NEEDED records.&lt;/p&gt;

&lt;pre&gt;
$ elfedit mod_magnet.so mod_magnet2.so
&amp;#62; dyn:value DT_NEEDED
     index  tag                value
       [0]  NEEDED            0x5f9               libsendfile.so.1
       [1]  NEEDED            0x60a               libm.so.2
       [2]  NEEDED            0x614               libresolv.so.2
       [3]  NEEDED            0x623               libnsl.so.1
       [4]  NEEDED            0x62f               libsocket.so.1
       [5]  NEEDED            0x5d3               libc.so.1
&lt;/pre&gt;

	&lt;p&gt;This is basically the same list as above, with liblua.so notably lacking. Now add a new entry:&lt;/p&gt;

&lt;pre&gt;
&amp;#62; dyn:value -add -s DT_NEEDED liblua.so
     index  tag                value
      [34]  NEEDED            0x63e               liblua.so
&lt;/pre&gt;

	&lt;p&gt;Now look at the new table, and save it.&lt;/p&gt;

&lt;pre&gt;
&amp;#62; dyn:value DT_NEEDED
     index  tag                value
       [0]  NEEDED            0x5f9               libsendfile.so.1
       [1]  NEEDED            0x60a               libm.so.2
       [2]  NEEDED            0x614               libresolv.so.2
       [3]  NEEDED            0x623               libnsl.so.1
       [4]  NEEDED            0x62f               libsocket.so.1
       [5]  NEEDED            0x5d3               libc.so.1
      [34]  NEEDED            0x63e               liblua.so
&amp;#62; :write
&amp;#62; :quit
&lt;/pre&gt;

	&lt;p&gt;Looking at the &lt;code&gt;ldd(1)&lt;/code&gt; output, just to be sure.&lt;/p&gt;

&lt;pre&gt;
$ ldd ./mod_magnet2.so
        libsendfile.so.1 =&amp;#62;      /lib/libsendfile.so.1
        libm.so.2 =&amp;#62;     /lib/libm.so.2
        libresolv.so.2 =&amp;#62;        /lib/libresolv.so.2
        libnsl.so.1 =&amp;#62;   /lib/libnsl.so.1
        libsocket.so.1 =&amp;#62;        /lib/libsocket.so.1
        libc.so.1 =&amp;#62;     /lib/libc.so.1
        liblua.so =&amp;#62;     /usr/lib/liblua.so
        libmd.so.1 =&amp;#62;    /lib/libmd.so.1
        libmp.so.2 =&amp;#62;    /lib/libmp.so.2
        libscf.so.1 =&amp;#62;   /lib/libscf.so.1
        libdl.so.1 =&amp;#62;    /lib/libdl.so.1
        libuutil.so.1 =&amp;#62;         /lib/libuutil.so.1
        libgen.so.1 =&amp;#62;   /lib/libgen.so.1
        libsmbios.so.1 =&amp;#62;        /usr/lib/libsmbios.so.1
&lt;/pre&gt;

	&lt;p&gt;Now the linker picks up the lua libraries. If the modified mod_magnet.so is now put back into &lt;code&gt;/usr/lighttpd/1.4/lib&lt;/code&gt;, lighttpd will start and mod_magnet will work.&lt;/p&gt;

	&lt;p&gt;Now, this wasn&amp;#8217;t so hard, was it?&lt;/p&gt; 
    </content:encoded>

    <pubDate>Wed, 30 Dec 2009 15:34:59 +0100</pubDate>
    <guid isPermaLink="false">http://www.skytale.net/blog/archives/28-guid.html</guid>
    
</item>
<item>
    <title>Changing the rpool disk in Solaris</title>
    <link>http://www.skytale.net/blog/archives/27-Changing-the-rpool-disk-in-Solaris.html</link>
            <category>Computer</category>
            <category>Software</category>
            <category>Solaris</category>
    
    <comments>http://www.skytale.net/blog/archives/27-Changing-the-rpool-disk-in-Solaris.html#comments</comments>
    <wfw:comment>http://www.skytale.net/blog/wfwcomment.php?cid=27</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.skytale.net/blog/rss.php?version=2.0&amp;type=comments&amp;cid=27</wfw:commentRss>
    

    <author>nospam@example.com (Ralf Ertzinger)</author>
    <content:encoded>
    	&lt;p&gt;Ever since my storage system was built there was one thing that annoyed me. The 2.5&amp;#8221; hard disk drive that houses the operating system itself was lifted from an old notebook and had the annoying property of parking it&amp;#8217;s heads after five seconds of inactivity. Since &lt;span class=&quot;caps&quot;&gt;ZFS&lt;/span&gt; writes to the disk quite often and regularily this led to a constant cycle of parking and unparking. This was certainly not helping the disks life span, it made an annoying noise and it caused small system hangs whenever the disk had to unpark it&amp;#8217;s heads to read some data.&lt;/p&gt;

	&lt;p&gt;Under Linux one could use &lt;code&gt;hdparm&lt;/code&gt; to instruct the disk to not park it&amp;#8217;s heads, but unfortunately a program mimicking this functionality seems to be absent under Solaris. Thus the plan to replace the disk with a different one which had a more sensible apporoach to head parking.&lt;/p&gt;

	&lt;p&gt;This turned out to be an interesting endeavour.&lt;/p&gt;

	&lt;p&gt;The general problem of replacing the disk holding the rpool is common enough that the excellent &lt;a href=&quot;http://www.solarisinternals.com/wiki/index.php/ZFS_Troubleshooting_Guide#Replacing.2FRelabeling_the_Root_Pool_Disk&quot;&gt;&lt;span class=&quot;caps&quot;&gt;ZFS&lt;/span&gt; troubleshooting guide&lt;/a&gt; has a section on doing this. The general plan of action is as follows:&lt;/p&gt;

	&lt;ul&gt;
		&lt;li&gt;Insert the replacement disk into an available slot&lt;/li&gt;
		&lt;li&gt;Create a partition spanning the whole disk&lt;/li&gt;
		&lt;li&gt;Create boot and data slices&lt;/li&gt;
		&lt;li&gt;Attach the new disk as a mirror to the rpool&lt;/li&gt;
		&lt;li&gt;Wait for the resilver to finish&lt;/li&gt;
		&lt;li&gt;Install grub on the new disk&lt;/li&gt;
		&lt;li&gt;Try to boot from the new disk&lt;/li&gt;
		&lt;li&gt;Detach the old disk from the rpool&lt;/li&gt;
		&lt;li&gt;Remove the old disk&lt;/li&gt;
	&lt;/ul&gt;

	&lt;p&gt;This is all very sensible, and it all works as advertised. In my case there is, however, a last step not on the list above:&lt;/p&gt;

	&lt;ul&gt;
		&lt;li&gt;Put the new disk on the controller the old disk was attached to&lt;/li&gt;
	&lt;/ul&gt;

	&lt;p&gt;The reason for that is that the case I used only has one internal 2.5&amp;#8221; hard disk drive slot. The new disk was prepared using an external &lt;span class=&quot;caps&quot;&gt;USB-IDE&lt;/span&gt; converter module. This worked just fine, the &lt;span class=&quot;caps&quot;&gt;BIOS&lt;/span&gt; is even able to boot from the &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; disk. As long as the new disk remained attached to the &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; converter everything was fine, even after the old (internal) disk was removed from the rpool. But putting the new disk into the case caused Solaris to roll over and die early in the boot process due to not finding it&amp;#8217;s rpool disk. The error message indicated that it was trying to read the pool from the external &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; device (which no longer existed at this point).&lt;/p&gt;

	&lt;p&gt;Investigation (and much swearing) turned up that this information was passed by &lt;span class=&quot;caps&quot;&gt;GRUB&lt;/span&gt; to the Solaris kernel.&lt;/p&gt;

	&lt;p&gt;Solaris uses a patched &lt;span class=&quot;caps&quot;&gt;GRUB&lt;/span&gt; version which understands &lt;span class=&quot;caps&quot;&gt;ZFS&lt;/span&gt; and has some string replacement magic built in. Every (non failsafe) boot entry contains a line similar to this:&lt;/p&gt;

&lt;pre&gt;
kernel$ /platform/i86pc/kernel/$ISADIR/unix -B $ZFS-BOOTFS
&lt;/pre&gt;

	&lt;p&gt;&lt;code&gt;$ZFS-BOOTFS&lt;/code&gt; is replaced by &lt;span class=&quot;caps&quot;&gt;GRUB&lt;/span&gt; with the following information:&lt;/p&gt;

	&lt;ul&gt;
		&lt;li&gt;The name of the root pool (usually rpool) and the number of the dataset that contains the root file system (there may be several BEs)&lt;/li&gt;
		&lt;li&gt;The device path of the disk this &lt;span class=&quot;caps&quot;&gt;GRUB&lt;/span&gt; instance was read from&lt;/li&gt;
	&lt;/ul&gt;

	&lt;p&gt;The actual command line that is executed by &lt;span class=&quot;caps&quot;&gt;GRUB&lt;/span&gt; thus looks something like this:&lt;/p&gt;

&lt;pre&gt;
kernel /platform/i86pc/kernel/$ISADIR/unix -B zfs-bootfs=rpool/328 \
bootpath=&amp;#34;/pci@0,0/pci8086,2942@1c,1/pci-ide@0/ide@0/cmdk@0,0:a&amp;#34;
&lt;/pre&gt;

	&lt;p&gt;The interesting part here is the &lt;code&gt;bootpath&lt;/code&gt; parameter. This is the device that Solaris will try to mount the rpool from. Even if the rpool consists of several mirror devices, only one is used in the initial boot process. Where does &lt;span class=&quot;caps&quot;&gt;GRUB&lt;/span&gt; get the device path from? It&amp;#8217;s read from the rpool header, from the disk &lt;span class=&quot;caps&quot;&gt;GRUB&lt;/span&gt; was loaded from. Every &lt;span class=&quot;caps&quot;&gt;ZFS&lt;/span&gt; pool disk contains the device path it was last found under. This usually does not matter much, a &lt;span class=&quot;caps&quot;&gt;RAIDZ&lt;/span&gt; will still mount if you swap the disks around when the machine is off, but the boot process relies on the rpool disks not wandering around. My new disk still had the &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; device path embedded, which &lt;span class=&quot;caps&quot;&gt;GRUB&lt;/span&gt; read and passed to the kernel, which then failed to find the disk.&lt;/p&gt;

	&lt;p&gt;Fixing this turns out to be easy: boot into failsafe mode with the new disk on it&amp;#8217;s final connector. This will search for rpools and BEs on the system and offer to mount one of them. Pick the right one, reboot. This is enough to get the current (and correct) device path embedded into the rpool. The next (non failsafe) boot will thus pick up the correct device path and allow the boot to continue.&lt;/p&gt;

	&lt;p&gt;The morale of an afternoon thus spent in the innards of the Solaris boot process is thus: do not swap your rpool disk around.&lt;/p&gt; 
    </content:encoded>

    <pubDate>Fri, 25 Dec 2009 16:01:53 +0100</pubDate>
    <guid isPermaLink="false">http://www.skytale.net/blog/archives/27-guid.html</guid>
    
</item>
<item>
    <title>Creating a write only directory with SAMBA and ZFS</title>
    <link>http://www.skytale.net/blog/archives/26-Creating-a-write-only-directory-with-SAMBA-and-ZFS.html</link>
            <category>Computer</category>
            <category>Software</category>
            <category>Solaris</category>
    
    <comments>http://www.skytale.net/blog/archives/26-Creating-a-write-only-directory-with-SAMBA-and-ZFS.html#comments</comments>
    <wfw:comment>http://www.skytale.net/blog/wfwcomment.php?cid=26</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.skytale.net/blog/rss.php?version=2.0&amp;type=comments&amp;cid=26</wfw:commentRss>
    

    <author>nospam@example.com (Ralf Ertzinger)</author>
    <content:encoded>
    	&lt;p&gt;One of the intended uses of my OpenSolaris storage server was to serve as a &lt;a href=&quot;http://www.samba.org&quot;&gt;SAMBA&lt;/a&gt; accessible data store. Part of that role was the wish to have an &lt;code&gt;incoming&lt;/code&gt; directory modeled after similar directories found on many &lt;span class=&quot;caps&quot;&gt;FTP&lt;/span&gt; servers. In detail this meant a share with the following properties:&lt;/p&gt;

	&lt;ul&gt;
		&lt;li&gt;Readable for everyone (including unauthenticated users, i.e. guests)&lt;/li&gt;
		&lt;li&gt;Everyone can create new files and directories on the share&lt;/li&gt;
		&lt;li&gt;Only certain users can delete files and directories from the share&lt;/li&gt;
	&lt;/ul&gt;

	&lt;p&gt;So everyone can add files to the share, but removing them requires special privileges.&lt;/p&gt;

	&lt;p&gt;It turns out that this is impossible to do with normal &lt;span class=&quot;caps&quot;&gt;UNIX&lt;/span&gt; file system permissions, as for &lt;span class=&quot;caps&quot;&gt;UNIX&lt;/span&gt; creating a file (which is a write operation on a directory) is much the same as deleting one (which is a write operation on a directory).&lt;/p&gt;

	&lt;p&gt;Fortunately OpenSolaris supports a much more powerful file operation permission language in the form of NFSv4 permissions.&lt;/p&gt;

	&lt;p&gt;It has been said that the NFSv4 permission system has been modeled after a smudged copy of the Windows &lt;span class=&quot;caps&quot;&gt;NTFS&lt;/span&gt; permission system, and there is certainly merit to that claim, which is not a bad thing. The &lt;span class=&quot;caps&quot;&gt;NTFS&lt;/span&gt; permission system is much more expressive than the standard &lt;span class=&quot;caps&quot;&gt;UNIX&lt;/span&gt; system, as it has more actions (besides writing, reading and executing it also knows about deleting, for example), can support a large number of principals with different permissions and can actively deny an action (which is different from &amp;#8220;not allowing&amp;#8221;).&lt;/p&gt;

	&lt;h3&gt;NFSv4 permissions&lt;/h3&gt;

	&lt;p&gt;The NFSv4 system knows about the following actions:&lt;/p&gt;

	&lt;table&gt;
		&lt;tr&gt;
			&lt;th&gt;Action &lt;/th&gt;
			&lt;th&gt;Description for files &lt;/th&gt;
			&lt;th&gt;Description for directories &lt;/th&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; read data &lt;/td&gt;
			&lt;td&gt; Read file contents &lt;/td&gt;
			&lt;td&gt; List directory contents &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; write data &lt;/td&gt;
			&lt;td&gt; Write file contents (anywhere in the file) &lt;/td&gt;
			&lt;td&gt; Create new files &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; execute &lt;/td&gt;
			&lt;td&gt; Execute file &lt;/td&gt;
			&lt;td&gt; Change into directory &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; append &lt;/td&gt;
			&lt;td&gt; Append data to file &lt;/td&gt;
			&lt;td&gt; Create new directories &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; delete &lt;/td&gt;
			&lt;td&gt; Delete the file &lt;/td&gt;
			&lt;td&gt; &amp;#8211; &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; delete child &lt;/td&gt;
			&lt;td&gt; &amp;#8211; &lt;/td&gt;
			&lt;td&gt; Delete a file in the directory &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; read/write attributes &lt;/td&gt;
			&lt;td&gt; Read/write basic attributes &lt;/td&gt;
			&lt;td&gt; (same as file) &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; read/write xattrs &lt;/td&gt;
			&lt;td&gt; Read/write extended attributes &lt;/td&gt;
			&lt;td&gt; (same as file) &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; read/write &lt;span class=&quot;caps&quot;&gt;ACL&lt;/span&gt; &lt;/td&gt;
			&lt;td&gt; Read/write ACLs &lt;/td&gt;
			&lt;td&gt; (same as file) &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; change owner &lt;/td&gt;
			&lt;td&gt; Change the owner &lt;/td&gt;
			&lt;td&gt; (same as file) &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; sync &lt;/td&gt;
			&lt;td&gt; Use syncronous file access &lt;/td&gt;
			&lt;td&gt; &amp;#8211; &lt;/td&gt;
		&lt;/tr&gt;
	&lt;/table&gt;

	&lt;p&gt;NFSv4 also contains a mechanism to specify actions that apply to a file or directory, and actions that are inherited to child objects of a directory (i.e. files or subdirectories). This allows very fine grained control of file system access.&lt;/p&gt;

	&lt;p&gt;Of special interest here are the bits about writing, appending and deleting files and folders.&lt;/p&gt;

	&lt;p&gt;The ACLs are maintained in a list of entries, each entry mapping a username/action pair to a verdict (allow/deny). Each access is matched against each entry in&lt;br /&gt;
turn, and the verdict is taken from the first entry to match. So the order of entries is important.&lt;/p&gt;

	&lt;p&gt;Solaris&amp;#8217; &lt;code&gt;ls&lt;/code&gt; has two extensions to list those ACLs: &lt;code&gt;-v&lt;/code&gt; for a verbose listing and &lt;code&gt;-V&lt;/code&gt; for a concise listing. The format used by &lt;code&gt;-V&lt;/code&gt; can be passed to &lt;code&gt;chmod&lt;/code&gt; to change ACLs.&lt;/p&gt;

	&lt;p&gt;The permissions corresponding to the list of requirements stated above are as follows (&lt;code&gt;/tank/share/incoming&lt;/code&gt; is the directory associated with the &lt;code&gt;incoming&lt;/code&gt; share in &lt;code&gt;smb.conf&lt;/code&gt;):&lt;/p&gt;

&lt;pre&gt;
# ls -lVd /tank/share/incoming
drwxrwxrwx+  5 root     root           6 Dec 12 16:49 /tank/share/incoming
               user:sun:-w--dD--------:fdi----:allow
               user:sun:-w--dD--------:-------:allow
              everyone@:-w--dD--------:f-i----:deny
              everyone@:----dD--------:-di----:deny
              everyone@:----dD--------:-------:deny
              everyone@:rwxp--a-R-c--s:-di----:allow
              everyone@:r-xp--a-R-c--s:f-i----:allow
              everyone@:rwxp--a-R-c--s:-------:allow
#
&lt;/pre&gt;

	&lt;p&gt;There are two kinds of entries in this list. Those with an &lt;code&gt;i&lt;/code&gt; in the second part of the action list and those without. The entries with an &lt;code&gt;i&lt;/code&gt; are so called &amp;#8220;inherit only&amp;#8221; entries. They do not apply to the file or directory they are associated with, but are only inherited to new child entries. The other entries apply to the file/directory they are associated with. &lt;/p&gt;

	&lt;p&gt;This list can be read in three blocks:&lt;/p&gt;

	&lt;p&gt;The first block consists of the first two lines. The first line specifies that the right to delete files (&lt;code&gt;d&lt;/code&gt;), delete child entries (&lt;code&gt;D&lt;/code&gt;) and create new files/write file content (&lt;code&gt;w&lt;/code&gt;) for the user named &lt;code&gt;sun&lt;/code&gt; is inherited to new files and directories (&lt;code&gt;fdi&lt;/code&gt;). This makes sure that this user can always remove files and directories, and overwrite existing file content in newly created files. The second line applies the same rights to the &lt;code&gt;incoming&lt;/code&gt; directory itself.&lt;/p&gt;

	&lt;p&gt;The second block consists of lines 3 to 5 and contains only deny statements. They apply to &lt;code&gt;everyone@&lt;/code&gt;, which means exactly what it says on the box. Lines 3 and 4 again deal with rights that are to be inherited to child objects, but the rights inherited to files and directories are different this time. Files inherit a deny to write anywhere in the file (&lt;code&gt;w&lt;/code&gt;) and file deletion (&lt;code&gt;dD&lt;/code&gt;). Directories just inherit the deletion part, otherwise new files could not be created in subdirectories (which needs the &lt;code&gt;w&lt;/code&gt; right). The &lt;code&gt;incoming&lt;/code&gt; directory itself gets the &amp;#8220;no deletion&amp;#8221; treatment as well.&lt;/p&gt;

	&lt;p&gt;The third block consists of the last three lines and restores some rights to non privileged users. Directories inherit the right to be read (&lt;code&gt;r&lt;/code&gt;), changed though (&lt;code&gt;x&amp;#60;/code), new files and subdirectories can be created (&amp;#60;code&amp;#62;rp&amp;#60;/code), and attributes of all sorts can be read (&amp;#60;code&amp;#62;aRc&lt;/code&gt;). We also allow synchronous file access (&lt;code&gt;s&lt;/code&gt;). Files are much the same, except that the write anywhere right is missing. Not that it would matter much if that were allowed here, since it has been explicitly denied earlier. Note that the right to append to a file (&lt;code&gt;p&lt;/code&gt;) is explicity allowed. The rights for the &lt;code&gt;incoming&lt;/code&gt; directory itself (last line) again match those inherited to subdirectories.&lt;/p&gt;

	&lt;p&gt;Let&amp;#8217;s see if that works out.&lt;/p&gt;

&lt;pre&gt;
$ id
uid=60003(smbnobody) gid=60003(smbnobody)
$ touch /tank/share/incoming/foo
$ ls -V /tank/share/incoming/foo
-r-xr-xr-x+  1 smbnobody   smbnobody         0 Dec 12 18:33 /tank/share/incoming/foo
               user:sun:-w--dD--------:------I:allow
              everyone@:-w--dD--------:------I:deny
              everyone@:r-xp--a-R-c--s:------I:allow
&lt;/pre&gt;

	&lt;p&gt;The unprivileged user &lt;code&gt;smbnobody&lt;/code&gt; (&lt;span class=&quot;caps&quot;&gt;SMB&lt;/span&gt; guest access is mapped to this uid) can create a new file in the incoming directory, and the file inherits the rights mentioned above (&lt;code&gt;I&lt;/code&gt; signifies an inherited right).&lt;/p&gt;

&lt;pre&gt;
$ cat /etc/passwd &amp;#62; /tank/share/incoming/foo
bash: /tank/share/incoming/foo: Permission denied
$ cat /etc/passwd &amp;#62;&amp;#62; /tank/share/incoming/foo
$
&lt;/pre&gt;

	&lt;p&gt;The user cannot overwrite the file (even though it is empty), but he can append to it.&lt;/p&gt;

&lt;pre&gt;
$ rm /tank/share/incoming/foo
rm: /tank/share/incoming/foo: override protection 555 (yes/no)? y
rm: /tank/share/incoming/foo not removed: Permission denied
$
&lt;/pre&gt;

	&lt;p&gt;Deletion is also denied. Good.&lt;/p&gt;

&lt;pre&gt;
$ id
uid=500(sun) gid=100(users)
$ cat /etc/passwd &amp;#62; /tank/share/incoming/foo
$ rm /tank/share/incoming/foo
$
&lt;/pre&gt;

	&lt;p&gt;However, the privileged user &lt;code&gt;sun&lt;/code&gt; can overwrite and delete the file.&lt;/p&gt;

	&lt;h3&gt;Samba configuration&lt;/h3&gt;

	&lt;p&gt;Samba also needs configuration to recognize and use the extended parmission system. The following is an excerpt from &lt;code&gt;smb.conf&lt;/code&gt;, describing the &lt;code&gt;incoming&lt;/code&gt; share:&lt;/p&gt;

&lt;pre&gt;
[incoming]
        path = /tank/share/incoming
        writable = yes
        guest ok = yes
        browseable = yes
        public = yes
        acl check permissions = False
        ea support = yes
        store dos attributes = no
        map readonly = no
        map archive = no
        map system = no
        map hidden = no
        vfs objects = zfsacl
        nfs4: mode = simple
        nfs4: acedup = dontcare
&lt;/pre&gt;

	&lt;p&gt;This configures Samba to use extended ACLs using the &lt;span class=&quot;caps&quot;&gt;ZFS&lt;/span&gt; (NFSv4) permission system.&lt;/p&gt; 
    </content:encoded>

    <pubDate>Sat, 12 Dec 2009 18:57:28 +0100</pubDate>
    <guid isPermaLink="false">http://www.skytale.net/blog/archives/26-guid.html</guid>
    
</item>
<item>
    <title>Access problems with Apache server-status</title>
    <link>http://www.skytale.net/blog/archives/25-Access-problems-with-Apache-server-status.html</link>
            <category>Computer</category>
            <category>Software</category>
    
    <comments>http://www.skytale.net/blog/archives/25-Access-problems-with-Apache-server-status.html#comments</comments>
    <wfw:comment>http://www.skytale.net/blog/wfwcomment.php?cid=25</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.skytale.net/blog/rss.php?version=2.0&amp;type=comments&amp;cid=25</wfw:commentRss>
    

    <author>nospam@example.com (Ralf Ertzinger)</author>
    <content:encoded>
    	&lt;p&gt;Since I have twice now spent considerable time on debugging this:&lt;/p&gt;

	&lt;p&gt;If you have configured an Apache &lt;code&gt;server-status&lt;/code&gt; handler, but retrieving the &lt;span class=&quot;caps&quot;&gt;URL&lt;/span&gt; bound to this handler results in access denied even though there are no access restrictions configured on the container (bad idea, by the way), or the connecting IP is allowed access, make sure that the webserver can access it&amp;#8217;s document root.&lt;/p&gt;

	&lt;p&gt;This may seem obvious, but if the Apache is configured as a reverse proxy there may not be any files in the document root, because all content is created by the backend servers (or virtual handlers, like &lt;code&gt;server-status&lt;/code&gt;). Nonetheless the Apache server must be able to change into the document root, or the virtual handlers will fail (reverse proxy access will work, however).&lt;/p&gt; 
    </content:encoded>

    <pubDate>Wed, 02 Dec 2009 14:17:15 +0100</pubDate>
    <guid isPermaLink="false">http://www.skytale.net/blog/archives/25-guid.html</guid>
    
</item>
<item>
    <title>Resetting SATA devices under Linux</title>
    <link>http://www.skytale.net/blog/archives/24-Resetting-SATA-devices-under-Linux.html</link>
            <category>Computer</category>
            <category>Hardware</category>
            <category>Linux</category>
    
    <comments>http://www.skytale.net/blog/archives/24-Resetting-SATA-devices-under-Linux.html#comments</comments>
    <wfw:comment>http://www.skytale.net/blog/wfwcomment.php?cid=24</wfw:comment>

    <slash:comments>1</slash:comments>
    <wfw:commentRss>http://www.skytale.net/blog/rss.php?version=2.0&amp;type=comments&amp;cid=24</wfw:commentRss>
    

    <author>nospam@example.com (Ralf Ertzinger)</author>
    <content:encoded>
    	&lt;p&gt;Note: this was tested only on &lt;span class=&quot;caps&quot;&gt;SATA&lt;/span&gt; attached optical drives, not on hard disks. Removing a hard disk with mounted partitions on it (directly or indirectly) is probably not a very smart idea.&lt;/p&gt;

	&lt;p&gt;A device name of &lt;code&gt;/dev/sr0&lt;/code&gt; is assumed.&lt;/p&gt;

	&lt;ul&gt;
		&lt;li&gt;Find out which controller the device is attached to (we&amp;#8217;ll need this later):&lt;/li&gt;
	&lt;/ul&gt;

&lt;pre&gt;
# readlink /sys/block/sr0
../devices/pci0000:00/0000:00:1f.2/host1/target1:0:0/1:0:0:0/block/sr0
&lt;/pre&gt;

	&lt;p&gt;The interesting part if the answer is &lt;code&gt;host1&lt;/code&gt;, which identifies the controller.&lt;/p&gt;

	&lt;ul&gt;
		&lt;li&gt;Disconnect the device&lt;/li&gt;
	&lt;/ul&gt;

&lt;pre&gt;
# echo 1 &amp;#62; /sys/block/sr0/device/delete
&lt;/pre&gt;

	&lt;p&gt;This will remove the device from the bus (logically). Look in &lt;code&gt;dmesg&lt;/code&gt; for confirmation.&lt;/p&gt;

	&lt;ul&gt;
		&lt;li&gt;Rescan the controller&lt;/li&gt;
	&lt;/ul&gt;

&lt;pre&gt;
# echo &amp;#34;- - -&amp;#34; &amp;#62; /sys/class/scsi_host/host1/scan
&lt;/pre&gt;

	&lt;p&gt;&lt;code&gt;host1&lt;/code&gt; is the identifier from step one. Again, &lt;code&gt;dmesg&lt;/code&gt; should show the device being rediscovered.&lt;/p&gt; 
    </content:encoded>

    <pubDate>Wed, 18 Nov 2009 13:36:49 +0100</pubDate>
    <guid isPermaLink="false">http://www.skytale.net/blog/archives/24-guid.html</guid>
    
</item>
<item>
    <title>Manual IMAP</title>
    <link>http://www.skytale.net/blog/archives/23-Manual-IMAP.html</link>
            <category>Computer</category>
            <category>Software</category>
    
    <comments>http://www.skytale.net/blog/archives/23-Manual-IMAP.html#comments</comments>
    <wfw:comment>http://www.skytale.net/blog/wfwcomment.php?cid=23</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.skytale.net/blog/rss.php?version=2.0&amp;type=comments&amp;cid=23</wfw:commentRss>
    

    <author>nospam@example.com (Ralf Ertzinger)</author>
    <content:encoded>
    	&lt;p&gt;From time to time I am in the unfortunate situation of having to manually communicate with an &lt;span class=&quot;caps&quot;&gt;IMAP&lt;/span&gt; server (in other words: reading mail via telnet).&lt;/p&gt;

	&lt;p&gt;Due to the nature of &lt;span class=&quot;caps&quot;&gt;IMAP&lt;/span&gt; this is not remotely as simple as reading mail via telnet using the POP3 protocol, however, as &lt;span class=&quot;caps&quot;&gt;IMAP&lt;/span&gt; is a very rich and powerful protocol with a quirky syntax.&lt;/p&gt;

	&lt;p&gt;As I tend to forget the commands for the most important tasks it might be a good idea to write them down.&lt;/p&gt;

	&lt;p&gt;Some definitions:&lt;/p&gt;

	&lt;p&gt;&lt;span class=&quot;caps&quot;&gt;IMAP&lt;/span&gt; handles &lt;strong&gt;messages&lt;/strong&gt;. Messages live in &lt;strong&gt;folders&lt;/strong&gt;, which can have &lt;strong&gt;subfolders&lt;/strong&gt;. Folders are separated by &lt;strong&gt;separators&lt;/strong&gt;. Multiple groups of folders can exist, those groups are called &lt;strong&gt;namespaces&lt;/strong&gt;. At least one namespace always exists. Within every folder each message has two &lt;strong&gt;identifiers&lt;/strong&gt; (both are positive integers). The first (the &lt;strong&gt;sequence number&lt;/strong&gt;) is valid only as long as the current folder is &lt;strong&gt;selected&lt;/strong&gt; (or open, in other words), and ranges from 1 to N, N being the number of messages in the folder. The second (the &lt;strong&gt;UID&lt;/strong&gt;) does not change from one selection to the next, and usually not between connects. Ideally, the &lt;span class=&quot;caps&quot;&gt;UID&lt;/span&gt; for a message never changes once it has been assigned. The &lt;span class=&quot;caps&quot;&gt;IMAP&lt;/span&gt; server is free to assign a new &lt;span class=&quot;caps&quot;&gt;UID&lt;/span&gt; to a message, but it must tell the client if it does so.&lt;/p&gt;

	&lt;p&gt;Each &lt;strong&gt;request&lt;/strong&gt; from a client starts with a &lt;strong&gt;tag&lt;/strong&gt;, which is a group of characters consisting of letters, numbers and the dot (&amp;#8221;.&amp;#8221;). The server &lt;strong&gt;reply&lt;/strong&gt; consists of at least one line, but may consist of several. In the latter case, each line starts with an asterisk (*), except for the last, which starts with the tag chosen by the client. This signals the completion of the command. If the server reply is one lined, only the line starting with the client tag is sent. The client may reuse tags if it wishes. The protocol is not synchronous, the client can send several requests without waiting for the server to complete the preceding command.&lt;/p&gt;

	&lt;p&gt;Unless the client or the server indicate otherwise the default character set for &lt;span class=&quot;caps&quot;&gt;IMAP&lt;/span&gt; is UTF7 (which, as long as you keep to the first 128 characters of the &lt;span class=&quot;caps&quot;&gt;ASCII&lt;/span&gt; character set, is exactly the same as &lt;span class=&quot;caps&quot;&gt;ASCII&lt;/span&gt; or UTF8).&lt;/p&gt;

	&lt;p&gt;Requests and replies consist of a space separated list of keywords and &lt;strong&gt;strings&lt;/strong&gt;. Strings can be written in two forms, &lt;strong&gt;quoted&lt;/strong&gt; and &lt;strong&gt;literal&lt;/strong&gt;. Quoted strings can consist of any 7-bit-characters, except &lt;code&gt;CR&lt;/code&gt; and &lt;code&gt;LF&lt;/code&gt;, enclosed by &lt;code&gt;&amp;#34;&lt;/code&gt;. If the quoted string contains the character &lt;code&gt;&amp;#34;&lt;/code&gt; itself it&lt;br /&gt;
must be quoted as &lt;code&gt;\&amp;#34;&lt;/code&gt;.&lt;/p&gt;

	&lt;p&gt;Literal strings start with the number of characters in the string, enclosed by curly braces, and a &lt;code&gt;CRLF&lt;/code&gt;. The string characters then follow.&lt;/p&gt;

	&lt;p&gt;That ought to be enough to make sense of the following:&lt;/p&gt;

	&lt;h3&gt;Login&lt;/h3&gt;

	&lt;p&gt;Assuming the server supports plain text logins (indicated by &lt;code&gt;AUTH=LOGIN&lt;/code&gt; in the server greeting:&lt;/p&gt;

&lt;pre&gt;
$ telnet mailserver 143
[...]
* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID AUTH=LOGIN AUTH=PLAIN AUTH=CRAM-MD5 SASL-IR]
mailserver Cyrus IMAP4 v2.3.7-Invoca-RPM-2.3.7-7.el5_4.3 server ready
foo login user password
foo OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID LOGINDISABLED ACL RIGHTS=kxte QUOTA MAILBOX-REFERRALS
NAMESPACE UIDPLUS NO_ATOMIC_RENAME UNSELECT CHILDREN MULTIAPPEND BINARY SORT SORT=MODSEQ
THREAD=ORDEREDSUBJECT THREAD=REFERENCES ANNOTATEMORE CATENATE CONDSTORE IDLE LISTEXT
LIST-SUBSCRIBED X-NETSCAPE URLAUTH] User logged in
&lt;/pre&gt;

	&lt;p&gt;In this example the login user name was &lt;code&gt;user&lt;/code&gt; and the password was &lt;code&gt;password&lt;/code&gt;. The tag chosen by the client (i.e. the person using telnet) was &lt;code&gt;foo&lt;/code&gt;, which was echoed by the server in the login response. From now on the tag used will be the dot (&amp;#8221;.&amp;#8221;), unless specified otherwise.&lt;/p&gt;

	&lt;h3&gt;Namespaces&lt;/h3&gt;

	&lt;p&gt;Several groups of folders can exists, these groups are called namespaces. One use is the implementation of shared folders such that the private folders of a user live in one namespace, and the shared folders in another. To list the available namespaces:&lt;/p&gt;

&lt;pre&gt;
. NAMESPACE
* NAMESPACE ((&amp;#34;INBOX.&amp;#34; &amp;#34;.&amp;#34;)) ((&amp;#34;user.&amp;#34; &amp;#34;.&amp;#34;)) ((&amp;#34;&amp;#34; &amp;#34;.&amp;#34;))
. OK Completed
&lt;/pre&gt;

	&lt;p&gt;This user has access to three namespaces: &lt;code&gt;INBOX&lt;/code&gt;, &lt;code&gt;user&lt;/code&gt; and a namespace without a name. The latter is the default name space. The dot (&amp;#8221;.&amp;#8221;) after the name is the separator used in this namespace.&lt;/p&gt;

	&lt;h3&gt;Listing folders&lt;/h3&gt;

	&lt;p&gt;Listing folders within a namespace requires the namespace to be listed, and a pattern describing the required names. The pattern supports wildcards, especially &amp;#8220;*&amp;#8221; (list subfolders, recursively) and &amp;#8220;%&amp;#8221; (list subfolders, not recursively).&lt;/p&gt;

&lt;pre&gt;
. LIST &amp;#34;&amp;#34; &amp;#34;INBOX.%&amp;#34;
* LIST (\HasNoChildren) &amp;#34;.&amp;#34; &amp;#34;INBOX.Folder1&amp;#34;
* LIST (\HasNoChildren) &amp;#34;.&amp;#34; &amp;#34;INBOX.Folder2&amp;#34;
* LIST (\HasChildren) &amp;#34;.&amp;#34; &amp;#34;INBOX.Folder3&amp;#34;
. OK Completed
&lt;/pre&gt;

	&lt;p&gt;This &lt;code&gt;INBOX&lt;/code&gt; folder has three subfolders: &lt;code&gt;Folder1&lt;/code&gt; and &lt;code&gt;Folder2&lt;/code&gt;, both of which have no subfolders, as indicated by the &lt;code&gt;\HasNoChildren&lt;/code&gt; flag, and one (&lt;code&gt;Folder3&lt;/code&gt;) which has. Because of the &amp;#8220;%&amp;#8221; wildcard the subfolders of &lt;code&gt;Folder3&lt;/code&gt; are not shown in this listing.&lt;/p&gt;

	&lt;p&gt;In general, it is usually not a good idea to list folders using &amp;#8220;*&amp;#8221;. This may return a list containing potentially thousands of folders (think of systems redistributing Usenet news via &lt;span class=&quot;caps&quot;&gt;IMAP&lt;/span&gt;). Instead use &amp;#8220;%&amp;#8221; to descend the folders considered interesting.&lt;/p&gt;

	&lt;h3&gt;Selecting folders&lt;/h3&gt;

	&lt;p&gt;In order to read messages the folder containing those must be activated first. This requires the full folder name as returned by &lt;code&gt;LIST&lt;/code&gt;.&lt;/p&gt;

&lt;pre&gt;
. SELECT &amp;#34;INBOX&amp;#34;
* FLAGS (\Answered \Flagged \Draft \Deleted \Seen NonJunk Junk $NotJunk $Junk $Forwarded)
* OK [PERMANENTFLAGS (\Answered \Flagged \Draft \Deleted \Seen NonJunk Junk $NotJunk $Junk $Forwarded \*)]  
* 5966 EXISTS
* 0 RECENT
* OK [UIDVALIDITY 1136990532]
* OK [UIDNEXT 12498]
* OK [NOMODSEQ] Sorry, modsequences have not been enabled on this mailbox
. OK [READ-WRITE] Completed
&lt;/pre&gt;

	&lt;p&gt;This folder contains 5966 messages (&lt;code&gt;5966 EXISTS&lt;/code&gt;), zero of which are unread (&lt;code&gt;0 RECENT&lt;/code&gt;). The &lt;code&gt;UIDVALIDITY&lt;/code&gt; parameter is an integer describing the validity of the &lt;span class=&quot;caps&quot;&gt;UID&lt;/span&gt; numbers assigned to the messages. As long as this number does not change the mapping from message to &lt;span class=&quot;caps&quot;&gt;UID&lt;/span&gt; has not changed.&lt;/p&gt;

	&lt;h3&gt;Finding messages&lt;/h3&gt;

	&lt;p&gt;Unlike POP3 &lt;span class=&quot;caps&quot;&gt;IMAP&lt;/span&gt; servers actually try to parse the messages stored in the folders in order to extract some information from the headers, such as sender address, recipient address, messageid and general message structure (such as attachments). The reason and upshot of this is that the server can search for messages having certain properties (for example, all messages by a certain sender) without having the client download all messages and doing the search itself. There are two search commands (&lt;code&gt;SEARCH&lt;/code&gt; and &lt;code&gt;UID SEARCH&lt;/code&gt;) which differ in the results they return. The first command returns sequence numbers, the second returns message UIDs.&lt;/p&gt;

	&lt;p&gt;Multiple search conditions can be used in one search request, those are ANDed (i.e., all have to be satisfied).&lt;/p&gt;

	&lt;p&gt;A small table of possible search conditions:&lt;/p&gt;

	&lt;table&gt;
		&lt;tr&gt;
			&lt;th&gt;Query &lt;/th&gt;
			&lt;th&gt;Looking for &lt;/th&gt;
			&lt;th&gt;Example &lt;/th&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; &lt;code&gt;FROM &amp;#34;&amp;#60;mailaddress&amp;#62;&amp;#34;&lt;/code&gt; &lt;/td&gt;
			&lt;td&gt; Mail from that sender &lt;/td&gt;
			&lt;td&gt; &lt;code&gt;FROM &amp;#34;user@example.org&amp;#34;&lt;/code&gt; &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; &lt;code&gt;TO &amp;#34;&amp;#60;mailaddress&amp;#62;&amp;#34;&lt;/code&gt; &lt;/td&gt;
			&lt;td&gt; Mail to that recipient &lt;/td&gt;
			&lt;td&gt; &lt;code&gt;TO &amp;#34;user@example.org&amp;#34;&lt;/code&gt; &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; &lt;code&gt;SINCE &amp;#60;date&amp;#62;&lt;/code&gt; &lt;/td&gt;
			&lt;td&gt; Mail received after this date &lt;/td&gt;
			&lt;td&gt; &lt;code&gt;SINCE 1-Nov-2009&lt;/code&gt; &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; &lt;code&gt;BEFORE &amp;#60;date&amp;#62;&lt;/code&gt; &lt;/td&gt;
			&lt;td&gt; Mail received before this date &lt;/td&gt;
			&lt;td&gt; &lt;code&gt;BEFORE 1-Nov-2009&lt;/code&gt; &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; &lt;code&gt;DELETED&lt;/code&gt; &lt;/td&gt;
			&lt;td&gt; Mails marked as deleted &lt;/td&gt;
			&lt;td&gt; &lt;code&gt;DELETED&lt;/code&gt; &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; &lt;code&gt;SUBJECT &amp;#60;string&amp;#62;&lt;/code&gt; &lt;/td&gt;
			&lt;td&gt; Mails containing string in the subject &lt;/td&gt;
			&lt;td&gt; &lt;code&gt;SUBJECT &amp;#34;Proposal&amp;#34;&lt;/code&gt; &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; &lt;code&gt;BODY &amp;#60;string&amp;#62;&lt;/code&gt; &lt;/td&gt;
			&lt;td&gt; Mails containing string in the body &lt;/td&gt;
			&lt;td&gt; &lt;code&gt;BODY &amp;#34;Hello Greg&amp;#34;&lt;/code&gt; &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; &lt;code&gt;NOT &amp;#60;key&amp;#62;&lt;/code&gt; &lt;/td&gt;
			&lt;td&gt; Mails which do not match the key &lt;/td&gt;
			&lt;td&gt; &lt;code&gt;NOT FROM &amp;#34;user@example.org&amp;#34;&lt;/code&gt; &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; &lt;code&gt;OR &amp;#60;key1&amp;#62; &amp;#60;key2&amp;#62;&lt;/code&gt; &lt;/td&gt;
			&lt;td&gt; Mails which match either of key1 or key2 &lt;/td&gt;
			&lt;td&gt; &lt;code&gt;OR FROM &amp;#34;user@example.org&amp;#34; FROM &amp;#34;user2@example.org&amp;#34;&lt;/code&gt; &lt;/td&gt;
		&lt;/tr&gt;
	&lt;/table&gt;

	&lt;p&gt;There are quite a bit more of these, &lt;a href=&quot;http://www.faqs.org/rfcs/rfc2060.html&quot;&gt;RfC 2060&lt;/a&gt; lists all possible options. But the ones above are probably the most commonly used.&lt;/p&gt;

	&lt;p&gt;Please be aware that the full text searches (&lt;code&gt;TEXT&lt;/code&gt; and &lt;code&gt;BODY&lt;/code&gt;) can be probibitively expensive if the server does not keep a full text search database of the messages. Getting an answer to such a query may take a very long time.&lt;/p&gt;

&lt;pre&gt;
. SEARCH FROM &amp;#34;user@example.org&amp;#34; BEFORE 1-Nov-2009
* SEARCH 5 10 456
. OK Completed
&lt;/pre&gt;

	&lt;h3&gt;Fetching messages&lt;/h3&gt;

	&lt;p&gt;Now that &lt;code&gt;SEARCH&lt;/code&gt; has turned up some messages it might be a good idea to take a look at the contents. The &lt;code&gt;FETCH&lt;/code&gt; command takes a list of sequence numbers or UIDs (as with &lt;code&gt;SEARCH&lt;/code&gt; there are two variants, &lt;code&gt;FETCH&lt;/code&gt; and &lt;code&gt;UID FETCH&lt;/code&gt;) and a list of the information we are interested in. The most commonly used parts are:&lt;/p&gt;

	&lt;table&gt;
		&lt;tr&gt;
			&lt;th&gt;Part name &lt;/th&gt;
			&lt;th&gt;Part description &lt;/th&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; &lt;code&gt;BODY[TEXT]&lt;/code&gt; &lt;/td&gt;
			&lt;td&gt; Just the mail body, without the headers &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; &lt;code&gt;BODY[HEADER]&lt;/code&gt; &lt;/td&gt;
			&lt;td&gt; The mail headers &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; &lt;code&gt;BODY[HEADER.FIELDS (&amp;#60;list&amp;#62;)]&lt;/code&gt; &lt;/td&gt;
			&lt;td&gt; Just the header fields indicated in list &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; &lt;code&gt;BODY[]&lt;/code&gt; &lt;/td&gt;
			&lt;td&gt; The entire mail text, header and body &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; &lt;code&gt;BODY.PEEK&lt;/code&gt; &lt;/td&gt;
			&lt;td&gt; Works as &lt;code&gt;BODY&lt;/code&gt; does, but does not mark the mail as seen &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; &lt;code&gt;FLAGS&lt;/code&gt; &lt;/td&gt;
			&lt;td&gt; Flags set for the message &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; &lt;code&gt;UID&lt;/code&gt; &lt;/td&gt;
			&lt;td&gt; The &lt;span class=&quot;caps&quot;&gt;UID&lt;/span&gt; of the message &lt;/td&gt;
		&lt;/tr&gt;
	&lt;/table&gt;

	&lt;p&gt;As above, RfC 2060 has all the gory details.&lt;/p&gt;

&lt;pre&gt;
. FETCH 5 (FLAGS BODY[HEADER.FIELDS (To)])
* 5 FETCH (FLAGS (\Seen) BODY[HEADER.FIELDS (To)] {24}
To: user@example.com
)
. OK Completed
&lt;/pre&gt;

	&lt;h3&gt;Deleting messages&lt;/h3&gt;

	&lt;p&gt;Deleting messages in &lt;span class=&quot;caps&quot;&gt;IMAP&lt;/span&gt; is a bit tricky, as there is no explicit delete command. Instead, a flag is set on the message marking it as deleted. This, by itself, does nothing to get the message removed. Just when a special command is called all messages in the current folder marked as to be deleted are removed&lt;sup class=&quot;footnote&quot;&gt;&lt;a href=&quot;#fn19007066684fb79547bec36&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;

&lt;pre&gt;
. UID SEARCH ALL
* 1 EXISTS
* 1 RECENT
* SEARCH 1814
. OK Completed
. UID STORE 1814 +FLAGS (\Deleted)
* 1 FETCH (FLAGS (\Recent \Deleted \Seen) UID 1814)
. OK Completed
. EXPUNGE
* 1 EXPUNGE
* 0 EXISTS
* 0 RECENT
. OK Completed
. UID SEARCH ALL
* SEARCH
. OK Completed
&lt;/pre&gt;

	&lt;p&gt;The above is executed in a folder containing just a single message (see the result of the &lt;code&gt;UID SEARCH ALL&lt;/code&gt;). The flag &lt;code&gt;\Deleted&lt;/code&gt; is then added to flag list of the message (&lt;code&gt;UID STORE 1814 +FLAGS (\Deleted)&lt;/code&gt;). The &lt;code&gt;STORE&lt;/code&gt; command returns the new flag list. The  &lt;code&gt;EXPUNGE&lt;/code&gt; command then removes the message.&lt;/p&gt;

	&lt;h3&gt;Leaving &lt;span class=&quot;caps&quot;&gt;IMAP&lt;/span&gt;&lt;/h3&gt;

	&lt;p&gt;When finished with the session the last thing to do is to leave:&lt;/p&gt;

&lt;pre&gt;
. logout
Connection closed by foreign host
$
&lt;/pre&gt;

	&lt;p id=&quot;fn19007066684fb79547bec36&quot; class=&quot;footnote&quot;&gt;&lt;sup&gt;1&lt;/sup&gt; The manual page for the rather excellent perl module &lt;code&gt;Mail::IMAPClient&lt;/code&gt; had the following to say about this:&lt;/p&gt;

	&lt;blockquote&gt;
		&lt;p&gt; In case you’re curious, expunging a folder deletes the messages that you thought were already deleted via &amp;#8220;delete_message&amp;#8221; but really weren&amp;#8217;t, which means you have to use a method that doesn&amp;#8217;t exist to delete messages that you thought didn&amp;#8217;t exist.  (Seriously, I&amp;#8217;m not making any of this stuff up.)&lt;/p&gt;
	&lt;/blockquote&gt;

	&lt;p&gt;Unfortunately this gem has disappeared from newer versions of the manual page.&lt;/p&gt; 
    </content:encoded>

    <pubDate>Thu, 05 Nov 2009 20:45:25 +0100</pubDate>
    <guid isPermaLink="false">http://www.skytale.net/blog/archives/23-guid.html</guid>
    
</item>
<item>
    <title>SSL cipher settings</title>
    <link>http://www.skytale.net/blog/archives/22-SSL-cipher-settings.html</link>
            <category>Computer</category>
            <category>Software</category>
    
    <comments>http://www.skytale.net/blog/archives/22-SSL-cipher-settings.html#comments</comments>
    <wfw:comment>http://www.skytale.net/blog/wfwcomment.php?cid=22</wfw:comment>

    <slash:comments>7</slash:comments>
    <wfw:commentRss>http://www.skytale.net/blog/rss.php?version=2.0&amp;type=comments&amp;cid=22</wfw:commentRss>
    

    <author>nospam@example.com (Ralf Ertzinger)</author>
    <content:encoded>
    	&lt;h3&gt;The Problem&lt;/h3&gt;

	&lt;p&gt;Securing network services with &lt;span class=&quot;caps&quot;&gt;SSL&lt;/span&gt; is, in general, a good idea, if you can spare the &lt;span class=&quot;caps&quot;&gt;CPU&lt;/span&gt; cycles. Especially personal data should always be protected while in transit via the network. But it may not be enough to simply enable &lt;span class=&quot;caps&quot;&gt;SSL&lt;/span&gt; in the service (be it Apache, Lighttpd, Cyrus &lt;span class=&quot;caps&quot;&gt;IMAPD&lt;/span&gt; or something else) to get a reasonably secure connection.&lt;/p&gt;

	&lt;p&gt;&lt;span class=&quot;caps&quot;&gt;SSL&lt;/span&gt; is a cover phrase for a wide collection of protocols and crypto algorithms. There are at least three protocol suites in use (SSLv2, SSLv3 and TLSv1), which between them support tens of different crypto algorithms with different strengths. Not all of those are still suitable for serious use today.&lt;/p&gt;

	&lt;p&gt;A list of the ciphers supported by the popular &lt;a href=&quot;http://openssl.org&quot;&gt;OpenSSL library&lt;/a&gt;, which is used by many projects to handle &lt;span class=&quot;caps&quot;&gt;SSL&lt;/span&gt;, can be obtained with the following command:&lt;/p&gt;

&lt;pre&gt;
$ openssl ciphers -v &amp;#39;ALL:COMPLEMENTOFALL&amp;#39;
DHE-RSA-AES256-SHA      SSLv3 Kx=DH       Au=RSA  Enc=AES(256)  Mac=SHA1
DHE-DSS-AES256-SHA      SSLv3 Kx=DH       Au=DSS  Enc=AES(256)  Mac=SHA1
...
$
&lt;/pre&gt;

	&lt;p&gt;On my notebook (running Fedora 11) this produces a list of 62 ciphers. The number of ciphers supported changes with the version of OpenSSL, so other&lt;br /&gt;
systems may display a different list.&lt;/p&gt;

	&lt;p&gt;During an &lt;span class=&quot;caps&quot;&gt;SSL&lt;/span&gt; handshake between a client and a server the cipher to use is negotiated between the two machines. In practical terms this means that the client send list of ciphers it is able and willing to use to the server, the server compares this list with it&amp;#8217;s own list of supported ciphers and, if a cipher supported by both sides is found returns it&amp;#8217;s choice to the client.&lt;/p&gt;

	&lt;h3&gt;Defaults&lt;/h3&gt;

	&lt;p&gt;Unless something else is configured, a server using OpenSSL uses the &amp;#8220;DEFAULT&amp;#8221; group of ciphers. The content of this group can also change between versions of OpenSSL. The value for the installed version can be queried:&lt;/p&gt;

&lt;pre&gt;
$ openssl ciphers -v &amp;#39;DEFAULT&amp;#39;
DHE-RSA-AES256-SHA      SSLv3 Kx=DH       Au=RSA  Enc=AES(256)  Mac=SHA1
DHE-DSS-AES256-SHA      SSLv3 Kx=DH       Au=DSS  Enc=AES(256)  Mac=SHA1
...
$
&lt;/pre&gt;

	&lt;p&gt;This list is shorter than the list of all ciphers above, containing 44 ciphers on my notebook. This list is not entirely nonsensical. It does not contain ciphers without encryption (yes, that is a valid mode of operation for &lt;span class=&quot;caps&quot;&gt;SSL&lt;/span&gt;), it does not contain ciphers without authentication (which would allow for Man-in-the-middle attacks). It does, however, contain ciphers whose strength in this day and age must be questioned. These include the so called &amp;#8220;export&amp;#8221; ciphers.&lt;/p&gt;

	&lt;p&gt;These ciphers stem from a time when it was illegal to export software from the United States which supported strong encryption. So software supporting encryption (for example web browsers, like the venerable Netscape Nagivator) destined for export only supported watered down versions of the strong encryption variants, mostly by supporting shorter keys. Fortunately it is no longer illegal to export strong crypto from the United States, and hasn&amp;#8217;t been for years, but for compatibility reasons OpenSSL is still willing to negotiate these weak ciphers with a client.&lt;/p&gt;

	&lt;p&gt;Another weak candidate is the &lt;a href=&quot;http://en.wikipedia.org/wiki/Data_Encryption_Standard&quot;&gt;&lt;span class=&quot;caps&quot;&gt;DES&lt;/span&gt; algorithm&lt;/a&gt;. It was made a standard in 1976 (which is an eternity ago in IT terms). Although it was never cryptographically broken, it&amp;#8217;s key length of 56 bits made it increasingly more vulnerable to brute force attacks as faster CPUs became available. Since the &lt;a href=&quot;http://www.eff.org&quot;&gt;Electronic Frontier Foundation&lt;/a&gt; demonstrated a custom-built &lt;span class=&quot;caps&quot;&gt;DES&lt;/span&gt; cracker in 1998, built for $250.000 and able to brute-force a &lt;span class=&quot;caps&quot;&gt;DES&lt;/span&gt; key in under two days, &lt;span class=&quot;caps&quot;&gt;DES&lt;/span&gt; has been effectively dead. But, for compatibility reasons, OpenSSL is, by default, willing to negotiate &lt;span class=&quot;caps&quot;&gt;DES&lt;/span&gt; as a cipher.&lt;/p&gt;

	&lt;p&gt;OpenSSL can be told which ciphers to offer in an &lt;span class=&quot;caps&quot;&gt;SSL&lt;/span&gt; negotiation, and thankfully most programs using OpenSSL offer configuration statements so the admin can change the default settings.&lt;/p&gt;

	&lt;h3&gt;Selections&lt;/h3&gt;

	&lt;p&gt;Which ciphers should be used then? Let&amp;#8217;s start with all the ciphers supported by the SSLv3/TLSv1 cipher suite (which every program offering &lt;span class=&quot;caps&quot;&gt;SSL&lt;/span&gt; should support, the use of SSLv2 is strongly discouraged due to vulnerabilities). And we only want ciphers which offer high security (which in OpenSSL terms means more than 128 bits key length, plus some ciphers with 128 bit keys). To be on the safe side we also explicitly disable SSLv2 ciphers, so they cannot be reintroduced later:&lt;/p&gt;

&lt;pre&gt;
$ openssl ciphers -v &amp;#39;TLSv1+HIGH:!SSLv2&amp;#39;
DHE-RSA-AES256-SHA      SSLv3 Kx=DH       Au=RSA  Enc=AES(256)  Mac=SHA1
DHE-DSS-AES256-SHA      SSLv3 Kx=DH       Au=DSS  Enc=AES(256)  Mac=SHA1
...
$
&lt;/pre&gt;

	&lt;p&gt;25 ciphers match this list, but it also contains ciphers without authentication. These have to go, along with all ciphers without encryption (there should not be any, but better save than sorry):&lt;/p&gt;

&lt;pre&gt;
$ openssl ciphers -v &amp;#39;TLSv1+HIGH:!SSLv2:!aNULL:!eNULL&amp;#39;
DHE-RSA-AES256-SHA      SSLv3 Kx=DH       Au=RSA  Enc=AES(256)  Mac=SHA1
DHE-DSS-AES256-SHA      SSLv3 Kx=DH       Au=DSS  Enc=AES(256)  Mac=SHA1
...
$
&lt;/pre&gt;

	&lt;p&gt;20 remain. It&amp;#8217;s my personal preference to disable ciphers based on triple-&lt;span class=&quot;caps&quot;&gt;DES&lt;/span&gt; (3DES), so these are removed, too. There is no technical reason for this, 3DES is still considered secure.&lt;/p&gt;

	&lt;p&gt;Finally, the remaining ciphers are sorted by strength, the most secure first, which will make OpenSSL prefer those.&lt;/p&gt;

&lt;pre&gt;
$ openssl ciphers -v &amp;#39;TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!3DES:@STRENGTH&amp;#39;
DHE-RSA-AES256-SHA      SSLv3 Kx=DH       Au=RSA  Enc=AES(256)  Mac=SHA1
DHE-DSS-AES256-SHA      SSLv3 Kx=DH       Au=DSS  Enc=AES(256)  Mac=SHA1
...
&lt;/pre&gt;

	&lt;p&gt;On my notebook 14 ciphers remain. For comparison, on my web server (running CentOS 5) this selection only produces 6 ciphers, due to an older version of OpenSSL.&lt;/p&gt;

	&lt;p&gt;There is, however, two problem with this list. First, it does no longer contain the export or simple &lt;span class=&quot;caps&quot;&gt;DES&lt;/span&gt; ciphers (which was kind of the point). This means that &lt;span class=&quot;caps&quot;&gt;SSL&lt;/span&gt; services secured with this selection are no longer available to &lt;span class=&quot;caps&quot;&gt;SSL&lt;/span&gt; client which only support export grade ciphers. This is a good thing, as these clients are insecure and need to be replaced with something more recent. Depending on the details of the service this option may not be available, though. Please check if these old ciphers must be supprted further before turning them off.&lt;/p&gt;

	&lt;p&gt;The second problem is Windows. In detail, Windows versions before and including Windows XP. The crypto libraries shipped with these versions do not support newer crypto algorithms (like &lt;span class=&quot;caps&quot;&gt;AES&lt;/span&gt;), so there is no overlap between the set of algorithms supported by the server and those supported by the client. These crypto libraries are primarily used by Internet Explorer, Outlook and Outlook Express, so these programs on Windows XP and earlier will not be able to negotiate an &lt;span class=&quot;caps&quot;&gt;SSL&lt;/span&gt; connection to a web or mail server. Other web browsers and mail clients (like Firefox and Thunderbird) usually ship with their own crypto libraries which do support modern algorithms, and are not&lt;br /&gt;
affected. The system crypto libraries in Windows Vista and Windows 7 are also not affected.&lt;/p&gt;

	&lt;p&gt;If support for older Windows versions cannot be dropped (likely), the cipher list needs to be extended by some RC4 ciphers (which Windows does support):&lt;/p&gt;

&lt;pre&gt;
$ openssl ciphers -v &amp;#39;TLSv1+HIGH:!SSLv2:RC4+MEDIUM:!aNULL:!eNULL:!3DES:@STRENGTH&amp;#39;
DHE-RSA-AES256-SHA      SSLv3 Kx=DH       Au=RSA  Enc=AES(256)  Mac=SHA1
DHE-DSS-AES256-SHA      SSLv3 Kx=DH       Au=DSS  Enc=AES(256)  Mac=SHA1
...
$
&lt;/pre&gt;

	&lt;p&gt;This brings the number of ciphers up to 19, the new RC4 ciphers are added at the end of the sorted list.&lt;/p&gt;

	&lt;h3&gt;Configuration&lt;/h3&gt;

	&lt;p&gt;Now that the cipher list is complete the various services that use &lt;span class=&quot;caps&quot;&gt;SSL&lt;/span&gt; need to be configured to use it. Instructions how to do this can be found in the documentation, examples for some services are below.&lt;/p&gt;

	&lt;h4&gt;Exim&lt;/h4&gt;

	&lt;p&gt;Add the following line to the global (first) configuration section and restart Exim:&lt;/p&gt;

&lt;pre&gt;
tls_require_ciphers = TLSv1+HIGH : !SSLv2 : RC4+MEDIUM : !aNULL : !eNULL : !3DES : @STRENGTH
&lt;/pre&gt;

	&lt;h4&gt;Lighttpd&lt;/h4&gt;

	&lt;p&gt;Add the following line to the configuration section containing &lt;code&gt;ssl.engine = &amp;#34;enable&amp;#34;&lt;/code&gt; and restart Lighttpd:&lt;/p&gt;

&lt;pre&gt;
ssl.cipher-list = &amp;#34;TLSv1+HIGH !SSLv2 RC4+MEDIUM !aNULL !eNULL !3DES @STRENGTH&amp;#34;
&lt;/pre&gt;

	&lt;h4&gt;Cyrus &lt;span class=&quot;caps&quot;&gt;IMAPD&lt;/span&gt;&lt;/h4&gt;

	&lt;p&gt;Add the following line in &lt;code&gt;imapd.conf&lt;/code&gt; and restart Cyrus:&lt;/p&gt;

&lt;pre&gt;
tls_cipher_list: TLSv1+HIGH:!SSLv2:RC4+MEDIUM:!aNULL:!eNULL:!3DES:@STRENGTH
&lt;/pre&gt;

	&lt;h3&gt;Testing&lt;/h3&gt;

	&lt;p&gt;In order to test the new settings, a connection attempt using an excluded cipher can be made (which should fail, of course):&lt;/p&gt;

&lt;pre&gt;
$ openssl s_client -host www.skytale.net -port 443 -cipher 3DES
CONNECTED(00000003)
140209911707464:error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure:s23_clnt.c:672:
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 7 bytes and written 58 bytes
---
New, (NONE), Cipher is (NONE)
Compression: NONE
Expansion: NONE
---
&lt;/pre&gt;

	&lt;p&gt;A successful attempt (letting openssl select the best cipher) negotiates &lt;span class=&quot;caps&quot;&gt;AES&lt;/span&gt; with a 256 bit key:&lt;/p&gt;

&lt;pre&gt;
$ openssl s_client -host www.skytale.net -port 443
CONNECTED(00000003)
...
---
SSL handshake has read 1281 bytes and written 309 bytes
---
New, TLSv1/SSLv3, Cipher is AES256-SHA
Server public key is 1024 bit
Compression: zlib compression
Expansion: zlib compression
SSL-Session:
Protocol  : TLSv1
Cipher    : AES256-SHA
Session-ID: --removed--
Session-ID-ctx:
Master-Key: --removed--
Key-Arg   : None
Krb5 Principal: None
PSK identity: None
PSK identity hint: None
Compression: 1 (zlib compression)
Start Time: 1252852959
Timeout   : 300 (sec)
Verify return code: 21 (unable to verify the first certificate)
---
&lt;/pre&gt; 
    </content:encoded>

    <pubDate>Sun, 13 Sep 2009 16:45:35 +0200</pubDate>
    <guid isPermaLink="false">http://www.skytale.net/blog/archives/22-guid.html</guid>
    
</item>
<item>
    <title>Running RivaTuner without Administrator rights</title>
    <link>http://www.skytale.net/blog/archives/21-Running-RivaTuner-without-Administrator-rights.html</link>
            <category>Computer</category>
            <category>Software</category>
            <category>Windows</category>
    
    <comments>http://www.skytale.net/blog/archives/21-Running-RivaTuner-without-Administrator-rights.html#comments</comments>
    <wfw:comment>http://www.skytale.net/blog/wfwcomment.php?cid=21</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.skytale.net/blog/rss.php?version=2.0&amp;type=comments&amp;cid=21</wfw:commentRss>
    

    <author>nospam@example.com (Ralf Ertzinger)</author>
    <content:encoded>
    	&lt;p&gt;&lt;a href=&quot;http://www.guru3d.com/rivatuner&quot;&gt;RivaTuner&lt;/a&gt; is a tweaking program for Windows used to change some more obscure parameters of modern GPUs. It&amp;#8217;s main uses are overclocking and monitoring, but it&amp;#8217;s feature list is truly impressive. I mainly use it to change the fan speed settings on the &lt;span class=&quot;caps&quot;&gt;GTX&lt;/span&gt; 260 in my gaming rig (the default profile is not aggressive enough for my taste, letting the &lt;span class=&quot;caps&quot;&gt;GPU&lt;/span&gt; temperature run up to 85 degrees before the fan starts to kick in in ernest).&lt;/p&gt;

	&lt;p&gt;One problem I always had with RivaTuner is that it requires Administrator privileges to run. It needs those to load a device driver that is then used to communicate (and manipulate) the &lt;span class=&quot;caps&quot;&gt;GPU&lt;/span&gt; driver and some parts of the graphic card. Since my normal user account does not have administrative privileges I had to use the &amp;#8220;Run As&amp;#8221; feature to start RivaTuner to allow it to set my fan parameters.&lt;/p&gt;

	&lt;p&gt;It turns out this is not really necessary, and that there is a way to run the RivaTuner frontend as a normal user. Here&amp;#8217;s how.&lt;/p&gt;

	&lt;h3&gt;&lt;span class=&quot;caps&quot;&gt;WARNING&lt;/span&gt;&lt;/h3&gt;

	&lt;p&gt;The following instructions involve editing sensitive parts of the Windows registry. Getting this wrong may render your Windows installation unbootable or harm your system in other ways. If you are not comfortable with the registry editor do not attempt to do this.&lt;/p&gt;

	&lt;h3&gt;Instructions&lt;/h3&gt;

	&lt;ul&gt;
		&lt;li&gt;Install RivaTuner (well, duh).&lt;/li&gt;
		&lt;li&gt;Start RivaTuner at least once (as an Administrator)&lt;/li&gt;
		&lt;li&gt;Log in as a user with administrative rights&lt;/li&gt;
		&lt;li&gt;Start the registry editor&lt;/li&gt;
		&lt;li&gt;Navigate to the following key:&lt;/li&gt;
	&lt;/ul&gt;
&lt;pre&gt;
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\RivaTuner32
&lt;/pre&gt;
	&lt;ul&gt;
		&lt;li&gt;Change the key &lt;code&gt;Start&lt;/code&gt; to &lt;code&gt;1&lt;/code&gt;&lt;/li&gt;
		&lt;li&gt;Reboot&lt;/li&gt;
	&lt;/ul&gt;

	&lt;p&gt;What this does is to instruct Windows to load the RivaTuner device driver during system startup, so it is already loaded when a user logs in. Seeing this, RivaTuner will not attempt to load the driver again, but connect to the driver as a normal user (which works).&lt;/p&gt;

	&lt;h3&gt;Advantages&lt;/h3&gt;

	&lt;p&gt;With this change RivaTuner can be run as a normal user&lt;/p&gt;

	&lt;h3&gt;Disadvantages&lt;/h3&gt;

	&lt;p&gt;The RivaTuner device driver will always be loaded, even when RivaTuner will not be used. This may lead to problems with other drivers, and disabling the device driver again requires another go at the registry.&lt;/p&gt; 
    </content:encoded>

    <pubDate>Thu, 03 Sep 2009 21:59:36 +0200</pubDate>
    <guid isPermaLink="false">http://www.skytale.net/blog/archives/21-guid.html</guid>
    
</item>
<item>
    <title>Tracing errors through the code</title>
    <link>http://www.skytale.net/blog/archives/20-Tracing-errors-through-the-code.html</link>
            <category>Computer</category>
            <category>Software</category>
            <category>Solaris</category>
    
    <comments>http://www.skytale.net/blog/archives/20-Tracing-errors-through-the-code.html#comments</comments>
    <wfw:comment>http://www.skytale.net/blog/wfwcomment.php?cid=20</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.skytale.net/blog/rss.php?version=2.0&amp;type=comments&amp;cid=20</wfw:commentRss>
    

    <author>nospam@example.com (Ralf Ertzinger)</author>
    <content:encoded>
    	&lt;p&gt;Open source is a great thing. This becomes especially obvious if one is confronted with a program that refuses to work, and furthermore refuses to yield any kind of helpful error message. Reading the source may be the only way to determine what is actually going on.&lt;/p&gt;

	&lt;p&gt;Sadly I&amp;#8217;ve been doing rather a lot of that lately, This post shall serve as an example how to navigate the Open Solaris source code in search of an answer.&lt;/p&gt;

	&lt;h3&gt;The problem&lt;/h3&gt;

	&lt;p&gt;This specific problem arose during my experiments to create a small Solaris installation for use in an embedded system (small in this context means around 60MB used disk space). More details on this later.&lt;/p&gt;

	&lt;p&gt;The system has a &lt;code&gt;cfgadm(1M)&lt;/code&gt; binary, but it does not work:&lt;/p&gt;

&lt;pre&gt;
# cfgadm
cfgadm: Library error: Device library initialize failed: Facility is not active
&lt;/pre&gt;

	&lt;p&gt;As error messages go this only marginally better that &amp;#8220;Failed&amp;#8221;, but not by much. Telling the user which exact facility is not active would have been helpful.&lt;/p&gt;

	&lt;p&gt;But at least there are some search friendly strings in there that may help to determine the source code responsible for this message.&lt;/p&gt;

	&lt;h3&gt;The source&lt;/h3&gt;

	&lt;p&gt;One thing the classical &lt;span class=&quot;caps&quot;&gt;UNIX&lt;/span&gt; source approach of &amp;#8220;all the source in one tree&amp;#8221; has going for it is that it makes searching in the source relatively easy. The Open Solaris web site has build a search engine above the source tree which automatically cross-references symbols in the code and has some other nice features. &lt;a href=&quot;http://src.opensolaris.org/source&quot;&gt;The entry page to the search engine is here.&lt;/a&gt;&lt;/p&gt;

	&lt;p&gt;Searching for &amp;#8220;Facility is not active&amp;#8221; (note the quotes) yields just a handful of hits. One of those (in &lt;code&gt;/onnv/onnv-gate/usr/src/uts/common/sys/errno.h&lt;/code&gt;) hints that there is a system error (and corresponding symbol) called &lt;code&gt;ENOTACTIVE&lt;/code&gt; which belongs to this error message.&lt;/p&gt;

	&lt;p&gt;Running &lt;code&gt;cfgadm&lt;/code&gt; under &lt;code&gt;truss(1)&lt;/code&gt; confirms this:&lt;/p&gt;

&lt;pre&gt;
# truss cfgadm
execve(&amp;#34;/usr/sbin/cfgadm&amp;#34;, 0x08047E24, 0x08047E2C)  argc = 1
[...]
sysconfig(_CONFIG_PAGESIZE)                     = 4096
open(&amp;#34;/devices/pseudo/devinfo@0:devinfo&amp;#34;, O_RDONLY) = 3
ioctl(3, DINFOIDENT, 0x00000000)                = 57311
ioctl(3, 0x10DF00, 0x08047460)                  Err#73 ENOTACTIVE
close(3)                                        = 0
[...]
&lt;/pre&gt;

	&lt;p&gt;Things go kind of downhill from there. So some code opens the devinfo device, runs two IOCTLs on in and the second one fails. Furthermore, &lt;code&gt;truss&lt;/code&gt; only knows the first &lt;span class=&quot;caps&quot;&gt;IOCTL&lt;/span&gt; by name, not the actually failing one.&lt;/p&gt;

	&lt;p&gt;Searching for the first name turns up &lt;code&gt;/onnv/onnv-gate/usr/src/uts/common/sys/devinfo_impl.h&lt;/code&gt;:&lt;/p&gt;

&lt;pre&gt;
#define DINFOIDENT (DIIOC | 0x82) /* identify the driver */
&lt;/pre&gt;

	&lt;p&gt;Looking around in this file some more yields two other definitions:&lt;/p&gt;

&lt;pre&gt;
#define  DIIOC       (0xdf&amp;#60;&amp;#60;8)
[...]
#define DINFOCACHE  (DIIOC | 0x100000) /* use cached data  */
&lt;/pre&gt;

	&lt;p&gt;So the second &lt;span class=&quot;caps&quot;&gt;IOCTL&lt;/span&gt; is actually called &lt;code&gt;DINFOCACHE&lt;/code&gt;. Tracing IOCTLs through the code is, unfortunately, a bit tricky, because the routine that handles the &lt;span class=&quot;caps&quot;&gt;IOCTL&lt;/span&gt; depends on the passed file descriptor (the first parameter to the &lt;span class=&quot;caps&quot;&gt;IOCTL&lt;/span&gt; call). The file associated with the &lt;span class=&quot;caps&quot;&gt;IOCTL&lt;/span&gt; in this case belongs to the file &lt;code&gt;/devices/pseudo/devinfo@0:devinfo&lt;/code&gt; (see the &lt;code&gt;open&lt;/code&gt; call directly above the two IOCTLs).&lt;/p&gt;

	&lt;p&gt;But since the &lt;span class=&quot;caps&quot;&gt;IOCTL&lt;/span&gt; handling code most likely contains the symbol &lt;code&gt;DINFOCACHE&lt;/code&gt; as well (that&amp;#8217;s what constants are for, after all) searching for the name will turn up the correct file, possibly buried among others.&lt;/p&gt;

	&lt;p&gt;Armed this knowledge the search results for &lt;code&gt;DINFOCACHE&lt;/code&gt; can be narrowed down to one likely candidate: &lt;code&gt;/onnv/onnv-gate/usr/src/uts/common/io/devinfo.c&lt;/code&gt;. This file belongs to the kernel code (it lives in &lt;code&gt;usr/src/uts&lt;/code&gt;), and the name fits the name of the device opened above.&lt;/p&gt;

	&lt;p&gt;&lt;code&gt;DINFOCACHE&lt;/code&gt; appears twice in a function called &lt;code&gt;di_ioctl&lt;/code&gt;, which sounds good. Following the code flow through this function (&lt;code&gt;DINFOCACHE&lt;/code&gt; is passed in the &lt;code&gt;cmd&lt;/code&gt; parameter), the first relevant code part reads as follows:&lt;/p&gt;

&lt;pre&gt;
if ((st-&amp;#62;command &amp;#38; DINFOCACHE) &amp;#38;&amp;#38; !cache_args_valid(st, &amp;#38;error)) {
        di_freemem(st);
        (void) di_setstate(st, IOC_IDLE);
        return (error);
}
&lt;/pre&gt;

	&lt;p&gt;(By the time execution reaches this code the &lt;code&gt;cmd&lt;/code&gt; variable has been copied to &lt;code&gt;st-&amp;#62;command&lt;/code&gt;, more or less). &lt;code&gt;cache_valid_args&lt;/code&gt;, among other things, does the following:&lt;/p&gt;

&lt;pre&gt;
if (!modrootloaded || !i_ddi_io_initialized()) {
       CACHE_DEBUG((DI_ERR,
       &amp;#34;cache lookup failure: I/O subsystem not inited&amp;#34;));
       *error = ENOTACTIVE;
       return (0);
}
&lt;/pre&gt;

	&lt;p&gt;That looks pretty promising, as it sets the right error code if the condition holds. &lt;code&gt;modrootloadied&lt;/code&gt; is a kernel symbol, so &lt;code&gt;mdb(1)&lt;/code&gt; can be used to inspect this value in a running kernel.&lt;/p&gt;

&lt;pre&gt;
# mdb -k
Loading modules: [ unix genunix specfs mac cpu.generic uppc pcplusmp scsi_vhci
ufs sockfs ip hook neti sctp arp usba uhci sd lofs logindmux ptm random crypto
zfs ipc ]
&amp;#62; modrootloaded/X
modrootloaded:
modrootloaded:  1
&lt;/pre&gt;

	&lt;p&gt;That&amp;#8217;s not the culprit. &lt;code&gt;i_ddi_io_initialized()&lt;/code&gt; basically returns the value of &lt;code&gt;sysevent_daemon_init&lt;/code&gt;, so what about that?&lt;/p&gt;

&lt;pre&gt;
# mdb -k
Loading modules: [ unix genunix specfs mac cpu.generic uppc pcplusmp scsi_vhci
ufs sockfs ip hook neti sctp arp usba uhci sd lofs logindmux ptm random crypto
zfs ipc ]
&amp;#62; modrootloaded/X
modrootloaded:
modrootloaded:  1
&amp;#62; sysevent_daemon_init/X
sysevent_daemon_init:
sysevent_daemon_init:           0
&lt;/pre&gt;

	&lt;p&gt;Bingo. From the name of the variable the probable name of the not running facility (remember the original error message?) can be deduced: &lt;code&gt;svc:/system/sysevent:default&lt;/code&gt;, which, indeed, is not running on the minimal system. Starting it makes &lt;code&gt;cfgadm&lt;/code&gt; work.&lt;/p&gt;

	&lt;p&gt;That wasn&amp;#8217;t so hard, now was it?&lt;/p&gt; 
    </content:encoded>

    <pubDate>Fri, 29 May 2009 16:50:12 +0200</pubDate>
    <guid isPermaLink="false">http://www.skytale.net/blog/archives/20-guid.html</guid>
    
</item>

</channel>
</rss>
