log TNC PEP decision with level 0
This commit is contained in:
@@ -112,36 +112,56 @@ METHOD(imv_manager_t, create_recommendations, recommendations_t*,
|
|||||||
}
|
}
|
||||||
|
|
||||||
METHOD(imv_manager_t, enforce_recommendation, bool,
|
METHOD(imv_manager_t, enforce_recommendation, bool,
|
||||||
private_tnc_imv_manager_t *this, TNC_IMV_Action_Recommendation rec)
|
private_tnc_imv_manager_t *this, TNC_IMV_Action_Recommendation rec,
|
||||||
|
TNC_IMV_Evaluation_Result eval)
|
||||||
{
|
{
|
||||||
char *group;
|
char *group;
|
||||||
identification_t *id;
|
identification_t *id;
|
||||||
ike_sa_t *ike_sa;
|
ike_sa_t *ike_sa;
|
||||||
auth_cfg_t *auth;
|
auth_cfg_t *auth;
|
||||||
|
bool no_access = FALSE;
|
||||||
|
|
||||||
|
DBG1(DBG_TNC, "final recommendation is '%N' and evaluation is '%N'",
|
||||||
|
TNC_IMV_Action_Recommendation_names, rec,
|
||||||
|
TNC_IMV_Evaluation_Result_names, eval);
|
||||||
|
|
||||||
switch (rec)
|
switch (rec)
|
||||||
{
|
{
|
||||||
case TNC_IMV_ACTION_RECOMMENDATION_ALLOW:
|
case TNC_IMV_ACTION_RECOMMENDATION_ALLOW:
|
||||||
DBG1(DBG_TNC, "TNC recommendation is allow");
|
|
||||||
group = "allow";
|
group = "allow";
|
||||||
break;
|
break;
|
||||||
case TNC_IMV_ACTION_RECOMMENDATION_ISOLATE:
|
case TNC_IMV_ACTION_RECOMMENDATION_ISOLATE:
|
||||||
DBG1(DBG_TNC, "TNC recommendation is isolate");
|
|
||||||
group = "isolate";
|
group = "isolate";
|
||||||
break;
|
break;
|
||||||
case TNC_IMV_ACTION_RECOMMENDATION_NO_ACCESS:
|
case TNC_IMV_ACTION_RECOMMENDATION_NO_ACCESS:
|
||||||
case TNC_IMV_ACTION_RECOMMENDATION_NO_RECOMMENDATION:
|
case TNC_IMV_ACTION_RECOMMENDATION_NO_RECOMMENDATION:
|
||||||
default:
|
default:
|
||||||
DBG1(DBG_TNC, "TNC recommendation is none");
|
group = "no access";
|
||||||
return FALSE;
|
no_access = TRUE;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ike_sa = charon->bus->get_sa(charon->bus);
|
ike_sa = charon->bus->get_sa(charon->bus);
|
||||||
if (ike_sa)
|
if (!ike_sa)
|
||||||
{
|
{
|
||||||
|
DBG1(DBG_TNC, "policy enforcement point did not find IKE_SA");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
id = ike_sa->get_other_id(ike_sa);
|
||||||
|
DBG0(DBG_TNC, "policy enforced on peer '%Y' is '%s'", id, group);
|
||||||
|
|
||||||
|
if (no_access)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
auth = ike_sa->get_auth_cfg(ike_sa, FALSE);
|
auth = ike_sa->get_auth_cfg(ike_sa, FALSE);
|
||||||
id = identification_create_from_string(group);
|
id = identification_create_from_string(group);
|
||||||
auth->add(auth, AUTH_RULE_GROUP, id);
|
auth->add(auth, AUTH_RULE_GROUP, id);
|
||||||
DBG1(DBG_TNC, "TNC added group membership '%s'", group);
|
DBG1(DBG_TNC, "policy enforcement point added group membership '%s'",
|
||||||
|
group);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -437,11 +437,7 @@ METHOD(tls_t, is_complete, bool,
|
|||||||
|
|
||||||
if (this->recs && this->recs->have_recommendation(this->recs, &rec, &eval))
|
if (this->recs && this->recs->have_recommendation(this->recs, &rec, &eval))
|
||||||
{
|
{
|
||||||
DBG2(DBG_TNC, "Final recommendation is '%N' and evaluation is '%N'",
|
return charon->imvs->enforce_recommendation(charon->imvs, rec, eval);
|
||||||
TNC_IMV_Action_Recommendation_names, rec,
|
|
||||||
TNC_IMV_Evaluation_Result_names, eval);
|
|
||||||
|
|
||||||
return charon->imvs->enforce_recommendation(charon->imvs, rec);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -608,11 +608,7 @@ METHOD(tls_t, is_complete, bool,
|
|||||||
|
|
||||||
if (this->recs && this->recs->have_recommendation(this->recs, &rec, &eval))
|
if (this->recs && this->recs->have_recommendation(this->recs, &rec, &eval))
|
||||||
{
|
{
|
||||||
DBG2(DBG_TNC, "Final recommendation is '%N' and evaluation is '%N'",
|
return charon->imvs->enforce_recommendation(charon->imvs, rec, eval);
|
||||||
TNC_IMV_Action_Recommendation_names, rec,
|
|
||||||
TNC_IMV_Evaluation_Result_names, eval);
|
|
||||||
|
|
||||||
return charon->imvs->enforce_recommendation(charon->imvs, rec);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -67,11 +67,13 @@ struct imv_manager_t {
|
|||||||
* Enforce the TNC recommendation on the IKE_SA by either inserting an
|
* Enforce the TNC recommendation on the IKE_SA by either inserting an
|
||||||
* allow|isolate group membership rule (TRUE) or by blocking access (FALSE)
|
* allow|isolate group membership rule (TRUE) or by blocking access (FALSE)
|
||||||
*
|
*
|
||||||
* @param void TNC action recommendation
|
* @param rec TNC action recommendation
|
||||||
|
* @param eval TNC evaluation result
|
||||||
* @return TRUE for allow|isolate, FALSE for none
|
* @return TRUE for allow|isolate, FALSE for none
|
||||||
*/
|
*/
|
||||||
bool (*enforce_recommendation)(imv_manager_t *this,
|
bool (*enforce_recommendation)(imv_manager_t *this,
|
||||||
TNC_IMV_Action_Recommendation rec);
|
TNC_IMV_Action_Recommendation rec,
|
||||||
|
TNC_IMV_Evaluation_Result eval);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notify all IMV instances
|
* Notify all IMV instances
|
||||||
|
|||||||
Reference in New Issue
Block a user