這裏顯示兩個版本的差異處。
Both sides previous revision 前次修改 下次修改 | 前次修改 | ||
service:proftpd [2007/05/06 04:29] wenpei |
service:proftpd [2008/12/16 20:13] (目前版本) wenpei |
||
---|---|---|---|
行 1: | 行 1: | ||
+ | ====== proftpd 使用 TLS 加密 ====== | ||
+ | ===== 產生金鑰 ===== | ||
+ | openssl genrsa -out proftpd.key2 1024 | ||
+ | |||
+ | openssl req -new -x509 -days 3650 -key proftpd.key -out proftpd.crt | ||
+ | |||
+ | <code> | ||
+ | Country Name (2 letter code) [AU]:TW | ||
+ | State or Province Name (full name) [Some-State]:Taiwan | ||
+ | Locality Name (eg, city) []:Jhungli | ||
+ | Organization Name (eg, company) [Internet Widgits Pty Ltd]:SARS.tw | ||
+ | Organizational Unit Name (eg, section) []:FTP | ||
+ | Common Name (eg, YOUR name) []:sars.tw | ||
+ | Email Address []:username@domain.name | ||
+ | </code> | ||
+ | |||
+ | chmod go-r proftpd.key proftpd.crt | ||
+ | |||
+ | mv proftpd.key proftpd.crt /etc/ssl/certs/ | ||
+ | |||
+ | ===== 設定 tls.conf ===== | ||
+ | <code> | ||
+ | <IfModule mod_tls.c> | ||
+ | TLSEngine on | ||
+ | TLSLog /var/log/proftpd/tls.log | ||
+ | TLSProtocol SSLv23 | ||
+ | TLSRSACertificateFile /etc/ssl/certs/proftpd.crt | ||
+ | TLSRSACertificateKeyFile /etc/ssl/certs/proftpd.key | ||
+ | TLSVerifyClient off | ||
+ | TLSRequired on | ||
+ | TLSRenegotiate required off | ||
+ | </IfModule> | ||
+ | </code> | ||
+ | |||
+ | ===== 設定 proftpd.conf ===== | ||
+ | 在檔案中加入: | ||
+ | Include /etc/proftpd/tls.conf | ||
+ | |||
+ | 並檢查 modules.conf 中是否有: | ||
+ | LoadModule mod_tls.c | ||
+ | |||
====== 用 mysql 管理 proftpd 帳號 ====== | ====== 用 mysql 管理 proftpd 帳號 ====== | ||
http://www.castaglia.org/proftpd/doc/contrib/ProFTPD-mini-HOWTO-SQL.html | http://www.castaglia.org/proftpd/doc/contrib/ProFTPD-mini-HOWTO-SQL.html | ||
行 7: | 行 48: | ||
http://www.lslnet.com/linux/f/docs1/i34/big5258812.htm | http://www.lslnet.com/linux/f/docs1/i34/big5258812.htm | ||
- | |||
- | ===== 支援 ===== | ||
- | 確定 proftpd 有支援 sql module | ||
- | # proftpd -l | grep sql | ||
- | mod_sql.c | ||
- | mod_sql_mysql.c | ||
- | mod_quotatab_sql.c | ||
===== 建立資料庫 ===== | ===== 建立資料庫 ===== | ||
行 47: | 行 81: | ||
===== proftpd 設定 ===== | ===== proftpd 設定 ===== | ||
- | <code> | + | ==== proftpd.conf ==== |
- | # used to connect to the database | + | 使用 sql.conf 設定,檔案中要有這行: |
- | # databasename@host database_user user_password | + | Include /etc/proftpd/sql.conf |
- | SQLConnectInfo ftp@localhost proftpd [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 ftp username password 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 groups groupname gid members | + | |
- | + | ||
- | # The passwords in MySQL are encrypted using CRYPT | + | |
- | SQLAuthTypes Plaintext | + | |
- | SQLAuthenticate users* groups* | + | |
- | + | ||
- | # 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 | + | |
- | SQLHomedirOnDemand on | + | |
+ | ==== sql.conf ==== | ||
+ | <code> | ||
+ | <IfModule mod_sql.c> | ||
+ | SQLBackend mysql | ||
+ | SQLEngine on | ||
+ | SQLAuthenticate on | ||
+ | SQLAuthTypes Crypt Plaintext | ||
+ | SQLConnectInfo ftp@localhost proftpd Cc:Y6yn9fnH7Zhtx | ||
+ | SQLUserInfo ftp username password uid gid homedir shell | ||
+ | SQLGroupInfo groups groupname gid members | ||
#設定mysql log檔 | #設定mysql log檔 | ||
SQLLogFile /var/log/proftpd/sql.log | SQLLogFile /var/log/proftpd/sql.log | ||
PersistentPasswd off | PersistentPasswd off | ||
- | + | </IfModule> | |
- | # 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 | + | |
</code> | </code> | ||