moura64
(usa Debian)
Enviado em 04/06/2014 - 14:05h
Boa tarde
segue o meu Firewall/Squid
Bem meus amigos eu tenho um modem ADSL OI QUE RODA 192.168.1.1 NA ETH0 (DHCP)
ETH1 192.168.0.1
O FIREWALL NAO ESTA DISTRIBUINDO IP NA REDE ETH1.
O SQUID RODA SEM ERRO:
SEGUE MINHAS CONFIGURAÇÕES
Uso modem adsl da oi-rj
#Configuração do IP Estático#
Vi /etc/network/interfaces
auto eth0
iface eth0 inet dhcp
Auto eth1
Iface eth1 inet static
Address 192.168.0.1
Netmask 255.255.255.0
Network 192.168.0.0
Broadcast 192.168.0.255
CONFIGURANDO DHCP
Vi /etc/dhcp/dhcpd.conf
Ddns-update-style interim;
Default-lease-time 600;
Max-lease-time 7200;
Option subnet-mask 255.255.255.0;
Option broadcast-address 192.168.0.255
Option domain-name servers 192.168.0.1,8.8.8.8,8.8.4.4;
Subnet 192.168.0.0 netmask 255.255.255.0 {range 192.168.0.1 192.168.0.254;}
INICIANDO BIND
Service bind9 start
Nslookupp – 127.0.0.1
CONFIGURANDO SQUID
http_port 3128 transparent
visible_hostname firewall
#proxy transparent com autenticação não funciona error_directory /usr/share/squid/errors/potuguese/
Cachê_mem 64 mb
Maximum_object_size_in_memory 64 kb
Maximum_object_size 512 mb
Manimum_object_size 0 kb
Cache_swap_low 50
Cache_swap_hight 70
Cache_dir ufs /var/spool/squid 2048 16 256
Cache_access_log /var/log/squid/access.log
#cache_store_log /var/log/squid/store.log
#cache_swap_log /var/log/squid/cache_swap.log
Refresh_pattern ^ftp: 15 20% 2280
Refresh_pattern ^gopher: 15 0% 2280
Refresh_pathern . 15 20% 2280
Acl all src 0.0.0.0/0.0.0.0
Acl manager proto cache_object
Acl loaclhost src 127.0.0.1/255.255.255.255
Acl SSL_ports port 22 995 993 465
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 !safe_ports
http_access deny CONNECT !SSL _ports
#Validação da rede local
Acl redelocal src 192.168.0.0/24
# Bloqueio de Sites
#acl sites url_regex –i “/etc/squid/bloqueados/sites”
#http_access deny sites
#acl porno url_regex –i “/etc/squid/bloqueados/porno”
#http_access deny pornô
#Bloqueios de arquivos por extensão
#acl extensão urlpath_regex –i “/etc/squid/bloqueados/extensão”
#http_access deny extensão
#controle de banda de accesso a internet
#15728640= 15mb de banda contratada junto a operadora = 15 mb/s
#1048576 = 1 mb de banda controlada =128 kb/s de velocidade máxima de download por usuário
# 2097152 = 2 mb de banda controlada = 256 kb/s de velocidade máxima de download por usuário
#delay_pools 1
#delay_class 1 2
#delayparameters 1 15728640/15728640 1048576/1048576 # 0 -1/1 é ilimitado o uso de banda
#delay_parameters 1 32000/32000 1048576/1048576
#delay_access 1 allow redelocal
http_access allow localhost
http_access allow redelocal
http_access deny all
**************************************”****************************************
Configurando SCRIP FW.SH
#!bin/bash
Echo inicializando regras do firewall
Sleep 0
IF_WAN=eth0 # interface de saída para internet
LAN=192.168.0.0/24 # ENDEREÇO PARA REDE LOCAL LAN
#LIMPA REGRAS DO FIREWALL
Iptables –P INPUT ACCEPT
Iptables -P OUTPUT ACCEPT
Iptables –P FORWARD ACCEPT
Iptables –F
Iptables –t nat –F
Echo “nameserver 127.0.0.1 “ > /etc/resolv.conf
Echo “nameserver 8.8.8.8” >> /etc/resolv.conf
Echo “nameserver 8.8.4.4” >> /etc/resolv.conf
#ATIVA O SISTEMA DE ROTEAMENTO DE PACOTES
Echo 1 > /proc/sys/net/ipv4/ip_forward
#ATIVA O MODO DE MASQUERADE
Iptables –t nat -A postrouting -o $IF_WAN -j MASQUERADE # Mascaramento de rede
#FORÇA A NEVEGAÇÃO PELA PORTA 3128
Iptables –t Nat – A PREROUTING –p tcp --drop 80 –s $LAN –j REDIRECT –to 3128 # força navegação na 3128
#iptables – t nat –A PREROUTING –p tcp –s $LAN –dport 1863 –j DROP
#BLOQUEANDO SITE COM HTTPS
#cat /etc/squid/bloqueados/bloq_https |while read SITES;c
# do
# iptables –A FORWARD – p tcp –d $SITES –j ACCEPT
# done
#Vi /etc/rc.local
Sh /etc/rc.local/fw.sh
#vi /etc/squid/clock.sh
Ntpdate –u pool.org
#vi /etc/rc.local
Sh /squid/clock.sh
# crontab –e
00 23 **** /etc/squid/clock.sh
INSTALANDO E CONFIGURANDO SARG
#vi /etc/apt/soucer.list
Deb
HTTP://backports.debian.org/debian-backports squeeze-backports main
#Vi /etc/squid/relatorio.sh
Clear
DATA –g e –d $DATA’-‘$DATA
# vi /etc/apache2/sites-enabled/000-default
Virtualhost *:8082>
<Directory “/var/squid-reportts/ “>
Options indexes multiviews
AllowOverride nome
Order allow,deny
Auth Type Basic
Authname “Acesso Restrito”
Auth UserFile “/etc/squid/.sargpasswd”
Require valid-user
<Directory>
#vi /etc/apache2/ports.conf
Name VirtualHost *;8082
Listen 8082
#vi /etc/sarg/sarg.conf
#output_dir /var/www/squid.reports
Output_dir /var/lib/sarg
INSTALANDO WEBMIN
http://prdownloads.souceforge.net/webadmin_1.570_all.deb
https://192.168.0.1:10000
#apt-get install chkconfig –y –force-yes
#chkconfig apache2 on
#chkconfig bind9 on
#chkconfig squid on
#chkconfig webmin on
#reboot
# /etc/init.d/squid restart
#/etc/init.d/squid reload