Diego-Garcia
(usa Linux Mint)
Enviado em 16/04/2013 - 17:25h
Todas as estações estão com Windows 7
Configuração dos arquivos:
=====interfaces=====
allow-hotplug eth0
iface eth0 inet static
address 192.168.1.254
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
allow-hotplug eth1
iface eth1 inet static
address 192.168.0.254
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
=====rc.local=====
/etc/rc.firewall
exit 0
=====rc.firewall=====
#!/bin/bash
# Limpa a tabela filter
iptables -F
# Limpa a tabela nat
iptables -t nat -F
# Limpa a tabela mangle
iptables -t mangle -F
# Habilita o roteamento no kernel #
echo 1 > /proc/sys/net/ipv4/ip_forward
# Compartilha a internet
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
# Liberando Squid
iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 80 -j REDIRECT --to-port 3128
#################
# REGRAS DE NAT #
#################
# Acesso externo
# Tecnicon
iptables -A FORWARD -p tcp --sport 9090 -j ACCEPT
iptables -A FORWARD -p tcp --dport 9090 -j ACCEPT
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 9090 -j DNAT --to-destination 192.168.0.2:9090
iptables -t nat -A PREROUTING -i eth0 -p udp --dport 9090 -j DNAT --to-destination 192.168.0.2:9090
# Cameras
iptables -A FORWARD -p tcp --sport 7070 -j ACCEPT
iptables -A FORWARD -p tcp --dport 7070 -j ACCEPT
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 7070 -j DNAT --to-destination 192.168.0.252:7070
iptables -t nat -A PREROUTING -i eth0 -p udp --dport 7070 -j DNAT --to-destination 192.168.0.252:7070
iptables -A FORWARD -p tcp --sport 4550 -j ACCEPT
iptables -A FORWARD -p tcp --dport 4550 -j ACCEPT
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 4550 -j DNAT --to-destination 192.168.0.252:4550
iptables -t nat -A PREROUTING -i eth0 -p udp --dport 4550 -j DNAT --to-destination 192.168.0.252:4550
iptables -A FORWARD -p tcp --sport 5550 -j ACCEPT
iptables -A FORWARD -p tcp --dport 5550 -j ACCEPT
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 5550 -j DNAT --to-destination 192.168.0.252:5550
iptables -t nat -A PREROUTING -i eth0 -p udp --dport 5550 -j DNAT --to-destination 192.168.0.252:5550
iptables -A FORWARD -p tcp --sport 8556 -j ACCEPT
iptables -A FORWARD -p tcp --dport 8556 -j ACCEPT
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 8556 -j DNAT --to-destination 192.168.0.252:8556
iptables -t nat -A PREROUTING -i eth0 -p udp --dport 8556 -j DNAT --to-destination 192.168.0.252:8556
iptables -A FORWARD -p tcp --sport 8866 -j ACCEPT
iptables -A FORWARD -p tcp --dport 8866 -j ACCEPT
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 8866 -j DNAT --to-destination 192.168.0.252:8866
iptables -t nat -A PREROUTING -i eth0 -p udp --dport 8866 -j DNAT --to-destination 192.168.0.252:8866
###################
# REGRAS DE INPUT #
###################
# Libera o squid a partir da rede interna
iptables -A INPUT -p tcp --dport 3128 -i eth1 -j ACCEPT
####################
# REGRAS DE OUTPUT #
####################
# Libera o acesso a clientes de E-Mail, POP, SMTP e Tecnicon
iptables -A FORWARD -p tcp -m multiport --dports 25,81,110,587,3050,4848,8080,9090 -j ACCEPT
# Libera DNS apenas para localhost
iptables -A OUTPUT -p tcp --dport 53 -j ACCEPT
iptables -A OUTPUT -p udp --dport 53 -j ACCEPT
# FIM DO SCRIPT DE FIREWALL #
=====squid.conf=====
# Configuração Squid
# Mensagens de erro em Português
error_directory /usr/share/squid3/errors/Portuguese
# Porta do Squid
http_port 3128 transparent
# Nome do servidor
visible_hostname Squid3
# Cache
cache_mem 64 MB
maximum_object_size_in_memory 32 KB
maximum_object_size 128 MB
minimum_object_size 0 KB
cache_swap_low 90
cache_swap_high 95
cache_dir ufs /var/spool/squid3 2048 16 256
# Logs de acesso
access_log /var/log/squid3/access.log squid
cache_log /var/log/squid3/cache.log
# Regras acl Padrao
acl manager proto cache_object
# Regras acl Definidas
acl localhost src 127.0.0.1/32
acl rede src 192.168.0.0/24
acl MCL arp "/etc/squid3/acls/MCL"
acl SB url_regex -i "/etc/squid3/acls/SB"
acl SL url_regex -i "/etc/squid3/acls/SL"
# Portas acl Padrao
acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
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
# Portas acl Definidas
acl SSL_ports port 30000 # bradesco
acl SSL_ports port 563 # snews
acl SSL_ports port 873 # rsync
acl Safe_ports port 631 # cups
acl Safe_ports port 873 # rsync
acl Safe_ports port 901 # SWAT
acl Safe_ports port 587 # smtp
acl Safe_ports port 110 # pop3
acl Safe_ports port 22 # ssh
acl Safe_ports port 30000 # bradesco
acl Safe_ports port 81 # tecnicon
acl Safe_ports port 4848 # tecnicon
acl Safe_ports port 8080 # tecnicon
acl Safe_ports port 3050 # tecnicon
acl Safe_ports port 403 # java
acl CONNECT method CONNECT
# Permissões e Bloqueios Padrao
http_access allow manager rede
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost
# Permissões e Bloqueios Definidos
http_access allow MCL
http_access deny SB !SL
http_access allow rede
http_access deny all
# Sistema Padrao
hierarchy_stoplist cgi-bin ?
coredump_dir /var/spool/squid3
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern . 0 20% 4320