[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis] branch master updated: add command-line options to all
From: |
gnunet |
Subject: |
[taler-anastasis] branch master updated: add command-line options to allow anastasis to authenticate against merchant backend |
Date: |
Wed, 02 Dec 2020 10:31:58 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository anastasis.
The following commit(s) were added to refs/heads/master by this push:
new d728e26 add command-line options to allow anastasis to authenticate
against merchant backend
d728e26 is described below
commit d728e26673c2874b464480947fc723c2c4348da7
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Wed Dec 2 10:31:56 2020 +0100
add command-line options to allow anastasis to authenticate against
merchant backend
---
src/backend/anastasis-httpd.c | 85 ++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 84 insertions(+), 1 deletion(-)
diff --git a/src/backend/anastasis-httpd.c b/src/backend/anastasis-httpd.c
index 1f81c2b..155ed16 100644
--- a/src/backend/anastasis-httpd.c
+++ b/src/backend/anastasis-httpd.c
@@ -157,6 +157,38 @@ static struct GNUNET_CURL_RescheduleContext *rc;
*/
static int triggered;
+/**
+ * Username and password to use for client authentication
+ * (optional).
+ */
+static char *userpass;
+
+/**
+ * Type of the client's TLS certificate (optional).
+ */
+static char *certtype;
+
+/**
+ * File with the client's TLS certificate (optional).
+ */
+static char *certfile;
+
+/**
+ * File with the client's TLS private key (optional).
+ */
+static char *keyfile;
+
+/**
+ * This value goes in the Authorization:-header.
+ */
+static char *apikey;
+
+/**
+ * Passphrase to decrypt client's TLS private key file (optional).
+ */
+static char *keypass;
+
+
/**
* Function that queries MHD's select sets and
* starts the task waiting for them.
@@ -702,6 +734,33 @@ run (void *cls,
AH_ctx = GNUNET_CURL_init (&GNUNET_CURL_gnunet_scheduler_reschedule,
&rc);
rc = GNUNET_CURL_gnunet_rc_create (AH_ctx);
+ if (NULL != userpass)
+ GNUNET_CURL_set_userpass (AH_ctx,
+ userpass);
+ if (NULL != keyfile)
+ GNUNET_CURL_set_tlscert (AH_ctx,
+ certtype,
+ certfile,
+ keyfile,
+ keypass);
+ if (NULL != apikey)
+ {
+ char *auth_header;
+
+ GNUNET_asprintf (&auth_header,
+ "%s: %s",
+ MHD_HTTP_HEADER_AUTHORIZATION,
+ apikey);
+ if (GNUNET_OK !=
+ GNUNET_CURL_append_header (AH_ctx,
+ auth_header))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Failed so set %s header, trying without\n",
+ MHD_HTTP_HEADER_AUTHORIZATION);
+ }
+ GNUNET_free (auth_header);
+ }
if (NULL ==
(db = ANASTASIS_DB_plugin_load (config)))
@@ -754,11 +813,35 @@ main (int argc,
{
enum GNUNET_GenericReturnValue res;
struct GNUNET_GETOPT_CommandLineOption options[] = {
+ GNUNET_GETOPT_option_string ('A',
+ "auth",
+ "USERNAME:PASSWORD",
+ "use the given USERNAME and PASSWORD for
client authentication",
+ &userpass),
GNUNET_GETOPT_option_flag ('C',
"connection-close",
"force HTTP connections to be closed after each
request",
&TMH_anastasis_connection_close),
-
+ GNUNET_GETOPT_option_string ('k',
+ "key",
+ "KEYFILE",
+ "file with the private TLS key for TLS client
authentication",
+ &keyfile),
+ GNUNET_GETOPT_option_string ('p',
+ "pass",
+ "KEYFILEPASSPHRASE",
+ "passphrase needed to decrypt the TLS client
private key file",
+ &keypass),
+ GNUNET_GETOPT_option_string ('K',
+ "apikey",
+ "APIKEY",
+ "API key to use in the HTTP request",
+ &apikey),
+ GNUNET_GETOPT_option_string ('t',
+ "type",
+ "CERTTYPE",
+ "type of the TLS client certificate, defaults
to PEM if not specified",
+ &certtype),
GNUNET_GETOPT_OPTION_END
};
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-anastasis] branch master updated: add command-line options to allow anastasis to authenticate against merchant backend,
gnunet <=