Skip to content

Commit 48255eb

Browse files
authored
Update OPNsense plugin: add ACL, fix service (#259)
1 parent bf5deb2 commit 48255eb

3 files changed

Lines changed: 23 additions & 10 deletions

File tree

opnsense/src/etc/inc/plugins.inc.d/defguardgateway.inc

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
<?php
22
function defguardgateway_services()
33
{
4+
global $config;
5+
46
$services = [];
57

68
$pidfile = (string) (new OPNsense\DefguardGateway\DefguardGateway())->general->PidFile;
79

8-
$services[] = [
9-
"description" => "Defguard Gateway",
10-
"configd" => [
11-
"start" => ["defguard_gateway start"],
12-
"restart" => ["defguard_gateway restart"],
13-
"stop" => ["defguard_gateway stop"],
14-
],
15-
"pidfile" => empty($pidfile) ? "/var/run/defguard_gateway.pid" : $pidfile,
16-
"name" => "defguard_gateway",
17-
];
10+
if (isset($config['OPNsense']['defguardgateway']['general']['enabled']) && $config['OPNsense']['defguardgateway']['general']['enabled'] == 1) {
11+
$services[] = [
12+
"description" => "Defguard Gateway",
13+
"configd" => [
14+
"start" => ["defguardgateway start"],
15+
"restart" => ["defguardgateway restart"],
16+
"stop" => ["defguardgateway stop"],
17+
],
18+
"pidfile" => empty($pidfile) ? "/var/run/defguard_gateway.pid" : $pidfile,
19+
"name" => "defguardgateway",
20+
];
21+
}
1822

1923
return $services;
2024
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<acl>
2+
<page-services-defguardgateway>
3+
<name>Services: Defguard Gateway</name>
4+
<patterns>
5+
<pattern>ui/defguardgateway/*</pattern>
6+
<pattern>api/defguardgateway/*</pattern>
7+
</patterns>
8+
</page-services-defguardgateway>
9+
</acl>

opnsense/src/opnsense/service/conf/actions.d/actions_defguard_gateway.conf renamed to opnsense/src/opnsense/service/conf/actions.d/actions_defguardgateway.conf

File renamed without changes.

0 commit comments

Comments
 (0)