summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorng0 <ng0@n0.is>2019-10-17 13:49:49 +0000
committerng0 <ng0@n0.is>2019-10-17 13:49:49 +0000
commit9d41ec39756a783c53bb06581ea189c95e08c4d6 (patch)
tree08263348bc5cbeaa8e0a5dc21fcf0fdaabb7184a
parent22ad43e23641318de7f50084aa816a6fda14d7ec (diff)
Add support for doas.
-rw-r--r--ChangeLog6
-rw-r--r--configure.ac5
-rw-r--r--src/dns/Makefile.am10
-rw-r--r--src/exit/Makefile.am10
-rw-r--r--src/gns/Makefile.am10
-rw-r--r--src/nat/Makefile.am22
-rw-r--r--src/transport/Makefile.am12
-rw-r--r--src/vpn/Makefile.am10
8 files changed, 70 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index 315c869e4..3e083f2eb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
+Thu Oct 17 00:00:00 UTC 2019
+ Added support for doas, use it in some places conditionally
+ if sudo is not present. -ng0
+
Mon Oct 14 00:00:00 UTC 2019
- Add 'pretty' make rule to run uncrustify over the source tree.
+ Added 'pretty' make rule to run uncrustify over the source tree.
-ng0
Mon Sep 16 00:00:00 UTC 2019
diff --git a/configure.ac b/configure.ac
index f56d2f508..f1c93b309 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1357,7 +1357,6 @@ DATAROOTDIR=$datarootdir
AC_SUBST(DATAROOTDIR)
# test for sudo
-# TODO: do we need to change anything for "doas" on openbsd?
AC_MSG_CHECKING(for sudo)
AC_ARG_WITH(sudo,
[ --with-sudo=PATH path to sudo binary (or just yes)],
@@ -1371,6 +1370,10 @@ AC_SUBST(SUDO_BINARY)
AM_CONDITIONAL([HAVE_SUDO],
[test "x$SUDO_BINARY" != "x" -o -w /])
+# test for doas
+AC_MSG_CHECKING(for doas)
+AC_CHECK_PROGS(DOAS_BINARY, [doas], false)
+AM_CONDITIONAL(HAVE_DOAS_BINARY, test x$DOAS_BINARY != xfalse)
# test for gnunetdns group name
GNUNETDNS_GROUP=gnunetdns
diff --git a/src/dns/Makefile.am b/src/dns/Makefile.am
index 33ec8ef85..acf9660f7 100644
--- a/src/dns/Makefile.am
+++ b/src/dns/Makefile.am
@@ -14,10 +14,18 @@ plugindir = $(libdir)/gnunet
pkgcfg_DATA = \
dns.conf
+if HAVE_SUDO
+SUDO_OR_DOAS_BINARY= $(SUDO_BINARY)
+else
+if HAVE_DOAS_BINARY
+SUDO_OR_DOAS_BINARY= $(DOAS_BINARY)
+endif
+endif
+
if LINUX
HIJACKBIN = gnunet-helper-dns
install-exec-hook:
- $(top_srcdir)/src/dns/install-dns-helper.sh $(DESTDIR)$(libexecdir) $(GNUNETDNS_GROUP) $(SUDO_BINARY) || true
+ $(top_srcdir)/src/dns/install-dns-helper.sh $(DESTDIR)$(libexecdir) $(GNUNETDNS_GROUP) $(SUDO_OR_DOAS_BINARY) || true
else
install-exec-hook:
endif
diff --git a/src/exit/Makefile.am b/src/exit/Makefile.am
index b7286349d..bca0f1d9f 100644
--- a/src/exit/Makefile.am
+++ b/src/exit/Makefile.am
@@ -14,10 +14,18 @@ plugindir = $(libdir)/gnunet
dist_pkgcfg_DATA = \
exit.conf
+if HAVE_SUDO
+SUDO_OR_DOAS_BINARY= $(SUDO_BINARY)
+else
+if HAVE_DOAS_BINARY
+SUDO_OR_DOAS_BINARY= $(DOAS_BINARY)
+endif
+endif
+
if LINUX
EXITBIN = gnunet-helper-exit
install-exec-hook:
- $(top_srcdir)/src/exit/install-exit-helper.sh $(DESTDIR)$(libexecdir) $(SUDO_BINARY) || true
+ $(top_srcdir)/src/exit/install-exit-helper.sh $(DESTDIR)$(libexecdir) $(SUDO_OR_DOAS_BINARY) || true
else
install-exec-hook:
endif
diff --git a/src/gns/Makefile.am b/src/gns/Makefile.am
index 6cc09c098..48d13e3c0 100644
--- a/src/gns/Makefile.am
+++ b/src/gns/Makefile.am
@@ -158,10 +158,18 @@ gnunet_dns2gns_LDADD = \
$(top_builddir)/src/identity/libgnunetidentity.la \
$(GN_LIBINTL)
+if HAVE_SUDO
+SUDO_OR_DOAS_BINARY= $(SUDO_BINARY)
+else
+if HAVE_DOAS_BINARY
+SUDO_OR_DOAS_BINARY= $(DOAS_BINARY)
+endif
+endif
+
if LINUX
HIJACKBIN = gnunet-dns2gns
install-exec-hook:
- $(SUDO_BINARY) setcap 'cap_net_bind_service=+ep' $(DESTDIR)$(libexecdir)/gnunet-dns2gns || true
+ $(SUDO_OR_DOAS_BINARY) setcap 'cap_net_bind_service=+ep' $(DESTDIR)$(libexecdir)/gnunet-dns2gns || true
else
install-exec-hook:
endif
diff --git a/src/nat/Makefile.am b/src/nat/Makefile.am
index db104d194..d88dd6db4 100644
--- a/src/nat/Makefile.am
+++ b/src/nat/Makefile.am
@@ -8,19 +8,27 @@ pkgcfgdir= $(pkgdatadir)/config.d/
pkgcfg_DATA = \
nat.conf
+if HAVE_SUDO
+SUDO_OR_DOAS_BINARY= $(SUDO_BINARY)
+else
+if HAVE_DOAS_BINARY
+SUDO_OR_DOAS_BINARY= $(DOAS_BINARY)
+endif
+endif
+
if LINUX
NATBIN = gnunet-helper-nat-server gnunet-helper-nat-client
NATSERVER = gnunet-helper-nat-server.c
NATCLIENT = gnunet-helper-nat-client.c
install-exec-hook:
- $(top_srcdir)/src/nat/install-nat-helper.sh $(DESTDIR)$(libexecdir) $(SUDO_BINARY) || true
+ $(top_srcdir)/src/nat/install-nat-helper.sh $(DESTDIR)$(libexecdir) $(SUDO_OR_DOAS_BINARY) || true
else
if XFREEBSD
NATBIN = gnunet-helper-nat-server gnunet-helper-nat-client
NATSERVER = gnunet-helper-nat-server.c
NATCLIENT = gnunet-helper-nat-client.c
install-exec-hook:
- $(top_srcdir)/src/nat/install-nat-helper.sh $(DESTDIR)$(libexecdir) $(SUDO_BINARY) || true
+ $(top_srcdir)/src/nat/install-nat-helper.sh $(DESTDIR)$(libexecdir) $(SUDO_OR_DOAS_BINARY) || true
endif
else
install-exec-hook:
@@ -61,7 +69,7 @@ libgnunetnatnew_la_SOURCES = \
nat.h
libgnunetnatnew_la_LIBADD = \
$(top_builddir)/src/util/libgnunetutil.la \
- $(GN_LIBINTL) @EXT_LIBS@
+ $(GN_LIBINTL) @EXT_LIBS@
libgnunetnatnew_la_LDFLAGS = \
$(GN_LIB_LDFLAGS) $(WINFLAGS) \
-version-info 2:0:0
@@ -94,25 +102,25 @@ endif
# test_nat.c
#test_nat_LDADD = \
# libgnunetnat.la \
-# $(top_builddir)/src/util/libgnunetutil.la
+# $(top_builddir)/src/util/libgnunetutil.la
#test_nat_mini_SOURCES = \
# test_nat_mini.c
#test_nat_mini_LDADD = \
# libgnunetnat.la \
-# $(top_builddir)/src/util/libgnunetutil.la
+# $(top_builddir)/src/util/libgnunetutil.la
#test_nat_test_SOURCES = \
# test_nat_test.c
#test_nat_test_LDADD = \
# libgnunetnat.la \
-# $(top_builddir)/src/util/libgnunetutil.la
+# $(top_builddir)/src/util/libgnunetutil.la
#test_stun_SOURCES = \
# test_stun.c
#test_stun_LDADD = \
# libgnunetnat.la \
-# $(top_builddir)/src/util/libgnunetutil.la
+# $(top_builddir)/src/util/libgnunetutil.la
EXTRA_DIST = \
test_nat_data.conf \
diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am
index 0f5b2e8be..178ecc737 100644
--- a/src/transport/Makefile.am
+++ b/src/transport/Makefile.am
@@ -93,11 +93,19 @@ if LINUX
test_quota_compliance_wlan_asymmetric
endif
+if HAVE_SUDO
+SUDO_OR_DOAS_BINARY= $(SUDO_BINARY)
+else
+if HAVE_DOAS_BINARY
+SUDO_OR_DOAS_BINARY= $(DOAS_BINARY)
+endif
+endif
+
if LINUX
install-exec-hook:
- $(top_srcdir)/src/transport/install-wlan-helper.sh $(DESTDIR)$(libexecdir) $(SUDO_BINARY) || true
+ $(top_srcdir)/src/transport/install-wlan-helper.sh $(DESTDIR)$(libexecdir) $(SUDO_OR_DOAS_BINARY) || true
if HAVE_LIBBLUETOOTH
- $(top_srcdir)/src/transport/install-bluetooth-helper.sh $(DESTDIR)$(libexecdir) $(SUDO_BINARY) || true
+ $(top_srcdir)/src/transport/install-bluetooth-helper.sh $(DESTDIR)$(libexecdir) $(SUDO_OR_DOAS_BINARY) || true
endif
else
install-exec-hook:
diff --git a/src/vpn/Makefile.am b/src/vpn/Makefile.am
index 3ad9b1a54..4d7ca087e 100644
--- a/src/vpn/Makefile.am
+++ b/src/vpn/Makefile.am
@@ -14,10 +14,18 @@ plugindir = $(libdir)/gnunet
pkgcfg_DATA = \
vpn.conf
+if HAVE_SUDO
+SUDO_OR_DOAS_BINARY= $(SUDO_BINARY)
+else
+if HAVE_DOAS_BINARY
+SUDO_OR_DOAS_BINARY= $(DOAS_BINARY)
+endif
+endif
+
if LINUX
VPNBIN = gnunet-helper-vpn
install-exec-hook:
- $(top_srcdir)/src/vpn/install-vpn-helper.sh $(DESTDIR)$(libexecdir) $(SUDO_BINARY) || true
+ $(top_srcdir)/src/vpn/install-vpn-helper.sh $(DESTDIR)$(libexecdir) $(SUDO_OR_DOAS_BINARY) || true
else
install-exec-hook:
endif