VPN: IPsec: Connections - omit conditional authentication properties when not applicable. closes https://github.com/opnsense/core/issues/6807

This commit is contained in:
Ad Schellevis 2023-08-31 15:10:59 +02:00
parent fc0f2c746d
commit a702cf9fb3

View File

@ -172,11 +172,18 @@ class Swanctl extends BaseModel
}
$thisnode[$attr_name] = implode(',', $tmp);
} elseif ($attr_name == 'pubkeys') {
if ((string)$node->auth != 'pubkey') {
// explicit skip, pubkeys bound to auth type selection
continue;
}
$tmp = [];
foreach (explode(',', (string)$attr) as $item) {
$tmp[] = $item . '.pem';
}
$thisnode[$attr_name] = implode(',', $tmp);
} elseif ($attr_name == 'eap_id' && strpos((string)$node->auth, 'eap') === false) {
// explicit skip, eap_id is only valid for eap auth types.
continue;
} else {
$thisnode[$attr_name] = (string)$attr;
}