moved imv_manager to libtnccs
This commit is contained in:
@@ -87,8 +87,6 @@ sa/tasks/ike_reauth.c sa/tasks/ike_reauth.h \
|
|||||||
sa/tasks/ike_auth_lifetime.c sa/tasks/ike_auth_lifetime.h \
|
sa/tasks/ike_auth_lifetime.c sa/tasks/ike_auth_lifetime.h \
|
||||||
sa/tasks/ike_vendor.c sa/tasks/ike_vendor.h \
|
sa/tasks/ike_vendor.c sa/tasks/ike_vendor.h \
|
||||||
sa/tasks/task.c sa/tasks/task.h \
|
sa/tasks/task.c sa/tasks/task.h \
|
||||||
tnc/imv/imv.h tnc/imv/imv_manager.h \
|
|
||||||
tnc/imv/imv_recommendations.c tnc/imv/imv_recommendations.h \
|
|
||||||
tnc/tnccs/tnccs.c tnc/tnccs/tnccs.h \
|
tnc/tnccs/tnccs.c tnc/tnccs/tnccs.h \
|
||||||
tnc/tnccs/tnccs_manager.c tnc/tnccs/tnccs_manager.h
|
tnc/tnccs/tnccs_manager.c tnc/tnccs/tnccs_manager.h
|
||||||
|
|
||||||
|
|||||||
@@ -152,7 +152,6 @@ typedef struct daemon_t daemon_t;
|
|||||||
#include <sa/shunt_manager.h>
|
#include <sa/shunt_manager.h>
|
||||||
#include <config/backend_manager.h>
|
#include <config/backend_manager.h>
|
||||||
#include <sa/authenticators/eap/eap_manager.h>
|
#include <sa/authenticators/eap/eap_manager.h>
|
||||||
#include <tnc/imv/imv_manager.h>
|
|
||||||
#include <tnc/tnccs/tnccs_manager.h>
|
#include <tnc/tnccs/tnccs_manager.h>
|
||||||
|
|
||||||
#ifdef ME
|
#ifdef ME
|
||||||
@@ -240,11 +239,6 @@ struct daemon_t {
|
|||||||
*/
|
*/
|
||||||
eap_manager_t *eap;
|
eap_manager_t *eap;
|
||||||
|
|
||||||
/**
|
|
||||||
* TNC IMV manager controlling Integrity Measurement Verifiers
|
|
||||||
*/
|
|
||||||
imv_manager_t *imvs;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TNCCS manager to maintain registered TNCCS protocols
|
* TNCCS manager to maintain registered TNCCS protocols
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -24,13 +24,31 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
#include <daemon.h>
|
|
||||||
#include <utils/lexparser.h>
|
#include <utils/lexparser.h>
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
typedef struct private_tnc_imv_plugin_t private_tnc_imv_plugin_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Private data of a tnc_imv_plugin_t object.
|
||||||
|
*/
|
||||||
|
struct private_tnc_imv_plugin_t {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Public interface.
|
||||||
|
*/
|
||||||
|
tnc_imv_plugin_t public;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TNC IMV manager controlling Integrity Measurement Verifiers
|
||||||
|
*/
|
||||||
|
imv_manager_t *imvs;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* load IMVs from a configuration file
|
* load IMVs from a configuration file
|
||||||
*/
|
*/
|
||||||
static bool load_imvs(char *filename)
|
static bool load_imvs(private_tnc_imv_plugin_t *this, char *filename)
|
||||||
{
|
{
|
||||||
int fd, line_nr = 0;
|
int fd, line_nr = 0;
|
||||||
chunk_t src, line;
|
chunk_t src, line;
|
||||||
@@ -128,7 +146,7 @@ static bool load_imvs(char *filename)
|
|||||||
free(path);
|
free(path);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (!charon->imvs->add(charon->imvs, imv))
|
if (!this->imvs->add(this->imvs, imv))
|
||||||
{
|
{
|
||||||
if (imv->terminate &&
|
if (imv->terminate &&
|
||||||
imv->terminate(imv->get_id(imv)) != TNC_RESULT_SUCCESS)
|
imv->terminate(imv->get_id(imv)) != TNC_RESULT_SUCCESS)
|
||||||
@@ -153,10 +171,21 @@ METHOD(plugin_t, get_name, char*,
|
|||||||
return "tnc-imv";
|
return "tnc-imv";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
METHOD(plugin_t, get_features, int,
|
||||||
|
private_tnc_imv_plugin_t *this, plugin_feature_t *features[])
|
||||||
|
{
|
||||||
|
static plugin_feature_t f[] = {
|
||||||
|
PLUGIN_PROVIDE(CUSTOM, "imv-manager"),
|
||||||
|
};
|
||||||
|
*features = f;
|
||||||
|
return countof(f);
|
||||||
|
}
|
||||||
|
|
||||||
METHOD(plugin_t, destroy, void,
|
METHOD(plugin_t, destroy, void,
|
||||||
tnc_imv_plugin_t *this)
|
tnc_imv_plugin_t *this)
|
||||||
{
|
{
|
||||||
charon->imvs->destroy(charon->imvs);
|
lib->set(lib, "imv-manager", NULL);
|
||||||
|
this->imvs->destroy(this->imvs);
|
||||||
free(this);
|
free(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,27 +198,26 @@ plugin_t *tnc_imv_plugin_create()
|
|||||||
tnc_imv_plugin_t *this;
|
tnc_imv_plugin_t *this;
|
||||||
|
|
||||||
INIT(this,
|
INIT(this,
|
||||||
|
.public = {
|
||||||
.plugin = {
|
.plugin = {
|
||||||
.get_name = _get_name,
|
.get_name = _get_name,
|
||||||
.reload = (void*)return_false,
|
.get_features = _get_features,
|
||||||
.destroy = _destroy,
|
.destroy = _destroy,
|
||||||
},
|
},
|
||||||
|
},
|
||||||
|
.imvs = tnc_imv_manager_create(),
|
||||||
);
|
);
|
||||||
|
|
||||||
tnc_config = lib->settings->get_str(lib->settings,
|
lib->set(lib, "imv-manager", this->imvs);
|
||||||
"charon.plugins.tnc-imv.tnc_config", "/etc/tnc_config");
|
|
||||||
|
|
||||||
/* Create IMV manager */
|
|
||||||
charon->imvs = tnc_imv_manager_create();
|
|
||||||
|
|
||||||
/* Load IMVs and abort if not all instances initalize successfully */
|
/* Load IMVs and abort if not all instances initalize successfully */
|
||||||
if (!load_imvs(tnc_config))
|
tnc_config = lib->settings->get_str(lib->settings,
|
||||||
|
"charon.plugins.tnc-imv.tnc_config", "/etc/tnc_config");
|
||||||
|
if (!load_imvs(this, tnc_config))
|
||||||
{
|
{
|
||||||
charon->imvs->destroy(charon->imvs);
|
destroy(this);
|
||||||
charon->imvs = NULL;
|
|
||||||
free(this);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return &this->plugin;
|
return &this->public.plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -99,6 +99,11 @@ struct private_tnccs_11_t {
|
|||||||
*/
|
*/
|
||||||
imc_manager_t *imcs;
|
imc_manager_t *imcs;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TNC IMV manager controlling Integrity Measurement Verifiers
|
||||||
|
*/
|
||||||
|
imc_manager_t *imvs;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
METHOD(tnccs_t, send_msg, TNC_Result,
|
METHOD(tnccs_t, send_msg, TNC_Result,
|
||||||
@@ -181,7 +186,7 @@ static void handle_message(private_tnccs_11_t *this, tnccs_msg_t *msg)
|
|||||||
this->send_msg = TRUE;
|
this->send_msg = TRUE;
|
||||||
if (this->is_server)
|
if (this->is_server)
|
||||||
{
|
{
|
||||||
charon->imvs->receive_message(charon->imvs,
|
this->imvs->receive_message(this->imvs,
|
||||||
this->connection_id, msg_body.ptr, msg_body.len, msg_type);
|
this->connection_id, msg_body.ptr, msg_body.len, msg_type);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -343,7 +348,7 @@ METHOD(tls_t, process, status_t,
|
|||||||
this->send_msg = TRUE;
|
this->send_msg = TRUE;
|
||||||
if (this->is_server)
|
if (this->is_server)
|
||||||
{
|
{
|
||||||
charon->imvs->batch_ending(charon->imvs, this->connection_id);
|
this->imvs->batch_ending(this->imvs, this->connection_id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -540,6 +545,7 @@ tls_t *tnccs_11_create(bool is_server)
|
|||||||
.is_server = is_server,
|
.is_server = is_server,
|
||||||
.mutex = mutex_create(MUTEX_TYPE_DEFAULT),
|
.mutex = mutex_create(MUTEX_TYPE_DEFAULT),
|
||||||
.imcs = lib->get(lib, "imc-manager"),
|
.imcs = lib->get(lib, "imc-manager"),
|
||||||
|
.imvs = lib->get(lib, "imv-manager"),
|
||||||
);
|
);
|
||||||
|
|
||||||
return &this->public;
|
return &this->public;
|
||||||
|
|||||||
@@ -99,6 +99,11 @@ struct private_tnccs_20_t {
|
|||||||
*/
|
*/
|
||||||
imc_manager_t *imcs;
|
imc_manager_t *imcs;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TNC IMV manager controlling Integrity Measurement Verifiers
|
||||||
|
*/
|
||||||
|
imv_manager_t *imvs;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
METHOD(tnccs_t, send_msg, TNC_Result,
|
METHOD(tnccs_t, send_msg, TNC_Result,
|
||||||
@@ -198,7 +203,7 @@ static void handle_message(private_tnccs_20_t *this, pb_tnc_msg_t *msg)
|
|||||||
this->send_msg = TRUE;
|
this->send_msg = TRUE;
|
||||||
if (this->is_server)
|
if (this->is_server)
|
||||||
{
|
{
|
||||||
charon->imvs->receive_message(charon->imvs,
|
this->imvs->receive_message(this->imvs,
|
||||||
this->connection_id, msg_body.ptr, msg_body.len, msg_type);
|
this->connection_id, msg_body.ptr, msg_body.len, msg_type);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -447,7 +452,7 @@ METHOD(tls_t, process, status_t,
|
|||||||
this->send_msg = TRUE;
|
this->send_msg = TRUE;
|
||||||
if (this->is_server)
|
if (this->is_server)
|
||||||
{
|
{
|
||||||
charon->imvs->batch_ending(charon->imvs, this->connection_id);
|
this->imvs->batch_ending(this->imvs, this->connection_id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -740,6 +745,7 @@ tls_t *tnccs_20_create(bool is_server)
|
|||||||
.state_machine = pb_tnc_state_machine_create(is_server),
|
.state_machine = pb_tnc_state_machine_create(is_server),
|
||||||
.mutex = mutex_create(MUTEX_TYPE_DEFAULT),
|
.mutex = mutex_create(MUTEX_TYPE_DEFAULT),
|
||||||
.imcs = lib->get(lib, "imc-manager"),
|
.imcs = lib->get(lib, "imc-manager"),
|
||||||
|
.imvs = lib->get(lib, "imv-manager"),
|
||||||
);
|
);
|
||||||
|
|
||||||
return &this->public;
|
return &this->public;
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
#include "tnccs_manager.h"
|
#include "tnccs_manager.h"
|
||||||
|
|
||||||
#include <imc/imc_manager.h>
|
#include <imc/imc_manager.h>
|
||||||
#include <tnc/imv/imv_recommendations.h>
|
#include <imv/imv_manager.h>
|
||||||
|
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
#include <daemon.h>
|
#include <daemon.h>
|
||||||
@@ -116,6 +116,11 @@ struct private_tnccs_manager_t {
|
|||||||
*/
|
*/
|
||||||
imc_manager_t *imcs;
|
imc_manager_t *imcs;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TNC IMV manager controlling Integrity Measurement Verifiers
|
||||||
|
*/
|
||||||
|
imv_manager_t *imvs;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
METHOD(tnccs_manager_t, add_method, void,
|
METHOD(tnccs_manager_t, add_method, void,
|
||||||
@@ -193,13 +198,17 @@ METHOD(tnccs_manager_t, create_connection, TNC_ConnectionID,
|
|||||||
if (recs)
|
if (recs)
|
||||||
{
|
{
|
||||||
/* we assume a TNC Server needing recommendations from IMVs */
|
/* we assume a TNC Server needing recommendations from IMVs */
|
||||||
if (!charon->imvs)
|
if (!this->imvs)
|
||||||
|
{
|
||||||
|
this->imvs = lib->get(lib, "imv-manager");
|
||||||
|
}
|
||||||
|
if (!this->imvs)
|
||||||
{
|
{
|
||||||
DBG1(DBG_TNC, "no IMV manager available!");
|
DBG1(DBG_TNC, "no IMV manager available!");
|
||||||
free(entry);
|
free(entry);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
entry->recs = charon->imvs->create_recommendations(charon->imvs);
|
entry->recs = this->imvs->create_recommendations(this->imvs);
|
||||||
*recs = entry->recs;
|
*recs = entry->recs;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -234,9 +243,9 @@ METHOD(tnccs_manager_t, remove_connection, void,
|
|||||||
|
|
||||||
if (is_server)
|
if (is_server)
|
||||||
{
|
{
|
||||||
if (charon->imvs)
|
if (this->imvs)
|
||||||
{
|
{
|
||||||
charon->imvs->notify_connection_change(charon->imvs, id,
|
this->imvs->notify_connection_change(this->imvs, id,
|
||||||
TNC_CONNECTION_STATE_DELETE);
|
TNC_CONNECTION_STATE_DELETE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -511,6 +520,7 @@ tnccs_manager_t *tnccs_manager_create()
|
|||||||
.protocol_lock = rwlock_create(RWLOCK_TYPE_DEFAULT),
|
.protocol_lock = rwlock_create(RWLOCK_TYPE_DEFAULT),
|
||||||
.connection_lock = rwlock_create(RWLOCK_TYPE_DEFAULT),
|
.connection_lock = rwlock_create(RWLOCK_TYPE_DEFAULT),
|
||||||
.imcs = lib->get(lib, "imc-manager"),
|
.imcs = lib->get(lib, "imc-manager"),
|
||||||
|
.imvs = lib->get(lib, "imv-manager"),
|
||||||
);
|
);
|
||||||
|
|
||||||
return &this->public;
|
return &this->public;
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ typedef struct tnccs_manager_t tnccs_manager_t;
|
|||||||
|
|
||||||
#include "tnccs.h"
|
#include "tnccs.h"
|
||||||
|
|
||||||
#include <tnc/imv/imv_recommendations.h>
|
#include <imv/imv_recommendations.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The TNCCS manager manages all TNCCS implementations and creates instances.
|
* The TNCCS manager manages all TNCCS implementations and creates instances.
|
||||||
|
|||||||
@@ -6,5 +6,7 @@ ipseclib_LTLIBRARIES = libtnccs.la
|
|||||||
libtnccs_la_LIBADD = $(top_builddir)/src/libtncif/libtncif.la
|
libtnccs_la_LIBADD = $(top_builddir)/src/libtncif/libtncif.la
|
||||||
|
|
||||||
libtnccs_la_SOURCES = \
|
libtnccs_la_SOURCES = \
|
||||||
imc/imc.h imc/imc_manager.h
|
imc/imc.h imc/imc_manager.h \
|
||||||
|
imv/imv.h imv/imv_manager.h \
|
||||||
|
imv/imv_recommendations.h imv/imv_recommendations.c
|
||||||
|
|
||||||
|
|||||||
@@ -23,8 +23,6 @@
|
|||||||
|
|
||||||
typedef struct imv_manager_t imv_manager_t;
|
typedef struct imv_manager_t imv_manager_t;
|
||||||
|
|
||||||
#ifdef USE_TNC
|
|
||||||
|
|
||||||
#include "imv.h"
|
#include "imv.h"
|
||||||
#include "imv_recommendations.h"
|
#include "imv_recommendations.h"
|
||||||
|
|
||||||
@@ -144,6 +142,4 @@ struct imv_manager_t {
|
|||||||
void (*destroy)(imv_manager_t *this);
|
void (*destroy)(imv_manager_t *this);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* USE_TNC */
|
|
||||||
|
|
||||||
#endif /** IMV_MANAGER_H_ @}*/
|
#endif /** IMV_MANAGER_H_ @}*/
|
||||||
Reference in New Issue
Block a user