"Selamat datang di Kawasan pendidikan Nur Okta Aliza"



Kamis, 14 April 2011

Setting FTP Server dengan ProFTPD


ProFTPD adalah free FTP daemon yang didistribusikan di bawah lisensi GNU Public. ProFTPD merupakan aplikasi FTP server yang terkenal akan kehandalannya. ProFTPD adalah ftp server yang dibuat untuk Unix dan keluarga unix, seperti Linux, OpenBSD, FreeBSD, atau yang lainnya, dan tidak mendukung sistem operasi Win****.
Fitur-fitur yang ada pada Proftp ;
* Kita bisa membuat file per-izinan per direktori ftp ?.ftpaccess? yang mirip dengan konfigurasi web server apache ?.htaccess?.
* Mudah dalam mengkonfigurasi untuk multiple virtual FTP server dan anyonymous FTP services.
* Didesain untuk dijalankan secara stand-alone atau servis yang dipanggil melalui inetd/xinetd, tergantung sistem anda.
* Anonymous FTP root direktori tidak memerlukan struktur direktori secara spesifik , system binaries atau system files lainnya.
Langkah-langkah;
1. Pertama-tama download paket ProFTPD di ftp://ftp.proftpd.org/distrib/source/proftpd-1.3.2rc4.tar.gz atau dengan versi yang terbaru, pake dengkul juga boleh. Pada saat instalasi Linux Slackware dengan Full Installation, paket ProFTPD sudah terinstall di mesin anda, anda bisa langsung loncat ke langkah 5 untuk konfigurasi.
2. Lakukan ekstraksi, dengan perintah
unamed@slacker:~proftp# tar xvzf proftpd-1.3.2rc4.tar.gz
3. Lakukan konfigurasi, kompilasi, dan letak instalasi (prefix), contoh seperti di bawah ini,
unamed@slacker:~proftp# ./configure –prefix=/usr –sysconfdir=/etc –localstatedir=/var/run && make
4. Jika tidak ada error, “Mari Kita Install
unamed@slacker:~proftp# make install
5. Membuat Account untuk ProFTPD, ikuti langkah-langkah di bawah ini,
root@slacker:~/proftp# groupadd -g 46 proftpd
root@slacker:~/proftp# useradd -c proftpd -d /srv/ftpd -g proftpd -s /usr/bin/proftpdshell -u 46 proftpd
root@slacker:~/proftp# usermod -c proftpd -d /srv/ftpd -g proftpd -s /usr/bin/proftpdshell -u 46 proftpd
root@slacker:~/proftp# install -v -d -m775 -o proftpd -g proftpd /home/ftp
root@slacker:~/proftp# ln -v -s /bin/false /usr/bin/proftpdshell
`/usr/bin/proftpdshell’ -> `/bin/false’
root@slacker:~/proftp# echo /usr/bin/proftpdshell >> /etc/shells
6. Lalu tahap konfigurasi, buka konfigurasi /etc/proftpd.conf edit dengan teks editor kesayangan anda,
unamed@slacker:~proftp# vi /etc/proftpd.conf
Lalu isi konfigurasi seperti di bawah ini,
# This is a basic ProFTPD configuration file.
# It establishes a single server and a single anonymous login.
# It assumes that you have a user/group “nobody” and “ftp”
# for normal/anonymous operation.
ServerName “ProFTPD Server”
ServerType standalone
DefaultServer on
# Port 21 is the standard FTP port.
Port 21
# Umask 022 is a good standard umask to prevent new dirs and files
# from being group and world writable.
Umask 022
# To prevent DoS attacks, set the maximum number of child processes
# to 30. If you need to allow more than 30 concurrent connections
# at once, simply increase this value. Note that this ONLY works
# in standalone mode, in inetd mode you should use an inetd server
# that allows you to limit maximum number of processes per service
# (such as xinetd)
MaxInstances 30
# Set the user and group that the server normally runs at.
User proftpd
Group proftpd
# This next option is required for NIS or NIS+ to work properly:
#PersistentPasswd off
SystemLog /var/log/proftpd.log
TransferLog /var/log/xferlog
# Normally, we want files to be overwriteable.
AllowOverwrite on
# A basic anonymous FTP server configuration.
# To enable this, remove the user ftp from /etc/ftpusers.
RequireValidShell off
User ftp
Group ftp
# We want clients to be able to login with “anonymous” as well as “ftp”
UserAlias anonymous ftp
# Limit the maximum number of anonymous logins
MaxClients 10
# We want ‘welcome.msg’ displayed at login, and ‘.message’ displayed
# in each newly chdired directory.
DisplayLogin welcome.msg
# DisplayFirstChdir .message
# Limit WRITE everywhere in the anonymous chroot
DenyAll
7. Buka file /etc/ftpusers, dan beri tanda # pada baris ftp
8. Buat file rc.proftpd dan disimpan dalam direktori /etc/rc.d atau /etc/init.d untuk ProFTPD dijalankan secara otomatis setiap komputer dihidupkan, berikut scriptnya,
#!/bin/sh
# ProFTPD files
FTPD_BIN=/usr/sbin/proftpd
FTPD_CONF=/etc/proftpd.conf
PIDFILE=/var/run/run/proftpd.pid
# If PIDFILE exists, does it point to a proftpd process?
if [ -f $PIDFILE ]; then
pid=`cat $PIDFILE`
fi
if [ ! -x $FTPD_BIN ]; then
echo “$0: $FTPD_BIN: cannot execute”
exit 1
fi
case $1 in
start)
if [ -n "$pid" ]; then
echo “$0: proftpd [PID $pid] already running”
exit
fi
if [ -r $FTPD_CONF ]; then
echo “Starting proftpd…”
$FTPD_BIN -c $FTPD_CONF
else
echo “$0: cannot start proftpd — $FTPD_CONF missing”
fi
;;
stop)
if [ -n "$pid" ]; then
echo “Stopping proftpd…”
kill -TERM $pid
else
echo “$0: proftpd not running”
exit 1
fi
;;
restart)
if [ -n "$pid" ]; then
echo “Rehashing proftpd configuration”
kill -HUP $pid
else
echo “$0: proftpd not running”
exit 1
fi
;;
*)
echo “usage: $0 {start|stop|restart}”
exit 1
;;
esac
exit 0
Lalu ketik perintah,
root@slacker:~/proftp# chmod +x /etc/rc.d/rc.proftpd
8. Aktifkan ProFTPD,
root@slacker:~/proftp# proftpd -c /etc/proftpd.conf
test dengan akun proftpd yang dibuat sebelumnya,
root@slacker:~# ftp localhost
Connected to localhost.
220 ProFTPD 1.3.1 Server (FTP Server on slackware.org) [::ffff:127.0.0.1]
Name (localhost:root): proftpd
331 Password required for proftpd
Password:
proftpd access granted, restrictions apply
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>
sampai di atas, anda berhasil dengan akun user yang anda buat sendiri, lalu coba dengan akun anyonymous,
root@slacker:~# ftp localhost
Connected to localhost.
220 ProFTPD 1.3.1 Server (FTP Server on slackware.org) [::ffff:127.0.0.1]
Name (localhost:root): anonymous
331 Anonymous login ok, send your complete email address as your password
Password:
230 Anonymous access granted, restrictions apply
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>
http://bolpoint.wordpress.com/2010/03/11/setting-ftp-server-dengan-proftpd/

