2008-12-07 19:17:26 +01:00
|
|
|
#
|
|
|
|
# Shorewall version 4 - Reject Action
|
|
|
|
#
|
|
|
|
# /usr/share/shorewall/action.Reject
|
|
|
|
#
|
|
|
|
# The default REJECT action common rules
|
|
|
|
#
|
|
|
|
# This action is invoked before a REJECT policy is enforced. The purpose
|
|
|
|
# of the action is:
|
|
|
|
#
|
|
|
|
# a) Avoid logging lots of useless cruft.
|
|
|
|
# b) Ensure that certain ICMP packets that are necessary for successful
|
|
|
|
# internet operation are always ACCEPTed.
|
|
|
|
#
|
2011-06-22 23:27:32 +02:00
|
|
|
# The action accepts five optional parameters:
|
2011-06-11 23:58:54 +02:00
|
|
|
#
|
|
|
|
# 1 - 'audit' or '-'. Default is '-' which means don't audit in builtin
|
|
|
|
# actions.
|
2013-05-14 19:44:26 +02:00
|
|
|
# 2 - Action to take with Auth requests. Default is to do nothing
|
|
|
|
# special with them.
|
2011-06-11 23:58:54 +02:00
|
|
|
# 3 - Action to take with SMB requests. Default is REJECT or A_REJECT,
|
|
|
|
# depending on the setting of the first parameter.
|
2011-06-22 23:27:32 +02:00
|
|
|
# 4 - Action to take with required ICMP packets. Default is ACCEPT or
|
|
|
|
# A_ACCEPT depending on the first parameter.
|
|
|
|
# 5 - Action to take with late UDP replies (UDP source port 53). Default
|
|
|
|
# is DROP or A_DROP depending on the first parameter.
|
2011-06-11 23:58:54 +02:00
|
|
|
#
|
2008-12-07 19:17:26 +01:00
|
|
|
# IF YOU ARE HAVING CONNECTION PROBLEMS, CHANGING THIS FILE WON'T HELP!!!!!!!!!
|
|
|
|
###############################################################################
|
2012-12-22 00:51:14 +01:00
|
|
|
?FORMAT 2
|
2011-06-11 23:58:54 +02:00
|
|
|
#
|
2012-12-21 23:00:05 +01:00
|
|
|
# The following magic provides different defaults for @2 thru @5, when @1 is
|
2011-06-11 23:58:54 +02:00
|
|
|
# 'audit'.
|
|
|
|
#
|
2012-06-05 16:32:43 +02:00
|
|
|
?BEGIN PERL;
|
2011-06-11 17:34:37 +02:00
|
|
|
use Shorewall::Config;
|
|
|
|
|
2011-07-03 16:22:29 +02:00
|
|
|
my ( $p1, $p2, $p3 , $p4, $p5 ) = get_action_params( 5 );
|
2011-06-11 17:34:37 +02:00
|
|
|
|
2012-04-24 23:52:57 +02:00
|
|
|
if ( defined $p1 ) {
|
2011-06-25 19:51:17 +02:00
|
|
|
if ( $p1 eq 'audit' ) {
|
2011-07-03 17:47:53 +02:00
|
|
|
set_action_param( 3, 'A_REJECT') unless supplied $p3;
|
|
|
|
set_action_param( 4, 'A_ACCEPT' ) unless supplied $p4;
|
|
|
|
set_action_param( 5, 'A_DROP' ) unless supplied $p5;
|
2011-06-25 19:51:17 +02:00
|
|
|
} else {
|
2011-07-03 17:47:53 +02:00
|
|
|
fatal_error "Invalid value ($p1) for first Reject parameter" if supplied $p1;
|
2011-06-25 19:51:17 +02:00
|
|
|
}
|
|
|
|
}
|
2011-06-11 17:34:37 +02:00
|
|
|
|
|
|
|
1;
|
|
|
|
|
2012-06-05 16:32:43 +02:00
|
|
|
?END PERL;
|
2011-06-11 17:34:37 +02:00
|
|
|
|
2013-05-14 19:44:26 +02:00
|
|
|
DEFAULTS -,-,REJECT,ACCEPT,DROP
|
2011-06-11 17:34:37 +02:00
|
|
|
|
2008-12-07 19:17:26 +01:00
|
|
|
#TARGET SOURCE DEST PROTO
|
|
|
|
#
|
2009-01-28 20:49:12 +01:00
|
|
|
# Count packets that come through here
|
|
|
|
#
|
|
|
|
COUNT
|
|
|
|
#
|
2013-05-14 19:44:26 +02:00
|
|
|
# Special handling for Auth
|
2008-12-07 19:17:26 +01:00
|
|
|
#
|
2013-05-14 19:44:26 +02:00
|
|
|
?if @2 ne '-'
|
2012-12-21 23:00:05 +01:00
|
|
|
Auth(@2)
|
2013-05-14 19:44:26 +02:00
|
|
|
?endif
|
2008-12-07 19:17:26 +01:00
|
|
|
#
|
|
|
|
# Drop Broadcasts so they don't clutter up the log
|
|
|
|
# (broadcasts must *not* be rejected).
|
|
|
|
#
|
2012-12-21 23:00:05 +01:00
|
|
|
Broadcast(DROP,@1)
|
2008-12-07 19:17:26 +01:00
|
|
|
#
|
|
|
|
# ACCEPT critical ICMP types
|
|
|
|
#
|
2012-12-21 23:00:05 +01:00
|
|
|
AllowICMPs(@4) - - icmp
|
2008-12-07 19:17:26 +01:00
|
|
|
#
|
|
|
|
# Drop packets that are in the INVALID state -- these are usually ICMP packets
|
|
|
|
# and just confuse people when they appear in the log (these ICMPs cannot be
|
|
|
|
# rejected).
|
|
|
|
#
|
2012-12-21 23:00:05 +01:00
|
|
|
Invalid(DROP,@1)
|
2008-12-07 19:17:26 +01:00
|
|
|
#
|
|
|
|
# Reject Microsoft noise so that it doesn't clutter up the log.
|
|
|
|
#
|
2012-12-21 23:00:05 +01:00
|
|
|
SMB(@3)
|
|
|
|
DropUPnP(@5)
|
2008-12-07 19:17:26 +01:00
|
|
|
#
|
|
|
|
# Drop 'newnotsyn' traffic so that it doesn't get logged.
|
|
|
|
#
|
2012-12-21 23:00:05 +01:00
|
|
|
NotSyn(DROP,@1) - - tcp
|
2008-12-07 19:17:26 +01:00
|
|
|
#
|
|
|
|
# Drop late-arriving DNS replies. These are just a nuisance and clutter up
|
|
|
|
# the log.
|
|
|
|
#
|
2012-12-21 23:00:05 +01:00
|
|
|
DropDNSrep(@5)
|