]>
git.proxmox.com Git - pve-firewall.git/blob - pvefw
b10895e22af32ef3deefe02ea69f829247220f41
10 use PVE
::RPCEnvironment
;
12 use PVE
::JSONSchema
qw(get_standard_option);
16 use base
qw(PVE::CLIHandler);
18 $ENV{'PATH'} = '/sbin:/bin:/usr/sbin:/usr/bin';
22 die "please run as root\n" if $> != 0;
24 PVE
::INotify
::inotify_init
();
26 my $rpcenv = PVE
::RPCEnvironment-
>init('cli');
28 $rpcenv->init_request();
29 $rpcenv->set_language($ENV{LANG
});
30 $rpcenv->set_user('root@pam');
33 __PACKAGE__-
>register_method ({
37 description
=> "Compile firewall rules.",
39 additionalProperties
=> 0,
42 returns
=> { type
=> 'null' },
47 PVE
::Firewall
::compile
();
52 __PACKAGE__-
>register_method ({
56 description
=> "Start firewall.",
58 additionalProperties
=> 0,
61 returns
=> { type
=> 'null' },
66 PVE
::Firewall
::compile_and_start
();
71 __PACKAGE__-
>register_method ({
75 description
=> "Restart firewall.",
77 additionalProperties
=> 0,
80 returns
=> { type
=> 'null' },
85 PVE
::Firewall
::compile_and_start
(1);
90 __PACKAGE__-
>register_method ({
94 description
=> "Stop firewall.",
96 additionalProperties
=> 0,
99 returns
=> { type
=> 'null' },
104 PVE
::Tools
::run_command
(['shorewall', 'stop']);
109 __PACKAGE__-
>register_method ({
113 description
=> "Clear will remove all rules installed by this script. The host is then unprotected.",
115 additionalProperties
=> 0,
118 returns
=> { type
=> 'null' },
123 PVE
::Tools
::run_command
(['shorewall', 'clear']);
128 my $nodename = PVE
::INotify
::nodename
();
131 compile
=> [ __PACKAGE__
, 'compile', []],
132 start
=> [ __PACKAGE__
, 'start', []],
133 restart
=> [ __PACKAGE__
, 'restart', []],
134 stop
=> [ __PACKAGE__
, 'stop', []],
135 clear
=> [ __PACKAGE__
, 'clear', []],
140 PVE
::CLIHandler
::handle_cmd
($cmddef, "pvefw", $cmd, \
@ARGV, undef, $0);