summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2017-02-19 11:55:28 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2017-02-19 11:55:28 (GMT)
commit588c206289a84bfc939ac27dacba991d9b6d0793 (patch)
tree0de656a445e236de1846e8f40e6635077b9d3f19 /src/core
parent1898c6ea16d0eee8ecc5ab9ebb26ac91ad7314b4 (diff)
Created client/server certificates on demand for a given identity.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/core.c4
-rw-r--r--src/core/params.c39
-rw-r--r--src/core/params.h13
3 files changed, 56 insertions, 0 deletions
diff --git a/src/core/core.c b/src/core/core.c
index e265250..9750fc6 100644
--- a/src/core/core.c
+++ b/src/core/core.c
@@ -27,6 +27,7 @@
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
+#include <openssl/ssl.h>
#include <config.h>
@@ -79,6 +80,9 @@ bool load_all_basic_components(void)
result &= load_main_config_parameters();
+ SSL_load_error_strings();
+ SSL_library_init();
+
result &= ensure_user_has_rsa_keys();
result &= g_generic_config_read(get_main_configuration());
diff --git a/src/core/params.c b/src/core/params.c
index 1611e98..a82f186 100644
--- a/src/core/params.c
+++ b/src/core/params.c
@@ -120,6 +120,45 @@ bool load_main_config_parameters(void)
free(string);
if (param == NULL) return false;
+ param = g_generic_config_create_param(config, MPK_IDENTITY_CLIENT_C, CPT_STRING, NULL);
+ if (param == NULL) return false;
+
+ param = g_generic_config_create_param(config, MPK_IDENTITY_CLIENT_ST, CPT_STRING, NULL);
+ if (param == NULL) return false;
+
+ param = g_generic_config_create_param(config, MPK_IDENTITY_CLIENT_L, CPT_STRING, NULL);
+ if (param == NULL) return false;
+
+ param = g_generic_config_create_param(config, MPK_IDENTITY_CLIENT_O, CPT_STRING, NULL);
+ if (param == NULL) return false;
+
+ param = g_generic_config_create_param(config, MPK_IDENTITY_CLIENT_OU, CPT_STRING, NULL);
+ if (param == NULL) return false;
+
+ param = g_generic_config_create_param(config, MPK_IDENTITY_CLIENT_CN, CPT_STRING, NULL);
+ if (param == NULL) return false;
+
+ param = g_generic_config_create_param(config, MPK_IDENTITY_SERVER_C, CPT_STRING, NULL);
+ if (param == NULL) return false;
+
+ param = g_generic_config_create_param(config, MPK_IDENTITY_SERVER_ST, CPT_STRING, NULL);
+ if (param == NULL) return false;
+
+ param = g_generic_config_create_param(config, MPK_IDENTITY_SERVER_L, CPT_STRING, NULL);
+ if (param == NULL) return false;
+
+ param = g_generic_config_create_param(config, MPK_IDENTITY_SERVER_O, CPT_STRING, NULL);
+ if (param == NULL) return false;
+
+ param = g_generic_config_create_param(config, MPK_IDENTITY_SERVER_OU, CPT_STRING, NULL);
+ if (param == NULL) return false;
+
+ param = g_generic_config_create_param(config, MPK_IDENTITY_SERVER_CN, CPT_STRING, NULL);
+ if (param == NULL) return false;
+
+ param = g_generic_config_create_param(config, MPK_IDENTITY_VALIDITY, CPT_ULONG, 10 * 365 * 24 * 60 * 60);
+ if (param == NULL) return false;
+
param = g_generic_config_create_param(config, MPK_REMOTE_HOST, CPT_STRING, "localhost");
if (param == NULL) return false;
diff --git a/src/core/params.h b/src/core/params.h
index ec55710..9bbffc6 100644
--- a/src/core/params.h
+++ b/src/core/params.h
@@ -34,6 +34,19 @@
*/
#define MPK_AUTHOR_NAME "cdb.default.author"
+#define MPK_IDENTITY_CLIENT_C "cdb.identity.client.country"
+#define MPK_IDENTITY_CLIENT_ST "cdb.identity.client.state"
+#define MPK_IDENTITY_CLIENT_L "cdb.identity.client.locality"
+#define MPK_IDENTITY_CLIENT_O "cdb.identity.client.organisation"
+#define MPK_IDENTITY_CLIENT_OU "cdb.identity.client.organisational_unit"
+#define MPK_IDENTITY_CLIENT_CN "cdb.identity.client.common_name"
+#define MPK_IDENTITY_SERVER_C "cdb.identity.server.country"
+#define MPK_IDENTITY_SERVER_ST "cdb.identity.server.state"
+#define MPK_IDENTITY_SERVER_L "cdb.identity.server.locality"
+#define MPK_IDENTITY_SERVER_O "cdb.identity.server.organisation"
+#define MPK_IDENTITY_SERVER_OU "cdb.identity.server.organisational_unit"
+#define MPK_IDENTITY_SERVER_CN "cdb.identity.server.common_name"
+#define MPK_IDENTITY_VALIDITY "cdb.identity.validity"
#define MPK_REMOTE_HOST "cdb.default.network.remote.server"
#define MPK_REMOTE_PORT "cdb.default.network.remote.port"
#define MPK_LOCAL_HOST "cdb.network.local.server"