When the going gets tough, the tough mess with cookies!
Well sort of. I started using Chromium from the Chromium Daily Build PPA yesterday at work. I remembered most of my passwords for things, but one eluded me.
The wiki system we use is WikkaWiki and while it does the job, it’s not something that would be my first choice. Or second choice. Anyway.
The weird thing is, it does something stupid and as a result, Firefox can’t remember the password, so I couldn’t look up the password in Firefox’s little menu. We didn’t have mail setup on the wiki server (it’s a VM), so I couldn’t do the standard reset my password thing, and blah blah blah, pain the butt, this that and the other thing.
So I look at my cookies in Firefox. Hmm, they look tasty.
What would happen if I:
- Wrote a little Sinatra application to set the cookies to the same values as in Firefox,
- Set the hostname of the wiki machine to localhost in my hosts file,
- ssh and port forward 80 to 4567 (So I can hit the proper hostname and path but direct it to the Sinatra app on port 4567. The reason behind this is I compile ruby into my home directory, so doing this is faster than installing Sinatra and all the required gems in the system path),
- And finally hit the wiki path in Chrome?
Would it set the cookies to the proper values, so that when I undid everything I would be logged into the wiki? You bet!
Initially I didn’t think it would work, but in retrospect, it makes sense that it did. Still, all I have to say is zomg hacks!!