1

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");
}
Callum Watkins
  • 2,844
  • 4
  • 29
  • 49
StanB1234
  • 11
  • 2

1 Answers1

0

In order to authenticate to the firewall, it must be configured from Fortinet GUI or CLI, adding the user group and adding the user in question; then the socket should automatically connect using the firewall configuration.

xaskasdf
  • 46
  • 3