]> git.proxmox.com Git - pve-firewall.git/blobdiff - pvefw
add support for security groups
[pve-firewall.git] / pvefw
diff --git a/pvefw b/pvefw
index 2d4d4503481824e6c1103d9c560771f04705386e..70a2beecd954f867174c45fe7758d4812b22d65b 100755 (executable)
--- a/pvefw
+++ b/pvefw
@@ -100,6 +100,51 @@ __PACKAGE__->register_method({
         return undef;
     }});
 
+__PACKAGE__->register_method({
+    name => 'enablegroup',
+    path => 'enablegroup',
+    method => 'POST',
+    parameters => {
+        additionalProperties => 0,
+        properties => {
+            securitygroup => {
+                type => 'string',
+            },
+        },
+    },
+    returns => { type => 'null' },
+    code => sub {
+        my ($param) = @_;
+
+       my $group = $param->{securitygroup};
+       PVE::Firewall::enable_group_rules($group);
+
+        return undef;
+    }});
+
+__PACKAGE__->register_method({
+    name => 'disablegroup',
+    path => 'disablegroup',
+    method => 'POST',
+    parameters => {
+        additionalProperties => 0,
+        properties => {
+            securitygroup => {
+                type => 'string',
+            },
+
+        },
+    },
+    returns => { type => 'null' },
+    code => sub {
+        my ($param) = @_;
+
+       my $group = $param->{securitygroup};
+       PVE::Firewall::disable_group_rules($group);
+
+        return undef;
+    }});
+
 __PACKAGE__->register_method({
     name => 'enablehostfw',
     path => 'enablehostfw',
@@ -243,6 +288,8 @@ my $cmddef = {
     disablevmfw => [ __PACKAGE__, 'disablevmfw', []],
     enablehostfw => [ __PACKAGE__, 'enablehostfw', []],
     disablehostfw => [ __PACKAGE__, 'disablehostfw', []],
+    enablegroup => [ __PACKAGE__, 'enablegroup', []],
+    disablegroup => [ __PACKAGE__, 'disablegroup', []],
 };
 
 my $cmd = shift;