<th><?php echo gettext("In Use"); ?> </th> </tr> </thead> <tbody> <?php $i = 0; foreach ($a_cert as $cert) { $name = htmlspecialchars($cert['descr']); $purpose = null; if (!empty($cert['crt'])) { $subj = cert_get_subject($cert['crt']); $issuer = cert_get_issuer($cert['crt']); $purpose = cert_get_purpose($cert['crt']); list($startdate, $enddate) = cert_get_dates($cert['crt']); if ($subj == $issuer) { $caname = "<em>" . gettext("self-signed") . "</em>"; } else { $caname = "<em>" . gettext("external") . "</em>"; } $subj = htmlspecialchars($subj); } if (isset($cert['csr'])) { $subj = htmlspecialchars(csr_get_subject($cert['csr'])); $caname = "<em>" . gettext("external - signature pending") . "</em>"; } if (isset($cert['caref'])) { $ca = lookup_ca($cert['caref']); if ($ca) {
$list[$ca['refid']] = $ca['descr']; } $section->addInput(new Form_Select('caref', 'Peer Certificate Authority', $pconfig['caref'], $list)); } else { $section->addInput(new Form_StaticText('Peer Certificate Authority', sprintf('No Certificate Authorities defined. You may create one here: %s', '<a href="system_camanager.php">System > Cert Manager</a>'))); } if (count($a_crl)) { $section->addInput(new Form_Select('crlref', 'Peer Certificate Revocation list', $pconfig['crlref'], openvpn_build_crl_list())); } else { $section->addInput(new Form_StaticText('Peer Certificate Revocation list', sprintf('No Certificate Revocation Lists defined. You may create one here: %s', '<a href="system_camanager.php">System > Cert Manager</a>'))); } $certhelp = '<span id="certtype"></span>'; if (count($a_cert)) { if (!empty(trim($pconfig['certref']))) { $thiscert = lookup_cert($pconfig['certref']); $purpose = cert_get_purpose($thiscert['crt'], true); if ($purpose['server'] != "Yes") { $certhelp = '<span id="certtype" class="text-danger">' . gettext("Warning: The selected server certificate was not created as an SSL Server certificate and may not work as expected") . ' </span>'; } } } else { $certhelp = sprintf('%s%s%s$s', '<span id="certtype">', gettext('No Certificates defined. You may create one here: '), '<a href="system_camanager.php">' . gettext("System > Cert Manager") . '</a>', '</span>'); } $cl = openvpn_build_cert_list(false, true); //Save the number of server certs for use at run-time $servercerts = count($cl['server']); $section->addInput(new Form_Select('certref', 'Server certificate', $pconfig['certref'], $cl['server'] + $cl['non-server']))->setHelp($certhelp); $section->addInput(new Form_Select('dh_length', 'DH Parameter length (bits)', $pconfig['dh_length'], array_combine($openvpn_dh_lengths, $openvpn_dh_lengths)))->setHelp(count($a_cert) ? '' : sprintf('No Certificates defined. You may create one here: %s', '<a href="system_camanager.php">System > Cert Manager</a>')); if (!$pconfig['shared_key']) { $section->addInput(new Form_Checkbox('autokey_enable', 'Shared key', 'Automatically generate a shared key', $pconfig['autokey_enable'])); }