Converting your existing ssh rsa key for use with Windows Azure

Oh Microsoft, it seems like you make simple things complex.

I could not find anything on converting an existing ssh key for use with Azure. Once I figured out what was needed and the commands available to me, it was easy. It only took me hours of fiddling with ssh-keygen and openssl.

The magic was learning that openssh stores its id_rsa in a format which openssl can read. This means I can use openssl directly to convert this private key.

openssl req -x509 -new -days 365 -key id_rsa -out id_rsa.x509req.pem

Type in your password for your private key (if you are not using a password, you should be.) Then fill out the certificate request fields.

Now you can boot your azure vm using id_rsa.x509req.pem

azure vm create jrwtest b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-12_04_3-LTS-amd64-server-20130916.1-en-us-30GB jwren –location “East US” -e -t id_rsa.x509req.pem

Now you can secure shell to your azure vm.

ssh jrwtest.cloudapp.net

SWEET. šŸ™‚Ā  No generating new ssh keys for me.

git svn terrible trouble

I use git svn.

I recently somehow (I do not recall) put git svn into a strange state.

The symptom was that from master, git svn info would show a branch to which I once committed instead of trunk. I could not figure this out. My solution was to rm -rf .git/svn/ ; git svn fetch -r latesttrunkrev to let git svn recreate the refs. Then all worked.

Now git svn info from master tells me trunk, like I expect it to.

 

WCF Async Without Changing The Contract

Someone asked a group of people recently about how to prevent overloading a WCF service that gets blocked. It sounded like the WCF service was getting called a lot and this was causing many threads to get created to service all of the requests, but nearly all of those threads were blocked handling some IO requests.

I vaguely recalled something about WCF async and I suggested this person look into that. I even looked up the AsyncPattern=true property and value for the OperationContract attribute, but the person didn’t want to break the contract. I was pretty sure that this change was only a server side change and that it wouldn’t break any contract, but I wasn’t 100% sure.

Today I confirmed that I was right. The generated WSDL does not change when you change your contract from something like this:

[ServiceContract]

public interface IOrderService

{

[OperationContract]

Order[] GetOrders(int numOrders);

}

To something like this:

[ServiceContract]

public interface IOrderService

{

[OperationContract(AsyncPattern=true)]

IAsyncResult BeginGetOrders(int numOrders, AsyncCallback callback, object state);

Order[] EndGetOrders(IAsyncResult result);

}

If you want to convert existing WCF services to server-side async style, you can do so without your clients ever knowing. (There may be a caveat when using a ChannelFactory, see the docs.)

The MSDN docs are pretty good. An overview here http://msdn.microsoft.com/en-us/library/ms730059.aspx some better details here http://msdn.microsoft.com/en-us/library/ms731177.aspx

Dan Rigsby had some blog posts from when these features were rolled out, but beware his examples, he keeps a sync version and an async version, which is not strictly required. http://www.danrigsby.com/blog/index.php/2008/03/26/async-operations-in-wcf-iasyncresult-model-server-side/

Finally, Wenlong Dong’s blog gives great reasons why you would want this and even goes as far as suggesting using the async version of the datareader for async database access. http://blogs.msdn.com/b/wenlong/archive/2009/02/09/scale-wcf-application-better-with-asynchronous-programming.aspx

OpenWRT 10.03.1-rc2 and Comcast IPv6

After documenting the IPv6 goodness for the old kamikaze release of openwrt, I wanted to play with something a little newer. I also wanted newer iptables so I could play with the tee module.

Some notes:

  • Still no 6rd support on OpenWRT AFAIK
  • rc2 and rc3 are the same for the brcm-2.4 version of Openwrt 10.03.1
  • brcm4700 doesnā€™t work well at all with my WRT54GL. I think the open source broadcom drivers still arenā€™t as stable as the proprietary ones that ship with 2.4
  • nearly the same config scripts as the old kamikaze work

Once you flash the router with the firmware you will need to install some extra packages.

  1. opkg update
  2. opkg install ip kmod-ipv6 kmod-sit radvd
  3. paste this code into a new startup script at /etc/init.d/comcast6to4
  4. #!/bin/sh /etc/rc.common

    inetip=`ip -4 addr show dev eth0.1 | awk ‘/inet / {print $2}’ | cut -d/ -f 1`
    inetipspaced=`echo $inetip | tr . ‘ ‘`
    local6prefix=`printf 2002:%02x%02x:%02x%02x $inetipspaced`

    start() {
    ip tunnel add c6to4 mode sit ttl 255 remote any local $inetip
    ip link set c6to4 up
    ip -6 addr add $local6prefix:0::1/64 dev c6to4
    ip -6 addr add $local6prefix:1::1/64 dev br-lan
    ip -6 route add 2000::/3 via ::192.88.99.1 dev c6to4
    sysctl -w net.ipv6.conf.all.forwarding=1 > /dev/null
    cat > /etc/radvd.conf <<EOF
    interface br-lan
    {
    AdvSendAdvert on;
    MinRtrAdvInterval 3;
    MaxRtrAdvInterval 10;
    prefix $local6prefix:1::/64
    {
    AdvOnLink on;
    AdvAutonomous on;
    AdvRouterAddr on;
    AdvValidLifetime 86400;
    AdvPreferredLifetime 86400;
    };
    };
    EOF
    }

    stop() {
      ip tunnel del c6to4
      ip -6 addr del $local6prefix:1::1/64 dev br-lan
    }

  5. pushd /etc/rc.d ; ln ā€“s ../init.d/comcast6to4 S42comcast6to4

