<blockquote>
  <p>solutions is: <strong>OpenConnect Plugin</strong> </p>
</blockquote>

<p>See here: <a href="https://wiki.jenkins.io/display/JENKINS/OpenConnect+Plugin" rel="nofollow noreferrer">https://wiki.jenkins.io/display/JENKINS/OpenConnect+Plugin</a></p>

<p>OR also you can use below method:</p>

<p>On Linux (Debian based)</p>

<pre><code>sudo apt-get install openconnect
</code></pre>

<p>Add the following lines to the bottom of /etc/sudoers (ubuntu configuration)</p>

<pre><code>jenkins ALL=NOPASSWD:/usr/sbin/openconnect*
jenkins ALL=NOPASSWD:/bin/kill*
</code></pre>

<p>Then you will get an option in the Jenkins run task called:</p>

<pre><code>Connect to Cisco AnyConnect VPN
</code></pre>

CC BY-SA 4.0
2019-05-31T10:33:30.163Z
It seems the `OpenConnect Plugin` was removed from Jenkins's plugin repository.
walnut_salami
CC BY-SA 4.0
2019-02-26T05:08:14.583Z
2019-02-26T05:08:14.583Z
Subhash
<p>Using Jenkins to create its own network paths is either clever or crazy. Right now I am leaning toward crazy, and trying to justify this reaction.</p>

<p>VPNs, particularly AnyConnect types, are normally maintained as infrastructure by network engineers and used for multiple uses. But it sounds like you want to deploy from inside your network to inside a customer network. Attaching a physical VPN between you is heavy-handed and likely to run into corporate road-blocks - if I've understood you correctly. Thinking of your problem as IoT causes me to suggest that you have your inside-customer device call up to the Cloud and pull down deployments, which you have staged in the Cloud. If your customer will give you an ingress port ( ours don't very often) you can have a two-way connection where the Cloud server pushes to the IoT device. But pull-only works well.</p>

<p>You can establish a VPN from your IoT device to the Cloud, and in fact, most today would demand that this connection be encrypted in some way.</p>

CC BY-SA 4.0
2019-02-26T00:31:44.697Z
2019-02-26T00:31:44.697Z
John Fisher
<p>I'm on a Windows Server and I want to have a pipeline project on Jenkins that basically does this:</p>

<ul>
<li>SVN update</li>
<li>Build</li>
<li>Deploy</li>
</ul>

<p>As the deploy target machine is on a different network, I want to know how to start a VPN connection before to do the deploy.</p>

<p>Note: My general goal is to automate deployment to a server in a VPN. Currently the VPN is Cisco AnyConnect.</p>

CC BY-SA 3.0
2018-02-07T11:49:45.437Z
Possible duplicate of [Jenkins job using VPN?](https://devops.stackexchange.com/questions/1818/jenkins-job-using-vpn)
storm
CC BY-SA 3.0
2018-02-07T11:52:27.300Z
This plugin may help you https://wiki.jenkins.io/display/JENKINS/OpenConnect+Plugin
storm
CC BY-SA 3.0
2018-02-07T11:57:50.740Z
I am using a Windows OS and this plugin is for Linux.
Guilherme Castro
CC BY-SA 3.0
2018-02-07T12:03:42.987Z
I can't help you'll probably have to make your own script to connect to the target and deploy directly
storm
CC BY-SA 3.0
2018-02-07T12:06:37.813Z
Is it possible to do that using another tool instead of jenkins ?
Guilherme Castro
CC BY-SA 3.0
2018-02-07T12:15:26.203Z
Don't know really .. can't you just connect with ssh instead of VPN ?
storm
CC BY-SA 3.0
2018-02-07T17:31:01.260Z
What is your reasoning for wanting to use a VPN? Are you blocked behind a firewall? Can you allow your remote machine to connect to Jenkins?
Preston Martin
CC BY-SA 3.0
2018-02-08T11:38:34.187Z
Because the deploy target machine is on a different network, which is private from a client, and I would like to directly deploy in their server.
Guilherme Castro
CC BY-SA 3.0
2018-02-09T12:27:35.173Z
A possible solution that I found is to create a .bat file to connect in VPN, after the Build and before the Deploy.
Guilherme Castro
<jenkins><deployment><jenkins-pipeline><vpn>
How to start a VPN connection using Jenkins?
Guilherme Castro
# How to start a VPN connection using Jenkins?

(Asked by: username_0 on 2018-02-07)

I'm on a Windows Server and I want to have a pipeline project on Jenkins that basically does this:

* SVN update
* Build
* Deploy

As the deploy target machine is on a different network, I want to know how to start a VPN connection before to do the deploy.

Note: My general goal is to automate deployment to a server in a VPN. Currently the VPN is Cisco AnyConnect.

**Tags:** jenkins, deployment, jenkins-pipeline, vpn

> **Comments:**
> **username_1**: Possible duplicate of [Jenkins job using VPN?](https://devops.stackexchange.com/questions/1818/jenkins-job-using-vpn)  
> **username_1**: This plugin may help you https://wiki.jenkins.io/display/JENKINS/OpenConnect+Plugin  
> **username_0**: I am using a Windows OS and this plugin is for Linux.  
> **username_1**: I can't help you'll probably have to make your own script to connect to the target and deploy directly  
> **username_0**: Is it possible to do that using another tool instead of jenkins ?  
> **username_1**: Don't know really .. can't you just connect with ssh instead of VPN ?  
> **username_2**: What is your reasoning for wanting to use a VPN? Are you blocked behind a firewall? Can you allow your remote machine to connect to Jenkins?  
> **username_0**: Because the deploy target machine is on a different network, which is private from a client, and I would like to directly deploy in their server.  
> **username_0**: A possible solution that I found is to create a .bat file to connect in VPN, after the Build and before the Deploy.  

---

## 2 answers

### Answer by username_3 on 2019-02-26. Score: 2

solutions is: OpenConnect Plugin 

See here: https://wiki.jenkins.io/display/JENKINS/OpenConnect+Plugin
OR also you can use below method:
On Linux (Debian based)
sudo apt-get install openconnect

Add the following lines to the bottom of /etc/sudoers (ubuntu configuration)
jenkins ALL=NOPASSWD:/usr/sbin/openconnect*
jenkins ALL=NOPASSWD:/bin/kill*

Then you will get an option in the Jenkins run task called:
Connect to Cisco AnyConnect VPN

> **Comments:**
> **username_4**: It seems the `OpenConnect Plugin` was removed from Jenkins's plugin repository.  

---

### Answer by username_5 on 2019-02-26. Score: 0

Using Jenkins to create its own network paths is either clever or crazy. Right now I am leaning toward crazy, and trying to justify this reaction.

VPNs, particularly AnyConnect types, are normally maintained as infrastructure by network engineers and used for multiple uses. But it sounds like you want to deploy from inside your network to inside a customer network. Attaching a physical VPN between you is heavy-handed and likely to run into corporate road-blocks - if I've understood you correctly. Thinking of your problem as IoT causes me to suggest that you have your inside-customer device call up to the Cloud and pull down deployments, which you have staged in the Cloud. If your customer will give you an ingress port ( ours don't very often) you can have a two-way connection where the Cloud server pushes to the IoT device. But pull-only works well.

You can establish a VPN from your IoT device to the Cloud, and in fact, most today would demand that this connection be encrypted in some way.


---

