X-Git-Url: https://git.proxmox.com/?p=pve-firewall.git;a=blobdiff_plain;f=src%2FPVE%2FFirewall.pm;h=4375f9c14fd857df4a5c66e02442c4b9fb881dbe;hp=296ec8c55823d686f516dc1b466262f03dd1f63f;hb=9567aa9160afb99986c37be328cf1a886b005649;hpb=30f1b1001966ca16048dfe294dd5f91d93aa6eba diff --git a/src/PVE/Firewall.pm b/src/PVE/Firewall.pm index 296ec8c..4375f9c 100644 --- a/src/PVE/Firewall.pm +++ b/src/PVE/Firewall.pm @@ -7,7 +7,7 @@ use Data::Dumper; use Digest::SHA; use PVE::INotify; use PVE::Exception qw(raise raise_param_exc); -use PVE::JSONSchema qw(get_standard_option); +use PVE::JSONSchema qw(register_standard_option get_standard_option); use PVE::Cluster; use PVE::ProcFSTools; use PVE::Tools qw($IPV4RE); @@ -48,6 +48,21 @@ sub pve_verify_ipv4_or_cidr { die "value does not look like a valid IP address or CIDR network\n"; } +PVE::JSONSchema::register_standard_option('ipset-name', { + description => "IP set name.", + type => 'string', + pattern => '[A-Za-z][A-Za-z0-9\-\_]+', + minLength => 2, + maxLength => 20, +}); + +PVE::JSONSchema::register_standard_option('pve-security-group-name', { + description => "Security Group name.", + type => 'string', + pattern => '[A-Za-z][A-Za-z0-9\-\_]+', + minLength => 2, + maxLength => 20, +}); my $feature_ipset_nomatch = 0; eval { @@ -687,7 +702,7 @@ sub get_etc_protocols { sub parse_address_list { my ($str) = @_; - return if $str !~ m/^(\+)(\S+)$/; # ipset ref + return if $str =~ m/^(\+)(\S+)$/; # ipset ref my $count = 0; my $iprange = 0; @@ -1977,6 +1992,7 @@ sub parse_cluster_fw_rules { if ($line =~ m/^\[group\s+(\S+)\]\s*$/i) { $section = 'groups'; $group = lc($1); + $res->{$section}->{$group} = []; next; } @@ -1988,6 +2004,7 @@ sub parse_cluster_fw_rules { if ($line =~ m/^\[ipset\s+(\S+)\]\s*$/i) { $section = 'ipset'; $group = lc($1); + $res->{$section}->{$group} = []; next; }