Estou tentando instalar um servidor nodejs ouvindo a porta 8080 que abri com o iptable, mas quando executo o nmap ou uma ferramenta web sempre recebo a mensagem de que a porta está fechada. Estou em um Ubuntu vps.
Primeiro, certifique-se de que o nodejs esteja realmente escutando essa porta:
sudo netstat -tpln
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:60613 0.0.0.0:* LISTEN 1097/sshd
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 1215/mysqld
tcp 0 0 127.0.0.1:8080 0.0.0.0:* LISTEN 18843/nodejs
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 1375/master
tcp6 0 0 :::60613 :::* LISTEN 1097/sshd
tcp6 0 0 :::80 :::* LISTEN 1454/apache2
tcp6 0 0 :::25 :::* LISTEN 1375/master
tcp6 0 0 :::443 :::* LISTEN 1454/apache2
iptable:
sudo iptables -A INPUT -i lo -j ACCEPT
sudo iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 443 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 8080 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 60613 -m state --state NEW -m recent --set
sudo iptables -A INPUT -p tcp --dport 60613 -m state --state NEW -m recent --update --seconds 60 --hitcount 4 -j DROP
sudo iptables -A INPUT -p tcp -m tcp --dport 60613 -j ACCEPT
Vamos verificar o iptable:
sudo iptables -nvL
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
3945 766K ACCEPT all -- lo * 0.0.0.0/0 0.0.0.0/0
67404 17M ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 ctstate RELATED,ESTABLISHED
3057 179K ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:443
32 1488 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:8080
888 51392 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:80
3 180 tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:60613 state NEW recent: SET name: DEFAULT side: source mask: 255.255.255.255
0 0 DROP tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:60613 state NEW recent: UPDATE seconds: 60 hit_count: 4 name: DEFAULT side: source mask: 255.255.255.255
3 180 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:60613
7106 318K DROP all -- * * 0.0.0.0/0 0.0.0.0/0
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 71509 packets, 60M bytes)
pkts bytes target prot opt in out source destination
No entanto, a porta 8080 permanece fechada:
sudo nmap MYSITE.org
Starting Nmap 6.40 ( http://nmap.org ) at 2015-04-26 18:17 CEST
Nmap scan report for MYSITE.org (XXX.XXX.XXX.XXX)
Host is up (0.041s latency).
rDNS record for XXX.XXX.XXX.XXX: MYSITE
Not shown: 997 filtered ports
PORT STATE SERVICE
80/tcp open http
443/tcp open https
8080/tcp closed http-proxy
Nmap done: 1 IP address (1 host up) scanned in 85.14 seconds
Eu pensei em um problema no meu firewall, mas também tentei em outros servidores e no sinal de usuário , mas o porto está definitivamente fechado.