Skip to content

Commit

Permalink
dist: set capabilities during make install
Browse files Browse the repository at this point in the history
Resolves: #7284
  • Loading branch information
sumit-bose committed Apr 23, 2024
1 parent 55bcb88 commit f3c4707
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ SUBDIRS += . src/tests/cwrap src/tests/intg src/tests/test_CA \
# Some old versions of automake don't define builddir
builddir ?= .

SETCAP = @SETCAP@
DOXYGEN = @DOXYGEN@

DISTSETUPOPTS =
Expand Down Expand Up @@ -5566,17 +5567,22 @@ else
$(MKDIR_P) $(DESTDIR)$(initdir)
endif

CHILD_CAPABILITIES="cap_chown,cap_dac_override,cap_setuid,cap_setgid=ep"
if SSSD_USER
-chgrp $(SSSD_USER) $(DESTDIR)$(sssdlibexecdir)/ldap_child
chmod 4750 $(DESTDIR)$(sssdlibexecdir)/ldap_child
chmod 750 $(DESTDIR)$(sssdlibexecdir)/ldap_child
-$(SETCAP) $(CHILD_CAPABILITIES) $(DESTDIR)$(sssdlibexecdir)/ldap_child
-chgrp $(SSSD_USER) $(DESTDIR)$(sssdlibexecdir)/krb5_child
chmod 4750 $(DESTDIR)$(sssdlibexecdir)/krb5_child
chmod 750 $(DESTDIR)$(sssdlibexecdir)/krb5_child
-$(SETCAP) $(CHILD_CAPABILITIES) $(DESTDIR)$(sssdlibexecdir)/krb5_child
if BUILD_SELINUX
-chgrp $(SSSD_USER) $(DESTDIR)$(sssdlibexecdir)/selinux_child
chmod 4750 $(DESTDIR)$(sssdlibexecdir)/selinux_child
chmod 750 $(DESTDIR)$(sssdlibexecdir)/selinux_child
-$(SETCAP) $(CHILD_CAPABILITIES) $(DESTDIR)$(sssdlibexecdir)/selinux_child
endif
endif


install-data-hook:
rm $(DESTDIR)/$(nsslibdir)/libnss_sss.so.2 \
$(DESTDIR)/$(nsslibdir)/libnss_sss.so
Expand Down
4 changes: 4 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,10 @@ AS_IF([test x$have_libcap = x], [
], [
AC_CHECK_HEADERS([sys/capability.h],,AC_MSG_ERROR([Could not find sys/capability.h headers]))
])
AC_PATH_PROG([SETCAP], [setcap], [false])
AS_IF([test x$SETCAP == xfalse], [
AC_MSG_WARN([setcap missing, capabilities cannot be set during make install])
])

AC_PATH_PROG([DOXYGEN], [doxygen], [false])
AM_CONDITIONAL([HAVE_DOXYGEN], [test x$DOXYGEN != xfalse ])
Expand Down

0 comments on commit f3c4707

Please sign in to comment.