| 1 | package Ereshkigal::App::Command::remove; | ||||||||||
| 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::remove - Stop a kur instance and deregister it. | ||||||||||
| 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 remove sshd | ||||||||||
| 23 | |||||||||||
| 24 | =head1 DESCRIPTION | ||||||||||
| 25 | |||||||||||
| 26 | Stops the kur instance, tearing its firewall setup down and removing its | ||||||||||
| 27 | socket and PID files, and deregisters it from the running manager. Does not | ||||||||||
| 28 | rewrite the config file... to make it permanent, remove it from the config. | ||||||||||
| 29 | |||||||||||
| 30 | =head1 METHODS | ||||||||||
| 31 | |||||||||||
| 32 | The App::Cmd hooks this subcommand supplies... abstract, description, | ||||||||||
| 33 | usage_desc, validate_args, and execute. | ||||||||||
| 34 | |||||||||||
| 35 | =cut | ||||||||||
| 36 | |||||||||||
| 37 | 1 | ▶ | sub abstract { return 'stop a kur instance and deregister it' } | ||||||||
|
Subroutine
abstract: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 38 | |||||||||||
| 39 | 4 | ▶ | sub description { | ||||||||
|
Subroutine
description: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 40 | 4 | return <<'DESCRIPTION'; | |||||||||
| 41 | Stop a kur instance and deregister it from the running manager. | ||||||||||
| 42 | |||||||||||
| 43 | The kur is asked to stop, which tears its firewall setup down on the way | ||||||||||
| 44 | out... the table, set, chain, or list it owns is removed, and with it | ||||||||||
| 45 | every ban it was holding. Those addresses stop being blocked the moment | ||||||||||
| 46 | this returns. The ban tablet is left on disk, so re-adding the same kur | ||||||||||
| 47 | later restores what it was carrying. | ||||||||||
| 48 | |||||||||||
| 49 | The config file is not rewritten, so a kur defined there returns at the | ||||||||||
| 50 | next manager start. To be rid of it for good, delete it from the config | ||||||||||
| 51 | as well. | ||||||||||
| 52 | |||||||||||
| 53 | A kur that is a member of a fan_out gate cannot be removed, as that would | ||||||||||
| 54 | leave the gate pointing at nothing... remove it from the gate first. | ||||||||||
| 55 | DESCRIPTION | ||||||||||
| 56 | } ## end sub description | ||||||||||
| 57 | |||||||||||
| 58 | 7 | ▶ | sub usage_desc { return '%c remove %o <kur>'; } | ||||||||
|
Subroutine
usage_desc: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 59 | |||||||||||
| 60 | 3 | ▶ | sub validate_args { | ||||||||
|
Subroutine
validate_args: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 61 | 3 | my ( $self, $opt, $args ) = @_; | |||||||||
| 62 | |||||||||||
| 63 | 3 | ▶ | if ( @{$args} != 1 ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 64 | 1 | $self->usage_error('a single kur instance name must be specified'); | |||||||||
| 65 | } | ||||||||||
| 66 | |||||||||||
| 67 | 2 | return; | |||||||||
| 68 | } | ||||||||||
| 69 | |||||||||||
| 70 | 2 | ▶ | sub execute { | ||||||||
|
Subroutine
execute: called CC=1 SCAR=0.4
Pod
documented
| |||||||||||
| 71 | 2 | my ( $self, $opt, $args ) = @_; | |||||||||
| 72 | |||||||||||
| 73 | 2 | $self->run_command( 'remove_kur', { 'name' => $args->[0] } ); | |||||||||
| 74 | |||||||||||
| 75 | 0 | return; | |||||||||
| 76 | } | ||||||||||
| 77 | |||||||||||
| 78 | 2 | 1; | |||||||||