BlockerHelper/backends/netscaler.pm

filter: Statementstmt 47.9% 152 / 317 Branchbran 45.6% 53 / 116 Conditioncond 66.6% 28 / 42 MC/DCmcdc 16.6% 4 / 24 Subroutinesub 78.2% 18 / 23 Podpod 100% 13 / 13 totaltotal 50.0% 268 / 535 CC 76 SCAR 37.9
CC
76
Cov
49%
new
95.2
_request
42.0
unban
41.2
CRAP 44.1
« BlockerHelper/backends/cisco_fmc.pm ↑ Summary BlockerHelper/backends/routeros_api.pm »
1 package Net::Firewall::BlockerHelper::backends::netscaler;
2  
3 1 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use base 'Error::Helper';
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Regexp::IPv4 qw($IPv4_re);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Regexp::IPv6 qw($IPv6_re);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 =head1 NAME
11  
12 Net::Firewall::BlockerHelper::backends::netscaler - Citrix NetScaler/ADC backend for Net::Firewall::BlockerHelper.
13  
14 =head1 VERSION
15  
16 Version 0.1.0
17  
18 =cut
19  
20 1 our $VERSION = '0.1.0';
21  
22 =head1 SYNOPSIS
23  
24 use Net::Firewall::BlockerHelper;
25  
26 my $fw_helper = Net::Firewall::BlockerHelper->new(
27 backend => 'netscaler',
28 name => 'ssh',
29 options => {
30 host => 'netscaler.foo.bar',
31 user => 'nsroot',
32 pass => $password,
33 dataset => 'fail2ban',
34 },
35 );
36  
37 $fw_helper->init_backend;
38 $fw_helper->ban(ban => '1.2.3.4');
39 $fw_helper->unban(ban => '1.2.3.4');
40  
41 =head1 DESCRIPTION
42  
43 Blocks IPs remotely by binding them into a policy dataset on a Citrix
44 NetScaler/ADC via the NITRO REST API, equivalent to the fail2ban netscaler
45 action, but using L<LWP::UserAgent> rather than curl. The dataset can then
46 be used to block the IPs via responder policies at a vserver or global
47 level.
48  
49 The dataset must already exist on the NetScaler, as must a responder or
50 similar policy referencing it, as binding IPs into the dataset does nothing
51 by itself; init and check only verify the API is reachable and auth works.
52  
53 Blocking is per IP; ports and protocols are not supported and specifying
54 them is an error.
55  
56 L<LWP::UserAgent> is only loaded at run time, so it is only required if
57 this backend is actually used. For https, L<LWP::Protocol::https> must be
58 present as well.
59  
60 =head1 METHODS
61  
62 =head2 new
63  
64 Initiates the the object.
65  
66 - options :: Backend specific options. See below.
67 - Default :: {}
68  
69 - prefix :: Prefix to use. Must match the regex /^[a-zA-Z0-9]+$/
70 - default :: kur
71  
72 - name :: Name of this specific instance. This must be specified.
73 - default :: undef
74  
75 Ports and protocols are not supported by this backend and specifying either
76 is an error.
77  
78 The options hash accepts the following. host must be specified, as must
79 either auth or both user and pass.
80  
81 - host :: Hostname or IP of the NetScaler appliance.
82 - Default :: undef
83  
84 - user :: Username for basic auth.
85 - Default :: undef
86  
87 - pass :: Password for basic auth.
88 - Default :: undef
89  
90 - auth :: Pre-base64ed basic auth value to use instead of user/pass,
91 for parity with the fail2ban ns_auth option.
92 - Default :: undef
93  
94 - dataset :: The policy dataset holding the blocked IPs.
95 - Default :: <prefix>_<name>
96  
97 - scheme :: http or https.
98 - Default :: https
99  
100 - ssl_verify :: Verify the TLS certificate. The fail2ban action uses
101 curl -k, so this defaults to off; set to 1 if the appliance has
102 a valid certificate.
103 - Default :: 0
104  
105 - timeout :: HTTP timeout in seconds.
106 - Default :: 30
107  
108 All errors are considered fatal, meaning if new fails it will die.
109  
110 =cut
111  
112 sub new {
113 5 ▶ my ( $blank, %opts ) = @_;
Subroutine new: called CC=33 SCAR=45.6
Pod documented
114  
115 5 my $self = {
116 perror => undef,
117 error => undef,
118 errorLine => undef,
119 errorFilename => undef,
120 errorString => "",
121 errorExtra => {
122 all_errors_fatal => 1,
123 # all_fatal is what Error::Helper 2.1.0 actually checks; all_errors_fatal
124 # is kept for the name documented in its POD
125 all_fatal => 1,
126 flags => {
127 1 => 'notInited',
128 6 => 'invalidPrefixSpecified',
129 7 => 'invalidName',
130 8 => 'optionsNotHash',
131 9 => 'noBanItem',
132 10 => 'banItemNotIP',
133 12 => 'backendInitError',
134 13 => 'banFailed',
135 14 => 'unbanFailed',
136 15 => 'listFailed',
137 16 => 'reInitFailed',
138 17 => 'teardownFailed',
139 18 => 'alreadyInited',
140 23 => 'initFailed',
141 24 => 'checkFailed',
142 25 => 'flushFailed',
143 26 => 'portsNotSupported',
144 27 => 'protocolsNotSupported',
145 28 => 'optionInvalid',
146 29 => 'banCidrFailed',
147 30 => 'unbanCidrFailed',
148 31 => 'cidrItemNotCidr',
149 32 => 'cidrNotSupported',
150 33 => 'listCidrFailed',
151 },
152 fatal_flags => {},
153 perror_not_fatal => 0,
154 },
155 options => {},
156 ports => [],
157 protocols => [],
158 testing => undef,
159 test_data => undef,
160 prefix => 'kur',
161 frontend_obj => undef,
162 inited => 0,
163 banned => {},
164 cidr_supported => 0,
165 ua => undef,
166 };
167 5 bless $self;
168  
169 # blocking is per IP; the dataset has no concept of ports or protocols
170 5 ▶ if ( defined( $opts{ports} ) && ref( $opts{ports} ) eq 'ARRAY' && defined( $opts{ports}[0] ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $opts{"ports"} and ref $opts{"ports"} eq "ARRAY" and defined $opts{"ports"}[0]) 1 4 5
Condition83%5/6
defined $opts{"ports"} and ref $opts{"ports"} eq "ARRAY" and defined $opts{"ports"}[0]
!ll&&!rl&&r
221
defined $opts{"ports"} and ref $opts{"ports"} eq "ARRAY"
!ll&&!rl&&r
203
MC/DC66%2/3
defined $opts{"ports"} and ref $opts{"ports"} eq "ARRAY" and defined $opts{"ports"}[0]
defined $opts{"ports"} ref $opts{"ports"} eq "ARRAY" defined $opts{"ports"}[0]
Truth table75%3/4
A and B and C
A= defined $opts{"ports"}B= ref $opts{"ports"} eq "ARRAY"C= defined $opts{"ports"}[0]
ABCresult
0XX0
10X0
1100
1111
171 1 $self->{perror} = 1;
172 1 $self->{error} = 26;
173 1 $self->{errorString} = 'the netscaler backend blocks whole IPs and does not support ports';
174 1 $self->warn;
175 }
176 4 ▶ if ( defined( $opts{protocols} ) && ref( $opts{protocols} ) eq 'ARRAY' && defined( $opts{protocols}[0] ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $opts{"protocols"} and ref $opts{"protocols"} eq "ARRAY" and defined $opts{"protocols"}[0]) 0 4 4
Condition66%4/6
defined $opts{"protocols"} and ref $opts{"protocols"} eq "ARRAY" and defined $opts{"protocols"}[0]
!ll&&!rl&&r
220
defined $opts{"protocols"} and ref $opts{"protocols"} eq "ARRAY"
!ll&&!rl&&r
202
MC/DC0%0/3
defined $opts{"protocols"} and ref $opts{"protocols"} eq "ARRAY" and defined $opts{"protocols"}[0]
defined $opts{"protocols"} ref $opts{"protocols"} eq "ARRAY" defined $opts{"protocols"}[0]
Truth table50%2/4
A and B and C
A= defined $opts{"protocols"}B= ref $opts{"protocols"} eq "ARRAY"C= defined $opts{"protocols"}[0]
ABCresult
0XX0
10X0
1100
1111
177 0 $self->{perror} = 1;
178 0 $self->{error} = 27;
179 0 $self->{errorString} = 'the netscaler backend blocks whole IPs and does not support protocols';
180 0 $self->warn;
181 }
182  
183 # make sure prefix is sane if defiend
184 4 ▶ if ( defined( $opts{prefix} ) && $opts{prefix} !~ /^[a-zA-Z0-9]+$/ ) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $opts{'prefix'} and not $opts{'prefix'} =~ /^[a-zA-Z0-9]+$/) { } 0 4 4
elsif (defined $opts{'prefix'}) { } 2 2 4
Condition66%2/3
defined $opts{"prefix"} and not $opts{"prefix"} =~ /^[a-zA-Z0-9]+$/
!ll&&!rl&&r
220
MC/DC0%0/2
defined $opts{"prefix"} and not $opts{"prefix"} =~ /^[a-zA-Z0-9]+$/
defined $opts{"prefix"} not $opts{"prefix"} =~ /^[a-zA-Z0-9]+$/
Truth table66%2/3
A and not(B)
A= defined $opts{"prefix"}B= not $opts{"prefix"} =~ /^[a-zA-Z0-9]+$/
ABresult
0X0
100
111
185 0 $self->{perror} = 1;
186 0 $self->{error} = 6;
187 $self->{errorString}
188 0 = '"' . $opts{prefix} . '" is not a valid prefix as it does not match the regex /^[a-zA-Z0-9]+$/';
189 0 $self->warn;
190 } elsif ( defined( $opts{prefix} ) ) {
191 2 $self->{prefix} = $opts{prefix};
192 }
193  
194 # make sure we have a name and that it is valid
195 4 ▶ if ( !defined( $opts{name} ) ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not defined $opts{'name'}) { } 0 4 4
elsif (not $opts{'name'} =~ /^[a-zA-Z0-9\-]+$/) { } 0 4 4
196 0 $self->{perror} = 1;
197 0 $self->{error} = 7;
198 0 $self->{errorString} = 'name is undef';
199 0 $self->warn;
200 } elsif ( $opts{name} !~ /^[a-zA-Z0-9\-]+$/ ) {
201 0 $self->{perror} = 1;
202 0 $self->{error} = 7;
203 0 $self->{errorString} = 'name set to "' . $opts{name} . '" which does not match the regexp /^[a-zA-Z0-9\-]+$/';
204 0 $self->warn;
205 }
206 4 $self->{name} = $opts{name};
207  
208 # used internally for testing
209 4 ▶ if ( defined( $opts{testing} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $opts{"testing"}) 2 2 4
210 2 $self->{testing} = $opts{testing};
211 }
212 4 ▶ if ( defined( $opts{frontend_obj} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $opts{"frontend_obj"}) 2 2 4
213 2 $self->{frontend_obj} = $opts{frontend_obj};
214 }
215  
216 4 ▶ if ( defined( $opts{options} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $opts{"options"}) 4 0 4
217 4 ▶ if ( ref( $opts{options} ) ne 'HASH' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $opts{"options"} ne "HASH") 0 4 4
218 0 $self->{perror} = 1;
219 0 $self->{error} = 8;
220 0 $self->{errorString} = 'ref for options is "' . ref( $opts{options} ) . '" and not HASH';
221 0 $self->warn;
222 }
223 4 $self->{options} = $opts{options};
224 }
225  
226 4 ▶ if ( !defined( $self->{options}{host} ) || $self->{options}{host} !~ /^[a-zA-Z0-9.\-\[\]:]+$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"options"}{"host"} and $self->{"options"}{"host"} =~ /^[a-zA-Z0-9.\-\[\]:]+$/) 1 3 4
Condition66%2/3
defined $self->{"options"}{"host"} and $self->{"options"}{"host"} =~ /^[a-zA-Z0-9.\-\[\]:]+$/
!ll&&!rl&&r
103
MC/DC50%1/2
defined $self->{"options"}{"host"} and $self->{"options"}{"host"} =~ /^[a-zA-Z0-9.\-\[\]:]+$/
defined $self->{"options"}{"host"} $self->{"options"}{"host"} =~ /^[a-zA-Z0-9.\-\[\]:]+$/
Truth table66%2/3
A and B
A= defined $self->{"options"}{"host"}B= $self->{"options"}{"host"} =~ /^[a-zA-Z0-9.\-\[\]:]+$/
ABresult
0X0
100
111
227 1 $self->{perror} = 1;
228 1 $self->{error} = 28;
229 $self->{errorString}
230 = 'the option host is '
231 1 ▶ . ( defined( $self->{options}{host} ) ? '"' . $self->{options}{host} . '" and not a valid host' : 'undef' );
Branch: 1 branch
BranchTrueFalseTotal
defined $self->{'options'}{'host'} ? : 0 1 1
232 1 $self->warn;
233 }
234  
235 3 ▶ if ( !defined( $self->{options}{auth} )
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"options"}{"auth"} or defined $self->{"options"}{"user"} and defined $self->{"options"}{"pass"}) 1 2 3
Condition83%5/6
defined $self->{"options"}{"auth"} or defined $self->{"options"}{"user"} and defined $self->{"options"}{"pass"}
l!l&&r!l&&!r
111
defined $self->{"options"}{"user"} and defined $self->{"options"}{"pass"}
!ll&&!rl&&r
101
MC/DC0%0/3
defined $self->{"options"}{"auth"} or defined $self->{"options"}{"user"} and defined $self->{"options"}{"pass"}
defined $self->{"options"}{"auth"} defined $self->{"options"}{"user"} defined $self->{"options"}{"pass"}
Truth table50%2/4
A or B and C
A= defined $self->{"options"}{"auth"}B= defined $self->{"options"}{"user"}C= defined $self->{"options"}{"pass"}
ABCresult
1XX1
0111
00X0
0100
236 && ( !defined( $self->{options}{user} ) || !defined( $self->{options}{pass} ) ) )
237 {
238 1 $self->{perror} = 1;
239 1 $self->{error} = 28;
240 $self->{errorString}
241 1 = 'either the option auth, or both the options user and pass, must be specified for auth';
242 1 $self->warn;
243 }
244  
245 2 ▶ if ( !defined( $self->{options}{dataset} ) && defined( $self->{name} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $self->{"options"}{"dataset"} and defined $self->{"name"}) 1 1 2
Condition66%2/3
not defined $self->{"options"}{"dataset"} and defined $self->{"name"}
!ll&&!rl&&r
101
MC/DC50%1/2
not defined $self->{"options"}{"dataset"} and defined $self->{"name"}
not defined $self->{"options"}{"dataset"} defined $self->{"name"}
Truth table66%2/3
not(A) and B
A= not defined $self->{"options"}{"dataset"}B= defined $self->{"name"}
ABresult
0X0
100
111
246 1 $self->{options}{dataset} = $self->{prefix} . '_' . $self->{name};
247 }
248 2 ▶ if ( defined( $self->{options}{dataset} ) && $self->{options}{dataset} !~ /^[a-zA-Z0-9_\-]+$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"options"}{"dataset"} and not $self->{"options"}{"dataset"} =~ /^[a-zA-Z0-9_\-]+$/) 0 2 2
Condition33%1/3
defined $self->{"options"}{"dataset"} and not $self->{"options"}{"dataset"} =~ /^[a-zA-Z0-9_\-]+$/
!ll&&!rl&&r
020
MC/DC0%0/2
defined $self->{"options"}{"dataset"} and not $self->{"options"}{"dataset"} =~ /^[a-zA-Z0-9_\-]+$/
defined $self->{"options"}{"dataset"} not $self->{"options"}{"dataset"} =~ /^[a-zA-Z0-9_\-]+$/
Truth table33%1/3
A and not(B)
A= defined $self->{"options"}{"dataset"}B= not $self->{"options"}{"dataset"} =~ /^[a-zA-Z0-9_\-]+$/
ABresult
0X0
100
111
249 0 $self->{perror} = 1;
250 0 $self->{error} = 28;
251 $self->{errorString}
252 0 = 'the option dataset, "' . $self->{options}{dataset} . '", does not match /^[a-zA-Z0-9_\-]+$/';
253 0 $self->warn;
254 }
255  
256 2 ▶ if ( defined( $self->{options}{scheme} )
Branch: 2 branches
BranchTrueFalseTotal
if (defined $self->{'options'}{'scheme'} and $self->{'options'}{'scheme'} ne 'http' and $self->{'options'}{'scheme'} ne 'https') { } 0 2 2
elsif (not defined $self->{'options'}{'scheme'}) { } 1 1 2
Condition50%3/6
defined $self->{"options"}{"scheme"} and $self->{"options"}{"scheme"} ne "http" and $self->{"options"}{"scheme"} ne "https"
!ll&&!rl&&r
200
defined $self->{"options"}{"scheme"} and $self->{"options"}{"scheme"} ne "http"
!ll&&!rl&&r
110
MC/DC0%0/3
defined $self->{"options"}{"scheme"} and $self->{"options"}{"scheme"} ne "http" and $self->{"options"}{"scheme"} ne "https"
defined $self->{"options"}{"scheme"} $self->{"options"}{"scheme"} ne "http" $self->{"options"}{"scheme"} ne "https"
Truth table50%2/4
A and B and C
A= defined $self->{"options"}{"scheme"}B= $self->{"options"}{"scheme"} ne "http"C= $self->{"options"}{"scheme"} ne "https"
ABCresult
0XX0
10X0
1100
1111
257 && $self->{options}{scheme} ne 'http'
258 && $self->{options}{scheme} ne 'https' )
259 {
260 0 $self->{perror} = 1;
261 0 $self->{error} = 28;
262 0 $self->{errorString} = 'the option scheme, "' . $self->{options}{scheme} . '", is not "http" or "https"';
263 0 $self->warn;
264 } elsif ( !defined( $self->{options}{scheme} ) ) {
265 1 $self->{options}{scheme} = 'https';
266 }
267  
268 2 ▶ if ( !defined( $self->{options}{ssl_verify} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"options"}{"ssl_verify"}) 2 0 2
269 2 $self->{options}{ssl_verify} = 0;
270 }
271  
272 2 ▶ if ( !defined( $self->{options}{timeout} ) ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not defined $self->{'options'}{'timeout'}) { } 2 0 2
elsif (not $self->{'options'}{'timeout'} =~ /^[0-9]+$/) { } 0 0 0
273 2 $self->{options}{timeout} = 30;
274 } elsif ( $self->{options}{timeout} !~ /^[0-9]+$/ ) {
275 0 $self->{perror} = 1;
276 0 $self->{error} = 28;
277 0 $self->{errorString} = 'the option timeout, "' . $self->{options}{timeout} . '", is not an int';
278 0 $self->warn;
279 }
280  
281 2 return $self;
282 } ## end sub new
283  
284 # Internal helper. Returns the NITRO config API base URL.
285 sub _base_url {
286 22 ▶ my ($self) = @_;
Subroutine _base_url: called CC=1 SCAR=0.0
287  
288 22 return $self->{options}{scheme} . '://' . $self->{options}{host} . '/nitro/v1/config';
289 }
290  
291 # Internal helper. Minimal percent encoder so URI::Escape is not needed.
292 sub _uri_escape {
293 5 ▶ my ( $self, $string ) = @_;
Subroutine _uri_escape: called CC=1 SCAR=0.0
294  
295 5 $string =~ s/([^A-Za-z0-9\-._~])/sprintf('%%%02X', ord($1))/ge;
296  
297 5 return $string;
298 }
299  
300 # Internal helper. Performs a HTTP request via LWP::UserAgent, dying with a
301 # explanation on any HTTP level failure. Never called in testing mode.
302 sub _request {
303 0 ▶ my ( $self, $method, $url, $body ) = @_;
Subroutine _request: not called CC=6 SCAR=37.4
304  
305 0 ▶ if ( !defined( $self->{ua} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"ua"}) 0 0 0
306 0 local $@;
307 0 ▶ eval {
Branch: 1 branch
BranchTrueFalseTotal
eval { do { require LWP::UserAgent; my(%new_opts) = ("agent", 'Net::Firewall::BlockerHelper/' . $Net::Firewall::BlockerHelper::backends::netscaler::VERSION, "timeout", $self->{"options"}{"timeout"}); unless ($self->{"options"}{"ssl_verify"}) { $new_opts{"ssl_opts"} = {"verify_hostname", 0, "SSL_verify_mode", 0}; } ; $self->{"ua"} = "LWP::UserAgent"->new(%new_opts); 1 } } or die 'failed to load LWP::UserAgent, which the netscaler backend requires... ' . $@ 0 0 0
308 0 require LWP::UserAgent;
309 my %new_opts = (
310 agent => 'Net::Firewall::BlockerHelper/' . $VERSION,
311 timeout => $self->{options}{timeout},
312 0 );
313 0 ▶ if ( !$self->{options}{ssl_verify} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"options"}{"ssl_verify"}) 0 0 0
314 0 $new_opts{ssl_opts} = { verify_hostname => 0, SSL_verify_mode => 0 };
315 }
316 0 $self->{ua} = LWP::UserAgent->new(%new_opts);
317 0 1;
318 } or die( 'failed to load LWP::UserAgent, which the netscaler backend requires... ' . $@ );
319 } ## end if ( !defined( $self->{ua} ) )
320  
321 0 my $auth = $self->{options}{auth};
322 0 ▶ if ( !defined($auth) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $auth) 0 0 0
323 0 require MIME::Base64;
324 0 $auth = MIME::Base64::encode_base64( $self->{options}{user} . ':' . $self->{options}{pass}, '' );
325 }
326  
327 0 my @headers = (
328 'Content-Type' => 'application/json',
329 'Authorization' => 'Basic ' . $auth,
330 );
331  
332 0 require HTTP::Request;
333 0 my $request = HTTP::Request->new( $method, $url, \@headers, $body );
334 0 my $response = $self->{ua}->request($request);
335  
336 0 ▶ if ( !$response->is_success ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($response->is_success) 0 0 0
337 0 die( $method . ' '
338 . $url
339 . ' failed... HTTP status... '
340 . $response->status_line
341 . '... content... '
342 . $response->decoded_content );
343 }
344  
345 0 return $response;
346 } ## end sub _request
347  
348 =head2 init
349  
350 Initiates the backend. Verifies the NITRO API is reachable and auth works
351 via a GET of C</nitro/v1/config>. Nothing is created on the NetScaler; the
352 dataset is expected to already exist.
353  
354 $backend->init;
355  
356 =cut
357  
358 sub init {
359 4 ▶ my ( $self, %opts ) = @_;
Subroutine init: called CC=4 SCAR=20.3
Pod documented
360  
361 4 $self->errorblank;
362  
363 4 ▶ if ( $self->{inited} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"inited"}) 0 4 4
364 0 $self->{error} = 18;
365 0 $self->{errorString} = 'backend has already been inited';
366 0 $self->warn;
367 }
368  
369 4 my $url = $self->_base_url;
370  
371 4 ▶ if ( $self->{testing} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'testing'}) { } 4 0 4
372 4 $self->{frontend_obj}->{test_data} = { requests => [ { method => 'GET', url => $url } ] };
373 } else {
374 0 local $@;
375 0 ▶ eval { $self->_request( 'GET', $url ); 1; } or do {
Branch: 1 branch
BranchTrueFalseTotal
eval { do { $self->_request("GET", $url); 1 } } or do { $self->{"error"} = 23; $self->{"errorString"} = 'init failed. probing the NITRO API failed... ' . $@; $self->warn } 0 0 0
376 0 $self->{error} = 23;
377 0 $self->{errorString} = 'init failed. probing the NITRO API failed... ' . $@;
378 0 $self->warn;
379 };
380 }
381  
382 4 $self->{inited} = 1;
383 } ## end sub init
384  
385 =head2 ban
386  
387 Bans an IP. The value of ban is validated as being a IPv4 or IPv6 address
388 and lowercased, then bound into the policy dataset via a PUT to
389 C</nitro/v1/config/policydataset_value_binding>. Banning an already banned
390 IP is a noop.
391  
392 $backend->ban(ban => $ip);
393  
394 =cut
395  
396 sub ban {
397 5 ▶ my ( $self, %opts ) = @_;
Subroutine ban: called CC=10 SCAR=33.8
Pod documented
398  
399 5 $self->errorblank;
400  
401 5 ▶ if ( !$self->{inited} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"inited"}) 0 5 5
402 0 $self->{error} = 1;
403 0 $self->{errorString} = 'backend has not been inited';
404 0 $self->warn;
405 0 return;
406 }
407  
408 5 ▶ if ( !defined( $opts{ban} ) ) {
Branch: 3 branches
BranchTrueFalseTotal
if (not defined $opts{'ban'}) { } 0 5 5
elsif (ref $opts{'ban'} ne '') { } 0 5 5
elsif (not $opts{'ban'} =~ /\A$Net::Firewall::BlockerHelper::backends::netscaler::IPv4_re\z/ || $opts{'ban'} =~ /\A$Net::Firewall::BlockerHelper::backends::netscaler::IPv6_re\z/) { } 0 5 5
409 0 $self->{error} = 9;
410 0 $self->{errorString} = 'Nothing specified for the value ban';
411 0 $self->warn;
412 0 return;
413 } elsif ( ref( $opts{ban} ) ne '' ) {
414 0 $self->{error} = 10;
415 0 $self->{errorString} = 'Bad ref type for ban... ref is "' . ref( $opts{ban} ) . '"';
416 0 $self->warn;
417 0 return;
418 ▶ } elsif ( $opts{ban} !~ /\A$IPv4_re\z/
Condition66%2/3
$opts{'ban'} =~ /\A$Net::Firewall::BlockerHelper::backends::netscaler::IPv4_re\z/ || $opts{'ban'} =~ /\A$Net::Firewall::BlockerHelper::backends::netscaler::IPv6_re\z/
l!l&&r!l&&!r
410
MC/DC0%0/2
$opts{'ban'} =~ /\A$Net::Firewall::BlockerHelper::backends::netscaler::IPv4_re\z/ || $opts{'ban'} =~ /\A$Net::Firewall::BlockerHelper::backends::netscaler::IPv6_re\z/
$opts{'ban'} =~ /\A$Net::Firewall::BlockerHelper::backends::netscaler::IPv4_re\z/ $opts{'ban'} =~ /\A$Net::Firewall::BlockerHelper::backends::netscaler::IPv6_re\z/
Truth table66%2/3
A || B
A= $opts{'ban'} =~ /\A$Net::Firewall::BlockerHelper::backends::netscaler::IPv4_re\z/B= $opts{'ban'} =~ /\A$Net::Firewall::BlockerHelper::backends::netscaler::IPv6_re\z/
ABresult
1X1
011
000
419 && $opts{ban} !~ /\A$IPv6_re\z/ )
420 {
421 0 $self->{error} = 10;
422 0 $self->{errorString} = 'ban item,"' . $opts{ban} . '", does not appear to be a IPv4 or IPv6 IP';
423 0 $self->warn;
424 0 return;
425 }
426  
427 # lowercase so the same IPv6 IP in differing cases can't result in duplicate entries
428 5 $opts{ban} = lc( $opts{ban} );
429  
430 5 ▶ if ( $self->{banned}{ $opts{ban} } ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"banned"}{$opts{"ban"}}) 1 4 5
431 1 ▶ if ( $self->{testing} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"testing"}) 1 0 1
432 1 $self->{frontend_obj}->{test_data} = 'already banned';
433 }
434 1 return;
435 }
436  
437 4 my $url = $self->_base_url . '/policydataset_value_binding';
438 my $body
439 = '{"policydataset_value_binding":{"name":"'
440 . $self->{options}{dataset}
441 . '","value":"'
442 4 . $opts{ban} . '"}}';
443  
444 4 ▶ if ( $self->{testing} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'testing'}) { } 4 0 4
445 4 $self->{frontend_obj}->{test_data} = [ { method => 'PUT', url => $url, content => $body } ];
446 } else {
447 0 local $@;
448 0 ▶ eval { $self->_request( 'PUT', $url, $body ); 1; } or do {
Branch: 1 branch
BranchTrueFalseTotal
eval { do { $self->_request("PUT", $url, $body); 1 } } or do { $self->{"error"} = 13; $self->{"errorString"} = 'banning "' . $opts{"ban"} . '" failed... ' . $@; $self->warn; return } 0 0 0
449 0 $self->{error} = 13;
450 0 $self->{errorString} = 'banning "' . $opts{ban} . '" failed... ' . $@;
451 0 $self->warn;
452 0 return;
453 };
454 }
455  
456 4 $self->{banned}{ $opts{ban} } = 1;
457 } ## end sub ban
458  
459 # Internal helper. Returns the URL used to remove the binding for the passed
460 # IP.
461 sub _unban_url {
462 5 ▶ my ( $self, $ip ) = @_;
Subroutine _unban_url: called CC=1 SCAR=0.0
463  
464 return
465 $self->_base_url
466 . '/policydataset_value_binding/'
467 . $self->{options}{dataset}
468 5 . '?args=value:'
469 . $self->_uri_escape($ip);
470 } ## end sub _unban_url
471  
472 =head2 unban
473  
474 Unbans an IP. The value of ban is validated as being a IPv4 or IPv6 address
475 and lowercased, then its binding is removed from the policy dataset via a
476 DELETE of C</nitro/v1/config/policydataset_value_binding/E<lt>datasetE<gt>?args=value:E<lt>ipE<gt>>.
477 Unbanning an IP that is not banned is a noop.
478  
479 $backend->unban(ban => $ip);
480  
481 =cut
482  
483 sub unban {
484 2 ▶ my ( $self, %opts ) = @_;
Subroutine unban: called CC=10 SCAR=37.2
Pod documented
485  
486 2 $self->errorblank;
487  
488 2 ▶ if ( !$self->{inited} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"inited"}) 0 2 2
489 0 $self->{error} = 1;
490 0 $self->{errorString} = 'backend has not been inited';
491 0 $self->warn;
492 0 return;
493 }
494  
495 2 ▶ if ( !defined( $opts{ban} ) ) {
Branch: 3 branches
BranchTrueFalseTotal
if (not defined $opts{'ban'}) { } 0 2 2
elsif (ref $opts{'ban'} ne '') { } 0 2 2
elsif (not $opts{'ban'} =~ /\A$Net::Firewall::BlockerHelper::backends::netscaler::IPv4_re\z/ || $opts{'ban'} =~ /\A$Net::Firewall::BlockerHelper::backends::netscaler::IPv6_re\z/) { } 0 2 2
496 0 $self->{error} = 9;
497 0 $self->{errorString} = 'Nothing specified for the value ban';
498 0 $self->warn;
499 0 return;
500 } elsif ( ref( $opts{ban} ) ne '' ) {
501 0 $self->{error} = 10;
502 0 $self->{errorString} = 'Bad ref type for ban... ref is "' . ref( $opts{ban} ) . '"';
503 0 $self->warn;
504 0 return;
505 ▶ } elsif ( $opts{ban} !~ /\A$IPv4_re\z/
Condition66%2/3
$opts{'ban'} =~ /\A$Net::Firewall::BlockerHelper::backends::netscaler::IPv4_re\z/ || $opts{'ban'} =~ /\A$Net::Firewall::BlockerHelper::backends::netscaler::IPv6_re\z/
l!l&&r!l&&!r
110
MC/DC0%0/2
$opts{'ban'} =~ /\A$Net::Firewall::BlockerHelper::backends::netscaler::IPv4_re\z/ || $opts{'ban'} =~ /\A$Net::Firewall::BlockerHelper::backends::netscaler::IPv6_re\z/
$opts{'ban'} =~ /\A$Net::Firewall::BlockerHelper::backends::netscaler::IPv4_re\z/ $opts{'ban'} =~ /\A$Net::Firewall::BlockerHelper::backends::netscaler::IPv6_re\z/
Truth table66%2/3
A || B
A= $opts{'ban'} =~ /\A$Net::Firewall::BlockerHelper::backends::netscaler::IPv4_re\z/B= $opts{'ban'} =~ /\A$Net::Firewall::BlockerHelper::backends::netscaler::IPv6_re\z/
ABresult
1X1
011
000
506 && $opts{ban} !~ /\A$IPv6_re\z/ )
507 {
508 0 $self->{error} = 10;
509 0 $self->{errorString} = 'ban item,"' . $opts{ban} . '", does not appear to be a IPv4 or IPv6 IP';
510 0 $self->warn;
511 0 return;
512 }
513  
514 # lowercase so the same IPv6 IP in differing cases can't result in duplicate entries
515 2 $opts{ban} = lc( $opts{ban} );
516  
517 2 ▶ if ( !$self->{banned}{ $opts{ban} } ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"banned"}{$opts{"ban"}}) 0 2 2
518 0 ▶ if ( $self->{testing} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"testing"}) 0 0 0
519 0 $self->{frontend_obj}->{test_data} = 'not banned';
520 }
521 0 return;
522 }
523  
524 2 my $url = $self->_unban_url( $opts{ban} );
525  
526 2 ▶ if ( $self->{testing} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'testing'}) { } 2 0 2
527 2 $self->{frontend_obj}->{test_data} = [ { method => 'DELETE', url => $url } ];
528 } else {
529 0 local $@;
530 0 ▶ eval { $self->_request( 'DELETE', $url ); 1; } or do {
Branch: 1 branch
BranchTrueFalseTotal
eval { do { $self->_request("DELETE", $url); 1 } } or do { $self->{"error"} = 14; $self->{"errorString"} = 'unbanning "' . $opts{"ban"} . '" failed... ' . $@; $self->warn; return } 0 0 0
531 0 $self->{error} = 14;
532 0 $self->{errorString} = 'unbanning "' . $opts{ban} . '" failed... ' . $@;
533 0 $self->warn;
534 0 return;
535 };
536 }
537  
538 2 delete( $self->{banned}{ $opts{ban} } );
539 } ## end sub unban
540  
541 =head2 ban_cidr
542  
543 CIDR bans are not supported by this backend; this always sets the
544 cidrNotSupported error.
545  
546 $backend->ban_cidr(ban => '1.2.3.0/24');
547  
548 =cut
549  
550 sub ban_cidr {
551 0 ▶ my ( $self, %opts ) = @_;
Subroutine ban_cidr: not called CC=1 SCAR=6.9
Pod documented
552  
553 0 $self->errorblank;
554  
555 0 $self->{error} = 32;
556 0 $self->{errorString} = 'the ' . __PACKAGE__ . ' backend does not support CIDR bans';
557 0 $self->warn;
558  
559 0 return;
560 } ## end sub ban_cidr
561  
562 =head2 unban_cidr
563  
564 CIDR bans are not supported by this backend; this always sets the
565 cidrNotSupported error.
566  
567 $backend->unban_cidr(ban => '1.2.3.0/24');
568  
569 =cut
570  
571 sub unban_cidr {
572 0 ▶ my ( $self, %opts ) = @_;
Subroutine unban_cidr: not called CC=1 SCAR=6.9
Pod documented
573  
574 0 $self->errorblank;
575  
576 0 $self->{error} = 32;
577 0 $self->{errorString} = 'the ' . __PACKAGE__ . ' backend does not support CIDR bans';
578 0 $self->warn;
579  
580 0 return;
581 } ## end sub unban_cidr
582  
583 =head2 list_cidr
584  
585 CIDR bans are not supported by this backend, so this always returns an empty
586 list.
587  
588 my @banned_cidrs = $backend->list_cidr;
589  
590 =cut
591  
592 sub list_cidr {
593 0 ▶ my ( $self, %opts ) = @_;
Subroutine list_cidr: not called CC=1 SCAR=6.9
Pod documented
594  
595 0 $self->errorblank;
596  
597 0 return ();
598 }
599  
600 =head2 list
601  
602 List banned IPs. Returns an array of the currently banned IPs from the
603 internal ban list; the NetScaler is not queried.
604  
605 my @banned = $backend->list;
606  
607 =cut
608  
609 sub list {
610 2 ▶ my ( $self, %opts ) = @_;
Subroutine list: called CC=2 SCAR=7.0
Pod documented
611  
612 2 $self->errorblank;
613  
614 2 ▶ if ( $self->{testing} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"testing"}) 2 0 2
615 2 $self->{frontend_obj}->{test_data} = 'list';
616 }
617  
618 2 return keys( %{ $self->{banned} } );
619 }
620  
621 =head2 re_init
622  
623 Tells the backend to re-init it's self.
624  
625 This will call teardown, best effort as a partially wiped setup is what it
626 is recovering from, then init again. After that every IP in the retained
627 ban list is re-banned by PUTing its dataset binding back.
628  
629 $backend->re_init;
630  
631 =cut
632  
633 sub re_init {
634 1 ▶ my ( $self, %opts ) = @_;
Subroutine re_init: called CC=6 SCAR=21.6
Pod documented
635  
636 1 $self->errorblank;
637  
638 1 ▶ if ( !$self->{inited} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"inited"}) 0 1 1
639 0 $self->{error} = 1;
640 0 $self->{errorString} = 'backend has not been inited';
641 0 $self->warn;
642 0 return;
643 }
644  
645 # teardown is best effort here as a partially or fully wiped setup is
646 # exactly what re_init needs to recover from; init cleans up any remnants
647 {
648 1 local $@;
649 1 eval { $self->teardown; };
650 }
651 1 $self->init;
652  
653 1 my @to_ban = keys( %{ $self->{banned} } );
654  
655 1 my @re_init_test_data;
656 1 foreach my $item (@to_ban) {
657 1 my $url = $self->_base_url . '/policydataset_value_binding';
658 my $body
659 1 = '{"policydataset_value_binding":{"name":"' . $self->{options}{dataset} . '","value":"' . $item . '"}}';
660  
661 1 ▶ if ( $self->{testing} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'testing'}) { } 1 0 1
662 1 push( @re_init_test_data, { method => 'PUT', url => $url, content => $body } );
663 } else {
664 0 local $@;
665 0 ▶ eval { $self->_request( 'PUT', $url, $body ); 1; } or do {
Branch: 1 branch
BranchTrueFalseTotal
eval { do { $self->_request("PUT", $url, $body); 1 } } or do { $self->{"error"} = 13; $self->{"errorString"} = 'banning "' . $item . '" failed... ' . $@; $self->warn } 0 0 0
666 0 $self->{error} = 13;
667 0 $self->{errorString} = 'banning "' . $item . '" failed... ' . $@;
668 0 $self->warn;
669 };
670 }
671 } ## end foreach my $item (@to_ban)
672  
673 1 ▶ if ( $self->{testing} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"testing"}) 1 0 1
674 1 $self->{frontend_obj}->{test_data} = \@re_init_test_data;
675 }
676  
677 1 $self->{inited} = 1;
678 } ## end sub re_init
679  
680 =head2 teardown
681  
682 Tears down the setup for the backend by removing the binding for each
683 currently banned IP. The internal list of bans is kept, so a following
684 re_init will re-add them.
685  
686 $backend->teardown;
687  
688 =cut
689  
690 sub teardown {
691 2 ▶ my ( $self, %opts ) = @_;
Subroutine teardown: called CC=5 SCAR=20.0
Pod documented
692  
693 2 $self->errorblank;
694  
695 2 $self->{inited} = 0;
696  
697 2 my @requests;
698 2 foreach my $item ( sort( keys( %{ $self->{banned} } ) ) ) {
699 2 my $url = $self->_unban_url($item);
700 2 ▶ if ( $self->{testing} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'testing'}) { } 2 0 2
701 2 push( @requests, { method => 'DELETE', url => $url } );
702 } else {
703 0 local $@;
704 0 ▶ eval { $self->_request( 'DELETE', $url ); 1; } or do {
Branch: 1 branch
BranchTrueFalseTotal
eval { do { $self->_request("DELETE", $url); 1 } } or do { $self->{"error"} = 17; $self->{"errorString"} = 'teardown failed removing the binding for "' . $item . '"... ' . $@; $self->warn } 0 0 0
705 0 $self->{error} = 17;
706 0 $self->{errorString} = 'teardown failed removing the binding for "' . $item . '"... ' . $@;
707 0 $self->warn;
708 };
709 }
710 } ## end foreach my $item ( sort( keys( %{ $self->{banned...})))
711  
712 2 ▶ if ( $self->{testing} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"testing"}) 2 0 2
713 2 $self->{frontend_obj}->{test_data} = \@requests;
714 }
715 } ## end sub teardown
716  
717 =head2 stop
718  
719 Alias for L</teardown>, provided for parity with the fail2ban C<actionstop>
720 concept.
721  
722 $backend->stop;
723  
724 =cut
725  
726 sub stop {
727 0 ▶ my ( $self, %opts ) = @_;
Subroutine stop: not called CC=1 SCAR=6.9
Pod documented
728  
729 0 return $self->teardown(%opts);
730 }
731  
732 =head2 check
733  
734 Verifies the NITRO API is still reachable and auth still works. Returns a
735 true value if so and a false value otherwise. This is the equivalent of
736 fail2ban's C<actioncheck>.
737  
738 if ( !$backend->check ) {
739 $backend->re_init;
740 }
741  
742 =cut
743  
744 sub check {
745 8 ▶ my ( $self, %opts ) = @_;
Subroutine check: called CC=3 SCAR=14.7
Pod documented
746  
747 8 $self->errorblank;
748  
749 8 my $url = $self->_base_url;
750  
751 8 ▶ if ( $self->{testing} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"testing"}) 8 0 8
752 8 $self->{frontend_obj}->{test_data} = [ { method => 'GET', url => $url } ];
753 8 return 1;
754 }
755  
756 0 local $@;
757 0 ▶ eval { $self->_request( 'GET', $url ); 1; } or return 0;
Branch: 1 branch
BranchTrueFalseTotal
eval { do { $self->_request("GET", $url); 1 } } or return 0 0 0 0
758  
759 0 return 1;
760 } ## end sub check
761  
762 =head2 flush
763  
764 Removes all currently banned IPs at once by removing their bindings and
765 forgetting them. This is the equivalent of fail2ban's C<actionflush>.
766  
767 $backend->flush;
768  
769 =cut
770  
771 sub flush {
772 1 ▶ my ( $self, %opts ) = @_;
Subroutine flush: called CC=6 SCAR=23.9
Pod documented
773  
774 1 $self->errorblank;
775  
776 1 ▶ if ( !$self->{inited} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"inited"}) 0 1 1
777 0 $self->{error} = 1;
778 0 $self->{errorString} = 'backend has not been inited';
779 0 $self->warn;
780 0 return;
781 }
782  
783 1 my @requests;
784 1 foreach my $item ( sort( keys( %{ $self->{banned} } ) ) ) {
785 1 my $url = $self->_unban_url($item);
786 1 ▶ if ( $self->{testing} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'testing'}) { } 1 0 1
787 1 push( @requests, { method => 'DELETE', url => $url } );
788 } else {
789 0 local $@;
790 0 ▶ eval { $self->_request( 'DELETE', $url ); 1; } or do {
Branch: 1 branch
BranchTrueFalseTotal
eval { do { $self->_request("DELETE", $url); 1 } } or do { $self->{"error"} = 25; $self->{"errorString"} = 'flush failed removing the binding for "' . $item . '"... ' . $@; $self->warn } 0 0 0
791 0 $self->{error} = 25;
792 0 $self->{errorString} = 'flush failed removing the binding for "' . $item . '"... ' . $@;
793 0 $self->warn;
794 };
795 }
796 } ## end foreach my $item ( sort( keys( %{ $self->{banned...})))
797  
798 1 ▶ if ( $self->{testing} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"testing"}) 1 0 1
799 1 $self->{frontend_obj}->{test_data} = \@requests;
800 }
801  
802 1 $self->{banned} = {};
803 } ## end sub flush
804  
805 =head1 ERROR CODES / FLAGS
806  
807 Error handling is provided by L<Error::Helper>. All
808 errors are considered fatal.
809  
810 =head2 1, notInited
811  
812 The backend has not been inited yet.
813  
814 =head2 6, invalidPrefixSpecified
815  
816 The specified prefix did not match /^[a-zA-Z0-9]+$/.
817  
818 =head2 7, invalidName
819  
820 The name is either undef or does not match /^[a-zA-Z0-9\-]+$/.
821  
822 =head2 8, optionsNotHash
823  
824 The item passed to new for options is not a hash.
825  
826 =head2 9, noBanItem
827  
828 No IP specified to ban or unban.
829  
830 =head2 10, banItemNotIP
831  
832 The item to ban is not an IP. Either wrong ref type or regexp
833 test using L<Regexp::IPv4> and L<Regexp::IPv6> failed.
834  
835 =head2 12, backendInitError
836  
837 Failed to init the backend.
838  
839 =head2 13, banFailed
840  
841 Failed to ban the item.
842  
843 =head2 14, unbanFailed
844  
845 Failed to unban the item.
846  
847 =head2 15, listFailed
848  
849 Failed to get a list of bans.
850  
851 =head2 16, reInitFailed
852  
853 Failed to re_init the backend.
854  
855 =head2 17, teardownFailed
856  
857 Failed to teardown the backend.
858  
859 =head2 18, alreadyInited
860  
861 init called, but the backend has already been inited.
862  
863 =head2 23, initFailed
864  
865 Probing the NITRO API during init failed.
866  
867 =head2 24, checkFailed
868  
869 The backend check raised an error.
870  
871 =head2 25, flushFailed
872  
873 Failed to flush the bans.
874  
875 =head2 26, portsNotSupported
876  
877 The netscaler backend blocks whole IPs and does not support ports.
878  
879 =head2 27, protocolsNotSupported
880  
881 The netscaler backend blocks whole IPs and does not support protocols.
882  
883 =head2 28, optionInvalid
884  
885 One of the options, such as host, auth, dataset, scheme, or timeout, is
886 invalid or missing.
887  
888 =head2 29, banCidrFailed
889  
890 Failed to ban the CIDR range.
891  
892 =head2 30, unbanCidrFailed
893  
894 Failed to unban the CIDR range.
895  
896 =head2 31, cidrItemNotCidr
897  
898 The item to ban is not a CIDR range. Either wrong ref type or it is not an
899 IPv4 or IPv6 address followed by a prefix length valid for its family.
900  
901 =head2 32, cidrNotSupported
902  
903 The backend does not support CIDR bans.
904  
905 =head2 33, listCidrFailed
906  
907 Failed to get a list of CIDR bans.
908  
909 =head1 AUTHOR
910  
911 Zane C. Bowers-Hadley, C<< <vvelox at vvelox.ent> >>
912  
913 =head1 BUGS
914  
915 Please report any bugs or feature requests to C<bug-net-firewall-blockerhelper at rt.cpan.org>, or through
916 the web interface at L<https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-Firewall-BlockerHelper>.
917  
918 =head1 LICENSE AND COPYRIGHT
919  
920 This software is Copyright (c) 2023 by Zane C. Bowers-Hadley.
921  
922 This is free software, licensed under:
923  
924 The GNU Lesser General Public License, Version 2.1, February 1999
925  
926  
927 =cut
928  
929 1 1; # End of Net::Firewall::BlockerHelper
« BlockerHelper/backends/cisco_fmc.pm ↑ Summary BlockerHelper/backends/routeros_api.pm »