19 February 2013

341. Upgrading/installing BankID on 64 bit linux

Note: the post below is aimed at installing BankID on Debian (should be ok for ubuntu/mint too). For Arch Linux, see here (item 16)

There are a few ways to get around the rotten behaviour of bankid. This is one of them:

NOTE: to install nspluginwrapper you need to enable the stable/squeeze repos by e.g. adding
deb http://ftp.au.debian.org/debian/ squeeze main contrib non-free
to your /etc/apt/sources.list.

That's normally reasonably safe since apt by default pulls in the newest package and I haven't had any issues. Just be careful though.

You can also install nspluginwrapper by compiling it as shown here: http://verahill.blogspot.com.au/2013/03/366-nspluginwrapper-on-debian.html


Note that there's a FOSS alternative in Fribid (http://verahill.blogspot.se/2012/02/debian-testing-wheezy-64-fribid-as.html) which seems to be working perfectly -- and if you can use it, use it. The main limitation is that in practice you'll have to collect your certificate/ID with it, since newer versions of BankID saves the ID in an incompatible format. Like many foreigners, I don't have the opportunity to visit Sweden for the sole sake of picking up a new ID, so I'm stuck with BankID. But you may not be.



0. Things to install:
sudo apt-get install iceweasel nspluginwrapper ia32-libs

1. Download BankID and uninstall any previous installations
cd ~/Downloads
mkdir bankid
cd bankid
wget https://install.bankid.com/Download?defaultFileId=Linux -O bankid.tar.gz
tar xvf bankid.tar.gz
cd BISP-4.19.1.11663/
sudo sh install.4.19.1.11663.sh u

2. If you're upgrading, make sure to remove any previous libplugins.so
sudo updatedb && locate libplugins.so
/home/me/Downloads/bankid/BISP-4.19.1.11663/libplugins.so /usr/lib/mozilla/plugins/libplugins.so /usr/lib/mozilla/plugins/npwrapper.libplugins.so /usr/lib/nspluginwrapper/plugins/npwrapper.libplugins.so
sudo nspluginwrapper -r /usr/lib/mozilla/plugins/npwrapper.libplugins.so sudo rm /usr/lib/mozilla/plugins/libplugins.so sudo rm /usr/lib/nspluginwrapper/plugins/npwrapper.libplugins.so

