Monthly Archives: April 2012

Enable secure LDAP container based authentication with JSPWiki

A quick follow up on my post here. I will describe below the steps needed to enable secure LDAP authentication (both LDAPS and HTTPS). This is not intended for production use, obviously.

I’m using the same platform and environment described here, and also using this as the starting point for the following.

 

Verify that the LDAPS connection handler is enabled in OpenDJ

This can be checked using the OpenDJ Control Panel GUI, and modified if necessary using the CLI dsconfig utility.

 

Switch to the secure LDAP port in the GlassFish JSPWiki security realm

Make sure you are using the ldaps:// URL prefix, and specify the secure port number (1636 in this example):

Enable LDAPS in GlassFish

 

Enable security for the relevant GlassFish HTTP network listener port

Our JSPWiki application is listening over port 8080, configured in GlassFish under http-listener-1. Enable security for this port:

Enabling security for the GlassFish http-listener-1 network listener

 

Enable HTTPS connections to JSPWiki

This is performed via modification of the JSPWiki web.xml file. In a default state, the web.xml file contains the following entries which enable the use of SSL connections:

<user-data-constraint>
           <transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>

Ensure these exist in web.xml under the container managed authentication section.

 

Export the OpenDJ SSL certificate and import it into the JSPWiki JKS keystore

The keytool CLI utility is used for this step.

First, we export the OpenDJ certificate (which has a default alias of server-cert) to a file:

dave@mymachine:~/OpenDJ/config$ pfexec keytool -export -alias "server-cert" -keystore ~/OpenDJ/config/keystore -file /tmp/server-cert.cer
Enter keystore password:  

Certificate stored in file </tmp/server-cert.cer>

Next, we import the certificate file into the keystore of the GlassFish domain running our instance of JSPWiki, which in this example is at /opt/glassfishv3/glassfish/domains/domain1/config/cacerts.jks:

dave@mymachine:~/OpenDJ/config$ pfexec keytool -import -v -trustcacerts -alias "server-cert" -keystore /opt/glassfishv3/glassfish/domains/domain1/config/cacerts.jks -file /tmp/server-cert.cer 
Enter keystore password:  
Owner: CN=mymachine, O=OpenDS Self-Signed Certificate
Issuer: CN=mymachine, O=OpenDS Self-Signed Certificate
Serial number: 
Valid from: 
Certificate fingerprints:
	 MD5:  
	 SHA1: 
	 Signature algorithm name: SHA1withRSA
	 Version: 3
Trust this certificate? [no]:  yes
Certificate was added to keystore
[Storing /opt/glassfishv3/glassfish/domains/domain1/config/cacerts.jks]

 

Modify the jspwiki.baseURL value

This is required as the URL prefix will have changed from http:// to https://. This modification is performed in the jspwiki.properties file.

Assuming my existing jspwiki.baseURL value is:

http://192.168.1.1:8080/ITProjects/

This would need to be changed to:

https://192.168.1.1:8080/ITProjects/

 

Restart the GlassFish domain, and test LDAP logins…

…and if you don’t observe secure logins working as they should, leave a comment.

Advertisements

Importing Firefox RSS bookmarks into Thunderbird

(This guide has been updated for Thunderbird version 31.2.0, running on Ubuntu 14.04.)

Although I’ve tended to use Firefox to subscribe to RSS feeds via its Live Bookmarks feature, turns out Thunderbird can import Firefox bookmarks with the help of a third-party add-on. In this way, you can use Thunderbird to subscribe to any number of your existing Firefox bookmarked RSS feeds, without otherwise having to manually subscribe to each one in turn.

 

First, download the Firefox OPML Support add-on here:

https://addons.mozilla.org/en-us/firefox/addon/opml-support/

Install the add-on in the normal way, and restart Firefox. After restarting, go to “Bookmarks -> Show All Bookmarks” where you will observe new “OPML” entries under the “Import and Backup” menu. We want to select the “Export OPML…” command:

Exporting OPML file

I have used the following export settings:

OPML export settings

Save the resulting .opml file somewhere convenient.

