Hanno Böck
Change license from CC0 to 0BSD, all contributors agreed
Hanno Böck commited dcc202f at 2022-08-20 09:22:23
<?php
/*
This file belongs to the Webinterface of schokokeks.org Hosting
Written by schokokeks.org Hosting, namely
Bernd Wurst <bernd@schokokeks.org>
Hanno Böck <hanno@schokokeks.org>
This code is published under a 0BSD license.
Nevertheless, in case you use a significant part of this code, we ask (but not require, see the license) that you keep the authors' names in place and return your changes to the public. We would be especially happy if you tell us what you're going to do with this code.
*/
require_once("certs.php");
require_once("inc/security.php");
require_role(ROLE_SYSTEMUSER);
$section = 'vhosts_certs';
if ($_GET['action'] == 'new') {
check_form_token('vhosts_certs_new');
if (! isset($_POST['cert'])) {
system_failure("Es wurde kein Zertifikat eingegeben");
}
$cert = $_POST['cert'];
$oldcert = null;
if (isset($_REQUEST['replace']) && is_numeric($_REQUEST['replace'])) {
$oldcert = cert_details($_REQUEST['replace']);
DEBUG('altes cert:');
DEBUG($oldcert);
}
$key = null;
if (! isset($_POST['key']) && isset($_REQUEST['csr'])) {
$csr = csr_details($_REQUEST['csr']);
$key = $csr['key'];
} elseif (isset($_POST['key']) and $_POST['key']) {
$key = $_POST['key'];
} elseif ($oldcert) {
$key = $oldcert['key'];
}
if (! $cert or ! $key) {
system_failure('Es muss ein Zertifikat und der dazu passende private Schlüssel eingetragen werden');
}
$result = validate_certificate($cert, $key);
switch ($result) {
case CERT_OK:
$certinfo = parse_cert_details($cert);
if ($oldcert) {
refresh_cert($oldcert['id'], $certinfo, $cert, $key);
 
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX