OpenVPN server, validate certificate type, closes https://github.com/opnsense/core/issues/3045

This commit is contained in:
Ad Schellevis 2019-02-28 16:36:40 +01:00
parent 6fe924c1f7
commit e7d04751c9

View File

@ -329,6 +329,19 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$input_errors[] = gettext("Renegotiate time should contain a valid number of seconds.");
}
// When server certificate is set, check type.
if (!empty($pconfig['certref'])) {
foreach ($config['cert'] as $cert) {
if ($cert['refid'] == $pconfig['certref']) {
if (cert_get_purpose($cert['crt'])['server'] == 'No') {
$input_errors[] = gettext(
sprintf("certificate %s is not intended for server use", $cert['descr'])
);
}
}
}
}
do_input_validation($pconfig, $reqdfields, $reqdfieldsn, $input_errors);
if (count($input_errors) == 0) {