fabiopedrosa
(usa Debian)
Enviado em 14/12/2009 - 11:45h
Basicamente meu IPTABLES está assim
# !/bin/bash
REDE1=10.0.10.0/24
REDE2=10.0.20.0/24
iptables=/sbin/iptables
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
modprobe ip_tables
modprobe ip_tables
modprobe ip_conntrack
modprobe ip_conntrack_ftp
modprobe ipt_REDIRECT
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT
iptables -A INPUT -i lo -j ACCEPT
echo "1" > /proc/sys/net/ipv4/ip_forward
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -s $REDE1 -p tcp --dport 3128 -j ACCEPT
iptables -A INPUT -s $REDE2 -p tcp --dport 3128 -j ACCEPT
iptables -A INPUT -s $REDE1 -p tcp --dport 53 -j ACCEPT
iptables -A INPUT -s $REDE2 -p udp --dport 53 -j ACCEPT
iptables -t nat -A POSTROUTING -s $REDE1 -o eth0 -j MASQUERADE
iptables -t nat -A POSTROUTING -s $REDE2 -o eth0 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/tcp_syncookies
for f in /proc/sys/net/ipv4/conf/*/accept_source_route; do
echo 0 > $f
done
iptables -A INPUT -p tcp -s $REDE1 -j ACCEPT
iptables -A INPUT -p udp -s $REDE1 -j ACCEPT
iptables -A INPUT -p tcp -s $REDE2 -j ACCEPT
iptables -A INPUT -p udp -s $REDE2 -j ACCEPT
iptables -A FORWARD -i eth1 -s $REDE1 -j ACCEPT
iptables -A FORWARD -i eth2 -s $REDE2 -j ACCEPT
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -j DROP
iptables -A INPUT -j DROP
E o SQUID...
http_port 3128
visible_hostname proxy-local
hierarchy_stoplist cgi-bin ?
acl QUERY urlpath_regex cgi-bin \?
no_cache deny QUERY
cache_mem 32 MB
hosts_file /etc/hosts
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern . 0 20% 4320
request_body_max_size 0 MB
acl all src 0.0.0.0/0.0.0.0
acl localhost src 127.0.0.1/255.255.255.255
acl to_localhost dst 127.0.0.0/8
acl rede1 src 10.0.10.0/24
acl rede2 src 10.0.20.0/24
acl manager proto cache_object
acl SSL_ports port 443 563 # https, snews
acl SSL_ports port 873 # rsync
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 20 # ftp
acl Safe_ports port 443 563 # https, snews
acl Safe_ports port 70 # gopher
acl Safe_ports port 3456 # DIRF
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl Safe_ports port 631 # cups
acl Safe_ports port 873 # rsync
acl Safe_ports port 901 # SWAT
acl purge method PURGE
acl CONNECT method CONNECT
http_access allow manager localhost
http_access deny manager
http_access allow purge localhost
http_access deny purge
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost
http_access allow rede1
http_access allow rede2
http_reply_access allow all
icp_access allow all
http_access deny all
cache_access_log /var/log/squid/access.log
cache_log /var/log/squid/cache.log
coredump_dir /var/spool/squid
error_directory /usr/share/squid/errors/Portuguese/
deny_info ERRO downloads
deny_info ERRO all
####################
Daí é só criar as regras de liberação ou bloqueio e aplicar a cada rede
####################
Espero ter ajudado!! :))