ALGUÉM ME AJUDE , IPTABLES

1. ALGUÉM ME AJUDE , IPTABLES

Eric Borges
schneidereeg

(usa CentOS)

Enviado em 23/02/2015 - 19:46h

Não consigo abrir nenhuma porta , uso o scanner de portas e estão todas fechadas. Simples assim.
Vou postar abaixo meu iptables e também o resultado do comando iptables -L Aí Vaí :

firewall.sh

iptables -t nat -F
iptables -t mangle -F
iptables -t filter -F
iptables -X
iptables -t nat -Z
iptables -t mangle -Z
iptables -t filter -Z

# Redireciona as conexões vindas da rede interna na porta 80 para a porta 3128
iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 80 -j REDIRECT --to-port 3128

iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -p icmp --icmp-type 0 -j ACCEPT
iptables -A INPUT -p icmp --icmp-type 8 -j ACCEPT

iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -p tcp --dport 3128 -j ACCEPT
#esta não sei se funciona

iptables -t filter -A INPUT -p tcp --dport 22 -j ACCEPT

iptables -A INPUT -p tcp --dport 21 -j ACCEPT

iptables -A INPUT -p tcp --dport 1194 -j ACCEPT

### Regras FORWARD
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -i eth0 -o eth1 -p icmp -j ACCEPT

# Libera o tráfego de pacotes da rede interna para a rede externa na porta 25 (smtp)
iptables -A FORWARD -i eth0 -o eth1 -p tcp --dport 25 -j ACCEPT
iptables -A FORWARD -i eth1 -o eth0 -p tcp --dport 25 -j ACCEPT

# Libera o tráfego de pacotes da rede interna para a rede externa na porta 22 (ssh)
iptables -A FORWARD -i eth0 -o eth1 -p tcp --dport 22 -j ACCEPT

# Libera o tráfego de pacotes da rede interna para a rede externa na porta 110 (pop)
iptables -A FORWARD -i eth0 -o eth1 -p tcp --dport 110 -j ACCEPT

# Libera o tráfego de pacotes da rede interna para a rede externa na porta 443 (ssl)
iptables -A FORWARD -i eth0 -o eth1 -p tcp --dport 443 -j ACCEPT

# Libera o tráfego de pacotes da rede interna para a rede externa na porta 3389 (Terminal Server da Microsoft)
iptables -A FORWARD -i eth0 -o eth1 -p tcp --dport 3389 -j ACCEPT

# Libera o tráfego de pacotes da rede interna para a rede externa na porta 80 (http)
iptables -A FORWARD -i eth0 -o eth1 -p tcp --dport 80 -j ACCEPT

# Libera o tráfego de pacotes da rede externa para a rede interna na porta 3389 (Terminal Server da Microsoft)
iptables -A FORWARD -i eth0 -o eth1 -p tcp --dport 3389 -j ACCEPT

# Libera o tráfego de pacotes da rede externa para a rede interna na porta 5900 (VNC)
iptables -A FORWARD -i eth0 -o eth1 -p tcp --dport 5900 -j ACCEPT

iptables -A FORWARD -i eth1 -o eth0 -p tcp --dport 21 -j ACCEPT

### Regras OUTPUT
iptables -A OUTPUT -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT


### Regras POSTROUTING
iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -o eth0 -j MASQUERADE

iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT
iptables -P FORWARD DROP

resultado IPTABLES – L
_____________________________________________________________________________________________

comando Iptables -L
root@internet:/# iptables -L
Chain INPUT (policy DROP)
target prot opt source destination
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT all -- anywhere anywhere
ACCEPT icmp -- anywhere anywhere icmp echo-reply
ACCEPT icmp -- anywhere anywhere icmp echo-request
ACCEPT tcp -- anywhere anywhere tcp dpt:ssh
ACCEPT tcp -- anywhere anywhere tcp dpt:3128
ACCEPT tcp -- anywhere anywhere tcp dpt:ssh
ACCEPT tcp -- anywhere anywhere tcp dpt:ftp
ACCEPT tcp -- anywhere anywhere tcp dpt:openvpn

Chain FORWARD (policy DROP)
target prot opt source destination
ACCEPT tcp -- anywhere 192.168.1.0 tcp dpt:http-alt
ACCEPT tcp -- anywhere 192.168.1.253 tcp dpt:http-alt
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT icmp -- anywhere anywhere
ACCEPT tcp -- anywhere anywhere tcp dpt:smtp
ACCEPT tcp -- anywhere anywhere tcp dpt:smtp
ACCEPT tcp -- anywhere anywhere tcp dpt:ssh
ACCEPT tcp -- anywhere anywhere tcp dpt:pop3
ACCEPT tcp -- anywhere anywhere tcp dpt:https
ACCEPT tcp -- anywhere anywhere tcp dpt:3389
ACCEPT tcp -- anywhere anywhere tcp dpt:http
ACCEPT tcp -- anywhere anywhere tcp dpt:3389
ACCEPT tcp -- anywhere anywhere tcp dpt:5900
ACCEPT tcp -- anywhere anywhere tcp dpt:ftp

Chain OUTPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere state NEW,RELATED,ESTABLISHED



  


2. Re: ALGUÉM ME AJUDE , IPTABLES

Rodrigo Lira
roudi

(usa Arch Linux)

Enviado em 23/02/2015 - 21:07h

Antes de mais nada você tem algum serviço rodando nessas portas (ssh, ftp)? Pq se não tiver mesmo que as portas esteja liberada no firewall não vão estar aberta. Rode o comando abaixo no firewall:

#netstat -untap ou

#nmap localhost




3. ALGUÉM ME AJUDE , IPTABLES

Eric Borges
schneidereeg

(usa CentOS)

Enviado em 24/02/2015 - 10:05h


Olá amigo , minha situação é essa :

tenho em uma das minhas maquinas um servidor apache rodando e outros serviços de diferentes portas.
Mas o que mais me incomoda é o servidor apache que precisa ser acessado pelo publico externo da minha rede através da porta 8080 e 80 não roda. Tenho um proxy marcado com direcionamento da porta 80 para a 3128.


4. ALGUÉM ME AJUDE , IPTABLES

Eric Borges
schneidereeg

(usa CentOS)

Enviado em 24/02/2015 - 11:23h


Vou postar o resultado do comando que tu me passou !



  



Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts