aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-06-10 06:50:19 +0200
committerChristian Grothoff <christian@grothoff.org>2019-06-10 06:50:19 +0200
commit0263818b1ec7ef1115196002f9ba70e5cb766bf4 (patch)
tree55fe9c04e28ee92d297ee67c3b78cff715f4c14a
parent378e6561f3c706ef0b71e09574af26940a9be3fa (diff)
downloadgnunet-0263818b1ec7ef1115196002f9ba70e5cb766bf4.tar.gz
gnunet-0263818b1ec7ef1115196002f9ba70e5cb766bf4.zip
add option to pass private key via environment variable
-rw-r--r--doc/man/gnunet-namestore.14
-rw-r--r--src/namestore/gnunet-namestore.c22
2 files changed, 23 insertions, 3 deletions
diff --git a/doc/man/gnunet-namestore.1 b/doc/man/gnunet-namestore.1
index 98d1839b9..7f6e0bcb6 100644
--- a/doc/man/gnunet-namestore.1
+++ b/doc/man/gnunet-namestore.1
@@ -105,7 +105,7 @@ Value to store or remove from the GNS zone.
105Specific format depends on the record type. 105Specific format depends on the record type.
106A records expect a dotted decimal IPv4 address, AAAA records an IPv6 address, PKEY a public key in GNUnet's printable format, and CNAME and NS records should be a domain name. 106A records expect a dotted decimal IPv4 address, AAAA records an IPv6 address, PKEY a public key in GNUnet's printable format, and CNAME and NS records should be a domain name.
107.It Fl z Ar EGO | Fl \-zone= Ns Ar EGO 107.It Fl z Ar EGO | Fl \-zone= Ns Ar EGO
108Specifies the name of the ego controlling the private key for the zone (mandatory option). 108Specifies the name of the ego controlling the private key for the zone. If not provided, we will attempt to use the default identity set for the "namestore". Alternatively, a private key may be passed in Base32-encoding using the GNUNET_NAMESTORE_EGO_PRIVATE_KEY environment variable. The latter is useful to improve performance of tools like Ascension as it allows the command to skip IPC with the identity management subsystem.
109.El 109.El
110.\".Sh EXAMPLES 110.\".Sh EXAMPLES
111.\".Sh FILES 111.\".Sh FILES
@@ -113,7 +113,7 @@ Specifies the name of the ego controlling the private key for the zone (mandator
113.Xr gnunet-gns 1 , 113.Xr gnunet-gns 1 ,
114.Xr gnunet-namestore-gtk 1 114.Xr gnunet-namestore-gtk 1
115.sp 115.sp
116The full documentation for gnunet is maintained as a Texinfo manual. 116The full documentation for GNUnet is maintained as a Texinfo manual.
117If the 117If the
118.Xr info 1 118.Xr info 1
119and gnunet programs are properly installed at your site, the command 119and gnunet programs are properly installed at your site, the command
diff --git a/src/namestore/gnunet-namestore.c b/src/namestore/gnunet-namestore.c
index b678086df..26b5a704b 100644
--- a/src/namestore/gnunet-namestore.c
+++ b/src/namestore/gnunet-namestore.c
@@ -1356,6 +1356,8 @@ run (void *cls,
1356 const char *cfgfile, 1356 const char *cfgfile,
1357 const struct GNUNET_CONFIGURATION_Handle *cfg) 1357 const struct GNUNET_CONFIGURATION_Handle *cfg)
1358{ 1358{
1359 const char *pkey_str;
1360
1359 (void) cls; 1361 (void) cls;
1360 (void) args; 1362 (void) args;
1361 (void) cfgfile; 1363 (void) cfgfile;
@@ -1368,7 +1370,25 @@ run (void *cls,
1368 uri = GNUNET_strdup (args[0]); 1370 uri = GNUNET_strdup (args[0]);
1369 1371
1370 GNUNET_SCHEDULER_add_shutdown (&do_shutdown, (void *) cfg); 1372 GNUNET_SCHEDULER_add_shutdown (&do_shutdown, (void *) cfg);
1371 1373 pkey_str = getenv ("GNUNET_NAMESTORE_EGO_PRIVATE_KEY");
1374 if (NULL != pkey_str)
1375 {
1376 if (GNUNET_OK != GNUNET_STRINGS_string_to_data (pkey_str,
1377 strlen (pkey_str),
1378 &zone_pkey,
1379 sizeof (zone_pkey)))
1380 {
1381 fprintf (stderr,
1382 "Malformed private key `%s' in $%s\n",
1383 pkey_str,
1384 "GNUNET_NAMESTORE_EGO_PRIVATE_KEY");
1385 ret = 1;
1386 GNUNET_SCHEDULER_shutdown ();
1387 return;
1388 }
1389 run_with_zone_pkey (cfg);
1390 return;
1391 }
1372 if (NULL == ego_name) 1392 if (NULL == ego_name)
1373 { 1393 {
1374 idh = GNUNET_IDENTITY_connect (cfg, &id_connect_cb, (void *) cfg); 1394 idh = GNUNET_IDENTITY_connect (cfg, &id_connect_cb, (void *) cfg);