<?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-3279819592335911399</id><updated>2011-10-28T16:29:05.845-04:00</updated><category term='x.org'/><category term='breaking packages'/><category term='oss'/><category term='astronomy'/><category term='introduction'/><category term='installing'/><category term='debugging'/><category term='security'/><category term='cell phone'/><category term='fonts'/><category term='gsm'/><category term='modules'/><category term='backups'/><category term='audit'/><category term='mythtv'/><category term='sendmail'/><category term='patches'/><category term='configuring'/><category term='kde'/><category term='television'/><category term='traveling'/><category term='taiwan'/><category term='sound'/><category term='spam'/><category term='kernel'/><category term='internet'/><category term='impact'/><category term='history'/><category term='email'/><category term='compiling'/><category term='physics'/><category term='X11R7'/><category term='review'/><category term='blogging'/><category term='login failure'/><category term='X11'/><category term='chinese'/><category term='crypto'/><category term='ottawa'/><category term='hardware'/><category term='rationale'/><category term='OpenGL'/><category term='one size fits all'/><title type='text'>Linux without a package manager</title><subtitle type='html'>Experiences of maintaining Linux computers without benefit of RPMs, .deb files, or similar packages.  Problems encountered, and sometimes solutions found.  Plus whatever else draws my attention.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://distrofreelinuxuser.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://distrofreelinuxuser.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Winter Toad</name><uri>http://www.blogger.com/profile/05606540195506310406</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>27</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3279819592335911399.post-2367913883384693089</id><published>2011-10-28T16:29:00.000-04:00</published><updated>2011-10-28T16:29:05.860-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='traveling'/><category scheme='http://www.blogger.com/atom/ns#' term='mythtv'/><category scheme='http://www.blogger.com/atom/ns#' term='hardware'/><category scheme='http://www.blogger.com/atom/ns#' term='television'/><title type='text'>Converting DVDs for viewing on a tablet, while inlining captions</title><content type='html'>Previously, I&amp;nbsp; &lt;a href="http://distrofreelinuxuser.blogspot.com/2011/10/converting-hdtv-videos-for-viewing-on.html"&gt;described how to convert HDTV videos&lt;/a&gt; for my EEE Pad Transformer.&amp;nbsp; Now, I'll go over something a bit more difficult.&lt;br /&gt;&lt;br /&gt;My wife and I have some DVDs of Bollywood films that we enjoy watching.&amp;nbsp; &lt;a href="http://www.imdb.com/title/tt0986213/"&gt;Aaja Nachle&lt;/a&gt;, &lt;a href="http://www.imdb.com/title/tt1024943/"&gt;Om Shanti Om&lt;/a&gt;, &lt;a href="http://www.imdb.com/title/tt1187043/"&gt;3 Idiots&lt;/a&gt;, &lt;a href="http://www.imdb.com/title/tt1230448/"&gt;Billu&lt;/a&gt;, among others.&amp;nbsp; These films are mostly in Hindi, but there are English subtitles available.&amp;nbsp; As we don't understand Hindi, we watch the movies with the subtitles.&amp;nbsp; The Android media viewer that comes with the tablet doesn't have a way to select subtitles from an alternate video stream.&lt;br /&gt;&lt;br /&gt;Now, I wanted to make files of these movies that I could watch on the Android tablet.&amp;nbsp; As noted in the previous article, the resulting files have to be H.264 Baseline profile, and under 2GB in size.&lt;br /&gt;&lt;br /&gt;Here's how I did this.&amp;nbsp; Note that this procedure required no less than 70 GB of free disk space to hold a large intermediate file, as I wanted to avoid artefacts introduced by running through multiple codecs, so I used a lossless intermediate state.&lt;br /&gt;&lt;br /&gt;First of all, I used the MythTV option to rip a perfect copy of the DVD.&amp;nbsp; That gave me a file, say 3IDIOTS.vob.&lt;br /&gt;&lt;br /&gt;Next, I used mencoder to inline the captions directly into the video stream:&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"&gt;&lt;code&gt;mencoder -ovc lavc -lavcopts vcodec=ljpeg:aspect=16/9 \&lt;br /&gt;    -vobsubid 0 -oac lavc -lavcopts acodec=flac \&lt;br /&gt;    -o 3idiots 3IDIOTS.vob&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;The output file, 3idiots, was, as noted, huge.&amp;nbsp; It consisted of a lossless jpeg video stream, with the subtitle 0 track overlaid on the video stream itself.&lt;br /&gt;&lt;br /&gt;Next, the file had to be converted to H.264 Baseline.&amp;nbsp; In this case, I decided, rather than setting a qmax, that I would set a bitrate.&amp;nbsp; That way I could be certain ahead of time what the final size of the file would be, though at the cost of increased trancoding time.&amp;nbsp; To get a fixed bitrate, it is necessary to run ffmpeg in two passes, once to collect statistics, and the second time to generate the file itself.&amp;nbsp; Here's how this is run:&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"&gt;&lt;code&gt;ffmpeg -pass 1 -i 3idiots -vcodec libx264 -vpre fast \&lt;br /&gt;    -vpre baseline -b 1400 -acodec libfaac -ab 64k \&lt;br /&gt;    -ac 2 -ar 44100 -threads 3 \&lt;br /&gt;    -deinterlace -y junkfile.mp4&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"&gt;&lt;code&gt;ffmpeg -pass 2 -i 3idiots -vcodec libx264 -vpre fast \&lt;br /&gt;    -vpre baseline -b 1400k -acodec libfaac -ab 64k \&lt;br /&gt;    -ac 2 -ar 44100 -threads 3 \&lt;br /&gt;    -deinterlace 3idiots.mp4 &lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;The "junkfile.mp4" file can be deleted.&amp;nbsp; The H.264 file, 3idiots.mp4, came in at 1.8 GB, and was of quite acceptable quality to view on the tablet.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3279819592335911399-2367913883384693089?l=distrofreelinuxuser.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://distrofreelinuxuser.blogspot.com/feeds/2367913883384693089/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3279819592335911399&amp;postID=2367913883384693089' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/2367913883384693089'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/2367913883384693089'/><link rel='alternate' type='text/html' href='http://distrofreelinuxuser.blogspot.com/2011/10/converting-dvds-for-viewing-on-tablet.html' title='Converting DVDs for viewing on a tablet, while inlining captions'/><author><name>Winter Toad</name><uri>http://www.blogger.com/profile/05606540195506310406</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-3279819592335911399.post-4406627719237401171</id><published>2011-10-28T16:07:00.000-04:00</published><updated>2011-10-28T16:07:40.957-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='traveling'/><category scheme='http://www.blogger.com/atom/ns#' term='mythtv'/><category scheme='http://www.blogger.com/atom/ns#' term='hardware'/><category scheme='http://www.blogger.com/atom/ns#' term='television'/><title type='text'>Converting HDTV videos for viewing on a tablet</title><content type='html'>I have an Android-based tablet computer, the EEE Pad Transformer.&amp;nbsp; My MythTV computer can record digital over-the-air broadcasts in high definition now that I have put an HDHomerun on my network.&amp;nbsp; So, it would be nice to be able to transfer some HDTV programs to the Android computer to watch them there while traveling.&amp;nbsp; The HDTV shows are 1080i, encoded as mpeg2 video, at a bitrate of close to 16000 kbits/sec.&lt;br /&gt;&lt;br /&gt;So, what are our constraints?&amp;nbsp; The Android computer is not powerful enough to play videos without hardware assist, and that hardware assist is only available when viewing H.264 videos encoded with the baseline profile.&amp;nbsp; It doesn't work on main profile H.264 videos.&amp;nbsp; Also, the Micro-SD card that I plug into the tablet must be formatted as VFAT, it isn't recognized when I reformat it to any more modern Linux filesystems, so our files are going to have to be under 2GB in size.&amp;nbsp; Also, the Android screen is only 1280x800, so there's no point copying a 2560x1080 file there, the machine will have to reduce the resolution, we might as well do it before we copy it to the card.&lt;br /&gt;&lt;br /&gt;So, a 1 hour show, recorded on the MythTV box, is about 8 GB and in the wrong format.&amp;nbsp; We convert it in two steps.&amp;nbsp; First, cut out any commercials and transcode it at high quality.&amp;nbsp; For network broadcast television that chops off about 25% of the file size, and you probably didn't want to watch the commercials while sitting on the train/airplane anyway.&lt;br /&gt;&lt;br /&gt;Next, it has to be transcoded to H.264 Basline.&amp;nbsp; This can be done with ffmpeg:&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"&gt;&lt;code&gt;ffmpeg -i PROGRAM.mpg -vcodec libx264 -vpre fast \&lt;br /&gt;     -vpre baseline -s hd720 -qmax 30 -acodec libfaac \&lt;br /&gt;     -ab 128k -ac 2 -threads 4 -ar 44100 -deinterlace \&lt;br /&gt;     PROGRAM.mp4&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;This takes the HDTV .mpg file from mythtv, "PROGRAM.mpg", and converts it.&amp;nbsp; We use the libx264 video codec, fast settings, baseline profile, formatted for a high definition 720 line screen.&amp;nbsp; "qmax" sets a limit on quality loss, I usually use a value between 25 and 30.&amp;nbsp; We use the FAAC audio codec at 128kbits/sec, deinterlace the result, and write it to "PROGRAM.mp4".&lt;br /&gt;&lt;br /&gt;The resulting file, about 45 minutes of air time, is about 600 MB in size.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3279819592335911399-4406627719237401171?l=distrofreelinuxuser.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://distrofreelinuxuser.blogspot.com/feeds/4406627719237401171/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3279819592335911399&amp;postID=4406627719237401171' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/4406627719237401171'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/4406627719237401171'/><link rel='alternate' type='text/html' href='http://distrofreelinuxuser.blogspot.com/2011/10/converting-hdtv-videos-for-viewing-on.html' title='Converting HDTV videos for viewing on a tablet'/><author><name>Winter Toad</name><uri>http://www.blogger.com/profile/05606540195506310406</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-3279819592335911399.post-5347149766828046441</id><published>2009-09-18T18:12:00.003-04:00</published><updated>2010-08-08T18:09:37.085-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='gsm'/><category scheme='http://www.blogger.com/atom/ns#' term='taiwan'/><category scheme='http://www.blogger.com/atom/ns#' term='internet'/><category scheme='http://www.blogger.com/atom/ns#' term='cell phone'/><title type='text'>Getting GSM + Internet while visiting Taiwan</title><content type='html'>I have a Palm Centro phone, not SIM-locked, so I can obtain local phone numbers when I travel.  Of course, it doesn't make sense to try to sign up for a contract if you're only in the country for two weeks, so a pre-paid phone card is really the best choice.&lt;br /&gt;&lt;br /&gt;I recently made one of my frequent trips to Taiwan to visit family there.  While there, I wanted a local phone number so people could reach me, and I also wanted to be able to use my phone's web browser and Google Earth, meaning I needed Internet access.&lt;br /&gt;&lt;br /&gt;This may not be the only way to do that, and may not be the cheapest, it just happens to be the way I did it.  I went to a few cell-phone company shop fronts.  FarEasTone had not yet opened for the day, so I went to Aurora.  The Aurora staff told me they could give me a pre-paid account, but not with Internet access.  So the third stop in my quest was &lt;a href="http://www.cht.com.tw/"&gt;Chunghwa Telecom&lt;/a&gt; (中華電信).  It's one of the larger companies.  Here, I was able to get everything that I was looking for.&lt;br /&gt;&lt;br /&gt;You will need:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;An unlocked GSM (or G3) cell phone.&lt;/li&gt;&lt;li&gt;Two pieces of photo ID.  I used my Canadian passport and my Ontario driver's license.&lt;/li&gt;&lt;li&gt;A local address in Taiwan.  A hotel address is fine.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The ability to communicate with the staff.&lt;/li&gt;&lt;/ol&gt;I can speak Mandarin, and could carry out the transaction in that language.  Don't assume that the employees can speak English - if you cannot carry on conversations in Mandarin you should bring somebody to interpret for you.&lt;br /&gt;&lt;br /&gt;I signed up for a pre-paid G3 card.  While my phone is GSM, the G3 cards are backward compatible to the older format.  I paid NT$300 (about C$10) up front, and got the full amount in credit on my account, there are no setting-up fees, all the money goes toward pre-paid airtime minutes.  The transaction took only a few minutes, and I was able to make test calls from my phone before getting up from my chair.  The SIM card comes with a 4-digit unlock code, you have to enter this every time you turn on the cell phone.  You can set up voice mail, but I didn't bother.&lt;br /&gt;&lt;br /&gt;I was actually a bit surprised that I could set up a new phone number for only C$10.  I would have expected that the administration costs would make it impractical to offer such a low-price entry.  In the end, I used only about C$23 in air time charges in the almost three weeks I was there.&lt;br /&gt;&lt;br /&gt;Calls are billed by the second.  After each outgoing call, a text message is sent to your phone telling you the number you called, the time spent on the call, the amount charged against your account for the call, and the expiry date of your account.  The account expiration timer is 180 days, reset every time you add funds to your account.  To add funds to  your account, you simply walk into any 7-11 and tell them you want to buy a recharge for your Chunghwa Telecom (zhong1 hua2 dian4 xin4) phone.  Recharges cost NT$300, and again, all of the money you pay goes into pre-paid airtime minutes, without anything held back for "access fees" etc.  To use the recharge, follow the directions printed on the card.  Basically, you call 928, go through a couple of menu options, then type in the PIN revealed by scratching the back of the recharge.&lt;br /&gt;&lt;br /&gt;The employee who set up my account warned me that Internet use was expensive, but I didn't find it so.  Of course, I wasn't watching television shows on my cell phone, just visiting a few websites in the morning to read the news from home.  The price quoted for GPRS is NT$0.005 per "packet".  A GPRS packet is about 1 kB, so that would make the price about NT$5 per megabyte.&lt;br /&gt;&lt;br /&gt;You should probably ask that your service be set for English.  If you don't do it at the counter, you can change your language preference at any time by calling the number 928.  While I can read Chinese, my phone, bought in North America, doesn't have Chinese fonts, so the text messages sent after every outgoing call are unreadable unless you've set your language preference to English.&lt;br /&gt;&lt;br /&gt;EDIT: returning to Taiwan this year, the same SIM card in the same cell phone couldn't log onto the Internet.&amp;nbsp; After a bit of discussion between their customer service staff and their IT support, it was determined that we had to edit the network settings on my cell phone, specifically assigning an APN string of "emome".&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3279819592335911399-5347149766828046441?l=distrofreelinuxuser.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://distrofreelinuxuser.blogspot.com/feeds/5347149766828046441/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3279819592335911399&amp;postID=5347149766828046441' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/5347149766828046441'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/5347149766828046441'/><link rel='alternate' type='text/html' href='http://distrofreelinuxuser.blogspot.com/2009/09/getting-gsm-internet-while-visiting.html' title='Getting GSM + Internet while visiting Taiwan'/><author><name>Winter Toad</name><uri>http://www.blogger.com/profile/05606540195506310406</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-3279819592335911399.post-3745347232312093395</id><published>2009-07-04T08:21:00.003-04:00</published><updated>2009-07-04T11:01:51.070-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='impact'/><category scheme='http://www.blogger.com/atom/ns#' term='television'/><category scheme='http://www.blogger.com/atom/ns#' term='review'/><category scheme='http://www.blogger.com/atom/ns#' term='astronomy'/><category scheme='http://www.blogger.com/atom/ns#' term='physics'/><title type='text'>Musings on the "Impact" miniseries</title><content type='html'>I watched that 4-hour television miniseries, "Impact", yesterday.  I'm now going to set down some of my observations, from a physics and astronomy viewpoint.  Even a broadcast like that can teach you something, if it is used as a starting point to explain the things the writers got wrong.  And there is a lot of teaching available here, even in the first ten minutes.&lt;br /&gt;&lt;br /&gt;OK, we start off with people observing this "biggest meteor shower in 50000 years".  It is seen starting up, so we know the observations were simultaneous.  There were groups in New Mexico, the East coast of the US, and in Germany, all watching the meteor shower begin.  Sunset times between those locations are as much as 9 hours apart, and in the summer time (when this movie appears to have been set) there aren't 9 hours of full darkness.  This is a common mistake, movies and television shows will often show two participants in a phone call sitting half a world apart, both in full daylight.&lt;br /&gt;&lt;br /&gt;Then, that meteor shower was a disappointment.  There are recent records of much more intense meteor showers.  The Leonid showers of 1833 and 1966 were, from their descriptions, much more spectacular than the shower shown in this movie.&lt;br /&gt;&lt;br /&gt;Two astronomers are observing the meteor swarm through telescopes, before it reaches the Earth.  We see a field of rocks large enough to be seen through telescopes, and so densely packed as to block sight lines so that astronomers couldn't see another object at the back of the swarm.  This isn't a meteor swarm, a meteor swarm is rocks smaller than pebbles, separated from one another by kilometres of empty space.  This is an avalanche in space.&lt;br /&gt;&lt;br /&gt;Next, we find out that an object, visible while it's still moving in space, was traveling with the cloud of meteors and is going to strike the moon.  Seen from the ground, this object had a visibly different track across the sky, which doesn't make sense if the objects were all traveling together.  But if it were traveling in the same direction as the visible meteors, it wouldn't stand out and so would be less desirable from a dramatic standpoint, so we'll let that one pass.&lt;br /&gt;&lt;br /&gt;So, this mystery object.  Let's forget about the "brown dwarf" babble, and just describe it as a super-dense, magnetized object with, as they say in the movie, a mass twice that of the Earth's.  It hit the moon, and bad things happened.&lt;br /&gt;&lt;br /&gt;Now, the science used to explain the effects on Earth is all nonsense, of course.  The "levitating frog" experiment did not produce anti-gravity.  It exerted a force on a frog.  A string tied to the frog's leg would also exert a force.  This was just like that, but it used a magnetic field to apply the force.  Gravity was still affecting the frog, but the frog was being supported against the force of gravity by a force of magnetic origin, one related to the gradient of the magnetic field (how much the field changes over a short distance).  So, starting from a misunderstanding of an old news release, the writers created weird fantasy effects where objects that are not too small and not too large levitate in spooky ways in random places on the Earth, then crash to the ground.  Whatever, we're not going to talk about that anymore.&lt;br /&gt;&lt;br /&gt;OK, back to "small, very heavy object hits the moon".  Our astronomers mention that the moon has 1/6 the mass of the Earth.  No, it doesn't.  It has about 1/6 the surface gravity, but only about 1/80 of the mass of the Earth.  This is a common mistake, believing that gravity is a function solely of the mass of the object, and ignoring the different sizes.  To take a dramatic example, Saturn has almost 100 times the mass of the Earth, but the force of gravity exerted at the cloud tops is not much higher than the force of gravity at the surface of the Earth, because the cloud tops are over 9 times as far from the centre of Saturn as the surface of the Earth is from its centre.&lt;br /&gt;&lt;br /&gt;The moon gets hit by something very small that weighs two Earth masses, and is traveling very fast.  And they stick together.  160 times the mass of the moon smacks into it with a speed of, let's say, several kilometres per second.  This object wouldn't stop.  It would barely even notice the moon.  If the entire moon got in its way, it would sweep it up and continue on its path practically unaware that it was now carrying a moon with it.  Since the thing is small, only a bit of the moon gets in its way.  It's a very small and extremely fast bullet striking a very large soap bubble.  You don't expect the soap bubble to be carried away by the bullet, you expect to find a punctured bubble.  You certainly don't expect the bullet to stop dead in the bubble.&lt;br /&gt;&lt;br /&gt;160 times the mass.  Imagine you're driving down a highway, and a raccoon is crossing the road.  Just as your car is about to hit it, the raccoon jumps straight up and hits the front of your car.  Your car stops dead as if it had struck a concrete wall, and the mid-air raccoon is barely pushed at all.  Even cartoons don't try to get you to believe that.&lt;br /&gt;&lt;br /&gt;That much mass, stopping all at once within the moon.  Just the kinetic energy released is about the same as the total output of the sun over the space of 48 hours.  Not the light hitting the Earth, the light leaving the entire solar sphere.  The moon would vanish in a puff of gas.  The Earth would vanish in a larger puff of gas.&lt;br /&gt;&lt;br /&gt;OK, so suddenly the moon weighs twice what the Earth does.  This would have some fairly obvious effects.  For one thing, the tides on the surface of the Earth would go from a few metres to a few hundred metres in amplitude.  That would have a serious effect on the coastal regions (and with those tides, Missouri is a coastal region).&lt;br /&gt;&lt;br /&gt;Increase the mass of the Earth-moon system, and the rotational period will decrease.  A month would go from about 30 days to about 10 days.  But in the movie, the moon was making complete orbits around the Earth on plot-driven timescales.  Sometimes the orbital period was a few days, and toward the end of the movie the orbital period seems to have become about 90 days, because they had deduced that the moon would hit the Earth on this orbit, but they still had 40 days left to try to find a solution.  And these weird, sudden "orbital shifts" don't make sense.  Yes, an uneven mass distribution can result in smooth and gradual changes to orbits, but the moon didn't have an uneven mass distribution.  It was a big mass travelling in orbit, with a light, insignificant, moon stuck to it like a bug on a windshield.  The pre-impact mass of the moon isn't even an important perturbation on the mass distribution.&lt;br /&gt;&lt;br /&gt;Good news, everybody!  We just happen to have a lunar expedition fueled up and ready to go, prepared before the impact.  Our heroes can fly to the moon and use some special technology to push the big new mass out of the moon.  Well, the mass weighs 160 times what the moon does, so Newton's laws tell us that you're not going to push the mass out of the moon, you're going to push the moon away.  The mass won't be appreciably disturbed.  The plan is to push the mass out of the moon so it flies toward the sun, but really all you'd do is send the moon away at high speed while the big dense mass stays firmly in its orbit around the Earth.&lt;br /&gt;&lt;br /&gt;Now, about this lunar mission.  The good news is that you don't need as much fuel to cross over, because of the changes to the shape of the gravitational potential fields in the vicinity.  The bad news is that the moon's surface gravity is at least 25 times that of the Earth.  That assumes that the colliding mass is at the centre of the moon.  In the movie, it's actually only partway down, and our heroes have to land near it, so they'll feel a gravitational force much higher than that.  OK, they've been working out, they can walk and work in 25 gravities of force.  But their lander was designed to land on rockets in 1/6 normal gravity.  It would be like designing a parachute to land you safely, and then you decide that you'll change the parameters, the parachute will be used to land a bit more weight.  You plus 159 of your friends, all hanging on the one parachute.  You might reasonably conclude that the parachute was not designed for that kind of treatment.  A similar argument can be made for the lunar lander and that little rocket jumper vehicle, whose engines certainly cannot supply the thrust to land under the new conditions.  The lander would probably crumple under its own weight just trying to sit still on the moon, and taking off from the surface would be similarly difficult because of the changed conditions.&lt;br /&gt;&lt;br /&gt;OK.  Gravitation, tides, astronomy, orbital motion.  If you learned something new from this movie, it's almost certainly wrong.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3279819592335911399-3745347232312093395?l=distrofreelinuxuser.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://distrofreelinuxuser.blogspot.com/feeds/3745347232312093395/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3279819592335911399&amp;postID=3745347232312093395' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/3745347232312093395'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/3745347232312093395'/><link rel='alternate' type='text/html' href='http://distrofreelinuxuser.blogspot.com/2009/07/musings-on-impact-miniseries.html' title='Musings on the &quot;Impact&quot; miniseries'/><author><name>Winter Toad</name><uri>http://www.blogger.com/profile/05606540195506310406</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-3279819592335911399.post-5274434629781959976</id><published>2009-01-16T19:53:00.002-05:00</published><updated>2009-01-16T20:17:39.765-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='configuring'/><category scheme='http://www.blogger.com/atom/ns#' term='traveling'/><category scheme='http://www.blogger.com/atom/ns#' term='sendmail'/><category scheme='http://www.blogger.com/atom/ns#' term='email'/><title type='text'>When your on-the-road ISP blocks your outbound mail</title><content type='html'>Now, we talked about allowing your computer to &lt;a href="http://distrofreelinuxuser.blogspot.com/2008/03/selective-sendmail-relaying-based-on.html"&gt;relay mail through the home machine&lt;/a&gt; when the ISP through which you're connecting has made it onto a block list.  What do you do when the ISP simply blocks all outgoing connections on port 25?  Now you can't even connect to your home computer to relay the mail.&lt;br /&gt;&lt;br /&gt;The ISP does this to force you to pass email through their servers.  The hope is that infected Windows computers will just try to open connections directly, and not forward the mail through the ISP servers.  As noted in &lt;a href="http://isc.sans.org/diary.html?storyid=5698"&gt;this story&lt;/a&gt;, that is not necessarily true.&lt;br /&gt;&lt;br /&gt;So, now you find yourself unable to open connections on port 25, but you still want to send email.  You could set up your computer to relay mail through the ISP's servers, as described in &lt;a href="http://distrofreelinuxuser.blogspot.com/2008/12/when-other-sites-discard-or-refuse-your.html"&gt;this earlier article&lt;/a&gt;, but that may not be convenient if, for instance, you're accessing the Internet at a relative's home, since they would have to give you their passwords for you to do that.&lt;br /&gt;&lt;br /&gt;So, the first thing to do is to check that you can connect to your home computer on the ESMTP port number 587.  Telnet onto that port number on your home computer, and if you get a response, then this technique will work for you.&lt;br /&gt;&lt;br /&gt;First of all, you should already have set up relaying as described &lt;a href="http://distrofreelinuxuser.blogspot.com/2008/03/selective-sendmail-relaying-based-on.html"&gt;here&lt;/a&gt;.  If you set it up a while ago, verify that your keys are still valid and haven't expired.&lt;br /&gt;&lt;br /&gt;As we're discussing this in the spirit of a temporary work-around, we'll be editing the sendmail.cf file directly.  First, of course, make a backup copy of your current sendmail.cf file, because you'll want to reset it to its former behaviour after you stop using this particular ISP.&lt;br /&gt;&lt;br /&gt;Now, go into your sendmail.cf file and find the smart relay line.  It will look something like this:&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;# &amp;quot;Smart&amp;quot; relay host (may be null)&lt;br /&gt;DS&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Change that line to indicate that you're sending ESMTP to your home machine.  It will look a bit like this:&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;# &amp;quot;Smart&amp;quot; relay host (may be null)&lt;br /&gt;DSesmtp:mail-host.example.com&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Next, we have to tell sendmail that it is to use port 587 for outbound mail to esmtp smart relays.  Locate the block in the sendmail.cf file that looks like this:&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;Mesmtp,         P=[IPC], F=mDFMuXa, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP, E=\r\n, L=990,&lt;br /&gt;                T=DNS/RFC822/SMTP,&lt;br /&gt;                A=TCP $h&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;and change the last line to read:&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;                A=TCP $h 587&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;That's it.  Restart the sendmail program, and you should be able to relay all mail through your home machine using authenticated relaying on port 587.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3279819592335911399-5274434629781959976?l=distrofreelinuxuser.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://distrofreelinuxuser.blogspot.com/feeds/5274434629781959976/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3279819592335911399&amp;postID=5274434629781959976' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/5274434629781959976'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/5274434629781959976'/><link rel='alternate' type='text/html' href='http://distrofreelinuxuser.blogspot.com/2009/01/when-your-on-road-isp-blocks-your.html' title='When your on-the-road ISP blocks your outbound mail'/><author><name>Winter Toad</name><uri>http://www.blogger.com/profile/05606540195506310406</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-3279819592335911399.post-5594695421512436697</id><published>2008-12-22T11:12:00.005-05:00</published><updated>2008-12-22T11:47:36.630-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='configuring'/><category scheme='http://www.blogger.com/atom/ns#' term='sendmail'/><category scheme='http://www.blogger.com/atom/ns#' term='email'/><category scheme='http://www.blogger.com/atom/ns#' term='security'/><title type='text'>When other sites discard or refuse your email</title><content type='html'>We've &lt;a href="http://distrofreelinuxuser.blogspot.com/2008/03/selective-sendmail-relaying-based-on.html"&gt;covered&lt;/a&gt; setting up your sendmail to act as a relay for certain computers.  Now, we look at another relaying problem.&lt;br /&gt;&lt;br /&gt;You like running your own sendmail, you're using it to manage your own email accounts.  You could use your ISP's mail server for all outbound messages, but let's say you're not doing that.  Now, some third party, maybe another ISP, let's call them "Dogers", decides to silently discard all email coming from IP blocks owned by your ISP unless the sending IP number is one of the mail servers of your ISP.  Even if you're running a responsible sendmail on a static IP number, messages sent to "Dogers" just vanish.&lt;br /&gt;&lt;br /&gt;The solution is to arrange your sendmail so that, when sending to certain domains, it relays the messages through your ISP's servers.  We'll need two more features for this.  First, the mailertable function will allow you to use a different mailer for certain addresses.  Second, depending on your ISP, you may have to authenticate yourself with the ISP's server before it will relay your messages.  This configuration will show how to perform that authentication.&lt;br /&gt;&lt;br /&gt;Make sure your &lt;span style="font-weight: bold;"&gt;sendmail.mc&lt;/span&gt; contains the following two lines before the first "MAILER" line:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;FEATURE(`authinfo',`hash /etc/mail/auth/client-info')dnl&lt;br /&gt;FEATURE(`mailertable')&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Also, add the following line anywhere in the file:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;You will need to have cyrus-sasl installed, and configured for logins.  Here is a sample cyrus-sasl configuration invocation:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;./configure --prefix=/usr/local --enable-anon --enable-plain \&lt;br /&gt;       --enable-login --disable-krb4 --with-mysql \&lt;br /&gt;       --with-saslauthd=/var/state/saslauthd --with-openssl=/usr/local/ssl \&lt;br /&gt;       --with-plugindir=/usr/local/lib/sasl2/ --enable-cram \&lt;br /&gt;       --enable-digest --enable-otp --without-des&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;OK, now the mailertable entry.  Add a line for the dogers domain, telling your sendmail to forward mail for those addresses through your ISP's server:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;dogers.com      smtp:smtp.&amp;lt;MY&amp;gt;.&amp;lt;ISP&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Now, to authenticate with the ISP. We told sendmail that our credentials would be stored in&lt;span style="font-weight: bold;"&gt; /etc/mail/auth/client-info&lt;/span&gt;, so we create a file there:&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;AuthInfo:smtp.&amp;lt;MY&amp;gt;.&amp;lt;ISP&amp;gt; &amp;quot;U:root&amp;quot; &amp;quot;I:wintertoad@&amp;lt;MY&amp;gt;.&amp;lt;ISP&amp;gt;&amp;quot; &amp;quot;P:&amp;lt;password&amp;gt;&amp;quot; &amp;quot;M:LOGIN&amp;quot;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Then, we just have to rehash the mailertable and authentication files with a command like this:&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;# makemap hash file.db &amp;lt; file&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Now, assuming you've rebuilt your &lt;span style="font-weight: bold;"&gt;sendmail.cf&lt;/span&gt; after the changes we made to the .mc file above, you can just send a SIGHUP to the sendmail processes, and you should be able to send email to anybody at the dogers.com domain by relaying those messages through your ISP's mail server.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3279819592335911399-5594695421512436697?l=distrofreelinuxuser.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://distrofreelinuxuser.blogspot.com/feeds/5594695421512436697/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3279819592335911399&amp;postID=5594695421512436697' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/5594695421512436697'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/5594695421512436697'/><link rel='alternate' type='text/html' href='http://distrofreelinuxuser.blogspot.com/2008/12/when-other-sites-discard-or-refuse-your.html' title='When other sites discard or refuse your email'/><author><name>Winter Toad</name><uri>http://www.blogger.com/profile/05606540195506310406</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-3279819592335911399.post-2880518039040330501</id><published>2008-07-13T11:59:00.003-04:00</published><updated>2008-07-13T12:16:17.575-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sound'/><category scheme='http://www.blogger.com/atom/ns#' term='kde'/><title type='text'>A Curious Permissions Problem with ALSA</title><content type='html'>While I'm waiting for kde4 to reach everyday usability (defined for my purposes as supporting panel auto-hiding), I periodically check out an updated subversion tree of kde4, compile it, and try it out.&lt;br /&gt;&lt;br /&gt;There's some pain with switching between kde3 and kde4 and back again, so I try kde4 with a different login, specially created for testing kde4.&lt;br /&gt;&lt;br /&gt;There are still bugs in kde4, particularly when you compile subversion trees, and not specific tagged releases.  In my latest foray into kde4, several applications did crash, including amarok, the audio media player.&lt;br /&gt;&lt;br /&gt;After spending some time in kde4, I logged out and switched back to kde3 with my regular username.  Once there, I found that there was no audio from ALSA applications.  So, the usual course when this happens is to examine the permissions on the appropriate audio devices.  In this case, however, all of the permissions looked fine.&lt;br /&gt;&lt;br /&gt;So, what was preventing ALSA applications from running?  When I ran strace on an ALSA application, I found that I was getting permissions problems (reported as &lt;span style="font-weight: bold;"&gt;EPERM&lt;/span&gt; on the return from a syscall) on semctl() syscalls.  So, the next step is to run &lt;span style="font-style: italic;"&gt;ipcs&lt;/span&gt;.  This shows the SYSV IPC resources currently in use.  There, I found two shared memory segments and two semaphores that were owned by the "kde4" username.  Since all kde4-owned processes had exited, this indicated that some process had experienced an abnormal exit without releasing some SYSV IPC resources.&lt;br /&gt;&lt;br /&gt;ALSA uses such resources when applications want to generate sound, and it is not possible for an unprivileged user to obtain or release the resources of another user.  This produced the permission problems and prevented the applications from working correctly with ALSA.&lt;br /&gt;&lt;br /&gt;The solution was to become the root user, and use the &lt;span style="font-style: italic;"&gt;ipcrm&lt;/span&gt; command to release all resources owned by the kde4 user.  Once that was done, ALSA applications run as my regular username could, once again, produce sound.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3279819592335911399-2880518039040330501?l=distrofreelinuxuser.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://distrofreelinuxuser.blogspot.com/feeds/2880518039040330501/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3279819592335911399&amp;postID=2880518039040330501' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/2880518039040330501'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/2880518039040330501'/><link rel='alternate' type='text/html' href='http://distrofreelinuxuser.blogspot.com/2008/07/curious-permissions-problem-with-alsa.html' title='A Curious Permissions Problem with ALSA'/><author><name>Winter Toad</name><uri>http://www.blogger.com/profile/05606540195506310406</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-3279819592335911399.post-8059891807844243479</id><published>2008-05-29T01:10:00.004-04:00</published><updated>2008-05-29T01:29:35.492-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='patches'/><category scheme='http://www.blogger.com/atom/ns#' term='crypto'/><category scheme='http://www.blogger.com/atom/ns#' term='rationale'/><category scheme='http://www.blogger.com/atom/ns#' term='security'/><title type='text'>When distributions patch wrongly</title><content type='html'>Events of recent weeks have provided another reason one might be inclined to avoid the use of distributions.  Let's call this the "debian SSL bug".  A patch applied by a well-meaning Debian coder made cryptographic keys generated by numerous applications on that distribution entirely useless.  Details can be found &lt;a href="http://lwn.net/Articles/282038/"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The Debian patch affected derived distributions as well, such as Ubuntu.  For almost two years, many cryptographic transactions were severely compromised.  The biggest problem was that the patch was not correctly passed back to development team of the &lt;a href="http://www.openssl.org/"&gt;OpenSSL&lt;/a&gt; project.  Had it been, they would have pointed out its fatal security implications, and this entire headache would have been avoided.&lt;br /&gt;&lt;br /&gt;I always feel uncomfortable when I see distributions applying patches against the original sources.  There can be several reasons for these patches.&lt;br /&gt;&lt;ol&gt;&lt;li&gt;They may be back-porting selected bugfixes to an earlier version of a library rather than including the latest version of the library with all of its new, and possibly untested features.&lt;/li&gt;&lt;li&gt;They may be modifying a logo or informational string to include something specific to the distribution.&lt;/li&gt;&lt;li&gt;They may be changing some default pathnames or other resources to mesh more well with the idiosyncracies of their own distribution.&lt;/li&gt;&lt;li&gt;They may be changing the appearance of the interface to make it more consistent with other applications.&lt;/li&gt;&lt;li&gt;They may be applying changes that the original maintainers of the package do not consider necessary, but which the distribution maintainers find desirable.&lt;/li&gt;&lt;li&gt;Other...&lt;/li&gt;&lt;/ol&gt;None of these motivations will usually convince me to apply foreign patches.  Your opinion may differ.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3279819592335911399-8059891807844243479?l=distrofreelinuxuser.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://distrofreelinuxuser.blogspot.com/feeds/8059891807844243479/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3279819592335911399&amp;postID=8059891807844243479' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/8059891807844243479'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/8059891807844243479'/><link rel='alternate' type='text/html' href='http://distrofreelinuxuser.blogspot.com/2008/05/when-distributions-patch-wrongly.html' title='When distributions patch wrongly'/><author><name>Winter Toad</name><uri>http://www.blogger.com/profile/05606540195506310406</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-3279819592335911399.post-1240244519696408269</id><published>2008-04-27T16:32:00.005-04:00</published><updated>2008-04-27T17:02:52.225-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='configuring'/><category scheme='http://www.blogger.com/atom/ns#' term='crypto'/><category scheme='http://www.blogger.com/atom/ns#' term='traveling'/><category scheme='http://www.blogger.com/atom/ns#' term='chinese'/><category scheme='http://www.blogger.com/atom/ns#' term='security'/><title type='text'>Web browsing behind the great firewall of China</title><content type='html'>I sometimes spend time in China, and while there, I work remotely to my office and to my home computer.  I do somewhat technical work that sometimes requires online research, and it's annoying that a significant fraction of non-Chinese sites are unreachable from China.&lt;br /&gt;&lt;br /&gt;The thing to remember is that the firewall isn't there to keep me from working.  I'm a Canadian passport holder, and they really don't care what I read while in China.  That explains certain curious omissions, such as the fact that TCP port 22 (ssh) is not blocked.&lt;br /&gt;&lt;br /&gt;So, here I am, in China, with a Linux laptop, and I'd like to browse the web.  Rather than take my chances with the firewall, I proxy the connection through my home computer's apache daemon.&lt;br /&gt;&lt;br /&gt;So, first I set up the proxy service on my apache.  Make sure you've built the httpd with these configuration options:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;--enable-mods-shared="proxy proxy-http proxy-connect"&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;These settings turn on the proxy service and set it to proxy HTTP traffic.  The "proxy-connect" flag allows the httpd to be used as a reflector for SSL connections.  If you want to visit a banking website, the data still travels as SSL between your laptop and the home machine, but the home machine just reflects the traffic to the bank without knowing what's in the data stream (the home machine cannot decode that data, if it could, it would count as a man-in-the-middle compromise of the SSL stream).&lt;br /&gt;&lt;br /&gt;Next, add some lines to the httpd configuration file.  Mine's in &lt;span style="font-style: italic;"&gt;/etc/apache/httpd.conf&lt;/span&gt;.&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;LoadModule proxy_module modules/mod_proxy.so&lt;br /&gt;LoadModule proxy_http_module modules/mod_proxy_http.so&lt;br /&gt;LoadModule proxy_connect_module modules/mod_proxy_connect.so&lt;br /&gt;&lt;br /&gt;&amp;lt;IfModule mod_proxy.c&amp;gt;&lt;br /&gt;ProxyRequests On&lt;br /&gt;&lt;br /&gt;&amp;lt;Proxy *&amp;gt;&lt;br /&gt; Order deny,allow&lt;br /&gt; Deny from all&lt;br /&gt; Allow from 127.0.0.1&lt;br /&gt;&amp;lt;/Proxy&amp;gt;&lt;br /&gt;&amp;lt;/IfModule&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;What this does is to enable proxying, but only on connections from localhost.  I don't want my httpd to be a proxy for any random person in the outside world.&lt;br /&gt;&lt;br /&gt;Next, I set up my ssh on connections to my home computer.  You can either add a switch like this to the invocation:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;-L 8080:127.0.0.1:80&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;or you can add a line to your &lt;span style="font-style: italic;"&gt;~/.ssh/config&lt;/span&gt; entry for the connection to the home computer:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;LocalForward 8080 127.0.0.1:80&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Now, you ssh into your home computer.&lt;br /&gt;&lt;br /&gt;Finally, you start up firefox, and select the menu item:&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Edit-&gt;Preferences-&gt;Advanced-&gt;Network-&gt;Settings&lt;/span&gt;&lt;br /&gt;Select "Manual proxy configuration", and point your HTTP and SSL proxies at "localhost" with the port number 8080.&lt;br /&gt;&lt;br /&gt;That's it, now when  you browse websites, the HTTP-related data stream appears simply as a pile of encrypted bits over your ssh connection.  The firewall cannot know what websites you're visiting, it can't even tell that you're visiting a website at all.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Important note&lt;/span&gt;:  this system proxies the HTTP data.  That means web pages, frames, images in the page, RSS feeds, and so on.  It does not proxy UDP or post-connection traffic, like youtube videos.  If your web browser has a plugin that downloads data from an external site, that plugin may not be using  your proxy.&lt;br /&gt;&lt;br /&gt;If you want to know what data is not passing through your proxy, you can run &lt;span style="font-weight: bold;"&gt;tcpdump&lt;/span&gt; in another window.  Something like this:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;tcpdump 'host &amp;lt;IPNUM&amp;gt; and not port 22'&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;where &lt;ipnum&gt; is the IP number of your external interface (not 127.0.0.1).  You may have to add a "-i" switch if your laptop has more than one network interface.  This command will show you all traffic that is not going over the ssh connection.&lt;/ipnum&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3279819592335911399-1240244519696408269?l=distrofreelinuxuser.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://distrofreelinuxuser.blogspot.com/feeds/1240244519696408269/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3279819592335911399&amp;postID=1240244519696408269' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/1240244519696408269'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/1240244519696408269'/><link rel='alternate' type='text/html' href='http://distrofreelinuxuser.blogspot.com/2008/04/web-browsing-behind-great-firewall-of.html' title='Web browsing behind the great firewall of China'/><author><name>Winter Toad</name><uri>http://www.blogger.com/profile/05606540195506310406</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-3279819592335911399.post-3587908026071662864</id><published>2008-04-02T21:46:00.003-04:00</published><updated>2008-04-02T21:55:04.513-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='configuring'/><category scheme='http://www.blogger.com/atom/ns#' term='oss'/><category scheme='http://www.blogger.com/atom/ns#' term='sound'/><category scheme='http://www.blogger.com/atom/ns#' term='modules'/><category scheme='http://www.blogger.com/atom/ns#' term='kernel'/><title type='text'>Fixing sound in Linux Civ:CTP</title><content type='html'>When my old 64-bit motherboard died, and I replaced it with the DP35DP, one of the surprises I ran into was that the sound was badly broken on "Civilization:Call To Power".  All other applications that I tried worked well, any programs using the ALSA interface, as well as a few 32-bit binaries on the OSS interface, like Quake 2 and Heroes 3.  However, with Civ:CTP, the sound stuttered and looped horribly.  I couldn't use the aoss wrapper because Civ:CTP is statically linked.  After a lot of tinkering, I finally came to the conclusion that, for this one application, I had to load the sound module with different parameters.&lt;br /&gt;&lt;br /&gt;For every application except Civ:CTP, my snd-hda-intel module is loaded with the parameters&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;position_fix=1 model=5stack&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;However, in order to run Civ:CTP, I have to exit all sound applications, remove the snd-hda-intel module, and re-load it with the parameters:&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;position_fix=3 model=5stack&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;With this change, the sound in Civ:CTP sounds fine.  However, all other applications have poor sound, scratchy and unpleasant to the ear, so I only make this module change just prior to running the game, and re-load the module with the usual parameters immediately afterwards.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3279819592335911399-3587908026071662864?l=distrofreelinuxuser.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://distrofreelinuxuser.blogspot.com/feeds/3587908026071662864/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3279819592335911399&amp;postID=3587908026071662864' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/3587908026071662864'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/3587908026071662864'/><link rel='alternate' type='text/html' href='http://distrofreelinuxuser.blogspot.com/2008/04/fixing-sound-in-linux-civctp.html' title='Fixing sound in Linux Civ:CTP'/><author><name>Winter Toad</name><uri>http://www.blogger.com/profile/05606540195506310406</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-3279819592335911399.post-1165646786580300042</id><published>2008-03-19T21:23:00.004-04:00</published><updated>2008-03-19T21:40:49.784-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='configuring'/><category scheme='http://www.blogger.com/atom/ns#' term='x.org'/><category scheme='http://www.blogger.com/atom/ns#' term='fonts'/><category scheme='http://www.blogger.com/atom/ns#' term='chinese'/><category scheme='http://www.blogger.com/atom/ns#' term='X11R7'/><category scheme='http://www.blogger.com/atom/ns#' term='OpenGL'/><category scheme='http://www.blogger.com/atom/ns#' term='X11'/><title type='text'>Experiences compiling X11R7</title><content type='html'>Compiling and installing X11R7, x.org 7.3, was a bit more rough than the X11 compiles I used to perform.  I used the build script supplied with the source packages.  When it finished, apparently successfully, there were two problems whose solutions were not obvious.&lt;br /&gt;&lt;br /&gt;First of all, OpenGL worked on my NVidia box, but not my ATI laptop.&lt;br /&gt;&lt;br /&gt;Second, my Chinese fonts for traditional characters in Emacs looked different, much worse.  The simplified Chinese characters still looked fine.&lt;br /&gt;&lt;br /&gt;OK, what were the problems, and how did I fix them.  First of all, the OpenGL issue.  I compiled X11 the same way on both computers, why did OpenGL not work on the ATI laptop?  Well, both NVidia and ATI ship closed-source binary blobs with support libraries.  The difference is that NVidia supplies its own libGL.so, while ATI uses the one from x.org.  So, somehow I was failing to compile and install the OpenGL stuff.  This didn't matter for the NVidia case, because it supplied all of the libraries required, but ATI doesn't do that.  I had compiled and installed libMesa, so OpenGL should have worked.  The OpenGL component is compiled as part of the xorg-server-1.4 package, and its configure script is executed by the build script that came with x.org.  Aha, but in order to compile OpenGL, you have to provide the configure script with the path of the libMesa source tree.  The x.org build script doesn't do that, so OpenGL is not built.  The solution is to interrupt the build at the point where the xorg-server-1.4 is about to be built (you can edit the script and put in an 'exit 0' there, for instance), then configure, build, and install the xorg-server-1.4 archive by hand, remembering to tell it where the mesa source tree is located.  Once that completes, you can continue the build with the xorg script (I just commented out all entries above the server compile and resumed).&lt;br /&gt;&lt;br /&gt;Now, the font problem.  My TTF fonts are in /usr/share/fonts, and I verified that the files there were being read when I asked Emacs to display Chinese characters.  So, it appeared as if the Chinese TTF fonts were the ones that were looking bad.  A bit of research showed that Emacs does not, as of version 22.1.1, use scalable fonts.  So I decided that it probably wasn't supposed to be using those TTF fonts.  Now, I had kept my old X11R6 tree around in case of issues like this, so a quick comparison of directories showed that there were some Chinese PCF fonts in the old install that I had forgotten to copy to the new location.  So, I copied these files into their location in the X11R7 tree, and Emacs was restored to its former behaviour with respect to the displaying of Chinese fonts.  The fonts, by the way, are &lt;span style="font-style:italic;"&gt;taipei15.pcf&lt;/span&gt;, &lt;span style="font-style:italic;"&gt;taipei16.pcf&lt;/span&gt;, &lt;span style="font-style:italic;"&gt;taipei24.pcf&lt;/span&gt;, &lt;span style="font-style:italic;"&gt;taipei24k.pcf&lt;/span&gt;, and &lt;span style="font-style:italic;"&gt;taipeil24.pcf&lt;/span&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3279819592335911399-1165646786580300042?l=distrofreelinuxuser.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://distrofreelinuxuser.blogspot.com/feeds/1165646786580300042/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3279819592335911399&amp;postID=1165646786580300042' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/1165646786580300042'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/1165646786580300042'/><link rel='alternate' type='text/html' href='http://distrofreelinuxuser.blogspot.com/2008/03/experiences-compiling-x11r7.html' title='Experiences compiling X11R7'/><author><name>Winter Toad</name><uri>http://www.blogger.com/profile/05606540195506310406</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-3279819592335911399.post-9007498717527055055</id><published>2008-03-11T19:39:00.004-04:00</published><updated>2008-03-11T21:22:21.576-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='configuring'/><category scheme='http://www.blogger.com/atom/ns#' term='crypto'/><category scheme='http://www.blogger.com/atom/ns#' term='sendmail'/><category scheme='http://www.blogger.com/atom/ns#' term='security'/><title type='text'>Selective sendmail relaying based on self-signed keys</title><content type='html'>Back in the early days of the Internet, people trusted one another not to abuse email.  Sure, there were accidents.  A badly configured mailing list could fill up with traffic as &lt;a href="http://catb.org/jargon/html/S/sorcerers-apprentice-mode.html"&gt;two &lt;span style="font-weight: bold;"&gt;vacation&lt;/span&gt; programs talked to one another&lt;/a&gt;, each informing the other that his latest message would not be read until some later date, because the recipient was out of the office.  &lt;br /&gt;&lt;br /&gt;In those days, you set up your sendmail to relay messages for others.  Many people had email addresses that weren't on a full-time connection to the network, they might be on a BBS that did a nightly download of email, or down some Bitnet rabbit hole.  Email was relayed from one intermediate post to another, rather than being simply sent directly from the sender to the receiver.  A sendmail daemon that relayed messages for others was helpful to the community, everybody pitched in to get everyone's email where it was ultimately intended.&lt;br /&gt;&lt;br /&gt;Then came new developments.  &lt;a href="http://www.cybernothing.org/faqs/net-abuse-faq.html#2.6"&gt;Canter &amp;amp; Siegel&lt;/a&gt;, the &lt;a href="http://catb.org/jargon/html/S/September-that-never-ended.html"&gt;September that never ended&lt;/a&gt;, and the presence of people who would buy things they saw in an unsolicited email message.  Spam started to appear in mailboxes.  Suddenly, being a helpful person and relaying messages was no longer beneficial to the community, as commercial email senders used relays to hide the origins of their messages.  People started turning off open relays on their boxes as a defensive move.&lt;br /&gt;&lt;br /&gt;So, now you've got a domain set up with a sendmail daemon at home, and you're traveling with a laptop.  To make this a bit more complicated, let's say your laptop is a work computer, and you send email from its sendmail, but with a different domain than your home computer.  Everything's working fine, until you find that the coffee shop in Beijing where you're using your laptop has made it onto a list of spamming IP numbers.  Some recipients of your messages may not receive them because their sendmail is set up to refuse messages from computers on these bad IP numbers.  You know that your home computer is not on a banned IP number, so it would be nice if you could forward your laptop-generated work-related messages through your home computer.  It would be even nicer if people selling generic pharmaceuticals could not do the same thing, otherwise your home computer's IP number will very quickly find itself on one of those banned lists.  So, you want to allow relaying from your laptop, but only from your laptop, and do it easily even if you move to another coffee shop.&lt;br /&gt;&lt;br /&gt;What you want, then, is a way for your home computer to recognize your laptop, and permit only that computer to relay messages through the home sendmail.  This will be done with sendmail's TLS facility.  You will create a private certificate authority, one you don't have to pay to sign your keys.  You'll then use a signed certificate to verify the identity of the laptop.  The following procedure will be performed on the home computer, only at the end of this process will the laptop be involved.&lt;br /&gt;&lt;br /&gt;We'll start by creating two directories on your home computer, one for the certificate authority, and the other for the signed certificates.  I'll use the directory locations that are found in the default OpenSSL configuration file, so that you don't have to edit too many files.&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;mkdir /etc/mail/CA /etc/mail/certs /etc/mail/CA/demoCA /etc/mail/CA/demoCA/private&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Copy the OpenSSL &lt;span style="font-style:italic;"&gt;openssl.cnf&lt;/span&gt; file into &lt;span style="font-style:italic;"&gt;/etc/mail/CA&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;Next, we will create the signing certificate.&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;$ cd /etc/mail/CA&lt;br /&gt;$ openssl req -new -x509 -keyout demoCA/private/cakey.pem -out demoCA/cacert.pem -days 1000 -config openssl.cnf&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;You will be prompted for several fields, such as country code, location, name.  Here's a sample dialogue:&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;$ openssl req -new -x509 -keyout demoCA/private/cakey.pem -out demoCA/cacert.pem -days 1000 -config openssl.cnf&lt;br /&gt;Generating a 1024 bit RSA private key&lt;br /&gt;.............++++++&lt;br /&gt;.........++++++&lt;br /&gt;writing new private key to 'demoCA/private/cakey.pem'&lt;br /&gt;Enter PEM pass phrase:&lt;br /&gt;Verifying - Enter PEM pass phrase:&lt;br /&gt;-----&lt;br /&gt;You are about to be asked to enter information that will be incorporated&lt;br /&gt;into your certificate request.&lt;br /&gt;What you are about to enter is what is called a Distinguished Name or a DN.&lt;br /&gt;There are quite a few fields but you can leave some blank&lt;br /&gt;For some fields there will be a default value,&lt;br /&gt;If you enter '.', the field will be left blank.&lt;br /&gt;-----&lt;br /&gt;Country Name (2 letter code) [AU]:CA&lt;br /&gt;State or Province Name (full name) [Some-State]:Ontario&lt;br /&gt;Locality Name (eg, city) []:Toronto&lt;br /&gt;Organization Name (eg, company) [Internet Widgits Pty Ltd]:Example&lt;br /&gt;Organizational Unit Name (eg, section) []:&lt;br /&gt;Common Name (eg, YOUR name) []:Bert Ificate&lt;br /&gt;Email Address []:bertificate@example.com&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;When prompted, you will have to enter a pass phrase twice.  Remember this phrase, you will need it if you ever want to sign certificates with this signing certificate.&lt;br /&gt;&lt;br /&gt;This command creates new files: &lt;span style="font-style:italic;"&gt;/etc/mail/CA/demoCA/cacert.pem&lt;/span&gt; and &lt;span style="font-style:italic;"&gt;/etc/mail/CA/demoCA/private/cakey.pem&lt;/span&gt;.  The file contains encoded information related to a certificate signing authority that will be valid for 1000 days.&lt;br /&gt;&lt;br /&gt;Next, you must create the certificate that you will use to validate your laptop.  You enter the commands:&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;$ cd /etc/mail/CA&lt;br /&gt;$ openssl req -nodes -new -x509 -keyout laptopcert.pem -out laptopcert.pem -days 365 -config openssl.cnf&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Again, you will have to answer some questions.  Here is a sample dialogue:&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;$ openssl req -nodes -new -x509 -keyout laptopcert.pem -out laptopcert.pem -days 365 -config openssl.cnf&lt;br /&gt;Generating a 1024 bit RSA private key&lt;br /&gt;....++++++&lt;br /&gt;............................................++++++&lt;br /&gt;writing new private key to 'laptopcert.pem'&lt;br /&gt;-----&lt;br /&gt;You are about to be asked to enter information that will be incorporated&lt;br /&gt;into your certificate request.&lt;br /&gt;What you are about to enter is what is called a Distinguished Name or a DN.&lt;br /&gt;There are quite a few fields but you can leave some blank&lt;br /&gt;For some fields there will be a default value,&lt;br /&gt;If you enter '.', the field will be left blank.&lt;br /&gt;-----&lt;br /&gt;Country Name (2 letter code) [AU]:CA&lt;br /&gt;State or Province Name (full name) [Some-State]:Alberta&lt;br /&gt;Locality Name (eg, city) []:Calgary&lt;br /&gt;Organization Name (eg, company) [Internet Widgits Pty Ltd]:Example&lt;br /&gt;Organizational Unit Name (eg, section) []:&lt;br /&gt;Common Name (eg, YOUR name) []:Rhoda Warrior&lt;br /&gt;Email Address []:rhoda-warrior@example.com&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Now, you have a certificate for your laptop, but it hasn't yet been signed.  You use the signing certificate to vouch for the laptop certificate.  First, we have to set up a bit more information for the signing process:&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;$ mkdir /etc/mail/CA/demoCA/newcerts&lt;br /&gt;$ touch /etc/mail/CA/demoCA/index.txt&lt;br /&gt;$ echo 01 &amp;gt; /etc/mail/CA/demoCA/serial&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;You'll only have to do this the first time you set up a signing authority.&lt;br /&gt;&lt;br /&gt;Now, we issue two commands to sign the laptop certificate:&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;$ openssl x509 -x509toreq -in laptopcert.pem -signkey laptopcert.pem -out tmp.pem&lt;br /&gt;$ /usr/local/ssl/bin/openssl ca -config openssl.cnf -policy policy_anything -out signed-laptopcert.pem -infiles tmp.pem&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;Once again, there will be a brief dialogue when the second command is run, something like this:&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;$ openssl ca -config openssl.cnf -policy policy_anything -out signed-laptopcert.pem -infiles tmp.pem&lt;br /&gt;Using configuration from openssl.cnf&lt;br /&gt;Enter pass phrase for ./demoCA/private/cakey.pem:&lt;br /&gt;Check that the request matches the signature&lt;br /&gt;Signature ok&lt;br /&gt;Certificate Details:&lt;br /&gt;        Serial Number: 1 (0x1)&lt;br /&gt;        Validity&lt;br /&gt;            Not Before: Mar 12 00:46:43 2008 GMT&lt;br /&gt;            Not After : Mar 12 00:46:43 2009 GMT&lt;br /&gt;        Subject:&lt;br /&gt;            countryName               = CA&lt;br /&gt;            stateOrProvinceName       = Alberta&lt;br /&gt;            localityName              = Calgary&lt;br /&gt;            organizationName          = Example&lt;br /&gt;            commonName                = Rhoda Warrior&lt;br /&gt;            emailAddress              = rhoda-warrior@example.com&lt;br /&gt;        X509v3 extensions:&lt;br /&gt;            X509v3 Basic Constraints:&lt;br /&gt;                CA:FALSE&lt;br /&gt;            Netscape Comment:&lt;br /&gt;                OpenSSL Generated Certificate&lt;br /&gt;            X509v3 Subject Key Identifier:&lt;br /&gt;                67:11:5A:25:6F:5C:70:36:03:14:3B:04:4A:8C:30:C9:CF:60:51:AE&lt;br /&gt;            X509v3 Authority Key Identifier:&lt;br /&gt;                keyid:F4:CE:58:BD:82:8A:E3:EC:0F:89:C6:60:E2:45:58:A4:CA:79:C8:89&lt;br /&gt;&lt;br /&gt;Certificate is to be certified until Mar 12 00:46:43 2009 GMT (365 days)&lt;br /&gt;Sign the certificate? [y/n]:y&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;1 out of 1 certificate requests certified, commit? [y/n]y&lt;br /&gt;Write out database with 1 new entries&lt;br /&gt;Data Base Updated&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Now, it's time to tell the home machine's sendmail that it should relay messages received from this key.  Add a line to the &lt;span style="font-style:italic;"&gt;/etc/mail/access.src&lt;/span&gt; file that looks like this:&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;CertIssuer:/C=CA/ST=Ontario/L=Toronto/O=Example/CN=Bert+20Ificate/emailAd&lt;br /&gt;dress=bertificate@example.com RELAY&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;You'll have to make that file readable by sendmail:&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;makemap hash access.db &amp;lt; access.src&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;And now we have to make sure that the home machine's sendmail knows where to find its certificates and access file.  Build a new &lt;span style="font-style:italic;"&gt;sendmail.cf&lt;/span&gt; using a &lt;span style="font-style:italic;"&gt;sendmail.mc&lt;/span&gt; something like this:&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;divert(0)dnl&lt;br /&gt;VERSIONID(`sendmail.mc for example.com version 01')&lt;br /&gt;OSTYPE(linux)dnl&lt;br /&gt;DOMAIN(example.com)dnl&lt;br /&gt;FEATURE(`nouucp', `reject')&lt;br /&gt;FEATURE(`virtusertable', `hash /etc/sendmail/virtusertable')dnl&lt;br /&gt;FEATURE(`genericstable', `hash /etc/sendmail/genericstable')dnl&lt;br /&gt;FEATURE(`local_procmail', `/usr/local/bin/procmail')&lt;br /&gt;FEATURE(`access_db', `hash -T&amp;lt;TMPF&amp;gt; /etc/mail/access')&lt;br /&gt;FEATURE(`mailertable')&lt;br /&gt;MAILER(local)&lt;br /&gt;MAILER(smtp)&lt;br /&gt;define(`CERT_DIR', `MAIL_SETTINGS_DIR`'certs')dnl&lt;br /&gt;define(`confCACERT_PATH', `CERT_DIR')dnl&lt;br /&gt;define(`confCACERT', `CERT_DIR/CAcert.pem')dnl&lt;br /&gt;define(`confSERVER_CERT', `CERT_DIR/MYcert.pem')dnl&lt;br /&gt;define(`confSERVER_KEY', `CERT_DIR/MYkey.pem')dnl&lt;br /&gt;define(`confCLIENT_CERT', `CERT_DIR/MYcert.pem')dnl&lt;br /&gt;define(`confCLIENT_KEY', `CERT_DIR/MYkey.pem')dnl&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Now, we move some things around a bit.  We copy the signing certificate and laptop signed certificate like this:&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;$ cd /etc/mail/CA&lt;br /&gt;$ /bin/cp signed-laptopcert.pem /etc/mail/certs&lt;br /&gt;$ /bin/cp demoCA/cacert.pem /etc/mail/certs/CAcert.pem&lt;br /&gt;$ cd /etc/mail/certs&lt;br /&gt;$ ln -s signed-laptopcert.pem `openssl x509 -noout -hash &amp;lt; signed-laptopcert.pem`.0&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;The three files, &lt;span style="font-style:italic;"&gt;demoCA/cacert.pem&lt;/span&gt;&lt;span style="font-style:italic;"&gt;, laptopcert.pem&lt;/span&gt; and &lt;span style="font-style:italic;"&gt;signed-laptopcert.pem&lt;/span&gt; get copied onto the laptop, in its &lt;span style="font-style:italic;"&gt;/etc/mail/certs&lt;/span&gt; directory.  Now, you must tell the laptop's sendmail that these are its certificates.  This is done by building (on the laptop) the &lt;span style="font-style:italic;"&gt;sendmail.cf&lt;/span&gt; file from a &lt;span style="font-style:italic;"&gt;sendmail.mc&lt;/span&gt; file that looks roughly like this:&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;divert(0)dnl&lt;br /&gt;VERSIONID(`$Id: generic-linux.mc,v 8.1 1999/09/24 22:48:05 gshapiro Exp $')&lt;br /&gt;OSTYPE(linux)dnl&lt;br /&gt;DOMAIN(example.net)dnl&lt;br /&gt;define(`confCACERT_PATH', `/etc/mail/certs/')&lt;br /&gt;define(`confCACERT', `/etc/mail/certs/cacert.pem')&lt;br /&gt;define(`confCLIENT_CERT', `/etc/mail/certs/laptopcert.pem')&lt;br /&gt;define(`confCLIENT_KEY', `/etc/mail/certs/signed-laptopcert.pem')&lt;br /&gt;define(`confSERVER_CERT', `/etc/mail/certs/laptopcert.pem')&lt;br /&gt;define(`confSERVER_KEY', `/etc/mail/certs/signed-laptopcert.pem')&lt;br /&gt;FEATURE(`genericstable')&lt;br /&gt;FEATURE(`virtusertable')&lt;br /&gt;FEATURE(`local_procmail', `/usr/local/bin/procmail')&lt;br /&gt;MAILER(local)dnl&lt;br /&gt;MAILER(smtp)dnl&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Finally, you'll have to decide when you want to relay through the home computer.  You really have two choices.  You could set it up so that all messages are always relayed through the home computer, by setting a smart relay in your sendmail.cf, or you could relay them explicitly.  There are other places that identify the technique for setting up a smart relay, so I'll just describe the second, on-demand version.&lt;br /&gt;&lt;br /&gt;If you are trying to send email from your laptop to the user &lt;span style="font-style:italic;"&gt;somebody@example.net&lt;/span&gt;, but want to relay it through your home computer at &lt;span style="font-style:italic;"&gt;example.com&lt;/span&gt;, you would send the message to this email address:&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;somebody%example.net@example.com&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;And there you go, on-demand secure relaying of messages through your home computer.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3279819592335911399-9007498717527055055?l=distrofreelinuxuser.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://distrofreelinuxuser.blogspot.com/feeds/9007498717527055055/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3279819592335911399&amp;postID=9007498717527055055' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/9007498717527055055'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/9007498717527055055'/><link rel='alternate' type='text/html' href='http://distrofreelinuxuser.blogspot.com/2008/03/selective-sendmail-relaying-based-on.html' title='Selective sendmail relaying based on self-signed keys'/><author><name>Winter Toad</name><uri>http://www.blogger.com/profile/05606540195506310406</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-3279819592335911399.post-2841607337631242036</id><published>2008-02-28T21:46:00.008-05:00</published><updated>2008-02-28T23:21:31.689-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='configuring'/><category scheme='http://www.blogger.com/atom/ns#' term='sendmail'/><category scheme='http://www.blogger.com/atom/ns#' term='email'/><category scheme='http://www.blogger.com/atom/ns#' term='spam'/><title type='text'>Why don't I get spam?</title><content type='html'>I have an anti-spam trick.  It won't work for most people, but there might be some people out there who are inclined to take advantage of it.  For the rest, this might be educational.&lt;br /&gt;&lt;br /&gt;The trick that I use depends on the fact that I have my own domain.  That means I can run sendmail on my computer, and I can create email addresses quickly and easily.  I will use the domains &lt;span style="font-style: italic;"&gt;example.com&lt;/span&gt;, &lt;span style="font-style:italic;"&gt;example.net&lt;/span&gt;, and &lt;span style="font-style:italic;"&gt;example.org&lt;/span&gt; for this document, as recommended in &lt;a href="http://www.ietf.org/rfc/rfc2606.txt"&gt;RFC 2606&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The basic idea is this:  instead of having one email address, I have dozens.  I create a new email address for every person with whom I exchange messages, as well as addresses for websites and companies when necessary.  If an email address is accidentally revealed, or if one of the companies decides to start sending annoying amounts of unsolicited mail, I simply expire the email address and, if desired, contact the sending party to tell them about the new address.  I don't have to contact all of my friends whenever I turn off one address, only the one person who uses that address to talk to me.&lt;br /&gt;&lt;br /&gt;OK, how is this implemented?  There are two things I have to do.  First, I need my sendmail to accept the messages for the active addresses, and send them all to me.  Second, I have to ensure that my outbound email has the correct Reply-To: address for the particular recipient of the message.&lt;br /&gt;&lt;br /&gt;If you're familiar with sendmail, you can probably guess how I do the first thing.  I set up a virtual user table.  Here's the sendmail.mc file used to make this work:&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;divert(0)dnl&lt;br /&gt;VERSIONID(`sendmail.mc for example.com version 01')&lt;br /&gt;OSTYPE(linux)dnl&lt;br /&gt;DOMAIN(example.com)dnl&lt;br /&gt;FEATURE(`nouucp', `reject')&lt;br /&gt;FEATURE(`virtusertable', `hash /etc/sendmail/virtusertable')dnl&lt;br /&gt;FEATURE(`genericstable', `hash /etc/sendmail/genericstable')dnl&lt;br /&gt;FEATURE(`local_procmail', `/usr/local/bin/procmail')&lt;br /&gt;FEATURE(`access_db', `hash -T&amp;lt;TMPF&amp;gt; /etc/mail/access')&lt;br /&gt;FEATURE(`mailertable')&lt;br /&gt;GENERICS_DOMAIN(mailhost.example.com)&lt;br /&gt;MAILER(local)&lt;br /&gt;MAILER(smtp)&lt;br /&gt;define(`CERT_DIR', `MAIL_SETTINGS_DIR`'certs')dnl&lt;br /&gt;define(`confCACERT_PATH', `CERT_DIR')dnl&lt;br /&gt;define(`confCACERT', `CERT_DIR/CAcert.pem')dnl&lt;br /&gt;define(`confSERVER_CERT', `CERT_DIR/MYcert.pem')dnl&lt;br /&gt;define(`confSERVER_KEY', `CERT_DIR/MYkey.pem')dnl&lt;br /&gt;define(`confCLIENT_CERT', `CERT_DIR/MYcert.pem')dnl&lt;br /&gt;define(`confCLIENT_KEY', `CERT_DIR/MYkey.pem')dnl&lt;br /&gt;Cw mailhost.example.com&lt;br /&gt;Cw example.com&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;Then, I create a file called &lt;span style="font-weight:bold;"&gt;/etc/mail/virtusertable.src&lt;/span&gt;.  It contains entries similar to this:&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;hotels@example.com                      error:nouser Spammers found this address&lt;br /&gt;&lt;br /&gt;disposable0000@example.com              myself&lt;br /&gt;&lt;br /&gt;ebay@example.com                        myself&lt;br /&gt;electronics@example.com                 myself&lt;br /&gt;slashdot@example.com                    myself&lt;br /&gt;thinkgeek@example.com                   myself&lt;br /&gt;&lt;br /&gt;mail-default-0000-r2@example.com        myself&lt;br /&gt;mail-0000-r7@example.com                myself&lt;br /&gt;mail-0001-q3@example.com                myself&lt;br /&gt;mail-0002-a4@example.com                myself&lt;br /&gt;mail-0003-c8@example.com                error:nouser Spammers found this address&lt;br /&gt;mail-0004-d7@example.com                myself&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;The addresses I create for regular correspondance are just successive numbers, plus an unpredictable sequence of two characters to avoid dictionary attacks.&lt;br /&gt;&lt;br /&gt;Now, recall that sendmail doesn't read the &lt;span style="font-weight:bold;"&gt;virtusertable.src&lt;/span&gt; file, it reads another file called &lt;span style="font-weight:bold;"&gt;virtusertable.db&lt;/span&gt;.  I've got a little Makefile in &lt;span style="font-weight:bold;"&gt;/etc/mail&lt;/span&gt; that I use to keep things up to date:&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;all : genericstable.db virtusertable.db mailertable.db aliases.db access.db&lt;br /&gt;&lt;br /&gt;%.db : %.src&lt;br /&gt;        makemap hash $* &amp;lt; $&amp;lt;&lt;br /&gt;&lt;br /&gt;aliases.db : aliases&lt;br /&gt;        newaliases&lt;br /&gt;&lt;br /&gt;hup :   all&lt;br /&gt;        killall -HUP sendmail&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;Now, I can change the virtusertable file, and when it looks correct, issue (as root) the command:&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;make -C /etc/mail hup&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;This will update the appropriate database file, and send a SIGHUP to sendmail, telling that program to reload its databases.&lt;br /&gt;&lt;br /&gt;So, that's the receiving side.  How about sending?  There may be a way to configure sendmail to rewrite the outbound addresses according to a database of recipients, but I haven't figured one out.  Instead, I have written a bit of code for my email client, which is rmail mode in Emacs.  Here are the relevant bits of Emacs Lisp:&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;(setq user-mail-address &amp;quot;bounces0000@example.com&amp;quot;)&lt;br /&gt;(setq mail-specify-envelope-from t)&lt;br /&gt;&lt;br /&gt;(setq outbound-address-alist&lt;br /&gt;      '(&lt;br /&gt;        (&amp;quot;joe@example.org&amp;quot;              &amp;quot;mail-0000-r7@example.com&amp;quot;)&lt;br /&gt;        (&amp;quot;frank@example.org&amp;quot;            &amp;quot;mail-0001-q3@example.com&amp;quot;)&lt;br /&gt;        (&amp;quot;wilbur@example.net&amp;quot;           &amp;quot;mail-0002-a4@example.com&amp;quot;)&lt;br /&gt;        (&amp;quot;euripedes@example.net&amp;quot;        &amp;quot;mail-0004-d7@example.com&amp;quot;)&lt;br /&gt;        (nil                   &amp;quot;mail-default-0000-r2@example.com&amp;quot;)&lt;br /&gt;        )&lt;br /&gt;)&lt;br /&gt;(setq full-name &amp;quot;Winter Toad&amp;quot;)&lt;br /&gt;&lt;br /&gt;;; a function to parse out the header and send email as if from&lt;br /&gt;;; different usernames.  That way, I can obsolete a username if it&lt;br /&gt;;; gets spam.&lt;br /&gt;(add-hook 'mail-send-hook&lt;br /&gt;          '(lambda ()&lt;br /&gt;            (narrow-to-region 1 (mail-header-end))&lt;br /&gt;            (beginning-of-buffer)&lt;br /&gt;            (expand-mail-aliases 1 (mail-header-end))&lt;br /&gt;            (re-search-forward &amp;quot;^To: &amp;quot;)&lt;br /&gt;            ;; parse out the recipient address&lt;br /&gt;            (let (recipient from-whom)&lt;br /&gt;              (cond&lt;br /&gt;                ((looking-at &amp;quot;\\([^ \\t]*\\)$&amp;quot;)&lt;br /&gt;                 (setq recipient (match-string 1)))&lt;br /&gt;                ((looking-at &amp;quot;[^&amp;lt;]*&amp;lt;\\([^&amp;gt;]*\\)&amp;gt;$&amp;quot;)&lt;br /&gt;                 (setq recipient (match-string 1))))&lt;br /&gt;              (setq from-whom (or (cadr (assoc recipient outbound-address-alist))&lt;br /&gt;                                  (cadr (assoc nil outbound-address-alist))))&lt;br /&gt;              (end-of-line)&lt;br /&gt;              (newline)&lt;br /&gt;              (insert &amp;quot;From: &amp;quot; full-name &amp;quot; &amp;lt;&amp;quot; from-whom &amp;quot;&amp;gt;&amp;quot;)&lt;br /&gt;&lt;br /&gt;              (re-search-forward &amp;quot;^Reply-to: &amp;quot;)&lt;br /&gt;              (let ((namestart (point-marker)))&lt;br /&gt;                (end-of-line)&lt;br /&gt;                (kill-region namestart (point-marker))&lt;br /&gt;                (insert from-whom)))&lt;br /&gt;&lt;br /&gt;            (narrow-to-region 1 (1+ (buffer-size)))))&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;What this does is to insert a hook into the mail system when I hit send.  A bit of elisp locates the email address in the "To:" field, and tries to match that string to one of the names in the 'outbound-address-alist'.  If it finds a match, it inserts the corresponding data into the "Reply-to:" field.  If no match is found, or if there are multiple recipients, it uses the default fallback address.&lt;br /&gt;&lt;br /&gt;It also sets the sender address to bounces0000@example.com, which means that automated replies, such as sendmail daemon warnings and errors, will be delivered to that address.  It should be redirected in the virtusertable to some appropriate address so that you can be notified of problems at the recipient's end (though many systems no longer generate bounce messages, because of spam abuse).&lt;br /&gt;&lt;br /&gt;Anyway, with all this, I get really no spam.  Every few months I may get one message on one of my email addresses, typically one that I used for a forum post or to send a bug report or patch to a mailing list.  I retire the address, set up a new one, and never get spam at that address again.&lt;br /&gt;&lt;br /&gt;Some time later I'll describe the cryptographic certificates in the mail configuration, and how they allow secure relaying.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3279819592335911399-2841607337631242036?l=distrofreelinuxuser.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://distrofreelinuxuser.blogspot.com/feeds/2841607337631242036/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3279819592335911399&amp;postID=2841607337631242036' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/2841607337631242036'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/2841607337631242036'/><link rel='alternate' type='text/html' href='http://distrofreelinuxuser.blogspot.com/2008/02/why-dont-i-get-spam.html' title='Why don&apos;t I get spam?'/><author><name>Winter Toad</name><uri>http://www.blogger.com/profile/05606540195506310406</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-3279819592335911399.post-4461988853501517600</id><published>2008-02-26T19:45:00.002-05:00</published><updated>2008-02-26T19:53:11.147-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='configuring'/><category scheme='http://www.blogger.com/atom/ns#' term='debugging'/><category scheme='http://www.blogger.com/atom/ns#' term='compiling'/><title type='text'>Installing in non-standard places</title><content type='html'>I &lt;a href="http://distrofreelinuxuser.blogspot.com/2008/02/choosing-install-prefix.html"&gt;mentioned earlier&lt;/a&gt; the possibility of choosing an install prefix like &lt;span style="font-weight: bold;"&gt;/usr/local/samba&lt;/span&gt;, which installs the Samba libraries in a directory that may not commonly exist on distribution-managed machines.  One possible effect of this is that you may turn up bugs in configuration and compilation scripts of other packages.&lt;br /&gt;&lt;br /&gt;A configure script for another package may accept arguments related to the location of Samba libraries and header files, but compiling the package with these options set might not work.  This isn't very surprising, it's a compilation option that is probably rarely used, so bit rot has a tendency to set in.  A change somewhere that accidentally breaks the compilation when Samba is installed in an unusual place might not be noticed for some time.  By putting Samba in its own directory, you are setting yourself up to test a valid, but rarely exercised option.  You may find yourself submitting bug reports and patches to the package maintainers.&lt;br /&gt;&lt;br /&gt;As I've said before, maintaining your box without a package manager and distribution is not easy.  It's quite a bit more work, but it does force you to understand more about how the system is set up and what it's doing.  For people who like the extra control and understanding this provides, this is a useful technique.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3279819592335911399-4461988853501517600?l=distrofreelinuxuser.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://distrofreelinuxuser.blogspot.com/feeds/4461988853501517600/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3279819592335911399&amp;postID=4461988853501517600' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/4461988853501517600'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/4461988853501517600'/><link rel='alternate' type='text/html' href='http://distrofreelinuxuser.blogspot.com/2008/02/installing-in-non-standard-places.html' title='Installing in non-standard places'/><author><name>Winter Toad</name><uri>http://www.blogger.com/profile/05606540195506310406</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-3279819592335911399.post-2529012576893138688</id><published>2008-02-24T10:34:00.002-05:00</published><updated>2008-02-24T10:42:40.012-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='blogging'/><category scheme='http://www.blogger.com/atom/ns#' term='ottawa'/><title type='text'>Pharyngula readers in Ottawa</title><content type='html'>PZ over at &lt;a href="http://scienceblogs.com/pharyngula/"&gt;Pharyngula&lt;/a&gt; reports that readers of his blog are &lt;a href="http://scienceblogs.com/pharyngula/2008/02/what_a_strange_phenomenon.php"&gt;meeting up in various places&lt;/a&gt;.  Well, if there are any people in Ottawa who are interested in meeting, we can try to set it up here in the comments.&lt;br /&gt;&lt;br /&gt;Any place I can get to by bus is fine with me, maybe a weekend lunch time?  Possibilities would be&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Lone Star at Baseline and Fisher&lt;/li&gt;&lt;li&gt;Sushi Kan at Baseline and Merivale&lt;/li&gt;&lt;li&gt;Some place in Chinatown&lt;/li&gt;&lt;/ul&gt;Or suggestions from somebody else, I'm not very familiar with the spots to eat in the city, places where a group can sit, eat, and talk for a while.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3279819592335911399-2529012576893138688?l=distrofreelinuxuser.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://distrofreelinuxuser.blogspot.com/feeds/2529012576893138688/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3279819592335911399&amp;postID=2529012576893138688' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/2529012576893138688'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/2529012576893138688'/><link rel='alternate' type='text/html' href='http://distrofreelinuxuser.blogspot.com/2008/02/pharyngula-readers-in-ottawa.html' title='Pharyngula readers in Ottawa'/><author><name>Winter Toad</name><uri>http://www.blogger.com/profile/05606540195506310406</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>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3279819592335911399.post-660413901934859337</id><published>2008-02-21T20:07:00.002-05:00</published><updated>2008-02-21T20:25:36.489-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='crypto'/><category scheme='http://www.blogger.com/atom/ns#' term='security'/><category scheme='http://www.blogger.com/atom/ns#' term='hardware'/><title type='text'>A Followup On Cryptographic Mounts, The Bad News</title><content type='html'>Previously, I discussed &lt;a href="http://distrofreelinuxuser.blogspot.com/2008/02/cryptographic-mounts.html"&gt;cryptographic mounts&lt;/a&gt; to hold sensitive data.  It's worth pointing out an article that is making the rounds today by 9 authors from Princeton, in which the researchers &lt;a href="http://citp.princeton.edu/memory/"&gt;describe an attack&lt;/a&gt; on cryptographic techniques, including the one I've described.&lt;br /&gt;&lt;br /&gt;The technique relies on the fact that modern memory can retain its information for several minutes after the computer stops sending it refresh signals.  What this means is that a person with physical access to the computer can pull the power connector from the computer and then remove the memory chips, insert them in another computer, and read the cryptographic keys out of the memory.  I don't know of a good way to avoid this attack.  If the cryptographic volumes are mounted when the computer falls into the hands of the attacker, the data will be, in theory, recoverable.&lt;br /&gt;&lt;br /&gt;So, what can be done to prevent the key from being resident in the computer's memory at the instant that the attacker unplugs it?  The key has to be available to the operating system so that it can read and write that data in normal operation.  Sure, you could get specially modified hardware that deliberately overwrites the main memory from batteries when the power connector is removed, but maybe there's a way to store 128 bits somewhere other than in main memory?&lt;br /&gt;&lt;br /&gt;A cache line on a modern CPU is 64 bytes, big enough to hold two 128-bit keys.  Could the operating system subvert the hardware's L1 caching mechanism sufficiently to pin a value in the cache and remove it from L2 and main memory?  This attack won't recover data from the L1 cache, so if that's the only place the key is kept, maybe that would be enough.  You sacrifice a cache line, but maybe it's worth it?&lt;br /&gt;&lt;br /&gt;How about the TLB?  That's another part of the CPU that holds data, and that one is explicitly designed to interact with the operating system.  Could we find a way to store 128 bits in parts of the TLB, and then deliberately avoid overwriting them?  Can the operating system read those numbers back out of the TLB?&lt;br /&gt;&lt;br /&gt;Are there any registers that could be used?  Probably not on 32-bits, there aren't many registers there, and on 64-bits you'd probably have to use a special-purpose compiler to avoid these registers being touched by a context switch, and avoid them being saved to memory when an interrupt handler runs.&lt;br /&gt;&lt;br /&gt;What if you have fifteen keys, all of 128 bits?  Well, I believe we could handle that if we had 256 bits of volatile storage space.  The first 128 bits of volatile space holds an XOR key, that decodes all of the fifteen keys.  The second 128 bits of volatile space holds the decoded key in active use.&lt;br /&gt;&lt;br /&gt;Those are my thoughts, anyway.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3279819592335911399-660413901934859337?l=distrofreelinuxuser.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://distrofreelinuxuser.blogspot.com/feeds/660413901934859337/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3279819592335911399&amp;postID=660413901934859337' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/660413901934859337'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/660413901934859337'/><link rel='alternate' type='text/html' href='http://distrofreelinuxuser.blogspot.com/2008/02/followup-on-cryptographic-mounts-bad.html' title='A Followup On Cryptographic Mounts, The Bad News'/><author><name>Winter Toad</name><uri>http://www.blogger.com/profile/05606540195506310406</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-3279819592335911399.post-2500077847525174546</id><published>2008-02-20T20:03:00.002-05:00</published><updated>2008-02-20T20:26:53.459-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='configuring'/><category scheme='http://www.blogger.com/atom/ns#' term='compiling'/><title type='text'>Choosing an install prefix</title><content type='html'>As noted in &lt;a href="http://distrofreelinuxuser.blogspot.com/2008/02/compiling-and-installing-by-hand.html"&gt;this posting&lt;/a&gt;, you generally will have to choose an install prefix for software that you are compiling yourself.  Most packages you encounter will be configured to install under /usr/local, though some will be configured for /usr.&lt;br /&gt;&lt;br /&gt;The first thing you'll want to do is to see if you already have an older version of the software installed anywhere.  If the software was previously installed under /usr/local, and you install the new package under /usr, not only will you needlessly consume disk space, but the version that is run will depend on the setting of your PATH environment variable.  A user may report that he can't use a certain feature in the new version, and it may take you a while to notice that his environment variable differs from yours, and that he's still running the old software.  So, find the name of an executable that you expect will be installed.  For example, if you're installing the binutils software, you will expect that the &lt;span style="font-weight: bold;"&gt;ld&lt;/span&gt; binary should be installed somewhere.  Next, type the command:&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;which ld&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;to see where it is currently installed.  If you see it in "/usr/bin/ld", then you'll probably want to use a prefix of "/usr", so that your new versions install over top of the old ones.  If, on the other hand, it's in "/usr/local/bin/ld", you'll want a prefix of "/usr/local".&lt;br /&gt;&lt;br /&gt;Sometimes a package installs only one or a few binaries.  You may decide to install this into its own directory.  For example, I install &lt;a href="http://www.mozilla.com/en-US/firefox/"&gt;firefox&lt;/a&gt; into the prefix /usr/local/firefox, &lt;a href="http://sbcl.sourceforge.net/"&gt;SBCL&lt;/a&gt; into the prefix /usr/local/sbcl, and the &lt;a href="http://httpd.apache.org/"&gt;apache httpd&lt;/a&gt; into /usr/local/apache2.  These get their own directories because, while they may install a very small number of executables, they come with a large set of ancillary files.  Rather than installing over top of the old directory, I move the old directory to a new location, say "/usr/local/sbcl.old", and then install and test the new version.  If the new version doesn't work properly, I can revert to the old one by deleting the new install and renaming the ".old" directory.  Alternatively, I can compare the two installations, the previously working one against the new one, and see if there are any obvious differences that could account for problems.&lt;br /&gt;&lt;br /&gt;Of course, you probably won't be able to type the command &lt;span style="font-weight: bold;"&gt;firefox&lt;/span&gt; and expect it to run if it's installed in /usr/local/firefox/bin/.  You will either want to add that directory to the PATH variable, or, more conveniently, put a symbolic link to the appropriate executable from a directory that is in your PATH.  This command:&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;ln -s /usr/local/firefox/bin/firefox /usr/X11/bin/firefox&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;puts the firefox executable into your PATH, piggy-backing on the /usr/X11/bin entry that is probably there already.  Note, however, that if you re-install X11 (we'll get to that in another posting), you might destroy this symbolic link, and you'll have to re-create it then.&lt;br /&gt;&lt;br /&gt;So, you really have a couple of choices.  Put the program into a standard place, like /usr or /usr/local (and if upgrading try to install over top of the old version by using the same prefix that was used then), or installing the software in its own dedicated directory, like /usr/local/firefox or /usr/local/sbcl.&lt;br /&gt;&lt;br /&gt;Now, when you set the prefix in an autoconf configure script, it also sets a number of derived values which can be separately overridden.  Configuration files are, by default, put in &amp;lt;prefix&amp;gt;/etc, libraries in &amp;lt;prefix&amp;gt;/lib, headers in &amp;lt;prefix&amp;gt;/include, man pages in &amp;lt;prefix&amp;gt;/share/man (sometimes omitting the 'share' component), log files in &amp;lt;prefix&amp;amp;gt/var/log, and so on.  The configure program lets you override these defaults separately, so that you can put configuration files into, say, /etc/http with the option "--sysconfdir=/etc/http", and so on.  Think carefully about whether you want these additional directories to keep their defaults.  You probably don't want your X-server log to be in /usr/X11/var/log, nobody will know where to look for it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3279819592335911399-2500077847525174546?l=distrofreelinuxuser.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://distrofreelinuxuser.blogspot.com/feeds/2500077847525174546/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3279819592335911399&amp;postID=2500077847525174546' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/2500077847525174546'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/2500077847525174546'/><link rel='alternate' type='text/html' href='http://distrofreelinuxuser.blogspot.com/2008/02/choosing-install-prefix.html' title='Choosing an install prefix'/><author><name>Winter Toad</name><uri>http://www.blogger.com/profile/05606540195506310406</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-3279819592335911399.post-4945719910033271054</id><published>2008-02-20T18:47:00.005-05:00</published><updated>2008-02-20T20:28:12.014-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='configuring'/><category scheme='http://www.blogger.com/atom/ns#' term='installing'/><category scheme='http://www.blogger.com/atom/ns#' term='compiling'/><title type='text'>Compiling and installing by hand</title><content type='html'>If you're not using a package manager, or if you are, but there is no package available for a piece of software you'd like to install, you'll find yourself compiling the software by hand.  Generally, you start by locating the official web page of the software, downloading an appropriate version of the source code, and extracting the tar file to a directory somewhere.&lt;br /&gt;&lt;br /&gt;At this point in the process, you are not doing anything as the root user.  You'll become root much later in this process.&lt;br /&gt;&lt;br /&gt;The next thing you'll do is look in the top level of the extracted directory for promising looking files, like README, INSTALL, or Makefile.  It is likely that you will see an executable script called "configure".  It's always a good idea to start by looking at the README and INSTALL files, if present.  They may be in the toplevel directory, or in a documentation directory, which will often have a name like "doc", "docs", or "documentation", possibly with different capitalizations.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;If The Package Came With A Makefile&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If there's a Makefile in the toplevel, that's usually because the software package is fairly small.  You will want to look over the Makefile to ensure that it is correct for your intended installation.  The most important things to look for are the installation directory and any optional features that might have to be turned on by editing the Makefile.  If you can't find the installation directory, type the command:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;make -n install&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;This will ask "make" to print out the sequence of commands that it will be using to install the package.  Since you haven't compiled anything yet, it will start with the sequence of commands required to compile your software, so look for the installation commands to occur near the end of the output generated by this command.&lt;br /&gt;&lt;br /&gt;If your package came with a Makefile, you will now modify the Makefile if necessary, perhaps changing the installation directory of the product.  You should do this before compiling it, because sometimes character strings holding the pathnames of configuration files are inserted into the compiled binary, so changing the installation target after compiling may result in an installation that doesn't work correctly.  Editing the Makefile will usually not force a recompilation of the objects under its control, that is the Makefile is not, by default, considered a dependency for the targets in the file.&lt;br /&gt;&lt;br /&gt;After this, you will, still as your non-root user, compile the package. This is usually done by simply entering the command &lt;span style="font-weight: bold;"&gt;make&lt;/span&gt;.  If errors are encountered during the compile, you'll have to figure out what happened and how to fix it.  The most common causes of errors are:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;missing include files - you might have to add a "-I&amp;lt;directory&amp;gt;" to the CFLAGS, CXXFLAGS, or CPPFLAGS variables in your Makefile.&lt;/li&gt;&lt;li&gt;missing libraries - you might have to add a "-L&amp;lt;directory&amp;gt;" to the LDFLAGS variable in your Makefile.&lt;/li&gt;&lt;li&gt;bad version - the compilation may depend on a library you have on your machine, but the version you have may not be compatible with the software package.  You might have to download a different version of that library and install it before you can continue with the software package.&lt;/li&gt;&lt;li&gt;apparent code errors - the compiler may generate errors related to missing variables, bad function declarations, or syntax errors.  Resist the urge to correct these immediately, and try to understand why you are seeing these errors.  Remember, this package probably compiled for somebody before they released it, why doesn't it work for you?  Is it that your compiler is a different version, and flags as errors things that used to be warnings?  Is the Makefile configured for the wrong architecture or platform?  Something else?&lt;/li&gt;&lt;/ul&gt;Once you get a clean compile, you're almost ready for the install.  I usually prefer to run the command&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;make -n install | less&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;once and read through the output, just to make sure that the install isn't going to do something weird.  Look for things like configuration files going into /usr/etc, which might not be what you expect, or binaries going into /bin (you should try to keep in that directory only those executables that are necessary to get the computer to boot through its startup scripts up to the point where the network starts up).&lt;br /&gt;&lt;br /&gt;At this point, move down to the section of the text called "Installing The Software".&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;You Have A "configure.am" Script, But No "configure" Script&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;If you have a "configure.am" script, but no "configure" script, you'll have to generate the configure script.  If there is an executable in this directory with a name like "autogen.sh", run it.  This should be sufficient to set up the configure script.  If you don't have an autogen script, you should run the commands &lt;span style="font-weight: bold;"&gt;automake&lt;/span&gt; then &lt;span style="font-weight: bold;"&gt;autoconf&lt;/span&gt;.  This will often generate warnings, but unless the configure script you generate doesn't run, you can ignore those.  So, now you have a configure script, you continue to the next section.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;You Have A "configure" Script&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If you generated the configure script yourself, you know that it's an autoconf configure script.  Sometimes, though, software is produced that has a completely different script that happens to be called "configure".  This can be confusing if it doesn't recognize the switch "--help".  Start by typing:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;./configure --help | less&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;and look at the output.  If it produces a list of options that are available to you, review them carefully and see if there are any optional behaviours that you would like to turn on, or unwanted options that you want to remove (possibly you don't have library support for these, and don't need them).  If, instead, the configure script appears to run and do things, you don't have an autoconf configure script, go back and look at the documentation again to see how to use their particular configuration script.&lt;br /&gt;&lt;br /&gt;There are a few things to look at in the options you get from "configure".  One of them is the prefix location, and choosing that properly can require some care, which is &lt;a href="http://distrofreelinuxuser.blogspot.com/2008/02/choosing-install-prefix.html"&gt;discussed here&lt;/a&gt;.  For now, let's assume that you've chosen a set of options that look suitable.  You re-run the configure script with those options, and without the "--help" option.  It will do some things, it may take a considerable amount of time to run.  Eventually, the script should exit, sometimes generating a list of all options and whether or not they are active.  Examine this list if present, there might be an option that you want to enable that has been turned off because the configure script failed to find a particular library, in which case you'll have figure out why that option was disabled and figure out how to get it working.  When you're satisfied with the compilation options, type "make".  If an error is encountered, see the possibilities mentioned in the earlier section referring to building from a Makefile.  If you succeed in compiling the software package, go to next section, "Installing The Software".&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Installing The Software&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now, you can become the root user.  Change directory to the location where you compiled the binary, and run&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;make install&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;If the thing you're installing has any shared objects (libraries, usually with names that end in ".so", possibly followed by more dots and numerals), you should type&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;ldconfig&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;to make sure that the dynamic linker knows where to find the libraries you've just installed.&lt;br /&gt;&lt;br /&gt;Many packages these days produce a pkg-config file.  This is usually a filename that ends in ".pc", and is installed in a directory like ".../lib/pkgconfig/".  The &lt;span style="font-weight: bold;"&gt;pkg-config&lt;/span&gt; application often looks for these files when "configure" is being run, but it has a fairly definite idea of where to look.  If your .pc file was installed into a directory where pkg-config doesn't normally look, you'll have to find some way to make this file visible to that program.  There are three ways you can handle this:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Add the appropriate directory to the system-wide environment variable PKG_CONFIG_PATH.  Usually this means editing /etc/profile.  You likely want it set at least to "/usr/lib/pkgconfig:/usr/local/lib/pkgconfig:/usr/X11/lib/pkgconfig", but you may want to add more search directories to it, if you expect many packages to be installed in the same prefix.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Copy the .pc file into a directory that &lt;span style="font-weight: bold;"&gt;pkg-config&lt;/span&gt; searches.  This is unwise, you may install another version of the software some time later, and unless you remember this step your .pc file will still be the old one, causing much aggravation as "configure" insists you still have a version of the package that you know you just replaced.&lt;/li&gt;&lt;li&gt;Put a symbolic link to the file from a directory that is searched by pkg-config.  Do this if you've got only one or two .pc files in this prefix, and don't expect to put in more.&lt;/li&gt;&lt;/ul&gt;Test your newly-installed software.  It's best to find problems now, when you've just finished installing it and remember what you did, than two weeks from now and have to go through the whole thing again just to figure out how it's set up.&lt;br /&gt;&lt;br /&gt;Two more hints:  "configure" writes its command line into a comment near the top of the file "config.log".  If you need to remember how you last ran "configure", you will find the options you used there.&lt;br /&gt;&lt;br /&gt;If you have a particularly detailed set of configure options, you might want to record them in a directory somewhere for future reference, both to see quickly what options you enabled when you compiled the software and to re-use the command the next time you recompile it after downloading a new version.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3279819592335911399-4945719910033271054?l=distrofreelinuxuser.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://distrofreelinuxuser.blogspot.com/feeds/4945719910033271054/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3279819592335911399&amp;postID=4945719910033271054' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/4945719910033271054'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/4945719910033271054'/><link rel='alternate' type='text/html' href='http://distrofreelinuxuser.blogspot.com/2008/02/compiling-and-installing-by-hand.html' title='Compiling and installing by hand'/><author><name>Winter Toad</name><uri>http://www.blogger.com/profile/05606540195506310406</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-3279819592335911399.post-403726778628691740</id><published>2008-02-19T22:07:00.003-05:00</published><updated>2008-02-19T22:58:52.747-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='blogging'/><title type='text'>Making blogged source code readable</title><content type='html'>Just a quick note, I've reformatted my source code examples using &lt;a href="http://formatmysourcecode.blogspot.com/"&gt;http://formatmysourcecode.blogspot.com/&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3279819592335911399-403726778628691740?l=distrofreelinuxuser.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://distrofreelinuxuser.blogspot.com/feeds/403726778628691740/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3279819592335911399&amp;postID=403726778628691740' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/403726778628691740'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/403726778628691740'/><link rel='alternate' type='text/html' href='http://distrofreelinuxuser.blogspot.com/2008/02/just-quick-note-ill-reformat-my-source.html' title='Making blogged source code readable'/><author><name>Winter Toad</name><uri>http://www.blogger.com/profile/05606540195506310406</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-3279819592335911399.post-100738987988630658</id><published>2008-02-18T22:13:00.008-05:00</published><updated>2008-02-21T21:53:04.087-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='crypto'/><category scheme='http://www.blogger.com/atom/ns#' term='security'/><title type='text'>Keeping sensitive data on the crypto disks</title><content type='html'>Previously, I described how to &lt;a href="http://distrofreelinuxuser.blogspot.com/2008/02/cryptographic-mounts.html"&gt;create one or more crytpographic partitions&lt;/a&gt;&lt;a href="http://distrofreelinuxuser.blogspot.com/"&gt;&lt;/a&gt;. The data stored on those partitions is not retrievable without the 32-digit hexadecimal key that protects it, the key being constructed from a passphrase input by the user.  It may seem that this is sufficient to protect sensitive data, making sure simply to create and edit your files only in that partition.  However, there are some subtle details that have to be kept in mind.&lt;br /&gt;&lt;br /&gt;Information stored on an unencrypted ext2 or ext3 partition has an unknown persistence.  A file that was stored there, and later deleted, may be partially or fully recoverable at some time in the future.  To be sure of the confidentiality of your data, you have to make sure that it has never been stored to an unencrypted partition.&lt;br /&gt;&lt;br /&gt;If you start up your favourite text editor, telling it to create a new file in some place, let's call it /crypto/sensitive.txt, and then start typing, you may expect that the data never lands on an unencrypted partition.  However, there are at least four things to be careful of:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;The editor may store information in your home directory, which may not be on the encrypted partition.  It might store some of the file contents there, or it might store file metadata.  Your editor may keep a table of filenames recently visited in /home, with information about the line number last visited.  Your editor might be configured to store crash-recovery autosave files in a directory under your /home directory.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The editor may sometimes store the contents of a working buffer to a file in /tmp.&lt;/li&gt;&lt;li&gt;The computer may come under memory pressure, resulting in some of your data being sent to the swap device.&lt;/li&gt;&lt;li&gt;Your backups may not be as well protected as the files on the cryptographic disk.&lt;/li&gt;&lt;/ol&gt;The first two points are probably best addressed by ensuring that all of the directories writable by the unprivileged user are on cryptographic partitions.  If you only have write permission to the crypto drives, you won't store any files in plaintext.  Note, however, that you typically need /tmp to exist and be writable during the bootup of your system, so that partition can't be protected with a passphrase if you care about the system successfully performing an unattended reboot.&lt;br /&gt;&lt;br /&gt;So, what do we do about /tmp?  Well, one simple solution is an overmount.  While you normally mount a partition onto an empty directory, it is legal to mount onto a directory that is not empty.  The files that were present in that directory are mostly inaccessible after that (a process with access to file descriptors that it opened before the mount will still be able to operate on those files, but they will be invisible to new open operations by pathname).&lt;br /&gt;&lt;br /&gt;We're assuming you have at least one cryptographic partition.  So, create a directory on that partition, let's say /crypto/tmp.  After you have formatted and mounted your cryptographic partition, run this command.  You only have to do this once, the first time you set up cryptographic disks.&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;mkdir --mode=01777 /crypto/tmp&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Now, you can add the following command to the end of the script in the previous post, the script that mounts your formatted disks:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;mount --bind /crypto/tmp /tmp&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;After you've done this, the system will still boot up as usual, using its unencrypted /tmp partition.  Then, the root user can run the script from the previous post, now modified to have this extra &lt;span style="font-weight: bold;"&gt;mount&lt;/span&gt; line on the end of it. After entering the passphrase the script will do its work and exit, at which time your /tmp partition will have been replaced with the one in /crypto.  Note that if your system starts up in X, with a graphical login screen, you will have to restart it after you have overmounted /tmp, otherwise you will find that X programs fail to work at all.  I usually restart X by issuing a simple "&lt;span style="font-weight: bold;"&gt;killall X&lt;/span&gt;" command, and letting the xdm or gdm program start it back up again.  This is a lot of trouble, but all manner of things can be stored on your /tmp disk.  Firefox will store downloaded files such as PDFs there when there is a helper application ready to use them.&lt;br /&gt;&lt;br /&gt;That leaves us with swap.  Encrypting the swap space is actually very easy:&lt;br /&gt;&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;# Encrypt the swap partition&lt;br /&gt;hashed=`dd if=/dev/urandom bs=1 count=64 | md5sum | awk ' { print $1 } '`&lt;br /&gt;dmsetup create SWP &amp;lt;&amp;lt;DONE&lt;br /&gt;0 `blockdev --getsize /dev/hda6` crypt aes-plain $hashed 0 /dev/hda6 0&lt;br /&gt;DONE&lt;br /&gt;mkswap /dev/mapper/SWP&lt;br /&gt;swapon /dev/mapper/SWP&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;This can run unattended during the bootup.  It creates a random cryptographic key using /dev/urandom, a device especially designed to produce true random numbers even during a system bootup sequence.  This random key is used to create an encrypted interface to /dev/hda6.  It is formatted as a swap partition, and then enabled.  A new key will be generated each time the system boots, so nothing in swap space will survive a reboot.  Note that there do exist suspend-to-disk procedures for Linux that store a memory image on the swap partition.  If you intend to use such a suspend system, you will have to ensure that it does not attempt to write to the cryptographic swap partition, or you'll have to defer mounting the swap partition until the root user can enter a specific passphrase, thereby allowing you to preserve the contents across a reboot.  If you're supplying a passphrase to handle encryption on the swap space, you should not run &lt;span style="font-weight: bold;"&gt;mkswap&lt;/span&gt;, except the first time you set up the partition (think of &lt;span style="font-weight: bold;"&gt;mkswap&lt;/span&gt; as being a reformat).&lt;br /&gt;&lt;br /&gt;The question of how to protect your backup copies of sensitive files is entirely dependent on what system you use for backups.  You may be able to pipe your backups through the &lt;span style="font-weight: bold;"&gt;des&lt;/span&gt; binary, or you may be able to store the backups on encrypted filesystems, but there are too many variations for me to offer much advice here.  The security of your backups is not something that can be ignored, as has been made all to obvious with the various data disclosure scares that occur with alarming regularity when shipments of tapes or CDs fail to arrive at their destinations.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;UPDATE&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;See my followup article for a warning about a &lt;a href="http://distrofreelinuxuser.blogspot.com/2008/02/followup-on-cryptographic-mounts-bad.html"&gt;vulnerability in this technique&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3279819592335911399-100738987988630658?l=distrofreelinuxuser.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://distrofreelinuxuser.blogspot.com/feeds/100738987988630658/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3279819592335911399&amp;postID=100738987988630658' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/100738987988630658'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/100738987988630658'/><link rel='alternate' type='text/html' href='http://distrofreelinuxuser.blogspot.com/2008/02/keeping-sensitive-data-on-crypto-disks.html' title='Keeping sensitive data on the crypto disks'/><author><name>Winter Toad</name><uri>http://www.blogger.com/profile/05606540195506310406</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-3279819592335911399.post-5165007214856247251</id><published>2008-02-17T21:51:00.005-05:00</published><updated>2008-02-19T22:51:28.624-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='crypto'/><category scheme='http://www.blogger.com/atom/ns#' term='security'/><title type='text'>Cryptographic mounts</title><content type='html'>Some of the data on my computers is stuff that I'd rather not let into the hands of a random stranger.  Work-related files, proprietary data or source code, banking information, or other sensitive files.  A laptop can go missing, an entire desktop computer can be carried away.  It would be nice if the sensitive data were inaccessible in that event.&lt;br /&gt;&lt;br /&gt;This leads us to cryptographic mounts.  Partitions whose contents cannot be read without the knowledge of a secret that is not stored in the computer.  I use a passphrase, but if you are the kind of person who memorizes 32 digit hexadecimal numbers, you can skip the passphrase.  The appropriate features to enable in the kernel, either as modules or compiled directly in, are MD (the same subsystem that controls RAID) and two features in that subsystem, BLK_DEV_MD, and DM_CRYPT.  You also need a cryptographic algorithm available.  I use AES encryption on my partitions, but there are many others available.  I have activated the CRYPTO_AES module, plus the appropriate architecture specific module, CRYPTO_AES_X86_64 for my desktop machine and CRYPTO_AES_586 for my laptop.&lt;br /&gt;&lt;br /&gt;So, let's say you have one or more blank partitions that you'd like to set up as a cryptographic partitions, all with the same passphrase.  You start with this script:&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;#! /bin/sh&lt;br /&gt;#&lt;br /&gt;&lt;br /&gt;partition=/dev/sda6&lt;br /&gt;partition2=/dev/sdc6&lt;br /&gt;mtpt=/crypto&lt;br /&gt;mapname1=Crypto1&lt;br /&gt;mapname2=Crypto2&lt;br /&gt;&lt;br /&gt;holdIFS=&amp;quot;$IFS&amp;quot;&lt;br /&gt;IFS=&amp;quot;&amp;quot;&lt;br /&gt;&lt;br /&gt;echo -n &amp;quot;Enter the passphrase: &amp;quot;&lt;br /&gt;read -s oneline&lt;br /&gt;&lt;br /&gt;IFS=&amp;quot;$holdIFS&amp;quot;&lt;br /&gt;&lt;br /&gt;{ hashed=`md5sum &amp;#124; awk ' { print $1 } '` ; }&amp;amp;lt;&amp;amp;lt;DONE&lt;br /&gt;$oneline&lt;br /&gt;DONE&lt;br /&gt;&lt;br /&gt;dmsetup create $mapname1 &amp;lt;&amp;lt;DONE&lt;br /&gt;0 `blockdev --getsize $partition` crypt aes-plain $hashed 0 $partition 0&lt;br /&gt;DONE&lt;br /&gt;dmsetup create $mapname2 &amp;lt;&amp;lt;ONE&lt;br /&gt;0 `blockdev --getsize $partition2` crypt aes-plain $hashed 0 $partition2 0&lt;br /&gt;DONE&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;What this script does is to prompt the user for a passphrase, without echoing it to the screen.  Once the passphrase is entered, it is converted to a 32 character hexadecimal string with the MD5 program.  I use a here document, marked with the &amp;lt;&amp;lt; characters, because that way the hexadecimal string does not appear in the process status list.  Simply using echo risks having the secret visible to any user who types  &lt;span style="font-weight: bold;"&gt;ps&lt;/span&gt; at the correct moment.  Then, the &lt;span style="font-weight: bold;"&gt;dmsetup&lt;/span&gt; program creates the cryptographic mapping, using the hex sequence as the cryptographic key.&lt;br /&gt;&lt;br /&gt;You will have to change the values of the $partition and $partition2 variables to correspond to those on your system.  Note that volume labels are unavailable, because the system can't read the label off a cryptographic partition before the passphrase has been supplied.&lt;br /&gt;&lt;br /&gt;Run this script, entering the passphrase.  It's important that you do this through the script, and not manually at the command line, because later you'll modify the script to mount your cryptographic partitions, and you want to ensure that exactly the same code read your passphrase when you created the partitions as will read your passphrase when you try to mount the partitions after a reboot some time in the future.&lt;br /&gt;&lt;br /&gt;When the script exits, you will have two new objects appearing in the /dev/mapper directory.  In this case, they are /dev/mapper/Crypto1 and /dev/mapper/Crypto2.  So, in this example, /dev/sda6 is the encrypted volume, and /dev/mapper/Crypto1 is the decrypted version of the same volume.  You do all of your work on /dev/mapper/Crypto1.  You format and mount that device, never /dev/sda6.&lt;br /&gt;&lt;br /&gt;This command will create an ext3 filesystem with 0 bytes reserved for the superuser.&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;/sbin/mke2fs -j -m 0 /dev/mapper/Crypto1&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Now, you can mount /dev/mapper/Crypto1 onto a mount point, and start copying files there as usual.  Until you remove the cryptographic mapping, the data is available as a normal mounted partition.  So, we now append some code to the script above to allow the partitions to be mounted by the root user after a reboot.  Take the script above and add the following lines to the bottom:&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;/sbin/e2fsck -y /dev/mapper/$mapname1 &amp;#124;&amp;#124; \&lt;br /&gt;        { dmsetup remove $mapname1 ; echo &amp;quot;&amp;quot; ; echo &amp;quot;fsck failed&amp;quot;; exit 1; }&lt;br /&gt;&lt;br /&gt;/sbin/e2fsck -y /dev/mapper/$mapname2 &amp;#124;&amp;#124; \&lt;br /&gt;        { dmsetup remove $mapname1; dmsetup remove $mapname2 ;\&lt;br /&gt;             echo &amp;quot;&amp;quot; ; echo &amp;quot;fsck failed&amp;quot;; exit 1; }&lt;br /&gt;&lt;br /&gt;mount -onodiratime /dev/mapper/$mapname1 $mtpt1 &amp;#124;&amp;#124; \&lt;br /&gt;        { dmsetup remove $mapname1 ; dmsetup remove $mapname2 ; \&lt;br /&gt;            echo &amp;quot;&amp;quot; ; echo &amp;quot;Failed&amp;quot; ; exit 1 ; }&lt;br /&gt;&lt;br /&gt;mount -onodiratime /dev/mapper/$mapname1 $mtpt2 &amp;#124;&amp;#124; \&lt;br /&gt;        { umount $mtpt ; \&lt;br /&gt;            dmsetup remove $mapname1 ; dmsetup remove $mapname2 ; \&lt;br /&gt;            echo &amp;quot;&amp;quot; ; echo &amp;quot;Failed&amp;quot; ; exit 1 ; }&lt;br /&gt;echo &amp;quot;&amp;quot;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;This runs fsck on the partitions, if necessary (remember, fstab can't fsck these partitions because it doesn't know the passphrase).  Note that if you entered the wrong passphrase, you'll find out at this point, when e2fsck fails to identify the partition as being an ext2 or ext3 partition.&lt;br /&gt;&lt;br /&gt;It then manually mounts the cryptographic partitions onto the mountpoints in $mtpt1 and $mtpt2.  In the event of a mount failure, it unmounts everything and removes the cryptographic mappings.&lt;br /&gt;&lt;br /&gt;The next time the computer is rebooted, the root user will have to run this script and enter the correct passphrase before the data on those drives is readable.  If somebody else obtains your laptop, any mounted cryptographic partitions will be unavailable if the computer is rebooted, or the drive removed from the laptop and inserted into another machine.&lt;br /&gt;&lt;br /&gt;This is only half the story.  In a later post I'll describe the care you have to take to make sure your sensitive data does not wind up as readable plaintext somewhere on your filesystem.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3279819592335911399-5165007214856247251?l=distrofreelinuxuser.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://distrofreelinuxuser.blogspot.com/feeds/5165007214856247251/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3279819592335911399&amp;postID=5165007214856247251' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/5165007214856247251'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/5165007214856247251'/><link rel='alternate' type='text/html' href='http://distrofreelinuxuser.blogspot.com/2008/02/cryptographic-mounts.html' title='Cryptographic mounts'/><author><name>Winter Toad</name><uri>http://www.blogger.com/profile/05606540195506310406</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-3279819592335911399.post-1209540889690451580</id><published>2008-02-17T19:29:00.005-05:00</published><updated>2008-02-19T22:53:40.931-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='hardware'/><category scheme='http://www.blogger.com/atom/ns#' term='backups'/><title type='text'>Why do I have so many hard drives?</title><content type='html'>There are five hard drives in my main computer.  There is no RAID setup.  Why?&lt;br /&gt;&lt;br /&gt;Hard drives fail.  I've had the drive holding my root partition fail more than once.  When that happens, I used to restore from backup.  I would make a backup tape at least once a week, but a badly timed disk failure could still result in the loss of a lot of work.&lt;br /&gt;&lt;br /&gt;My solution to this has been to buy my hard drives in matched pairs.  I partition them equally, format them the same way, and install them both in the computer.  One of them is the live disk, the other is the spare.  The spare is kept unmounted and spun down.  Every night around 3:00 AM, a cron job spins up the spares drives.  Then, one partition at a time is fsck-ed, mounted, and copied to.  The shell script uses &lt;span style="font-weight: bold;"&gt;rdist&lt;/span&gt; to synchronize the contents of the two partitions.  Finally, I take special care to make the backup drive bootable.  I use the LILO boot loader, so, when the root partition is mounted under /mnt/backup, the script executes the command:&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;/sbin/lilo -r /mnt/backup -b /dev/sdc&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;which, on my system, writes the LILO boot magic to the backup boot drive, which appears as /dev/sdc when it is the spare in my system.  My lilo.conf file, on both the live system and the spare, refer to the boot drive as being /dev/sda, but this '-b' switch overrides that, so that the information is written to the boot block of the current /dev/sdc, but is written so that is appropriate for booting the device at /dev/sda (which it will appear to be should my live boot drive fail and be removed from the system).&lt;br /&gt;&lt;br /&gt;Next, I use volume labels to mount my partitions.  You can't have duplicate labels in the system, so my spare drive has labels with the suffix "_bak" applied.  That means that the /etc/fstab file suitable for the live drive would not work if the spare were booted with that fstab.  To solve this problem, the copying script runs this command after it finishes copying the files in /etc:&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;sed -e 's&amp;#124;LABEL=\([^ \t]*\)\([ \t]\)&amp;#124;LABEL=\1_bak\2&amp;#124;' /etc/fstab &amp;gt; /mnt/backup/etc/fstab&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;which has the effect of renaming the labels in the fstab to their versions with the _bak suffix, so they match the volume partitions on the spare hard drive.&lt;br /&gt;&lt;br /&gt;OK, that sounds like a lot of work, why do I do it?  What does it buy me?&lt;br /&gt;&lt;br /&gt;First of all, it gives me automatic backups.  Every night, every file is backed up.  When I go to the computer at the beginning of the day, the spare drive holds a copy of the filesystem as it appeared when I went to sleep the night before.  Now, if I do something really unwise, deleting a pile of important files, or similarly mess up the filesystem, I have a backup that I haven't deleted.  If I were to use RAID, deleting a file would delete it immediately from my backup, which isn't what I want.  As long as I realize there's a problem before the end of the evening, I can always recover the machine to the way it looked before I started changing things in the morning.  If I don't have enough time to verify that the things I've done are OK, I turn off the backup for a night by editing the script.&lt;br /&gt;&lt;br /&gt;Another important thing it allows me to do is to test really risky operations.  For instance, replacing glibc on a live box can be tricky.  In recent years, the process has been improved to the point that it's not really scary to type "make install" on a live system, but ten years ago that would almost certainly have confused the dynamic linker enough that you would be forced to go to rescue floppies.  Now, though, I can test it safely.  I prepare for the risky operation, and then before doing it, I run the backup script.  When that completes, I mount the complete spare filesystem under a mountpoint, /mnt/chroot.  I chroot into that directory, and I am now running in the spare.  I can try the unsafe operation, installing a new glibc, or a new bash, or something else critical to the operation of the Linux box.  If things go badly wrong, I type "exit", and I'm back in the boot drive, with a mounted image of the damage in /mnt/chroot.  I can investigate that filesystem, figure out what went wrong and how to fix it, and avoid the problem when the time comes to do the operation "for real".  Then, I unmount the partitions under /mnt/chroot and re-run my backup script, and everything on the spare drive is restored.  Think of it as a sort of semi-virtual machine for investigating dangerous filesystem operations.&lt;br /&gt;&lt;br /&gt;The other thing this gives me is a live filesystem on a spare drive.  When my hard drive fails (not "if", "when", your hard drive &lt;span style="font-style: italic;"&gt;will&lt;/span&gt; fail one day), it's a simple matter of removing the bad hardware from the box, re-jumpering the spare if necessary, and then rebooting the box.  I have had my computer up and running again in less than ten minutes, having lost, at most, the things I did earlier in the same day.  While you get this benefit with RAID, the other advantages listed above are not easily available with RAID.&lt;br /&gt;&lt;br /&gt;Of course, this is fine, but it's not enough for proper safety.  The entire computer could catch fire, destroying all of my hard drives at once.  I still make periodic backups to writable DVDs.  I use &lt;span style="font-weight: bold;"&gt;afio&lt;/span&gt; for my backups, asking it to break the archive into chunks a bit larger than 4 GB, then burn them onto DVDs formatted with the ext2 filesystem (you don't have to use a UDF filesystem on a DVD, ext2 works just fine, and it's certain to be available when you're using any rescue and recovery disk).  Once I've written the DVDs, I put them in an envelope, mark it with the date, and give it to relatives to hang onto, as off-site backups.&lt;br /&gt;&lt;br /&gt;So, one pair of drives is for my /home partition, one pair for the other partitions on my system.  Why do I have 5 drives?  Well, the fifth one isn't backed up.  It holds large data sets related to my work.  These are files I can get back by carrying them home from the office on my laptop, so I don't have a backup for this drive.  Occasionally I put things on that drive that I don't want to risk losing, and in that case I have a script that copies the appropriate directories to one of my backed-up partitions, but everything else on that drive is expendable.&lt;br /&gt;&lt;br /&gt;There are two problems that can appear with large files.&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;rdist&lt;/span&gt; doesn't handle files larger than 2 GB.  I looked through the source code to see if I could fix that shortcoming, and got a bit worried about the code.  So I'm working on writing my own replacement for &lt;span style="font-weight: bold;"&gt;rdist&lt;/span&gt; with the features I want.  In the mean time, I rarely have files that large, and when I do, they don't change often, so I've been copying the files to the backup manually.&lt;/li&gt;&lt;li&gt;Sometimes root's shells, even those spawned by cron, have ulimit settings.  If you're not careful, you'll find that cron jobs cannot create a file in excess of some maximum size, often 1 GB.  This is an inconvenient restriction, and one that I have removed on my system.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3279819592335911399-1209540889690451580?l=distrofreelinuxuser.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://distrofreelinuxuser.blogspot.com/feeds/1209540889690451580/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3279819592335911399&amp;postID=1209540889690451580' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/1209540889690451580'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/1209540889690451580'/><link rel='alternate' type='text/html' href='http://distrofreelinuxuser.blogspot.com/2008/02/why-do-i-have-so-many-hard-drives.html' title='Why do I have so many hard drives?'/><author><name>Winter Toad</name><uri>http://www.blogger.com/profile/05606540195506310406</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-3279819592335911399.post-5632926317973654528</id><published>2008-02-17T19:03:00.004-05:00</published><updated>2008-02-17T19:27:38.026-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='breaking packages'/><category scheme='http://www.blogger.com/atom/ns#' term='history'/><title type='text'>Breaking packages</title><content type='html'>I've used the term "breaking packages" a few times.  As I said, I maintain my Linux boxes without a package manager.  So, how did I get these Linux boxes?&lt;br /&gt;&lt;br /&gt;My main Linux computer has over half a million files in its filesystem, and over 3000 separate executables.  Where did they all come from?  You need some way to start out, your computer isn't going to do much without a kernel, a shell, and a compiler.&lt;br /&gt;&lt;br /&gt;In 1994, I installed Slackware on a 486-based computer.  This computer had about 180 MB of hard drive space  (nowadays that wouldn't even hold half of the kernel source tree) and 16 MB of RAM.  At that time, Slackware didn't really have a package manager.  It had packages, just compressed tar files of compiled binaries, grouped by function.  If you weren't interested in networking, you didn't download the networking file.  If you weren't interested in LaTeX, you didn't download that file.  There were only a few dozen "packages", because of this very coarse granularity.  The functions like "upgrade", "install", "find package owning file" weren't present.  An upgrade was the same as an install, just install the new package into the filesystem, and it would probably replace the old package.  To find out which package provided a certain file, you could look in per-package lists of files.&lt;br /&gt;&lt;br /&gt;So, I never really had a package manager on that system.  When I needed new programs, I downloaded the source code, compiled it, and installed it.  When I moved to a new system, I brought backup images or a live hard drive to the new computer.  I didn't start with a blank hard drive, I started with the hard drive from the old computer I was replacing.  Over the years, I have replaced every executable that was installed in 1994 (I know this is the case because all of the files installed then were a.out format, and I have only ELF binaries on my computer now).&lt;br /&gt;&lt;br /&gt;Sometimes, though, I've started with a computer that had a distribution installed on it.  At a previous job, my laptop came with Mandrake Linux installed on it.  I tried to keep the distribution alive for a while, but eventually got impatient with the package management system and broke the packages.&lt;br /&gt;&lt;br /&gt;So, if you give me a new Linux computer and tell me it's mine to modify, a good first step for me is to kill the package manager.  On an RPM-based system, that's generally achieved by recursively deleting the directory /var/lib/rpm.  After that, the &lt;span style="font-weight: bold;"&gt;rpm&lt;/span&gt; command will stop working, and I have the finer control and more difficult task of managing the box myself.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3279819592335911399-5632926317973654528?l=distrofreelinuxuser.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://distrofreelinuxuser.blogspot.com/feeds/5632926317973654528/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3279819592335911399&amp;postID=5632926317973654528' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/5632926317973654528'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/5632926317973654528'/><link rel='alternate' type='text/html' href='http://distrofreelinuxuser.blogspot.com/2008/02/breaking-packages.html' title='Breaking packages'/><author><name>Winter Toad</name><uri>http://www.blogger.com/profile/05606540195506310406</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-3279819592335911399.post-1333834400639549288</id><published>2008-02-17T16:08:00.004-05:00</published><updated>2008-02-19T22:55:14.648-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='security'/><category scheme='http://www.blogger.com/atom/ns#' term='one size fits all'/><category scheme='http://www.blogger.com/atom/ns#' term='login failure'/><category scheme='http://www.blogger.com/atom/ns#' term='audit'/><title type='text'>What do we have running on that box?</title><content type='html'>As I mentioned in my &lt;a href="http://distrofreelinuxuser.blogspot.com/2008/02/why-not-use-distribution-and-package.html"&gt;first post&lt;/a&gt;, when you install a distribution you sometimes have programs running without your knowledge.  Because some users may need these features, you often get them as well.&lt;br /&gt;&lt;br /&gt;Last week at the office, somebody came up to me to ask if I could figure out why it was no longer possible to log into one of the servers.  This server has a history of flakiness, there's probably a bad memory module on the board, and sometimes it becomes unresponsive.  So, my co-worker, upon realizing that he couldn't log in, had rebooted the computer.  However, even after the reboot, he still couldn't log on, either as his regular user through SSH, or as root on the console.&lt;br /&gt;&lt;br /&gt;The first step, before getting out of my chair, was to telnet to port 22 on the box.  I got a "connected" message, and a text string indicating that I was attached to an SSH daemon.  This told me that the kernel was alive, it was accepting new connections and passing them to the appropriate processes, which were themselves able to make forward progress.  So, the box wasn't wedged.  I went to the console, and tried to log in through the getty running on the text login screen.  I entered 'root' at the username, and got a password prompt.  When I entered the password and pressed ENTER, the getty process froze, and did not present me with a shell.&lt;br /&gt;&lt;br /&gt;So, we have two very different authentication schemes that are failing to allow logins.  The console doesn't allow root logins.  Something seemed to be interfering with the general activity of authentication.  The first thought is that this might be a PAM problem, but it would be a strange one.  We didn't get authentication failure messages, we got a hang after authentication.  Root's credentials were stored on the local drive, so it wasn't an LDAP issue, and in any case, the machine was on the network, and there weren't LDAP problems anywhere else in the office.&lt;br /&gt;&lt;br /&gt;When multiple independent programs fail together, the next thought is that there's probably a full disk somewhere.  If you fill up /tmp your system can start to behave very strangely.  The login problems were a symptom of something, as yet unknown.  So, the next thing to do is to check the hard drive to see if we had any full partitions.  Because I didn't know what else might be misbehaving, I wanted to avoid all of the startup jobs, so I rebooted the machine with an appended kernel parameter, "&lt;span style="font-weight: bold;"&gt;init=/bin/bash&lt;/span&gt;".  Instead of running the usual /sbin/init, and all of the various scripts under /etc/init.d, the computer would start up the kernel and then drop immediately to a root shell.  No logins, no passwords, no startup scripts.  I could then run '&lt;span style="font-weight: bold;"&gt;df&lt;/span&gt;' at the prompt, and confirm that there were no partitions within 5% of full (remember that a default ext2 format will reserve 5% of the blocks for root, so a disk that's 96% full could actually be entirely full for some users).  Checking with '&lt;span style="font-weight: bold;"&gt;df -i&lt;/span&gt;' showed that we had not run out of inodes either.&lt;br /&gt;&lt;br /&gt;So, what's next?  I decided to reboot the machine into single-user mode so that I could easily modify files on the disk but still get onto the computer without a password.  This is done by appending the parameter "S" on the kernel boot line.  Again, I get a shell, but this time the disks are read-write mounted, and various services have started up.  So, I modify the inittab.  I replaced the getty on tty1 with /bin/bash.  That means that when the computer is rebooted into multi-user mode, tty1 has a root shell while the other ttys are still running their gettys.&lt;br /&gt;&lt;br /&gt;Reboot into the usual multi-user mode.  I have a root shell on tty1.  I run "&lt;span style="font-weight: bold;"&gt;ps ax&lt;/span&gt;", and find the PID of the getty on tty2.  Then, I run the command &lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;strace -f -p &amp;lt;PID&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;at the shell prompt of tty1.  Changing virtual consoles to tty2 with the usual command, CTRL-ALT-F2, I am presented with a login prompt.  I enter the username 'root', and enter the password.  The program hangs.  So, I change back to tty1 to see what strace has to say about the program.  The last things the program did are on the screen.  It opened a device called /dev/audit, did some things with it, then issued an ioctl() on the file descriptor.  That ioctl was not returning to the caller, so the program was blocking waiting for a response from something associated with /dev/audit.&lt;br /&gt;&lt;br /&gt;None of us had heard of /dev/audit, so it was time to do a bit of research.  It turned out to be a package that was included in the RHEL distribution installed on that computer.  There is communication between the device and a daemon.  That daemon keeps logs, so I went to its logging directory to see what was there.  I found 4 GB of data there.  Apparently that had reached some sort of internal limit, and the daemon responded by forbidding further auditable actions until some of the logs were removed by the administrator.  Logins, being auditable actions, were blocked.&lt;br /&gt;&lt;br /&gt;So, delete all of the logs in the directory, and reboot the computer.  Everything returned to normal.&lt;br /&gt;&lt;br /&gt;Now, a logging function like this is very useful for some users.  There are some people who must know exactly who logged into the machine, what database entries they accessed or modified, and so on.  We are not such people. A service we never knew about, enabled for all because it is useful by some, wound up locking us out of our own machine.&lt;br /&gt;&lt;br /&gt;It's a security feature that logins are forbidden until the logs have been inspected and removed.  If you're going to design a function like this, then this is the correct way to go about it.  Of course, it was very easy for me to overcome this security feature with access to the console, but that's generally true.  I probably would have set it up so that gettys are permitted to log in as root even when an audit failure occurs, but that level of flexibility may not be available, if the behaviour is driven by a special PAM module or a patched glibc.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3279819592335911399-1333834400639549288?l=distrofreelinuxuser.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://distrofreelinuxuser.blogspot.com/feeds/1333834400639549288/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3279819592335911399&amp;postID=1333834400639549288' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/1333834400639549288'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/1333834400639549288'/><link rel='alternate' type='text/html' href='http://distrofreelinuxuser.blogspot.com/2008/02/what-do-we-have-running-on-that-box.html' title='What do we have running on that box?'/><author><name>Winter Toad</name><uri>http://www.blogger.com/profile/05606540195506310406</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-3279819592335911399.post-4590998616987322552</id><published>2008-02-17T15:30:00.003-05:00</published><updated>2008-02-17T16:07:07.104-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mythtv'/><title type='text'>Breaking packages on the MythTV box</title><content type='html'>As I &lt;a href="http://distrofreelinuxuser.blogspot.com/2008/02/why-not-use-distribution-and-package.html"&gt;mentioned earlier&lt;/a&gt;, I have a &lt;a href="http://www.mythtv.org"&gt;MythTV&lt;/a&gt; computer, installed from packages, but I've broken some of the packages.  Here are some of the issues that I had with the packages, and how I solved them. &lt;br /&gt;&lt;br /&gt;Two of the package manager drawbacks I've mentioned previously appear here:  the one-size-fits-all approach to software packaging, and the failure to receive timely updates.&lt;br /&gt;&lt;br /&gt;The MythTV box is on old hardware.  Because it has hardware assistance for both MPEG encoding and decoding, I didn't need a new computer with a fast CPU.  The fact that this is old hardware, with a 7-year old BIOS, may be why I had problems, but I found it easier to break the packages than to try to solve the problems under the constraints of the package system.&lt;br /&gt;&lt;br /&gt;First, the MythTV box controls an infra-red LED attached to its serial port, allowing it to change the channels on a digital cable box.  This requires the use of the LIRC package, and the lirc_serial kernel module.  Well, at the time I set this up, the lirc_serial module was having problems with the SMP kernel.  The system would generate an oops quite regularly when it wanted to change channels.  Looking at the oops logs, I could see that there were problems specifically with SMP.  My MythTV box has only one CPU, so I didn't need an SMP kernel, but because some users will have SMP computers, the KnoppMyth distribution ships with an SMP kernel.  I tried to find a non-SMP kernel for the system, without success.  So, the easiest way to fix the problem was just to download a recent kernel source tree from kernel.org, copy the configuration file from the Knoppix kernel, and reconfigure it as non-SMP.  The spontaneous reboots stopped occurring.  The package manager still believes that it knows what kernel is running on the computer, but that isn't what is really installed.&lt;br /&gt;&lt;br /&gt;When I installed the MythTV box, the software was still a bit immature, and a stability fix in the form of version 0.20 came out several months later.  I waited a few weeks with no update to the distribution, and no word of when an update might become available.  Eventually, I grew impatient and downloaded the source code of 0.20 myself, recompiled it on the MythTV box, and installed it over top of the existing programs.&lt;br /&gt;&lt;br /&gt;There was one other impact of the one-size-fits-all approach that caused difficulties with the MythTV box.  I was regularly recording a television show between 6:00AM and 6:30AM.  A few minutes before the end of the show, the recording would have problems.  The audio would break up, and the video would jump.  It appeared that the program was losing frames of data, either because it was losing interrupts, or because it couldn't get the data to the disk quickly enough.  Because it happened at about the same time every day, I expected it was probably a cron job.  I got a root shell on the box, and asked for the list of all root-owned cron jobs with the command "crontab -l".  This reported that there were no root-owned cron jobs.  I mistrusted this result, and did more investigation.  As I mentioned in the &lt;a href="http://distrofreelinuxuser.blogspot.com/2008/02/why-not-use-distribution-and-package.html"&gt;first post&lt;/a&gt;, distribution packagers often break up a configuration file into a set of separate files.  They did that with cron jobs, which means that the command-line tool that ought to tell you all about root-owned cron jobs didn't report the full set of such processes.  A bit of digging around in /etc showed that the slocate database update was being run at that time.  This process scans the entire disk, making a list of the files on it.  While probably useful in a general context, this is an unnecessary operation on an appliance box that isn't changing, particularly when it results in so much bus traffic that the primary function of the box is degraded.  My solution was to change the /etc/crontab file (which is, itself, not viewed by "crontab -l") so that a cron job would be skipped if there were any users (reported by the 'fuser' command) of either of the two video input devices, /dev/video0 and /dev/video1.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3279819592335911399-4590998616987322552?l=distrofreelinuxuser.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://distrofreelinuxuser.blogspot.com/feeds/4590998616987322552/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3279819592335911399&amp;postID=4590998616987322552' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/4590998616987322552'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/4590998616987322552'/><link rel='alternate' type='text/html' href='http://distrofreelinuxuser.blogspot.com/2008/02/breaking-packages-on-mythtv-box.html' title='Breaking packages on the MythTV box'/><author><name>Winter Toad</name><uri>http://www.blogger.com/profile/05606540195506310406</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-3279819592335911399.post-2651235137197925646</id><published>2008-02-17T15:12:00.003-05:00</published><updated>2008-02-17T15:29:57.623-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='hardware'/><title type='text'>My hardware environment</title><content type='html'>I have two computers that I use for my work.  One is an x86 laptop, a ThinkPad T42 with a built-in ATI video controller (Mobility Radeon 9600).  The other is a quad-core x86_64 box with an NVidia card (GeForce 6600).  My work involves a lot of scientific computation, sometimes multi-threaded, and I need hardware-accelerated 3D rendering to analyze the results.  So, I'm running on two architectures, with two different video cards.&lt;br /&gt;&lt;br /&gt;The laptop is fairly standard, so I won't discuss it further.  My big box has the following hardware:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Intel DP35DP motherboard&lt;/li&gt;&lt;li&gt;Intel Core2 Quad CPU, Q6600, 2.4GHz per core&lt;br /&gt;&lt;/li&gt;&lt;li&gt;4 GB RAM&lt;/li&gt;&lt;li&gt;Two 160 GB SATA disks&lt;/li&gt;&lt;li&gt;One 500 GB SATA disk&lt;/li&gt;&lt;li&gt;Two 120 GB EIDE disks&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;I'll discuss later why I have so many hard drives.&lt;br /&gt;&lt;br /&gt;Because I sit next to this box all day, I've put a lot of effort into making it quiet.  My laptop makes more noise than the big box.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3279819592335911399-2651235137197925646?l=distrofreelinuxuser.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://distrofreelinuxuser.blogspot.com/feeds/2651235137197925646/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3279819592335911399&amp;postID=2651235137197925646' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/2651235137197925646'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/2651235137197925646'/><link rel='alternate' type='text/html' href='http://distrofreelinuxuser.blogspot.com/2008/02/my-hardware-environment.html' title='My hardware environment'/><author><name>Winter Toad</name><uri>http://www.blogger.com/profile/05606540195506310406</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-3279819592335911399.post-3431165282653850375</id><published>2008-02-17T13:53:00.006-05:00</published><updated>2008-02-17T19:16:13.219-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='introduction'/><category scheme='http://www.blogger.com/atom/ns#' term='rationale'/><title type='text'>Why not use a distribution and a package manager?</title><content type='html'>I have a few Linux computers, but they do not use a package manager.  They're not "redhat" computers, or "debian", or "ubuntu".  Once, 13 years ago, they were slackware.  Briefly.  I administer these boxes manually, for lack of a better adjective.&lt;br /&gt;&lt;br /&gt;Maintaining a Linux computer manually is a fair amount of work.  Installing new software is not always trivial, and sometimes things break in subtle ways that may take some effort to debug.  I plan to start recording my adventures here, in part so that I can come back and see what I did the next time I upgrade something and it misbehaves in a familiar manner.  Because I do things manually, I tend to run into problems that the majority of Linux users don't experience.  I often have to look on the web for answers to questions, so I hope my experiences can help out other people who, for whatever reason, come across one of these unusual problems.&lt;br /&gt;&lt;br /&gt;What do I have against distributions and package managers?  Nothing, really.  They are very useful.  I do have one computer that was installed from packages, a &lt;a href="http://www.mythtv.org/"&gt;MythTV&lt;/a&gt; computer that I installed from a &lt;a href="http://mysettopbox.tv/knoppmyth.html"&gt;KnoppMyth&lt;/a&gt; CD.  This is a good example of a place where package managers are useful.  The computer is an appliance that I set up once, and then don't ever modify.  It's not exposed to the Internet, and it isn't going to change much.  I don't need to install new software on it, because it's a dedicated single-purpose machine that already does what I want it to do.  And yet, I've "broken the packages" on the box.  There are files ostensibly under control of the knoppix package manager that I have replaced with recompiled binaries, and which I am maintaining myself now.  I'll talk about that in a later post.&lt;br /&gt;&lt;br /&gt;Here are some of the things that I think are good and useful about distributions and package managers (note that there are some exceptions to these rules, but most package managers supply at least some of these benefits):&lt;br /&gt;&lt;ul&gt;&lt;li&gt;They supply the entire filesystem in compiled form, allowing a new computer to be set up and running in under an hour with reasonable defaults, usually after asking just a handful of questions.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;They usually are associated with a good setup tool that can configure the software correctly for the hardware attached to your computer.&lt;/li&gt;&lt;li&gt;They have a good, general-purpose kernel with modules ready to handle many situations.&lt;/li&gt;&lt;li&gt;They keep track of dependencies to help to ensure that interdependent packages are correctly installed, so that the user doesn't end up with an installed package that fails to work correctly.&lt;/li&gt;&lt;li&gt;They provide a single location for access to updates and security fixes.  A user can simply ask the package manager to do an "update to latest packages", and expect that they have all of the updates provided by the distribution.&lt;/li&gt;&lt;li&gt;If you have a dozen new computers to set up, possibly even on different architectures, it's not a very big job with the correct installation media available.&lt;/li&gt;&lt;li&gt;Probably most importantly, distributions and package managers provide an easy way for people to administer their Linux computer without having to become Linux experts.  The computer is a tool used to perform other activities, and a distribution lets the person work with the tool, instead of spending a lot of time maintaining the tool.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;So, why don't I use package managers?  There are a few drawbacks to the use of package managers, and for me, they outweigh the benefits.  Other people will have different priorities.  I would never suggest to a newcomer to Linux that they should be going distribution-free.  A person who maintains a large collection of computers on dissimilar hardware might also be poorly served by breaking the distributions (though I have actually done exactly that).&lt;br /&gt;&lt;br /&gt;What don't I like about package managers and distributions?  Well, here's a collection of drawbacks:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;It isn't always clear what your computer is doing.  There may be packages or services installed that you don't want, doing things you don't understand.  Somewhere in the 200 packages that were installed when you set up the computer, you may have wound up with, say, an FTP daemon you didn't ask to have.  When you're installing software manually, you're more likely to install only the things you really need.&lt;/li&gt;&lt;li&gt;Distributions tend to ship with older code.  Distributors have to freeze their versions and do extensive testing, and by the time the packages are shipped there may have been improvements, bugfixes, or security fixes that didn't make it into the base media.&lt;/li&gt;&lt;li&gt;Bugfixes and security fixes can be delayed as you wait for the distributor to build updated packages.  While most Linux distributors get security fixes out within a small number of days, there is still some delay between the time a fix is produced and the time that updated packages are available.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Distributions are set up to be good for the general case, but there will be times when they do the wrong thing for a particular special use.&lt;/li&gt;&lt;li&gt;Package installers are generally forbidden from interacting with the user, otherwise a new install would be a tedious exercise in configuring every package as it came along.  Consequently, packages are usually dropped in with some default configuration.&lt;/li&gt;&lt;li&gt;Many programs come with multiple compile-time configuration options.  A media player may have support for multiple codecs, output devices, companion devices, and so on.  A distribution will usually turn on as many of these options as possible.  Some of these options might not be of interest to a specific user, but that user is still forced to install other packages holding libraries he or she doesn't expect to use.  These dependent libraries increase the interconnectedness of the packages, which can make what would be a simple upgrade of one package into a huge transaction that touches a dozen other packages and the kernel.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Because it's easier for a particular file to be owned by a specific package, even when that file controls the behaviour of multiple packages, distributions tend, when possible, to break up the file into fragments that are logically collated in some other place.  This can make it hard to figure out exactly what a specific application is doing.&lt;/li&gt;&lt;li&gt;Distributions and package manages don't insulate the user in all cases.  Some users with unusual requirements may still end up having to install software by hand, and figure out how to tie the new software into the system correctly, and sometimes the package management system makes such efforts more difficult.&lt;/li&gt;&lt;li&gt;Most importantly, for me, a package manager hides too much of what is happening.  You don't have to learn how to configure a program, you don't know what files it's installing, it's a bit too much of a black box for my tastes.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Given all this, I've decided that I prefer not to use package manager. Consequently, I've been manually modifying my Linux computers for over 13 years now.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3279819592335911399-3431165282653850375?l=distrofreelinuxuser.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://distrofreelinuxuser.blogspot.com/feeds/3431165282653850375/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3279819592335911399&amp;postID=3431165282653850375' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/3431165282653850375'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3279819592335911399/posts/default/3431165282653850375'/><link rel='alternate' type='text/html' href='http://distrofreelinuxuser.blogspot.com/2008/02/why-not-use-distribution-and-package.html' title='Why not use a distribution and a package manager?'/><author><name>Winter Toad</name><uri>http://www.blogger.com/profile/05606540195506310406</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></feed>
