Skip to content

December 11, 2013

8

Running 1Password and Evernote under Seamonkey

by e1ven

I always find it fun to test new gadgets, and play with different ways of reaching the world.
I enjoy swapping phone platforms, OS, but mail clients and web-browsers are particularly susceptible to this, since they’re in that special fit of frequently used, but low cost-of switching.

Most recently, I’ve switched back to using a browser I used to love 10 years ago – Mozilla, or as it’s known now, Seamonkey [1]

Seamonkey logo

Seamonkey is the new name for what used to be called the Mozilla Application Suite, or, more commonly, Mozilla.
Like it’s predecessor Netscape 4, Seamonkey combines a Browser, Email client, and Newsreader into one svelt package. Even though the Mozilla Foundation quasi-abandoned Seamonkey back in 2005, volunteers around the world have kept it up to date.. Since it shares the engine with Firefox, it supports all major web features, and gives a really nice experience.

I had a lot of fun playing nostalgically with various Throbbers Ns ani, before getting down to the business of making it a mean, lean, modern web-browser.
Amusingly, with the resurgence of minimalism, the theme that was used during the beta looks perfectly at home.

Screen Shot 2013 12 10 at 6 01 44 AM

Modifying Extensions

As much fun as I was having, if I wanted to stay with Seamonkey for a primary browser, I couldn’t use it without extensions.
I’ve become far too accustomed to storing pages to read offline, using separate passwords for every site, and other things that aren’t built into any browser directly.

While quite a few extensions run out-of-the-box on Seamonkey, it’s often ignored compared to it’s vulpine cousin.
Luckily, they both use the same underlying engine, as well as the same UI framework, so porting them isn’t that bad.

Evernote

The first addon I ported over was the Evernote Web Clipper – It’s a cute little extension which lets me download webpages, and store them to read later.

Since it isn’t designed to run in Seamonkey, Mozilla (understandably) tries to discourage downloading the extension, but thankfully they do provide an override.

Download Extension

Once an extension is downloaded, it’s very straightforward to edit.
xpi extensions can be thought of as .zip files. [2]

By default, the files will unzip into your working directory, rather than a subdir (aka, a tarbomb)
This means that we should create a new subdirectory to work in

unzip evernote_web_clipper-*.xpi -d evernote-tmp/

The layout of modern extensions is pretty straightforward – The first file we care about is ‘install.rdf’
This file gives browsers the details of the extension – What browsers it’s compatible with, which languages it supports, etc.

Inside the file, there’s a section that describes it’s Firefox compatibility.

<!-- Firefox -->
<em:targetApplication>
  <Description>
    <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
    <em:minVersion>4.0b1>/em:minVersion>
    <em:maxVersion>24.0a1</em:maxVersion>
  </Description>
</em:targetApplication>

The section gives gives the Firefox ID, along with versions that are known to be compatible.
It’s straightforward to create a new entry just under it, and include that information for Seamonkey.

<!-- SeaMonkey -->
<em:targetApplication>
  <Description>
    <em:id>{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}</em:id>
    <em:minVersion>2.0</em:minVersion>
    <em:maxVersion&gt2.1.*</em:maxVersion>
  </Description>
</em:targetApplication>

That that that’s added, Seamonkey is willing to try to load the extension.
There’s one other change that needs to be made – It comes up fairly commonly when porting over extensions.

Firefox references the UI internally as ‘chrome://browser/content/browser.xul’, whereas Seamonkey uses ‘chrome://navigator/content/navigator.xul’

Thankfully, it’s easy to update this everywhere using some bash magic, without needing to manually chech each file.

    cd evernote-tmp
    for i in `find .`; do sed -i '' 's/chrome:\/\/browser\/content\/browser.xul/chrome:\/\/navigator\/content\/navigator.xul/g' $i; done > /dev/null 2>&1

Almost all extensions will need that fix. There are some other similar tweaks that other extensions might need, but it’s rare.
With that change in place, the extension should work fine in Seamonkey – It just needs to be turned back into an xpi file.

zip -r ~/Downloads/Evernote-for-Seamonkey.xpi *

Once this is an xpi file, it can be loaded like any other Extension that we downloaded from Mozilla.org.
Screen Shot 2013 12 10 at 6 24 59 AM
This adds the extension to Seamonkey, but by default doesn’t add it to the active toolbar.
It can be added by right-click the menu bar, choosing customize, and dragging the new button into the toolbar.

Screen Shot 2013 12 10 at 6 29 02 AM

Once that’s done, we’re good to go – The extension is in place, and we can properly save articles for reading later on.
Screen Shot 2013 12 10 at 6 30 05 AM

1Password

Another extension I rely heavily on is 1Password. It lets me generate unique passwords for each site I visit, so if they’re hacked, and my password is leaked, it can’t be used to break into my other accounts.
Converting it to work with Seamonkey is very similar to the procedure for Evernote –

Download the xpi file locally.

Download1Pass
Unzip into a tmp dir

unzip 1Password-4.0.1.xpi -d OnePass-tmp/

Edit install.rdf, and add the Seamonkey entry.

<!-- SeaMonkey -->
<em:targetApplication>
  <Description>
    <em:id>{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}</em:id>
    <em:minVersion>2.0</em:minVersion>
    <em:maxVersion&gt2.1.*</em:maxVersion>
  </Description>
</em:targetApplication>

