summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Up the release version to 2.59HEADmasterAndrew G. Morgan2021-09-268-10/+10
| | | | Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* Fix to 'make clean sudotest' reliablyAndrew G. Morgan2021-09-241-1/+1
| | | | Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* Recognize that NULL is an invalid cap_t and cap_iab_t.Andrew G. Morgan2021-09-245-13/+33
| | | | | | | | This was a regresssion introduced in libcap-2.55. Fixed in libcap-2.59. Added a cap_launch NULL test too. Comparing against NULL would cause a SIGSEGV against these library revisions. Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* Update example to avoid reference to deprecated Compare function.Andrew G. Morgan2021-09-231-1/+1
| | | | | | | In 2.54 (*Set).Compare() was deprecated in favor of (*Set).Cf(), so update the top level comment to reflect the preferred API. Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* Spelling fix.Andrew G. Morgan2021-09-221-1/+1
| | | | Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* More compliant cap.Differs documentation.Andrew G. Morgan2021-09-171-3/+17
| | | | | | Deprecation has a stylized comment format as per go.dev. Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* Up the release version to 2.58Andrew G. Morgan2021-09-178-10/+10
| | | | Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* Fix typo in capsh.Andrew G. Morgan2021-09-141-1/+1
| | | | Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* Add some debugging info for the pam_cap.so deferred callback.Andrew G. Morgan2021-09-141-0/+18
| | | | | | | | | | | | | | | | As with the other D(()) entries in the pam_cap.so module, this is enabled if the /* #define PAM_DEBUG */ comment is uncommented at the top of the pam_cap.so file. I tried this on a sample app and it didn't actually follow the documentation: http://www.linux-pam.org/Linux-PAM-html/adg-interface-by-app-expected.html#adg-pam_end where no pam_end() call was made to terminate the fork()ed copy of the pamh value. That app needs to be fixed. Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* Another attempt at supporting Ambient vector setting from pam_cap.so.Andrew G. Morgan2021-09-143-60/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | While the session idea worked with contrib/sucap/su.c, it failed on more traditional PAM apps. For a second (likely last) attempt to find a path, I've deleted the session support and now attempt to do the setting via a PAM data item cleanup() callback. In the contrib/sucap/su.c code, evolved from the original SimplePAMApps 'su', there is a pam_end(pamh, PAM_SUCCESS | PAM_DATA_SILENT) from within the fork()d launcher code, so I hope this convention is standard for all the PAM apps that came after. The suggested config for this module for an app, that wants to support the Ambient vector, is thus now: #%PAM-1.0 auth required pam_cap.so keepcaps defer auth required pam_unix.so account required pam_unix.so password required pam_unix.so session required pam_unix.so This is all part of an effort to address: https://bugzilla.kernel.org/show_bug.cgi?id=214377 Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* Not sure why I didn't include this line before!Andrew G. Morgan2021-09-141-0/+1
| | | | Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* Simplify the contric/sucap/su structure.Andrew G. Morgan2021-09-132-77/+80
| | | | | | | | Also include the aggressive default CFLAGS, and fix the many many issues it uncovered. (Honestly, it was a wonder it worked at all before.) Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* Add PAM "session" support to pam_cap.so.Andrew G. Morgan2021-09-133-19/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is an attempt to address: https://bugzilla.kernel.org/show_bug.cgi?id=214377 The basic structure is you configure PAM with a config like this: #%PAM-1.0 auth required pam_cap.so use_session keepcaps auth required pam_unix.so account required pam_unix.so password required pam_unix.so session required pam_unix.so session optional pam_cap.so Here the "auth" part prepares the application with "keepcaps", and the "use_session" instructs the module to apply any IAB tuple for the user at session open time and not during the setcred (auth) flow. This has been tested against the contrib/sucap implementation of su. The "use_session" support should work with more standard PAM enabled apps too, but I'll wait for some positive feedback (see the bug) before declaring it stable. FWIW the contrib/sucap/su app also supports this config for Ambient vector setting (without a "session" invocation of pam_cap.so): #%PAM-1.0 auth required pam_cap.so auth required pam_unix.so account required pam_unix.so password required pam_unix.so session required pam_unix.so but that is because the sucap/su app is more tightly integrated with libcap than the standard PAM apps. Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* Free _cap_proc_dir on exit.Andrew G. Morgan2021-09-121-0/+13
| | | | | | | | Credit to yan12125 for finding this bug: https://bugzilla.kernel.org/show_bug.cgi?id=214373 Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* kdebug shouldn't require sudotest to build uns_test binary.Andrew G. Morgan2021-09-121-1/+2
| | | | | | | Part of the reason for the QEMU kernel test is to fully test the library against kernels without requiring sudo. Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* Recover the kdebug make rules.Andrew G. Morgan2021-09-111-1/+1
| | | | | | | These were broken as a result of delaying building the test and sudotest binaries until they were actually needed. Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* Add in something the builder can override to augment the GO buildsAndrew G. Morgan2021-09-112-12/+13
| | | | | | | | | | | | | | | | | | | I've been looking at reasons packagers are not building the Go binaries and found this with respect to RPMs: https://github.com/rpm-software-management/rpm/issues/367 There has been no easy way to inject the otherwise unneeded workaround: -ldflags=-linkmode=external for building (which, strangely, generates some sort of warning and gratuitously links glibc to an otherwise static build), but seems to work. Until RPM supports Go's native '.note.go.buildid', and RPM requires '.note.gnu.build-id' on binaries, I guess this can work around it: GO_BUILD_FLAGS='-ldflags=-linkmode=external' Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* Update pam_cap .gitignore fileAndrew G. Morgan2021-09-101-0/+1
| | | | Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* Another missing dependency for make -j13Andrew G. Morgan2021-09-101-1/+6
| | | | | | One more missing dependency for pam_cap.so building. Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* More standard deprecation comment for cap.Compare and cap.IABInitAndrew G. Morgan2021-09-102-6/+39
| | | | | | | | Based on what I see on go.dev, there seems to be some preferred comment style for deprecating a function. Use it to help spread the word. Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* Up the release version to 2.57Andrew G. Morgan2021-09-098-10/+10
| | | | Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* Implement --strict capsh argument.Andrew G. Morgan2021-09-073-95/+109
| | | | | | | | | | | | | | Up to this point, capsh hides some complexity concerning raising the CAP_SETPCAP in order to raise inheritable and drop bounding set values. This made it harder to explain some aspects of inheritance, and I ran into that detail writing this: https://sites.google.com/site/fullycapable/why-didnt-that-work#h.z7rwbcazhr4r Refactored capsh.c to clean up some buggy code, and also fix some documentation, including reference to the --strict argument. Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* Be more systematic about POSIX.1e value group namesAndrew G. Morgan2021-09-076-78/+94
| | | | | | | cap.Set's have Flag component Values cap.IAB's have Vector component Values Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* Fixed parallel make issuesAndrew G. Morgan2021-09-053-3/+3
| | | | | | Tried make -j12 and these fixes were needed. Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* Treat ENOTSUP as an expected error for getcap.Andrew G. Morgan2021-09-051-1/+1
| | | | | | | | | | | | Things like /proc/* files don't support capabilities on them and if getcap looks at them it generates a lot of errors. Treat it as equivalent to there being no capability on the file. This addresses https://bugzilla.kernel.org/show_bug.cgi?id=214317 Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* Add --mode query support to capshAndrew G. Morgan2021-09-052-27/+41
| | | | | | | | This addresses the feature request: https://bugzilla.kernel.org/show_bug.cgi?id=214319 Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* Refactor top level Makefile to reduce redundant buildingAndrew G. Morgan2021-09-046-28/+21
| | | | | | Make build a bit quicker for folk that don't want to run tests. Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* Don't build the tests/binaries until we want to run themAndrew G. Morgan2021-09-041-5/+3
| | | | Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* Build system fixesDavid Seifert2021-09-041-2/+3
| | | | | | | Summary: - Always keep $(WARNINGS) when overriding CFLAGS Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* Up the release version to 2.56Andrew G. Morgan2021-09-028-10/+10
| | | | Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* Document latest option for captree in its man page.Andrew G. Morgan2021-09-021-1/+8
| | | | Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* Make captree use --color on any terminal by default.Andrew G. Morgan2021-09-021-13/+28
| | | | | | | | Disable with --colo[u]r=false or pipe into something else. Ex. 'captree | cat' Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* Avoid disecting sub-trees of processes in captree output.Andrew G. Morgan2021-09-011-12/+84
| | | | | | | | | | | Added --color as an argument to make it easier to spot what you are looking for in the output. This addresses item (2) of: https://bugzilla.kernel.org/show_bug.cgi?id=214269 Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* Don't display duplicate subtrees with captree.Andrew G. Morgan2021-09-011-0/+8
| | | | | | | | This addresses issue (1) of: https://bugzilla.kernel.org/show_bug.cgi?id=214269 Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* sucap/su should start with an empty INHERITABLE flag.Andrew G. Morgan2021-09-011-3/+14
| | | | Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* Canonicalize build systemDavid Seifert2021-09-016-20/+12
| | | | | | | | | | | | | | | * Respect user's CFLAGS/CPPFLAGS/LDFLAGS * Respect $(MAKE) * Remove CPPFLAGS from link rules Note: for in-tree built test binaries, where we build --static, we do not apply LDFLAGS: we want to limit external dependencies in general; and users' LDFLAGS have a strong tendency to conflict with --static for linking. Work in collaboration with David Seifert (ie, he wrote most of it). Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* cap_iab.3 doc fixes and cleanupAndrew G. Morgan2021-09-011-34/+31
| | | | Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* Permit root to run test_pam_cap without arguments.Andrew G. Morgan2021-09-011-1/+6
| | | | | | | | | This fixes a bug preventing 'make test' from working when invoked by root. Bug reported by David Seifert: https://bugzilla.kernel.org/show_bug.cgi?id=214257 Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* Move $(LDFLAGS) earlier in build command lines.Andrew G. Morgan2021-08-313-13/+15
| | | | | | | | | As explained (thanks David Seifert) there are some LDFLAGS that need to precede actual linked libraries. For example, -Wl,--as-needed. Given this, I've tried it and it appears to work for the default build cases as captured in 'make distcheck'. Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* Resurrect the $(WARNINGS) for the target buildAndrew G. Morgan2021-08-312-6/+6
| | | | Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* Be more consistent with make variables.Andrew G. Morgan2021-08-304-25/+27
| | | | | | | | Noticed that we weren't applying the same amount of flag discipline to local BUILD_* tool rules. Fixing that, I see we've been carrying a source code issue in libcap/_makenames.c for a while. (FIXED). Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* Up the release version to 2.55Andrew G. Morgan2021-08-298-10/+10
| | | | Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* Update man pages.Andrew G. Morgan2021-08-295-30/+50
| | | | | | Some fixes, some more efficient URLs, some more coherrent cross-references. Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* Add captree command line options and support process by name.Andrew G. Morgan2021-08-293-9/+117
| | | | | | | | | Add some features to captree. I plan to post a companion article here: https://sites.google.com/site/fullycapable/captree Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* Make sudotest more robust against untestable environmentsAndrew G. Morgan2021-08-287-9/+41
| | | | | | | I'm setting up some testing environments and they are not all created equal. Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* Avoid the build server failure.Andrew G. Morgan2021-08-282-9/+19
| | | | | | | | | I figured out that the key ingredient to reproducing this issue was: make COPTS="-D_FORTIFY_SOURCE=2 -O1 -g" clean test Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* Still unclear where cap_test is crashing.Andrew G. Morgan2021-08-271-0/+28
| | | | | | Add more debug logging. Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* Speculative fix for build failure.Andrew G. Morgan2021-08-273-6/+16
| | | | | | | | Not sure exactly what is causing the build server to fail (can't reproduce yet), but add some extra padding to a calloc and also some test debugging printf()s. Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* Implement libcap:cap_proc_root() function.Andrew G. Morgan2021-08-274-4/+74
| | | | | | | | | | This is needed to locally configure libcap to find the pid data if the proc filesystem is not mounted at "/proc" (rare). Currently libcap only uses this info to implement cap_iab_get_pid(). This brings libcap back to parity with the Go "cap" package. Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
* More fixes for static analysis issues.Andrew G. Morgan2021-08-279-38/+199
| | | | | | | | | Further observations from Zoltan Fridrich's static analysis of libcap. This commit also includes a fix for something I broke with the last round of "fixing", and a test to make sure I don't make that mistake again. Signed-off-by: Andrew G. Morgan <morgan@kernel.org>