ISPConfig 3 ProFTPd per Debian
1 Introduzione
Sono un nuovo utente di ISPConfig e gioco con Linux da alcuni anni ormai. Il mio server è attualmente un VPS con OpenVZ e non mi consente di eseguire il pureftpd predefinito fornito con ISPConfig, quindi ho iniziato a esaminare ProFTPd e ho scoperto che non era molto difficile passare all'utilizzo.
2 Preinstallazione
Nota:questo non include il supporto per la quota perché il mio VPS non lo supporta. Se avete suggerimenti o idee su come migliorare questa integrazione senza dover modificare ftp_user_edit.php inISPConfig3 fatemelo sapere. Queste istruzioni sono state realizzate con Debian 5.0 Lenny ma dovrebbero funzionare allo stesso modo per 6.0. Per altre distribuzioni potrebbe essere necessario modificare leggermente queste istruzioni.
Nota anche:questo processo ha funzionato bene per me su un nuovo server e installazione di ISPConfig 3. L'utilizzo di questo su un server esistente richiederà l'accesso e la modifica/salvataggio di ogni utente FTP che è stato creato e potrebbe causare altri problemi. Potrei creare un semplice script php per farlo automaticamente in futuro. Non sono responsabile per eventuali problemi che potrebbero sorgere, quindi per favore usalo A TUO RISCHIO.
3 Installazione
Corri
apt-get remove pure-ftpd-common pure-ftpd-mysql
apt-get install proftpd proftpd-mod-mysql
Run as standalone
Crea gruppo e utente
groupadd -g 2001 ftpgroup
useradd -u 2001 -s /bin/false -d /bin/null -c "proftpd user" -gftpgroup ftpuser
4 Configurazione database
mysql -u root -p
Usa dbispconfig
Esegui query:
ALTER TABLE `ftp_user` ADD `shell` VARCHAR( 18 ) NOT NULL DEFAULT
'/sbin/nologin',
ADD `count` INT( 11 ) NOT NULL DEFAULT '0',
ADD `accessed` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
ADD `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00';
CREATE TABLE ftp_group (
groupname varchar(16) NOT NULL default '',
gid smallint(6) NOT NULL default '5500',
members varchar(16) NOT NULL default '',
KEY groupname (groupname)
) TYPE=MyISAM COMMENT='ProFTP group table';
INSERT INTO `ftp_group` (`groupname`, `gid`, `members`) VALUES
('ftpgroup', 2001, 'ftpuser');
5 Configurazione ProFTPd
Modifica /usr/local/ispconfig/interface/lib/config.inc.php:
nano /usr/local/ispconfig/interface/lib/config.inc.php
Trova la variabile db_password.
Annota la password per dopo.
Modifica /etc/proftpd/proftpd.conf
nano /etc/proftpd/proftpd.conf
Trova:
#Include /etc/proftpd/sql.conf
Cambia in:
Include /etc/proftpd/sql.conf
Modifica /etc/proftpd/sql.conf
nano /etc/proftpd/sql.conf
Cancella tutti i contenuti e sostituisci con:
#
# Proftpd sample configuration for SQL-based authentication.
#
# (This is not to be used if you prefer a PAM-based SQL authentication)
#
<IfModule mod_sql.c>
DefaultRoot ~
SQLBackend mysql
# The passwords in MySQL are encrypted using CRYPT
SQLAuthTypes Plaintext Crypt
SQLAuthenticate users groups
# used to connect to the database
# [email protected] database_user user_password
SQLConnectInfo [email protected] ispconfig _insertpasswordhere_
# Here we tell ProFTPd the names of the database columns in the "usertable"
# we want it to interact with. Match the names with those in the db
SQLUserInfo ftp_user username password uid gid dir shell
# Here we tell ProFTPd the names of the database columns in the "grouptable"
# we want it to interact with. Again the names match with those in the db
SQLGroupInfo ftp_group groupname gid members
# set min UID and GID - otherwise these are 999 each
SQLMinID 500
# create a user's home directory on demand if it doesn't exist
CreateHome off
# Update count every time user logs in
SQLLog PASS updatecount
SQLNamedQuery updatecount UPDATE "count=count+1, accessed=now() WHERE userid='%u'" ftpuser
# Update modified everytime user uploads or deletes a file
SQLLog STOR,DELE modified
SQLNamedQuery modified UPDATE "modified=now() WHERE userid='%u'" ftpuser
RootLogin off
RequireValidShell off
</IfModule>
Assicurati di cambiare _insertpasswordqui_ con la password che hai recuperato da ISPConfig.
Se il tuo database MySQL si trova su un altro server, cambia host locale per rappresentare il tuo server MySQL.
Modifica:/etc/proftpd/modules.conf
nano /etc/proftpd/modules.conf
Trova:
#LoadModule mod_sql.c
Cambia in:
LoadModule mod_sql.c
Trova:
#LoadModule mod_sql_mysql.c
Cambia in:
LoadModule mod_sql_mysql.c
Corri:
/etc/init.d/proftpd restart
6 Modifiche a ISPConfig 3
Ora dobbiamo cambiare uno dei file ispconfig. Questo non è perfetto, come se esegui l'aggiornamento alla nuova versione perderai le modifiche, ma è l'unico modo per far funzionare proftpd che potrei trovare.
Modifica /usr/local/ispconfig/interface/web/sites/ftp_user_edit.php
nano/usr/local/ispconfig/interface/web/sites/ftp_user_edit.php
Trova:
$uid = $web["system_user"]; $gid = $web["system_group"];
Sostituisci con:
$userinfo = posix_getpwnam($web["system_user"]); $uid = $userinfo['uid']; $gid = $userinfo['gid'];
Nota:se sei attualmente connesso al pannello web di ISPConfig, devi disconnetterti prima che le modifiche vengano registrate sulla tua macchina.