]> git.proxmox.com Git - pve-firewall.git/commitdiff
remove shorewall specific commands
authorDietmar Maurer <dietmar@proxmox.com>
Thu, 13 Feb 2014 09:55:48 +0000 (10:55 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 13 Feb 2014 10:18:48 +0000 (11:18 +0100)
PVE/Firewall.pm
pvefw

index ff5cadfdd6ae1fd2098e30800dc72d184e02fb3a..8e5cfb1f996ccc0d552173c87cce02bcec9e0f76 100644 (file)
@@ -15,15 +15,19 @@ use Data::Dumper;
 my $macros;
 my @ruleset = ();
 
-sub get_shorewall_macros {
+# todo: implement some kind of MACROS, like shorewall /usr/share/shorewall/macro.*
+sub get_firewall_macros {
 
     return $macros if $macros;
 
-    foreach my $path (</usr/share/shorewall/macro.*>) {
-       if ($path =~ m|/macro\.(\S+)$|) {
-           $macros->{$1} = 1;
-       }
-    }
+    #foreach my $path (</usr/share/shorewall/macro.*>) {
+    #  if ($path =~ m|/macro\.(\S+)$|) {
+    #    $macros->{$1} = 1;
+    #  }
+    #}
+
+    $macros = {}; # fixme: implemet me
+
     return $macros;
 }
 
@@ -859,7 +863,7 @@ sub parse_fw_rules {
 
     my $res = { in => [], out => [] };
 
-    my $macros = get_shorewall_macros();
+    my $macros = get_firewall_macros();
     my $protocols = get_etc_protocols();
     
     while (defined(my $line = <$fh>)) {
@@ -992,18 +996,12 @@ sub read_vm_firewall_rules {
 }
 
 sub compile {
-
     my $vmdata = read_local_vm_config();
     my $rules = read_vm_firewall_rules($vmdata);
 
     # print Dumper($vmdata);
 
-    my $swdir = '/etc/shorewall';
-    mkdir $swdir;
-
-    &$compile_shorewall($swdir, $vmdata, $rules);
-
-    PVE::Tools::run_command(['shorewall', 'compile']);
+    die "implement me";
 }
 
 sub compile_and_start {
@@ -1011,8 +1009,7 @@ sub compile_and_start {
 
     compile();
 
-    PVE::Tools::run_command(['shorewall', $restart ? 'restart' : 'start']);
+     die "implement me";  
 }
 
-
 1;
diff --git a/pvefw b/pvefw
index 70a2beecd954f867174c45fe7758d4812b22d65b..f7273943add07401682da8daa83feff5f294eed0 100755 (executable)
--- a/pvefw
+++ b/pvefw
@@ -204,7 +204,7 @@ __PACKAGE__->register_method ({
     name => 'start',
     path => 'start',
     method => 'POST',
-    description => "Start firewall.",
+    description => "Start (or restart if already active) firewall.",
     parameters => {
        additionalProperties => 0,
        properties => {},
@@ -219,49 +219,11 @@ __PACKAGE__->register_method ({
        return undef;
     }});
 
-__PACKAGE__->register_method ({
-    name => 'restart',
-    path => 'restart',
-    method => 'POST',
-    description => "Restart firewall.",
-    parameters => {
-       additionalProperties => 0,
-       properties => {},
-    },
-    returns => { type => 'null' },
-
-    code => sub {
-       my ($param) = @_;
-
-       PVE::Firewall::compile_and_start(1);
-
-       return undef;
-    }});
-
 __PACKAGE__->register_method ({
     name => 'stop',
     path => 'stop',
     method => 'POST',
-    description => "Stop firewall.",
-    parameters => {
-       additionalProperties => 0,
-       properties => {},
-    },
-    returns => { type => 'null' },
-
-    code => sub {
-       my ($param) = @_;
-
-       PVE::Tools::run_command(['shorewall', 'stop']);
-
-       return undef;
-    }});
-
-__PACKAGE__->register_method ({
-    name => 'clear',
-    path => 'clear',
-    method => 'POST',
-    description => "Clear will remove all rules installed by this script. The host is then unprotected.",
+    description => "Stop firewall. This will remove all rules installed by this script. The host is then unprotected.",
     parameters => {
        additionalProperties => 0,
        properties => {},
@@ -271,7 +233,7 @@ __PACKAGE__->register_method ({
     code => sub {
        my ($param) = @_;
 
-       PVE::Tools::run_command(['shorewall', 'clear']);
+       die "implement me";
 
        return undef;
     }});
@@ -283,7 +245,6 @@ my $cmddef = {
     start => [ __PACKAGE__, 'start', []],
     restart => [ __PACKAGE__, 'restart', []],
     stop => [ __PACKAGE__, 'stop', []],
-    clear => [ __PACKAGE__, 'clear', []],
     enablevmfw => [ __PACKAGE__, 'enablevmfw', []],
     disablevmfw => [ __PACKAGE__, 'disablevmfw', []],
     enablehostfw => [ __PACKAGE__, 'enablehostfw', []],