diff options
-rw-r--r-- | src/transport/plugin_transport_http_server.c | 33 | ||||
-rw-r--r-- | src/transport/transport.conf.in | 2 |
2 files changed, 31 insertions, 4 deletions
diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c index fb6181a6b..df9d517f3 100644 --- a/src/transport/plugin_transport_http_server.c +++ b/src/transport/plugin_transport_http_server.c | |||
@@ -214,6 +214,12 @@ struct HTTP_Server_Plugin | |||
214 | char *external_hostname; | 214 | char *external_hostname; |
215 | 215 | ||
216 | /** | 216 | /** |
217 | * Verify external address | ||
218 | */ | ||
219 | int verify_external_hostname; | ||
220 | |||
221 | |||
222 | /** | ||
217 | * Maximum number of sockets the plugin can use | 223 | * Maximum number of sockets the plugin can use |
218 | * Each http inbound /outbound connections are two connections | 224 | * Each http inbound /outbound connections are two connections |
219 | */ | 225 | */ |
@@ -2574,10 +2580,9 @@ server_check_ipv6_support (struct HTTP_Server_Plugin *plugin) | |||
2574 | 2580 | ||
2575 | 2581 | ||
2576 | /** | 2582 | /** |
2577 | * Function called when the service shuts down. Unloads our plugins | 2583 | * Notify server about our external hostname |
2578 | * and cancels pending validations. | ||
2579 | * | 2584 | * |
2580 | * @param cls closure, unused | 2585 | * @param cls plugin |
2581 | * @param tc task context (unused) | 2586 | * @param tc task context (unused) |
2582 | */ | 2587 | */ |
2583 | static void | 2588 | static void |
@@ -2590,12 +2595,24 @@ server_notify_external_hostname (void *cls, const struct GNUNET_SCHEDULER_TaskCo | |||
2590 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) | 2595 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) |
2591 | return; | 2596 | return; |
2592 | 2597 | ||
2593 | GNUNET_asprintf(&plugin->ext_addr, "%s://%s", plugin->protocol, plugin->external_hostname); | 2598 | |
2599 | #if BUILD_HTTPS | ||
2600 | GNUNET_asprintf(&plugin->ext_addr, "%s%s://%s", plugin->protocol, | ||
2601 | (GNUNET_YES == plugin->verify_external_hostname) ? "+" : "", | ||
2602 | plugin->external_hostname); | ||
2603 | #else | ||
2604 | GNUNET_asprintf(&plugin->ext_addr, "%s://%s", plugin->protocol, | ||
2605 | plugin->external_hostname); | ||
2606 | #endif | ||
2607 | |||
2594 | plugin->ext_addr_len = strlen (plugin->ext_addr) + 1; | 2608 | plugin->ext_addr_len = strlen (plugin->ext_addr) + 1; |
2595 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 2609 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, |
2596 | "Notifying transport about external hostname address `%s'\n", plugin->ext_addr); | 2610 | "Notifying transport about external hostname address `%s'\n", plugin->ext_addr); |
2597 | 2611 | ||
2598 | #if BUILD_HTTPS | 2612 | #if BUILD_HTTPS |
2613 | if (GNUNET_YES == plugin->verify_external_hostname) | ||
2614 | GNUNET_log_from (GNUNET_ERROR_TYPE_INFO, plugin->name, | ||
2615 | "Enabling SSL verification for external hostname address `%s'\n", plugin->ext_addr); | ||
2599 | plugin->env->notify_address (plugin->env->cls, GNUNET_YES, | 2616 | plugin->env->notify_address (plugin->env->cls, GNUNET_YES, |
2600 | plugin->ext_addr, plugin->ext_addr_len, | 2617 | plugin->ext_addr, plugin->ext_addr_len, |
2601 | "https_client"); | 2618 | "https_client"); |
@@ -2734,6 +2751,14 @@ server_configure_plugin (struct HTTP_Server_Plugin *plugin) | |||
2734 | GNUNET_free (bind6_address); | 2751 | GNUNET_free (bind6_address); |
2735 | } | 2752 | } |
2736 | 2753 | ||
2754 | plugin->verify_external_hostname = GNUNET_NO; | ||
2755 | #if BUILD_HTTPS | ||
2756 | plugin->verify_external_hostname = GNUNET_CONFIGURATION_get_value_yesno (plugin->env->cfg, plugin->name, | ||
2757 | "VERIFY_EXTERNAL_HOSTNAME"); | ||
2758 | if (GNUNET_SYSERR == plugin->verify_external_hostname) | ||
2759 | plugin->verify_external_hostname = GNUNET_NO; | ||
2760 | #endif | ||
2761 | |||
2737 | if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_string (plugin->env->cfg, plugin->name, | 2762 | if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_string (plugin->env->cfg, plugin->name, |
2738 | "EXTERNAL_HOSTNAME", &plugin->external_hostname)) | 2763 | "EXTERNAL_HOSTNAME", &plugin->external_hostname)) |
2739 | { | 2764 | { |
diff --git a/src/transport/transport.conf.in b/src/transport/transport.conf.in index a5aad7006..0ef064f77 100644 --- a/src/transport/transport.conf.in +++ b/src/transport/transport.conf.in | |||
@@ -67,6 +67,8 @@ MAX_CONNECTIONS = 128 | |||
67 | TESTING_IGNORE_KEYS = ACCEPT_FROM; | 67 | TESTING_IGNORE_KEYS = ACCEPT_FROM; |
68 | 68 | ||
69 | [transport-https_server] | 69 | [transport-https_server] |
70 | #EXTERNAL_HOSTNAME = <your hostname/path> | ||
71 | #VERIFY_EXTERNAL_HOSTNAME = YES | ||
70 | PORT = 4433 | 72 | PORT = 4433 |
71 | ADVERTISED_PORT = 4433 | 73 | ADVERTISED_PORT = 4433 |
72 | CRYPTO_INIT = NORMAL | 74 | CRYPTO_INIT = NORMAL |