Pureftpd and Linux capabilties [message #4203] |
Sun, 02 July 2006 16:02 |
christoph
Messages: 19 Registered: July 2006
|
Junior Member |
|
|
Hello!
I'm trying to get pureftpd running inside a Debian sarge VPS.
There seems to be a problem with Linux capabilities.
What can be done to solve that issue without recompiling pureftpd with "--without-capabilities"?
# /etc/init.d/pure-ftpd-mysql start
Starting ftp server: Running: /usr/sbin/pure-ftpd-mysql -l mysql:/etc/pure-ftpd/db/mysql.conf -E -u 60 -O clf:/var/log/ftp/transfer.log -A -B
421 Unable to switch capabilities : Operation not permitted
My versions:
ii pure-ftpd-common 1.0.19-4 Pure-FTPd FTP server (Common Files)
ii pure-ftpd-mysql 1.0.19-4 Pure-FTPd FTP server with MySQL user authenticat
Thank you for any hints!
Christoph
|
|
|
|
|
Re: Pureftpd and Linux capabilties [message #4210 is a reply to message #4203] |
Mon, 03 July 2006 00:18 |
luismi
Messages: 8 Registered: July 2006 Location: Dublin
|
Junior Member |
|
|
Hi there,
Yes, I have the sane problem here.
You need to recompile the pure-ftpd package using the next option:
--without-capabilities: if the capabilities library (libcap) is found,
Pure-FTPd will try to use it in order to enhance security. This option
overrides the test to ignore the library. Try this if capabilities don't
work properly on your system. libcap can be downloaded from
ftp://ftp.kernel.org/pub/linux/libs/security/linux-privs/ .
From: http://download.pureftpd.org/pub/pure-ftpd/doc/README
I can send you my packages if you want, I use puredb since I have few accounts but I also created the mysql and ldap packages, for the future
I am not using the latest version 1.0.22 since I use the version from a debian stable mirror, that is, 1.0.19.
Also if you need some help recompiling pure-ftpd under debian, let me know, I will try to help you
Regards.
|
|
|
|
|
|
Re: Pureftpd and Linux capabilties [message #4244 is a reply to message #4216] |
Mon, 03 July 2006 18:31 |
christoph
Messages: 19 Registered: July 2006
|
Junior Member |
|
|
Hi!
I removed CAP_NET_ADMIN and it doesn't work then.
Here is a part of the strace with CAP_NET_ADMIN disabled.
# strace /usr/sbin/pure-ftpd-mysql:
capset(0x19980330, 0, {CAP_CHOWN|CAP_DAC_READ_SEARCH|CAP_SETGID|CAP_SETUID|CAP_NET_BIND_SERVICE|CAP_NET_ADMIN|CAP_SYS_CHROOT|CAP_SYS_NICE, CAP_CHOWN|CAP_DAC_READ_SEARCH|CAP_SETGID|CAP_SETUID|CAP_NET_BIND_SERVICE|CAP_NET_ADMIN|CAP_SYS_CHROOT|CAP_SYS_NICE, }) = -1 EPERM (Operation not permitted)
rt_sigprocmask(SIG_BLOCK, ~[RTMIN], [], 8) = 0
fstat64(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 0), ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40018000
write(1, "421 Unable to switch capabilitie"..., 61421 Unable to switch capabilities : Operation not permitted
) = 61
Christoph
|
|
|
Re: Pureftpd and Linux capabilties [message #4266 is a reply to message #4216] |
Tue, 04 July 2006 14:15 |
christoph
Messages: 19 Registered: July 2006
|
Junior Member |
|
|
Hi!
I now checked the source code of pureftpd.
It seems that it always keeps CAP_NET_ADMIN.
What should one think about that?
Christoph
caps.c:
http://pureftpd.cvs.sourceforge.net/pureftpd/pureftpd/src/ca ps.c?view=markup
...
void set_initial_caps(void)
{
apply_caps(cap_keep_startup,
sizeof(cap_keep_startup) / sizeof(cap_value_t));
}
...
caps_p.h:
http://pureftpd.cvs.sourceforge.net/pureftpd/pureftpd/src/ca ps_p.h?view=markup
...
cap_value_t cap_keep_startup[] = {
CAP_SETGID,
CAP_SETUID,
CAP_CHOWN,
CAP_NET_BIND_SERVICE,
CAP_SYS_CHROOT,
CAP_SYS_NICE,
CAP_NET_ADMIN,
CAP_DAC_READ_SEARCH
};
cap_value_t cap_keep_login[] = {
# ifndef WITH_PRIVSEP
# ifndef HAVE_SYS_FSUID_H
CAP_SETUID,
# endif
CAP_NET_BIND_SERVICE,
# endif
CAP_NET_ADMIN
};
...
|
|
|
|
|
|
|
|
|
|
Re: Pureftpd and Linux capabilties [message #44224 is a reply to message #44214] |
Fri, 25 November 2011 15:39 |
xdanx
Messages: 4 Registered: August 2011
|
Junior Member |
|
|
I see. Thanks for the info.
And I agree with you: it is a bit strange for pure-ftpd to ask for that many capabilities ( including NET_ADMIN )
For anyone who wants to know what they do exactly, go to http : //linux.die.net/man/7/capabilities
OR in linux
man capabilities
Cheers,
Dan
|
|
|