<?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>Cain Manor &#187; Work</title> <atom:link href="http://cainmanor.com/category/tech/work/feed/" rel="self" type="application/rss+xml" /><link>http://cainmanor.com</link> <description>Your Guide To All Things Cain™</description> <lastBuildDate>Thu, 27 Oct 2011 19:34:41 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>Push SSH public keys to multiple host</title><link>http://cainmanor.com/tech/push-ssh-public-keys-to-mulitple-host/</link> <comments>http://cainmanor.com/tech/push-ssh-public-keys-to-mulitple-host/#comments</comments> <pubDate>Tue, 02 Aug 2011 18:27:52 +0000</pubDate> <dc:creator>Greg Cain</dc:creator> <category><![CDATA[OS-X]]></category> <category><![CDATA[Tech]]></category> <category><![CDATA[UNIX]]></category> <category><![CDATA[Work]]></category><guid
isPermaLink="false">http://cainmanor.com/?p=1251</guid> <description><![CDATA[I’m starting a new job where I need to have my SSH keys pushed to hundreds of Red Hat servers. The special sauce is a command called ssh-copy-id. However, using this command requires you answering a (yes/no) question, then shortly &#8230; <a
href="http://cainmanor.com/tech/push-ssh-public-keys-to-mulitple-host/">Continue reading <span
class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>I’m starting a new job where I need to have my SSH keys pushed to hundreds of Red Hat servers. The special sauce is a command called ssh-copy-id.  However, using this command requires you answering a (yes/no) question, then shortly thereafter enter your password.  Painful. Here’s how push your keys without the pain.<br
/> <span
id="more-1251"></span><br
/> The first problem is having to answer (yes/no) for each server.  Normally you see this…</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;">The authenticity of host <span style="color: #ff0000;">'myfirsthost.work.cainmanor.com (10.256.33.106)'</span> can<span style="color: #ff0000;">'t be established.
RSA key fingerprint is fc:40:7c:de:b8:ac:a2:f5:d4:11:d0:0e:b2:77:8a:63.
Are you sure you want to continue connecting (yes/no)? yes</span></pre></div></div><p>To stop this prompt, we need to edit your ~/.ssh/config file.  Add these two lines</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;">StrictHostKeyChecking no
<span style="color: #007800;">UserKnownHostsFile</span>=<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null</pre></div></div><p>Setting your UserKnownHostsFile should only be a temporary fix.  After you’ve pushed your keys, you should comment out both of those settings.</p><p>Your password is the next problem.  We can solve that with sshpass.  sshpass takes your password and passes it on when ssh ask for it.  There are three ways to do it, all of them insecure.  Read the man page and decide which of those you want to use.  For my purposes I just put it on the command line — I’m on my personal machine with no other users, and only I know the passwords to the box.  Don’t do this on a shared server.</p><p>Here is an example of how to push your public key one.  Try it on a new server to make sure you get the results you expect.</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;">sshpass <span style="color: #660033;">-p</span> <span style="color: #ff0000;">'MY_PASSWORD'</span> ssh-copy-id gregc<span style="color: #000000; font-weight: bold;">@</span>new_host_with_no_keys</pre></div></div><p>Now that we’ve got the prompts turned off, we’ll wrap a script around this.  How you get the list of appropriate hostnames or IP’s is your business.</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">for</span> X <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">cat</span> my_host_that_need_keys<span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #000000; font-weight: bold;">do</span>
sshpass <span style="color: #660033;">-p</span> <span style="color: #ff0000;">'MY_PASSWORD'</span> ssh-copy-id gregc<span style="color: #000000; font-weight: bold;">@</span><span style="color: #800000;">${X}</span>
<span style="color: #000000; font-weight: bold;">done</span></pre></div></div><p>Happy Computing!!</p> ]]></content:encoded> <wfw:commentRss>http://cainmanor.com/tech/push-ssh-public-keys-to-mulitple-host/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>gpresult — Access Denied</title><link>http://cainmanor.com/tech/gpresult-access-denied/</link> <comments>http://cainmanor.com/tech/gpresult-access-denied/#comments</comments> <pubDate>Wed, 29 Apr 2009 06:18:58 +0000</pubDate> <dc:creator>Greg Cain</dc:creator> <category><![CDATA[Tech]]></category> <category><![CDATA[Windows]]></category> <category><![CDATA[Work]]></category><guid
isPermaLink="false">http://cainmanor.com/?p=569</guid> <description><![CDATA[While trying to make sure a GPO got applied on a Windows 2003 Server, I tried to run gpresult. I got “Access Denied.“ Microsoft’s recommendation did not work, but it’s probably worth trying again. CD %windir%\system32\wbem For /f %s in &#8230; <a
href="http://cainmanor.com/tech/gpresult-access-denied/">Continue reading <span
class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>While trying to make sure a GPO got applied on a Windows 2003 Server, I tried to run gpresult.  I got “Access Denied.“<br
/> <span
id="more-569"></span></p><p>Microsoft’s <a
href="http://support.microsoft.com/kb/932460">recommendation</a> did not work, but it’s probably worth trying again.</p><div
class="wp_syntax"><div
class="code"><pre class="dos" style="font-family:monospace;"><span style="color: #b1b100; font-weight: bold;">CD</span> <span style="color: #33cc33;">%</span><span style="color: #448888;">windir</span><span style="color: #33cc33;">%</span>\system32\wbem
<span style="color: #00b100; font-weight: bold;">For</span> /f <span style="color: #33cc33;">%</span><span style="color: #448888;">s</span> <span style="color: #00b100; font-weight: bold;">in</span> <span style="color: #33cc33;">(</span>'<span style="color: #b1b100; font-weight: bold;">dir</span> /b /s *.dll'<span style="color: #33cc33;">)</span> <span style="color: #00b100; font-weight: bold;">do</span> regsvr32 /s <span style="color: #33cc33;">%</span><span style="color: #448888;">s</span>
wmiprvse /regserver</pre></div></div><p>I found <a
href="http://x220.minasi.com/forum/topic.asp?TOPIC_ID=20825">THIS</a> worked.</p><div
class="wp_syntax"><div
class="code"><pre class="dos" style="font-family:monospace;"><span style="color: #b1b100; font-weight: bold;">cd</span> /d <span style="color: #33cc33;">%</span><span style="color: #448888;">windir</span><span style="color: #33cc33;">%</span>\system32
regsvr32 /n /I userenv.dll
<span style="color: #b1b100; font-weight: bold;">cd</span> wbem
mofcomp scersop.mof
gpupdate /force
gpresult</pre></div></div>]]></content:encoded> <wfw:commentRss>http://cainmanor.com/tech/gpresult-access-denied/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>SSH Public and Private Key setup on OS-X</title><link>http://cainmanor.com/tech/ssh-public-and-private-key-setup-on-os-x/</link> <comments>http://cainmanor.com/tech/ssh-public-and-private-key-setup-on-os-x/#comments</comments> <pubDate>Thu, 05 Feb 2009 05:39:15 +0000</pubDate> <dc:creator>Greg Cain</dc:creator> <category><![CDATA[Online]]></category> <category><![CDATA[OS-X]]></category> <category><![CDATA[Tech]]></category> <category><![CDATA[UNIX]]></category> <category><![CDATA[Work]]></category><guid
isPermaLink="false">http://cainmanor.com/tech/ssh-public-and-private-key-setup-on-os-x</guid> <description><![CDATA[I didn’t find one clear and concise place explaining how to setup private keys on OS-X. This is my attempt to remedy that. First, you need to generate the Private (id_dsa or id_rsa) and Public (id_dsa.pub or id_rsa.pub) Key pair. &#8230; <a
href="http://cainmanor.com/tech/ssh-public-and-private-key-setup-on-os-x/">Continue reading <span
class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>I didn’t find one clear and concise place explaining how to setup private keys on OS-X.  This is my attempt to remedy that.<br
/> <span
id="more-479"></span><br
/> First, you need to generate the Private (id_dsa or id_rsa) and Public (id_dsa.pub or id_rsa.pub) Key pair.  Properly secured machines don’t accept RSA encryption (rsa1) which was used by SSH v1 protocol, but they do accept RSA v2 and DSA, with DSA being arguably more secure.  For the –t option use either rsa or dsa, with dsa being preffered.  The rest of this article assumes you’re using dsa.  You are able to choose a passphrase, so pick something easy to remember and sufficiently complex.</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ssh-keygen</span> <span style="color: #660033;">-t</span> dsa <span style="color: #660033;">-f</span> ~<span style="color: #000000; font-weight: bold;">/</span>.ssh<span style="color: #000000; font-weight: bold;">/</span>id_dsa <span style="color: #660033;">-C</span> <span style="color: #ff0000;">&quot;your.email.address&quot;</span></pre></div></div><p>Copy the public key to the remote server</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">scp</span> id_dsa.pub username<span style="color: #000000; font-weight: bold;">@</span>remoteserver.com:~<span style="color: #000000; font-weight: bold;">/</span>.ssh<span style="color: #000000; font-weight: bold;">/</span></pre></div></div><p>This whole exercise relies on correct permissions on important files.  You should keep your private key very secure, for reasons other than getting this to work correctly.</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">600</span> ~<span style="color: #000000; font-weight: bold;">/</span>.ssh<span style="color: #000000; font-weight: bold;">/</span>id_dsa</pre></div></div><p>On the remote server, let’s add your public key to the authorized keys file, which lives in your home account</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cat</span> id_dsa.pub <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> authorized_keys2
<span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">644</span> authorized_keys2
<span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">700</span> ~<span style="color: #000000; font-weight: bold;">/</span>.ssh</pre></div></div><p>Back on your local machine, you now need to authorize yourself to use the new public key.  For OS-X it easy.  Just connect to a box that has a shared key.  You’ll get <a
href="http://photos.cainmanor.com/2009/02/pk_password.png"><img
class="size-medium wp-image-480 alignnone" title="pk_password" src="http://photos.cainmanor.com/2009/02/pk_password.png" alt="" width="300" height="175" /></a><br
/> To add identities to your keychain without the popup box (OS-X only)</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ssh-add</span> <span style="color: #660033;">-K</span></pre></div></div><p>To add the identities previously stored in your keychain (OS-X only)</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ssh-add</span> <span style="color: #660033;">-k</span></pre></div></div><p>For other unixes you can add the key manually (this works on OS-X too.)</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ssh-add</span></pre></div></div><p>To see what keys you have loaded (again, all Unixes, including OS-X)</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ssh-add</span> <span style="color: #660033;">-l</span></pre></div></div><p>To delete keys (this will delete from your keychain too)</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ssh-add</span> <span style="color: #660033;">-d</span></pre></div></div><p>There are a lot of cool things you can do with ssh-add.  The man pages are your friend.</p> ]]></content:encoded> <wfw:commentRss>http://cainmanor.com/tech/ssh-public-and-private-key-setup-on-os-x/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Easy way to ping a range of IP Addresses</title><link>http://cainmanor.com/tech/easy-way-to-ping-a-range-of-ip-addresses/</link> <comments>http://cainmanor.com/tech/easy-way-to-ping-a-range-of-ip-addresses/#comments</comments> <pubDate>Wed, 23 Apr 2008 17:49:54 +0000</pubDate> <dc:creator>Greg Cain</dc:creator> <category><![CDATA[OS-X]]></category> <category><![CDATA[Tech]]></category> <category><![CDATA[UNIX]]></category> <category><![CDATA[Work]]></category><guid
isPermaLink="false">http://cainmanor.com/technology/easy-way-to-ping-a-range-of-ip-addresses</guid> <description><![CDATA[nmap -sP 10.1.1.0/24 When I need to find an open IP, this is a decent way to do it. I wish there were a way to find IPs that don’t respond, but this works for now. This won’t work if &#8230; <a
href="http://cainmanor.com/tech/easy-way-to-ping-a-range-of-ip-addresses/">Continue reading <span
class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">nmap</span> <span style="color: #660033;">-sP</span> 10.1.1.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">24</span></pre></div></div><p>When I need to find an open IP, this is a decent way to do it.  I wish there were a way to find IPs that don’t respond, but this works for now.  This won’t work if your network bans ICMP traffic, or your host doesn’t respond, but is alive.</p> ]]></content:encoded> <wfw:commentRss>http://cainmanor.com/tech/easy-way-to-ping-a-range-of-ip-addresses/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>If Windows 2000 Add/Remove programs doesn’t open</title><link>http://cainmanor.com/tech/if-windows-2000-addremove-programs-doesnt-open/</link> <comments>http://cainmanor.com/tech/if-windows-2000-addremove-programs-doesnt-open/#comments</comments> <pubDate>Fri, 11 Apr 2008 19:17:37 +0000</pubDate> <dc:creator>Greg Cain</dc:creator> <category><![CDATA[Tech]]></category> <category><![CDATA[Windows]]></category> <category><![CDATA[Work]]></category> <category><![CDATA[w2k3]]></category> <category><![CDATA[Windows 2000]]></category><guid
isPermaLink="false">http://cainmanor.com/technology/if-windows-2000-addremove-programs-doesnt-open</guid> <description><![CDATA[From a command window run… regsvr32 mshtml.dll regsvr32 shdocvw.dll –i regsvr32 shell32.dll –i After each command, you’ll get a pop-up window saying “xxx was registered“ I support a lot of W2K boxes :(]]></description> <content:encoded><![CDATA[<p>From a command window run…</p><p
style="padding-left: 30px;">regsvr32 mshtml.dll<br
/> regsvr32 shdocvw.dll –i<br
/> regsvr32 shell32.dll –i</p><p>After each command, you’ll get a pop-up window saying “xxx was registered“<br
/> I support a lot of W2K boxes :(</p> ]]></content:encoded> <wfw:commentRss>http://cainmanor.com/tech/if-windows-2000-addremove-programs-doesnt-open/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 1/47 queries in 0.033 seconds using apc
Object Caching 627/723 objects using apc

Served from: cainmanor.com @ 2012-02-04 19:30:00 -->
