Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connect to http server behind vpn with java

Tags:

java

servlets

vpn

I would like to connect to an REST Web Service through a VPN. Is there a way in Java to establish an pptp, l2tp ipsec connection to the VPN gateway an tunnel the HTTP request, without using the Operation System functions? This is important because I will connected to several rest services from a servlet. This Services could be behind different VPNs and I do not want to connect the network of the server with this VPNs.

Do anyone know about an API for that?

like image 547
Tobias Varlemann Avatar asked Jul 27 '26 15:07

Tobias Varlemann


2 Answers

If you want to connect to a server behind a private VPN, from the outside, nothing you can do on you app can/will allow you to do connect. Unless you launch a VPN client and programmatically connect your network, to that VPN server, your java app will just sit there waiting for a socket on http connect.

Your question is technically incorrect (not from the SO point of view).

Look for a VPN client library that will pop up a dialog and take username/pwd.

like image 143
Siddharth Avatar answered Jul 30 '26 06:07

Siddharth


A VPN has the purpose of connecting networks. If you want to reach another system via a VPN you will have to establish a network connection.

a Java API for all of this protocols will be (nearly) impossible, since VPN is handled by OS drivers and not on the application level (where java has its place) in most cases.

If you don't want to have your physical server being connected with those VPNs, you could perhaps set up a virtual system with virtualbox or vmware (or others) which handles all those connections and use it as a proxy. But this is no java issue than.

like image 45
mschenk74 Avatar answered Jul 30 '26 05:07

mschenk74



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!