FileZilla Server: Plugin Design: Difference between revisions

From The Uniform Server Wiki
Jump to navigation Jump to search
(New page: {{Uc nav FileZilla Server}} FileZilla Server plugin design for Uniform Server 3.5-Apollo Recently I had a requirement for a secure FTP server and decided to use FileZilla. Installed it as...)
 
m (Reverted edits by Upazixorys (Talk); changed back to last version by Ric)
 
(One intermediate revision by one other user not shown)
(No difference)

Latest revision as of 07:49, 24 November 2010

MPG UniCenter

MPG UniCenter

Uniform Server 3.5-Apollo
FileZilla Server.

FileZilla Server plugin design for Uniform Server 3.5-Apollo

Recently I had a requirement for a secure FTP server and decided to use FileZilla. Installed it as a service, worked fine and was relatively easy to set-up.

I was not to happy with it being installed as an auto-run service hence created two batch files, install-run and stop-uninstall. Originally I thought this server was only capable of running as a service however after looking at the source code discovered compatibly mode for Windows 95. This means it can be run as a standard program making it an ideal candidate for a Uniform Server plugin.

The following step-by-step guide explains how to convert FileZilla Server along with the problems encountered during this process.

Required files

Before a plugin can be created it is necessary to extract and isolate all the files. I use the following method install the program, copy all files to a temporary folder and uninstall the program.

Top

Method

Download the latest version from Server Download (version I used was FileZilla_Server-0_9_27.exe)

  1. Create a folder zilla_temp
  2. Copy FileZilla_Server-0_9_27.exe into folder zilla_temp
  3. To install double click on FileZilla_Server-0_9_27.exe
    1. Click "I Agree" to license
    2. Standard configuration is OK click Next
    3. Click "browse" and navigate to folder zilla_temp click next
    4. From the drop down menu select "Do not install as service, start server automatically (not recommended)" leave admin port set to 14147 click Next
    5. From drop down menu select "Start manually" leave “Start Interface after setup completes" checked, click Install.
    6. When “Installation complete” is displayed click Close
    7. When challenged by your Firewall allow to connect to Internet.
      Leave Server address 127.0.0.1 port 14147 unchanged.
      Set a password: root
      Leave "Always connect to this server" unchecked
      Click OK
      When Challenged allow connection to Internet.
      Note: Logged on indicates everything is working.
  4. Quit FileZilla server
  5. Create a new folder zilla_temp_2 copy the contents of folder zilla_temp\FileZilla Server to this new folder.
  6. Navigate to file Uninstall.exe (\zilla_temp\FileZilla Server) double click to run. This stops/uninstalls service and uninstalls FileZilla Server from your PC.

Top

Extracted files

Folder zilla_temp_2 contains the required files:

  • dbghelp.dll
  • FileZilla Server Interface.exe
  • FileZilla Server Interface.xml
  • FileZilla server.exe
  • FileZilla server.pdb
  • FileZilla Server.xml
  • FzGSS.dll
  • legal.htm
  • libeay32.dll
  • license.txt
  • readme.htm
  • ssleay32.dll
  • Uninstall.exe

Delete Uninstall.exe it’s not required.

Top

Running the server

At this stage you can run the server and check you can log on using the control interface.

  1. To start the server double click on FileZilla server.exe a pop-up is displayed with the option to install service click “Yes
  2. Click “NO” to auto-start service.
  3. Click “Yes” to start server. When challenged by your firewall allow connection to Internet
  4. To start the interface (admin) double click on FileZilla Server Interface.exe a pop-up is displayed “Connect to Server” click OK. This opens the interface window where you set-up the server.
    All we are interested in is the last line, which states “Logged on” confirming everything is working.
    Close this window using File > Quit.
  5. To stop the server double click on FileZilla server.exe, a pop-up is displayed with the option to “stop server” click “Yes

I think you will agree a toggle menu is a neat way to control the server however for a plugin I prefer to use batch files.

Top

Command line options

The server is controllable using a command line interface, available command line options are:

  • -start –stop
  • -install –uninstall
  • -compat
  • -reload-config

Of real importance is compat this is used for Windows 9x compatibility and allows the server to run as a standard program. It must be the first switch when using a command line.

The server can be started and stopped using the following command lines:

  • Start server as standard program: FileZilla server.exe /compat /start
  • Stop server standard program: FileZilla server.exe /compat /stop

Top

Service batch file

Before looking at a portable solution its worth testing the server running as a service under batch file control.

To test the concept create the following batch files and place them in folder zilla_temp_2.

Install and run - FileZillaFTP_start.bat

@echo off
echo FileZilla FTP Server is being installed ... 
"FileZilla Server.exe" /install
echo FileZilla FTP Server is starting ... 
"FileZilla Server.exe" /start
:pause

