Ejemplo n.º 1
0
         $input_errors[] = gettext("Please select a valid Key Length.");
     }
     if ($pconfig['certmethod'] != "external" && !in_array($pconfig["digest_alg"], $openssl_digest_algs)) {
         $input_errors[] = gettext("Please select a valid Digest Algorithm.");
     }
     if ($pconfig['certmethod'] == "external" && isset($pconfig["csr_keylen"]) && !in_array($pconfig["csr_keylen"], $cert_keylens)) {
         $input_errors[] = gettext("Please select a valid Key Length.");
     }
     if ($pconfig['certmethod'] == "external" && !in_array($pconfig["csr_digest_alg"], $openssl_digest_algs)) {
         $input_errors[] = gettext("Please select a valid Digest Algorithm.");
     }
 }
 /* save modifications */
 if (count($input_errors) == 0) {
     if ($pconfig['certmethod'] == "existing") {
         $cert = lookup_cert($pconfig['certref']);
         if ($cert && !empty($userid)) {
             $a_user[$userid]['cert'][] = $cert['refid'];
         }
     } else {
         $cert = array();
         $cert['refid'] = uniqid();
         if (isset($id) && $a_cert[$id]) {
             $cert = $a_cert[$id];
         }
         $cert['descr'] = $pconfig['descr'];
         $old_err_level = error_reporting(0);
         /* otherwise openssl_ functions throw warings directly to a page screwing menu tab */
         if ($pconfig['certmethod'] == "import") {
             cert_import($cert, $pconfig['cert'], $pconfig['key']);
         }
Ejemplo n.º 2
0
function build_cert_table()
{
    global $a_user, $id;
    $certhtml = '<div class="table-responsive">';
    $certhtml .= '<table class="table table-striped table-hover table-condensed">';
    $certhtml .= '<thead>';
    $certhtml .= '<tr>';
    $certhtml .= '<th>' . gettext('Name') . '</th>';
    $certhtml .= '<th>' . gettext('CA') . '</th>';
    $certhtml .= '<th></th>';
    $certhtml .= '</tr>';
    $certhtml .= '</thead>';
    $certhtml .= '<tbody>';
    $a_cert = $a_user[$id]['cert'];
    if (is_array($a_cert)) {
        $i = 0;
        foreach ($a_cert as $certref) {
            $cert = lookup_cert($certref);
            $ca = lookup_ca($cert['caref']);
            $revokedstr = is_cert_revoked($cert) ? '<b> Revoked</b>' : '';
            $certhtml .= '<tr>';
            $certhtml .= '<td>' . htmlspecialchars($cert['descr']) . $revokedstr . '</td>';
            $certhtml .= '<td>' . htmlspecialchars($ca['descr']) . '</td>';
            $certhtml .= '<td>';
            $certhtml .= '<a id="delcert' . $i . '" class="fa fa-trash no-confirm icon-pointer" title="';
            $certhtml .= gettext('Remove this certificate association? (Certificate will not be deleted)') . '"></a>';
            $certhtml .= '</td>';
            $certhtml .= '</tr>';
            $i++;
        }
    }
    $certhtml .= '</tbody>';
    $certhtml .= '</table>';
    $certhtml .= '</div>';
    $certhtml .= '<nav class="action-buttons">';
    $certhtml .= '<a href="system_certmanager.php?act=new&amp;userid=' . $id . '" class="btn btn-success">' . gettext("Add") . '</a>';
    $certhtml .= '</nav>';
    return $certhtml;
}
Ejemplo n.º 3
0
                                    <td width="45%" class="listhdrr"><?php 
        echo gettext("Name");
        ?>
</td>
                                    <td width="45%" class="listhdrr"><?php 
        echo gettext("CA");
        ?>
</td>
                                    <td class="list"></td>
                                </tr>
				<?php 
        $a_cert = $a_user[$id]['cert'];
        if (is_array($a_cert)) {
            $i = 0;
            foreach ($a_cert as $certref) {
                $cert = lookup_cert($certref);
                $ca = lookup_ca($cert['caref']);
                ?>
                        <tr>
                            <td class="listlr">
                                <?php 
                echo htmlspecialchars($cert['descr']);
                ?>
				<?php 
                if (is_cert_revoked($cert)) {
                    ?>
                    (<b>Revoked</b>)
				<?php 
                }
                ?>
                            </td>
Ejemplo n.º 4
0
					$acls = get_frontend_acls($frontend);
					$isaclset = "";
					foreach ($acls as $acl) {
						$isaclset .= "&#10;" . htmlspecialchars($acl['descr']);
					}
					if ($isaclset) 
						echo "<img src=\"$img_acl\" title=\"" . gettext("acl's used") . ": {$isaclset}\" border=\"0\" />";
						
					if (get_frontend_uses_ssl($frontend)) {
						$cert = lookup_cert($frontend['ssloffloadcert']);
						$descr = htmlspecialchars($cert['descr']);
						if (is_array($frontend['ha_certificates']) && is_array($frontend['ha_certificates']['item'])) {
							$certs = $frontend['ha_certificates']['item'];
							if (count($certs) > 0){
								foreach($certs as $certitem){
									$cert = lookup_cert($certitem['ssl_certificate']);
									$descr .= "\n".htmlspecialchars($cert['descr']);
								}
							}
						}
						echo '<img src="'.$img_cert.'" title="SSL offloading cert: '.$descr.'" alt="SSL offloading" border="0" height="16" width="16" />';
					}
					
					$isadvset = "";
					if ($frontend['advanced_bind']) $isadvset .= "Advanced bind: ".htmlspecialchars($frontend['advanced_bind'])."\r\n";
					if ($frontend['advanced']) $isadvset .= "Advanced pass thru setting used\r\n";
					if ($isadvset)
						echo "<img src=\"$img_adv\" title=\"" . gettext("Advanced settings set") . ": {$isadvset}\" border=\"0\" />";
					
					$backend_serverpool_hint = "";
					$backend_serverpool = $frontend['backend_serverpool'];
Ejemplo n.º 5
0
        continue;
    }
    $ras_user = array();
    $ras_certs = array();
    if (stripos($server['mode'], "server") === false) {
        continue;
    }
    if (($server['mode'] == "server_tls_user") && ($server['authmode'] == "Local Database")) {
        foreach ($a_user as $uindex => $user) {
            if (!is_array($user['cert'])) {
                continue;
            }
            foreach ($user['cert'] as $cindex => $cert) {
                // If $cert is not an array, it's a certref not a cert.
                if (!is_array($cert)) {
                    $cert = lookup_cert($cert);
                }

                if ($cert['caref'] != $server['caref']) {
                    continue;
                }
                $ras_userent = array();
                $ras_userent['uindex'] = $uindex;
                $ras_userent['cindex'] = $cindex;
                $ras_userent['name'] = $user['name'];
                $ras_userent['certname'] = $cert['descr'];
                $ras_user[] = $ras_userent;
            }
        }
    } elseif (($server['mode'] == "server_tls") || (($server['mode'] == "server_tls_user") && ($server['authmode'] != "Local Database"))) {
        foreach ($a_cert as $cindex => $cert) {