Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dist: set capabilities during make install #7292

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 22 additions & 9 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 @@ -5420,6 +5421,7 @@ src/tools/wrappers/sss_debuglevel: src/tools/wrappers/sss_debuglevel.in Makefile
$(replace_script)

SSSD_USER_DIRS = \
$(DESTDIR)$(sss_statedir) \
$(DESTDIR)$(dbpath) \
$(DESTDIR)$(keytabdir) \
$(DESTDIR)$(mcpath) \
Expand All @@ -5433,6 +5435,7 @@ SSSD_USER_DIRS = \
$(DESTDIR)$(sssddefaultconfdir) \
$(DESTDIR)$(logpath) \
$(DESTDIR)$(deskprofilepath) \
$(DESTDIR)$(runstatedir)/sssd \
$(NULL)

installsssddirs::
Expand Down Expand Up @@ -5460,14 +5463,18 @@ if SSSD_USER
-chown $(SSSD_USER):$(SSSD_USER) $(SSSD_USER_DIRS)
-chown $(SSSD_USER) $(DESTDIR)$(pipepath)/private
endif
$(INSTALL) -d -m 0700 $(DESTDIR)$(dbpath) $(DESTDIR)$(logpath) \
$(DESTDIR)$(keytabdir) \
$(INSTALL) -d -m 0770 $(DESTDIR)$(dbpath) $(DESTDIR)$(logpath) \
$(DESTDIR)$(keytabdir) $(DESTDIR)$(gpocachepath) \
$(NULL)
$(INSTALL) -d -m 0750 $(DESTDIR)$(pipepath)/private
$(INSTALL) -d -m 0755 $(DESTDIR)$(mcpath) $(DESTDIR)$(pipepath) \
$(INSTALL) -d -m 0770 $(DESTDIR)$(pipepath)/private
$(INSTALL) -d -m 0771 $(DESTDIR)$(deskprofilepath)
$(INSTALL) -d -m 0775 $(DESTDIR)$(sss_statedir) \
$(DESTDIR)$(mcpath) $(DESTDIR)$(pipepath) \
$(DESTDIR)$(pubconfpath) \
$(DESTDIR)$(pubconfpath)/krb5.include.d $(DESTDIR)$(gpocachepath)
$(INSTALL) -d -m 0711 $(DESTDIR)$(sssdconfdir) \
$(DESTDIR)$(pubconfpath)/krb5.include.d \
$(DESTDIR)$(runstatedir)/sssd \
$(NULL)
$(INSTALL) -d -m 0750 $(DESTDIR)$(sssdconfdir) \
$(DESTDIR)$(sssdconfdir)/conf.d \
$(DESTDIR)$(sssdconfdir)/pki

Expand Down Expand Up @@ -5566,17 +5573,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 All @@ -5590,6 +5602,7 @@ endif
if BUILD_KCM
$(MKDIR_P) $(DESTDIR)/$(sssdkcmdatadir)
$(MKDIR_P) $(DESTDIR)$(secdbpath)
$(INSTALL) -d -m 0700 $(DESTDIR)$(secdbpath)
endif

uninstall-hook:
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
Loading