| 1 | package Ereshkigal::App::Command::banned; | ||||||||||
| 2 | |||||||||||
| 3 | 2 | ▶ | use 5.006; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 2 | ▶ | use Ereshkigal::App -command; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | =head1 NAME | ||||||||||
| 9 | |||||||||||
| 10 | Ereshkigal::App::Command::banned - List banned IPs, grouped per kur. | ||||||||||
| 11 | |||||||||||
| 12 | =head1 VERSION | ||||||||||
| 13 | |||||||||||
| 14 | Version 0.0.1 | ||||||||||
| 15 | |||||||||||
| 16 | =cut | ||||||||||
| 17 | |||||||||||
| 18 | 2 | our $VERSION = '0.0.1'; | |||||||||
| 19 | |||||||||||
| 20 | =head1 SYNOPSIS | ||||||||||
| 21 | |||||||||||
| 22 | ereshkigal banned | ||||||||||
| 23 | |||||||||||
| 24 | =head1 DESCRIPTION | ||||||||||
| 25 | |||||||||||
| 26 | Lists who each kur is holding... the banned IPs as the firewall itself | ||||||||||
| 27 | reports them, an C<expires> map giving when each sentence runs out with 0 | ||||||||||
| 28 | meaning never, and the same pair for range bans under C<banned_cidr> and | ||||||||||
| 29 | C<cidr_expires>. | ||||||||||
| 30 | |||||||||||
| 31 | Also listed, under C<unban_retries> and C<cidr_unban_retries>, is anything | ||||||||||
| 32 | whose unban failed at expiry and is still owed to the firewall, each with | ||||||||||
| 33 | when it was first and last tried, how many times, and when it is next due. | ||||||||||
| 34 | Those are entries the kur has released but the firewall has not, so they | ||||||||||
| 35 | appear in the banned list as well. | ||||||||||
| 36 | L<clear_retries|Ereshkigal::App::Command::clear_retries> forgets them. | ||||||||||
| 37 | |||||||||||
| 38 | =head1 METHODS | ||||||||||
| 39 | |||||||||||
| 40 | The App::Cmd hooks this subcommand supplies... abstract, description, | ||||||||||
| 41 | usage_desc, validate_args, and execute. | ||||||||||
| 42 | |||||||||||
| 43 | =cut | ||||||||||
| 44 | |||||||||||
| 45 | 1 | ▶ | sub abstract { return 'list banned IPs, grouped per kur' } | ||||||||
|
Subroutine
abstract: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 46 | |||||||||||
| 47 | 4 | ▶ | sub description { | ||||||||
|
Subroutine
description: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 48 | 4 | return <<'DESCRIPTION'; | |||||||||
| 49 | List who each kur is holding. | ||||||||||
| 50 | |||||||||||
| 51 | Per kur: the banned IPs as the firewall itself reports them, an expires | ||||||||||
| 52 | map giving when each sentence runs out with 0 meaning never, and the same | ||||||||||
| 53 | pair for range bans under banned_cidr and cidr_expires. | ||||||||||
| 54 | |||||||||||
| 55 | Also listed, under unban_retries and cidr_unban_retries, is anything whose | ||||||||||
| 56 | unban failed at expiry and is still owed to the firewall... each with when | ||||||||||
| 57 | it was first tried, when it was last tried, how many times, and when it is | ||||||||||
| 58 | next due. Those are entries the kur has released but the firewall has not, | ||||||||||
| 59 | so they will still appear in the banned list as well. "clear-retries" | ||||||||||
| 60 | forgets them, with the caveats in its own help. | ||||||||||
| 61 | DESCRIPTION | ||||||||||
| 62 | } ## end sub description | ||||||||||
| 63 | |||||||||||
| 64 | 7 | ▶ | sub usage_desc { return '%c banned %o'; } | ||||||||
|
Subroutine
usage_desc: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 65 | |||||||||||
| 66 | 3 | ▶ | sub validate_args { | ||||||||
|
Subroutine
validate_args: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 67 | 3 | my ( $self, $opt, $args ) = @_; | |||||||||
| 68 | |||||||||||
| 69 | 3 | ▶ | if ( @{$args} ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 70 | 1 | $self->usage_error('banned does not take any args'); | |||||||||
| 71 | } | ||||||||||
| 72 | |||||||||||
| 73 | 2 | return; | |||||||||
| 74 | } | ||||||||||
| 75 | |||||||||||
| 76 | 2 | ▶ | sub execute { | ||||||||
|
Subroutine
execute: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 77 | 2 | my ( $self, $opt, $args ) = @_; | |||||||||
| 78 | |||||||||||
| 79 | 2 | $self->run_command('banned'); | |||||||||
| 80 | |||||||||||
| 81 | 1 | return; | |||||||||
| 82 | } | ||||||||||
| 83 | |||||||||||
| 84 | 2 | 1; | |||||||||