I have noticed that the OPML file in its present state doesn’t appear to successfully import a flat listing of RSS feeds into Thunderbird, without first performing the following edits. Our unmodified example .opml file contains the following (we’ve only got a few RSS feeds to export for this particular example):

<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
	<head>
		<title><![CDATA[Live Bookmarks OPML Export]]></title>
		<dateCreated>Tue Oct 15 2013 00:38:07 GMT+1300 (NZDT)</dateCreated>
	</head>
	<body>
<outline text="Bookmarks Menu">
</outline>
<outline text="Bookmarks Toolbar">
<outline type="rss" version="RSS" text="Apertura Designs blogs" htmlUrl="http://www.apertura.co.nz/blog" xmlUrl="http://www.apertura.co.nz/blog/feed" description=""/>
<outline type="rss" version="RSS" text="BusinessBlogs Hub" htmlUrl="http://www.businessblogshub.com/" xmlUrl="http://www.businessblogshub.com/feed/" description=""/>
<outline type="rss" version="RSS" text="Wonderblog" htmlUrl="http://blogs.openwonderland.org/" xmlUrl="http://blogs.openwonderland.org/feed/" description=""/>
<outline type="rss" version="RSS" text="XBMC" htmlUrl="http://xbmc.org/" xmlUrl="http://xbmc.org/feed/" description=""/>
<outline type="rss" version="RSS" text="Quetzalcoatal" htmlUrl="http://quetzalcoatal.blogspot.com/" xmlUrl="http://quetzalcoatal.blogspot.com/feeds/posts/default?alt=rss" description=""/>
</outline><outline text="Unfiled Bookmarks">
</outline></body>
</opml>

We can see here references to the “Bookmarks Menu”, “Bookmarks Toolbar” and “Unfiled Bookmarks” folders, with accompanying opening and closing outline tags. These references and their attendant tags can be removed, leaving just the feed information intact. For example, compare the above example with the following modified file:

<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
	<head>
		<title><![CDATA[Live Bookmarks OPML Export]]></title>
		<dateCreated>Tue Oct 15 2013 00:38:07 GMT+1300 (NZDT)</dateCreated>
	</head>
	<body>
<outline type="rss" version="RSS" text="Apertura Designs blogs" htmlUrl="http://www.apertura.co.nz/blog" xmlUrl="http://www.apertura.co.nz/blog/feed" description=""/>
<outline type="rss" version="RSS" text="BusinessBlogs Hub" htmlUrl="http://www.businessblogshub.com/" xmlUrl="http://www.businessblogshub.com/feed/" description=""/>
<outline type="rss" version="RSS" text="Wonderblog" htmlUrl="http://blogs.openwonderland.org/" xmlUrl="http://blogs.openwonderland.org/feed/" description=""/>
<outline type="rss" version="RSS" text="XBMC" htmlUrl="http://xbmc.org/" xmlUrl="http://xbmc.org/feed/" description=""/>
<outline type="rss" version="RSS" text="Quetzalcoatal" htmlUrl="http://quetzalcoatal.blogspot.com/" xmlUrl="http://quetzalcoatal.blogspot.com/feeds/posts/default?alt=rss" description=""/>
</body>
</opml>

The file is then ready to be imported into Thunderbird.

Next, in Thunderbird go to the “Account Settings…” window, and add another account. The account type should be set to “Feed Accout…”:

Add Feed account

Accept the default account name, and finish the process:

Feed account default name

Finish adding a new Feed account

Now, go back to the Thunderbird “Account Settings…” window where you will see the newly added account. Select the account, and click on the “Manage Subscriptions…” button.

Managing Feed subscriptions

Here we will finally import our Firefox RSS feed bookmarks. Click on the “Import” button, and locate the OPML file you exported and modified:

Importing RSS feeds

If all goes well, you should now see all your RSS feed bookmarks downloading on the left-hand side of the Thunderbird window (in a default Thunderbird layout):

RSS feeds still importing

Every news feed also has an image based on the source website as well as the feed name.

Close this subscription management window once the import has finished. By default, new news articles will be checked for every 100 minutes, but you can force an immediate update of all recent posts for all feed subscriptions if needed, by right-clicking on the Feed account and selecting Get Messages

Get new RSS feed posts