Then be glad you have ipv6.

 

This will actually work for ANY provider which uses the standard IPv6 6to4 address of 192.88.99.1, not just Comcast.

Now if only Comcast would open back up their trial so I could join my work to the ipv6 network.

Comcast IPv6 on an old Kamikaze 8.09 Openwrt via 6to4

Iā€™m an openwrt novice, but I know enough about linux and iptables to usually get done what I want. When Comcast announced they were trialing IPv6, I jumped at the opportunity to migration from my trusty Hurricane Electric tunnel to something more direct.

Iā€™m running Kamikaze 8.09.1 brcm-2.4 on my Linksys WRT54GL these instructions probably wonā€™t work elsewhere. Iā€™m guessing that IPv6 is a little different in a 2.6 kernel with a new iptables. If you have very new stuff you should be using 6rd instead of 6to4.

Iā€™m writing this because much of the information I found out there for 6to4 on Linux didnā€™t work for me, or was only partly correct and I had to piece together suggestions from different sources.

make a script in /etc/rc.d with this content. I called mine comcast6to4

inetip=`ip -4 addr show dev eth0.1 | awk ‘/inet / {print $2}’ | cut -d/ -f 1`
inetipspaced=`echo $inetip | tr . ‘ ‘`
local6prefix=`printf 2002:%02x%02x:%02x%02x $inetipspaced`
ip tunnel add c6to4 mode sit ttl 255 remote any local $inetip
ip link set c6to4 up
ip -6 addr add $local6prefix:0::1/64 dev c6to4
ip -6 addr add $local6prefix:1::1/64 dev br-lan
ip -6 route add 2000::/3 via ::192.88.99.1 dev c6to4

Make your /etc/radvd.conf look like this:

interface br-lan
{
AdvSendAdvert on;
MinRtrAdvInterval 3;
MaxRtrAdvInterval 10;
prefix $local6prefix:1::/64
{
AdvOnLink on;
AdvAutonomous on;
AdvRouterAddr on;
AdvValidLifetime 86400;
AdvPreferredLifetime 86400;
};
};

That is it. Iā€™m not going to explain it. Read the links below for all of that.

Sorry this isn’t a complete solution. You’ll have to fill in that $local6prefix in radvd.conf yourself.

Works Cited:

http://www.reddit.com/r/linux/comments/dbobx/

http://www.comcast6.net/

http://wiki.debian.org/DebianIPv6#IPv66to4Configuration

http://tldp.org/HOWTO/Linux+IPv6-HOWTO/configuring-ipv6to4-tunnels.html

http://en.wikipedia.org/wiki/6to4

http://www.dslreports.com/forum/r24972279-IPv6-via-6in4

http://www.anyweb.co.nz/tutorial/v6Linux6to4

Real IPv6, Here I Come

For a few months now, my entire home has been on the ipv6 internet via Hurricane Electricā€™s free tunnel service. It has been very cool and Iā€™ve learned a bit about IPv6 in the process.

Today I was happy to see an email from Comcast about their IPv6 trial program. I donā€™t have direct IPv6 just yet, but this was the first time I had to agree to Terms of Service.

Confidentiality.  While the conduct of the Trial, the nature and quality of the Trial Service and any Trial Equipment you receive constitute Comcast confidential information, one of Comcast’s objectives is to assist the general Internet community in preparing for IPv6 and to encourage widespread IPv6 deployment across the entire Internet.  Thus, you are authorized to discuss details of the trial with non-participants, such as members of the Internet Engineering Task Force, and to post information about your participation on web-based forums, email discussion lists, social media networks, etc. However, you agree not participate in any media interviews that involves disclosure or discussion of any details of the Trial with media representatives, including but not limited to professional bloggers, print media, online newspapers and magazines, radio, and television, without the prior written approval of Comcast.

I have to admit, these terms arenā€™t too bad. I can blog about it, tweet about it, talk about it all I want. I can be as mean or as nice as I want. Butā€¦ ā€œno interviewsā€ šŸ™‚

Windows 7 mp3 tag editor

I just accidentally found Windows 7ā€™s built in mp3 (and presumably other metadata, exif perhaps) tag editor.

I looked for this thing for what felt like hours over the past year. Eventually I sucked it up and downloaded mp3tag, but its still nice to know that this is there for the next time.

Normally when browsing my mp3 files I see a window that looks like this:

Stromkern1

