I'm trying to create an SSL VPN connection to a Fortinet firewall with Java.
To build up a socket connection in Java is not a problem, but how do I authenticate to the firewall and create the VPN tunnel? Unfortunately, I haven't found any tutorials. Maybe someone can help me with that.
public static void main(String[] args) throws IOException {
String vpnHost = "fortigateVPNHost";
int vpnPort = 443;
String vpnUser = "vpnUser";
String vpnPassword = "vpnPassword";
SSLSocketFactory sslsocketfactory = (SSLSocketFactory) SSLSocketFactory.getDefault();
SSLSocket sslsocket = (SSLSocket) sslsocketfactory.createSocket(vpnHost, vpnPort);
InputStream in = sslsocket.getInputStream();
OutputStream out = sslsocket.getOutputStream();
while (in.available() > 0) {
System.out.print(in.read());
}
System.out.println("Secured connection performed successfully");
}