Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 148490 - net-misc/vpnc - patch to allow pcf2vpnc to handle enc_GroupPwd without using an external website
Summary: net-misc/vpnc - patch to allow pcf2vpnc to handle enc_GroupPwd without using ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Hanno Böck
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-09-21 04:00 UTC by Nathan Goldstick
Modified: 2006-10-28 15:13 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
The overlay I use to allow vpnc to decode the group password in a pcf file locally. (vpnc-overlay.tar.bz2,4.63 KB, application/x-bzip)
2006-09-21 04:02 UTC, Nathan Goldstick
Details
Makes pcf2vpnc decode the password locally. (vpnc-0.3.3-cisco-decrypt.patch,6.58 KB, patch)
2006-09-21 13:25 UTC, Nathan Goldstick
Details | Diff
changes vpnc-0.3.3-r1.ebuild to make it use the last patch (vpnc-0.3.3-r1.ebuild.patch,365 bytes, patch)
2006-09-21 13:42 UTC, Nathan Goldstick
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nathan Goldstick 2006-09-21 04:00:51 UTC
When running pcf2vpnc on a pcf file with an enc_GroupPwd entry, it sends it to http://www.unix-ag.uni-kl.de/~massar/bin/cisco-decode to be decoded. When visiting the site, one finds that http://www.unix-ag.uni-kl.de/~massar/soft/cisco-decrypt.c may be used to decode it locally, rather than sending it unencrypted across the internet. One can then compile cisco-decrypt, and modify pcf2vpnc to use it to decode the password locally.

I created an overlay does just this. It is currently posted at http://www.ucf.ics.uci.edu/~goldsticknt/gentoo/overlays/vpnc-overlay.tar.bz2. Unzip in ${PORTDIR_OVERLAY}/net-misc/. USE="cisco-decrypt" emerge vpnc installs vpnc with the patch, while USE="-cisco-decrypt" installs the same thing the default vpnc-0.3.3 ebuild does.
Comment 1 Nathan Goldstick 2006-09-21 04:02:16 UTC
Created attachment 97623 [details]
The overlay I use to allow vpnc to decode the group password in a pcf file locally.
Comment 2 Jakub Moc (RETIRED) gentoo-dev 2006-09-21 04:33:33 UTC
Absolute no clue what installs pcf2vpn. Reopen with ebuild name and version, and attach the files as plaintext, not tarballs.
Comment 3 Nathan Goldstick 2006-09-21 13:21:57 UTC
Knew I was forgetting something important (shrug)... pcf2vpnc is a perl script installed by the vpnc-0.3.3 ebuild

Currently, =net-misc/vpnc-0.3.3 is built by upzipping the vpnc-0.3.3.tar.gz tarball found at http://www.unix-ag.uni-kl.de/~massar/vpnc/vpnc-0.3.3.tar.gz, and running make. This is what the ebuild in the portage tree currently does. The next step would normally be run make install, but the ebuild apparantly does this itself.

This is taken from ${PORTDIR}/net-misc/vpnc/vpnc-0.3.3.ebuild:
src_install() {
        dobin vpnc vpnc-disconnect pcf2vpnc
        dodoc ChangeLog README TODO VERSION
        doman vpnc.8
        insinto /etc
        doins vpnc.conf
        exeinto /etc/vpnc
        doexe vpnc-script
        keepdir /var/run/vpnc
}

The first line of this function is what installs pcf2vpnc. It eventually finds its way from ${S}/pcf2vpnc to /usr/bin/pcf2vpnc.

This script is used to convert a pcf file intended for the cisco vpn client to a conf file suitable for vpnc. This is important because the pcf file includes all the information required to log onto a particular vpn - including the group password. It turns out that sometimes the group password is scrambled before it is written to the pcf. The decodePW function inside pcf2vpnc unscrambles this password, but currently does so by utilizing the cisco-decode website mentioned above. As the algorithm used to unscramble this password is publicly available, and the website is accessed via an unencrypted connection, the group password is sent across the internet cleartext. The user is warned about this, and has a chance to opt out. It seems that it might make more sense to just decode the password locally, and give the user the vpnc.conf file they are looking for.

This can be done with a few modifications. First, the source mentioned on the cisco-decode site mentioned above must be downloaded and compiled. It can then be installed in /usr/bin/cisco-decode. I currently use an overlay that does this by adding cisco-decode.c to ${S}. I then modify the Makefile by changing the following:
-all : vpnc
+all : vpnc cisco-decrypt
I also add the following line to the Makefile:
cisco-decrypt : cisco-decrypt.c
    $(CC) -o $@ $^ $(CFLAGS) $LDFLAGS)
For completeness, I also modify the install and install-strip targets, even though they apparantly arn't used by the ebuild.

pcf2vpnc must then be modified to use cisco-decrypt. The necessary changes are made to the decodePW function (It should be pretty obvious.)

All of the above changes are included in vpnc-0.3.3-cisco-decrypt.patch, which I will attach.

The only other change required to use this patch is in the ebuild itself. I added IUSE="cisco-decrypt" in the overlay I am using to make this optional on my system. First a few lines are added to src_unpack():

src_unpack() {
        unpack ${A}
        cd ${S}
        epatch ${FILESDIR}/vpnc-iproute-fix-2.diff
        # Workaround for crappy Makefile
        sed -i -e "s:CFLAGS=-W -Wall -O:CFLAGS=${CFLAGS}:" Makefile

+        # cisco-decrypt addition
+        if use cisco-decrypt ; then
+                epatch ${FILESDIR}/vpnc-0.3.3-cisco-decrypt.patch
+        fi
}

I then modify the dobin line in src_install:

src_install() {
-        dobin vpnc vpnc-disconnect pcf2vpnc
+        if use cisco-decrypt ; then
+                dobin vpnc vpnc-disconnect pcf2vpnc cisco-decrypt
+        else
+                dobin vpnc vpnc-disconnect pcf2vpnc
+        fi
        dodoc ChangeLog README TODO VERSION
Comment 4 Nathan Goldstick 2006-09-21 13:25:07 UTC
Created attachment 97692 [details, diff]
Makes pcf2vpnc decode the password locally.

This patch adds cisco-decode.c, and changes the Makefile so that it will be built (and would be installed if make install were executed).
Comment 5 Nathan Goldstick 2006-09-21 13:42:14 UTC
Created attachment 97694 [details, diff]
changes vpnc-0.3.3-r1.ebuild to make it use the last patch

Modifies ${PORTDIR}/net-misc/vpnc/vpnc-0.3.3-r1.ebuild to use vpnc-0.3.3-cisco-decrypt.patch
Comment 6 Hanno Böck gentoo-dev 2006-10-28 15:13:09 UTC
applied upstream and using now svn snap.