Explorar E-books
Categorias
Explorar Audiolivros
Categorias
Explorar Revistas
Categorias
Explorar Documentos
Categorias
abril-maio/05
AVISO:
· este documento explica a instalação do pure-ftpd para ser usado no sistema PVANET em
fase de desenvolvimento pela Divisão de Sistemas da CPD.
· às vezes usa-se pure-ftpd e às vezes pureftpd, sempre se tentou usar o padrão usado pelo
próprio software que às vezes usa, nos exemplos, um ou outro.
veja-se que há outros softwares importantes no site, tais como o admin e o user manager.
ftp://ftp.pureftpd.org/pub/pure-ftpd/doc/readme.pdf
3. criar usuário principal e os dos domínios virtuais (a vantagem de criar usuários por domínio
virtual está em poder ter (se quiser) quotas pelo sistema operacional):
cd /var/pure-ftpd
rm -Rf tmp pvanet/tmp ftp2/tmp
mkdir /etc/pure-ftpd
ln -s /var/pure-ftpd/pvanet /etc/pure-ftpd/200.131.233.147
ln -s /var/pure-ftpd/ftp2 /etc/pure-ftpd/200.131.233.148
urpmi libmysql-devel
8. mudar para o subdiretório onde esta o fonte descompactado e rodar o seguinte configure:
./configure \
--with-altlog \
--with-language=brazilian-portuguese \
--with-mysql \
--with-peruserlimits \
--with-quotas \
--with-throttling \
--with-virtualchroot \
--with-virtualhost \
--with-privsep \
--without-humor \
--without-inetd
9. compilar e instalar:
make
make check
su
make install
10. copiar:
MÍNIMO:
MYSQLServer mysql.cpd.ufv.br
MYSQLPort 3306
MYSQLSocket /tmp/mysql.sock
MYSQLUser pureftpd
MYSQLPassword net-pva-ftp
MYSQLDatabase pureftpd
MYSQLCrypt cleartext
MYSQLGetPW SELECT Password FROM users WHERE User="\L"
MYSQLGetUID SELECT Uid FROM users WHERE User="\L"
MYSQLGetGID SELECT Gid FROM users WHERE User="\L"
MYSQLGetDir SELECT Dir FROM users WHERE User="\L"
COMO FICOU COM SERVIDORES VIRTUAIS (a versão final está no Anexo C):
MYSQLServer mysql.cpd.ufv.br
MYSQLPort 3306
MYSQLSocket /tmp/mysql.sock
MYSQLUser pureftpd
MYSQLPassword net-pva-ftp
MYSQLDatabase pureftpd
MYSQLCrypt cleartext
MYSQLGetPW SELECT Password FROM users WHERE User="\L" and IP="\I"
MYSQLGetUID SELECT Uid FROM users WHERE User="\L" and IP="\I"
MYSQLGetGID SELECT Gid FROM users WHERE User="\L" and IP="\I"
MYSQLGetDir SELECT Dir FROM users WHERE User="\L" and IP="\I"
MySQLGetQTAFS SELECT QuotaFiles FROM users WHERE User="\L" and IP="\I"
MySQLGetQTASZ SELECT QuotaSize FROM users WHERE User="\L" and IP="\I"
11. copiar:
cd /etc
chown -R pure-ftpd.pure-ftpd pure-ftpd
cd pure-ftpd
chmod o= pureftpd-mysql.conf (por causa da senha)
opcional:
chmod o= pure-ftpd.conf
-- esta eh a tabela minima, veja que nao hah quotas o que serah
-- implementado via opcao na linha de comando
use pureftpd;
CREATE TABLE users (
ID integer unsigned NOT NULL auto_increment,
User varchar(32) NOT NULL default '',
IP varchar(15) NOT NULL default 'nao-fornecido',
Password varchar(64) NOT NULL default '',
Uid varchar(16) NOT NULL default 'nao-fornecido',
Gid varchar(16) NOT NULL default 'nao-fornecido',
Dir varchar(128) NOT NULL default '/var/pure-ftpd',
QuotaFiles smallint unsigned NOT NULL default '1000',
QuotaSize smallint unsigned NOT NULL default '10',
MatriculaUFV varchar(14) NOT NULL default 'nao-fornecida',
PRIMARY KEY (ID),
UNIQUE KEY Usuario (User,IP)
) TYPE=MyISAM;
por ser relativamente grande o script o mesmo consta do ANEXO B. O nome dado ao script
foi pure-ftpd.rc e foi colocado no subdiretório /etc/rc.d/init.d
cd /etc/rc.d/init.d
chmod ug+x pure-ftpd
chkconfig pure-ftpd reset
# modo de execucao:
# /usr/local/sbin/pure-config.pl /etc/pure-ftpd/pure-ftpd.conf
#LOCAL - inicio#
# IMPORTANTE
# limites de conexao/usuarios devem ser "contados em dobro" jah que
# compilamos o servidor com --with-privsep que abre 2 sessoes por
# conexao.
#LOCAL - fim#
ChrootEveryone yes
# TrustedGID 100
#LOCAL#BrokenClientsCompatibility no
BrokenClientsCompatibility yes
# Fork in background
Daemonize yes
#LOCAL#MaxClientsPerIP 8
MaxClientsPerIP 60
VerboseLog no
#LOCAL#DisplayDotFiles yes
DisplayDotFiles no
AnonymousOnly no
#LOCAL#NoAnonymous no
NoAnonymous yes
SyslogFacility ftp
# Don't resolve host names in log files. Logs are less verbose, but
# it uses less bandwidth. Set this to "yes" on very busy servers or
# if you don't have a working DNS.
#LOCAL#DontResolve yes
DontResolve no
#LOCAL#MaxIdleTime 15
MaxIdleTime 7
# LDAPConfigFile /etc/pureftpd-ldap.conf
# PGSQLConfigFile /etc/pureftpd-pgsql.conf
# PureDB /etc/pureftpd.pdb
# ExtAuth /var/run/ftpd.sock
# PAMAuthentication yes
# If you want simple Unix (/etc/passwd) authentication, uncomment this
# UnixAuthentication yes
#LOCAL#LimitRecursion 2000 8
AnonymousCanCreateDirs no
MaxLoad 4
# ForcePassiveIP 192.168.0.1
# AnonymousRatio 1 10
# Upload/download ratio for all users.
# This directive superscedes the previous one.
# UserRatio 1 10
AntiWarez yes
# Bind 127.0.0.1,21
# AnonymousBandwidth 8
# UserBandwidth 8
Umask 133:022
MinUID 100
AllowUserFXP no
# Allow anonymous FXP for anonymous and non-anonymous users.
AllowAnonymousFXP no
ProhibitDotFilesWrite no
ProhibitDotFilesRead no
# Never overwrite files. When a file whoose name already exist is uploaded,
# it get automatically renamed to file.1, file.2, file.3, ...
AutoRename no
#LOCAL#AnonymousCantUpload no
AnonymousCantUpload yes
#TrustedIP 10.1.1.1
# If you want to add the PID to every logged line, uncomment the following
# line.
#LOCAL##LogPID yes
LogPID yes
# AltLog clf:/var/log/pureftpd.log
# Create an additional log file with transfers logged in the standard W3C
# format (compatible with most commercial log analyzers)
# AltLog w3c:/var/log/pureftpd.log
# Disallow the CHMOD command. Users can't change perms of their files.
#LOCAL##NoChmod yes
NoChmod yes
# Allow users to resume and upload files, but *NOT* to delete them.
#KeepAllFiles yes
#LOCAL#CreateHomeDir yes
CreateHomeDir yes
# Enable virtual quotas. The first number is the max number of files.
# The second number is the max size of megabytes.
# So 1000:10 limits every user to 1000 files and 10 Mb.
#Quota 1000:10
# If your pure-ftpd has been compiled with standalone support, you can change
# the location of the pid file. The default is /var/run/pure-ftpd.pid
#PIDFile /var/run/pure-ftpd.pid
# If your pure-ftpd has been compiled with pure-uploadscript support,
# this will make pure-ftpd write info about new uploads to
# /var/run/pure-ftpd.upload.pipe so pure-uploadscript can read it and
# spawn a script to handle the upload.
#CallUploadScript yes
#LOCAL#MaxDiskUsage 99
MaxDiskUsage 95
#NoRename yes
CustomerProof yes
# Per-user concurrency limits. It will only work if the FTP server has
# been compiled with --with-peruserlimits (and this is the case on
# most binary distributions) .
# The format is : <max sessions per user>:<max anonymous sessions>
# For instance, 3:20 means that the same authenticated user can have 3 active
# sessions max. And there are 20 anonymous sessions max.
# When a file is uploaded and there is already a previous version of the file
# with the same name, the old file will neither get removed nor truncated.
# Upload will take place in a temporary file and once the upload is complete,
# the switch to the new version will be atomic. For instance, when a large PHP
# script is being uploaded, the web server will still serve the old version and
# immediatly switch to the new one as soon as the full file will have been
# transfered. This option is incompatible with virtual quotas.
# NoTruncate yes
# TLS 1
# IPV4Only yes
# IPV6Only yes
ANEXO B
arquivo /etc/rc.d/init.d/pure-ftpd.rc
#!/bin/sh
#
# Start/stop/restart the pureftp server:
# OBTIDO em abr/05 via:
# http://www.vivaolinux.com.br/scripts/verFonte.php?codigo= (continua o link)
# 1015&arquivo=build_pureftpd.sh
#
# MODIFICADO: Dojai - abr/05 para ter chkconfig (igual ao proftpd), apontar
# corretamente para os arquivos e mini correcoes.
#
# chkconfig: 345 85 15
# description: servidor de ftp pure-ftpd que permite o uso de banco \
# de dados, servidores virtuais etc.
ftpd_start() {
#LOCAL#/usr/sbin/pure-config.pl /etc/pure-ftpd.conf
/usr/local/sbin/pure-config.pl /etc/pure-ftpd/pure-ftpd.conf
}
ftpd_stop() {
killall pure-ftpd
}
ftpd_restart() {
ftpd_stop
sleep 1
ftpd_start
}
#LOCAL#case "\$1" in
case "$1" in
'start')
ftpd_start
;;
'stop')
ftpd_stop
;;
'restart')
ftpd_restart
;;
*)
#LOCAL#echo "usage \$0 start|stop|restart"
echo "usage $0 start|stop|restart"
esac
ANEXO C
arquivo /etc/pure-ftpd/pureftpd-mysql.conf
##############################################
# #
# Sample Pure-FTPd Mysql configuration file. #
# See README.MySQL for explanations. #
# #
##############################################
# Optional : MySQL server name or IP. Don't define this for unix sockets.
# Optional : MySQL port. Don't define this if a local unix socket is used.
# MYSQLPort 3306
# Optional : define the location of mysql.sock if the server runs on this host.
MYSQLSocket /tmp/mysql.sock
#LOCAL#MYSQLUser root
MYSQLUser pureftpd
#LOCAL#MYSQLPassword rootpw
MYSQLPassword net-pva-ftp
MYSQLDatabase pureftpd
MYSQLCrypt cleartext
#MYSQLDefaultUID 1000
#MYSQLDefaultGID 1000
# MySQLForceTildeExpansion 1
# MySQLTransactions On