VPNC for OpenSolaris

I’ve compiled VPNC and the requisite TUN/TAP driver for OpenSolaris so that I can access my work network from home. Kazuyoshi’s driver adds TAP functionality to the original TUN driver which hasn’t been updated in nine years. It’s a real testament to the stability of the OpenSolaris kernel ABI that the module still compiles, loads, and works properly.

All of the software can be installed from my repository onto build 111 or higher:

$ pfexec pkg set-publisher -O http://pkg.thestaticvoid.com/ thestaticvoid
$ pfexec pkg install vpnc

The tun driver should load automatically and create /dev/tun. Now create a VPN profile configuration in /etc/vpnc/. The configuration contains a lot of private information so I’m not going to share mine here, but /etc/vpnc/default.conf is a good start.

One thing I do like to do is make sure only certain subnets are tunneled through the VPN. That way connecting to the VPN doesn’t interrupt any connections that are already established (for example, AIM). To do that I create a script /etc/vpnc/gwu-networks-script containing

#!/bin/sh

# Only tunnel GWU networks through VPN
CISCO_SPLIT_INC=2
CISCO_SPLIT_INC_0_ADDR=161.253.0.0
CISCO_SPLIT_INC_0_MASK=255.255.0.0
CISCO_SPLIT_INC_0_MASKLEN=16
CISCO_SPLIT_INC_0_PROTOCOL=0
CISCO_SPLIT_INC_0_SPORT=0
CISCO_SPLIT_INC_0_DPORT=0
CISCO_SPLIT_INC_1_ADDR=128.164.0.0
CISCO_SPLIT_INC_1_MASK=255.255.0.0
CISCO_SPLIT_INC_1_MASKLEN=16
CISCO_SPLIT_INC_1_PROTOCOL=0
CISCO_SPLIT_INC_1_SPORT=0
CISCO_SPLIT_INC_1_DPORT=0

. /etc/vpnc/vpnc-script

then add Script /etc/vpnc/gwu-networks-script to the end of my VPN profile configuration.

Connecting to the VPN you should see messages like:

$ pfexec vpnc gwu
Enter password for jameslee@<no>: 
which: no ip in (/sbin:/usr/sbin:/usr/gnu/bin:/usr/bin:/usr/sbin:/sbin)
which: no ip in (/sbin:/usr/sbin:/usr/gnu/bin:/usr/bin:/usr/sbin:/sbin)
add net 128.164.<no>: gateway 128.164.<no>
add host 128.164.<no>: gateway 161.253.<no>
add net 161.253.0.0: gateway 128.164.<no>
add net 128.164.0.0: gateway 128.164.<no>
add net 128.164.<no>: gateway 128.164.<no>
add net 128.164.<no>: gateway 128.164.<no>
VPNC started in background (pid: 594)...

The vpnc-script will modify your /etc/resolv.conf and routing tables so be sure to run vpnc-disconnect when you are done with the connection to restore the original configuration.

Thanks to the good folks at OpenConnect for a well-maintained vpnc-script which works on Solaris. Spec files for these packages are available from my GitHub repository if you want to roll your own.

