Come aprire una porta 8080 per un'applicazione, con iptables


17

Sono un principiante totale per quanto riguarda i server, quindi scusa la mia umile domanda :-)

Qualcuno ha sviluppato per me un'applicazione Python che funge da server web. Questa applicazione TCP deve ascoltare la porta 8080.

[root@blabla jll]# netstat -tanpu | grep ":8080"
tcp        0      0 0.0.0.0:8080                0.0.0.0:*                   LISTEN      18209/python

Sembra che 8080 non sia aperto sul firewall del mio server. Per aprirlo, ho provato a modificare le regole di iptables in questo modo:

/sbin/iptables -A RH-Firewall-1-INPUT -i eth0 -p tcp --dport 8080 -j ACCEPT

Tuttavia non ho ancora nulla su http://my.server.name:8080 .

(Non sono nemmeno sicuro di "RH-Firewall-1-INPUT" o "INPUT")

Cosa posso fare ora ? Esiste una sorta di procedura generale per tali cose?

Ti do le seguenti informazioni utili:

/sbin/iptables -nvL
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
   49  3388 ACCEPT     tcp  --  eth0   *       0.0.0.0/0            0.0.0.0/0           tcp dpt:8080 
  25M 3736M RH-Firewall-1-INPUT  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         
    0     0 REJECT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited 

Chain OUTPUT (policy ACCEPT 43M packets, 41G bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain RH-Firewall-1-INPUT (1 references)
 pkts bytes target     prot opt in     out     source               destination         
 121K   15M ACCEPT     all  --  lo     *       0.0.0.0/0            0.0.0.0/0           
97773 8078K ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           icmp type 255 
    0     0 ACCEPT     esp  --  *      *       0.0.0.0/0            0.0.0.0/0           
    0     0 ACCEPT     ah   --  *      *       0.0.0.0/0            0.0.0.0/0           
   17  2509 ACCEPT     udp  --  *      *       0.0.0.0/0            224.0.0.251         udp dpt:5353 
    0     0 ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0           udp dpt:631 
    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:631 
  24M 3682M ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED 
26069 1319K ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:22 
 3806  204K ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:443 
 563K   30M REJECT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited

E :

    /sbin/iptables -nvL -t nat
Chain PREROUTING (policy ACCEPT 168K packets, 15M bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain POSTROUTING (policy ACCEPT 4200K packets, 252M bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 4200K packets, 252M bytes)
 pkts bytes target     prot opt in     out     source               destination

Quale sistema operativo è in esecuzione sul tuo server?

Sto eseguendo Fedora 8 Linux

@JCLL pubblica l'output di iptables-save, e il tuo server web è lo stesso del firewall?
pepoluan,

Risposte:


32

Escludendo l'output di iptables -nvL, iptables -nvL -t nate iptables -nVL -t mangle, che sarebbe utile avere in questo caso, ecco una sveltina che potrebbe funzionare:

iptables -I INPUT 1 -i eth0 -p tcp --dport 8080 -j ACCEPT
Utilizzando il nostro sito, riconosci di aver letto e compreso le nostre Informativa sui cookie e Informativa sulla privacy.
Licensed under cc by-sa 3.0 with attribution required.