From 92609e8b088bf1dde6b927dc0e3be2e9092f0f87 Mon Sep 17 00:00:00 2001 From: "psyc://loupsycedyglgamf.onion/~lynX" Date: Sat, 23 Jun 2018 13:30:01 +0000 Subject: require gnunet.conf to specify which services to run --- src/arm/gnunet-service-arm.c | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/arm/gnunet-service-arm.c b/src/arm/gnunet-service-arm.c index b56c9c0a8..4f443d0a1 100644 --- a/src/arm/gnunet-service-arm.c +++ b/src/arm/gnunet-service-arm.c @@ -234,6 +234,11 @@ static struct GNUNET_DISK_PipeHandle *sigpipe; */ static int in_shutdown; +/** + * Return value from main + */ +static int global_ret; + /** * Are we starting user services? */ @@ -2219,21 +2224,20 @@ run (void *cls, else final_option = GNUNET_CONFIGURATION_expand_dollar (cfg, final_option); - if (GNUNET_YES == - GNUNET_CONFIGURATION_get_value_yesno (cfg, + start_user = GNUNET_CONFIGURATION_get_value_yesno (cfg, "ARM", - "USER_ONLY")) - { - GNUNET_break (GNUNET_YES == start_user); - start_system = GNUNET_NO; - } - if (GNUNET_YES == - GNUNET_CONFIGURATION_get_value_yesno (cfg, + "USER_ONLY"); + start_system = GNUNET_CONFIGURATION_get_value_yesno (cfg, "ARM", - "SYSTEM_ONLY")) + "SYSTEM_ONLY"); + if ( (GNUNET_NO == start_user) && + (GNUNET_NO == start_system) ) { - GNUNET_break (GNUNET_YES == start_system); - start_user = GNUNET_NO; + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Please configure either USER_ONLY or SYSTEM_ONLY or both.\n"); + GNUNET_SCHEDULER_shutdown (); + global_ret = 1; + return; } GNUNET_CONFIGURATION_iterate_sections (cfg, &setup_service, @@ -2260,7 +2264,6 @@ int main (int argc, char *const *argv) { - int ret; struct GNUNET_SIGNAL_Context *shc_chld; struct GNUNET_MQ_MessageHandler handlers[] = { GNUNET_MQ_hd_var_size (start, @@ -2294,7 +2297,7 @@ main (int argc, shc_chld = GNUNET_SIGNAL_handler_install (GNUNET_SIGCHLD, &sighandler_child_death); - ret = GNUNET_SERVICE_run_ (argc, + if ( GNUNET_OK != GNUNET_SERVICE_run_ (argc, argv, "arm", GNUNET_SERVICE_OPTION_MANUAL_SHUTDOWN, @@ -2302,7 +2305,8 @@ main (int argc, &client_connect_cb, &client_disconnect_cb, NULL, - handlers); + handlers)) + global_ret = 2; #if HAVE_WAIT4 if (NULL != wait_file) { @@ -2319,7 +2323,7 @@ main (int argc, shc_chld = NULL; GNUNET_DISK_pipe_close (sigpipe); sigpipe = NULL; - return ret; + return global_ret; } -- cgit v1.2.3 From e5daa4634f5fb7e22ed07c882e224b65c3d78ada Mon Sep 17 00:00:00 2001 From: "psyc://loupsycedyglgamf.onion/~lynX" Date: Sat, 23 Jun 2018 13:30:02 +0000 Subject: rename USER/SYSTEM_ONLY into START_USER/SYSTEM_SERVICES (#4548) --- contrib/ci/docker/Dockerfile | 2 +- doc/documentation/chapters/developer.texi | 8 ++++---- doc/documentation/chapters/user.texi | 8 ++++---- doc/man/gnunet.conf.5 | 4 ++-- src/arm/arm.conf.in | 6 +++--- src/arm/gnunet-service-arm.c | 6 +++--- src/pt/test_gns_vpn.conf | 4 ++-- 7 files changed, 19 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/contrib/ci/docker/Dockerfile b/contrib/ci/docker/Dockerfile index 42c64eaf3..b9f019c43 100644 --- a/contrib/ci/docker/Dockerfile +++ b/contrib/ci/docker/Dockerfile @@ -22,7 +22,7 @@ RUN cd /usr/src/gnunet && ./bootstrap && ./configure --enable-experimental --pre RUN addgroup gnunetdns && addgroup gnunet && adduser --system --home /var/lib/gnunet gnunet RUN chown gnunet:gnunet /var/lib/gnunet -RUN echo '[arm]\nSYSTEM_ONLY = YES\nUSER_ONLY = NO\n' > /etc/gnunet.conf +RUN echo '[arm]\nSTART_SYSTEM_SERVICES = YES\nSTART_USER_SERVICES = NO\n' > /etc/gnunet.conf ADD docker-entrypoint.sh . diff --git a/doc/documentation/chapters/developer.texi b/doc/documentation/chapters/developer.texi index 10319e7a6..6d85c813f 100644 --- a/doc/documentation/chapters/developer.texi +++ b/doc/documentation/chapters/developer.texi @@ -1362,8 +1362,8 @@ Next, edit the file @file{/etc/gnunet.conf} to contain the following: @example [arm] -SYSTEM_ONLY = YES -USER_ONLY = NO +START_SYSTEM_SERVICES = YES +START_USER_SERVICES = NO @end example @noindent @@ -1409,8 +1409,8 @@ with the lines: @example [arm] -SYSTEM_ONLY = NO -USER_ONLY = YES +START_SYSTEM_SERVICES = NO +START_USER_SERVICES = YES DEFAULTSERVICES = gns @end example diff --git a/doc/documentation/chapters/user.texi b/doc/documentation/chapters/user.texi index 07dd781b0..fa742b229 100644 --- a/doc/documentation/chapters/user.texi +++ b/doc/documentation/chapters/user.texi @@ -3742,8 +3742,8 @@ contain the lines:@ @example [arm] -SYSTEM_ONLY = YES -USER_ONLY = NO +START_SYSTEM_SERVICES = YES +START_USER_SERVICES = NO @end example @noindent @@ -3771,8 +3771,8 @@ $USER with the lines: @example [arm] -SYSTEM_ONLY = NO -USER_ONLY = YES +START_SYSTEM_SERVICES = NO +START_USER_SERVICES = YES @end example @noindent diff --git a/doc/man/gnunet.conf.5 b/doc/man/gnunet.conf.5 index 707964579..518a352ce 100644 --- a/doc/man/gnunet.conf.5 +++ b/doc/man/gnunet.conf.5 @@ -137,8 +137,8 @@ to the actual external address for your usage. EXTERNAL_ADDRESS = 157.166.249.10 [arm] - SYSTEM_ONLY = YES - USER_ONLY = NO + START_SYSTEM_SERVICES = YES + START_USER_SERVICES = NO .SH FILES .TP diff --git a/src/arm/arm.conf.in b/src/arm/arm.conf.in index 38cf4599c..64ae35786 100644 --- a/src/arm/arm.conf.in +++ b/src/arm/arm.conf.in @@ -22,9 +22,9 @@ GLOBAL_PREFIX = @MONKEYPREFIX@ # system-level services (and we'll expect a second ARM to be # run per-user to run user-level services). Note that in this # case you must have manually created a different configuration -# file with the user where at least this and the USER_ONLY +# file with the user where at least this and the START_USER_SERVICES # options differ. -# SYSTEM_ONLY = YES +# START_SYSTEM_SERVICES = YES # If set to YES, ARM will only start services that are marked as # per-user services (and we'll expect a system user to run ARM to @@ -39,7 +39,7 @@ GLOBAL_PREFIX = @MONKEYPREFIX@ # USER ARM instances to some free port (counting down from 2085 should # be sane). # -# USER_ONLY = YES +# START_USER_SERVICES = YES # File where we should log per-service resource consumption on exit. # RESOURCE_DIAGNOSTICS = resource.log diff --git a/src/arm/gnunet-service-arm.c b/src/arm/gnunet-service-arm.c index 4f443d0a1..22c967a9f 100644 --- a/src/arm/gnunet-service-arm.c +++ b/src/arm/gnunet-service-arm.c @@ -2226,15 +2226,15 @@ run (void *cls, final_option); start_user = GNUNET_CONFIGURATION_get_value_yesno (cfg, "ARM", - "USER_ONLY"); + "START_USER_SERVICES"); start_system = GNUNET_CONFIGURATION_get_value_yesno (cfg, "ARM", - "SYSTEM_ONLY"); + "START_SYSTEM_SERVICES"); if ( (GNUNET_NO == start_user) && (GNUNET_NO == start_system) ) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Please configure either USER_ONLY or SYSTEM_ONLY or both.\n"); + "Please configure either START_USER_SERVICES or START_SYSTEM_SERVICES or both.\n"); GNUNET_SCHEDULER_shutdown (); global_ret = 1; return; diff --git a/src/pt/test_gns_vpn.conf b/src/pt/test_gns_vpn.conf index c603b7422..7447322d4 100644 --- a/src/pt/test_gns_vpn.conf +++ b/src/pt/test_gns_vpn.conf @@ -7,8 +7,8 @@ PLUGINS = tcp [arm] PORT = 0 ALLOW_SHUTDOWN = YES -SYSTEM_ONLY = NO -USER_ONLY = NO +START_SYSTEM_SERVICES = NO +START_USER_SERVICES = NO [exit] FORCESTART = YES -- cgit v1.2.3 From af8cf3fa1402728e46b648d44739ee379fb7f81d Mon Sep 17 00:00:00 2001 From: "psyc://loupsycedyglgamf.onion/~lynX" Date: Sat, 23 Jun 2018 13:30:03 +0000 Subject: rename USER_SERVICE into RUN_PER_USER. thx, tg (#4548a) --- doc/man/gnunet.conf.5 | 2 +- src/arm/gnunet-service-arm.c | 4 ++-- src/credential/credential.conf.in | 4 ++-- src/gns/gns.conf.in | 4 ++-- src/identity-provider/identity-provider.conf | 2 +- src/identity/identity.conf.in | 2 +- src/namecache/namecache.conf.in | 2 +- src/namestore/namestore.conf.in | 2 +- src/social/social.conf.in | 2 +- src/util/util.conf | 2 +- 10 files changed, 13 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/doc/man/gnunet.conf.5 b/doc/man/gnunet.conf.5 index 518a352ce..1a94a0a66 100644 --- a/doc/man/gnunet.conf.5 +++ b/doc/man/gnunet.conf.5 @@ -88,7 +88,7 @@ The following options are generic and shared by all services: .IP UNIX_MATCH_GID If UNIX domain sockets are used, set this to YES if only users with the same GID are allowed to access the service. -.IP USER_SERVICE +.IP RUN_PER_USER Set to YES if this service should be run per-user, NO if this is a system service. End-users should never have to change the defaults GNUnet provides for this option. diff --git a/src/arm/gnunet-service-arm.c b/src/arm/gnunet-service-arm.c index 22c967a9f..f7a59c5fb 100644 --- a/src/arm/gnunet-service-arm.c +++ b/src/arm/gnunet-service-arm.c @@ -1990,11 +1990,11 @@ setup_service (void *cls, if ((GNUNET_YES == GNUNET_CONFIGURATION_have_value (cfg, section, - "USER_SERVICE")) && + "RUN_PER_USER")) && (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno (cfg, section, - "USER_SERVICE"))) + "RUN_PER_USER"))) { if (GNUNET_NO == start_user) { diff --git a/src/credential/credential.conf.in b/src/credential/credential.conf.in index 71f3066ca..d5a0b1c88 100644 --- a/src/credential/credential.conf.in +++ b/src/credential/credential.conf.in @@ -1,5 +1,5 @@ [credential] BINARY = gnunet-service-credential UNIXPATH = $GNUNET_USER_RUNTIME_DIR/gnunet-service-credential.sock -USER_SERVICE = YES -OPTIONS = -L DEBUG \ No newline at end of file +RUN_PER_USER = YES +OPTIONS = -L DEBUG diff --git a/src/gns/gns.conf.in b/src/gns/gns.conf.in index de50d1047..323129a1e 100644 --- a/src/gns/gns.conf.in +++ b/src/gns/gns.conf.in @@ -31,7 +31,7 @@ INTERCEPT_DNS = NO [gns-proxy] BINARY = gnunet-gns-proxy AUTOSTART = NO -USER_SERVICE = YES +RUN_PER_USER = YES # Where is the certificate for the GNS proxy stored? PROXY_CACERT = $GNUNET_DATA_HOME/gns/gns_ca_cert.pem @@ -41,7 +41,7 @@ PROXY_UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-gns-proxy.sock [dns2gns] BINARY = gnunet-dns2gns AUTOSTART = NO -USER_SERVICE = YES +RUN_PER_USER = YES # -d: DNS resolver to use, -s: suffix to use, -f: fcfs suffix to use OPTIONS = -d 8.8.8.8 diff --git a/src/identity-provider/identity-provider.conf b/src/identity-provider/identity-provider.conf index f2c24c32d..3d4e340a6 100644 --- a/src/identity-provider/identity-provider.conf +++ b/src/identity-provider/identity-provider.conf @@ -1,6 +1,6 @@ [identity-provider] AUTOSTART = NO -USER_SERVICE = YES +RUN_PER_USER = YES #PORT = 2108 HOSTNAME = localhost BINARY = gnunet-service-identity-provider diff --git a/src/identity/identity.conf.in b/src/identity/identity.conf.in index 4af3a6261..32855c02d 100644 --- a/src/identity/identity.conf.in +++ b/src/identity/identity.conf.in @@ -1,6 +1,6 @@ [identity] AUTOSTART = @AUTOSTART@ -USER_SERVICE = YES +RUN_PER_USER = YES @JAVAPORT@PORT = 2108 HOSTNAME = localhost BINARY = gnunet-service-identity diff --git a/src/namecache/namecache.conf.in b/src/namecache/namecache.conf.in index becd34187..27062ca82 100644 --- a/src/namecache/namecache.conf.in +++ b/src/namecache/namecache.conf.in @@ -1,6 +1,6 @@ [namecache] AUTOSTART = @AUTOSTART@ -USER_SERVICE = NO +RUN_PER_USER = NO UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-namecache.sock UNIX_MATCH_UID = NO UNIX_MATCH_GID = YES diff --git a/src/namestore/namestore.conf.in b/src/namestore/namestore.conf.in index 8b5e440b8..94e158609 100644 --- a/src/namestore/namestore.conf.in +++ b/src/namestore/namestore.conf.in @@ -1,6 +1,6 @@ [namestore] AUTOSTART = @AUTOSTART@ -USER_SERVICE = YES +RUN_PER_USER = YES UNIXPATH = $GNUNET_USER_RUNTIME_DIR/gnunet-service-namestore.sock UNIX_MATCH_UID = NO UNIX_MATCH_GID = YES diff --git a/src/social/social.conf.in b/src/social/social.conf.in index 33b14e5b4..7dfa140e6 100644 --- a/src/social/social.conf.in +++ b/src/social/social.conf.in @@ -1,7 +1,7 @@ [social] AUTOSTART = @AUTOSTART@ BINARY = gnunet-service-social -USER_SERVICE = YES +RUN_PER_USER = YES UNIXPATH = $GNUNET_USER_RUNTIME_DIR/gnunet-service-social.sock UNIX_MATCH_UID = YES diff --git a/src/util/util.conf b/src/util/util.conf index f2e5bee28..dbc2b2e0d 100644 --- a/src/util/util.conf +++ b/src/util/util.conf @@ -25,7 +25,7 @@ GNUNET_CACHE_HOME = ${XDG_CACHE_HOME:-$GNUNET_HOME/.cache}/gnunet/ # Runtime data (i.e UNIX domain sockets, locks, always lost on system boot) # This is the variable for system-wide services; use GNUNET_USER_RUNTIME_DIR -# for per-user services (where USER_SERVICE=YES is set) +# for per-user services (where RUN_PER_USER=YES is set) # Note that the 'gnunet'/system user must have $TMPDIR/$TMP set to # exactly the same values as 'normal' users, otherwise this will fail. # If $TMPDIR or $TMP are set to different directories for different -- cgit v1.2.3 From b9e4bb72104b4871bf4443fc8a8fbb21d8c1944c Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 23 Jun 2018 16:32:26 +0200 Subject: ignore hostname if we have unixpath --- src/include/gnunet_gnsrecord_lib.h | 4 ++-- src/util/resolver_api.c | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/include/gnunet_gnsrecord_lib.h b/src/include/gnunet_gnsrecord_lib.h index b3f1eb632..20846238b 100644 --- a/src/include/gnunet_gnsrecord_lib.h +++ b/src/include/gnunet_gnsrecord_lib.h @@ -499,10 +499,10 @@ GNUNET_GNSRECORD_pkey_to_zkey (const struct GNUNET_CRYPTO_EcdsaPublicKey *pkey); /** - * Convert an absolute domain name in the ".zkey" pTLD to the + * Convert an absolute domain name to the * respective public key. * - * @param zkey string "X.zkey" where X is the public + * @param zkey string "X" where X is the public * key in an encoding suitable for DNS labels. * @param pkey set to a public key on the eliptic curve * @return #GNUNET_SYSERR if @a zkey has the wrong syntax diff --git a/src/util/resolver_api.c b/src/util/resolver_api.c index b2e6a4986..afebabf08 100644 --- a/src/util/resolver_api.c +++ b/src/util/resolver_api.c @@ -180,6 +180,11 @@ check_config () struct sockaddr_in v4; struct sockaddr_in6 v6; + if (GNUNET_OK == + GNUNET_CONFIGURATION_have_value (resolver_cfg, + "resolver", + "UNIXPATH")) + return GNUNET_OK; memset (&v4, 0, sizeof (v4)); v4.sin_addr.s_addr = htonl (INADDR_LOOPBACK); v4.sin_family = AF_INET; -- cgit v1.2.3