mirror of
https://github.com/netbirdio/plugins.git
synced 2026-05-22 18:44:07 -07:00
security/acme-client: expose import feature to GUI
This commit is contained in:
@@ -8,6 +8,11 @@ WWW: https://github.com/acmesh-official/acme.sh
|
||||
Plugin Changelog
|
||||
================
|
||||
|
||||
3.2
|
||||
|
||||
Added:
|
||||
* add button to (re-) import a certificate into the trust storage
|
||||
|
||||
3.1
|
||||
|
||||
Changed:
|
||||
|
||||
+19
@@ -172,4 +172,23 @@ class CertificatesController extends ApiMutableModelControllerBase
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* (re-) import the certificate by uuid
|
||||
* @param $uuid item unique id
|
||||
* @return array status
|
||||
*/
|
||||
public function importAction($uuid)
|
||||
{
|
||||
$result = array("result" => "failed");
|
||||
$mdlAcme = new AcmeClient();
|
||||
if ($uuid != null) {
|
||||
$node = $mdlAcme->getNodeByReference('certificates.certificate.' . $uuid);
|
||||
if ($node != null) {
|
||||
$backend = new Backend();
|
||||
$response = $backend->configdRun("acmeclient import ${uuid}");
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
revoke:'/api/acmeclient/certificates/revoke/',
|
||||
removekey:'/api/acmeclient/certificates/removekey/',
|
||||
automation:'/api/acmeclient/certificates/automation/',
|
||||
import:'/api/acmeclient/certificates/import/',
|
||||
};
|
||||
|
||||
var gridopt = {
|
||||
@@ -62,6 +63,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
return "<button type=\"button\" title=\"{{ lang._('Edit certificate') }}\" class=\"btn btn-xs btn-default command-edit bootgrid-tooltip\" data-row-id=\"" + row.uuid + "\"><span class=\"fa fa-pencil\"></span></button> " +
|
||||
"<button type=\"button\" title=\"{{ lang._('Copy certificate') }}\" class=\"btn btn-xs btn-default command-copy bootgrid-tooltip\" data-row-id=\"" + row.uuid + "\"><span class=\"fa fa-clone\"></span></button>" +
|
||||
"<button type=\"button\" title=\"{{ lang._('Issue or renew certificate') }}\" class=\"btn btn-xs btn-default command-sign bootgrid-tooltip\" data-row-id=\"" + row.uuid + "\"><span class=\"fa fa-repeat\"></span></button>" +
|
||||
"<button type=\"button\" title=\"{{ lang._('(Re-) Import certificate') }}\" class=\"btn btn-xs btn-default command-import bootgrid-tooltip\" data-row-id=\"" + row.uuid + "\"><span class=\"fa fa-certificate\"></span></button>" +
|
||||
"<button type=\"button\" title=\"{{ lang._('Run automations') }}\" class=\"btn btn-xs btn-default command-automation bootgrid-tooltip\" data-row-id=\"" + row.uuid + "\"><span class=\"fa fa-paper-plane\"></span></button>" +
|
||||
"<button type=\"button\" title=\"{{ lang._('Revoke certificate') }}\" class=\"btn btn-xs btn-default command-revoke bootgrid-tooltip\" data-row-id=\"" + row.uuid + "\"><span class=\"fa fa-power-off\"></span></button>" +
|
||||
"<button type=\"button\" title=\"{{ lang._('Reset certificate') }}\" class=\"btn btn-xs btn-default command-removekey bootgrid-tooltip\" data-row-id=\"" + row.uuid + "\"><span class=\"fa fa-history\"></span></button>" +
|
||||
@@ -397,6 +399,25 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
}
|
||||
});
|
||||
|
||||
// import certificate into trust storage
|
||||
grid_certificates.find(".command-import").on("click", function(e)
|
||||
{
|
||||
if (gridParams['import'] != undefined) {
|
||||
var uuid=$(this).data("row-id");
|
||||
stdDialogConfirm('{{ lang._('Confirmation Required') }}',
|
||||
'{{ lang._('(Re-) import the selected certificate into the trust storage?') }}',
|
||||
'{{ lang._('Yes') }}', '{{ lang._('Cancel') }}', function() {
|
||||
ajaxCall(url=gridParams['import'] + uuid,
|
||||
sendData={},callback=function(data,status){
|
||||
// reload grid after sign
|
||||
$("#"+gridId).bootgrid("reload");
|
||||
});
|
||||
});
|
||||
} else {
|
||||
console.log("[grid] action import missing")
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// Hide options that are irrelevant in this context.
|
||||
|
||||
@@ -77,6 +77,12 @@ parameters:%s
|
||||
type:script
|
||||
message:running automations for a certificate
|
||||
|
||||
[import]
|
||||
command:/usr/local/opnsense/scripts/OPNsense/AcmeClient/setup.sh; /usr/sbin/daemon -f /usr/local/opnsense/scripts/OPNsense/AcmeClient/lecert.php --mode import --cert
|
||||
parameters:%s
|
||||
type:script
|
||||
message:running import for a certificate
|
||||
|
||||
[cron-auto-renew]
|
||||
command:/usr/local/opnsense/scripts/OPNsense/AcmeClient/setup.sh; /usr/sbin/daemon -f /usr/local/opnsense/scripts/OPNsense/AcmeClient/lecert.php --mode issue --all --cron
|
||||
parameters:
|
||||
|
||||
Reference in New Issue
Block a user