Stop and Uninstall - FileZillaFTP_stop.bat

@echo off
echo FileZilla FTP Server is being stopped ... 
"FileZilla Server.exe" /stop
echo FileZilla FTP Server is being unistalled ... 
"FileZilla Server.exe" /uninstall
:pause

FilezillaFTP_admin.bat

@echo off
echo Starting FileZilla admin ... 
"FileZilla Server Interface.exe"

Run the batch files and test the server; when you are finished remember to run FileZillaFTP_stop.bat otherwise the service remains installed. This is the reason for it not being a portable solution it has the potential to leave dross behind on a machine.

The standard program batch files resolves this issue.

Top

Standard program batch files

The following batch files offer a truly portable solution however there remains one problem to resolve.

When running a standard program from a batch file the command window remains open until that program (application) is closed. Apache is a classic example, to the rescue Uniform Server’s small utility program uniserv.exe this allows a program to run in hidden mode.

I want the plugin to be self-contained to achieve this copy file uniserv.exe into folder zilla_temp_2 it is used by filezila_start.bat and filezilla_admin_1.bat.

A side effect of running “FileZilla Server Interface.exe” with uniserv.exe is to hide the admin window, hence requires an additional trick. The trick is to run a second batch file that is hidden this hidden batch file runs “FileZilla Server Interface.exe”.

Place the following new batch files in folder zilla temp_2:

filezila_start.bat

@echo off
echo FileZilla FTP Server is starting ... 
start uniserv.exe "FileZilla Server.exe /compat /start"
:pause

filezila_stop.bat

@echo off
echo FileZilla FTP Server is being stopped ... 
"FileZilla Server.exe" /compat /stop
:pause

filezilla_admin.bat

@echo off
echo Starting FileZilla admin ... 
:start /min filezilla_admin_1.bat
start uniserv.exe filezilla_admin_1.bat
:Pause

filezilla_admin_1.bat

@echo off
echo Starting FileZilla admin ... 
"FileZilla Server Interface.exe"
exit

Note: The “exit” is required otherwise after closing the application the batch file window remains open.

Although the above batch files work its a proof of concept they need tweaking and along with FileZilla server integrating into Uniform Server’s file structure.

Top

Plugin

All that remains for a plugin is to add new batch files to folder “Uniform Server” and place FileZilla program files in an appropriate folder. In folder udrive I created a new folder named “filezilla_server” and copied all the files from zilla_temp_2. Tweaked the old batch files allowing them to be run from a remote location i.e new batch files in folder “Uniform Server”.

Top

Folder - Uniform Server

Add the following new batch files to folder Uniform Server:

filezila_start.bat

udrive\filezilla_server\filezilla_start.bat

filezila_stop.bat

udrive\filezilla_server\filezilla_stop.bat

filezilla_admin.bat

udrive\filezilla_server\filezilla_admin.bat

Batch files in folder filezilla_server require tweaking to run locally see below.

Top

Folder - filezilla_server

This folder contains the following files:

  • dbghelp.dll
  • FileZilla Server Interface.exe
  • FileZilla Server Interface.xml
  • FileZilla server.exe
  • FileZilla server.pdb
  • FileZilla Server.xml
  • FzGSS.dll
  • legal.htm
  • libeay32.dll
  • license.txt
  • readme.htm
  • ssleay32.dll
  • uniserv.exe
  • filezilla_start.bat
  • filezilla_stop.bat
  • filezilla_admin.bat
  • filezilla_admin_1.bat

The batch files are tweaked as follows:

filezilla_start.bat

@echo off
echo FileZilla FTP Server is starting ... 
pushd %~dp0
start uniserv.exe "FileZilla Server.exe /compat /start"
:pause
popd

filezilla_stop.bat

@echo off
echo FileZilla FTP Server is being stopped ... 
pushd %~dp0
"FileZilla Server.exe" /compat /stop
:pause
popd

filezilla_admin.bat

@echo off
echo Starting FileZilla admin ... 
pushd %~dp0
:start /min filezilla_admin_1.bat
start uniserv.exe filezilla_admin_1.bat
:Pause
popd

filezilla_admin_1.bat

@echo off
echo Starting FileZilla admin ... 
pushd %~dp0
"FileZilla Server Interface.exe"
popd
exit

Top

Download

Download the following file filezilla_server_plugin_design.exe from the Download and support page. Save it to folder Uniform Server.

Double click to extract the files no need to change the path. Once extracted if you wish to save space, delete file filezilla_server_plugin_design.exe

Top

Summary

I have shown design steps in producing the plugin some of the information may be of use. The next page covers FileZilla configuration.

Top


Ric