2010年1月14日木曜日

mail01 ProFTPdの導入

pb01でProFTPdをMySQLベースで運用していましたが、pb01を潰すのでmail01に引っ越す。

mail01にて

# yum --enablerepo=rpmforge install proftpd-mysql
# chkconfig proftpd on

rpmforgeのyumではユーザが作られないみたい。
UID500でproftpdユーザを作っておくこと。

/etc/proftpd.confはこんな感じ
編集後 # service proftpd start

ServerIdent on ""
ServerName "PB FTP"
ServerType standalone
DefaultServer on
Port 21
Umask 022
RootLogin off
ListOptions "-la"
MaxInstances 30
User proftpd
Group proftpd

CreateHome on skel /kfs/pb/ftp/skel
DeleteAbortedStores on

DefaultRoot ~ !wheel
RequireValidShell off
UseReverseDNS off
IdentLookups off

TimesGMT off
SetEnv TZ JST-9

TimeoutIdle 600
TimeoutLogin 300
TimeoutNoTransfer 600
TimeoutStalled 600
ShowSymlinks on
MaxClientsPerHost 3
MaxHostsPerUser 10

#AllowStoreRestart on
#AllowRetrieveRestart on
#MaxStoreFileSize 100 Mb

LogFormat allinfo "%t : %u (%a [%h]) : [%s], %T, %m (%f)"
LogFormat write "%t : %u : %F (%a)"
LogFormat read "%t : %u : %F (%a)"
LogFormat auth "%t : %u (%a [%h])"
ExtendedLog /var/log/proftpd/all.log ALL allinfo
ExtendedLog /var/log/proftpd/write.log WRITE write
ExtendedLog /var/log/proftpd/read.log READ read
ExtendedLog /var/log/proftpd/auth.log AUTH auth


AllowOverwrite on
AllowStoreRestart on
AllowRetrieveRestart on


#
# Order allow,deny
# Allow from 192.168.1.0/24
# Deny from all
#


LoadModule mod_sql.c
LoadModule mod_sql_mysql.c

SQLAuthenticate users
SQLConnectInfo pb_proftpd@dbm01.hoge.com:3306 proftpd proftpd
SQLAuthTypes Crypt
SQLUserInfo users userid password uid gid homedir shell
SQLGroupInfo groups groupname gid members
AuthOrder mod_sql.c


LoadModule mod_quotatab.c
LoadModule mod_quotatab_sql.c

QuotaEngine on
QuotaLog /var/log/proftpd/quota-log
QuotaLimitTable sql:/get-quota-limit
QuotaTallyTable sql:/get-quota-tally/update-quota-tally/insert-quota-tally

SQLNamedQuery get-quota-limit SELECT "userid, 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 quotalimits WHERE userid = '%{0}' AND quota_type = '%{1}'"

SQLNamedQuery get-quota-tally SELECT "userid, quota_type, bytes_in_used, \
bytes_out_used, bytes_xfer_used, files_in_used, files_out_used, files_xfer_used \
FROM quotatallies WHERE userid = '%{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 userid = '%{6}' AND quota_type = '%{7}'" quotatallies

SQLNamedQuery insert-quota-tally INSERT "%{0}, %{1}, %{2}, %{3}, %{4}, %{5}, %{6}, %{7}" quotatallies

QuotaLock /usr/local/proftpd/var/proftpd/tally.lock
QuotaShowQuotas on
QuotaDisplayUnits Mb
QuotaDirectoryTally on

0 件のコメント: