From 2309bb75f368da8c44a90d741d78b5e7b8a04f42 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 23 Feb 2017 22:52:21 +0100 Subject: [PATCH] change default port to 53, use setcap to enable binding to low port --- src/gns/Makefile.am | 10 +++++++++- src/gns/gnunet-dns2gns.c | 14 +++++++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/gns/Makefile.am b/src/gns/Makefile.am index 8c952be04..464bbbca1 100644 --- a/src/gns/Makefile.am +++ b/src/gns/Makefile.am @@ -69,8 +69,8 @@ endif libexec_PROGRAMS = \ gnunet-service-gns \ - $(DO_W32_HELPER) \ gnunet-dns2gns \ + $(DO_W32_HELPER) \ $(DO_PROXY) bin_PROGRAMS = \ @@ -136,6 +136,14 @@ gnunet_dns2gns_LDADD = \ $(top_builddir)/src/dns/libgnunetdnsstub.la \ $(GN_LIBINTL) +if LINUX +HIJACKBIN = gnunet-dns2gns +install-exec-hook: + $(SUDO_BINARY) setcap 'cap_net_bind_service=+ep' $(DESTDIR)$(libexecdir)/gnunet-dns2gns || true +else +install-exec-hook: +endif + gnunet_gns_proxy_SOURCES = \ gnunet-gns-proxy.c gnunet_gns_proxy_CPPFLAGS = $(AM_CPPFLAGS) $(CPP_GNURL) diff --git a/src/gns/gnunet-dns2gns.c b/src/gns/gnunet-dns2gns.c index bb37a42a3..813ecdf8e 100644 --- a/src/gns/gnunet-dns2gns.c +++ b/src/gns/gnunet-dns2gns.c @@ -138,7 +138,7 @@ static char *dns_ip; /** * UDP Port we listen on for inbound DNS requests. */ -static unsigned int listen_port = 2853; +static unsigned int listen_port = 53; /** * Which GNS zone do we translate incoming DNS requests to? @@ -796,13 +796,17 @@ main (int argc, }; int ret; - if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, - &argc, &argv)) + if (GNUNET_OK != + GNUNET_STRINGS_get_utf8_args (argc, argv, + &argc, &argv)) return 2; - GNUNET_log_setup ("gnunet-dns2gns", "WARNING", NULL); + GNUNET_log_setup ("gnunet-dns2gns", + "WARNING", + NULL); ret = (GNUNET_OK == - GNUNET_PROGRAM_run (argc, argv, "gnunet-dns2gns", + GNUNET_PROGRAM_run (argc, argv, + "gnunet-dns2gns", _("GNUnet DNS-to-GNS proxy (a DNS server)"), options, &run, NULL)) ? 0 : 1; -- 2.25.1