Fwctl/Services/rsh.pm untested

filter: Statementstmt 0.0% 0 / 33 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 9 Podpod 0.0% 0 / 6 totaltotal 0.0% 0 / 61 CC 5 SCAR 18.9
CC
5
Cov
0%
accept_rules
12.0
account_rules
12.0
new
2.0
CRAP 6.6
1 #
2 # rsh.pm: Fwctl service module to handle the rsh protocol.
3 #
4 # This file is part of Fwctl.
5 #
6 # Author: Francis J. Lacoste <francis.lacoste@iNsu.COM>
7 #
8 # Copyright (c) 1999,2000 iNsu Innovations Inc.
9 #
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 2 of the License, or
13 # (at your option) any later version.
14 #
15 package Fwctl::Services::rsh;
16  
17 use strict;
18  
19 use Fwctl::RuleSet qw(:tcp_rulesets :masq);
20 use IPChains;
21  
22 sub new {
23 my $proto = shift;
24 my $class = ref $proto || $proto;
25 bless {}, $class;
26 }
27  
28 sub prototypes {
29 my ($self,$target,$options) = @_;
30  
31 # Build prototypes
32 (
33 IPChains->new(
34 Rule => $target,
35 Prot => 'tcp',
36 SourcePort => "512:1023",
37 DestPort => "shell",
38 %{$options->{ipchains}},
39 ),
40 IPChains->new(
41 Rule => $target,
42 Prot => 'tcp',
43 SourcePort => "512:1023",
44 DestPort => "512:1023",
45 %{$options->{ipchains}},
46 ),
47 );
48 }
49  
50 sub block_rules {
51 my $self = shift;
52 my ( $target, $src, $src_if, $dst, $dst_if, $options ) = @_;
53  
54  
55 my ($rsh,$stderr) = $self->prototypes( $target, $options );
56 block_tcp_ruleset( $rsh, $src, $src_if, $dst, $dst_if );
57 block_tcp_ruleset( $stderr, $dst, $dst_if, $src, $src_if );
58 }
59  
60 sub accept_rules {
61 my $self = shift;
62 my ( $target, $src, $src_if, $dst, $dst_if, $options ) = @_;
63  
64 my ($rsh,$stderr) = $self->prototypes( $target, $options );
65 accept_tcp_ruleset( $rsh, $src, $src_if, $dst, $dst_if,
66 $options->{masq} ? MASQ : NOMASQ
67 );
68 accept_tcp_ruleset( $stderr, $dst, $dst_if, $src, $src_if,
69 $options->{masq} ? MASQ : NOMASQ
70 );
71 }
72  
73 sub account_rules {
74 my $self = shift;
75 my ( $target, $src, $src_if, $dst, $dst_if, $options ) = @_;
76  
77 my ($rsh,$stderr) = $self->prototypes( $target, $options );
78 acct_tcp_ruleset( $rsh, $src, $src_if, $dst, $dst_if,
79 $options->{masq} ? MASQ : NOMASQ
80 );
81 acct_tcp_ruleset( $stderr, $dst, $dst_if, $src, $src_if,
82 $options->{masq} ? MASQ : NOMASQ
83 );
84 }
85  
86 sub valid_options {
87 my $self = shift;
88 ();
89 }
90  
91 1;
92 =pod
93  
94 =head1 NAME
95  
96 Fwctl::Services::rsh - Fwctl module to handle the rsh protocol.
97  
98 =head1 SYNOPSIS
99  
100 accept rsh -src INTERNAL_NET -dst FIREWALL
101  
102 =head1 DESCRIPTION
103  
104 The rsh module handles the remote shell protocol.
105  
106 =head1 AUTHOR
107  
108 Francis J. Lacoste <francis.lacoste@iNsu.COM>
109  
110 =head1 COPYRIGHT
111  
112 Copyright (c) 1999,2000 iNsu Innovations Inc.
113 All rights reserved.
114  
115 This program is free software; you can redistribute it and/or modify
116 it under the terms of the GNU General Public License as published by
117 the Free Software Foundation; either version 2 of the License, or
118 (at your option) any later version.
119  
120 =head1 SEE ALSO
121  
122 fwctl(8) Fwctl(3) Fwctl::RuleSet(3)
123  
124 =cut
125