# # Proftpd sample configuration for SQL-based authentication. # # (This is not to be used if you prefer a PAM-based SQL authentication) # # # Choose a SQL backend among MySQL or PostgreSQL. # Both modules are loaded in default configuration, so you have to specify the backend # or comment out the unused module in /etc/proftpd/modules.conf. # Use 'mysql' or 'postgres' as possible values. # SQLBackend mysql # SQLEngine on SQLAuthenticate on # # Use both a crypted or plaintext password #SQLAuthTypes Crypt Plaintext # # Use a backend-crypted or a crypted password ###SQLAuthTypes Crypt # # Connection SQLConnectInfo dbname@192.168.10.1 user topsecret # # Describes both users/groups tables # ###SQLUserInfo passwd login password uid gid home "/bin/false" #SQLUserInfo users userid passwd uid gid homedir shell #SQLGroupInfo groups groupname gid members # SQLAuthTypes Crypt Plaintext SQLUserInfo passwd login password uid NULL home NULL RequireValidShell off SQLAuthenticate users # utworzenie katalogu domowego gdy nie istnieje CreateHome on # komunikat przy logowaniu SQLShowInfo PASS "230" "Last login: %{getlastlogin}" SQLLog PASS setlastlogin SQLNamedQuery getlastlogin SELECT "CASE lastlogin WHEN 0 THEN '' ELSE FROM_UNIXTIME(lastlogin) END FROM passwd WHERE login='%u'" SQLNamedQuery setlastlogin UPDATE "lastlogin=UNIX_TIMESTAMP() WHERE login='%u'" passwd #SQLNamedQuery getlastlogin SELECT "CASE lastlogin WHEN 0 THEN '' ELSE lastlogin::abstime::timestamp::text END FROM passwd WHERE login='%u'" #SQLNamedQuery setlastlogin UPDATE "lastlogin=EXTRACT(EPOCH FROM CURRENT_TIMESTAMP(0)) WHERE login='%u'" passwd # Sprawdzamy dat�� wa��no��ci konta oraz ograniczamy szukanie do kont ftp SQLUserWhereClause "type & 8 = 8 AND (expdate = 0 OR expdate > UNIX_TIMESTAMP())" #SQLUserWhereClause "type & 8 = 8 AND (expdate = 0 OR expdate > EXTRACT(EPOCH FROM CURRENT_TIMESTAMP(0)))" SQLLogFile /var/log/proftpd/mod_sql.log