[Proftpd-user] Wrong ordering of mod_auth_file and mod_sql breaks AuthFile user authentication
William Edwards via Proftp-user <[email protected]> Sun, 09 Jul 2023 11:41:31 +0200
| Newsgroups | gmane.network.proftpd.user |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I use both mod_sql and mod_auth_file for user authentication.
With the line below, authentication for both SQL and AuthFile users
works.
AuthOrder mod_sql.c mod_auth_file.c
With the line below, authentication for SQL users works, but is broken
for AuthFile users.
AuthOrder mod_auth_file.c mod_sql.c
When logging in with an AuthFile user, ProFTPD logs the following to
SQLLogFile. `/var/lib/proftpd.db` is the database path specified in
SQLConnectInfo.
2023-07-09 11:31:40,139 mod_sql/4.5[857014]: error opening SQLite
database '/var/lib/proftpd.db': unable to open database file (No such
file or directory)
2023-07-09 11:31:40,139 mod_sql/4.5[857014]: exiting sqlite
cmd_open
2023-07-09 11:31:40,139 mod_sql/4.5[857014]: exiting sqlite
cmd_select
2023-07-09 11:31:40,139 mod_sql/4.5[857014]: unrecoverable backend
error
2023-07-09 11:31:40,139 mod_sql/4.5[857014]: error:
'mod_sql_sqlite/0.4'
2023-07-09 11:31:40,139 mod_sql/4.5[857014]: message: 'unable to
open database file (No such file or directory)'
That is indeed what these syscalls return:
[pid 857014] lstat("/var/lib/proftpd.db", 0x7ffc4f2c1db0) = -1
ENOENT (No such file or directory)
[pid 857014] getpid() = 857014
[pid 857014] getpid() = 857014
[pid 857014] openat(AT_FDCWD, "/var/lib/proftpd.db",
O_RDWR|O_NOFOLLOW|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 857014] openat(AT_FDCWD, "/var/lib/proftpd.db",
O_RDONLY|O_NOFOLLOW|O_CLOEXEC) = -1 ENOENT (No such file or directory)
This happens because chroot() is called before the file is opened, as
the config contains `DefaultRoot ~`. Therefore, the issue does not occur
when that setting is absent.
A couple of things interest me:
- Why is the user looked up using mod_sql used when authenticating with
a valid AuthUser? I would expect ProFTPD to exit on the first match,
according to the AuthOrder. And with the 'broken' AuthOrder, AuthFile
comes first.
- Why is chroot() called during authentication?
Met vriendelijke groeten,
William Edwards
_______________________________________________
ProFTPD Users List <[email protected]>
Unsubscribe problems?
http://www.proftpd.org/list-unsub.html