Start a Single Tunnel#

The CrushTunnel process can be integrated into an existing workflow using a standalone machine acting as the tunnel provider, or programmatically through your own code. CrushTunnel.jar can be found in the CrushFTP WebInterface folder.

Here is a stand alone example (one long line):

java -cp CrushTunnel.jar com.crushftp.tunnel2.Tunnel2 protocol=https port=443 username=demo password=demo

That command would start the tunnel and make it a FTP server handling requests that ultimately ended up going through the tunnel and to the main CrushFTP server on the other side. You can control the port ranges for PASV, and the IP that is given to the FTP clients for PASV mode. The tunnel goes over HTTPS, so everything is encrypted between CrushTunnel and the server.

Start a Tunnel in Code#

To programmatically start the tunnel, include the CrushTunnel.jar file, and do something similar to the following:
com.crushtunnel.gui.Common.trustEverything(); //ignore SSL validation issues…bad for prod use
com.crushftp.tunnel2.Tunnel2 t = new com.crushftp.tunnel2.Tunnel2("", "demo", "demo", false);
//tunnel is now open and ready.  Connections to it over FTP on will be proxied securely through the tunnel to the CrushFTP FTP server side.

//to stop it later on

Install as a Service on Windows for an Always on Tunnel#

Here is another example for installing the tunnel as a service on Windows. First, make sure you have CrushFTP installed as a service on windows. You need this as we need the "service" folder that this creates. Copy this service folder somewhere else and call it "CrushTunnel". For my example, I put this in my program files folder.

Now edit the wrapper.conf file to make it have these contents, with adjustments to the bottom part which applies to your server.\\Program Files (x86)\\Java\\jre6\\bin\\java
wrapper.working.dir=C:\\Program Files (x86)\\CrushTunnel\\



Now you can test this config from the DOS prompt, or install the service.

java -jar wrapper.jar -c wrapper.conf
java -jar wrapper.jar -i wrapper.conf
java -jar wrapper.jar -r wrapper.conf

(If installing the service, your DOS prompt needs to be running as an administrator.)

Command Line JNLP Launch
You could also launch a specific tunnel from the command line using Java WebStart.
<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="">
		<vendor>Ben Spink</vendor>
		<shortcut online="true">
		<j2se version="1.2+" /><jar href="/WebInterface/CrushTunnel.jar"/>
	<application-desc main-class="com.crushftp.tunnel2.Tunnel2">

Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-7) was last changed on 09-Oct-2016 18:14 by Ben Spink
G’day (anonymous guest)

Referenced by

JSPWiki v2.8.2