daniel_4fun
(usa Debian)
Enviado em 25/07/2011 - 13:59h
Ola galera do VOL, estou com uma grande tarefa a cumprir..
atualmente tenho uma maquina Debian com squid autenticado...
gostaria de deixar a estrutura dessa forma;
modem > servidor > switch > maquinas...
nada espetacular, mas nao estou conseguindo obter sucesso com minhas configurações, entao recorri ao VOL..
vou passar aqui algumas informaçoes da minha rede
gateway (modem) > 192.168.254.254
eth0 do servidor > 192.168.254.201
eth1 do servidor > 10.1.100.1
vou passar tbm meu squid.conf , minha cfg de firewall, e meu dhcp.conf...
se puderem me ajudar, por menor q seja a ajuda, ja será de GRANDE importancia para que eu consigo realizar esse trabalho, OBRG..
############### DHCPD.CONF
ddns-update-style none;
default-lease-time 600;
max-lease-time 7200;
authoritative;
log-facility local7;
subnet 10.1.100.0 netmask 255.255.255.0 {
range 10.1.100.10 10.1.100.150;
option domain-name-servers 208.67.222.222,208.67.220.220;
option domain-name "tuxnetwork.local.net";
option routers 192.168.254.254;
option broadcast-address 192.168.254.255;
}
######################## SQUID.CONF
##################################################################
# LIBERANDO PROXY PARA AUTENTICACAO #
##################################################################
auth_param basic program /usr/lib/squid/ncsa_auth /etc/squid/passwd
#
#
###############################################################
#LIBERANDO PROXY PARA AUTENTICACAO #
###############################################################
auth_param basic children 5
#
#
###############################################################
#LIBERANDO PROXY PARA AUTENTICACAO #
###############################################################
auth_param basic realm Digite sua senha
#
#
##################################################################
## LIBERANDO PROXY PARA AUTENTICACAO #
##################################################################
auth_param basic credentialsttl 2 hours
#
#
##################################################################
## LIBERANDO PROXY PARA AUTENTICACAO - DESCOMENTAR LINHA ABAIXO ##
##################################################################
auth_param basic casesensitive off
#
#
#
#Recommended minimum configuration:
acl all src all
acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl to_localhost dst 127.0.0.0/8
#
# Example rule allowing access from your local networks.
# Adapt to list your (internal) IP networks from where browsing
# should be allowed
acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
#
###################################
# ACLS FEITAS PELO ADMIN DA ReDe #
###################################
###################################
acl redelocal src 192.168.254.0/24
#
#
#
#
################################################
# ESTA ACL FAZ COM QUE O PROXY PECA AUTENTICACAO
################################################
#
acl autenticados proxy_auth REQUIRED
#
#
#
#
#######################################################
# ESTA ACL LIBERA ACESSO AOS SITES DO ARQUIVO LIBERADOS
#######################################################
#
acl liberados url_regex -i "/etc/squid/liberados"
#
#
#
#
#############################################################
# ESTA ACL INDICA O SITES BLOQUEADOS PELO ARQUIVO OPERACIONAL
#############################################################
#
acl operacional url_regex -i "/etc/squid/operacional"
#
#
#
#
############################
# ESTA ACL BLOQUEIA DOWNLOAD
############################
#
acl nodown urlpath_regex -i "/etc/squid/nodown"
#
#
#
#
#################################################
# ESTA ACL LIBERA ACESSO A ALGUMS SITES NO ALMOCO
#################################################
acl entretenimento url_regex "/etc/squid/entretenimento"
acl intervalo time MTWHF 12:00-13:15
#
http_access allow entretenimento intervalo
#
#
################################################
# USUARIOS COM ACESSO LIVRE
################################################
# basta criar o usuario com o comando htpasswd passwd user_name
# depois inserir o nome do usuario no arquivo usr_livre
#
acl acesso_livre proxy_auth "/etc/squid/listas/usr_livre"
#
http_access allow acesso_livre
#
#
#
#
################################################
# USUARIOS COM ACESSO CONTROLADO
################################################
#
# acl acesso_restrito proxy_auth "/etc/squid/listas/usr_restrito"
# acl url_bloqueado url_regex -i "/etc/squid/listas/url_bloqueado"
#
# http_access deny url_bloqueado
# http_access allow acesso_restrito !url_bloqueado
#
#
#
#
#
################################################
# USUARIOS COM ACESSO APENAS AOS SITES LIBERADOS
################################################
#
# acl acesso_bloqueado proxy_auth "/etc/squid/listas/usr_bloqueado"
# acl url_liberados url_regex -i "/etc/squid/listas/url_liberados"
#
#http_access allow url_liberado
#http_access deny acesso_bloqueado !url_liberado
#
#
#
#
################################################
# ESTA ACL BLOQUEIA STREAMING
################################################
#
#
acl streaming req_mime_type ^video/x-ms-asf
#acl proibir_musica urlpath_regex -i "/etc/squid/streaming"
acl proibir_musica urlpath_regex -i .aif$ .aifc$ .aiff$ .asf$ .asx$ .avi$ .au$ .flv$ .m3u$ .med$ .mp3$ .m1v$ .mp2$ .mp2v$ .mpa$ .mov$ .mpe$ .mpg$ .mpeg$ .ogg$ .pls$ .ram$ .ra$ .ram$ .snd$ .wma$ .wmv$ .wvx$ .mid$ .midi$ .rmi$
#
#
# AQUI SE ENCERRAM AS ACL's #############
#
#
#
acl SSL_ports port 443 # https
acl SSL_ports port 563 # snews
acl SSL_ports port 873 # rsync
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
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
# Only allow cachemgr access from localhost
http_access allow manager localhost
http_access deny manager
# Only allow purge requests from localhost
http_access allow purge localhost
http_access deny purge
# Deny requests to unknown ports
http_access deny !Safe_ports
# Deny CONNECT to other than SSL ports
http_access deny CONNECT !SSL_ports
#
#http_access allow localnet
http_access allow localhost
#
#
#
#######################################
# REGRAS INSERIDAS PELO ADMIN DA REDE #
#######################################
#
#
#
#
#
http_access allow liberados
http_access deny operacional
http_access deny nodown
http_access deny proibir_musica
http_reply_access deny streaming
http_access allow autenticados
http_access allow redelocal
http_access deny all
#
#
#
#
#
#
#
#
#Allow ICP queries from local networks only
icp_access allow localnet
icp_access deny all
# PORTA DO SQUID
http_port 3128 transparent
# MEMORY CACHE OPTIONS
# -----------------------------------------------------------------------------
# ----- MEMORIA RESERVADA PARA O CACHE ---- #
#
#
cache_mem 1024 MB
#
#Default:
maximum_object_size_in_memory 4000 KB
## Para ele limpar o cache RAM e cache DISCO automaticamente ##
memory_replacement_policy lru
# DISK CACHE OPTIONS
#Para ele limpar a memoria CACHE no DISCO
cache_replacement_policy lru
#
#Default:
cache_dir ufs /var/spool/squid 4000 16 256
#Maximo tamanho dos arquivos cache no HD
maximum_object_size 2480 KB
#
# REGRA QUE COMECA A ESVAZIAR/SUBSTITUIR ARQUIVOS NO CACHE EM 95 %
cache_swap_low 90
cache_swap_high 95
# Logs do Squid
access_log /var/log/squid/access.log squid
#
cache_log /var/log/squid/cache.log
#
#Default:
# mime_table /usr/share/squid/mime.conf
#
#Suggested default:
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern (Release|Package(.gz)*)$ 0 20% 2880
refresh_pattern . 0 20% 4320
#
# Don't upgrade ShoutCast responses to HTTP
acl shoutcast rep_header X-HTTP09-First-Line ^ICY\s[0-9]
upgrade_http0.9 deny shoutcast
#
# Apache to signal ETag correctly on such responses
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache
#
# You can add up to 20 additional "extension" methods here.
extension_methods REPORT MERGE MKACTIVITY CHECKOUT
# -----------------------------------------------------------------------------
# cache_mgr webmaster
#Default:
# hosts_file /etc/hosts
#
hosts_file /etc/hosts
####FIREWALL.SH
#!/bin/bash
echo "Ativando Firewall..."
# Limpando Tabelas
iptables -F
iptables -t filter -F
iptables -t nat -F
iptables -t mangle -F
# Politica padrao
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT
# Tabela NAT
iptables -t nat -P PREROUTING ACCEPT
iptables -t nat -P OUTPUT ACCEPT
iptables -t nat -P POSTROUTING ACCEPT
#Tabela mangle
iptables -t mangle -P PREROUTING ACCEPT
iptables -t mangle -P OUTPUT ACCEPT
# Aceitar Pacotes Estabilziados
iptables -t filter -A INPUT -m state --state ESTABLISHED -j ACCEPT
iptables -t filter -A FORWARD -m state --state ESTABLISHED -j ACCEPT
iptables -t filter -A OUTPUT -m state --state ESTABLISHED -j ACCEPT
# Carregando Modulos
modprobe ip_tables
modprobe ip_nat_ftp
modprobe ip_conntrack_ftp
modprobe ip_conntrack
modprobe iptable_filter
modprobe iptable_nat
modprobe ipt_state
modprobe ipt_limit
modprobe ipt_LOG
modprobe ipt_MASQUERADE
# Bloqueando MSN
iptables -A FORWARD -d 64.4.13.0/24 -j REJECT
iptables -A FORWARD -s 0/0 -p tcp --dport 1863 -j REJECT
iptables -A FORWARD -s 0/0 -d 207.46.104.20 -j REJECT
# Rede_Interna
iptables -A FORWARD -s 192.168.0.0/24 -p tcp --dport 1863 -j ACCEPT
iptables -A FORWARD -s 192.168.0.0/24 -d loginnet.passport.com -j ACCEPT
# Desabilita resposta para ping
echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all
# Desabilita port scan
echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
# Desabilita redirecionamento de ICMP
for f in /proc/sys/net/ipv4/conf/*/accept_redirects; do
echo 0 >$f
done
# Protecao contra IP spoofing
for i in /proc/sys/net/ipv4/conf/*/rp_filter; do
echo 1 >$i
done
# Protecao contra synflood
echo "1" > /proc/sys/net/ipv4/tcp_syncookies
# Ativando protecao contra responses bogus
echo 1 > /proc/sys/net/ipv4/icmp_ignore_bogus_error_responses
# Protecao contra worms
iptables -A FORWARD -p tcp --dport 135 -j DROP
iptables -A INPUT -p tcp --dport 135 -j DROP
# Descarte de pacotes nao identificados ICMP
iptables -A OUTPUT -m state -p icmp --state INVALID -j DROP
iptables -A INPUT -m state -p icmp --state INVALID -j DROP
iptables -A FORWARD -m state -p icmp --state INVALID -j DROP
# Impedindo ataque Ping of Death
iptables -A FORWARD -p icmp --icmp-type echo-request -m limit --limit 1/s -j ACCEPT
# Impedindo ataque de Denial Of Service -DOS-
iptables -A FORWARD -p tcp -m limit --limit 1/s -j ACCEPT
# Impedindo ataque Port Scanners
iptables -A FORWARD -p tcp --tcp-flags SYN,ACK,FIN,RST RST -m limit --limit 1/s -j ACCEPT
iptables -A FORWARD --protocol tcp --tcp-flags ALL SYN,ACK -j DROP
# Bloqueia traceroute
iptables -A INPUT -p udp --dport 33435:33525 -j DROP
# Bloquear Back Orifice:
iptables -A INPUT -p tcp --dport 31337 -j DROP
iptables -A INPUT -p udp --dport 31337 -j DROP
# Bloquear NetBus:
iptables -A INPUT -p tcp --dport 12345:12346 -j DROP
iptables -A INPUT -p udp --dport 12345:12346 -j DROP
# Libera Trafego Local
iptables -A INPUT -i lo -j ACCEPT
# Abrindo http e https
iptables -t filter -A FORWARD -p tcp --dport 80 -j ACCEPT
iptables -t filter -A FORWARD -p tcp --dport 443 -j ACCEPT
# "Bloqueando o LogMeIn"
iptables -t filter -A FORWARD -p tcp --dport 2002 -j DROP
iptables -t filter -A FORWARD -d 69.209.251.0/24 -j DROP
iptables -t filter -A FORWARD -s 69.209.251.0/24 -j DROP
# Bloqueando Samba para acesso externo
iptables -t filter -A INPUT -p tcp --dport 137 -j DROP
iptables -t filter -A INPUT -p tcp --dport 138 -j DROP
iptables -t filter -A INPUT -p tcp --dport 139 -j DROP
# Liberando Conexao OPENVPN
#iptables -t filter -A INPUT -p udp --dport 5555 -j ACCEPT
#iptables -t filter -A FORWARD -p udp --dport 5555 -j ACCEPT
# Liberando TEDSEF
iptables -t filter -A FORWARD -p tcp -i eth1 -d 200.199.34.41 -j ACCEPT
# Liberando Sintegra
iptables -t filter -A FORWARD -p tcp -i eth1 --dport 8017 -j ACCEPT
# Liberando a atualizacao do Ad-ware
iptables -t filter -A FORWARD -s 192.168.0.0/24 -d 82.99.19.14/28 -p tcp --dport 80 -j ACCEPT
iptables -t filter -A FORWARD -s 192.168.0.0/24 -d 207.44.136.40 -p tcp --dport 80 -j ACCEPT
iptables -t filter -A FORWARD -s 192.168.0.0/24 -d 72.246.49.42/27 -p tcp --dport 80 -j ACCEPT
# Liberando acesso a servidor Apache.
#iptables -t filter -A INPUT -i ppp0 -p tcp -s 0/0 --sport 8080 -j ACCEPT
#iptables -t filter -A INPUT -i ppp0 -p tcp -s 0/0 --dport 8080 -j ACCEPT
#iptables -t filter -A INPUT -i ppp0 -p tcp -s 0/0 --sport 80 -j ACCEPT
#iptables -t filter -A INPUT -i ppp0 -p tcp -s 0/0 --dport 80 -j ACCEPT
# Liberando consulta em servidor de Dns.
#iptables -t filter -A INPUT -i ppp0 -p tcp -s 0/0 --sport 53 -j ACCEPT
#iptables -t filter -A INPUT -i eth0 -p tcp -s 0/0 --sport 53 -j ACCEPT
# Liberando Acesso FTP
#iptables -t filter -A INPUT -i ppp0 -p tcp -s 0/0 --dport 8660 -j DROP
#iptables -t filter -A INPUT -i eth1 -p tcp -s 0/0 --dport 8660 -j ACCEPT
#iptables -t filter -A INPUT -i eth2 -p tcp -s 0/0 --dport 8660 -j ACCEPT
#iptables -t filter -A INPUT -i eth3 -p tcp -s 0/0 --dport 8660 -j ACCEPT
# Libera acesso EXTERNO para SSH
# SSH Mac Address
#iptables -A INPUT -i ppp0 -m mac --mac-source 02:00:4C:4F:4F:50 -p tcp --dport 9999 -j ACCEPT
iptables -t filter -A INPUT -i ppp0 -p tcp -s 0/0 --dport 9999 -j ACCEPT
iptables -t filter -A INPUT -i eth0 -p tcp -s 0/0 --dport 9999 -j DROP
iptables -t filter -A INPUT -i eth1 -p tcp -s 0/0 --dport 9999 -j ACCEPT
# Liberando smtp e pop
#iptables -t filter -A INPUT -p tcp --dport 110 -j ACCEPT
#iptables -t filter -A INPUT -p tcp --dport 25 -j ACCEPT
iptables -t filter -A OUTPUT -p tcp --dport 110 -j ACCEPT
iptables -t filter -A OUTPUT -p tcp --dport 25 -j ACCEPT
iptables -t filter -A FORWARD -p tcp -s 0/0 -d 0/0 --dport 25 -j ACCEPT
iptables -t filter -A FORWARD -p tcp -s 0/0 -d 0/0 --dport 110 -j ACCEPT
# Liberando conexao cmt.caixa.gov.br
iptables -t nat -A PREROUTING -s 192.168.0.0/24 -p tcp -d cmt.caixa.gov.br --dport 80 -j RETURN
iptables -t nat -A PREROUTING -s 192.168.0.0/24 -p tcp -d 200.201.174.0/24 --dport 80 -j RETURN
# Liberando Conectividade Social
iptables -t nat -A PREROUTING -i eth1 -p tcp -d 200.255.42.71 --dport 80 -j ACCEPT
# Sefip / CNS
iptables -t nat -A PREROUTING -p tcp -d 200.201.0.0/16 -j ACCEPT
iptables -A FORWARD -p tcp -d 200.201.0.0/16 -j ACCEPT
# Programa Boleto sicoob
iptables -t nat -A PREROUTING -s 192.168.0.0/24 -p tcp -d 200.252.146.0/24 --dport 80 -j RETURN
# Redirecionando Acesso remoto via Terminal Server
#iptables -t nat -A PREROUTING -p tcp -i ppp0 --dport 3389 -j DNAT --to-destination 129.12.70.110:3389
#iptables -t nat -A PREROUTING -p udp -i ppp0 --dport 3389 -j DNAT --to-destination 129.12.70.110:3389
#iptables -A INPUT -p tcp -i ppp0 -s 0/0 --dport 3389 --syn -j ACCEPT
# Redirecionamento da porta 1435 para acesso remoto do SQL
#iptables -t nat -A PREROUTING -p tcp -i ppp0 --dport 1435 -j DNAT --to-destination 129.12.70.110:1435
#iptables -t nat -A PREROUTING -p tcp -i ppp0 --dport 1433 -j DNAT --to-destination 129.12.70.110:1433
# Redirecionando acesso porta 5900 (VNC) para micro da rede local
#iptables -t nat -A PREROUTING -p tcp -i ppp0 --dport 5900 -j DNAT --to-destination 10.6.0.2:5900
# Priorizando tráfego na porta 80
#iptables -t mangle -A INPUT -p tcp --dport 80 -j TOS --set-tos 16
# Bloqueando Emule
iptables -A FORWARD -p tcp -m multiport --dport 4661,4711,4662,4665,4672 -j DROP
iptables -A FORWARD -p udp -m multiport --dport 4662,4672,4665 -j DROP
# Bloqueando IMesh
iptables -A FORWARD -d 216.35.208.0/24 -j DROP
# Bloqueando Bearshare
iptables -A FORWARD -p tcp --dport 6346 -j DROP
# Bloqueando ToadNode
iptables -A FORWARD -p tcp --dport 6346 -j DROP
# Bloqueando WinMX
iptables -A FORWARD -d 209.61.186.0/24 -j DROP
iptables -A FORWARD -d 64.49.201.0/24 -j DROP
# Bloqueando Napigator
iptables -A FORWARD -d 209.25.178.0/24 -j DROP
# Bloqueando Morpheus
iptables -A FORWARD -d 206.142.53.0/24 -j DROP
iptables -A FORWARD -p tcp --dport 1214 -j DROP
# Bloqueando KaZaA
iptables -A FORWARD -d 213.248.112.0/24 -j DROP
iptables -A FORWARD -p tcp --dport 1214 -j DROP
# Bloqueando Limewire
iptables -A FORWARD -p tcp --dport 6346 -j DROP
# Bloqueando Audiogalaxy
iptables -A FORWARD -d 64.245.58.0/23 -j DROP
# Bloqueando AIM
iptables -A FORWARD -p tcp --dport 5190 -j DROP
iptables -A FORWARD -d 64.12.161.153/24 -j DROP
# Bloqueando ICQ
iptables -A FORWARD -p tcp --dport 5190 -j DROP
iptables -A FORWARD -d 205.188.153.121/24 -j DROP
# Bloqueando Yahoo Messenger
iptables -A FORWARD -d 216.136.233.138/24 -j DROP
# Bloqueando Napster
iptables -A FORWARD -d 64.124.41.0/24 -j DROP
# Bloqueando Bittorent
iptables -A FORWARD -p tcp --dport 6881:6889 -j DROP
iptables -A FORWARD -p tcp --dport 6881:6889 -j DROP
# Redirecionando Porta 80 para 3128
#iptables -t nat -A PREROUTING -p tcp -m multiport --dport 80,443 -j REDIRECT --to-port 3128
# roteando velox para rede
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o ppp0 -j MASQUERADE
# ativando Roteamento no kernel
echo 1 > /proc/sys/net/ipv4/ip_forward
# Libera ADSL Velox para toda Rede
iptables -A FORWARD -i ppp0 -j ACCEPT
# Liberando trafego para Rede Interna
iptables -A INPUT -s 192.168.0.0/24 -j ACCEPT
iptables -A FORWARD -s 192.168.0.0/24 -j ACCEPT
iptables -A OUTPUT -s 192.168.0.0/24 -j ACCEPT
echo "Reagras Adicionadas..."
muito do que tem aqui eu procurei aqui msm no vivaolinux... se puderem me indicar possiveis erros no mascaremento do ip eu agradeço.. VLWWWWWWWWWWWW!