Then change the browser.xul to navigator.xul, just like before.

    cd OnePass-tmp
    for i in `find .`; do sed -i '' 's/chrome:\/\/browser\/content\/browser.xul/chrome:\/\/navigator\/content\/navigator.xul/g' $i; done > /dev/null 2>&1

The 1Password extension has a few other places it’s looking for Firefox specifically that need to be tweaked.
It ships with a config file, ‘harness-options.json’, which sets various options.
One option, ‘is-sdk-bundled’ should be around line 4 – It chooses if the extension should use the version that’s built into firefox, or the one that ships with the plugin.

Setting this to true will ensure we load the version we’re about to modify.

 "is-sdk-bundled": true,

One of the files in the extension, ‘resources/addon-sdk/lib/sdk/loader/cuddlefish.js’ does another compatibility check.
Around line 50, there is a line that starts with ‘function incompatibility(module)’.
This can be bypassed in the terminal

sed -i '' 's/function incompatibility(module) {/function incompatibility(module) {return null;/g' resources/addon-sdk/lib/sdk/loader/cuddlefish.js

Once that’s fixed, it can be bundled up as an xpi, and installed via the gear icon in the admin menu, just like Evernote.

zip -r ~/Downloads/1Pass-for-Seamonkey.xpi *

While this loads, it’s not quite smooth sailing yet –

Screen Shot 2013 12 10 at 7 21 09 AM

In Version 4 of 1Password, Agilebits added a new security feature.
The app checks the gatekeeper signature of the browser that loads it, to ensure that it’s an approved browser.
The feature makes some sense – 1Password works by communicating with the browser over a socket, so adding some security to ensure we know who we’re talking to is reasonable.
Unfortunately, Seamonkey isn’t currently signed, so even if Agilebits wanted to, they couldn’t include it’s signature.

Of course, that’s no reason to give up 😉
I dug around in the app a bit – While I’m not really very talented at reverse-engineering apps, it looked to be fairly simple.
1Password runs in the background, listening on a socket, which the extension then connect to – When a connection comes in, 1Password looks up the Process that is talking to it.
This information is readily available in the system normally, such as with a lsof

2BUA8C4S2 34434 TCP localhost:10196->localhost:49738 (ESTABLISHED)
2BUA8C4S2 34434 TCP localhost:10191 (LISTEN)
2BUA8C4S2 34434 TCP localhost:10191 (LISTEN)
2BUA8C4S2 34434 TCP localhost:10196 (LISTEN)
2BUA8C4S2 34434 TCP localhost:10196 (LISTEN)

Once it has the PID, it can lookup the gatekeeper signature. Since all the major browsers are signed, it’s straightforward to compare against those signatures.

Screen Shot 2013 12 10 at 5 26 43 AM
Screen Shot 2013 12 10 at 5 32 09 AM

I can see where they’re going with this, and it’s an interesting idea, but the feature does make it a bit more difficult to use unsupported browsers.
Luckily, before I went too far down the rabbit hole of trying to patch the binary, I found an much easier way.
The new beta version has a bypass option built in.

Screen Shot 2013 12 10 at 7 35 49 AM

Success!
Seamonkey runs really well, and porting over a few plugins, even if you need to smash them around a bit, makes a great everyday experience.
I certainly wouldn’t recommend it for everyone, but it’s become my browser of choice — At least for this week.

Screen Shot 2013 12 10 at 5 41 06 AM

Footnotes

1 – I know that Mozilla prefers to refer to the suite as SeaMonkey, with both words capitalized. Personally, I find this a bit ugly, so I’ll be using the variant Seamonkey here.
2 – Technically, these are Jar files, but the distinction isn’t meaningful here.

Advertisements
Read more from Uncategorized
8 Comments Post a comment
  1. Jan 3 2014

    Thank you for this awesome post.

    I was trying to do this for DNTMe (https://www.abine.com/), but got the error:

    The add-on downloaded from unknown host could not be installed because it appears to be corrupt

    Does anyone know what must be done to port this extension?

    Thank You

    Reply
    • Jan 3 2014

      I’m not sure exactly what would need to be done, but where do you get that error?
      When you first try to download the xpi? Make sure you’re right-clicking, and choosing download, otherwise it’ll try to load it before you get a chance to modify it.

      Reply
      • Jan 4 2014

        Sorry for being unclear. I meant that after I had followed all the steps in your article and imported the xpi in the tool menu, it said that it could not add the extension because it was corrupt.

    • Jan 4 2014

      Yes, I know I am being hypocritical seeing my comment below.

      Reply
  2. Jan 3 2014

    Just Saying that doing this is illegal without permission from the creator of the add-on, such as if it is open source.

    Daniel F

    Reply
    • Jan 3 2014

      I’m not a lawyer, but I really think you’re mistaken.
      Redistributing the modified plugin would be more iffy, but modifying your own plugin without distributing any files is certainly legal.

      Reply
      • Jan 4 2014

        Sorry, I didn’t phrase that very well.

        Of course modifying your own plugin is illegal.
        What I was talking about was modifying closed source plugins, which is illegal as far as I know.

        If it is your own or modification is allowed, it is legal however.

        Fair Use is an entirely different matter though. If it is for educational purposes and you don’t distribute it you should be fine.

  3. Jan 4 2014

    Also, I think there might have been an error in the application that you used to write the .rdf files for this project in the line below:

    <em:maxVersion&gt2.1.*

    I am pretty sure it should be:

    2.1.*

    Please let me know if I am mistaken,

    DF

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Note: HTML is allowed. Your email address will never be published.

Subscribe to comments

%d bloggers like this: