Commit 8b4ed4aa authored by Ad Schellevis's avatar Ad Schellevis Committed by Franco Fichtner

(captiveportal) cleanse cert output before writing

(cherry picked from commit 08653da5)
parent 108b75b1
......@@ -48,8 +48,10 @@ if (isset($configObj->OPNsense->captiveportal->zones)) {
foreach ($configObj->cert as $cert) {
if ($cert_refid == (string)$cert->refid) {
// generate cert pem file
$pem_content = str_replace("\n\n", "\n", str_replace("\r", "", base64_decode((string)$cert->crt)));
$pem_content .= str_replace("\n\n", "\n", str_replace("\r", "", base64_decode((string)$cert->prv)));
$pem_content = trim(str_replace("\n\n", "\n", str_replace("\r", "", base64_decode((string)$cert->crt))));
$pem_content .= "\n";
$pem_content .= trim(str_replace("\n\n", "\n", str_replace("\r", "", base64_decode((string)$cert->prv))));
$pem_content .= "\n";
$output_pem_filename = "/var/etc/cert-cp-zone" . $zone_id . ".pem" ;
file_put_contents($output_pem_filename, $pem_content);
chmod($output_pem_filename, 0600);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment