Rodar o .conf sem reiniciar

1. Rodar o .conf sem reiniciar

Eduardo
myfeb

(usa Debian)

Enviado em 16/02/2009 - 15:27h

Boa tarde sou novo com o sistema Linux, criei um arquivo firewall.conf está rodando OK mas toda vez que eu crio uma linha dentro do arquivo eu desligo e ligo para ativar essa nova configuração , qual o comando para atualizar sem precisar dar o shutdown . Eu antes usava ../firewall.conf mas agora não funciona Atenciosamente Edu


  


2. Re: Rodar o .conf sem reiniciar

Rafael
rrafael

(usa Debian)

Enviado em 16/02/2009 - 15:33h

Dentro do seu firewall la no final coloca isso aki..
}
case $1 in
start)
echo Starting Firewall...
add_rules
echo "Done"
;;
stop)
echo -n Stoping Firewall...
flush_rules
iptables -F
iptables -X
iptables -Z
iptables -t filter -Z
iptables -t nat -Z
iptables -t mangle -Z
iptables -t filter -F
iptables -t nat -F
iptables -t mangle -F
iptables -F INPUT
iptables -F OUTPUT
iptables -F FORWARD
echo "Done"
;;
restart)
echo Restarting Firewall...
flush_rules
iptables -F
iptables -X
iptables -Z
iptables -t filter -Z
iptables -t nat -Z
iptables -t mangle -Z
iptables -t filter -F
iptables -t nat -F
iptables -t mangle -F
iptables -F INPUT
iptables -F OUTPUT
iptables -F FORWARD
echo "Cleaning all rules .................[ OK ]"
add_rules
echo "Done"
;;
status)
echo "============================ Firewall rules:"
iptables -L -n
echo "============================ Masquerade tables:"
iptables -t nat -L -n
echo "============================ Mangle table:"
iptables -t mangle -L -n
;;
*)
echo Usar: "$0 { status | start | stop | restart }"
;;
esac


Agora toda a vez que voce alterar o seu Firewall e so ir na pasta e dar um firewall restart -> reinicia
firewall stop -> para
firewall start -> inicia
firewall status -> mostra as regras..



3. Re: Rodar o .conf sem reiniciar

Eduardo
myfeb

(usa Debian)

Enviado em 16/02/2009 - 16:19h

Vou inserir essas linhas e vou testar, obrigado Rafael só mais uma pergunta mas porque não funciona mais ../firewall.conf


edu


4. Re: Rodar o .conf sem reiniciar

Eduardo
myfeb

(usa Debian)

Enviado em 16/02/2009 - 16:58h

Claro o comando é só com um ponto ./firewall.conf. Mas eu fiz o que vc falou Rafael mas deu erro já na primeira linha } syntax error near unexpected token `}´.


Esse é o conteudo do meu firewall.conf
#!/bin/bash

###############################################################################
## Inicia o Forward de Pacotes / Variaveis
###############################################################################

echo 1 > /proc/sys/net/ipv4/ip_forward

mark=2
GREP=`which grep`
CUT=`which cut`
EXPR=`which expr`
TC=`which tc`

###############################################################################
## Carrega os Modulos do iptables
###############################################################################
modprobe ip_tables
modprobe ip_conntrack
modprobe ip_conntrack_ftp
modprobe ip_conntrack_irc
modprobe ip_queue
modprobe iptable_filter
modprobe iptable_mangle
modprobe iptable_nat
modprobe ipt_REDIRECT
modprobe ipt_REJECT
modprobe ip_nat_ftp
modprobe ip_nat_irc
modprobe ipt_MARK
modprobe ipip
modprobe ip_gre

###############################################################################
## Zera Regras e estabelece Policies
###############################################################################

iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X




###############################################################################
## Bloqueio de programas e portas
###############################################################################

# Rede Microsoft
iptables -A FORWARD -p udp --dport 135:139 -j DROP
iptables -A FORWARD -p tcp --dport 135:139 -j DROP
#PORTA23
iptables -A INPUT -p tcp --dport 23 -j DROP
iptables -A INPUT -p udp --dport 23 -j DROP
#PORTA53(DNS)
iptables -A INPUT -p tcp --dport 53 -j DROP
iptables -A INPUT -p udp --dport 53 -j DROP
# PORTA 1900
iptables -A FORWARD -p TCP --dport 1900 -j DROP
iptables -A FORWARD -p UDP --dport 1900 -j DROP
#PORTA9
iptables -A INPUT -p tcp --dport 9 -j DROP
iptables -A INPUT -p udp --dport 9 -j DROP
#PORTA13
iptables -A INPUT -p tcp --dport 13 -j DROP
iptables -A INPUT -p udp --dport 13 -j DROP
#PORTA37
iptables -A INPUT -p tcp --dport 37 -j DROP
iptables -A INPUT -p udp --dport 37 -j DROP
#PORTA90
iptables -A INPUT -p tcp --dport 90 -j DROP
iptables -A INPUT -p udp --dport 90 -j DROP
#SUNRPC
iptables -A INPUT -p tcp --dport 111 -j DROP
iptables -A INPUT -p udp --dport 111 -j DROP
#Blaster e Sasser DOS
iptables -A FORWARD -p tcp --dport 444:445 -j DROP
iptables -A FORWARD -p udp --dport 444:445 -j DROP
# Rede Microsoft
iptables -A FORWARD -p udp --dport 135:139 -j DROP
iptables -A FORWARD -p tcp --dport 135:139 -j DROP
# MS-SQL Worm
iptables -A FORWARD -p tcp --dport 1434 -j DROP
iptables -A FORWARD -p udp --dport 1434 -j DROP
# Proteç contra Syn-flood:
iptables -A FORWARD -p tcp --syn -m limit --limit 1/s -j ACCEPT
# Port scanner suspeito:
iptables -A FORWARD -p tcp --tcp-flags SYN,ACK,FIN,RST RST -m limit --limit 1/s -j DROP
# Ping da morte:
iptables -A FORWARD -p icmp --icmp-type echo-request -m limit --limit 1/s -j ACCEPT
# NETBUS
iptables -A INPUT -p udp --sport 12345 -j DROP
iptables -A INPUT -p udp --sport 12346 -j DROP
# BACK ORIFFICE
iptables -A INPUT -p udp --sport 31337 -j DROP
iptables -A INPUT -p tcp --sport 31337 -j DROP
# TRIN00
iptables -A INPUT -p tcp --sport 27665 -j DROP
iptables -A INPUT -p udp --sport 27444 -j DROP
iptables -A INPUT -p udp --sport 31335 -j DROP
# Stachelddrath
iptables -A INPUT -p tcp --sport 16660 -j DROP
iptables -A INPUT -p tcp --sport 65000 -j DROP
# GATOR
iptables -A FORWARD -d 64.152.73.0/24 -j DROP
iptables -A FORWARD -d 66.35.229.0/24 -j DROP
# KUANG2 Trojan
iptables -A FORWARD -p tcp --dport 17300 -j DROP
iptables -A FORWARD -p udp --dport 17300 -j DROP
# Tentativa de conexao para a porta 1080
iptables -A FORWARD -p tcp --dport 1080 -j DROP
iptables -A FORWARD -p udp --dport 1080 -j DROP



5. Re: Rodar o .conf sem reiniciar

Rafael
rrafael

(usa Debian)

Enviado em 16/02/2009 - 17:13h

Coloca so o {

fica assim..

{
###############################################################################
## Bloqueio de programas e portas
###############################################################################

# Rede Microsoft

de pois poe la no final as linha funcina direitinho..






Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts