<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Penguins-On-Hudson</title>
	<atom:link href="http://cdfx.penguins-on-hudson.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://cdfx.penguins-on-hudson.com</link>
	<description>Linux &#38; F.O.S.S. in the Hudson River Valley.</description>
	<lastBuildDate>Tue, 25 May 2010 18:49:33 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>3 Easy Steps to SSL Client Authentication</title>
		<link>http://cdfx.penguins-on-hudson.com/2010/05/19/3-easy-steps-to-ssl-client-authentication/</link>
		<comments>http://cdfx.penguins-on-hudson.com/2010/05/19/3-easy-steps-to-ssl-client-authentication/#comments</comments>
		<pubDate>Wed, 19 May 2010 21:29:28 +0000</pubDate>
		<dc:creator>garrison</dc:creator>
				<category><![CDATA[Case Study]]></category>
		<category><![CDATA[Command Line]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://cdfx.penguins-on-hudson.com/2010/05/19/3-easy-steps-to-ssl-client-authentication/</guid>
		<description><![CDATA[There are many resources on the Internet for correctly securing apache web sites with X.509 client certificate authentication. This isn&#8217;t one of them. What follows is a three step guide to the fastest, easiest method for setting up self-signed server and client certificates. You are advised not to run any of the commands below in [...]]]></description>
			<content:encoded><![CDATA[<p>There are many resources on the Internet for correctly securing <a href="http://www.apache.org/">apache</a> web sites with X.509 client certificate authentication. <strong>This isn&#8217;t one of them.</strong> What follows is a three step guide to the fastest, easiest method for setting up <a href="http://en.wikipedia.org/wiki/Self-signed_certificate">self-signed</a> server and client certificates. You are advised not to run any of the commands below in a <a href="http://www.google.com/search?q=define:production+environment">production environment</a>, they are presented only as an aid for those who learn <a title="Wikipedia Entry: Kinesthetic Learning" href="http://en.wikipedia.org/wiki/Kinesthetic_learning">kinesthetically</a>.</p>
<blockquote><p>A good solution applied with vigor now is better than a perfect solution applied ten minutes later.<br />
<span class="attr">- <a href="http://en.wikipedia.org/wiki/Patton">General George Smith Patton III</a> <em><a href="http://en.wikiquote.org/wiki/George_S._Patton">(source)</a></em></span></p></blockquote>
<p><span id="more-56"></span><br />
Most readers are probably familiar with <a href="http://en.wikipedia.org/wiki/X.509">X.509 certificates</a> as used with <a title="Transport Layer Security/Secure Sockets Layer" href="http://en.wikipedia.org/wiki/Transport_Layer_Security">TLS/SSL</a> to secure websites with strong encryption. For commercial websites, this usually means presenting a <a href="http://en.wikipedia.org/wiki/Digital_certificate">digital certificate</a> which has been verified and signed by a <a href="http://en.wikipedia.org/wiki/Certification_Authority">certificate authority</a> , once the secure connection is established, user credentials are passed, e.g. username/password; however, X.509 certificates may also be used on the client side to supplement or even eliminate the need for users to enter passwords.</p>
<p>Intranets and temporary web applications are two examples wherein developers may choose to forgo the use of a widely accepted certificate authority in favor of a self-signed certificate. Naturally, this is a compromise which may or not impinge overall security depending on factors which will not be considered here.Strictly considered, this text has little information on security at all, rather, it is simply outlines an expedient way to set up X.509 client certificate authentication.</p>
<p class="nstep">1. The Server Certificate</p>
<p>The following command will generate a self-signed web certificate and unencrypted key (no password required).</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">openssl req <span style="color: #660033;">-new</span> <span style="color: #660033;">-x509</span> <span style="color: #660033;">-nodes</span> <span style="color: #660033;">-out</span> server.crt <span style="color: #660033;">-keyout</span> server.key <span style="color: #660033;">-days</span> <span style="color: #000000;">1825</span> \
 <span style="color: #660033;">-subj</span> <span style="color: #ff0000;">&quot;/C=US/ST=NY/O=Example Inc/CN=example.com/emailAddress=info@example.com/&quot;</span></pre></div></div>

<p class="nstep">2. Configuring Apache</p>
<p>This example illustrates enabling SSL in the apache config, note that because this is a self signed certificate, the same file is used for the Certificate and CA Certificate. The <a href="http://httpd.apache.org/docs/2.0/mod/core.html#location">&lt;Location&gt; directive</a> specifies where client certificates will be required; visit the Apache site for <a href="http://httpd.apache.org/docs/2.0/ssl/ssl_howto.html">additional relevant directives</a>.</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;">&lt;<span style="color: #000000; font-weight:bold;">VirtualHost</span> 192.168.1.1:<span style="color: #ff0000;">443</span>&gt;
  <span style="color: #00007f;">DocumentRoot</span> /var/www/<span style="color: #00007f;">example</span>.com
  <span style="color: #00007f;">ServerName</span> <span style="color: #00007f;">example</span>.com
  <span style="color: #00007f;">ServerAlias</span> *.<span style="color: #00007f;">example</span>.com
&nbsp;
  SSLEngine <span style="color: #0000ff;">on</span>
  SSLCertificateFile conf/ssl/<span style="color: #00007f;">example</span>.crt
  SSLCertificateKeyFile conf/ssl/<span style="color: #00007f;">example</span>.key
  SSLCACertificateFile conf/ssl/<span style="color: #00007f;">example</span>.crt
&nbsp;
  &lt;<span style="color: #000000; font-weight:bold;">Location</span> /clients&gt;
    SSLRequireSSL
    SSLVerifyClient <span style="color: #00007f;">require</span>
    SSLVerifyDepth <span style="color: #ff0000;">10</span>
  &lt;/<span style="color: #000000; font-weight:bold;">Location</span>&gt;
&lt;/<span style="color: #000000; font-weight:bold;">VirtualHost</span>&gt;</pre></div></div>

<p class="nstep">3. Client Certificates</p>
<p>The server certificate is used to generate a client certificate using the <a title="PKCS#12" href="http://en.wikipedia.org/wiki/PKCS12">PKCS#12</a> standard</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">openssl pkcs12 <span style="color: #660033;">-export</span> <span style="color: #660033;">-out</span> example.pfx <span style="color: #660033;">-in</span> example.crt <span style="color: #660033;">-inkey</span> example.key \
<span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;Example Client Certificate&quot;</span></pre></div></div>

<p>If a password was entered during the previous command, users will need to enter the same password when installing the certificate. Firefox users can import <span class="code">example.pfx</span> by navigating through:</p>
<p class="nowrap-small" style="text-align: center;">Prefs ⇨ Encryption ⇨ View Certs ⇨ Your Certs ⇨ Import</p>
<p>Upon visiting <span style="color: #688aad;">https://example.com/clients</span> users will be prompted to present the client certificate.</p>
]]></content:encoded>
			<wfw:commentRss>http://cdfx.penguins-on-hudson.com/2010/05/19/3-easy-steps-to-ssl-client-authentication/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Practical View of Comcast vs FCC</title>
		<link>http://cdfx.penguins-on-hudson.com/2010/04/06/a-practical-view-of-comcast-vs-fcc/</link>
		<comments>http://cdfx.penguins-on-hudson.com/2010/04/06/a-practical-view-of-comcast-vs-fcc/#comments</comments>
		<pubDate>Tue, 06 Apr 2010 23:35:09 +0000</pubDate>
		<dc:creator>garrison</dc:creator>
				<category><![CDATA[Legal Issues]]></category>
		<category><![CDATA[Networks]]></category>
		<category><![CDATA[News & Events]]></category>
		<category><![CDATA[Telephony]]></category>

		<guid isPermaLink="false">http://cdfx.penguins-on-hudson.com/2010/04/06/a-practical-view-of-comcast-vs-fcc/</guid>
		<description><![CDATA[One thing to note about the United States Court of Appeals for the District of Columbia Circuit  decision in Comcast vs. F.C.C.&#8211; it doesn&#8217;t restrict the F.C.C.&#8217;s ability to regulate Internet services; rather, the court ruled that the broad regulatory powers  enjoyed by the F.C.C. were overstepped when they told Comcast  to [...]]]></description>
			<content:encoded><![CDATA[<p>One thing to note about the <a href="http://www.cadc.uscourts.gov/">United States Court of Appeals for the District of Columbia Circuit</a>  decision in <a href="http://pacer.cadc.uscourts.gov/common/opinions/201004/08-1291-1238302.pdf" title="Comcast vs. F.C.C.">Comcast vs. F.C.C.</a>&#8211; it doesn&#8217;t restrict the <a href="http://en.wikipedia.org/wiki/FCC">F.C.C.</a>&#8217;s ability to regulate Internet services; rather, the court ruled that the <a href="http://en.wikipedia.org/wiki/FCC#Communications_Act_of_1934">broad regulatory powers</a>  enjoyed by the <a href="http://en.wikipedia.org/wiki/FCC">F.C.C.</a> were overstepped when they told <a href="http://en.wikipedia.org/wiki/Comcast#Controversies">Comcast</a>  to stop discriminating against <a href="http://en.wikipedia.org/wiki/BitTorrent_%28protocol%29">BitTorrent traffic</a> . Many individuals dismiss this as a &#8220;bad decision&#8221; of the court, but to do so ignores important issues relevant to this ruling.</p>
<p>I generally favor &#8216;net neutrality, and I certainly don&#8217;t take a kindly view of the arbitrary packet discrimination employed by unscrupulous companies; left unchecked, such practices easily (perhaps inevitably) lead to &#8220;<a href="http://www.scribd.com/doc/938752/Against-FeeBased-and-other-Pernicious-Net-Prejudice-An-Explanation-and-Examination-of-the-Net-Neutrality-Debate">the pseudo service scenario of bribery &#8230; extortion</a>&#8220;, but the same slippery slope analogy could slide the other way. Had the appellate court ruled in favor of the <a href="http://en.wikipedia.org/wiki/FCC">F.C.C.</a> it would have set a precedent for allowing a regulatory authority to essentially invent new powers not specifically delegated to it by any act of Congress. If you would prefer that Congress pass such a law, you may wish to ask your representatives to support <a href="http://www.opencongress.org/bill/111-h3458/show">H.R. 3458</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://cdfx.penguins-on-hudson.com/2010/04/06/a-practical-view-of-comcast-vs-fcc/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Automount USB drives on Ubuntu servers.</title>
		<link>http://cdfx.penguins-on-hudson.com/2010/01/20/automount-removable-devices-on-ubuntu-servers/</link>
		<comments>http://cdfx.penguins-on-hudson.com/2010/01/20/automount-removable-devices-on-ubuntu-servers/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 01:27:19 +0000</pubDate>
		<dc:creator>garrison</dc:creator>
				<category><![CDATA[Case Study]]></category>
		<category><![CDATA[Command Line]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://cdfx.penguins-on-hudson.com/2010/01/20/automount-removable-devices-on-ubuntu-servers/</guid>
		<description><![CDATA[In most cases, Ubuntu desktop systems will automatically detect and mount removable media, and this is largely done with software that is part of the X Windows system; for server systems without X Windows however, this sort of thing requires a bit of work.
Now some may ask, &#8220;Why automount removable media at all?&#8221; It is [...]]]></description>
			<content:encoded><![CDATA[<p>In most cases, Ubuntu desktop systems will automatically detect and mount removable media, and this is largely done with software that is part of the X Windows system; for server systems without X Windows however, this sort of thing requires a bit of work.</p>
<p>Now some may ask, &#8220;Why automount removable media at all?&#8221; It is unwise to remove an active device, such as unplugging a USB drive without first unmounting it, and automounting may encourage this sort of recklessness. I don&#8217;t contend this, but if one runs a server using an external USB drive, there are two words which should spark an immediate interest in automatic mounts: <strong>power failure</strong>.<br />
<span id="more-54"></span></p>
<p>To manually mount an external USB drive, a user might enter a command such as: <span class="code">mount /dev/sdd1 /mnt/usbdrive</span>. Naturally this assumes that sdd1 is the correct device node, and that&#8217;s the thing about mounting things like USB drives&#8211; there is no guarantee which device node it will use.</p>
<p>Fortunately UDEV, which is what handles all those devices in the /dev directory, has a rules syntax to control how those device nodes are named and what happens next. I&#8217;ll explain briefly how to automount a USB drive, but readers looking for detailed information about UDEV rules should consult <a href="http://www.reactivated.net/writing_udev_rules.html">Writing udev rules</a> by Daniel Drake as well as the udev man page (<span class="code">man udev</span>).</p>
<p>Start by plugging in the device you want to mount, for these examples I have used a USB thumbdrive.  Run <span class="code">dmesg</span> and look for something like:</p>

<div class="wp_syntax"><div class="code"><pre class="io" style="font-family:monospace;"><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">6388458.851691</span><span style="color: #66cc66;">&#93;</span>  sdb: sdb1
<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">6388458.852594</span><span style="color: #66cc66;">&#93;</span> sd <span style="color: #cc66cc;">15</span>:<span style="color: #cc66cc;">0</span>:<span style="color: #cc66cc;">0</span>:<span style="color: #cc66cc;">0</span>: <span style="color: #66cc66;">&#91;</span>sdb<span style="color: #66cc66;">&#93;</span> Attached SCSI removable disk
<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">6388458.852635</span><span style="color: #66cc66;">&#93;</span> sd <span style="color: #cc66cc;">15</span>:<span style="color: #cc66cc;">0</span>:<span style="color: #cc66cc;">0</span>:<span style="color: #cc66cc;">0</span>: Attached scsi generic sg2 <span style="color: #000000; font-weight: bold;">type</span> <span style="color: #cc66cc;">0</span></pre></div></div>

<p>This tells me that the assigned device node is <span class="code">/dev/sdb1</span>. To find out more about that device, run: <span class="code">udevinfo -a -p /sys/block/sdb</span> and look for a single block of text that has a useful attribute&#8211; a single rule may only match elements from a single block. In the example below, I&#8217;ve highlighted two lines I can use in my rule:</p>
<p><code>looking at parent device '/devices/pci0000:00/0000:00:02.1/usb2/2-5/2-5.1':<br />
KERNELS=="2-5.1"<br />
<strong>SUBSYSTEMS=="usb"</strong><br />
DRIVERS=="usb"<br />
ATTRS{dev}=="189:152"<br />
<em> ... lots more ATTRS ... </em><br />
ATTRS{manufacturer}=="Prolific Technology Inc."<br />
<strong>  ATTRS{product}=="USB Mass Storage Device"</strong><br />
</code></p>
<p>I now have four bits of information I can use to write a useful rule:</p>
<ul>
<li>The device node will be similar to <em>/dev/sdb1</em>, which I can match with <em>sd?1</em></li>
<li>SUBSYSTEMS==&#8221;usb&#8221;</li>
<li>ATTRS{product}==&#8221;USB Mass Storage Device&#8221;</li>
<li>I want to run <span class="code">/bin/mount</span> and mount the device at <span class="code">/mnt/usb</span></li>
</ul>
<p>After looking up the correct syntax in the man page, I wrote my rule like so:</p>

<div class="wp_syntax"><div class="code"><pre class="io" style="font-family:monospace;">KERNEL==<span style="color: #ff0000;">&quot;sd?1&quot;</span>, SUBSYSTEMS==<span style="color: #ff0000;">&quot;usb&quot;</span>, ATTRS<span style="color: #66cc66;">&#123;</span>product<span style="color: #66cc66;">&#125;</span>==<span style="color: #ff0000;">&quot;USB Mass Storage Device&quot;</span>,
↪ RUN+=<span style="color: #ff0000;">&quot;/bin/mount /dev/%k /mnt/usb&quot;</span></pre></div></div>

<p>This I saved in a file at <span class="code">/etc/udev/rules.d/10-codefix.rules</span>. The rule should be picked up automatically, but one can always run <span class="code">sudo udevcontrol reload_rules</span> or <span class="code">sudo /etc/init.d/udev reload</span>.</p>
<p>With the device attached, this rule can be tested with <span class="code">udevtest /sys/block/sdb/sdb1 usb</span>. If the rule is correct, the output of udevtest will include the mount command.</p>
]]></content:encoded>
			<wfw:commentRss>http://cdfx.penguins-on-hudson.com/2010/01/20/automount-removable-devices-on-ubuntu-servers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Diagnosing Sound Problems in Ubuntu Linux</title>
		<link>http://cdfx.penguins-on-hudson.com/2010/01/02/diagnosing-sound-problems-in-ubuntu-linux/</link>
		<comments>http://cdfx.penguins-on-hudson.com/2010/01/02/diagnosing-sound-problems-in-ubuntu-linux/#comments</comments>
		<pubDate>Sat, 02 Jan 2010 19:05:30 +0000</pubDate>
		<dc:creator>garrison</dc:creator>
				<category><![CDATA[Case Study]]></category>
		<category><![CDATA[Command Line]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://cdfx.penguins-on-hudson.com/2010/01/02/diagnosing-sound-problems-in-ubuntu-linux/</guid>
		<description><![CDATA[Sound problems fall in to three basic categories, and the first thing you want to do is determine which one you&#8217;re dealing with. The easiest thing you can do is test your speakers with something else, using the same cable. If your speakers and cable are confirmed to be in good working order, then the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://cdfx.penguins-on-hudson.com/wp-content/uploads/2010/01/hardinfo.png" class="lightview" rel="gallery[52]" title="Hardware Information"><a href="http://cdfx.penguins-on-hudson.com/wp-content/uploads/2010/01/hardinfo.png"><img class="alignright size-thumbnail wp-image-53" title="Hardware Information" src="http://cdfx.penguins-on-hudson.com/wp-content/uploads/2010/01/hardinfo.thumbnail.png" alt="" width="128" height="99" /></a></a>Sound problems fall in to three basic categories, and the first thing you want to do is determine which one you&#8217;re dealing with. The easiest thing you can do is test your speakers with something else, using the same cable. If your speakers and cable are confirmed to be in good working order, then the problem must be either:<span id="more-52"></span></p>
<p><strong>1. Defective hardware.</strong></p>
<p>If there is a working volume control in <em>Applications  Sound &amp; Video &#8680; Volume Control</em> or <em>Applications &#8680; Sound &amp; Video &#8680; AlsamixerGui</em>, or on the desktop toolbar, then defective hardware is less likely. On new installations, the case may be simply that the Master or PCM channel is muted. If no sound card is detected these controls should be &#8220;grayed out&#8221; and unusable. If the volume controls are missing or disabled (i.e. you cannot move the slider control), you can confirm the diagnosis by following the instructions in the next section, then take the machine back to the shop that sold it to you or seek assistance from a professional.</p>
<p><strong>2. Incorrectly detected hardware.</strong></p>
<p>Whether or not volume controls work, it is worthwhile to check whether and what devices have been detected by Linux.  Most Linux distributions should have the command line tool <span class="code">lspci</span> or <span class="code">lshw</span> available, however <span class="code">hardinfo</span> provides a nice graphic interface &amp; report generation. Ubuntu users can install it via the package manager or at the command line with: <code>sudo aptitude install hardinfo</code></p>
<p>The menu icon should appear in <em>Applications &#8680; System Tools &#8680; System Profiler &amp; Benchmark</em> but may also be launched with at a command line: <code>sudo hardinfo</code></p>
<p>In any case, the audio device will be listed under PCI devices. The reported device should be compared with the actual installed hardware to determine if it was correctly detected. If no audio device is listed, then this is a clear indication of missing or defective hardware.</p>
<p><strong>3. Application Issues</strong></p>
<p>If the hardware appears to be correctly identified and in good working order, the Master and PCM channels are enabled and volumes are set sufficiently high, speakers are plugged in and their volume is also turned up, and you are still unable to produce any sound in any application, professional assistance is probably in order. Those who are brave, foolish, lucky, or eager to learn can poke around online for reports of similar issues, in particular, users of Ubuntu Karmic (or any derived distributions) should check <a href="https://wiki.ubuntu.com/DebuggingSoundProblems/KarmicCaveats">Ubuntu&#8217;s Karmic Caveats</a> as well as the <a href="http://ubuntuforums.org/forumdisplay.php?f=334">Ubuntu Multimedia &amp; Video Forums</a> as many users have reported issues related to the <a title="Pulse Audio" href="https://wiki.ubuntu.com/PulseAudio">Pulse Audio</a> sound server.</p>
<p>If you&#8217;re still stuck after all the above, your best bet is to seek out your local <a title="USA Linux Groups" href="http://www.linux.org/groups/usa/">Linux User&#8217;s Group</a> where you are sure to find someone willing to help.</p>
]]></content:encoded>
			<wfw:commentRss>http://cdfx.penguins-on-hudson.com/2010/01/02/diagnosing-sound-problems-in-ubuntu-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SSH Coolness &#8230; even on Windows.</title>
		<link>http://cdfx.penguins-on-hudson.com/2009/12/26/ssh-coolness-even-on-windows/</link>
		<comments>http://cdfx.penguins-on-hudson.com/2009/12/26/ssh-coolness-even-on-windows/#comments</comments>
		<pubDate>Sat, 26 Dec 2009 07:21:56 +0000</pubDate>
		<dc:creator>garrison</dc:creator>
				<category><![CDATA[Case Study]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://cdfx.penguins-on-hudson.com/2009/12/26/ssh-coolness-even-on-windows/</guid>
		<description><![CDATA[prerequisite concepts: prelude, basic config., port fwd, proxy conn.

I don&#8217;t often have the opportunity to experiment on computers running Windows, but every  once in a long while it simply cannot be avoided. I recently found myself wanting to look up a password in Revelation, a password manager for the Gnome Desktop on Linux; I [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: right"><em>prerequisite concepts: <a href="http://blog.penguins-on-hudson.com/2008/09/25/openssh-prelude/">prelude</a>, <a href="http://blog.penguins-on-hudson.com/2008/09/26/openssh-basic-configuration/">basic config.</a>, <a href="http://blog.penguins-on-hudson.com/2008/10/16/open-ssh-port-forwarding/">port fwd</a>, <a href="http://blog.penguins-on-hudson.com/2008/10/17/openssh-proxy-connections/">proxy conn.</a><br />
</em></p>
<p>I don&#8217;t often have the opportunity to experiment on computers running Windows, but every <a href="http://openssh.org"><img src="http://codefix.files.wordpress.com/2008/10/puffy-armed.png" title="puffy-armed" class="alignright size-full wp-image-154" align="right" height="170" width="200" /></a> once in a long while it simply cannot be avoided. I recently found myself wanting to look up a password in <a href="http://oss.codepoet.no/revelation/">Revelation</a>, a password manager for the Gnome Desktop on Linux; I have previously written about using <a href="http://cdfx.penguins-on-hudson.com/?p=47" title="OpenSSH: Proxy Connections">OpenSSH&#8217;s ProxyCommand</a>  directive to tunnel through a firewall and <a href="http://cdfx.penguins-on-hudson.com/?p=46" title="Open SSH: Port Forwarding">forward X11 (GUI) applications</a>  remotely from a an isolated workstation on a private LAN, the difference here was that I needed to forward that application to a Windows workstation.</p>
<p><span id="more-51"></span>I haven&#8217;t used Windows enough to do this sort of thing for about ten years, so it took a bit of fiddling, but I eventually worked out the following methodology. Like the <a href="http://cdfx.penguins-on-hudson.com/?p=41" title="OpenSSH Prelude: Requisite Knowledge">other posts in this series</a>, it is assumed that the reader is familiar with the basics, specifically the use of <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/" title="PuTTY: a free telnet/ssh client">PuTTY</a> and Pageant to log in to Linux hosts using ssh keys; a windows installer is available to install all needed utilites, but the only others used in this experiment were PuTTYgen (to generate an SSH key) and plink which I simply tossed in the Windows directory so I wouldn&#8217;t need a full path in the local proxy command (below). Some additional software is needed to run X Windows applications on Windows, and in this case I used <a href="http://www.straightrunning.com/XmingNotes/" title="Xming - PC X Server">Xming</a>. I had never used Xming before, and may never need it again, but I was impressed that it was as easy as point, click, run&#8211; as long as it&#8217;s running in the background, it will do what&#8217;s needed. All the configuration is done in PuTTY.</p>
<p><strong>Session Settings</strong><br />
A proxy connection has only a few specific settings, <a href="http://cdfx.penguins-on-hudson.com/wp-content/uploads/2009/12/putty_session.png" class="lightview" rel="gallery[51]" title="PuTTY: Session Settings"><img src="http://cdfx.penguins-on-hudson.com/wp-content/uploads/2009/12/putty_session.thumbnail.png" alt="PuTTY: Session Settings" align="right" height="124" width="128" /></a> all others can be left at default values or the user&#8217;s preference; this screen shot is only included to emphasize that the Session Host is the box on the private LAN running the application we want, not the proxy host which has the public Internet connection we will be using.</p>
<p><strong>Proxy Settings</strong><br />
The proxy hostname is the box <a href="http://cdfx.penguins-on-hudson.com/wp-content/uploads/2009/12/putty_proxy.png" class="lightview" rel="gallery[51]" title="PuTTY: Proxy Settings"><img src="http://cdfx.penguins-on-hudson.com/wp-content/uploads/2009/12/putty_proxy.thumbnail.png" alt="PuTTY: Proxy Settings" align="right" height="124" width="128" /></a> with the public connection;  it will use the local proxy command to connect our SSH client to the session host specified on the previous screen. Note that SSH will only use the Auto-login username (Connection=&gt;Data=&gt;Login Details) with the session host, which is why I have specified a username here.</p>
<p><strong>X11 Forwarding</strong><br />
There is nothing complicated about the <a href="http://cdfx.penguins-on-hudson.com/wp-content/uploads/2009/12/putty_x11.png" class="lightview" rel="gallery[51]" title="PuTTY: X11 Forwarding Settings"><img src="http://cdfx.penguins-on-hudson.com/wp-content/uploads/2009/12/putty_x11.thumbnail.png" alt="PuTTY: X11 Forwarding Settings" align="right" height="124" width="128" /></a> X forwarding settings, this must be enabled in PuTTy, as well as on the remote Linux box, and on the proxy. In my case, the proxy was an Ubuntu server not running X Windows, so I first had to install xauth (sudo aptitude install xauth).</p>
<input id="gwProxy" type="hidden" /><!--Session data--><br />
<input onclick="jsCall();" id="jsProxy" type="hidden" />
<input id="gwProxy" type="hidden" /><!--Session data--><br />
<input onclick="jsCall();" id="jsProxy" type="hidden" />
<input id="gwProxy" type="hidden" /><!--Session data--></p>
<input onclick="jsCall();" id="jsProxy" type="hidden" />
<input id="gwProxy" type="hidden" /><!--Session data--><br />
<input onclick="jsCall();" id="jsProxy" type="hidden" />
<input id="gwProxy" type="hidden" /><!--Session data--><br />
<input onclick="jsCall();" id="jsProxy" type="hidden" />
<input id="gwProxy" type="hidden" /><!--Session data--></p>
<input onclick="jsCall();" id="jsProxy" type="hidden" />
<input id="gwProxy" type="hidden" /><!--Session data--><br />
<input onclick="jsCall();" id="jsProxy" type="hidden" />
<input id="gwProxy" type="hidden" /><!--Session data--></p>
<input onclick="jsCall();" id="jsProxy" type="hidden" />
<input id="gwProxy" type="hidden" /><!--Session data--><br />
<input onclick="jsCall();" id="jsProxy" type="hidden" />
<input id="gwProxy" type="hidden" /><!--Session data--></p>
<input onclick="jsCall();" id="jsProxy" type="hidden" />
<input id="gwProxy" type="hidden" /><!--Session data--><br />
<input onclick="jsCall();" id="jsProxy" type="hidden" />
<input id="gwProxy" type="hidden" /><!--Session data--></p>
<input onclick="jsCall();" id="jsProxy" type="hidden" />
<input id="gwProxy" type="hidden" /><!--Session data--><br />
<input onclick="jsCall();" id="jsProxy" type="hidden" />
<input id="gwProxy" type="hidden" /><!--Session data--></p>
<input onclick="jsCall();" id="jsProxy" type="hidden" />
<input id="gwProxy" type="hidden" /><!--Session data--><br />
<input onclick="jsCall();" id="jsProxy" type="hidden" />
<input id="gwProxy" type="hidden" /><!--Session data--></p>
<input onclick="jsCall();" id="jsProxy" type="hidden" />
<input id="gwProxy" type="hidden" /><!--Session data--><br />
<input onclick="jsCall();" id="jsProxy" type="hidden" />
<input id="gwProxy" type="hidden" /><!--Session data--></p>
<input onclick="jsCall();" id="jsProxy" type="hidden" />
]]></content:encoded>
			<wfw:commentRss>http://cdfx.penguins-on-hudson.com/2009/12/26/ssh-coolness-even-on-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenSSH: Environmental Override</title>
		<link>http://cdfx.penguins-on-hudson.com/2008/11/01/openssh-environmental-override/</link>
		<comments>http://cdfx.penguins-on-hudson.com/2008/11/01/openssh-environmental-override/#comments</comments>
		<pubDate>Sat, 01 Nov 2008 21:45:07 +0000</pubDate>
		<dc:creator>garrison</dc:creator>
				<category><![CDATA[Case Study]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[17]]></category>

		<guid isPermaLink="false">http://cdfx.penguins-on-hudson.com/?p=9</guid>
		<description><![CDATA[prerequisite concepts: prelude, basic configuration
This post is as much about customizing the root shell as it is about SSH environment variables, but I&#8217;m adding this to my OpenSSH collection because it&#8217;s applicable to  any user.
I occasionally work on servers where, for a variety of reasons, I share an account with one or more other [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: right"><em>prerequisite concepts: <a href="http://blog.penguins-on-hudson.com/2008/09/25/openssh-prelude/">prelude</a>, <a href="http://blog.penguins-on-hudson.com/2008/09/26/openssh-basic-configuration/">basic configuration</a></em></p>
<p>This post is as much about customizing the root shell as it is about SSH environment variables, but I&#8217;m adding this to my <a href="http://blog.penguins-on-hudson.com/2008/09/25/openssh-prelude/">OpenSSH collection</a> because it&#8217;s applicable to <a href="http://openssh.org"><img src="http://codefix.files.wordpress.com/2008/10/puffy-armed.png" title="puffy-armed" class="alignright size-full wp-image-154" align="right" width="200" height="170" /></a> any user.</p>
<p>I occasionally work on servers where, for a variety of reasons, I share an account with one or more other users; this is almost always suboptimal, but it does happen nonetheless. Over time I&#8217;ve grown somewhat partial to <a href="http://www.zsh.org">zShell</a>, so one method I&#8217;ve used is to log in to a default shell, usually bash, then run <span class="code">zsh</span>.<span id="more-9"></span></p>
<p>Even on server&#8217;s where I am the sole administrator, I usually don&#8217;t change the default shell&#8211; not so much because of days gone by when doing such a thing would break boot scripts &amp; such, but because I try to practice the good habit of logging in as a normal user and using sudo for escalated privileges.</p>
<p>Eventually I struck upon the idea to have some code in the shell init script (e.g. $HOME/.bash_profile) switch to the shell of my choosing automatically as I log in. What I came up with looks something like this:</p>
<pre>if [ -n "$CDFX_SHELL" ]; then

    tty -s &amp;&amp; exec $CDFX_SHELL

fi</pre>
<p>Briefly this code says, &#8220;if $CDFX_SHELL isn&#8217;t empty and the tty program says we&#8217;re connected to a terminal (on STDIN), then replace this shell by running the command in $CDFX_SHELL without creating a new process.&#8221;</p>
<p>Readers familiar with shell initialization may recognize potentially unnecessary checks in this example but this avoids having to delve into the differences between shell sessions which are <em>interactive</em>, <em>login</em>, both, or neither, as well as how this relates to scp and rsync. Also noteworthy are the checks which should be in the code before it&#8217;s used on a production server, such as verifying that $CDFX_SHELL specifies a valid shell. This isn&#8217;t intended to be cut-n-paste code.</p>
<p>Two steps are necessary for this to work: obviously $CDFX_SHELL must be set in the local environment for SSH to have anything to pass to the server, but less obviously the server must be configured to allow this variable to be set. This can be configured in the sshd config file (e.g. /etc/ssh/sshd_config) by adding this line:</p>
<p><code>AcceptEnv CDFX_SHELL</code></p>
<p>I prefer this method over those which require enabling PermitUserEnvironment because it&#8217;s less prone to unintended side-effects, as noted in the man page. In addition to (or in lieu of) using exec to switch shells, this method could also be used to set custom environments in the same shell, for different users or the same user, anytime it&#8217;s useful to have login behavior change based upon variables set in the SSH client.</p>
]]></content:encoded>
			<wfw:commentRss>http://cdfx.penguins-on-hudson.com/2008/11/01/openssh-environmental-override/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenSSH: Proxy Connections</title>
		<link>http://cdfx.penguins-on-hudson.com/2008/10/17/openssh-proxy-connections/</link>
		<comments>http://cdfx.penguins-on-hudson.com/2008/10/17/openssh-proxy-connections/#comments</comments>
		<pubDate>Fri, 17 Oct 2008 15:00:38 +0000</pubDate>
		<dc:creator>garrison</dc:creator>
				<category><![CDATA[Command Line]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[17]]></category>

		<guid isPermaLink="false">http://cdfx.penguins-on-hudson.com/?p=47</guid>
		<description><![CDATA[prerequisite concepts: prelude, basic configuration, port forwarding
Network address translation (NAT) is a very common method of providing secure access to hosts on a private network.  Given the limited amount of IPv4 addresses, computer networks with relatively few, very few, and even a single public IP address are common. A typical small business customer of [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: right"><em>prerequisite concepts: <a href="http://blog.penguins-on-hudson.com/2008/09/25/openssh-prelude/">prelude</a>, <a href="http://blog.penguins-on-hudson.com/2008/09/26/openssh-basic-configuration/">basic configuration</a>, <a href="http://blog.penguins-on-hudson.com/2008/10/16/open-ssh-port-forwarding/">port forwarding</a></em></p>
<p><a href="http://en.wikipedia.org/wiki/Network_address_translation">Network address translation</a> (NAT) is a very common method of providing secure access to hosts on a <a href="http://en.wikipedia.org/wiki/Private_network">private network</a>. <a href="http://openssh.org"><img src="http://codefix.files.wordpress.com/2008/10/puffy-armed.png" title="puffy-armed" class="alignright size-full wp-image-154" align="right" width="200" height="170" /></a> Given the limited amount of <a href="http://en.wikipedia.org/wiki/IP_address_starvation">IPv4 addresses</a>, computer networks with relatively few, very few, and even a single public IP address are common. A typical small business customer of my <a href="http://codefix.net">consulting practice</a> has one or more Linux servers on an office network protected by a firewall. The following is a close look at Example Industries, the theoretical owners of example.com; this customer receives support for two Linux servers, a mail server and a PBX, but only one public IP address between them. Through NAT, public services (namely mail and VoIP) on both servers are accessible via example.com. This works well for inbound mail and phone calls, which only need to access one or the other host, but SSH access is the lifeblood of remote system administration, and there&#8217;s the rub&#8211; when I enter <span class="code">ssh example.com</span> I land at the mail server. SSH access to the PBX would seemingly threaten to litter my command line with unsightly extra characters, if not subsequent commands outright.<br />
<span class="highlight"><br />
My carpals are tunneled enough, I don&#8217;t want to type more than <span class="code">ssh mail</span> and <span class="code">ssh pbx</span> to access these servers, and while I&#8217;m at it I want to have scripted log-ins as well&#8211; securely, not those namby-pamby no-password keys. In fact, I don&#8217;t even want to have private keys on either server.</span><br />
<span class="highlight"><br />
Fear not! With the power of OpenSSH, I can fix this.<br />
</span><span id="more-47"></span><br />
Recipes for SSH proxies are like homespun cure-alls: few do much good and some are actually harmful. As indicated in my introductory rant, I have a few criteria for this sort of thing:</p>
<ul>
<li>No interactive passwords.</li>
<li>No password-less keys.</li>
<li>No private keys on servers.</li>
<li>Avoid command line options.</li>
<li>Demur scripts.</li>
</ul>
<p>Previous installments in this series have intentionally focused on declarations which will help define my Example Industries SSH client configuration; here&#8217;s the file so far:</p>

<div class="wp_syntax"><div class="code"><pre class="io" style="font-family:monospace;"><span style="color: #808080; font-style: italic;"># /home/garrison/.ssh/config</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># Global Options</span>
<span style="color: #000066;">Host</span> <span style="color: #66cc66;">*</span>
ForwardAgent yes
&nbsp;
<span style="color: #000066;">Host</span> mail
HostName example.com
&nbsp;
<span style="color: #000066;">Host</span> pbx
HostName example.com
LocalForward <span style="color: #cc66cc;">8080</span> localhost:<span style="color: #cc66cc;">80</span>
LocalForward <span style="color: #cc66cc;">3306</span> localhost:<span style="color: #cc66cc;">3306</span></pre></div></div>

<p>At this point <span class="code">ssh mail</span> and <span class="code">ssh pbx</span> are functionally equivalent in that both land me on the mail server, and I want forwarded access to <span class="code">pbx</span>&#8217;s web configuration and database but I end up with webmail and mail user database (which I can access without port forwarding). While I can certainly connect to <span class="code">pbx</span> once I&#8217;m in <span class="code">mail</span>, I must specify it&#8217;s internal address (<span class="code">ssh 192.168.1.20</span>) and the services I require will not be forwarded to my workstation. What I need is a way to tell SSH to bypass <span class="code">mail</span> and connect me directly to <span class="code">pbx</span>.</p>
<p>Rubbish. In life, particularly in technology, we often confound our challenges by mischaracterizing the requirements of a solution as I just have. It is no coincidence that my most successful customers are also the ones who make use of my ability to solve problems, rather than simply implementing solutions. Often the most challenging part of a solution is correctly stating the problem. What I really need is just for <span class="code">ssh pbx</span> to connect me to <span class="code">pbx</span> and forward my ports; I don&#8217;t really care whether <span class="code">mail</span> is bypassed or not, so long as it stays out of my way.</p>
<p>As it turns out, the solution I favor does not bypass the gateway host (<span class="code">mail</span>) at all, but uses it as a proxy for my connection to <span class="code">pbx</span>. With the addition of a <span class="code">ProxyCommand</span> directive to my SSH config, I can achieve all my objectives.</p>
<p>The <span class="code">ProxyCommand</span> directive is a subtle beast, and my early attempts to use it were unsuccessful. At the time I was doing something similar on the command line: <span class="code">ssh -t example.com ssh 192.168.1.20</span> Because I initially hoped to &#8220;do the same thing in the config file&#8221; I mistakenly assumed that <span class="code">ProxyCommand</span> would allow my to connect to mail and immediately fire off a connection to pbx; <span class="code">LocalCommand</span> behaves this way but doesn&#8217;t allow me to accomplish what I can with <span class="code">ProxyCommand</span>.<br />
After a few unsuccessful syntax variations, I began to suspect that I might have the wrong idea about this directive.</p>
<p>When I eventually sorted out the correct syntax, I knew I had the wrong notion because I had no clue why one version worked and the others did not. Richard Silverman, one of the authors of the <a href="http://www.snailbook.com/">snail book</a> was kind enough to set me straight. He explained:</p>
<blockquote><p>ProxyCommand specifies a program which the SSH client will use to contact the remote SSH server.  Instead of opening a TCP connection, it runs this program and uses its stdin/stdout as the communications channel.</p></blockquote>
<p>I then understood that with <span class="code">ProxyCommand</span> in play, SSH expects the command it executes to provide the TCP connection between <span class="code">mail</span> and <span class="code">pbx</span>; <a href="http://en.wikipedia.org/wiki/Netcat">netcat</a>, a phenomenally <a href="http://sectools.org/tools2000.html">useful tool</a>, was designed for just this sort of task:</p>
<p><code>ProxyCommand ssh example.com nc -v %h %p</code></p>
<p>Adding this directive to the <span class="code">Host pbx</span> section of my config gets the whole proxy business out of my way and I can connect with just <span class="code">ssh pbx</span>; tho forwarded HTTP and MySQL connections are just the beginning. I can use scp, sftp, FuseSSH, sshfs or anything built on SSH just as if <span class="code">pbx</span> had a public IP. One more example:</p>
<p><code>rsync -Hav pbx:/usr/stuff backup:/archive</code></p>
<p>I often use such a command to transfer data from a machine with no public IP address to a backup server which also has no public IP and lives on another private network in a different town, state, or country. This is all done with <span class="code">ProxyCommand</span> directives, over secure SSH connections, and most importantly, with no special command line syntax. What could be easier?</p>
]]></content:encoded>
			<wfw:commentRss>http://cdfx.penguins-on-hudson.com/2008/10/17/openssh-proxy-connections/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Open SSH: Port Forwarding</title>
		<link>http://cdfx.penguins-on-hudson.com/2008/10/16/open-ssh-port-forwarding/</link>
		<comments>http://cdfx.penguins-on-hudson.com/2008/10/16/open-ssh-port-forwarding/#comments</comments>
		<pubDate>Thu, 16 Oct 2008 20:59:46 +0000</pubDate>
		<dc:creator>garrison</dc:creator>
				<category><![CDATA[Command Line]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[17]]></category>

		<guid isPermaLink="false">http://cdfx.penguins-on-hudson.com/?p=46</guid>
		<description><![CDATA[prerequisite concepts: prelude, basic configuration
Port forwarding  is a versatile feature which informs several popular concepts, including X Forwarding and tunneling which are briefly explained below; more advanced port magic will be addressed elsewhere.
X Forwarding
At the end of the previous installment of this series is an example SSH client configuration file, usually located at ~/.ssh/conf; [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: right"><em>prerequisite concepts: <a href="http://blog.penguins-on-hudson.com/2008/09/25/openssh-prelude/">prelude</a>, <a href="http://blog.penguins-on-hudson.com/2008/09/26/openssh-basic-configuration/">basic configuration</a></em></p>
<p><a href="http://en.wikipedia.org/wiki/Port_forwarding">Port forwarding</a> <a href="http://codefix.files.wordpress.com/2008/10/puffy-armed.png" class="lightview" rel="gallery[46]" title="puffy-armed"><img src="http://codefix.files.wordpress.com/2008/10/puffy-armed.png" class="alignright size-full wp-image-154" title="puffy-armed" align="right" width="200" height="170" /></a> is a versatile feature which informs several popular concepts, including X Forwarding and tunneling which are briefly explained below; more advanced port magic will be addressed elsewhere.</p>
<p><strong>X Forwarding</strong><br />
At the end of the <a href="http://blog.penguins-on-hudson.com/2008/09/26/openssh-basic-configuration/">previous installment</a> of this series is an example SSH client configuration file, usually located at <span class="code">~/.ssh/conf</span>; a more complete description of the global declarations shown was deferred until this section, where they are more relevant.<span id="more-46"></span><br />
<code># global declarations<br />
</code>This line is a comment and while it is ignored by SSH, it is very helpful to use comments and white space to maximize readability, and maintainability.<br />
<code>Host *</code>As <a href="http://blog.penguins-on-hudson.com/2008/09/26/openssh-basic-configuration/">previously stated</a>, Host declarations define the context of all following lines until the next Host declaration. Because the &#8216;*&#8217; will match any host, these declarations will be applied to all hosts&#8211; unless overridden by a later declaration or a command line option.<br />
<code>ForwardAgent yes</code>The key agent allows a user to store one or more authenticated keys in memory, enabling dual key authentication; this is sometimes (incorrectly) referred to as passwordless authentication, but a password check is still required to load the key into the agent. Agent forwarding allows one not only to rely on keys instead of passwords to connect to a remote server, but to use the same agent to connect to a third host and so on as long as the keys are recognized and ForwardAgent is enabled on each host.<br />
<code>ForwardX11 yes</code>This declaration turns on port forwarding for <a href="http://en.wikipedia.org/wiki/X_windows">X Windows</a> authentication; briefly put, this allows an X session (i.e. the active GUI environment) on a Linux workstation to interact with X Windows on a remote host using an encrypted tunnel. The practical benefit is that programs on a remote host needing or allowing a graphic interface may use one provided by the client. The canonical example is that I run <span class="code">xclock</span> on a remote server and the clock appears on my screen.</p>
<p><strong>Tunneling</strong><br />
X forwarding may be fun, but port forwarding has many more practical uses. Suppose you need to connect to a web application on, perhaps FreePBX to configure a Linux PBX, but you cannot connect directly because port 80 is blocked&#8211; there are a few reasons why this might occur but port forwarding can work equally well in all likely scenarios.</p>
<p>If you log in to the remote host with <code>ssh -L 8080:localhost:80 joe.telco@pbx.example.com</code> SSH will create an encrypted tunnel between port 8080 on your workstation and port 80 on the server, ergo you can now get to the web app by pointing your browser to <a href="http://localhost:8080">http://localhost:8080</a>. Because the connection is tunneled through SSH, it works even if port 80 is restricted by IP address or an interceding router, firewall, or cable modem; because of SSH&#8217;s strong encryption, this technique also provides a secure connection to servers which do not offer SSL.</p>
<p>Many users mistakenly assume that the localhost in the preceding command is the one referenced in the subsequent URL; in fact, the given example is connecting (client) localhost:8080 to (server) localhost:80 and could be entered as:<br />
<code class="nowrap">ssh -L <span class="teal">localhost:8080</span>:<span class="purple">pbx.example.com:80</span> joe.telco@pb»</code><br />
The notable concept is that the latter <span class="purple">host:port</span> pair is evaluated on the remote host, meaning it&#8217;s a bit like saying:</p>
<p style="text-align: center">&#8220;<em>connect my</em> <span class="teal">self:8080</span> <em>to your</em> <span class="purple">self:80</span>&#8220;</p>
<p><code>ssh -L <span class="sky">localhost:8080</span>:localhost:80 joe.telco@pbx.exam»<br />
ssh -L <span class="sky">192.168.1.7:8080</span>:localhost:80 joe.telco@pbx.ex»<br />
ssh -L <span class="sky">*:8080</span>:localhost:80 joe.telco@pbx.example.com<br />
</code>The explicit use of localhost in the first of the preceding examples restricts listening port 8080 for local use only; in contrast, the second example binds the port to a specific network interface, and other users on the network may use the forwarded port at the specified IP address; the last example avails the port on all interfaces. If the bind address is not specified, the port is bound to the loopback address unless <span class="code">GatewayPorts</span> is enabled, wherein the wildcard address issued.</p>
<p>The config file is the place for complexity, and the following example specifies that connections to pbx.example.com should be made as user joe.telco, and forwarded HTTP and MySQL connections should be available on all interfaces using the specified ports.<br />
<code>Host pbx<br />
HostName pbx.example.com<br />
GatewayPorts yes<br />
User joe.telco<br />
LocalForward 8080 localhost:80<br />
LocalForward 3306 localhost:3306<br />
</code>As <a href="http://blog.penguins-on-hudson.com/2008/09/26/openssh-basic-configuration/">previously illustrated</a>, this simplifies the command line syntax such that in lieu of:<br />
<code>ssh -g -u joe.telco -L 8080:localhost:80 \<br />
-L 3306:localhost:3306 pbx.example.com</code>one need only enter:<br />
<code>ssh pbx</code>Much more information on the port forwarding capabilities of SSH are available in the <a href="http://en.wikipedia.org/wiki/Man_pages">man pages</a> as well as previously cited sources; however, the examples here lay the foundation for the next installment of this OpenSSH series: Proxy Connections.</p>
]]></content:encoded>
			<wfw:commentRss>http://cdfx.penguins-on-hudson.com/2008/10/16/open-ssh-port-forwarding/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>I have seen the light.</title>
		<link>http://cdfx.penguins-on-hudson.com/2008/10/04/i-have-seen-the-light/</link>
		<comments>http://cdfx.penguins-on-hudson.com/2008/10/04/i-have-seen-the-light/#comments</comments>
		<pubDate>Sat, 04 Oct 2008 20:29:10 +0000</pubDate>
		<dc:creator>garrison</dc:creator>
				<category><![CDATA[Case Study]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Reviews]]></category>
		<category><![CDATA[Telephony]]></category>

		<guid isPermaLink="false">http://cdfx.penguins-on-hudson.com/?p=44</guid>
		<description><![CDATA[Having discovered the advantages of á la carte VoIP pricing, I pondered how to extrapolate my experience for general discussion while avoiding the pitfalls of interpolation and abridgement. The Reference Book of Rates, Price Indices, and Household Expenditures for Telephone Service published by the FCC&#8217;s Wireline Competition Bureau provides a rough estimate of wireline telephone [...]]]></description>
			<content:encoded><![CDATA[<p>Having discovered the advantages of á la carte VoIP pricing, I pondered how to extrapolate my experience for general discussion while avoiding the pitfalls of interpolation and abridgement.<a href="http://codefix.files.wordpress.com/2008/10/voicemeup-invoice.png" class="lightview" rel="gallery[44]" title="voicemeup-invoice"><img class="alignright size-medium wp-image-147" title="voicemeup-invoice" src="http://codefix.files.wordpress.com/2008/10/voicemeup-invoice.png?w=300" alt="" width="210" height="145" align="right" /></a> The <a href="http://hraunfoss.fcc.gov/edocs_public/attachmatch/DOC-284934A1.pdf">Reference Book of Rates, Price Indices, and Household Expenditures for Telephone Service</a> published by the FCC&#8217;s <a href="http://www.fcc.gov/wcb/">Wireline Competition Bureau</a> provides a rough estimate of wireline telephone expenses averaging $45 per month in 2007, based on market research by TNS Telecoms. This isn&#8217;t too far from my own experience with residential VoIP plans which have tended to average about $35 monthly, including additional fees and charges, which can be significant: on BroadVoice&#8217;s &#8220;Unlimited World&#8221; plan, for example,  &#8220;Taxes &amp; Surcharges&#8221; account for about 35% of the monthly total. Based on these data, I use an estimated $35-$45 for generic comparison of monthly residential phone bills, or an average average of $40. As I designed our current, á la carte plan, I surmised that after discounting <a href="http://codefix.net/">business use</a>, the residential remainder was unlikely to ever exceed $30 in a single month. As the plan took shape, however, I realized that intelligent planning could lower that even further; somewhere in the neighborhood of a $20 monthly average would certainly exemplify what custom VoIP plans can offer, and half the average isn&#8217;t a bad talking point. <img src='http://cdfx.penguins-on-hudson.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> <span id="more-44"></span></p>
<p>Though less obvious, another great feature of á la carte or &#8220;on demand&#8221; plans is scalability, if I suddenly find myself needing to host frequent call-in conference calls between a customer, their overseas manufacturing division, regional sales reps, and myself, the only change I&#8217;ll see on my invoices will be in usage. I am not aware of any &#8220;unlimited&#8221; residential plans which offer unlimited channels (simultaneous callers). With currently just three phone numbers, my setup is small enough, and with just enough complexity to provide a good example.</p>
<p>I use one number for my consulting, which has separate extensions, voice mail, etc.; I have a fax number for the <a href="http://en.wikipedia.org/wiki/Luddite">luddite</a> crowd, and a home number associated with a family voice mail, options for the caller to forward the call to my wife&#8217;s or my mobile phone, and a ring group which includes a line in my office. I&#8217;ll use an even usage split for comparison; for although <a href="http://codefix.net/">Codefix Consulting</a> has its own phone number, those who know me well tend to call my home number rather than risk my having a life outside of work.</p>
<p>My primary VoIP provider is <a href="http://VoiceMeUp.com">VoiceMeUp.com</a> and I have two <a href="http://en.wikipedia.org/wiki/Direct_Inward_Dialing">DIDs</a> (phone numbers) ($4.95 ea) and a prepaid, on-demand plan which bills 30/6 at $0.0185/min. My backup provider is <a href="http://CallWithUs.org">CallWithUs.org</a> who bill $0.0125 in whole minutes; while I hadn&#8217;t originally intended to acquire a DID through CallWithUs.org, I found one for $6/mo which includes 3000 free inbound minutes and couldn&#8217;t pass it up. My base VoIP price is therefore 4.95 * 2 + 6 = $15.90 plus usage, or $7.95 on an even split. Theoretically this leaves me with just over 650 minutes before exceeding my $20 target, but this doesn&#8217;t account for incremental billing, free VoIP to VoIP calls, and other variables which impinge cost.</p>
<p>It&#8217;s now more than a month since I <a href="http://blog.penguins-on-hudson.com/2008/09/19/three-things-to-avoid-in-a-voip-provider/">dumped Broadvoice</a>, ergo September&#8217;s charges and complete usage data are available for a real world comparison against a $40 average, a $35 example, and a $20 target. As it turned out we made no outbound calls on the (secondary) CallWithUs.com trunk and didn&#8217;t exceed the 3000 inbound minutes, so all billable usage was on the VoiceMeUp.com trunk which makes accounting easier. September&#8217;s total was 9.95 + 6 + 23.38 = $39.28 or $19.64 per split which helps validate my &#8220;less than $20 phone bill&#8221; theory. Our total usage was 36h 7m 33s (2167.55 min) or nearly 1,100 &#8220;home&#8221; minutes and more than 2,000 unused inbound minutes&#8211; how much do you talk?</p>
]]></content:encoded>
			<wfw:commentRss>http://cdfx.penguins-on-hudson.com/2008/10/04/i-have-seen-the-light/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenSSH: Basic Configuration</title>
		<link>http://cdfx.penguins-on-hudson.com/2008/09/26/openssh-basic-configuration/</link>
		<comments>http://cdfx.penguins-on-hudson.com/2008/09/26/openssh-basic-configuration/#comments</comments>
		<pubDate>Fri, 26 Sep 2008 04:20:17 +0000</pubDate>
		<dc:creator>garrison</dc:creator>
				<category><![CDATA[Command Line]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[17]]></category>

		<guid isPermaLink="false">http://cdfx.penguins-on-hudson.com/?p=42</guid>
		<description><![CDATA[prerequisite concepts: prelude
If you&#8217;re not already using a config file (~/.ssh/config) you should peruse the documentation to see what it offers; an ongoing benefit I enjoy is that it allows me to accomplish more while typing less. Suppose, for example, you need to access two mail servers which are both behind a firewall and sharing [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: right"><em>prerequisite concepts: <a href="http://blog.penguins-on-hudson.com/2008/09/25/openssh-prelude/"><em>prelude</em></a></em></p>
<p>If you&#8217;re not already using a config file (<span class="code">~/.ssh/config</span>) you should peruse the documentation to see what it offers;<a href="http://www.openssh.com/"><img src="http://codefix.files.wordpress.com/2008/10/puffy-armed.png" title="Puffy, the OpenBSD/OpenSSH mascot." class="alignright size-full wp-image-154" align="right" width="200" height="170" /></a> an ongoing benefit I enjoy is that it allows me to accomplish more while typing less. Suppose, for example, you need to access two mail servers which are both behind a firewall and sharing a single public IP address. One server uses NAT (port forwarding) to provide user access via IMAP-SSL, POP3-SSL, and perhaps even webmail, all on default ports; similarly SSH can be accessed on port 22. The other server happens to be a mail relay, which handles all of the spam and virus scanning for inbound and outbound mail; while the SMTP, SMTPS, and submission services all enjoy a NAT configuration using default ports, SSH access is on port 23 because port 22 already forwards to the IMAP server and the sysadmin hasn&#8217;t read this series of articles.<br />
<span id="more-42"></span><br />
As an added bonus, your accounts have usernames which differ from each other (let&#8217;s use &#8220;fred&#8221; and &#8220;barney&#8221;) as well as from your workstation.  To log in to these machines using the command line, you  would type:</p>
<p><code>ssh fred@example.com<br />
ssh -p 23 barney@example.com</code></p>
<p>This isn&#8217;t a great deal of typing but already one can see that differentiating more complex connections may be confusing when distinguished only by the port used. We can clarify things a bit with a config file like this:</p>
<p><code>Host imap<br />
HostName example.com<br />
User fred<br />
Host smtp<br />
HostName example.com<br />
Port 23<br />
User barney</code></p>
<p>Now our SSH commands look nicer:</p>
<p><code>ssh imap<br />
ssh smtp</code></p>
<p>The config file can always be overridden with command line options, so ssh admin@smtp will log in as admin rather than barney, but will still use port 23 and any other options set in <span class="code">~/.ssh/config</span>. Once you start using <span class="code">LocalForward</span> and <span class="code">ProxyCommand</span> command line options quickly become tedious and unwieldy, even if you can remember all options for every host you attend.</p>
<p>One final note, in addition to acting as a convenient alias, the host keywords may also be used to make declarations for groups of servers, or all servers, by using wildcards and pattern-lists. The <a href="http://www.openbsd.org/cgi-bin/man.cgi?query=ssh_config"><span class="code">ssh_config</span> man page</a> (or your preferred documentation) has a detailed <a href="http://www.openbsd.org/cgi-bin/man.cgi?query=ssh_config#end"><span class="code">PATTERNS</span> section</a>, but a below is a brief example to whet your appetite:</p>
<pre><span class="comment"># global declarations</span>
  Host *
  ForwardAgent yes
  ForwardX11 yes

<span class="comment"># just for example.com servers</span>
  Host *.example.com
  ServerAliveInterval 60
  StrictHostKeyChecking no</pre>
]]></content:encoded>
			<wfw:commentRss>http://cdfx.penguins-on-hudson.com/2008/09/26/openssh-basic-configuration/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
