#!/bin/bash # # # +---------------------------------------------------------------------------------------------+ # | Raphael Prencipe (Dexinou) / raphaelp@live.be | # | Script d'installation automatique de Pure-FTPd 1.0.21 | # | | # | Ce script est distribué sans garantie et à vos risques et périls. | # | Si ce script fait péter votre machine ça ne sera pas ma faute :-) | # | | # | Il a été testé sur Debian Sarge et Etch avec succès. | # | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | # | Vous pouvez modifier ce script et/ou le redistribué en laissant la licence intacte | # | celle que vous êtes en train de lire en ce moment. | # | La licence devra toujours être affichée. | # | | # | Toutes suggestions sont les bienvenues... | # +---------------------------------------------------------------------------------------------+ # # $Author: dexinou $ # $Revision: 0.1b $ # $Date: 2007-06-25 08:39:10 GMT +0100 (lun, 25 Juin 2007) $ # How to run this script ? # Put this script in /root folder et run like this : # chmod +x pure-ftpd.sh # ./pure-ftpd.sh # When script finish connect with = ftp localhost # First user for test = domain # Password = Same that you put when it ask you ;-) PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin ### variables ### VERSION="0.1b" wget="/usr/bin/wget" apt="/usr/bin/apt-get install" update="/usr/bin/apt-get update" url="http://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.21.tar.gz" pureftpd_package="pure-ftpd-1.0.21.tar.gz" install_package="build-essential libpam-dev ftp openssl libssl-dev libxcrypt-dev libmysqlclient15-dev libpq-dev libpqxx-dev libldap2-dev" config="http://download.tuxfamily.net/gbsd/pureftpd/pure-ftpd.conf" boot_config="http://download.tuxfamily.net/gbsd/pureftpd/pure-ftpd" purepw="/usr/local/pureftpd/bin/pure-pw" configure="./configure --prefix=/usr/local/pureftpd --without-inetd --without-capabilities --with-mysql --with-ldap \ --with-pgsql --with-paranoidmsg --with-altlog --with-pam --with-puredb --with-cookie --with-throttling \ --with-ratios --with-quotas --with-ftpwho --with-welcomemsg --with-extauth --with-uploadscript --with-virtualhosts \ --with-virtualchroot --with-diraliases --with-peruserlimits --with-language=french --with-tls --with-boring \ --with-rfc2640" install="make && make install" start="/etc/init.d/pure-ftpd start" firstuser="/usr/local/pureftpd/bin/pure-pw useradd domain -u webuser -g webgroup -d /var/www/domaine.com -N 250" makedb="/usr/local/pureftpd/bin/pure-pw mkdb" # Check if pure-ftpd is installed if ! test -e /usr/local/pureftpd/sbin/pure-ftpd then echo -e "Pure-FTPd is installed, deinstall pure-ftpd first! " exit 0 ### Install packages $update $install_package ### Create user and group for Pure-FTPd groupadd -g 2001 webgroup useradd -u 2001 -s /bin/false -d /bin/null -c "pureftpd user" -g webgroup webuser useradd -g webgroup -d /home/ftp -s /bin/false ftp ### Install Pure-FTPd mkdir /usr/local/src/tar cd /usr/local/src/tar wget $url cd ../ tar -zxf tar/$pureftpd_package cd pure-ftpd-1.0.21 $configure $install ### Create folders mkdir /var/lock/subsys mkdir /var/log/pure-ftpd mkdir /usr/local/pureftpd/etc cd configuration-file/ cp pure-config.pl /usr/local/pureftpd/sbin/ cd /usr/local/pureftpd/etc/ wget $config cp /usr/local/src/pure-ftpd-1.0.21/pam/ftpusers /usr/local/pureftpd/etc/ chmod +x /usr/local/pureftpd/sbin/pure-config.pl ### Create boot and runlevels cd /etc/init.d/ wget $boot_config chmod +x pure-ftpd update-rc.d pure-ftpd defaults ### Install TLS/SSL mkdir -p /etc/ssl/private openssl req -x509 -days 5000 -nodes -newkey rsa:2048 -keyout /etc/ssl/private/pure-ftpd.pem -out /etc/ssl/private/pure-ftpd.pem chmod 600 /etc/ssl/private/*.pem ### Create the first virtualuser $firstuser $makedb # Launch Pure-FTPD $start echo -e "Congratulations ! Pure-FTPd is sucessfully installed and started" exit 0