gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet] 29/39: http3: Load certificates from the configuration file.


From: gnunet
Subject: [gnunet] 29/39: http3: Load certificates from the configuration file.
Date: Sun, 25 Aug 2024 15:16:25 +0200

This is an automated email from the git hooks/post-receive script.

martin-schanzenbach pushed a commit to branch master
in repository gnunet.

commit 5f8ff699647eff417c609d10b86e4412ea1a22e0
Author: Shichao <mrrr61@outlook.com>
AuthorDate: Mon Jul 29 16:37:20 2024 +0800

    http3: Load certificates from the configuration file.
---
 src/service/transport/gnunet-communicator-http3.c  | 36 ++++++++++++++++++++--
 .../test_communicator_http3_basic_peer1.conf       |  2 ++
 .../test_communicator_http3_basic_peer2.conf       |  4 ++-
 3 files changed, 39 insertions(+), 3 deletions(-)

diff --git a/src/service/transport/gnunet-communicator-http3.c 
b/src/service/transport/gnunet-communicator-http3.c
index 4e61ce031..cdf8c4b15 100644
--- a/src/service/transport/gnunet-communicator-http3.c
+++ b/src/service/transport/gnunet-communicator-http3.c
@@ -3171,6 +3171,8 @@ run (void *cls,
   socklen_t in_len;
   struct sockaddr_storage in_sto;
   socklen_t sto_len;
+  char *cert_file;
+  char *key_file;
 
   (void) cls;
   cfg = c;
@@ -3185,6 +3187,31 @@ run (void *cls,
                                "BINDTO");
     return;
   }
+
+  if (GNUNET_OK !=
+      GNUNET_CONFIGURATION_get_value_filename (cfg,
+                                               COMMUNICATOR_CONFIG_SECTION,
+                                               "KEY_FILE",
+                                               &key_file))
+  {
+    GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+                               COMMUNICATOR_CONFIG_SECTION,
+                               "KEY_FILE");
+    return;
+  }
+  if (GNUNET_OK !=
+      GNUNET_CONFIGURATION_get_value_filename (cfg,
+                                               COMMUNICATOR_CONFIG_SECTION,
+                                               "CERT_FILE",
+                                               &cert_file))
+  {
+    GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+                               COMMUNICATOR_CONFIG_SECTION,
+                               "CERT_FILE");
+    GNUNET_free (key_file);
+    return;
+  }
+
   disable_v6 = GNUNET_NO;
   if ((GNUNET_NO == GNUNET_NETWORK_test_pf (PF_INET6)) ||
       (GNUNET_YES ==
@@ -3292,9 +3319,14 @@ run (void *cls,
     return;
   }
   rv = gnutls_certificate_set_x509_key_file (cred,
-                                             "credentials/server.pem",
-                                             "credentials/server-key.pem",
+                                             cert_file,
+                                             key_file,
                                              GNUTLS_X509_FMT_PEM);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "key_file: %s\ncert_file: %s\n",
+              key_file, cert_file);
+  GNUNET_free (cert_file);
+  GNUNET_free (key_file);
   if (rv < 0)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
diff --git a/src/service/transport/test_communicator_http3_basic_peer1.conf 
b/src/service/transport/test_communicator_http3_basic_peer1.conf
index b917c19c4..f2daba8d1 100644
--- a/src/service/transport/test_communicator_http3_basic_peer1.conf
+++ b/src/service/transport/test_communicator_http3_basic_peer1.conf
@@ -43,3 +43,5 @@ MAX_QUEUE_LENGTH=5000
 [communicator-http3]
 BINDTO = 60002
 DISABLE_V6 = YES
+KEY_FILE = credentials/server-key2.pem
+CERT_FILE = credentials/server2.pem
diff --git a/src/service/transport/test_communicator_http3_basic_peer2.conf 
b/src/service/transport/test_communicator_http3_basic_peer2.conf
index 27fd63bac..08ddf94fb 100644
--- a/src/service/transport/test_communicator_http3_basic_peer2.conf
+++ b/src/service/transport/test_communicator_http3_basic_peer2.conf
@@ -42,4 +42,6 @@ MAX_QUEUE_LENGTH=5000
 
 [communicator-http3]
 BINDTO = 60003
-DISABLE_V6 = YES
\ No newline at end of file
+DISABLE_V6 = YES
+KEY_FILE = credentials/server-key2.pem
+CERT_FILE = credentials/server2.pem
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]