Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Globalprotect VPN batch file or C# code

Hi I am trying to connect to a VPN network using GlobalProtect VPN client. I can do that using the UI but I would like this to be automated. In another project where I was using Sonicwall Netextender, I created a batch file which I was calling from my C# code so I would connect to a VPN by calling the batch file, do some operations and disconnect using another batch file. I am trying to find a similar way to achieve it using Globalprotect. The command line arguments which I was using with Netextender does not seem to work with the PanGPA.exe. Any ideas how I could do that? I am not having any luck with the batch file so far. The netextender batch file is:

cd c:\Program Files (x86)\SonicWALL\SSL-VPN\NetExtender\
NECLI connect -s 122.254.213.256 -d DNAME -u UNAME -p PASSWORD
like image 839
man_luck Avatar asked Jan 04 '16 16:01

man_luck


2 Answers

Update: just use OpenConnect v8.00 or newer. GlobalProtect support has been incorporated into the "official" OpenConnect builds as of v8.00. So GP support will Just Work™ with a recent official build.

———

You cannot do this with the official GP client. However, I have recently extended the fantastic open-source VPN client OpenConnect to support the PAN GlobalProtect VPN, both in its SSL-VPN and IPsec/ESP modes. It acts just like a native client and you can run it from the command line in a fully automated manner.

This is a work in progress, but I've been using it for real work already and it works very well for me. Having other people test it would be awesome and I welcome your feedback!

You'll need to build the globalprotect branch from this repository: https://github.com/dlenski/openconnect

... and then run it like this to test it (you can omit the --certificate part if your VPN doesn't use a client certificate):

echo password | openconnect --user username --passwd-on-stdin \
              --protocol=gp [--certificate=my_cert_with_pk.pem] \
              gp-gateway-server.company.com --dump -vvv

(I have not yet tested this build under Windows, but the official OpenConnect builds are all Windows-compatible and there is nothing particularly special about this one.)

like image 58
Dan Lenski Avatar answered Oct 16 '22 05:10

Dan Lenski


There is no such automation possible with globalprotect VPN client

like image 32
man_luck Avatar answered Oct 16 '22 05:10

man_luck