From 59b4defd5b8de19f886d57ef55d0a3a05f048ec9 Mon Sep 17 00:00:00 2001 From: Ad Schellevis Date: Tue, 20 Aug 2024 18:22:21 +0200 Subject: [PATCH] System: Trust: Revocation - add missing delAction() ref https://forum.opnsense.org/index.php?topic=42340.msg209048#msg209048 --- .../OPNsense/Trust/Api/CrlController.php | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/opnsense/mvc/app/controllers/OPNsense/Trust/Api/CrlController.php b/src/opnsense/mvc/app/controllers/OPNsense/Trust/Api/CrlController.php index 8dcc6b596..d8cebb5fc 100644 --- a/src/opnsense/mvc/app/controllers/OPNsense/Trust/Api/CrlController.php +++ b/src/opnsense/mvc/app/controllers/OPNsense/Trust/Api/CrlController.php @@ -373,6 +373,35 @@ class CrlController extends ApiControllerBase return ['status' => 'failed']; } + /** + * drop CRL by certificate reference + */ + public function delAction($caref) + { + if ($this->request->isPost() && !empty($caref)) { + Config::getInstance()->lock(); + $config = Config::getInstance()->object(); + $to_delete = []; + foreach ($config->crl as $node) { + if ((string)$node->caref == $caref) { + $to_delete[] = $node; + } + } + foreach ($to_delete as $cert) { + $dom = dom_import_simplexml($cert); + $dom->parentNode->removeChild($dom); + } + if (count($to_delete) > 0) { + Config::getInstance()->save(); + return ['status' => 'deleted']; + } else { + Config::getInstance()->unlock(); + return ['status' => 'not found']; + } + } + return ['status' => 'failed']; + } + public function rawDumpAction($caref) {