3. Install the new version
sudo sh install.4.19.1.11663.sh i
Installing BankID Security Application ln: failed to create symbolic link `/usr/lib/firefox-addons/plugins': No such file or directory WARNING: Failed installing plugin for Firefox 3. Manually add symlink to libplugins.so in your Firefox 3 plugin directory if this browser is to be used. Installation complete.
sudo nspluginwrapper --install /usr/local/lib/personal/libplugins.so

4. Test your installation
Don't bother with test.bankid.com since the idiots won't let you test anything that identifies itself as 64 bit (more about that later). Instead
5. Testing against test.bankid.com
Everything is in working order but for some idiotic reason bankid.com won't even allow you to test you fancy new 64 bit installation -- and it all boils down the useragent string in iceweasel/firefox identifying itself as running on a 64 bit system (paradoxically, a real 32 bit browser running in a chroot won't work either since the kernel is 64 bit -- in schroot you can use personality=linux32 to get around it, but good luck dealing with the massive memory leaks).

Anyway,
  • open your iceweasel browser
  • type in about:config in the address bar
  • promise that you'll be careful
  • right-click on the page, select New, String
  • In the first box, type general.useragent.override
  • In the second box paste Mozilla/5.0 (X11; Linux i686; rv:10.0.12) Gecko/20100101 Firefox/10.0.12 Iceweasel/10.0.12
You can now go to https://test.bankid.com. I find this a bit humiliating though, and you can use bankid everywhere but bankid.com without having to set the useragent to identify your system as being i686.


If you're having issues, the first thing to check is about:plugins in firefox:


25 comments:

  1. Martin Insulander25 March, 2013 06:39

    Great, thanks. Seems to work so far.

    Now where to start with getting id on card to work?

    ReplyDelete
  2. Yeees, finally I was able to get a BankID from Skandiabanken and got my tax declaration signed on Ubuntu 13.04.
    Thanks a lot!

    ReplyDelete
    Replies
    1. Happy that it worked out for you. I can't believe that BankID is so poorly managed given how important electronic ID has become in Sweden.

      Delete
  3. Terrific! This works. Thank you so much.

    One thing though: After I followed these instructions, I still was not able to download the bankid file from Nordea. For that, I had to get it using Windows, then export the file to a usb drive and then import it in Linux using the command `persadm import`. Once I did this, I am able to log in to skatteverket.se and also do the test.bankid.com tests.

    It's a crying shame that bankid is so poorly implemented/supported given its popularity. One would have expected it to be open-protocol'ed with many open-source implementations for whatever OS you prefer to use.

    ReplyDelete
    Replies
    1. Thanks for the feedback!

      How come it is easier -- and legal -- to obtain someone else's tax records, but that the source code of a program which is /required/ in order to interact with public agencies and to file taxes, is kept secret? It just doesn't make any sense.



      Delete
  4. To fix the warning in Step 3 up above
    FireFox version 21 fix to install script for Nexus Personal BankID

    That swedish ubuntu wiki link http://ubuntu-se.org/wiki/NexusPersonal helped me and a swede install NexusPersonal BankID onto 32 bit Puppy Linux Lucid 5.2.8 and 32 bit Slacko 5.5 with FireFox vesion 21 running.
    The install.4.19.1.11663.sh script should be modified with the following symbolic link command to work with FireFox 21. The location of the addon plugins directory was changed between FireFox 3.6 and later versions from /usr/lib/firefox-addons/plugins to /usr/lib/mozilla/plugins


    You may just create a link instead of copying the file. You won't have problems with updates then:

    ln -s /usr/local/lib/personal/libplugins.so /usr/lib/mozilla/plugins

    Here is the modification to the install script file install.4.19.1.11663.sh

    #Install plugin for FF21
    ln -s $INSTALL_DIR/personal/libplugins.so /usr/lib/mozilla/plugins
    if [ $? -ne 0 ]; then
    echo "WARNING: Failed installing plugin for Firefox 21. Manually add symlink to libplugins.so in your Firefox 21 /usr/lib/mozillla/plugins directory if this browser is to be used."
    echo "ln -s /usr/local/lib/personal/libplugins.so /usr/lib/mozilla/plugins"
    fi
    #Install plugin for FF3
    ln -s $INSTALL_DIR/personal/libplugins.so /usr/lib/firefox-addons/plugins
    if [ $? -ne 0 ]; then
    echo "WARNING: Failed installing plugin for
    Firefox 3. Manually add symlink to libplugins.so in your Firefox 3 plugin directory if this browser is to be used."
    fi


    With puppylinux or slacko puppy booting from a CD would provide the ideal banking security system if you use Windows. No virus software can be written to a CD. A fresh boot from a CD will load the OS into RAM

    http://01micko.com/slacko5.5/
    http://puppylinux.org/wikka/Puppy53
    http://www.puppylinux.org

    ReplyDelete
  5. Wont work, dispite with the hack mentioned above

    ReplyDelete
    Replies
    1. What won't work? Installing bankid? Opening bankid? Identifying yourself to your bank? Testing using test.bankid.com?

      And exactly what did you do?

      Delete
    2. Exactly what was recommended here, i've even added the hack Fred Finster WB7ODY recommended as well.

      The browser should have trigged the BankID software but, didn't.

      Delete
    3. Distro? Release? Any error messages at any point? What site failed to bring up bankid?

      Delete
    4. a) linux mint 15

      b) firefox 22.0, chromium

      c) no error messages, none. it just wont load

      d) sparbanken öresund, skatterverket, csn

      Delete
    5. Never tried it with chromium or mint 15 (which debian version is it comparable to?). I've tried it with iceweasel up to version 17, and I'm not sure what the highest version of firefox that I've used is.

      Anyway, the first step is to check about:plugins (see new image in post above) in iceweasel/ff to make sure that the plugin is properly installed.

      Delete
    6. That file doesn't exist in my system

      Delete
    7. What file? Be more specific.

      If you mean that nexus personal doesn't show as being installed, then you need to figure out where Mint keeps mozilla plugins.

      In case it's where it is supposed to be, does
      ls /usr/lib/mozilla/plugins/
      show
      npwrapper.libplugins.so?

      Delete
  6. As a reply to Lindquist reply from 20 july, 2013 12:06 on my comment from 15 July, 2013 00:26:


    No my npwrapper.libplugins.so doesn't show.

    ReplyDelete
    Replies
    1. So what happened when you ran

      sudo nspluginwrapper --install /usr/local/lib/personal/libplugins.so

      ?
      And
      nspluginwrapper -l
      ?

      You're running a 64 bit OS, right?

      Delete
    2. Yes I am running on a 64 bit OS

      Here is the output on the nspluginwrapper -l

      /usr/lib/mozilla/plugins/npwrapper.nppdf.so
      Original plugin: /opt/Adobe/Reader9/Browser/intellinux/nppdf.so
      Plugin viewer: /usr/lib/nspluginwrapper/i386/linux/npviewer
      Wrapper version string: 1.4.4-1


      By the way isn't your listed sudo command do more than just ask for my password?

      Delete
    3. Not sure what you mean by the 'sudo' command?
      This is a single command: "sudo nspluginwrapper --install /usr/local/lib/personal/libplugins.so"

      Delete
    4. At any rate, that is obviously the step that you haven't been able to get to work, and from your comment it seems like you may not have entered it correctly. Have a look at
      man nspluginwrapper
      to better understand what you are meant to do, and why.

      Delete
    5. IT FINALLY WORKS WOHOOO!!!!!!!!!!!

      Delete
    6. Good. Hope you learned a little bit about troubleshooting in the process :)

      Delete
  7. Hello. By following all the steps above I was able to make the BankID program appear on the right sites. I can see it in "about:plugins" page. It seems to be working. But, I can't get the "ID on file" from Swedbank. I go through the procedure, write a password and I get some sort of file on my computer, but it says "Certifikat saknas" in the BankID window, in the column "Giltigt till" where it should show a date. And it's unusable, of course. Importing my old certificate from Windows doesn't work either. "Persadm import" fails to import it without giving enough information why. I've also tried to copy the file with "cp -p". And it appears to work: I can see it in the BankID app, with the right date. But, when I try to use it I get the message that "Fel uppstod i det underliggande säkerhetssystemet" and a reference number.
    I'm using 64-bit Kubuntu 13.10 with Firefox. I also have Chromium installed but, unlike Firefox, Chromium fails to even start the BankID app.

    ReplyDelete
    Replies
    1. Since I don't have experience with Swedbank I don't know why it isn't working.

      If you have the possibility to request new IDs you might want to checkout fribid: http://fribid.se/index.en.html
      According to http://wiki.fribid.se/sidor/Banker_och_tj%C3%A4nster Swedbank should be ok

      Delete
    2. Thanks! Fribid worked. Mostly. I could request a new ID and I could use it on CSN. It didn't work in testing at test.bankid.com but this is unimportant, as long as it works elsewhere.

      Delete