summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2015-11-06 13:12:44 -0500
committerNick Mathewson <nickm@torproject.org>2015-12-15 13:10:57 -0500
commite8cc839e41adc4975a61fee62abe7f6664fd0c0e (patch)
treee1a5bc14b66ae047858e24fe2fc4d8903a5a7a0f /configure.ac
parentaf80d472f7d6cb32370176d4dd02b5194adf0f3d (diff)
downloadtor-e8cc839e41adc4975a61fee62abe7f6664fd0c0e.tar.gz
tor-e8cc839e41adc4975a61fee62abe7f6664fd0c0e.zip
Add ability to keep the CAP_NET_BIND_SERVICE capability on Linux
This feature allows us to bind low ports when starting as root and switching UIDs. Based on code by David Goulet. Implement feature 8195
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac16
1 files changed, 15 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 3bf2f471e0..eb7f2c2e26 100644
--- a/configure.ac
+++ b/configure.ac
@@ -698,6 +698,19 @@ else
fi
AC_SUBST(TOR_ZLIB_LIBS)
+dnl ----------------------------------------------------------------------
+dnl Check if libcap is available for capabilities.
+
+tor_cap_pkg_debian="libcap2"
+tor_cap_pkg_redhat="libcap"
+tor_cap_devpkg_debian="libcap-dev"
+tor_cap_devpkg_redhat="libcap-devel"
+
+AC_CHECK_LIB([cap], [cap_init], [],
+ AC_MSG_NOTICE([Libcap was not found. Capabilities will not be usable.])
+)
+AC_CHECK_FUNCS(cap_set_proc)
+
dnl ---------------------------------------------------------------------
dnl Now that we know about our major libraries, we can check for compiler
dnl and linker hardening options. We need to do this with the libraries known,
@@ -705,7 +718,7 @@ dnl since sometimes the linker will like an option but not be willing to
dnl use it with a build of a library.
all_ldflags_for_check="$TOR_LDFLAGS_zlib $TOR_LDFLAGS_openssl $TOR_LDFLAGS_libevent"
-all_libs_for_check="$TOR_ZLIB_LIBS $TOR_LIB_MATH $TOR_LIBEVENT_LIBS $TOR_OPENSSL_LIBS $TOR_SYSTEMD_LIBS $TOR_LIB_WS32 $TOR_LIB_GDI"
+all_libs_for_check="$TOR_ZLIB_LIBS $TOR_LIB_MATH $TOR_LIBEVENT_LIBS $TOR_OPENSSL_LIBS $TOR_SYSTEMD_LIBS $TOR_LIB_WS32 $TOR_LIB_GDI $TOR_CAP_LIBS"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
#if !defined(__clang__)
@@ -898,6 +911,7 @@ AC_CHECK_HEADERS(
fcntl.h \
signal.h \
string.h \
+ sys/capability.h \
sys/fcntl.h \
sys/stat.h \
sys/time.h \