Name: Bo Bayles (bmb3h6@mst.edu) Assignment: CS285 SS08 FTP Project Data: 24 April, 2008 ------------------------------------------------------------------------------- The files "client.cpp" and "server.cpp" are the source code files for an FTP client/server pair. --COMPILATION-- To compile both the client and server, navgiate to the "source" directory and execte: make To compile the client, execute: g++ client.cpp -o client To compile the server, execute: g++ server.cpp -o server --EXECUTION-- The server executable must run in the same directory as "db.txt", its username/password database. When it is compiled, start the server with the command: ./server --PASSWORD DATABASE-- The server requires a text file called "db.txt". The format of this username/ password database is simply: user1 password1 user2 password2 A future revision of this program could encrypt the database and use a salt to thwart dictionary attacks. --USAGE-- When it is compiled, and when the server is running, start the client with the command: ./client hostname 2221 localDir remoteDir where "hostname" is the hostname or IP address of the server, "localDir" is the directory in which files from the server will be saved, and "remoteDir" is the directory within the server directory from which files will be downloaded. "localDir" must be present for the download to work. A future revision of this program could create this directory if it does not exist. The program will prompt for a username and password. The pair must match one in the server's "db.txt". After logging in, the user may issue the PORT or QUIT commands. Issue the PORT command to establish a connection for file transfer with the server. After issuing PORT, the RETR command becomes available. Issue: RETR filename where "filename" is the name of a file in the directory specified in "remoteDir" above. If the file is present in the server's "remoteDir", the server will transfer the file and break the connection. If it is not, an error message will be returned. A future revision of this program could allow for the client to query the server for a list of available files. After RETR completes, PORT may be re-issued for another RETR transaction, or QUIT may be issued to cause the client to disconnect and terminate. To terminate the server, issue Ctrl+C. The server will intercept the signal, shut down the active connections, then terminate. --ENCRYPTION-- This program assumes that either both the client and server have OpenSSL installed or that both of them don't. If OpenSSL is installed on both, the transmission of the password from the client to the server during login and the transmission of data from the server to the client during file transfer will be encrypted using OpenSSL's encryption function with the DES3 algorithm. If OpenSSL is installed on neither, the transnmissions will not be encrypted. If OpenSSL is installed on one, but not the other, login will fail and the programs won't work together. A future revision of this program could detect the presence of OpenSSL and turn on/off encryption accordingly. --SAMPLE SETUP-- The .tar file you have just decompressed has created the necessary file structure for a sample run. The server is executed from "serverdir" and the client from "clientdir". Execute the server with the command "./server" and the client with the command "./client rc13cslinux 2221 served downloads". but replace "rc13cslinux" with the hostname of the machine where the server is. Using the client, when prompted, enter a username/password pair present in db.txt. For example, "Bo" and "pass" are a valid combination. Using the client, issue "PORT" to set up a data connection with the server. Then issue the command "RETR file1.txt". If file1.txt is present in the server's "served" directory, it will be encrypted and transmitted to the client. The encrypted file will be decrypted and stored as "file1.txt" in the the "downloads" subdirectory of the client's directory. Issue "QUIT" to disconnect from the server and exit the client. Using the server, issue Ctrl+C to start the shutdown process.