Skip to content

Commit

Permalink
System: Trust: Revocation - work in progress for opnsense#7248
Browse files Browse the repository at this point in the history
* fix self (not being $self)
* add serial and lifetime fields
  • Loading branch information
AdSchellevis committed Mar 12, 2024
1 parent d3f661a commit 4dccc49
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,12 @@ public function getAction($caref)
}
}
if ($found) {
$result = ['caref' => $caref, 'descr' => ''];
$result = ['caref' => $caref, 'descr' => '', 'serial' => '0', 'lifetime' => '9999'];
foreach ($config->crl as $node) {
if ((string)$node->caref == $caref) {
$result['descr'] = (string)$node->descr;
$result['serial'] = (string)$node->serial ?? '0';
$result['lifetime'] = (string)$node->lifetime ?? '9999';
}
}
$certs = [];
Expand Down Expand Up @@ -155,7 +157,7 @@ public function getAction($caref)
'selected' => $crlmethod == 'existing' ? '1' : '0'
],
];
for ($i = 0; $i < count($self::status_codes); $i++) {
for ($i = 0; $i < count(self::$status_codes); $i++) {
$code = (string)$i;
$result['revoked_reason_' . $code] = [];
foreach ($certs as $ref => $data) {
Expand Down Expand Up @@ -212,7 +214,7 @@ public function setAction($caref)
} else {
$revoked_refs = [];
if ((string)$node->crlmethod == 'internal') {
for ($i=0 ; $i <= count($self::status_codes); $i++) {
for ($i=0 ; $i <= count(self::$status_codes); $i++) {
$fieldname = 'revoked_reason_' . $i;
foreach (explode(',', $payload[$fieldname] ?? '') as $refid) {
if (!empty($refid)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@
<type>textbox</type>
<style>crlmethod crlmethod_existing</style>
</field>
<field>
<id>crl.serial</id>
<label>Serial</label>
<type>text</type>
</field>
<field>
<id>crl.lifetime</id>
<label>Lifetime (days)</label>
<type>text</type>
</field>
<field>
<type>header</type>
<label>Revocations per type</label>
Expand Down

0 comments on commit 4dccc49

Please sign in to comment.