<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-831962920238354198</id><updated>2011-08-25T10:50:52.590-07:00</updated><title type='text'>pbwy</title><subtitle type='html'>Peace be with you -- idle thoughts through rose tinted lenses.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://pbwy.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/831962920238354198/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://pbwy.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>BenCollver</name><uri>http://www.blogger.com/profile/03624042887924855196</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>11</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-831962920238354198.post-8819385947020347853</id><published>2011-03-12T12:57:00.000-08:00</published><updated>2011-03-12T13:09:25.055-08:00</updated><title type='text'>better late than never</title><content type='html'>I have written OOP programs by imitating the style of others.  Now I am reading &lt;a href="http://web.engr.oregonstate.edu/~budd/Books/oopintro3e/info/ReadMe.html"&gt;Object-Oriented Programming&lt;/a&gt; by Timothy Budd at Oregon State University, and just finished chapter 3.  The book is picking up the pace.  It was interesting to read about the teaching tool of &lt;a href="http://en.wikipedia.org/wiki/Responsibility-driven_design"&gt;Responsibility Driven Design&lt;/a&gt;, and about using note cards to physically model and organize components.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;The constraints of an index card are also a good measure of approximate complexity.  A component that is expected to perform more tasks than can fit easily in this space is probably too complex...&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;This reminds me of many other quotes.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;A Forth word should not have more than one or two arguments. This stack which people have so much trouble manipulating should never be more than three or four deep. ... And that is in my mind one of the keystones of Forth, you factor and you factor and you factor until most of your definitions are one or two lines long.&lt;/blockquote&gt;&lt;br /&gt;&lt;a href="http://www.ultratechnology.com/1xforth.htm"&gt;http://www.ultratechnology.com/1xforth.htm&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;Now, some people will claim that having 8-character indentations makes the code move too far to the right, and makes it hard to read on a 80-character terminal screen.  The answer to that is that if you need more than 3 levels of indentation, you're screwed anyway, and should fix your program.&lt;/blockquote&gt;&lt;br /&gt;&lt;a href="http://www.kernel.org/doc/Documentation/CodingStyle"&gt;http://www.kernel.org/doc/Documentation/CodingStyle&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;If a function exceeds about 40 lines, think about whether it can be broken up without harming the structure of the program.&lt;/blockquote&gt;&lt;br /&gt;&lt;a href="http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Write_Short_Functions"&gt;http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Write_Short_Functions&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;So far almost all of the OO code I have read has been in frameworks for web or windows applications.  The components would NOT fit on note cards.  I have not decided what that means yet, but it rings true to me that real world usage will add &lt;a href="http://www.joelonsoftware.com/articles/fog0000000069.html"&gt;hair&lt;/a&gt; to a program.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/831962920238354198-8819385947020347853?l=pbwy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pbwy.blogspot.com/feeds/8819385947020347853/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=831962920238354198&amp;postID=8819385947020347853' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/831962920238354198/posts/default/8819385947020347853'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/831962920238354198/posts/default/8819385947020347853'/><link rel='alternate' type='text/html' href='http://pbwy.blogspot.com/2011/03/better-late-than-never.html' title='better late than never'/><author><name>BenCollver</name><uri>http://www.blogger.com/profile/03624042887924855196</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-831962920238354198.post-4367802265561675094</id><published>2011-01-23T05:42:00.000-08:00</published><updated>2011-01-23T05:48:05.476-08:00</updated><title type='text'>Callback spaghetti sauce</title><content type='html'>&lt;a href="http://substack.net/posts/92a7f7/Build-chainable-interfaces-in-node-js-with-chainsaw"&gt;http://substack.net/posts/92a7f7/Build-chainable-interfaces-in-node-js-with-chainsaw&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/831962920238354198-4367802265561675094?l=pbwy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pbwy.blogspot.com/feeds/4367802265561675094/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=831962920238354198&amp;postID=4367802265561675094' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/831962920238354198/posts/default/4367802265561675094'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/831962920238354198/posts/default/4367802265561675094'/><link rel='alternate' type='text/html' href='http://pbwy.blogspot.com/2011/01/spaghetti-sauce.html' title='Callback spaghetti sauce'/><author><name>BenCollver</name><uri>http://www.blogger.com/profile/03624042887924855196</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-831962920238354198.post-7289290432141711220</id><published>2010-11-27T14:58:00.000-08:00</published><updated>2010-11-27T15:24:32.761-08:00</updated><title type='text'>virtually the same</title><content type='html'>&lt;p&gt;&lt;br /&gt;My new hardware has features for virtualization.  My plan was to try Fedora 14/KVM, Windows Server 2008 R2/Hyper-V, and VMware/ESXi 4.1, to see how they treated me.  I also planned to try FreeBSD 8.1 as a guest and some VMWare appliance disk images from turnkeylinux.org.  All this worked perfectly on KVM.  Hyper-V worked, but was surprisingly fussy.    Unfortunately, I could not install VMware on my hardware; it would always crash part way through the installation process.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;I ran informal benchmarks using the Linux hdparm command, the FreeBSD diskinfo command, and the Unix benchmarking tools bonnie++, nbench, and unixbench.  On Windows I used AIDA64 and Sandra.  On all platforms I timed a 2gb file copy over http on 100Mbps Ethernet.  The benchmarks were all over the place, so I will not tabulate the numbers.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;Some things were faster in the guest than on the host, including buffered/cached disk read throughput and process creation.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;The 2gb file copy took roughly 3.5 minutes on all platforms except for KVM/W2k8r2, which took 5 minutes.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;h3&gt;KVM Documentation links&lt;/h3&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;&lt;a href="http://docs.fedoraproject.org/en-US/Fedora/13/html/Virtualization_Guide/index.html"&gt;Fedora Virtualization Guide&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;a href="http://www.linux-kvm.org/page/How_To_Migrate_From_Vmware_To_KVM"&gt;Hints to use VMware disk images on KVM&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;a href="http://edoceo.com/liber/kvm-lvm"&gt;Using LVM snapshots to back up KVM&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;p&gt;Use virsh to manage virtual servers (aka domains).&lt;/p&gt;&lt;br /&gt;&lt;h3&gt;Fedora 14 guest on KVM&lt;/h3&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;lvcreate -L 8g -n lv_f14guest vg_overt&lt;br /&gt;&lt;br /&gt;virt-install -n f14guest -r 1024 -c /dev/dvd --os-type=linux --os-variant=fedora14 --boot=cdrom,hd --disk=/dev/vg_overt/lv_f14guest -w network:default --vnc --vnclisten=0.0.0.0 -v --virt-type=kvm&lt;br /&gt;&lt;br /&gt;vncviewer overt&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;Stop and delete the smartd service.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;h3&gt;MediaWiki appliance on KVM&lt;/h3&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;Obtain appliance disk image from &lt;a href="http://www.turnkeylinux.org/mediawiki"&gt;turnkeylinux.org/mediawiki&lt;/a&gt;.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;lvcreate -L 4g -n lv_appliances vg_overt&lt;br /&gt;mkfs -t ext4 /dev/vg_overt/lv_appliances&lt;br /&gt;mkdir /mnt/appliances&lt;br /&gt;mount /dev/vg_overt/lv_appliances /mnt/appliances&lt;br /&gt;cd /mnt/appliances&lt;br /&gt;unzip /mnt/hd/turnkey-mediawiki-2009.10-2-hardy-x86.zip&lt;br /&gt;&lt;br /&gt;yum install xmlstarlet&lt;br /&gt;alias xml=xmlstarlet&lt;br /&gt;&lt;br /&gt;# The vmdk file name is turnkey-mediawiki-2009.10-2-hardy-x86.vmdk&lt;br /&gt;# How to find vmdk file name:&lt;br /&gt;xml sel -N a=http://schemas.dmtf.org/ovf/envelope/1 -T -t -m //a:File -v @a:href -n turnkey-mediawiki-2009.10-2-hardy-x86/turnkey-mediawiki-2009.10-2-hardy-x86.ovf&lt;br /&gt;&lt;br /&gt;virt-install -n wikiguest -r 1024 --os-type=linux --os-variant=ubuntuhardy --boot=hd --import --disk=/mnt/appliances/turnkey-mediawiki-2009.10-2-hardy-x86/turnkey-mediawiki-2009.10-2-hardy-x86.vmdk,format=vmdk -w network:default --vnc --vnclisten=0.0.0.0 -v --virt-type=kvm&lt;br /&gt;&lt;br /&gt;$ ssh user@overt&lt;br /&gt;$ su -&lt;br /&gt;# sesetbool sshd_forward_ports 1&lt;br /&gt;# exit&lt;br /&gt;$ exit&lt;br /&gt;$ ssh user@overt -L 18008:192.168.122.237:80 -L 18000:192.168.122.237:12320 -L 18001:192.168.122.237:12321 -L 18002:192.168.122.237:12322&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;browse to http://127.0.0.1:18008/ or https://127.0.0.1:18000/&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;h3&gt;Install Vsphere/ESXi&lt;/h3&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;The installer crashes.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;Traceback (most recent call last):&lt;br /&gt;File "ThinESX.py", line 8, in &amp;lt;module&amp;gt;&lt;br /&gt;Installer.Start()&lt;br /&gt;File "/usr/lib/vmware/installer/Core/Log.py", line 46, in wrapper&lt;br /&gt;return func(*args, **kwargs)&lt;br /&gt;File "/usr/lib/vmware/installer/ThinESXInstall.py", line 38, in Start&lt;br /&gt;Install.Start(self, data)&lt;br /&gt;File "/usr/lib/vmware/installer/Core/Log.py", line 46, in wrapper&lt;br /&gt;return func(*args, **kwargs)&lt;br /&gt;File "/usr/lib/vmware/installer/Core/Install.py", line 40, in Start&lt;br /&gt;data = self.Steps[self._Dispatcher.CurrentStep](data)&lt;br /&gt;File "/usr/lib/vmware/installer/Core/Log.py", line 46, in wrapper&lt;br /&gt;return func(*args, **kwargs)&lt;br /&gt;File "/usr/lib/vmware/installer/ThinESX/ThinESXInstallSteps.py", line 70, in TargetSelectionStep&lt;br /&gt;datastores - DatastoreEnumeration(None)&lt;br /&gt;File "/usr/lib/vmware/installer/Core/DatastoreEnumeration.py", line 15, in __init__&lt;br /&gt;vmfs3Module.Load()&lt;br /&gt;File "/lib/python2.5/vmkctl.py", line 11328, in Load&lt;br /&gt;def Load(*args): return _vmkctl.ModuleImpl_Load(*args)&lt;br /&gt;vmkctl.HostCtlException: Unable to load module /usr/lib/vmware/vmkmod/vmfs3: Failure&lt;br /&gt;&amp;lt;/module&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;Based on the following two threads, I think that hardware support is the problem.&lt;br /&gt;&lt;a href="http://communities.vmware.com/message/1570064"&gt;thread1&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://forums11.itrc.hp.com/service/forums/questionanswer.do?admit=109447626+1290477977799+28353475&amp;amp;threadId=1451556"&gt;thread2&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;I removed some of the hardware but was not able to work around the crash.  I could not find any gigabyte brand motherboards on the compatibility list.  Some people recommend buying a used server for testing, and others recommend Supermicro/LSI.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;h3&gt;Fedora 14 guest on Hyper-V&lt;/h3&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;a href="https://bugzilla.redhat.com/show_bug.cgi?id=603210%20"&gt;Fedora 14 does not come with the Hyper-V drivers.&lt;/a&gt;  I tried the rpmfusion kmod-staging package.  After loading the hv_netvsc module, I could get a DHCP lease, but the Linux kernel would crash often.  The legacy network adapter performed better and was more stable.&lt;br /&gt;&lt;/p&gt;&lt;h3&gt;FreeBSD 8.1 guest on Hyper-V&lt;/h3&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;When I tried to install FreeBSD 8.1 x64 as a Hyper-V guest, the FreeBSD kernel crashed and Hyper-V hammered a processor core.  I was not able to turn off the guest, nor get a clean shut down on the host.  When I powered the host back on, the guest resumed the broken state.  Granted, FreeBSD is not a supported guest, but a guest should not be able to lock up the host system.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;h3&gt;Windows Server 2008 R2 guest on Hyper-V&lt;/h3&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;When I installed Windows Server 2008 R2 as a Hyper-V guest, it would not come online.  The integration services were installed and the NIC showed up in device manager, but was missing from the "ipconfig /all" command output and from the "Manage network connections" control panel.  The event log showed a message about "Microsoft VMBus Network" "This device cannot start".  I re-installed the integration services, rebooted, and that brought the guest online.&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/831962920238354198-7289290432141711220?l=pbwy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pbwy.blogspot.com/feeds/7289290432141711220/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=831962920238354198&amp;postID=7289290432141711220' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/831962920238354198/posts/default/7289290432141711220'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/831962920238354198/posts/default/7289290432141711220'/><link rel='alternate' type='text/html' href='http://pbwy.blogspot.com/2010/11/virtually-same.html' title='virtually the same'/><author><name>BenCollver</name><uri>http://www.blogger.com/profile/03624042887924855196</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-831962920238354198.post-5802957896361035156</id><published>2010-11-25T17:06:00.000-08:00</published><updated>2010-11-25T17:21:45.491-08:00</updated><title type='text'>remote access without SSH</title><content type='html'>As an exercise, I wanted to have authenticated and encrypted shell access without SSH.  Shellinabox [1] permits anyone to connect and it does not authenticate the client.  Instead, I chose to use stunnel and telnet on Fedora 14 and it worked like a charm.  Here are some notes.&lt;br /&gt;&lt;br /&gt;[1]&lt;br /&gt;http://code.google.com/p/shellinabox/&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Install server software.&lt;/h3&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;$ su -&lt;br /&gt;# yum install openssl-perl stunnel telnet-server&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Use stunnel to wrap telnet service.&lt;/h3&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;# vi /etc/xinetd.d/telnet&lt;br /&gt;:%s,\(disable.*=\) yes,\1 no,&lt;br /&gt;:%s,flags.*,&amp;amp; NAMEINARGS,&lt;br /&gt;:%s,\(server.*=\) .*,\1 /usr/bin/stunnel ,&lt;br /&gt;o&lt;br /&gt;server_args = stunnel /etc/stunnel/in.telnetd.conf&lt;br /&gt;:wq&lt;br /&gt;# vi /etc/stunnel/in.telnetd.conf&lt;br /&gt;i&lt;br /&gt;exec = /usr/sbin/in.telnetd&lt;br /&gt;execargs = in.telnetd&lt;br /&gt;CAfile = /etc/pki/CA/cacert.pem&lt;br /&gt;CApath = /etc/stunnel/authorized_certs&lt;br /&gt;cert = /etc/stunnel/in.telnetd.crt&lt;br /&gt;key = /etc/stunnel/in.telnetd.key&lt;br /&gt;verify = 3&lt;br /&gt;ciphers = ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW&lt;br /&gt;sslVersion = TLSv1&lt;br /&gt;:wq&lt;br /&gt;# service xinetd restart&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Create a new SSL certificate authority to sign SSL certificates.&lt;/h3&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;# man CA.pl&lt;br /&gt;Use common sense when responding to CA.pl prompts.&lt;br /&gt;# /etc/pki/tls/misc/CA.pl -newca&lt;br /&gt;At "CA certificate filename (or enter to create)", Press Enter.&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Create an SSL certificate and key for the telnet service.&lt;/h3&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;# /etc/pki/tls/misc/CA.pl -newreq-nodes&lt;br /&gt;# /etc/pki/tls/misc/CA.pl -signreq&lt;br /&gt;# rm -f newreq.pem&lt;br /&gt;# mv newcert.pem /etc/stunnel/in.telnetd.crt&lt;br /&gt;# mv newkey.pem /etc/stunnel/in.telnetd.key&lt;br /&gt;# chmod og-rwx /etc/stunnel/in.telnetd.key&lt;br /&gt;# mkdir /etc/stunnel/authorized_certs&lt;br /&gt;# restorecon -R /etc/stunnel&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Create an SSL certificate and key for the client.&lt;/h3&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;# /etc/pki/tls/misc/CA.pl -newreq-nodes&lt;br /&gt;# /etc/pki/tls/misc/CA.pl -signreq&lt;br /&gt;# rm -f newreq.pem&lt;br /&gt;# cp newcert.pem /etc/stunnel/authorized_certs/telnet.pem&lt;br /&gt;# c_rehash /etc/stunnel/authorized_certs&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Create stunnel configuration for the client.&lt;/h3&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;# mkdir .stunnel&lt;br /&gt;# cp /etc/pki/CA/cacert.pem .stunnel/&lt;br /&gt;# cp /etc/stunnel/in.telnetd.crt .stunnel/in.telnetd.pem&lt;br /&gt;# c_rehash .stunnel&lt;br /&gt;# mv newcert.pem .stunnel/telnet.crt&lt;br /&gt;# mv newkey.pem .stunnel/telnet.key&lt;br /&gt;$ vi .stunnel/client.conf&lt;br /&gt;i&lt;br /&gt;client = yes&lt;br /&gt;foreground = yes&lt;br /&gt;output = .stunnel/client.log&lt;br /&gt;pid =&lt;br /&gt;&lt;br /&gt;[telnet]&lt;br /&gt;accept = localhost:23&lt;br /&gt;connect = servername:23&lt;br /&gt;CAfile = .stunnel/cacert.pem&lt;br /&gt;CApath = .stunnel&lt;br /&gt;cert = .stunnel/telnet.crt&lt;br /&gt;key = .stunnel/telnet.key&lt;br /&gt;verify = 3&lt;br /&gt;ciphers = ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW&lt;br /&gt;sslVersion = TLSv1&lt;br /&gt;:wq&lt;br /&gt;# zip -r keys.zip .stunnel&lt;br /&gt;# rm -fr .stunnel&lt;br /&gt;# mv keys.zip /media/FLASHDRIVE/&lt;br /&gt;# umount /media/FLASHDRIVE/&lt;br /&gt;# exit&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Copy SSL certificate, key, and stunnel configuration to client machine.&lt;/h3&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;$ cd&lt;br /&gt;$ rm -fr .stunnel&lt;br /&gt;$ unzip /media/FLASHDRIVE/keys.zip&lt;br /&gt;$ rm -f /media/FLASHDRIVE/keys.zip&lt;br /&gt;$ chmod og-rwx .stunnel/telnet.key&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Run stunnel to forward telnet from client to server.&lt;/h3&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;$ stunnel .stunnel/client.conf&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;In another terminal, telnet to the stunnel listener.&lt;/h3&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;$ telnet localhost 23&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/831962920238354198-5802957896361035156?l=pbwy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pbwy.blogspot.com/feeds/5802957896361035156/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=831962920238354198&amp;postID=5802957896361035156' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/831962920238354198/posts/default/5802957896361035156'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/831962920238354198/posts/default/5802957896361035156'/><link rel='alternate' type='text/html' href='http://pbwy.blogspot.com/2010/11/remote-access-without-ssh.html' title='remote access without SSH'/><author><name>BenCollver</name><uri>http://www.blogger.com/profile/03624042887924855196</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-831962920238354198.post-6640609953054120235</id><published>2010-10-16T17:41:00.000-07:00</published><updated>2010-10-16T18:11:25.757-07:00</updated><title type='text'>dictionary</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_HJcKEpgF_nI/TLpJVDs0prI/AAAAAAAAA30/vbdPY7rXrC8/s1600/screen.jpg"&gt;&lt;img style="float: left; margin: 0pt 10px 10px 0pt; cursor: pointer; width: 320px; height: 273px;" src="http://1.bp.blogspot.com/_HJcKEpgF_nI/TLpJVDs0prI/AAAAAAAAA30/vbdPY7rXrC8/s320/screen.jpg" alt="" id="BLOGGER_PHOTO_ID_5528812118670091954" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;The book I am reading frequently requires me to reference a dictionary.  Today dict.org went down and that gave me all the excuse I needed to write some easy scripts.  The result works on the basic web browser built in to my MP3 player.&lt;br /&gt;&lt;br /&gt;The script downloads a pre-formatted dictionary, parses the definitions, and enters them into an SQL database.  Another script gives a web-based interface to search the database.&lt;br /&gt;&lt;br /&gt;Here is the shell script that downloads and imports the definitions.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#!/bin/sh&lt;br /&gt;base=ftp://ftp.dict.org/dict/pre/&lt;br /&gt;fn=dict-wn-2.0-pre.tar.gz&lt;br /&gt;url=$base$fn&lt;br /&gt;wget -c $url&lt;br /&gt;tar xf $fn&lt;br /&gt;gzip -dc &amp;lt;wn.dict.dz |\&lt;br /&gt;  awk -f load-wn20.awk |\&lt;br /&gt;  sqlite3 wn20.sqlite&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Here is the AWK script that parses the definitions.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;# Input: preformatted Wordnet 2.0 dictionary from dict.org&lt;br /&gt;# Output: text file formatted for the sqlite3 command&lt;br /&gt;&lt;br /&gt;function printDef() {&lt;br /&gt;  if (length(word) &amp;gt; 0) {&lt;br /&gt;      gsub(/'/, "''", word)&lt;br /&gt;      gsub(/'/, "''", data)&lt;br /&gt;      gsub(/\n\n*$/, "", data)&lt;br /&gt;      printf("insert into wn20 values ('%s', '%s');\n", word, data);&lt;br /&gt;      data = ""&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;BEGIN {&lt;br /&gt;  word = ""&lt;br /&gt;  data = ""&lt;br /&gt;  print "drop table if exists wn20;"&lt;br /&gt;  print "create table wn20 (word text, data text);"&lt;br /&gt;  print "begin;"&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/^[0-9A-Za-z]/ {&lt;br /&gt;  printDef()&lt;br /&gt;  word = toupper($1)&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;{&lt;br /&gt;  data = sprintf("%s%s\n", data, $0)&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;END {&lt;br /&gt;  printDef()&lt;br /&gt;  print "end;"&lt;br /&gt;  print "create index words on wn20 (word);"&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Here is the shell script for the web interface.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#!/bin/sh&lt;br /&gt;&lt;br /&gt;lookup() {&lt;br /&gt;  db="$DOCUMENT_ROOT/$1.sqlite"&lt;br /&gt;  if [ "$3" = "wild" ]&lt;br /&gt;  then&lt;br /&gt;      query="select data from $1 where word like '$2%' limit 5"&lt;br /&gt;  else&lt;br /&gt;      query="select data from $1 where word = '$2'"&lt;br /&gt;  fi&lt;br /&gt;  retval=$(sqlite3 "$db" "$query" 2&amp;gt;&amp;amp;1)&lt;br /&gt;  echo "$retval"&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;word=$(echo "$QUERY_STRING" |\&lt;br /&gt;  sed -e 's/^q=//' -e 's/[^A-Za-z0-9].*//' |\&lt;br /&gt;  tr a-z A-Z)&lt;br /&gt;isWild=$(echo "$QUERY_STRING" | grep '\*' &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 &amp;amp;&amp;amp; echo wild)&lt;br /&gt;web=$(lookup web1913 $word $isWild)&lt;br /&gt;wn=$(lookup wn20 $word $isWild)&lt;br /&gt;if [ -z "$web" -a -z "$wn" ]&lt;br /&gt;then&lt;br /&gt;  data="No definition found for word '$word'."&lt;br /&gt;else&lt;br /&gt;  data="&amp;lt;h2&amp;gt;From Webster's 1914 Dictionary:&amp;lt;/h2&amp;gt;&lt;br /&gt;&amp;lt;pre id="web"&amp;gt;&lt;br /&gt;$web&lt;br /&gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;&amp;lt;h2&amp;gt;From WordNet 2.0 Dictionary:&amp;lt;/h2&amp;gt;&lt;br /&gt;&amp;lt;pre id="wn"&amp;gt;&lt;br /&gt;$wn&lt;br /&gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;"&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;cat &amp;lt;&amp;lt;__TOP__&lt;br /&gt;Content-type: text/html&lt;br /&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;&amp;lt;title&amp;gt;dict $word&amp;lt;/title&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&amp;lt;form action="$SCRIPT_URL" name="dict"&amp;gt;&lt;br /&gt;Word: &amp;lt;input type="text" name="q" /&amp;gt;&lt;br /&gt;&amp;lt;input type="submit" /&amp;gt;&lt;br /&gt;&amp;lt;/form&amp;gt;&lt;br /&gt;__TOP__&lt;br /&gt;&lt;br /&gt;if [ ! -z "$word" ]&lt;br /&gt;then&lt;br /&gt;  cat &amp;lt;&amp;lt;__MID__&lt;br /&gt;&amp;lt;h1&amp;gt;$word :&amp;lt;/h1&amp;gt;&lt;br /&gt;$data&lt;br /&gt;__MID__&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;cat &amp;lt;&amp;lt;__END__&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;__END__&lt;br /&gt;exit 0&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;The scripts are in the linked &lt;a href="http://terrorpin.net/dict.zip"&gt;dict.zip&lt;/a&gt; file.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/831962920238354198-6640609953054120235?l=pbwy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pbwy.blogspot.com/feeds/6640609953054120235/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=831962920238354198&amp;postID=6640609953054120235' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/831962920238354198/posts/default/6640609953054120235'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/831962920238354198/posts/default/6640609953054120235'/><link rel='alternate' type='text/html' href='http://pbwy.blogspot.com/2010/10/dictionary.html' title='dictionary'/><author><name>BenCollver</name><uri>http://www.blogger.com/profile/03624042887924855196</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_HJcKEpgF_nI/TLpJVDs0prI/AAAAAAAAA30/vbdPY7rXrC8/s72-c/screen.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-831962920238354198.post-4349962318933869583</id><published>2010-09-23T05:46:00.000-07:00</published><updated>2010-09-23T06:46:31.477-07:00</updated><title type='text'>tabletop gaming</title><content type='html'>D&amp;amp;D comes in &lt;a href="http://web.fisher.cx/robert/rpg/dnd-id/"&gt;many flavors&lt;/a&gt;, and you can play &lt;a href="http://www.lulu.com/product/file-download/quick-primer-for-old-school-gaming/3159558"&gt;old school&lt;/a&gt; for free with a &lt;a href="http://www.goblinoidgames.com/labyrinthlord.html"&gt;retro clone such as Labyrinth Lord&lt;/a&gt;.  It is a social game and many adventures are designed for 5 or 6 players.  It can be played over the Internet using free tools such as Skype, Google Docs, and &lt;a href="http://dicelog.com/"&gt;dicelog.com&lt;/a&gt;.  There are many &lt;a href="http://www.dragonsfoot.org/cd/"&gt;resources&lt;/a&gt; available, and you can adapt &lt;a href="http://www.enworld.org/forum/attachments/4e-discussion/44277d1276231410-d-d-4th-edition-hack-fiction-first-playtest-hex-crawl.pdf"&gt;resources from other games&lt;/a&gt;.  For beginners or smaller groups, &lt;a href="http://www.oversoul-games.com/oversoul_download.html"&gt;Dungeon Plungin'&lt;/a&gt; might be a better option.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/831962920238354198-4349962318933869583?l=pbwy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pbwy.blogspot.com/feeds/4349962318933869583/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=831962920238354198&amp;postID=4349962318933869583' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/831962920238354198/posts/default/4349962318933869583'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/831962920238354198/posts/default/4349962318933869583'/><link rel='alternate' type='text/html' href='http://pbwy.blogspot.com/2010/09/tabletop-gaming.html' title='tabletop gaming'/><author><name>BenCollver</name><uri>http://www.blogger.com/profile/03624042887924855196</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-831962920238354198.post-8166914818169839139</id><published>2010-06-13T17:02:00.000-07:00</published><updated>2010-06-13T17:21:49.938-07:00</updated><title type='text'>Slackware chroot on Fedora</title><content type='html'>I used Slackware to give new life to some low-end computers.  I wanted to run Fedora 13 on my desktop to try SELinux, but I wanted to compile packages on my desktop instead of the weaker computers.  My first approach was to install Slackware in a virtual machine, but my processor lacks VT-x and KVM ran very slowly.  My next approach was to install Slackware in a chroot environment.  Test builds are exactly what &lt;a href="http://en.wikipedia.org/wiki/Chroot"&gt;chroot()&lt;/a&gt; was made for.  SELinux broke the compiler, so I made local policy to grant all permissions to Slackware.  This is not so great for security, but well enough for a learning exercise.  Plus, I don't have to reboot into Slackware or disable SELinux.  Here's what I did.&lt;br /&gt;&lt;br /&gt;Installed Slackware 13.1 from the first install CD, based on &lt;a href="http://slackworld.berlios.de/2007/chroot_howto.html"&gt;these notes&lt;/a&gt;.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;# mkdir /slackware&lt;br /&gt;# cd /slackware&lt;br /&gt;# for f in /media/S13_1d1/slackware/a/*tgz; do tar xf $f; done&lt;br /&gt;# sbin/installpkg -root /slackware /media/S13_1d1/slackware/{a,ap,d,l,n}/*.txz&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Created SELinux policy to allow slackware to do everything.  The following documents were helpful.&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://docs.fedoraproject.org/en-US/Fedora/13/html/SELinux_FAQ/"&gt;SELinux FAQ&lt;/a&gt;, section 1.2, question 4.&lt;/li&gt;&lt;li&gt;SELinux Project &lt;a href="http://selinuxproject.org/page/PolicyLanguage"&gt;Policy Language&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;Seedit SELinux &lt;a href="http://seedit.sourceforge.net/doc/access_vectors/"&gt;Permissions.&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;code&gt;&lt;br /&gt;# cd&lt;br /&gt;# mkdir slackware&lt;br /&gt;# cd slackware&lt;br /&gt;# touch slackware.{fc,if,te}&lt;br /&gt;# cat &amp;gt;slackware.te &amp;lt;&amp;lt;__EOF__&lt;br /&gt;policy_module(slackware, 1.0)&lt;br /&gt;&lt;br /&gt;require {&lt;br /&gt; type fs_t;&lt;br /&gt; type setfiles_t;&lt;br /&gt; type unconfined_t;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;type slackware_t;&lt;br /&gt;&lt;br /&gt;# necessary for restorecon&lt;br /&gt;allow slackware_t fs_t : filesystem { associate } ;&lt;br /&gt;allow setfiles_t slackware_t : file * ;&lt;br /&gt;allow setfiles_t slackware_t : dir * ;&lt;br /&gt;allow setfiles_t slackware_t : lnk_file * ;&lt;br /&gt;allow setfiles_t slackware_t : chr_file * ;&lt;br /&gt;allow setfiles_t slackware_t : blk_file * ;&lt;br /&gt;allow setfiles_t slackware_t : fifo_file * ;&lt;br /&gt;&lt;br /&gt;# necessary for programs within chroot /slackware&lt;br /&gt;allow unconfined_t slackware_t : file * ;&lt;br /&gt;allow unconfined_t slackware_t : dir * ;&lt;br /&gt;allow unconfined_t slackware_t : lnk_file * ;&lt;br /&gt;allow unconfined_t slackware_t : chr_file * ;&lt;br /&gt;allow unconfined_t slackware_t : blk_file * ;&lt;br /&gt;allow unconfined_t slackware_t : sock_file * ;&lt;br /&gt;allow unconfined_t slackware_t : fifo_file * ;&lt;br /&gt;__EOF__&lt;br /&gt;# make -f /usr/share/selinux/devel/Makefile&lt;br /&gt;# semodule -i slackware.pp&lt;br /&gt;# semanage fcontext -a -s unconfined_u -t slackware_t '/slackware.*'&lt;br /&gt;# restorecon -R /slackware&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Then I tested the chroot environment.  It is not shown here, but I also built several packages from &lt;a href="http://slackbuilds.org/"&gt;http://slackbuilds.org/&lt;/a&gt;.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;# mkdir proc sys&lt;br /&gt;# mount --bind /proc /slackware/proc&lt;br /&gt;# mount --bind /sys /slackware/sys&lt;br /&gt;# chroot /slackware&lt;br /&gt;# cd&lt;br /&gt;# cat &amp;gt;hi.c &amp;lt;&amp;lt;__EOF__&lt;br /&gt;#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;&lt;br /&gt;int main(int argc, char *argv[]) {&lt;br /&gt;   puts("hi there");&lt;br /&gt;   return 0;&lt;br /&gt;}&lt;br /&gt;__EOF__&lt;br /&gt;# cc -o hi hi.c&lt;br /&gt;# ./hi&lt;br /&gt;hi there&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/831962920238354198-8166914818169839139?l=pbwy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pbwy.blogspot.com/feeds/8166914818169839139/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=831962920238354198&amp;postID=8166914818169839139' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/831962920238354198/posts/default/8166914818169839139'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/831962920238354198/posts/default/8166914818169839139'/><link rel='alternate' type='text/html' href='http://pbwy.blogspot.com/2010/06/slackware-chroot-on-fedora.html' title='Slackware chroot on Fedora'/><author><name>BenCollver</name><uri>http://www.blogger.com/profile/03624042887924855196</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-831962920238354198.post-2240001548235378064</id><published>2010-06-12T12:12:00.000-07:00</published><updated>2010-06-12T12:50:40.902-07:00</updated><title type='text'>SELinux transition</title><content type='html'>Read the &lt;a href="http://docs.fedoraproject.org/en-US/Fedora/13/html/Security-Enhanced_Linux/index.html"&gt;RedHat SELinux User Guide&lt;/a&gt; this morning.  So far, I think of SELinux as a generic kernel-level application firewall.  It would augment and not replace the JVM &lt;a href="http://en.wikipedia.org/wiki/Sandbox_%28security%29"&gt;sandbox&lt;/a&gt;.  On RedHat, it seems intended for servers because there are myriads of policies written for services and very few written for users and roles.  Here are some personal notes in response to the User Guide.&lt;br /&gt;&lt;br /&gt;Chapter 3. SELinux Contexts&lt;br /&gt;Section 3.1. Domain Transitions&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;only authorized domains, such as passwd_t, can write to files labeled with the shadow_t  type. Even if other processes are running with superuser privileges, those processes can not write to files labeled with the shadow_t type, as they are not running in the passwd_t domain.&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Why can root run "vi /etc/shadow" and successfully write using ":w!"?  The answer comes later in chapter 4.&lt;br /&gt;&lt;br /&gt;Chapter 4. Targeted Policy&lt;br /&gt;Section 4.2. Unconfined Processes&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;Processes running in unconfined domains fall back to using DAC rules exclusively.&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;"ps -eZ | grep bash" reveals that the root shell is running in an unconfined domain.  That is why it can write to /etc/shadow.&lt;br /&gt;&lt;br /&gt;What protection does SELinux offer to an interactive root user?  The answer comes later in chapter 6.&lt;br /&gt;&lt;br /&gt;Chapter 6. Confining users&lt;br /&gt;Section 6.2. Confining New Linux Users&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;When Linux users run in the unconfined_t domain, SELinux policy rules are applied, but policy rules exist that allow Linux users running in the unconfined_t  domain almost all access. If unconfined Linux users execute an application that SELinux policy defines can transition from the unconfined_t domain to its own confined domain, unconfined Linux users are still subject to the restrictions of that confined domain. The security benefit of this is that, even though a Linux user is running unconfined, the application remains confined, and therefore, the exploitation of a flaw in the application can be limited by policy.&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Going back to the example in section 3.1, the passwd command has the passwd_exec_t type, which transitions the passwd process to the passwd_t domain so that it can write to files with the shadow_t type.  How can I see the policy responsible for transitioning the passwd process to the passwd_t domain?  Found the answer after asking questions on IRC and reading about &lt;a href="http://selinuxproject.org/page/TypeRules#type_transition_Statement"&gt;Domain Transitions&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;# id --context&lt;br /&gt;unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023&lt;br /&gt;&lt;br /&gt;# ls --context /usr/bin/passwd&lt;br /&gt;-rwsr-xr-x. root root system_u:object_r:passwd_exec_t:s0 /usr/bin/passwd&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;The following rule states that when a process of type unconfined_t executes a file of type passwd_exec_t, the process type should be changed to passwd_t if allowed by the policy (i.e. Transition from the unconfined_t domain to the passwd_t domain).&lt;br /&gt;&lt;code&gt;&lt;br /&gt;# sesearch --type --source=unconfined_t --target=passwd_exec_t&lt;br /&gt;Found 1 semantic te rules:&lt;br /&gt;   type_transition unconfined_t passwd_exec_t : process passwd_t;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;File needs to be executable in the unconfined_t domain:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;# sesearch --allow --source=unconfined_t --target=passwd_exec_t | grep -w unconfined_t&lt;br /&gt;   allow unconfined_t passwd_exec_t : file { read getattr execute open } ;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;The executable file needs an entry point into the passwd_t domain:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;# sesearch --allow --source=passwd_t --target=passwd_exec_t&lt;br /&gt;Found 1 semantic av rules:&lt;br /&gt;   allow passwd_t passwd_exec_t : file { ioctl read getattr lock execute entrypoint open } ;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Process needs permission to transition into the passwd_t domain:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;# sesearch --allow --source=unconfined_t --target=passwd_t | grep -w unconfined_t&lt;br /&gt;   allow unconfined_t passwd_t : process transition ;&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/831962920238354198-2240001548235378064?l=pbwy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pbwy.blogspot.com/feeds/2240001548235378064/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=831962920238354198&amp;postID=2240001548235378064' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/831962920238354198/posts/default/2240001548235378064'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/831962920238354198/posts/default/2240001548235378064'/><link rel='alternate' type='text/html' href='http://pbwy.blogspot.com/2010/06/selinux-transition.html' title='SELinux transition'/><author><name>BenCollver</name><uri>http://www.blogger.com/profile/03624042887924855196</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-831962920238354198.post-1962252987621369918</id><published>2010-05-25T20:35:00.000-07:00</published><updated>2010-05-25T21:12:33.943-07:00</updated><title type='text'>foot notes</title><content type='html'>Some times while reading books I will want to make notes for later.  Firefox has an add-on that can be used for this purpose.&lt;br /&gt;&lt;br /&gt;Here is a link to install &lt;a href="http://addons.mozilla.org/firefox/addon/8186"&gt;ScrapBook Plus&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Once installed, view an HTML ebook such as &lt;a href="http://www.gutenberg.org/files/2852/2852-h/2852-h.htm"&gt;The Hound of the Baskervilles&lt;/a&gt; by Arthur Conan Doyle.&lt;br /&gt;&lt;br /&gt;Click ScrapBook Plus.  Click Capture Page.  Click ScrapBook Plus.  Click The Hound of the Baskervilles.  Now you are viewing your local copy of the book.&lt;br /&gt;&lt;br /&gt;To highlight, select the desired section and click Style 1.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_HJcKEpgF_nI/S_ydUPPp6XI/AAAAAAAAAvM/F5kSe8ophqg/s1600/scrapbookplus.jpg"&gt;&lt;img style="float: right; margin: 0pt 0pt 10px 10px; cursor: pointer; width: 317px; height: 320px;" src="http://4.bp.blogspot.com/_HJcKEpgF_nI/S_ydUPPp6XI/AAAAAAAAAvM/F5kSe8ophqg/s320/scrapbookplus.jpg" alt="" id="BLOGGER_PHOTO_ID_5475424217990818162" border="0" /&gt;&lt;/a&gt;To add a foot note, click the pencil button in the bottom tool bar.  This will insert a note.  You can move the note by dragging the top edge around.  You can grow or shrink the note by dragging the bottom right edge.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_HJcKEpgF_nI/S_ye26spBlI/AAAAAAAAAvU/Tb136FCW-k4/s1600/scrapbookplus2.jpg"&gt;&lt;img style="float: left; margin: 0pt 10px 10px 0pt; cursor: pointer; width: 234px; height: 85px;" src="http://3.bp.blogspot.com/_HJcKEpgF_nI/S_ye26spBlI/AAAAAAAAAvU/Tb136FCW-k4/s320/scrapbookplus2.jpg" alt="" id="BLOGGER_PHOTO_ID_5475425913282299474" border="0" /&gt;&lt;/a&gt;To save your notes, click the floppy disk icon.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/831962920238354198-1962252987621369918?l=pbwy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pbwy.blogspot.com/feeds/1962252987621369918/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=831962920238354198&amp;postID=1962252987621369918' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/831962920238354198/posts/default/1962252987621369918'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/831962920238354198/posts/default/1962252987621369918'/><link rel='alternate' type='text/html' href='http://pbwy.blogspot.com/2010/05/foot-notes.html' title='foot notes'/><author><name>BenCollver</name><uri>http://www.blogger.com/profile/03624042887924855196</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_HJcKEpgF_nI/S_ydUPPp6XI/AAAAAAAAAvM/F5kSe8ophqg/s72-c/scrapbookplus.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-831962920238354198.post-1671561183682369879</id><published>2010-05-24T18:55:00.000-07:00</published><updated>2010-05-24T19:51:30.451-07:00</updated><title type='text'>scrollmarks</title><content type='html'>Page numbers can be a convenient way to save your place in an HTML ebook, but what if the page numbers are missing?  Here is a work around to save the position in a Firefox bookmark.&lt;br /&gt;&lt;br /&gt;Right click &lt;a href="javascript:window.location=window.location.href.replace(/#.*/,'')+'#scrollTop'+(document.body.scrollTop+document.documentElement.scrollTop);void(0);"&gt;Save Position&lt;/a&gt; and click Bookmark This Link.&lt;br /&gt;&lt;br /&gt;Right click &lt;a href="javascript:document.body.scrollTop=document.documentElement.scrollTop=parseInt(window.location.href.replace(/.*#scrollTop/,''));void(0);"&gt;Load Position&lt;/a&gt; and click Bookmark This Link.&lt;br /&gt;&lt;br /&gt;View an HTML ebook, such as &lt;a href="http://www.gutenberg.org/files/345/345-h/345-h.htm"&gt;Dracula&lt;/a&gt; by Bram Stoker.&lt;br /&gt;&lt;br /&gt;Scroll down to the desired section.  Click Bookmarks.  Click Save Position.  Click Bookmarks.  Click Bookmark This Page.&lt;br /&gt;&lt;br /&gt;Close the web browser and start a new one.  Click Bookmarks.  Click Dracula.  Click Bookmarks.  Click Load Position.  This will return you to the saved position.&lt;br /&gt;&lt;br /&gt;I tend to read books in full screen mode.  You can press F11 to enter full screen mode and Ctrl-Shift-O to open your bookmarks.&lt;br /&gt;&lt;br /&gt;If you save the position in full screen mode and load the position in window mode, then do not expect it to work correctly.  It would fail because the position depends on the size of the window (and font).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/831962920238354198-1671561183682369879?l=pbwy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pbwy.blogspot.com/feeds/1671561183682369879/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=831962920238354198&amp;postID=1671561183682369879' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/831962920238354198/posts/default/1671561183682369879'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/831962920238354198/posts/default/1671561183682369879'/><link rel='alternate' type='text/html' href='http://pbwy.blogspot.com/2010/05/scrollmarks.html' title='scrollmarks'/><author><name>BenCollver</name><uri>http://www.blogger.com/profile/03624042887924855196</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-831962920238354198.post-7993172137837863655</id><published>2010-05-23T15:53:00.000-07:00</published><updated>2010-05-23T17:13:24.535-07:00</updated><title type='text'>ebook font on Linux</title><content type='html'>I read HTML ebooks in Firefox on Linux.  The Firefox default serif font is legible but not stylish.  I wanted to try Caslon, a font favored by Ben Franklin.  Here are the steps I took.&lt;br /&gt;&lt;br /&gt;Run xterm and type the following commands.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;mkdir ~/.fonts&lt;br /&gt;cd ~/.fonts&lt;br /&gt;wget http://www.orbitals.com/programs/wyld.zip&lt;br /&gt;unzip -LL wyld.zip *.ttf&lt;br /&gt;rm wyld.zip&lt;br /&gt;mkfontscale&lt;br /&gt;mkfontdir&lt;br /&gt;xset fp+ ~/.fonts&lt;br /&gt;xset fp rehash&lt;br /&gt;exit&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Right click &lt;a href="javascript:document.body.style.fontFamily='Wyld';document.body.style.fontSize='14pt';void(0);"&gt;Use Caslon Font&lt;/a&gt; and click Bookmark This Link.&lt;br /&gt;&lt;br /&gt;View an HTML ebook, such as &lt;a href="http://www.gutenberg.org/files/18359/18359-h/18359-h.htm"&gt;The Story of My Boyhood and Youth&lt;/a&gt; by John Muir.&lt;br /&gt;&lt;br /&gt;Click Bookmarks and click Use Caslon Font.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/831962920238354198-7993172137837863655?l=pbwy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pbwy.blogspot.com/feeds/7993172137837863655/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=831962920238354198&amp;postID=7993172137837863655' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/831962920238354198/posts/default/7993172137837863655'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/831962920238354198/posts/default/7993172137837863655'/><link rel='alternate' type='text/html' href='http://pbwy.blogspot.com/2010/05/ebook-font-on-linux.html' title='ebook font on Linux'/><author><name>BenCollver</name><uri>http://www.blogger.com/profile/03624042887924855196</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry></feed>
