Änderungen

FTP-Speicher

3.837 Byte hinzugefügt, 11:37, 7. Okt. 2016
/* Konfiguration */
</syntaxhighlight>
Eine Portänderung von SSH ist möglich, auch wenn wir davon abraten. Wenn der Port geändert wird, auf jeden Fall einen Port kleiner als 1024 wählen! Passwort-Authentifizierung darf und sollte nicht deaktiviert werden.
Als nächstes konfigurieren wir den MySQL-Server. Hier wird die Variable ''bind-address'' in der Datei ''/etc/mysql/my.cnf'' von ''127.0.0.1'' auf ''0.0.0.0'' geändert. Danach wird der MySQL-Server neugestartet. Zusätzlich sollten wir noch ''mysql_secure_installation'' ausführen, hier darf der Remote-Zugriff für root nicht deaktiviert werden.
UNIQUE KEY userid (userid)
) ENGINE=MyISAM COMMENT='ProFTP user table';
 
INSERT INTO `ftpgroup` (`groupname`, `gid`, `members`) VALUES ('ftpgroup', 2001, 'ftpuser');
</syntaxhighlight>
 
Danach wird das Backend für PowerDNS konfiguriert. Hierfür bearbeiten wir die Datei ''/etc/proftpd/modules.conf''. Hier werden die Module ''mod_sql.c'', ''mod_sql_mysql.c'' und ''mod_quotatab_sql.c'' einkommentiert. Unter der Sektion "Alternative authentication frameworks" fügen Sie folgendes hinzu:
 
<syntaxhighlight lang="bash">
DefaultRoot ~
SQLBackend mysql
# The passwords in MySQL are encrypted using CRYPT
SQLAuthTypes Plaintext Crypt
SQLAuthenticate users groups
# used to connect to the database
# databasename@host database_user user_password
SQLConnectInfo proftpd@localhost root <password>
# 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 ftpuser userid passwd uid gid homedir 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 ftpgroup 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 on
# 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
# User quotas
# ===========
QuotaEngine on
QuotaDirectoryTally on
QuotaDisplayUnits Mb
QuotaShowQuotas on
SQLNamedQuery get-quota-limit SELECT "name, quota_type, per_session, limit_type, bytes_in_avail, bytes_out_avail, bytes_xfer_avail, files_in_avail, files_out_avail, files_xfer_avail FROM ftpquotalimits WHERE name = '%{0}' AND quota_type = '%{1}'"
SQLNamedQuery get-quota-tally SELECT "name, quota_type, bytes_in_used, bytes_out_used, bytes_xfer_used, files_in_used, files_out_used, files_xfer_used FROM ftpquotatallies WHERE name = '%{0}' AND quota_type = '%{1}'"
SQLNamedQuery update-quota-tally UPDATE "bytes_in_used = bytes_in_used + %{0}, bytes_out_used = bytes_out_used + %{1}, bytes_xfer_used = bytes_xfer_used + %{2}, files_in_used = files_in_used + %{3}, files_out_used = files_out_used + %{4}, files_xfer_used = files_xfer_used + %{5} WHERE name = '%{6}' AND quota_type = '%{7}'" ftpquotatallies
SQLNamedQuery insert-quota-tally INSERT "%{0}, %{1}, %{2}, %{3}, %{4}, %{5}, %{6}, %{7}" ftpquotatallies
QuotaLimitTable sql:/get-quota-limit
QuotaTallyTable sql:/get-quota-tally/update-quota-tally/insert-quota-tally
RootLogin off
RequireValidShell off
 
<IfModule mod_tls.c>
TLSEngine on
TLSLog /var/log/proftpd/tls.log
TLSProtocol SSLv3 TLSv1
TLSOptions NoCertRequest
TLSRSACertificateFile /etc/mysql/server-cert.pem
TLSRSACertificateKeyFile /etc/mysql/server-key.pem
TLSCertificateChainFile /etc/mysql/cacert.pem
TLSVerifyClient off
TLSRequired on
</IfModule>
 
User ftpuser
Group ftpgroup
</syntaxhighlight>
 
Unter ''SQLConnectInfo'' muss ''<password>'' durch das Root-Passwort von MySQL ersetzt werden.
 
Wichtig: Sollte irgendwo anders die Zeile ''QuotaEngine off'' auftauchen, muss diese unbedingt auskommentiert werden.
 
Nun muss der FTP-Server noch neugestartet werden:
 
<syntaxhighlight lang="bash">
service proftpd restart
</syntaxhighlight>
 
Zuletzt legen wir das Verzeichnis für die FTP-Dateien an:
 
<syntaxhighlight lang="bash">
mkdir -p /var/ftp
chown -R ftpuser:ftpgroup /var/ftp
</syntaxhighlight>
 
Damit ist die Konfiguration abgeschlossen.
== Hinzufügen ==
Beim Hinzufügen eines Produktes in sourceDESK muss nur der Hostname und , das Root-Passwort für den MySQL-Server , das Root-Passwort des Servers und der SSH-Port angegeben werden. Natürlich muss auch eine Quota gesetzt werden.