PDA

View Full Version : secure way to upload files to webserver



arthurprs
26-12-2008, 03:26 AM
On the end of the session in my app i have to upload some 100~200kb files to a webserver,

im currently using ftp, but using ftp is 100% unsecure, since with a simple packet sniffer someone can get the login details and hack me ;\

someone can help me?

thanks,
Arthur.

noeska
26-12-2008, 07:59 AM
do some investigation in ssh ( http://en.wikipedia.org/wiki/Secure_Shell ) and sftp ( http://en.wikipedia.org/wiki/SSH_file_transfer_protocol ) or even better scp ( http://en.wikipedia.org/wiki/Secure_copy ) For scp there is also a grapical version: ( http://en.wikipedia.org/wiki/WinSCP )

JernejL
26-12-2008, 11:21 AM
create a separate account for ftp which only has access to specific directory, and chmod and chown the dir properly, also i suggest you dont make the dir availible thru webserver to public and you limit what file extensions someone can upload in ftp server.

arthurprs
27-12-2008, 03:38 PM
do some investigation in ssh ( http://en.wikipedia.org/wiki/Secure_Shell ) and sftp ( http://en.wikipedia.org/wiki/SSH_file_transfer_protocol ) or even better scp ( http://en.wikipedia.org/wiki/Secure_copy ) For scp there is also a grapical version: ( http://en.wikipedia.org/wiki/WinSCP )
Any library that i can use one of those protocols with pascal? :)


create a separate account for ftp which only has access to specific directory, and chmod and chown the dir properly, also i suggest you dont make the dir availible thru webserver to public and you limit what file extensions someone can upload in ftp server.
I searched on my webserver and it don't have any options to limit uploaded file size or extension :|

JernejL
27-12-2008, 04:01 PM
In that case use a http post multipart form to upload files, and a server side script to limit the size and type and uploaded name.

arthurprs
27-12-2008, 07:20 PM
In that case use a http post multipart form to upload files, and a server side script to limit the size and type and uploaded name.

i will have to stick with post, since my webserver only gives me 1 sftp key, and i can't risk exposing my entire webserver

i found that page
http://code.activestate.com/recipes/146306/
usefull, i will try to translate the code now