Skip to content

Instantly share code, notes, and snippets.

@ptantiku
Created August 30, 2017 18:33
Show Gist options
  • Save ptantiku/9dbe2cf4645fce4e5904d573a3c56813 to your computer and use it in GitHub Desktop.
Save ptantiku/9dbe2cf4645fce4e5904d573a3c56813 to your computer and use it in GitHub Desktop.
Fix openconnect for when connecting to juniper web login, it cannot parse '<input type="username"' as a username field
  1. Download original code from Launchpad PPA openconnect/openconnect (https://code.launchpad.net/~openconnect/openconnect/trunk) using command
bzr branch lp:~openconnect/openconnect/trunk
  1. find auth-juniper.c and add code like this (this patch https://bugzilla.redhat.com/attachment.cgi?id=1239286&action=diff) from this bug report https://bugzilla.redhat.com/show_bug.cgi?id=1412021 by francois
 			ret = -ENOMEM;
 			goto out;
 		}
+	} else if (!strcasecmp(type, "username")) {
+		opt->type = OC_FORM_OPT_TEXT;
+		xmlnode_get_prop(node, "name", &opt->name);
+		if (asprintf(&opt->label, "%s:", opt->name) == -1) {
+			ret = -ENOMEM;
+			goto out;
+		}
 	} else if (!strcasecmp(type, "submit")) {
 		xmlnode_get_prop(node, "name", &opt->name);
 		if (opt->name && (!strcmp(opt->name, submit_button) ||
  1. compile and install
./autogen.sh
./configure
make
sudo make install
sudo cp .libs/libopenconnect*so* /usr/lib/x86_64-linux-gnu/
  1. run

4.1 if using Network Manager plugin (network-manager-openconnect) need to install package openconnect first (then delete the binary from /usr/sbin/openconnect) then do the make install again.

4.2. if run from command line, make install will put the binary in /usr/local/sbin/openconnect

sudo /usr/local/sbin/openconnect -v --juniper https://vpn.xxxxxxxxxxx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment