This file is indexed.

/usr/share/perl5/EBox/FirewallHelper.pm is in zentyal-firewall 2.3.3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
# Copyright (C) 2008-2012 eBox Technologies S.L.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2, as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

package EBox::FirewallHelper;

use strict;
use warnings;

use EBox::Gettext;

sub new
{
    my $class = shift;
    my $self = {};
    $self->{net} = EBox::Global->modInstance('network');
    bless($self, $class);
    return $self;
}

# Method: prerouting
#
#   Rules returned by this method are added to the PREROUTING chain in
#   the NAT table. You can use them to do NAT on the destination
#   address of packets.
#
# Returns:
#
#   array ref - containing prerouting rules
sub prerouting
{
    return [];
}

# Method: postrouting
#
#   Rules returned by this method are added to the POSTROUTING chain in
#   the NAT table. You can use them to do NAT on the source
#   address of packets.
#
# Returns:
#
#   array ref - containing postrouting rules
sub postrouting
{
    return [];
}

# Method: forward
#
#   Rules returned by this method are added to the FORWARD chain in
#   the filter table. You can use them to filter packets passing through
#   the firewall.
#
# Returns:
#
#   array ref - containing forward rules
sub forward
{
    return [];
}

# Method: forwardNoSpoof
#
#   Rules returned by this method are added to the fnospoofmodules chain in
#   the filter table. You can use them to add exceptions on the default
#   source checking in the firewall. This is mainly used by IPsec special
#   routing rules.
#
# Returns:
#
#   array ref - containing forward no spoof rules
sub forwardNoSpoof
{
    return [];
}

# Method: input
#
#   Rules returned by this method are added to the INPUT chain for INTERNAL ifaces in
#   the filter table. You can use them to filter packets directed at
#   the firewall itself.
#
# Returns:
#
#   array ref - containing input rules
sub input
{
    return [];
}

# Method: inputNoSpoof
#
#   Rules returned by this method are added to the inospoofmodules chain in
#   the filter table. You can use them to add exceptions on the default
#   source checking in the firewall. This is mainly used by IPsec special
#   routing rules.
#
# Returns:
#
#   array ref - containing input no spoof rules
sub inputNoSpoof
{
    return [];
}

# Method: output
#
#   Rules returned by this method are added to the OUTPUT chain in
#   the filter table. You can use them to filter packets originated
#   within the firewall.
#
# Returns:
#
#   array ref - containing output rules
sub output
{
    return [];
}



# Method: externalInput
#
#   Rules returned by this method are added to the INPUT for EXTERNAL interfaces chain in
#   the filter table. You can use them to filter packets directed at
#   the firewall itself.
#
# Returns:
#
#   array ref - containing input rules
sub externalInput
{
    return [];
}


# Method: chains
#
#   Chains returned by this method are created and can be referenced on this helper
#   defined rules
#
# Returns:
#
#   hash ref - containing table-chain name pairs. Example:
#       { nat => ['chain1', 'chain2'], filter => ['chain3'] }
sub chains
{
    return {}
}


# Method: _outputIface
#
#   Returns iptables rule part for output interface selection
#   If the interface is a bridge port it matches de whole bridge (brX)
#
# Parameters:
#
#   Iface - Iface name
#
sub _outputIface # (iface)
{
    my ($self, $iface) = @_;

    if ( $self->{net}->ifaceExists($iface) and
         $self->{net}->ifaceMethod($iface) eq 'bridged' ) {

        my $br = $self->{net}->ifaceBridge($iface);
        return  "-o br$br";
    } else {
        return "-o $iface";
    }
}
# Method: _inputIface
#
#   Returns iptables rule part for input interface selection
#   Takes into account if the iface is part of a bridge
#
# Parameters:
#
#   Iface - Iface name
#
sub _inputIface # (iface)
{
    my ($self, $iface) = @_;

    if ( $self->{net}->ifaceExists($iface) and
        $self->{net}->ifaceMethod($iface) eq 'bridged' ) {
        return  "-m physdev --physdev-in $iface";
    } else {
        return "-i $iface";
    }
}

1;