mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
MDL-17419 misconfigured openssl extension blocks installation - openssl.cnf missing??
This commit is contained in:
parent
2280e147c5
commit
eb7f89bc15
2 changed files with 11 additions and 1 deletions
|
@ -152,8 +152,14 @@ class mnet_environment {
|
||||||
function replace_keys() {
|
function replace_keys() {
|
||||||
global $DB, $CFG;
|
global $DB, $CFG;
|
||||||
|
|
||||||
|
$keypair = mnet_generate_keypair();
|
||||||
|
if (empty($keypair)) {
|
||||||
|
error_log('Can not generate keypair, sorry');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$this->keypair = array();
|
$this->keypair = array();
|
||||||
$this->keypair = mnet_generate_keypair();
|
$this->keypair = $keypair;
|
||||||
$this->public_key = $this->keypair['certificate'];
|
$this->public_key = $this->keypair['certificate'];
|
||||||
$details = openssl_x509_parse($this->public_key);
|
$details = openssl_x509_parse($this->public_key);
|
||||||
$this->public_key_expires = $details['validTo_time_t'];
|
$this->public_key_expires = $details['validTo_time_t'];
|
||||||
|
|
|
@ -391,6 +391,10 @@ function mnet_generate_keypair($dn = null, $days=28) {
|
||||||
$dn["commonName"] = preg_replace(':/$:', '', $dn["commonName"]);
|
$dn["commonName"] = preg_replace(':/$:', '', $dn["commonName"]);
|
||||||
|
|
||||||
$new_key = openssl_pkey_new();
|
$new_key = openssl_pkey_new();
|
||||||
|
if ($new_key === false) {
|
||||||
|
// can not generate keys - missing openssl.cnf??
|
||||||
|
return null;
|
||||||
|
}
|
||||||
$csr_rsc = openssl_csr_new($dn, $new_key, array('private_key_bits',2048));
|
$csr_rsc = openssl_csr_new($dn, $new_key, array('private_key_bits',2048));
|
||||||
$selfSignedCert = openssl_csr_sign($csr_rsc, null, $new_key, $days);
|
$selfSignedCert = openssl_csr_sign($csr_rsc, null, $new_key, $days);
|
||||||
unset($csr_rsc); // Free up the resource
|
unset($csr_rsc); // Free up the resource
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue