Locked yourself out of Jenkins?

Removed all permissions from your account did you? Save it did you?  Feeling a bit stupid?

Yeah, me too!

First steps

SSH to your server and stop Jenkins

/etc/init.d/jenkins stop

Now modify the config XML

sudo vi /var/lib/jenkins/config.xml

You now have two options to regain access

Yeehaw way

Turn security off and remove the <authorizationStrategy> node

<useSecurity>false</useSecurity>

Now restart Jenkins and head over to your admin UI to resecure it quick before the trolls get in.

/etc/init.d/jenkins start

Like a boss way

If you want to be safe and not open up a security hole at all, you can add the security permissions into the config XML manually. Just replace USERNAME with own

<authorizationStrategy class=”hudson.security.ProjectMatrixAuthorizationStrategy”>

<permission>hudson.model.Computer.Configure:USERNAME</permission>
<permission>hudson.model.Computer.Connect:USERNAME</permission>
<permission>hudson.model.Computer.Create:USERNAME</permission>
<permission>hudson.model.Computer.Delete:USERNAME</permission>
<permission>hudson.model.Computer.Disconnect:USERNAME</permission>
<permission>hudson.model.Hudson.Administer:USERNAME</permission>
<permission>hudson.model.Hudson.Read:USERNAME</permission>
<permission>hudson.model.Hudson.RunScripts:USERNAME</permission>
<permission>hudson.model.Item.Build:USERNAME</permission>
<permission>hudson.model.Item.Configure:USERNAME</permission>
<permission>hudson.model.Item.Create:USERNAME</permission>
<permission>hudson.model.Item.Delete:USERNAME</permission>
<permission>hudson.model.Item.Read:USERNAME</permission>
<permission>hudson.model.Item.Workspace:USERNAME</permission>
<permission>hudson.model.Run.Delete:USERNAME</permission>
<permission>hudson.model.Run.Update:USERNAME</permission>
<permission>hudson.model.View.Configure:USERNAME</permission>
<permission>hudson.model.View.Create:USERNAME</permission>
<permission>hudson.model.View.Delete:USERNAME</permission>
<permission>hudson.scm.SCM.Tag:USERNAME</permission>

</authorizationStrategy>

Now restart Jenkins and sit back with a smug grin.

/etc/init.d/jenkins start

Smug Croissant Guy

Smug Croissant Guy

Advertisements

Open mailto: links in Gmail

If you’re a Windows user, use Gmail and like me are sick of mailto: links opening Outlook this could save you any more of those argggggggh moments.

DISCLAIMER: If you don’t know how to modify the registry, you probably shouldn’t be doing it. If you do it, you do so at your own risk.

Update the registry value at:

HKEY_CLASSES_ROOT\mailto\shell\open\command

to be:

“C:\Users\[YOUR_USERNAME_HERE]\AppData\Local\Google\Chrome\Application\chrome.exe” http://mail.google.com/mail?extsrc=mailto&url=%1

or if you use Windows Server 2003 like me:

“C:\Documents and Settings\[YOUR_USERNAME_HERE]\Local Settings\Application Data\Google\Chrome\Application\chrome.exe” http://mail.google.com/mail?extsrc=mailto&url=%1

UPDATE: Someone has pointed out that there’s a Chrome extensions for that :

https://chrome.google.com/webstore/detail/dgkkmcknielgdhebimdnfahpipajcpjn



Removing sites from Google Search

If, like me, you hate experts-exchange.com results appearing in your google search results, you can use this bookmarklet to remove them.

javascript:(function(){
var query;
var regexS = "[\\?&]"+"q"+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null ){query = "";}
else{query = results[1];}
query =  query + " -site:experts-exchange.com";
document.location = "http://www.google.com/search?q=" + query;
})();