Files
phpki-ng/ca/main.php

169 lines
5.8 KiB
PHP
Raw Normal View History

2012-02-28 08:23:39 +00:00
<?php
include("../config.php");
include(STORE_DIR.'/config/config.php');
include("../include/my_functions.php");
include("../include/common.php") ;
include("../include/openssl_functions.php");
$stage = gpvar('stage');
switch($stage) {
2020-02-27 16:16:31 +01:00
case 'dl_takey':
upload("$config[private_dir]/takey.pem", "$config[ca_prefix]takey.pem", 'application/octet-stream');
break;
case 'dl_dhparam':
2020-03-19 01:05:16 +01:00
upload("$config[private_dir]/dhparam2048.pem", "$config[ca_prefix]dhparam2048.pem", 'application/octet-stream');
2020-02-27 16:16:31 +01:00
break;
2012-02-28 08:23:39 +00:00
case 'dl_root':
upload("$config[cacert_pem]", "$config[ca_prefix]cacert.crt", 'application/x-x509-ca-cert');
break;
case 'dl_crl':
upload("$config[cacrl_der]", "$config[ca_prefix]cacrl.crl", 'application/pkix-crl');
break;
2020-02-27 16:16:31 +01:00
case 'dl_crl_pem':
upload("$config[cacrl_pem]", "$config[ca_prefix]cacrl.crl", 'application/octet-stream');
break;
2012-02-28 08:23:39 +00:00
case 'gen_crl':
2020-02-27 16:16:31 +01:00
list($ret,$errtxt) = CA_generate_crl();
printHeader(false);
if ($ret) {
?>
<center><h2>Certificate Revocation List Updated</h2></center>
2020-03-04 14:58:10 +01:00
<br>
2020-02-27 16:16:31 +01:00
<form action="<?php echo $PHP_SELF?>" method="post">
2020-03-04 14:58:10 +01:00
<input type="submit" name="submit" value="Back to Menu">
2020-02-27 16:16:31 +01:00
</form>
<?php
print '<pre>'.CA_crl_text().'</pre>';
}
else {
?>
2020-03-04 14:58:10 +01:00
<font color="#ff0000">
2020-02-27 16:16:31 +01:00
<h2>There was an error updating the Certificate Revocation List.</h2></font><br>
<blockquote>
<h3>Debug Info:</h3>
<pre><?php echo $errtxt?></pre>
</blockquote>
<form action="<?php echo $PHP_SELF?>" method="post">
2020-03-04 14:58:10 +01:00
<br>
<input type="submit" name="submit" value="Back to Menu">
<br>
2020-02-27 16:16:31 +01:00
</form>
<?php
}
break;
case 'display_takey':
printHeader(false);
?>
<center><h2>OpenVPN pre-shared Key</h2></center>
2020-03-04 14:58:10 +01:00
<br>
2020-02-27 16:16:31 +01:00
<form action="<?php echo $PHP_SELF?>" method="post">
2020-03-04 14:58:10 +01:00
<input type="submit" name="submit" value="Back to Menu">
2020-02-27 16:16:31 +01:00
</form>
<?php
print '<pre>'.ta_key_text().'</pre>';
break;
case 'display_dhparam':
printHeader(false);
?>
<center><h2>OpenVPN Diffie-Helman parameters</h2></center>
2020-03-04 14:58:10 +01:00
<br>
2020-02-27 16:16:31 +01:00
<form action="<?php echo $PHP_SELF?>" method="post">
<input type=submit name=submit value="Back to Menu">
</form>
<?php
print '<pre>'.dhparam_text().'</pre>';
break;
case 'display_root_pem':
printHeader(false);
?>
<center><h2>Root certificate file (PEM Encoded)</h2></center>
2020-03-04 14:58:10 +01:00
<br>
2020-02-27 16:16:31 +01:00
<form action="<?php echo $PHP_SELF?>" method="post">
2020-03-04 14:58:10 +01:00
<input type="submit" name="submit" value="Back to Menu">
2020-02-27 16:16:31 +01:00
</form>
<?php
print '<pre>'.root_pem_text().'</pre>';
break;
2012-02-28 08:23:39 +00:00
default:
printHeader('ca');
?>
<br>
<br>
<center>
2020-03-04 14:58:10 +01:00
<table class="menu" width="600px"><th class="menu" colspan="2"><big>CERTIFICATE MANAGEMENT MENU</big></th>
<tr><td style="text-align: center; vertical-align: middle; font-weight: bold;" width="33%">
<a href="request_cert.php">Create a New Certificate</a></td>
2012-02-28 08:23:39 +00:00
<td>Use the <strong><cite>Certificate Request Form</cite></strong> to create and download new digital certificates.
You may create certificates in succession without re-entering the entire form
by clicking the "<strong>Go Back</strong>" button after each certificate is created.</td></tr>
<tr><td style="text-align: center; vertical-align: middle; font-weight: bold;">
2020-03-04 14:58:10 +01:00
<a href="manage_certs.php">Manage Certificates</a></td>
2012-02-28 08:23:39 +00:00
<td>Conveniently view, download, revoke, and renew your existing certificates using the
<strong><cite>Certificate Management Control Panel</cite></strong>.</td></tr>
<tr><td style="text-align: center; vertical-align: middle; font-weight: bold;">
2020-03-04 14:58:10 +01:00
<a href="<?php echo $PHP_SELF?>?stage=gen_crl">Update & View the Certificate Revocation List</a></td>
2012-02-28 08:23:39 +00:00
<td>Some applications automagically reference the Certificate Revocation List to determine
certificate validity. It is not necessary to perform this update function, as the CRL is
updated when certificates are revoked. However, doing so is harmless.
2020-03-04 14:58:10 +01:00
<a href="../help.php" target="_help">Read the online help</a> to learn more about this.</td></tr>
2012-02-28 08:23:39 +00:00
<tr><td style="text-align: center; vertical-align: middle; font-weight: bold;">
2020-03-04 14:58:10 +01:00
<a href="<?php echo $PHP_SELF?>?stage=dl_root">Download the Root Certificate</a><br><br>
<a href="<?php echo $PHP_SELF?>?stage=display_root_pem">Display the Root Certificate (PEM Encoded)</a></td>
2012-02-28 08:23:39 +00:00
<td>The "Root" certificate must be installed before using any of the
2020-03-04 14:58:10 +01:00
certificates issued here. <a href="../help.php" target="_help">Read the online help</a>
2012-02-28 08:23:39 +00:00
to learn more about this.</td></tr>
<tr><td style="text-align: center; vertical-align: middle; font-weight: bold;">
2020-03-04 14:58:10 +01:00
<a href="<?php echo $PHP_SELF?>?stage=dl_crl">Download the Certificate Revocation List</a><br><br>
<a href="<?php echo $PHP_SELF?>?stage=dl_crl_pem">Download in PEM format.</a></td>
2012-02-28 08:23:39 +00:00
<td>This is the official list of revoked certificates. Using this list with your e-mail or
2020-02-27 16:16:31 +01:00
browser application is optional. Some applications will automagically reference this list.</td></tr>
<?php
if (file_exists($config[private_dir] . '/takey.pem')) {
?>
<tr><td style="text-align: center; vertical-align: middle; font-weight: bold;">
2020-03-04 14:58:10 +01:00
<a href="<?php echo $PHP_SELF?>?stage=dl_takey">Download the static pre-shared key</a><br><br>
<a href="<?php echo $PHP_SELF?>?stage=display_takey">Display the static pre-shared key</a></td>
2020-02-27 16:16:31 +01:00
<td>This key can be used with OpenVPN as a standalone auth mechanism, or as an additional TLS authentication.</td></tr>
<?php }
?>
2020-03-19 01:05:16 +01:00
<?php if (file_exists ($config[private_dir] . '/dhparam2048.pem')) {
2020-02-27 16:16:31 +01:00
?>
<tr><td style="text-align: center; vertical-align: middle; font-weight: bold;">
2020-03-04 14:58:10 +01:00
<a href="<?php echo $PHP_SELF?>?stage=dl_dhparam">Download the Diffie-Hellman parameters</a><br><br>
<a href="<?php echo $PHP_SELF?>?stage=display_dhparam">Display the Diffie-Hellman parameters</a></td>
2020-02-27 16:16:31 +01:00
<td>This file is used by OpenVPN for the hand-shake. The Diffie-Hellman key agreement
protocol enables two communication partners to exchange a secret key safely.</td></tr>
<?php }
?>
2012-02-28 08:23:39 +00:00
</table>
</center>
<br><br>
2013-07-18 14:31:39 +00:00
<?php
2012-02-28 08:23:39 +00:00
printFooter();
}
?>