aboutsummaryrefslogtreecommitdiff
path: root/src/arm
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-10-11 16:09:56 +0000
committerChristian Grothoff <christian@grothoff.org>2013-10-11 16:09:56 +0000
commit996871b39362b2ce34980d99e7fedfb05075f041 (patch)
tree216af472c01d9a7ba36687ba4957c67f4e281be6 /src/arm
parent79fa5ae2d73c1da264e9565ba46868ee08dffacd (diff)
downloadgnunet-996871b39362b2ce34980d99e7fedfb05075f041.tar.gz
gnunet-996871b39362b2ce34980d99e7fedfb05075f041.zip
implementing #3064: enable split-personality ARM to run some services as 'gnunet' and others as grothoff, depending on level of personal information available to the service
Diffstat (limited to 'src/arm')
-rw-r--r--src/arm/arm.conf.in21
-rw-r--r--src/arm/gnunet-service-arm.c46
2 files changed, 64 insertions, 3 deletions
diff --git a/src/arm/arm.conf.in b/src/arm/arm.conf.in
index 6bffca796..830b51dc1 100644
--- a/src/arm/arm.conf.in
+++ b/src/arm/arm.conf.in
@@ -17,6 +17,27 @@ UNIX_MATCH_GID = YES
17# log files are preserved. 17# log files are preserved.
18# GLOBAL_POSTFIX = -l $GNUNET_CACHE_HOME/{}-%Y-%m-%d.log 18# GLOBAL_POSTFIX = -l $GNUNET_CACHE_HOME/{}-%Y-%m-%d.log
19GLOBAL_PREFIX = @MONKEYPREFIX@ 19GLOBAL_PREFIX = @MONKEYPREFIX@
20
21# If set to YES, ARM will only start services that are marked as
22# system-level services (and we'll expect a second ARM to be
23# run per-user to run user-level services). Note that in this
24# case you must have manually created a different configuration
25# file with the user where at least this and the USER_ONLY
26# options differ.
27# SYSTEM_ONLY = YES
28
29# If set to YES, ARM will only start services that are marked as
30# per-user services (and we'll expect a system user to run ARM to
31# provide system-level services). Per-user services enable
32# better personalization and priviledge separation and in particular
33# ensures that personal data is stored under $HOME, which might
34# be important in a multi-user system (or if $HOME is encrypted
35# and /var/ is not).
36# USER_ONLY = YES
37
38
39
40# Name of the user that will be used to provide the service
20# USERNAME = 41# USERNAME =
21# MAXBUF = 42# MAXBUF =
22# TIMEOUT = 43# TIMEOUT =
diff --git a/src/arm/gnunet-service-arm.c b/src/arm/gnunet-service-arm.c
index 7c759d0ac..1eaaa26c5 100644
--- a/src/arm/gnunet-service-arm.c
+++ b/src/arm/gnunet-service-arm.c
@@ -36,6 +36,7 @@
36 */ 36 */
37#define MAX_NOTIFY_QUEUE 1024 37#define MAX_NOTIFY_QUEUE 1024
38 38
39
39/** 40/**
40 * List of our services. 41 * List of our services.
41 */ 42 */
@@ -159,7 +160,7 @@ struct ServiceList
159 160
160 /** 161 /**
161 * Is this service to be started by default (or did a client tell us explicitly 162 * Is this service to be started by default (or did a client tell us explicitly
162 * to start it)? GNUNET_NO if the service is started only upon 'accept' on a 163 * to start it)? #GNUNET_NO if the service is started only upon 'accept' on a
163 * listen socket or possibly explicitly by a client changing the value. 164 * listen socket or possibly explicitly by a client changing the value.
164 */ 165 */
165 int is_default; 166 int is_default;
@@ -218,6 +219,16 @@ static struct GNUNET_DISK_PipeHandle *sigpipe;
218static int in_shutdown; 219static int in_shutdown;
219 220
220/** 221/**
222 * Are we starting user services?
223 */
224static int start_user = GNUNET_YES;
225
226/**
227 * Are we starting system services?
228 */
229static int start_system = GNUNET_YES;
230
231/**
221 * Handle to our server instance. Our server is a bit special in that 232 * Handle to our server instance. Our server is a bit special in that
222 * its service is not immediately stopped once we get a shutdown 233 * its service is not immediately stopped once we get a shutdown
223 * request (since we need to continue service until all of our child 234 * request (since we need to continue service until all of our child
@@ -387,7 +398,9 @@ broadcast_status (const char *name,
387 * being started. 0 if starting was not requested. 398 * being started. 0 if starting was not requested.
388 */ 399 */
389static void 400static void
390start_process (struct ServiceList *sl, struct GNUNET_SERVER_Client *client, uint64_t request_id) 401start_process (struct ServiceList *sl,
402 struct GNUNET_SERVER_Client *client,
403 uint64_t request_id)
391{ 404{
392 char *loprefix; 405 char *loprefix;
393 char *options; 406 char *options;
@@ -1273,6 +1286,19 @@ setup_service (void *cls, const char *section)
1273 /* not a service section */ 1286 /* not a service section */
1274 return; 1287 return;
1275 } 1288 }
1289 if ((GNUNET_YES ==
1290 GNUNET_CONFIGURATION_have_value (cfg, section, "USER_SERVICE")) &&
1291 (GNUNET_YES ==
1292 GNUNET_CONFIGURATION_get_value_yesno (cfg, section, "USER_SERVICE")))
1293 {
1294 if (GNUNET_NO == start_user)
1295 return; /* user service, and we don't deal with those */
1296 }
1297 else
1298 {
1299 if (GNUNET_NO == start_system)
1300 return; /* system service, and we don't deal with those */
1301 }
1276 sl = find_service (section); 1302 sl = find_service (section);
1277 if (NULL != sl) 1303 if (NULL != sl)
1278 { 1304 {
@@ -1312,6 +1338,7 @@ setup_service (void *cls, const char *section)
1312 sl->pipe_control = GNUNET_CONFIGURATION_get_value_yesno (cfg, section, "PIPECONTROL"); 1338 sl->pipe_control = GNUNET_CONFIGURATION_get_value_yesno (cfg, section, "PIPECONTROL");
1313#endif 1339#endif
1314 GNUNET_CONTAINER_DLL_insert (running_head, running_tail, sl); 1340 GNUNET_CONTAINER_DLL_insert (running_head, running_tail, sl);
1341
1315 if (GNUNET_YES != 1342 if (GNUNET_YES !=
1316 GNUNET_CONFIGURATION_get_value_yesno (cfg, section, "AUTOSTART")) 1343 GNUNET_CONFIGURATION_get_value_yesno (cfg, section, "AUTOSTART"))
1317 return; 1344 return;
@@ -1409,7 +1436,20 @@ run (void *cls, struct GNUNET_SERVER_Handle *serv,
1409 GNUNET_CONFIGURATION_get_value_string (cfg, "ARM", "GLOBAL_POSTFIX", 1436 GNUNET_CONFIGURATION_get_value_string (cfg, "ARM", "GLOBAL_POSTFIX",
1410 &final_option)) 1437 &final_option))
1411 final_option = GNUNET_strdup (""); 1438 final_option = GNUNET_strdup ("");
1412 1439 if (GNUNET_YES ==
1440 GNUNET_CONFIGURATION_get_value_yesno (cfg, "ARM", "USER_ONLY"))
1441 {
1442 GNUNET_break (GNUNET_YES == start_user);
1443 start_system = GNUNET_NO;
1444 return;
1445 }
1446 if (GNUNET_YES ==
1447 GNUNET_CONFIGURATION_get_value_yesno (cfg, "ARM", "SYSTEM_ONLY"))
1448 {
1449 GNUNET_break (GNUNET_YES == start_system);
1450 start_user = GNUNET_NO;
1451 return;
1452 }
1413 GNUNET_CONFIGURATION_iterate_sections (cfg, &setup_service, NULL); 1453 GNUNET_CONFIGURATION_iterate_sections (cfg, &setup_service, NULL);
1414 1454
1415 /* start default services... */ 1455 /* start default services... */