From: Jonas Witschel <diabonas@archlinux.org>
To: "Aurélien Aptel" <aaptel@suse.com>
Cc: linux-cifs@vger.kernel.org
Subject: Re: [PATCH 0/2] cifs-utils: update the cap bounding set only when CAP_SETPCAP is given
Date: Tue, 24 Nov 2020 14:37:40 +0100 [thread overview]
Message-ID: <20201124133740.cixyh57b3rlto54n@archlinux.org> (raw)
In-Reply-To: <87tutflztq.fsf@suse.com>
[-- Attachment #1: Type: text/plain, Size: 1555 bytes --]
Hi Aurélien,
On 2020-11-24 13:11, Aurélien Aptel wrote:
> This sounds good but I'm not very familiar with libcap, any ideas how we
> can test those code paths?
a simple integration test would be trying to run mount.cifs as a setuid binary
with normal user rights. With libcap-ng 0.8.1 and an unpatched version of
cifs-utils 6.11, this will result in the error message "Unable to apply new
capability set."
$ git clone --branch=cifs-utils-6.11 https://git.samba.org/cifs-utils.git
$ cd cifs-utils
$ autoreconf -i
$ ./configure
$ make
$ sudo chown root:root ./mount.cifs
$ sudo chmod u+s ./mount.cifs
$ ./mount.cifs test /mnt
Unable to apply new capability set.
After applying the patch series, mount.cifs will work normally:
$ ./mount.cifs test /mnt
mount.cifs: permission denied: no match for /mnt found in /etc/fstab
For cifs.upcall, I guess this is usually run with elevated privileges, so it
will normally have CAP_SETPCAP, but for testing purposes, we can grant the
necessary capabilities manually and run as a normal user:
$ sudo setcap cap_setuid,cap_setgid,cap_sys_ptrace,cap_dac_read_search=ep ./cifs.upcall
$ ./cifs.upcall
Without the patch, this will fail with an empty stderr and an error of
"trim_capabilities: Unable to apply capability set: Success" in the syslog.
With the patch, applying the capabilities succeeds and the usage information
Usage: cifs.upcall [ -K /path/to/keytab] [-k /path/to/krb5.conf] [-E] [-t] [-v] [-l] [-e nsecs] key_serial
is displayed on stderr.
Best,
Jonas
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2020-11-24 13:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-21 11:11 [PATCH 0/2] cifs-utils: update the cap bounding set only when CAP_SETPCAP is given Jonas Witschel
2020-11-21 11:11 ` [PATCH 1/2] mount.cifs: " Jonas Witschel
2020-11-21 11:11 ` [PATCH 2/2] cifs.upall: " Jonas Witschel
2020-11-24 12:11 ` [PATCH 0/2] cifs-utils: " Aurélien Aptel
2020-11-24 13:37 ` Jonas Witschel [this message]
2020-11-27 10:01 ` Aurélien Aptel
2020-12-09 19:15 ` Pavel Shilovsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201124133740.cixyh57b3rlto54n@archlinux.org \
--to=diabonas@archlinux.org \
--cc=aaptel@suse.com \
--cc=linux-cifs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox