[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet] 02/02: add option to pass private key via environm
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet] 02/02: add option to pass private key via environment variable |
Date: |
Mon, 10 Jun 2019 06:51:07 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository gnunet.
commit 0263818b1ec7ef1115196002f9ba70e5cb766bf4
Author: Christian Grothoff <address@hidden>
AuthorDate: Mon Jun 10 06:50:19 2019 +0200
add option to pass private key via environment variable
---
doc/man/gnunet-namestore.1 | 4 ++--
src/namestore/gnunet-namestore.c | 22 +++++++++++++++++++++-
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.
Specific format depends on the record type.
A 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.
.It Fl z Ar EGO | Fl \-zone= Ns Ar EGO
-Specifies the name of the ego controlling the private key for the zone
(mandatory option).
+Specifies 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.
.El
.\".Sh EXAMPLES
.\".Sh FILES
@@ -113,7 +113,7 @@ Specifies the name of the ego controlling the private key
for the zone (mandator
.Xr gnunet-gns 1 ,
.Xr gnunet-namestore-gtk 1
.sp
-The full documentation for gnunet is maintained as a Texinfo manual.
+The full documentation for GNUnet is maintained as a Texinfo manual.
If the
.Xr info 1
and 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,
const char *cfgfile,
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
+ const char *pkey_str;
+
(void) cls;
(void) args;
(void) cfgfile;
@@ -1368,7 +1370,25 @@ run (void *cls,
uri = GNUNET_strdup (args[0]);
GNUNET_SCHEDULER_add_shutdown (&do_shutdown, (void *) cfg);
-
+ pkey_str = getenv ("GNUNET_NAMESTORE_EGO_PRIVATE_KEY");
+ if (NULL != pkey_str)
+ {
+ if (GNUNET_OK != GNUNET_STRINGS_string_to_data (pkey_str,
+ strlen (pkey_str),
+ &zone_pkey,
+ sizeof (zone_pkey)))
+ {
+ fprintf (stderr,
+ "Malformed private key `%s' in $%s\n",
+ pkey_str,
+ "GNUNET_NAMESTORE_EGO_PRIVATE_KEY");
+ ret = 1;
+ GNUNET_SCHEDULER_shutdown ();
+ return;
+ }
+ run_with_zone_pkey (cfg);
+ return;
+ }
if (NULL == ego_name)
{
idh = GNUNET_IDENTITY_connect (cfg, &id_connect_cb, (void *) cfg);
--
To stop receiving notification emails like this one, please contact
address@hidden.