aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-08-19 12:25:34 +0200
committerChristian Grothoff <christian@grothoff.org>2021-08-19 12:25:34 +0200
commit87bc2f469bf120bbd57e98a0a8ea46e80de84927 (patch)
tree710867c85e6cfae09d07d526b6d4950c2e48bf75
parent260eaf05fa395a6d541fd2917faf47dc342b3005 (diff)
downloadanastasis-87bc2f469bf120bbd57e98a0a8ea46e80de84927.tar.gz
anastasis-87bc2f469bf120bbd57e98a0a8ea46e80de84927.zip
-update IBAN plugin, write man page for anastasis-helper-authorization-iban
-rw-r--r--doc/sphinx/manpages/anastasis-helper-authorization-iban.1.rst57
-rw-r--r--doc/sphinx/manpages/anastasis.conf.5.rst39
-rw-r--r--src/authorization/anastasis-helper-authorization-iban.c66
-rw-r--r--src/authorization/anastasis_authorization_plugin_iban.c18
4 files changed, 156 insertions, 24 deletions
diff --git a/doc/sphinx/manpages/anastasis-helper-authorization-iban.1.rst b/doc/sphinx/manpages/anastasis-helper-authorization-iban.1.rst
new file mode 100644
index 0000000..8674510
--- /dev/null
+++ b/doc/sphinx/manpages/anastasis-helper-authorization-iban.1.rst
@@ -0,0 +1,57 @@
1anastasis-helper-authorization-iban(1)
2######################################
3
4.. only:: html
5
6 Name
7 ====
8
9 **anastasis-helper-authorization-iban** - Helper for IBAN authentication
10
11Synopsis
12========
13
14**anastasis-helper-authorization-iban**
15[**-c** *FILENAME* | **––config=**\ ‌\ *FILENAME*]
16[**-h** | **––help**]
17[**-L** *LOGLEVEL* | **––loglevel=**\ ‌\ *LOGLEVEL*]
18[**-l** *FILENAME* | **––logfile=**\ ‌\ *FILENAME*]
19[**-t** | **––test**]
20[**-v** | **––version**]
21
22
23Description
24===========
25
26**anastasis-helper-authorization-iban** monitors the Anastasis provider's bank account for incoming wire transfers. This process supports the IBAN authentication method. It must be configured with the respective wire configuration to talk to LibEuFin/Nexus.
27
28
29**-c** *FILENAME* \| **––config=**\ ‌\ *FILENAME*
30 Use the configuration from *FILENAME*.
31
32**-h** \| **––help**
33 Print short help on options.
34
35**-L** *LOGLEVEL* \| **––loglevel=**\ ‌\ *LOGLEVEL*
36 Specifies the log level to use. Accepted values are: ``DEBUG``, ``INFO``,
37 ``WARNING``, ``ERROR``.
38
39**-l** *FILENAME* \| **––logfile=**\ ‌\ *FILENAME*
40 Send logging output to *FILENAME*.
41
42**-t** \| **––test**
43 Run in test mode. Causes the process to terminate after importing current wire transfers instead of running forever in the background.
44
45**-v** \| **––version**
46 Print version information.
47
48See Also
49========
50
51anastasis-httpd(1), anastasis.conf(5).
52
53Bugs
54====
55
56Report bugs by using https://bugs.anastasis.lu/ or by sending electronic
57mail to <contact@anastasis.lu>.
diff --git a/doc/sphinx/manpages/anastasis.conf.5.rst b/doc/sphinx/manpages/anastasis.conf.5.rst
index 1819d6d..40a3b7e 100644
--- a/doc/sphinx/manpages/anastasis.conf.5.rst
+++ b/doc/sphinx/manpages/anastasis.conf.5.rst
@@ -104,9 +104,11 @@ API_KEY
104Authorization options 104Authorization options
105--------------------- 105---------------------
106 106
107For each active authorization plugin, options must be configured in 107For each active authorization plugin, options must be configured in a
108a section called ``[authorization-$PLUGIN]`` where ``$PLUGIN`` is 108section called ``[authorization-$PLUGIN]`` where ``$PLUGIN`` is the
109the name of the authorization plugin. 109name of the authorization plugin. Specific plugins may require
110additional options, which are described in the respective sections
111below.
110 112
111COST 113COST
112 Fee the user has to pay to obtain a challenge from this 114 Fee the user has to pay to obtain a challenge from this
@@ -115,8 +117,37 @@ COST
115ENABLED 117ENABLED
116 ``yes`` to enable this plugin, ``no`` to disable. 118 ``yes`` to enable this plugin, ``no`` to disable.
117 119
120
121SMS Authorization options
122^^^^^^^^^^^^^^^^^^^^^^^^^
123
124COMMAND
125 Helper command to run to send SMS.
126
127Email Authorization options
128^^^^^^^^^^^^^^^^^^^^^^^^^^^
129
118COMMAND 130COMMAND
119 Helper command to run (only relevant for some plugins). 131 Helper command to run to send E-mail.
132
133
134Post Authorization options
135^^^^^^^^^^^^^^^^^^^^^^^^^^
136
137COMMAND
138 Helper command to run to send physical mail.
139
140
141IBAN Authorization options
142^^^^^^^^^^^^^^^^^^^^^^^^^^
143
144CREDIT_IBAN
145 IBAN number where the consumers must
146 wire the money to for authentication.
147
148BUSINESS_NAME
149 Name of the account holder.
150
120 151
121 152
122Postgres database configuration 153Postgres database configuration
diff --git a/src/authorization/anastasis-helper-authorization-iban.c b/src/authorization/anastasis-helper-authorization-iban.c
index f908b72..0d3200a 100644
--- a/src/authorization/anastasis-helper-authorization-iban.c
+++ b/src/authorization/anastasis-helper-authorization-iban.c
@@ -19,7 +19,6 @@
19 * @author Christian Grothoff 19 * @author Christian Grothoff
20 * 20 *
21 * TODO: 21 * TODO:
22 * - needs to load authentication information
23 * - needs to add DB triggers to notify main service of inbound activity 22 * - needs to add DB triggers to notify main service of inbound activity
24 * - needs man page 23 * - needs man page
25 */ 24 */
@@ -139,6 +138,7 @@ shutdown_task (void *cls)
139 } 138 }
140 ANASTASIS_DB_plugin_unload (db_plugin); 139 ANASTASIS_DB_plugin_unload (db_plugin);
141 db_plugin = NULL; 140 db_plugin = NULL;
141 ANASTASIS_EUFIN_auth_free (&auth);
142 cfg = NULL; 142 cfg = NULL;
143} 143}
144 144
@@ -293,7 +293,68 @@ run (void *cls,
293 global_ret = EXIT_NOTCONFIGURED; 293 global_ret = EXIT_NOTCONFIGURED;
294 return; 294 return;
295 } 295 }
296 // FIXME: initialize 'auth' from cfg! 296 {
297 char *iban;
298 char *receiver_name;
299
300 if (GNUNET_OK !=
301 GNUNET_CONFIGURATION_get_value_string (cfg,
302 "authorization-iban",
303 "CREDIT_IBAN",
304 &iban))
305 {
306 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
307 "authorization-iban",
308 "CREDIT_IBAN");
309 global_ret = EXIT_NOTCONFIGURED;
310 ANASTASIS_DB_plugin_unload (db_plugin);
311 db_plugin = NULL;
312 return;
313 }
314 if (GNUNET_OK !=
315 GNUNET_CONFIGURATION_get_value_string (cfg,
316 "authorization-iban",
317 "BUSINESS_NAME",
318 &receiver_name))
319 {
320 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
321 "authorization-iban",
322 "BUSINESS_NAME");
323 global_ret = EXIT_NOTCONFIGURED;
324 ANASTASIS_DB_plugin_unload (db_plugin);
325 db_plugin = NULL;
326 return;
327 }
328 {
329 size_t len;
330 char *uri_receiver_name;
331
332 len = GNUNET_STRINGS_urlencode (receiver_name,
333 strlen (receiver_name),
334 &uri_receiver_name);
335 GNUNET_assert (uri_receiver_name[len] == '\0');
336 GNUNET_asprintf (&credit_account_uri,
337 "payto://iban/%s?receiver-name=%s",
338 iban,
339 uri_receiver_name);
340 GNUNET_free (uri_receiver_name);
341 }
342 GNUNET_free (iban);
343 GNUNET_free (receiver_name);
344 }
345
346 if (GNUNET_OK !=
347 ANASTASIS_EUFIN_auth_parse_cfg (cfg,
348 "authorization-iban",
349 &auth))
350 {
351 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
352 "Failed to load bank access configuration data\n");
353 ANASTASIS_DB_plugin_unload (db_plugin);
354 db_plugin = NULL;
355 global_ret = EXIT_NOTCONFIGURED;
356 return;
357 }
297 { 358 {
298 enum GNUNET_DB_QueryStatus qs; 359 enum GNUNET_DB_QueryStatus qs;
299 360
@@ -303,6 +364,7 @@ run (void *cls,
303 if (qs < 0) 364 if (qs < 0)
304 { 365 {
305 GNUNET_break (0); 366 GNUNET_break (0);
367 ANASTASIS_EUFIN_auth_free (&auth);
306 ANASTASIS_DB_plugin_unload (db_plugin); 368 ANASTASIS_DB_plugin_unload (db_plugin);
307 db_plugin = NULL; 369 db_plugin = NULL;
308 return; 370 return;
diff --git a/src/authorization/anastasis_authorization_plugin_iban.c b/src/authorization/anastasis_authorization_plugin_iban.c
index 548b5c0..eee8e7e 100644
--- a/src/authorization/anastasis_authorization_plugin_iban.c
+++ b/src/authorization/anastasis_authorization_plugin_iban.c
@@ -20,7 +20,6 @@
20 */ 20 */
21#include "platform.h" 21#include "platform.h"
22#include "anastasis_authorization_plugin.h" 22#include "anastasis_authorization_plugin.h"
23#include <taler/taler_bank_service.h>
24#include <taler/taler_mhd_lib.h> 23#include <taler/taler_mhd_lib.h>
25#include <taler/taler_json_lib.h> 24#include <taler/taler_json_lib.h>
26#include <gnunet/gnunet_db_lib.h> 25#include <gnunet/gnunet_db_lib.h>
@@ -36,11 +35,6 @@ struct IBAN_Context
36{ 35{
37 36
38 /** 37 /**
39 * Authentication data to access our bank account.
40 */
41 struct TALER_BANK_AuthenticationData auth;
42
43 /**
44 * Messages of the plugin, read from a resource file. 38 * Messages of the plugin, read from a resource file.
45 */ 39 */
46 json_t *messages; 40 json_t *messages;
@@ -533,17 +527,6 @@ libanastasis_plugin_authorization_iban_init (void *cls)
533 GNUNET_free (fn); 527 GNUNET_free (fn);
534 } 528 }
535 ctx->ac = ac; 529 ctx->ac = ac;
536 if (GNUNET_OK !=
537 TALER_BANK_auth_parse_cfg (cfg,
538 "authorization-iban",
539 &ctx->auth))
540 {
541 json_decref (ctx->messages);
542 GNUNET_free (ctx->business_iban);
543 GNUNET_free (ctx->business_name);
544 GNUNET_free (ctx);
545 return NULL;
546 }
547 plugin = GNUNET_new (struct ANASTASIS_AuthorizationPlugin); 530 plugin = GNUNET_new (struct ANASTASIS_AuthorizationPlugin);
548 plugin->payment_plugin_managed = true; 531 plugin->payment_plugin_managed = true;
549 plugin->code_validity_period = GNUNET_TIME_UNIT_MONTHS; 532 plugin->code_validity_period = GNUNET_TIME_UNIT_MONTHS;
@@ -571,7 +554,6 @@ libanastasis_plugin_authorization_iban_done (void *cls)
571 struct ANASTASIS_AuthorizationPlugin *plugin = cls; 554 struct ANASTASIS_AuthorizationPlugin *plugin = cls;
572 struct IBAN_Context *ctx = plugin->cls; 555 struct IBAN_Context *ctx = plugin->cls;
573 556
574 TALER_BANK_auth_free (&ctx->auth);
575 json_decref (ctx->messages); 557 json_decref (ctx->messages);
576 GNUNET_free (ctx->business_iban); 558 GNUNET_free (ctx->business_iban);
577 GNUNET_free (ctx->business_name); 559 GNUNET_free (ctx->business_name);