Commit 18b114467f for strongswan.org
commit 18b114467fd5ef975421cea9293e6c423c792746
Author: Tobias Brunner <tobias@strongswan.org>
Date: Tue Nov 24 14:50:42 2026 +0100
vici: Actually enforce the documented default to pubkey authentication
For some reason this was never actually configured, even though the
docs said so since the beginning.
While currently not configurable, this change would work with
AUTH_CLASS_ANY explicitly configured (it's also returned as default if
nothing is specified, which was what happened before this change).
Fixes: b3d8bd8d2651 ("vici: Add backend providing in-memory connections")
diff --git a/src/libcharon/plugins/vici/vici_config.c b/src/libcharon/plugins/vici/vici_config.c
index 61577590a0..f3bf193d21 100644
--- a/src/libcharon/plugins/vici/vici_config.c
+++ b/src/libcharon/plugins/vici/vici_config.c
@@ -2022,6 +2022,7 @@ CALLBACK(peer_sn, bool,
enumerator_t *enumerator;
linked_list_t *auths;
auth_data_t *auth, *current;
+ auth_rule_t rule = AUTH_RULE_MAX;
certificate_t *cert;
identification_t *id;
@@ -2035,8 +2036,22 @@ CALLBACK(peer_sn, bool,
free_auth_data(auth);
return FALSE;
}
- id = auth->cfg->get(auth->cfg, AUTH_RULE_IDENTITY);
+ enumerator = auth->cfg->create_enumerator(auth->cfg);
+ while (enumerator->enumerate(enumerator, &rule, NULL))
+ {
+ if (rule == AUTH_RULE_AUTH_CLASS)
+ {
+ break;
+ }
+ }
+ enumerator->destroy(enumerator);
+ if (rule != AUTH_RULE_AUTH_CLASS)
+ {
+ auth->cfg->add(auth->cfg, AUTH_RULE_AUTH_CLASS, AUTH_CLASS_PUBKEY);
+ }
+
+ id = auth->cfg->get(auth->cfg, AUTH_RULE_IDENTITY);
if (!parse_and_add_pubkeys(auth, id))
{
free_auth_data(auth);
@@ -2547,6 +2562,7 @@ CALLBACK(config_sn, bool,
INIT(auth,
.cfg = auth_cfg_create(),
);
+ auth->cfg->add(auth->cfg, AUTH_RULE_AUTH_CLASS, AUTH_CLASS_PUBKEY);
peer.local->insert_last(peer.local, auth);
}
if (peer.remote->get_count(peer.remote) == 0)
@@ -2554,6 +2570,7 @@ CALLBACK(config_sn, bool,
INIT(auth,
.cfg = auth_cfg_create(),
);
+ auth->cfg->add(auth->cfg, AUTH_RULE_AUTH_CLASS, AUTH_CLASS_PUBKEY);
peer.remote->insert_last(peer.remote, auth);
}
if (peer.proposals->get_count(peer.proposals) == 0)