3 thoughts on “VPNC for OpenSolaris

  1. Thanks so much! I had already compiled and installed vpnc but I couldn’t find a vpnc-script that actually worked until I came here.

    Thanks 🙂

  2. I tried to install vpnc (and tun/tap) on my laptop running Oracle Solaris 11 11/11 but I encountered some problems related to ownership, can you modify the packages?

    Many many thanks in advance …..

    Preparing…
    Gathering package information

    Error:
    The requested change to the system attempts to install multiple actions
    for dir ‘usr/share/man/man8’ with conflicting attributes:

    1 package delivers ‘dir group=sys mode=0755 owner=root path=usr/share/man/man8’:
    pkg://thestaticvoid/vpnc@0.5.3.457,5.11-0.134:20110411T232255Z
    10 packages deliver ‘dir group=bin mode=0755 owner=root path=usr/share/man/man8’, including:
    pkg://solaris/data/sgml-common@0.6.3,5.11-0.175.0.5.0.4.0:20120306T221345Z
    pkg://solaris/desktop/administration/gparted@0.4.5,5.11-0.175.0.0.0.0.0:20110927T082039Z
    pkg://solaris/library/security/trousers@0.3.6,5.11-0.175.0.0.0.2.537:20111019T105635Z
    pkg://solaris/media/cdrtools@3.0,5.11-0.175.0.0.0.2.537:20111019T110020Z
    pkg://solaris/print/cups@1.4.5,5.11-0.175.0.0.0.2.537:20111019T110834Z

    These packages may not be installed together. Any non-conflicting set may
    be, or the packages must be corrected before they can be installed.

    The requested change to the system attempts to install multiple actions
    for dir ‘usr/share/man/man1’ with conflicting attributes:

    1 package delivers ‘dir group=sys mode=0755 owner=root path=usr/share/man/man1’:
    pkg://thestaticvoid/vpnc@0.5.3.457,5.11-0.134:20110411T232255Z
    192 packages deliver ‘dir group=bin mode=0755 owner=root path=usr/share/man/man1’, including:
    pkg://solaris/archiver/gnu-tar@1.26,5.11-0.175.0.0.0.2.537:20111019T091116Z
    pkg://solaris/audio/audio-utilities@0.5.11,5.11-0.175.0.0.0.2.1:20111019T052755Z
    pkg://solaris/codec/flac@1.2.1,5.11-0.175.0.0.0.0.0:20110927T080937Z
    pkg://solaris/codec/speex@1.2,5.11-0.175.0.0.0.0.0:20110927T081129Z
    pkg://solaris/communication/im/pidgin@2.10.0,5.11-0.175.0.0.0.0.0:20110927T081624Z

    These packages may not be installed together. Any non-conflicting set may
    be, or the packages must be corrected before they can be installed.

    The requested change to the system attempts to install multiple actions
    for dir ‘usr/bin’ with conflicting attributes:

    1 package delivers ‘dir group=sys mode=0755 owner=root path=usr/bin’:
    pkg://thestaticvoid/vpnc@0.5.3.457,5.11-0.134:20110411T232255Z
    233 packages deliver ‘dir group=bin mode=0755 owner=root path=usr/bin’, including:
    pkg://solaris/archiver/gnu-tar@1.26,5.11-0.175.0.0.0.2.537:20111019T091116Z
    pkg://solaris/audio/audio-utilities@0.5.11,5.11-0.175.0.0.0.2.1:20111019T052755Z
    pkg://solaris/codec/flac@1.2.1,5.11-0.175.0.0.0.0.0:20110927T080937Z
    pkg://solaris/codec/speex@1.2,5.11-0.175.0.0.0.0.0:20110927T081129Z
    pkg://solaris/communication/im/pidgin@2.10.0,5.11-0.175.0.0.0.0.0:20110927T081624Z

    These packages may not be installed together. Any non-conflicting set may
    be, or the packages must be corrected before they can be installed.

    The requested change to the system attempts to install multiple actions
    for dir ‘usr/share/man’ with conflicting attributes:

    1 package delivers ‘dir group=sys mode=0755 owner=root path=usr/share/man’:
    pkg://thestaticvoid/vpnc@0.5.3.457,5.11-0.134:20110411T232255Z
    207 packages deliver ‘dir group=bin mode=0755 owner=root path=usr/share/man’, including:
    pkg://solaris/archiver/gnu-tar@1.26,5.11-0.175.0.0.0.2.537:20111019T091116Z
    pkg://solaris/codec/flac@1.2.1,5.11-0.175.0.0.0.0.0:20110927T080937Z
    pkg://solaris/codec/libtheora@1.1.1,5.11-0.175.0.0.0.0.0:20110927T081013Z
    pkg://solaris/codec/ogg-vorbis@2.30.0,5.11-0.175.0.0.0.0.0:20110927T081051Z
    pkg://solaris/codec/speex@1.2,5.11-0.175.0.0.0.0.0:20110927T081129Z

    These packages may not be installed together. Any non-conflicting set may
    be, or the packages must be corrected before they can be installed.

    The requested change to the system attempts to install multiple actions
    for dir ‘usr/sbin’ with conflicting attributes:

    1 package delivers ‘dir group=sys mode=0755 owner=root path=usr/sbin’:
    pkg://thestaticvoid/vpnc@0.5.3.457,5.11-0.134:20110411T232255Z
    63 packages deliver ‘dir group=bin mode=0755 owner=root path=usr/sbin’, including:
    pkg://solaris/crypto/gnupg@2.0.17,5.11-0.175.0.0.0.2.537:20111019T091450Z
    pkg://solaris/desktop/administration/gparted@0.4.5,5.11-0.175.0.0.0.0.0:20110927T082039Z
    pkg://solaris/diagnostic/cpu-counters@0.5.11,5.11-0.175.0.3.0.1.1:20111208T161340Z
    pkg://solaris/diagnostic/snoop@0.5.11,5.11-0.175.0.5.0.2.1:20120224T171524Z
    pkg://solaris/diagnostic/spray@0.5.11,5.11-0.175.0.0.0.2.1:20111019T054309Z

    These packages may not be installed together. Any non-conflicting set may
    be, or the packages must be corrected before they can be installed.

    • It is exactly the same as Massimiliano,

      Can you help me with this …

      root@laptop-jb:~# pkg install vpnc
      Creating Plan |
      pkg install: The requested change to the system attempts to install multiple actions
      for dir ‘usr/share/man/man8’ with conflicting attributes:

      1 package delivers ‘dir group=sys mode=0755 owner=root path=usr/share/man/man8’:
      pkg://thestaticvoid/vpnc@0.5.3.457,5.11-0.134:20110411T232255Z
      11 packages deliver ‘dir group=bin mode=0755 owner=root path=usr/share/man/man8’, including:
      pkg://solaris/data/sgml-common@0.6.3,5.11-0.175.0.5.0.4.0:20120306T221345Z
      pkg://solaris/desktop/administration/gparted@0.4.5,5.11-0.175.0.0.0.0.0:20110927T082039Z
      pkg://solaris/library/security/trousers@0.3.6,5.11-0.175.0.0.0.2.537:20111019T105635Z
      pkg://solaris/media/cdrtools@3.0,5.11-0.175.0.0.0.2.537:20111019T110020Z
      pkg://solaris/print/cups@1.4.5,5.11-0.175.0.0.0.2.537:20111019T110834Z

      These packages may not be installed together. Any non-conflicting set may
      be, or the packages must be corrected before they can be installed.

      The requested change to the system attempts to install multiple actions
      for dir ‘usr/share/man/man1’ with conflicting attributes:

      1 package delivers ‘dir group=sys mode=0755 owner=root path=usr/share/man/man1’:
      pkg://thestaticvoid/vpnc@0.5.3.457,5.11-0.134:20110411T232255Z
      199 packages deliver ‘dir group=bin mode=0755 owner=root path=usr/share/man/man1’, including:
      pkg://solaris/archiver/gnu-tar@1.26,5.11-0.175.0.0.0.2.537:20111019T091116Z
      pkg://solaris/audio/audio-utilities@0.5.11,5.11-0.175.0.0.0.2.1:20111019T052755Z
      pkg://solaris/codec/flac@1.2.1,5.11-0.175.0.0.0.0.0:20110927T080937Z
      pkg://solaris/codec/speex@1.2,5.11-0.175.0.0.0.0.0:20110927T081129Z
      pkg://solaris/communication/im/pidgin@2.10.0,5.11-0.175.0.0.0.0.0:20110927T081624Z

      These packages may not be installed together. Any non-conflicting set may
      be, or the packages must be corrected before they can be installed.

      The requested change to the system attempts to install multiple actions
      for dir ‘usr/bin’ with conflicting attributes:

      1 package delivers ‘dir group=sys mode=0755 owner=root path=usr/bin’:
      pkg://thestaticvoid/vpnc@0.5.3.457,5.11-0.134:20110411T232255Z
      238 packages deliver ‘dir group=bin mode=0755 owner=root path=usr/bin’, including:
      pkg://solaris/archiver/gnu-tar@1.26,5.11-0.175.0.0.0.2.537:20111019T091116Z
      pkg://solaris/audio/audio-utilities@0.5.11,5.11-0.175.0.0.0.2.1:20111019T052755Z
      pkg://solaris/codec/flac@1.2.1,5.11-0.175.0.0.0.0.0:20110927T080937Z
      pkg://solaris/codec/speex@1.2,5.11-0.175.0.0.0.0.0:20110927T081129Z
      pkg://solaris/communication/im/pidgin@2.10.0,5.11-0.175.0.0.0.0.0:20110927T081624Z

      These packages may not be installed together. Any non-conflicting set may
      be, or the packages must be corrected before they can be installed.

      The requested change to the system attempts to install multiple actions
      for dir ‘usr/share/man’ with conflicting attributes:

      1 package delivers ‘dir group=sys mode=0755 owner=root path=usr/share/man’:
      pkg://thestaticvoid/vpnc@0.5.3.457,5.11-0.134:20110411T232255Z
      214 packages deliver ‘dir group=bin mode=0755 owner=root path=usr/share/man’, including:
      pkg://solaris/archiver/gnu-tar@1.26,5.11-0.175.0.0.0.2.537:20111019T091116Z
      pkg://solaris/codec/flac@1.2.1,5.11-0.175.0.0.0.0.0:20110927T080937Z
      pkg://solaris/codec/libtheora@1.1.1,5.11-0.175.0.0.0.0.0:20110927T081013Z
      pkg://solaris/codec/ogg-vorbis@2.30.0,5.11-0.175.0.8.0.2.0:20120519T001723Z
      pkg://solaris/codec/speex@1.2,5.11-0.175.0.0.0.0.0:20110927T081129Z

      These packages may not be installed together. Any non-conflicting set may
      be, or the packages must be corrected before they can be installed.

      The requested change to the system attempts to install multiple actions
      for dir ‘usr/sbin’ with conflicting attributes:

      1 package delivers ‘dir group=sys mode=0755 owner=root path=usr/sbin’:
      pkg://thestaticvoid/vpnc@0.5.3.457,5.11-0.134:20110411T232255Z
      66 packages deliver ‘dir group=bin mode=0755 owner=root path=usr/sbin’, including:
      pkg://solaris/crypto/gnupg@2.0.17,5.11-0.175.0.0.0.2.537:20111019T091450Z
      pkg://solaris/desktop/administration/gparted@0.4.5,5.11-0.175.0.0.0.0.0:20110927T082039Z
      pkg://solaris/diagnostic/cpu-counters@0.5.11,5.11-0.175.0.9.0.5.1:20120705T180853Z
      pkg://solaris/diagnostic/snoop@0.5.11,5.11-0.175.0.5.0.2.1:20120224T171524Z
      pkg://solaris/diagnostic/spray@0.5.11,5.11-0.175.0.0.0.2.1:20111019T054309Z

      These packages may not be installed together. Any non-conflicting set may
      be, or the packages must be corrected before they can be installed.

Leave a Reply to Pily Botello Cancel reply