vici: Support pinning end entity and CA certificates to connections

This commit is contained in:
Martin Willi
2014-05-07 14:13:37 +02:00
parent e6e975ff9d
commit b57739f721
2 changed files with 62 additions and 0 deletions
+25
View File
@@ -493,6 +493,7 @@ static void build_auth_cfgs(peer_cfg_t *peer_cfg, bool local, vici_builder_t *b)
union {
uintptr_t u;
identification_t *id;
certificate_t *cert;
char *str;
} v;
@@ -551,6 +552,30 @@ static void build_auth_cfgs(peer_cfg_t *peer_cfg, bool local, vici_builder_t *b)
rules->destroy(rules);
b->end_list(b);
b->begin_list(b, "certs");
rules = auth->create_enumerator(auth);
while (rules->enumerate(rules, &rule, &v))
{
if (rule == AUTH_RULE_SUBJECT_CERT)
{
b->add_li(b, "%Y", v.cert->get_subject(v.cert));
}
}
rules->destroy(rules);
b->end_list(b);
b->begin_list(b, "cacerts");
rules = auth->create_enumerator(auth);
while (rules->enumerate(rules, &rule, &v))
{
if (rule == AUTH_RULE_CA_CERT)
{
b->add_li(b, "%Y", v.cert->get_subject(v.cert));
}
}
rules->destroy(rules);
b->end_list(b);
b->end_section(b);
}
enumerator->destroy(enumerator);