ftpmd5back is Open Source Software
Table of Contents
Foreword
1. How it works?
2. How do I know if my ftp server implements the command XMD5?
3. Config File
4. Command line parameters
5. Security
6. Examples
A. Changelog
ftpmd5back is a tool to make a backup of a local folder to a remote ftp
server folder.
ftpmd5backup, as the name suggests, is a tool that is used to make
backups of your files to an ftp server . In order to minimize resources
necessary for this operation, a file will be uploaded only if:
* on the ftp server there is no copy of the local file
* on the ftp server there is a copy of the local file, but it is not
the same as the local version.
To determine if the remote copy (the one on the ftp server ) is
identical to the current local file, ftpmd5back perform 2 tests:
* ftpmd5back compares the size of the files ( local and remote ): if
the sizes do not match then the local file will be uploaded
* in the case that the sizes are identical, ftpmd5back will perform
the md5 test between the 2 files: only when there isn't a md5
match, the file will be uploaded
To calculate md5 on remote copy, it uses the XMD5 ftp protocol command.
This means that not all ftp servers can be used with ftpmd5back but
probably your favorite ftp server already implements this command.
of course you can use your favourite ftp client but... ftpmd5back
implements a test that lets you know if an ftp server can answer to
XMD5 command, requesting directly to the server.
launching such
user@host$ ./ftpmd5back -util testftp -s ftp.remotehostname.it -u ftpuser -p secret_2_login
we get a ftp test, follow the results
Host: ftp.remotehostname.it User: ftpuser Port: 21 MultiFolder: FALSE Util: TESTFTP Testing ftp server... 0 Test start 0 send login request to ftp server 1039 Logged in 1039 change to remote folder 1088 remote folder found request ftp capabilities 214-Supported Commands : (* unimplemented) ABOR DELE MKD PWD SIZE USER ACCT* EPRT MODE QUIT SMNT* XMD5 ALLO EPSV NLST REIN SSCN XMKD APPE FEAT NOOP REST STAT XPWD CCC HELP PASS RETR STOR XRMD CDUP LIST PASV RMD STOU XSHA1 CLNT MDTM PBSZ RNFR STRU XCRC CPSV MFCT PORT RNTO SYST XCUP CWD MFMT PROT SITE TYPE XDEL SITE HELP SITE PSWD SITE ZONE 214 End. EUREKA: XMD5 command is implemented by this server: you can use ftpmd5back! 1138 send logout request to ftp server 1188 logged out! 1188 Test end Time: 1 seconds 188 milliseconds
We can test the login to the FTP server and get, at the same time
(using the ftp HELP command), the list of commands implemented on the
server. Usually if a command is not implemented will be displayed
followed by a star (''). Find XMD5 (and not 'XMD5 ') means that the
command works and that we can use ftpmd5back with this server.
ftpmd5back can be used both from the command line or with a
configuration file. Not all features of ftpmd5back are usable from the
command line but only the following:
* copy of a local folder (including all subfolders) on a remote
folder
Instead using the configuration file, you can:
* copy of a local folder (including all subfolders) on a remote
folder
* copy one or more files to various local folders on a remote folder
Usage: ftpmd5back [-util {testftp|createconf}] -s ftpserver [-t port] -u usernam e -p password -l localfolder -r remotefolder Parameters: -s ftp server name or IP address -t optional, port to connect to ftp server, if omitted default value is 21 -u user name needed to login to ftp server -p password -l local folder, source of backup -r remote folder, destination of backup, the folder MUST exists -v verbose mode 0 - verbose disabled (errors displayed) 1 - show processed files (default) 2 - show processed files and local/remote size/time/md5 9 - debug verbose mode -util use ftpmd5back utility testftp - test ftp connection createconf - creates a configuration file using other parameters
Since version 0.2 was introduced the possibility of encrypting the
password for the FTP server. Security is limited to storing encrypted
password on the hard disk (the data transmitted with the ftp protocol
are not encrypted).
The level of security provided has limitations due to the fact that it
is an open source tool, therefore, by examining the sources you can
find out how to decipher the password. However, there are some
suggestions (which will be given at the end of this explanation) to
make this system highly secure.
To encrypt the FTP user password, ftpmd5back uses a symmetric-key
encryption algorithm which is Blowfish algorithm. The key
(pass-phrase-A) is supplied by you.
Since ftpmd5back will be scheduled is necessary to access this
pass-phrase-A in order to decrypt the password of the ftp server. For
this reason, your pass-phrase-A will be encrypted (again with Blowfish)
but this time, symmetric key (pass-phrase-B) will be determined at
runtime by ftpmd5back.
Your pass-phrase-A, encrypted with the pass-phrase-B, will be stored in
a file "ftpmd5back.sec" (fullpath depends by your OS). To make it more
secure.
* Schedule ftpmd5back using root account (Administrator on Windows
OS): this is the most important guarantee
* make sure that only root (Administrator on Windows OS) has access
to the file that contains your encrypted pass-phrase: this means
that you will have to manually remove permissions for read/write
access to all other users
* If you absolutely need the highest possible safety: (1) download
ftpmd5back source code, (2) download free pascal compiler, (3)
change the pass-phrase-B in the source and (4) recompile your own
release of ftpmd5back. This will encrypt in your unique way.
Example 1: backup on linux
ftpmd5back -s ftp.remotehost.org -t 21 -u username -p password -l
"/home/username/Desktop/COMPITI DI MATEMATICA" -r
/ftp.remotehost.org/backup/USERNAME
Example 2: backup on Windows
ftpmd5back.exe -s ftp.remotehost.org -t 21 -u username -p password -l
"C:\Users\USERNAME\Desktop\COMPITI DI MATEMATICA" -r
/ftp.remotehost.org/backup/USERNAME
* 0.2.3 fix VerboseLevel code; fix statistics * 0.2.2 added statistics for second attempt * 0.2.1 added second attempt on upload failed * 0.2.0 implementation of security: (1) ftpmd5back-pass-phrase to encrypt user-pass-phrase (2) user-pass-phrase to encrypt ftp-password * 0.1.7 code stabilization, out of beta phase * 0.1.6 removed older code bugfix: local folder now is not required * 0.1.5 added statistics * 0.1.0 first commit