See that summary pane at the bottom? Select a file with editable metadata, like an mp3 and resize that pane. Then click one of the metadata values.

Stromkern2

Wow, I wish that had been more discoverable. ā€“1 point for Windows 7 for making that far from intuitive, but 1 point for Windows 7 for having the feature.

An Application of iPad

I really hate the timing of this post, but the ideas are fresh in my head. You can consider this ā€˜just another iPad postā€™ if you want.

Ever taken a survey on the streets from someone with a PC style tablet? Iā€™ve taken a few. Iā€™m always surprised by the hardware choice. For some things, it seems like a clipboard and paper would be better.

At work, there is an upcoming project that involves something like the above. Here is why I think the iPad is a better choice. It mostly comes down to boring IT Operations reasons, aka management of the underlying platform.

  • With iPad, you never have to defragment your disk.
  • With iPad, you never have to run antivirus or update antivirus definitions.
  • With iPad, you never have to run anitspyware or update antispyware definitions.
  • With iPad, there is no moving and spinning disk which is prone to higher failure.
  • With iPad, you don’t have to worry about some slick-kid or script kiddie downloading and installing some crazy software that turns your computer into a bot or even just overwrites important files preventing you from booting the next time.
  • With iPad, you don’t have to worry about not having a replacement part available if a piece of hardware fails.
  • With iPad, the user will have a more familiar experience. Given the prevalence of iPhone, it is likely that an end user will understand many of the touch and drag gestures.
  • With iPad, there is no stylus like the PC Tablets of old.
  • With iPad, there is a very clear future. When was the last time apple canceled a product line? Newton? Ok, how about under Jobs? I’ve no idea.

Iā€™m as anti-fud as any person that I know. Yes, the above is definitely anti-windows fud cited by Mac and Linux lovers everywhere and normally Iā€™m the first person to refute it. However, I think under that fud there are tiny grains of truth. For certain applications those bits of truth are highly amplified. It is a different risk vector. These things become very important and translate directly to cost of ownership.

Notice that Iā€™ve listed no pros or cons for iPad as a general purpose device. I donā€™t care to go there. Iā€™ve also not mentioned if there is much of a market for the above use case (there isnā€™t enough to sustain the device alone). These are all things to be answered elsewhere. My point in short: here is a use case if you have been wondering for what kind of things iPad can be used.

Geeks drive girls out of computer science

My wife linked me to this article about a cultural study done on certain masculine aspects of things which often surround computer science.

http://www.msnbc.msn.com/id/34437233/ns/technology_and_science-science/

She (my wife) brought it up in the context of cables and cords lying around and Iā€™d guess that extends to the unused laptop, mouse or keyboard. She is a very neat person. I am less so, but she keeps me in check. This is good.

The article talks about the physical environment of a computer science classroom or office. I donā€™t know what classrooms this study is looking at. I can only assume that they are primary and secondary classrooms because the college classrooms in which I teach and in which I attended are the same boring sterile classrooms in which all subjects are taught.

I can comment on offices. The quote from the article is a quote by the lead researching Sapna Cheryan from the University of Washington. She says ā€œā€¦ the image that immediately pops into many of their minds is of the computer geek surrounded by such things as computer games, science-fiction memorabilia and junk food.ā€

Iā€™d like to address each of things. There are no computer games on my desk at home nor at work. At home, I share a desk with my wife, occasionally there is a game left out. They are hers. I have her Rollercoaster Tycoon CD in my backpack right now, because she left it in my disk drive. I do not play video games. It is a choice. I used to play a few video games. I think that when Starcraft 2 comes out, Iā€™ll probably play that video game.

I have some science fiction memorabilia stuffed in drawers at home. A hat from the cast of the original Stargate movie. A signed Richard Dean Anderson photograph. Both of these were gifts from people who knew that I love Stargate. I donā€™t leave them out. I donā€™t talk about them. In fact, if any of my coworkers read this, both items will probably be a surprise to them, and they will probably make fun of me greatly for each of them.

Junk food is bad. Iā€™d probably eat lots of junk food if I didnā€™t have my wife to take care of me and she didnā€™t constantly remind me about good nutrition and encourage me by talking to me about the food industry, summarizing books for me and watching movies with me such as Supersize Me and Food Inc. I bring my lunch to work almost every day rather than eat out. As I write this many of my coworkers are out at the monthly Ann Arbor ā€œNerd Lunchā€. I try to eat healthy.

I try to eat healthy to the point that food preparation is something that I can talk at length about. Last night I made cottage cheese. I bake all my own bread. Iā€™ve not bought bread from a store in over 6 years. I make my own chicken stock. I make a lot of things that are often bought. I do not consider any of these things add to my computer geek. If anything Iā€™m a non-geek. These things are also traditionally non-masculine activities. Although more recently I think they are more niche hobbies than feminine activities.

What is the point? I guess Iā€™m trying to say, look deeper. Yes, on the surface there is a video game, bad-sci-fi, junk food culture to computer science, but as soon as you peel back the first layer there is a variety and depth as wide as any other profession.