Monday, December 5, 2011

Using junipernc script under Ubuntu 11.10.

Getting the the Juniper Network connect client to work under Ubuntu can be a bit of a challenge. I learned quite a while ago that it requires the Sun / Oracle versions of Java, openJDK will not work. If you try using the openJDK Java you will quickly see the “Session Timeout” error when connecting.

With previous versions of Ubuntu I simply installed the sun jvm from the repositories and reconfigured the system to use it rather then openjdk. However, Oracle has decided to change the licencing requirements and newer versions of Java are no longer available in the repositoy. Now I could manually download and install the Oracle Java for the entire system to use, but then I’d have to manually keep it updated. I much prefer letting the package manger handle updates (so they actually get done).

My solution this problem is to setup a dedicated Oracle Java install that is only used by Network Connect. As an added benefit it uses the junipernc script, which in my opinion is much easier to use.


Here is what you need to do:

  1. Download and save the junipernc script.
  2. I like to put it in ~/bin. Don't forget to make it executable.
    mv ~/Downloads/junipernc ~/bin
    chmod +x ~/bin/junipernc
  3. Browse to your company vpn site and log in. (no need to install the correct java first) Click “allow” any any warnings and ctrl-c when it asks for the root password. This will download the files into the ~/.juniper_networks folder.
  4. Download the Oracle jdk .bin installer. Make it executable and execute to extract the files. Move the jdk directory to the .juniperNetwork
    chmod +x ~/Downloads/jdk-6u29-linux-i586.bin
    ~/Downloads/jdk-6u29-linux-i586.bin
    mv jdk1.6.0_29/ ~/.juniper_networks/
  5. Temporally update the PATH and run .junipernc for the first time.
    export PATH=~/.juniper_networks/jdk1.6.0_29/bin/:$PATH
    ~/bin/junipernc
  6. You should get a notice that initial setup requires administrative privileges. Enter your password several times Enter your server name, user name and realm. ( check out Issue #2 on this blog entry to determine your realm) Enter your password or securid/pin.
Why this works
In step 4 we temporally added the path to the downloaded Oracle Java install BEFORE the existing path. The junipernc script finds the Oracle Java version first and uses it (because it’s first in the path). This allows us to connect and all is good with the world. The junipernc script also writes the path to java in the ~/.vpn.default.cfg file. On subsequent execution of junipernc it uses the path in the cfg file.

Note:  None of this would be possible without the junipernc script developed by Paul D. Smith. Please check out his site (http://mad-scientist.us/juniper.html) for more information.

3 comments:

  1. Hey I tried the steps given by you exactly.
    But the problem is my firefox crashes when i click on the start button on the vpn page.

    The thing is there is nothing in the .juniper_networks directory. firefox crashes before even downloading the jar file or it does not download it.. Please help me

    ReplyDelete
  2. I tried with google chrome... now google chrome downloads the necessary files and now the junipernc script works perfectly...

    Thanks for the great post bro..

    ReplyDelete
  3. Did something slightly different in a 64 bit machine running Ubuntu 11.10 and 64 bit java:

    1. Went to my organization site, logged into the VPN as described above, let the software download, exited when it asked me for password as described above.

    2. Downloaded the Java SE Development Kit from the link above to a temp directory, but there is no more .bin file. I therefore downloaded the 32 bit jdk-XXXXX-linux-i586.tar.gz where "XXXXX" is the current version. Moved the directory to ~/.juniper_networks directory created above.

    3. Downloaded the junipernc script, moved the script to ~/bin. Opened the script and changed the export JDK_HOME line to:

    export JDK_HOME=~/.juniper_networks/jdkXXXXXX/bin

    where again, XXXXXX is the version of the jdk downloaded from oracle.

    4. started junipernc from the console, it works.

    ReplyDelete