mirror of
https://gitlab.com/shorewall/code.git
synced 2024-11-07 16:24:01 +01:00
Remove duplicate files
git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@3990 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
parent
74c19e8a44
commit
7f8ac172a2
File diff suppressed because it is too large
Load Diff
@ -302,6 +302,19 @@ install_file help ${PREFIX}/usr/share/shorewall/help 0544
|
||||
|
||||
echo "Help command executor installed in ${PREFIX}/usr/share/shorewall/help"
|
||||
|
||||
#
|
||||
# Install the Modules files
|
||||
#
|
||||
if [ ! -f ${PREFIX}/usr/share/shorewall/modules ]; then
|
||||
run_install $OWNERSHIP -m 0600 modules ${PREFIX}/usr/share/shorewall/modules
|
||||
echo "Modules file installed as ${PREFIX}/usr/share/shorewall/modules"
|
||||
fi
|
||||
|
||||
if [ ! -f ${PREFIX}/usr/share/shorewall/xmodules ]; then
|
||||
run_install $OWNERSHIP -m 0600 modules ${PREFIX}/usr/share/shorewall/xmodules
|
||||
echo "Xmodules file installed as ${PREFIX}/usr/share/shorewall/xmodules"
|
||||
fi
|
||||
|
||||
#
|
||||
# Create the version file
|
||||
#
|
||||
|
@ -46,290 +46,8 @@
|
||||
|
||||
VERSION=3.2.0-RC1
|
||||
|
||||
#
|
||||
# Suppress all output for a command
|
||||
#
|
||||
qt()
|
||||
{
|
||||
"$@" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
#
|
||||
# Split a colon-separated list into a space-separated list
|
||||
#
|
||||
split() {
|
||||
local ifs=$IFS
|
||||
IFS=:
|
||||
set -- $1
|
||||
echo $*
|
||||
IFS=$ifs
|
||||
}
|
||||
|
||||
#
|
||||
# Internal version of 'which'
|
||||
#
|
||||
mywhich() {
|
||||
local dir
|
||||
|
||||
for dir in $(split $PATH); do
|
||||
if [ -x $dir/$1 ]; then
|
||||
echo $dir/$1
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
return 2
|
||||
}
|
||||
|
||||
#
|
||||
# Load a Kernel Module
|
||||
#
|
||||
loadmodule() # $1 = module name, $2 - * arguments
|
||||
{
|
||||
local modulename=$1
|
||||
local modulefile
|
||||
local suffix
|
||||
moduleloader=modprobe
|
||||
|
||||
if ! qt mywhich modprobe; then
|
||||
moduleloader=insmod
|
||||
fi
|
||||
|
||||
if [ -z "$(lsmod | grep $modulename)" ]; then
|
||||
shift
|
||||
|
||||
for suffix in $MODULE_SUFFIX ; do
|
||||
modulefile=$MODULESDIR/${modulename}.${suffix}
|
||||
|
||||
if [ -f $modulefile ]; then
|
||||
case $moduleloader in
|
||||
insmod)
|
||||
insmod $modulefile $*
|
||||
;;
|
||||
*)
|
||||
modprobe $modulename $*
|
||||
;;
|
||||
esac
|
||||
|
||||
return
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Load kernel modules required for Shorewall
|
||||
#
|
||||
load_kernel_modules()
|
||||
{
|
||||
[ -z "$MODULESDIR" ] && \
|
||||
MODULESDIR=/lib/modules/$(uname -r)/kernel/net/ipv4/netfilter
|
||||
|
||||
#
|
||||
# Essential Modules
|
||||
#
|
||||
loadmodule nfnetlink
|
||||
loadmodule x_tables
|
||||
loadmodule ip_tables
|
||||
loadmodule iptable_filter
|
||||
loadmodule iptable_mangle
|
||||
loadmodule ip_conntrack
|
||||
loadmodule iptable_nat
|
||||
loadmodule xt_state
|
||||
loadmodule xt_tcpudp
|
||||
#
|
||||
# Other xtables modules
|
||||
#
|
||||
loadmodule xt_CLASSIFY
|
||||
loadmodule xt_connmark
|
||||
loadmodule xt_CONNMARK
|
||||
loadmodule xt_conntrack
|
||||
loadmodule xt_dccp
|
||||
loadmodule xt_helper
|
||||
loadmodule xt_length
|
||||
loadmodule xt_limit
|
||||
loadmodule xt_mac
|
||||
loadmodule xt_mark
|
||||
loadmodule xt_MARK
|
||||
loadmodule xt_NFQUEUE
|
||||
loadmodule xt_physdev
|
||||
loadmodule xt_pkttype
|
||||
loadmodule xt_tcpmss
|
||||
#
|
||||
# Helpers
|
||||
#
|
||||
loadmodule ip_conntrack_ftp
|
||||
loadmodule ip_conntrack_tftp
|
||||
loadmodule ip_conntrack_irc
|
||||
loadmodule iptable_nat
|
||||
loadmodule ip_nat_ftp
|
||||
loadmodule ip_nat_tftp
|
||||
loadmodule ip_nat_irc
|
||||
loadmodule ip_set
|
||||
loadmodule ip_set_iphash
|
||||
loadmodule ip_set_ipmap
|
||||
loadmodule ip_set_macipmap
|
||||
loadmodule ip_set_portmap
|
||||
#
|
||||
# Traffic Shaping
|
||||
#
|
||||
loadmodule sch_sfq
|
||||
loadmodule sch_ingress
|
||||
loadmodule sch_htb
|
||||
loadmodule cls_u32
|
||||
#
|
||||
# Extensions
|
||||
#
|
||||
loadmodule ipt_addrtype
|
||||
loadmodule ipt_ah
|
||||
loadmodule ipt_CLASSIFY
|
||||
loadmodule ipt_CLUSTERIP
|
||||
loadmodule ipt_comment
|
||||
loadmodule ipt_connmark
|
||||
loadmodule ipt_CONNMARK
|
||||
loadmodule ipt_conntrack
|
||||
loadmodule ipt_dscp
|
||||
loadmodule ipt_DSCP
|
||||
loadmodule ipt_ecn
|
||||
loadmodule ipt_ECN
|
||||
loadmodule ipt_esp
|
||||
loadmodule ipt_hashlimit
|
||||
loadmodule ipt_helper
|
||||
loadmodule ipt_ipp2p
|
||||
loadmodule ipt_iprange
|
||||
loadmodule ipt_length
|
||||
loadmodule ipt_limit
|
||||
loadmodule ipt_LOG
|
||||
loadmodule ipt_mac
|
||||
loadmodule ipt_mark
|
||||
loadmodule ipt_MARK
|
||||
loadmodule ipt_MASQUERADE
|
||||
loadmodule ipt_multiport
|
||||
loadmodule ipt_NETMAP
|
||||
loadmodule ipt_NOTRACK
|
||||
loadmodule ipt_owner
|
||||
loadmodule ipt_physdev
|
||||
loadmodule ipt_pkttype
|
||||
loadmodule ipt_policy
|
||||
loadmodule ipt_realm
|
||||
loadmodule ipt_recent
|
||||
loadmodule ipt_REDIRECT
|
||||
loadmodule ipt_REJECT
|
||||
loadmodule ipt_SAME
|
||||
loadmodule ipt_sctp
|
||||
loadmodule ipt_set
|
||||
loadmodule ipt_state
|
||||
loadmodule ipt_tcpmss
|
||||
loadmodule ipt_TCPMSS
|
||||
loadmodule ipt_tos
|
||||
loadmodule ipt_TOS
|
||||
loadmodule ipt_ttl
|
||||
loadmodule ipt_TTL
|
||||
loadmodule ipt_ULOG
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
# Determine which optional facilities are supported by iptables/netfilter
|
||||
#
|
||||
determine_capabilities() {
|
||||
[ -z "$IPTABLES" ] && IPTABLES=$(mywhich iptables)
|
||||
|
||||
[ -z "$IPTABLES" ] && { echo "ERROR: Can't find IPTABLES executable" ; exit 2; }
|
||||
|
||||
qt $IPTABLES -t nat -L -n && NAT_ENABLED=Yes || NAT_ENABLED=
|
||||
qt $IPTABLES -t mangle -L -n && MANGLE_ENABLED=Yes || MANGLE_ENABLED=
|
||||
|
||||
CONNTRACK_MATCH=
|
||||
MULTIPORT=
|
||||
XMULTIPORT=
|
||||
POLICY_MATCH=
|
||||
PHYSDEV_MATCH=
|
||||
IPRANGE_MATCH=
|
||||
RECENT_MATCH=
|
||||
OWNER_MATCH=
|
||||
IPSET_MATCH=
|
||||
CONNMARK=
|
||||
CONNMARK_MATCH=
|
||||
RAW_TABLE=
|
||||
IPP2P_MATCH=
|
||||
LENGTH_MATCH=
|
||||
CLASSIFY_TARGET=
|
||||
ENHANCED_REJECT=
|
||||
USEPKTTYPE=
|
||||
KLUDGEFREE=
|
||||
MARK=
|
||||
XMARK=
|
||||
MANGLE_FORWARD=
|
||||
|
||||
qt $IPTABLES -N fooX1234
|
||||
qt $IPTABLES -A fooX1234 -m conntrack --ctorigdst 192.168.1.1 -j ACCEPT && CONNTRACK_MATCH=Yes
|
||||
qt $IPTABLES -A fooX1234 -p tcp -m multiport --dports 21,22 -j ACCEPT && MULTIPORT=Yes
|
||||
qt $IPTABLES -A fooX1234 -p tcp -m multiport --dports 21:22 -j ACCEPT && XMULTIPORT=Yes
|
||||
qt $IPTABLES -A fooX1234 -m policy --pol ipsec --mode tunnel --dir in -j ACCEPT && POLICY_MATCH=Yes
|
||||
|
||||
if qt $IPTABLES -A fooX1234 -m physdev --physdev-in eth0 -j ACCEPT; then
|
||||
PHYSDEV_MATCH=Yes
|
||||
qt $IPTABLES -A fooX1234 -m physdev --physdev-in eth1 -m physdev --physdev-out eth1 -j ACCEPT && KLUDGEFREE=Yes
|
||||
fi
|
||||
|
||||
if qt $IPTABLES -A fooX1234 -m iprange --src-range 192.168.1.5-192.168.1.124 -j ACCEPT; then
|
||||
IPRANGE_MATCH=Yes
|
||||
if [ -z "${KLUDGEFREE}${PHYSDEV_MATCH}" ]; then
|
||||
qt $IPTABLES -A fooX1234 -m iprange --src-range 192.168.1.5-192.168.1.124 -m iprange --dst-range 192.168.1.5-192.168.1.124 -j ACCEPT && KLUDGEFREE=Yes
|
||||
fi
|
||||
fi
|
||||
|
||||
qt $IPTABLES -A fooX1234 -m recent --update -j ACCEPT && RECENT_MATCH=Yes
|
||||
qt $IPTABLES -A fooX1234 -m owner --uid-owner 0 -j ACCEPT && OWNER_MATCH=Yes
|
||||
|
||||
if qt $IPTABLES -A fooX1234 -m connmark --mark 2 -j ACCEPT; then
|
||||
CONNMARK_MATCH=Yes
|
||||
qt $IPTABLES -A fooX1234 -m connmark --mark 2/0xFF -j ACCEPT && XCONNMARK_MATCH=Yes
|
||||
fi
|
||||
|
||||
qt $IPTABLES -A fooX1234 -p tcp -m ipp2p --ipp2p -j ACCEPT && IPP2P_MATCH=Yes
|
||||
qt $IPTABLES -A fooX1234 -m length --length 10:20 -j ACCEPT && LENGTH_MATCH=Yes
|
||||
qt $IPTABLES -A fooX1234 -j REJECT --reject-with icmp-host-prohibited && ENHANCED_REJECT=Yes
|
||||
|
||||
if [ -n "$MANGLE_ENABLED" ]; then
|
||||
qt $IPTABLES -t mangle -N fooX1234
|
||||
|
||||
if qt $IPTABLES -t mangle -A fooX1234 -j MARK --set-mark 1; then
|
||||
MARK=Yes
|
||||
qt $IPTABLES -t mangle -A fooX1234 -j MARK --and-mark 0xFF && XMARK=Yes
|
||||
fi
|
||||
|
||||
if qt $IPTABLES -t mangle -A fooX1234 -j CONNMARK --save-mark; then
|
||||
CONNMARK=Yes
|
||||
qt $IPTABLES -t mangle -A fooX1234 -j CONNMARK --save-mark --mask 0xFF && XCONNMARK=Yes
|
||||
fi
|
||||
|
||||
qt $IPTABLES -t mangle -A fooX1234 -j CLASSIFY --set-class 1:1 && CLASSIFY_TARGET=Yes
|
||||
qt $IPTABLES -t mangle -F fooX1234
|
||||
qt $IPTABLES -t mangle -X fooX1234
|
||||
qt $IPTABLES -t mangle -L FORWARD -n && MANGLE_FORWARD=Yes
|
||||
fi
|
||||
|
||||
qt $IPTABLES -t raw -L -n && RAW_TABLE=Yes
|
||||
|
||||
if qt mywhich ipset; then
|
||||
qt ipset -X fooX1234 # Just in case something went wrong the last time
|
||||
|
||||
if qt ipset -N fooX1234 iphash ; then
|
||||
if qt $IPTABLES -A fooX1234 -m set --set fooX1234 src -j ACCEPT; then
|
||||
qt $IPTABLES -D fooX1234 -m set --set fooX1234 src -j ACCEPT
|
||||
IPSET_MATCH=Yes
|
||||
fi
|
||||
qt ipset -X fooX1234
|
||||
fi
|
||||
fi
|
||||
|
||||
qt $IPTABLES -A fooX1234 -m pkttype --pkt-type broadcast -j ACCEPT && USEPKTTYPE=Yes
|
||||
|
||||
qt $IPTABLES -F fooX1234
|
||||
qt $IPTABLES -X fooX1234
|
||||
}
|
||||
. /usr/share/shorewall/functions
|
||||
. /usr/share/shorewall/configpath
|
||||
|
||||
report_capability() # $1 = Capability
|
||||
{
|
||||
@ -367,6 +85,7 @@ report_capabilities() {
|
||||
report_capability MANGLE_FORWARD
|
||||
}
|
||||
|
||||
VERBOSE=0
|
||||
load_kernel_modules
|
||||
determine_capabilities
|
||||
report_capabilities
|
||||
|
Loading…
Reference in New Issue
Block a user