Contoh Aplikasi :
22.1. Installasi
Jika aplikasi ProFTPd sudah terinstall, tidak usah di install kembali.
debian-server:~# apt-get install proftpd openssl ssl-cert
22.2. Konfigurasi
22.2.1. Konfigurasi ProFTPd

Edit file konfigurasi ProFTPd seperti berikut, atau jika ingin menggunakan konfigurasi Anda sendiri, ya silahkan.
debian-server:~# vim /etc/proftpd/proftpd.conf
UseIPv6 off
IdentLookups off
ServerIdent on “Al-Mansyurin Forensic Labs”
#. . .

User ftp
UserAlias anonymous ftp
Pastikan bahwa pada file utama ProFTPd, file tls.conf ikut dijalankan ketika ProFTPd restart. Edit dan hilangkan tanda pagar pada script berikut ini.
# This is used for FTPS connections
Include /etc/proftpd/tls.conf
22.2.2 Creating The SSL Certificate For TLS
Agar kita bisa menggunakan TLS, kita harus membuat Sertifikat SSL terlebih dahulu. Kemudian, kita bisa mengenerate Sertifikat SSL seperti berikut:

debian-server:~# openssl req -x509 -newkey rsa:1024 -keyout /etc/ssl/private/proftpd.key -out /etc/ssl/certs/proftpd.crt -nodes -days 365
Country Name (2 letter code) [GB]: ID
State or Province Name (full name) [Some-State]: East Java
Locality Name (eg, city) []: Mojokerto
Organization Name (eg, company; recommended) []: Al-Mansyurin Team
Organizational Unit Name (eg, section) []:
server name (eg. ssl.domain.tld; required!!!) []: debian.edu
Email Address []: admin@debian.edu

Rubah hak akses kepemilikan dua file tersebut, agar hanya dapat dimodifikasi oleh account super user saja.

debian-server:~# chmod 600 /etc/ssl/certs/proftpd.crt
debian-server:~# chmod 600 /etc/ssl/private/proftpd.key

22.2.3 Enabling TLS In ProFTPd
Selanjutnya, edit file tls.conf untuk mengkonfigurasi SSL Certificate dan SSL Key.
debian-server:~# vim /etc/proftpd/tls.conf

TLSEngine on
TLSLog /var/log/proftpd/tls.log
TLSProtocol SSLv23
TLSRSACertificateFile /etc/ssl/certs/proftpd.crt
TLSRSACertificateKeyFile /etc/ssl/private/proftpd.key
TLSOptions NoCertRequest
TLSVerifyClient off
TLSRequired on

Terakhir, pastikan semua konfigurasi berjalan dengan merestart servis FTP.

debian-server:~# /etc/init.d/proftpd restart
Stopping ftp server: proftpd.
Starting ftp server: proftpd.
22.3. Pengujian
Sekarang anda bisa mencoba koneksi ke FTP Server dengan menggunakan FTP Client. Anda juga harus mensetting FTP Client agar menggunakan protokol SSL/TLS (ini wajib, jika anda menggunakan TLSRequired on). Berikut contoh konfigurasinya pada FileZilla.
  • Pilih menu File > Site Manager
  • Kemudian pilih New Site. Pastikan bahwa ServerType menggunakan FTPES.
Selanjutnya pilih Connect, maka akan muncul pesan seperti gambar di bawah ini.
http://wikilog.net/id/1224097-ftp-server-with-openssl-ftps.html