|
|
|
![]() |
|
Strumenti |
![]() |
#1 |
Senior Member
Iscritto dal: Jul 2002
Città: Padova
Messaggi: 4245
|
iptables, non capisco dove sbaglio..........
Ciao a tutti, volevo un consiglio su iptables perchè sto facendo una configurazione un po' particolare ma non capisco dove sto sbagliando.
Secondo come la vedo io, con una configurazione così: Chain INPUT (policy DROP) target prot opt source destination ACCEPT all -- localnet/24 anywhere ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED ACCEPT tcp -- anywhere anywhere tcp dpt:ssh ACCEPT tcp -- anywhere anywhere tcp dpt:www ACCEPT tcp -- anywhere anywhere tcp dpt:smtp ACCEPT tcp -- anywhere anywhere tcp dpt ![]() LOG all -- anywhere anywhere LOG level debug prefix `Blocked Packet: ' DROP tcp -- 192.168.0.98 anywhere tcp dpt:www Chain FORWARD (policy DROP) target prot opt source destination ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED ACCEPT all -- localnet/24 anywhere DROP tcp -- 192.168.0.98 anywhere tcp dpt:www Chain OUTPUT (policy DROP) target prot opt source destination ACCEPT all -- anywhere localnet/24 ACCEPT all -- anywhere anywhere state NEW,RELATED,ESTABLISHED DROP tcp -- 192.168.0.98 anywhere tcp dpt:www il Sig. 192.168.0.98 non dovrebbe riuscire a navigare su internet. Come mai naviga lo stesso? Grazie. |
![]() |
![]() |
![]() |
#2 |
Senior Member
Iscritto dal: Apr 2000
Città: Roma
Messaggi: 15625
|
iptables -L -n -v cosa riporta?
__________________
0: or %edi, %ecx; adc %eax, (%edx); popf; je 0b-22; pop %ebx; fadds 0x56(%ecx); lds 0x56(%ebx), %esp; mov %al, %al andeqs pc, r1, #147456; blpl 0xff8dd280; ldrgtb r4, [r6, #-472]; addgt r5, r8, r3, ror #12 |
![]() |
![]() |
![]() |
#3 | |
Senior Member
Iscritto dal: Jul 2002
Città: Padova
Messaggi: 4245
|
Quote:
Chain INPUT (policy DROP 0 packets, 0 bytes) pkts bytes target prot opt in out source destination 674 54902 ACCEPT all -- * * 192.168.0.0/24 0.0.0.0/0 15 1950 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED 0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:22 0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:80 0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:25 0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:110 0 0 LOG all -- * * 0.0.0.0/0 0.0.0.0/0 LOG flags 0 level 7 prefix `Blocked Packet: ' 0 0 DROP tcp -- * * 192.168.0.98 0.0.0.0/0 tcp dpt:80 Chain FORWARD (policy DROP 0 packets, 0 bytes) pkts bytes target prot opt in out source destination 2136 923K ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED 102 6395 ACCEPT all -- * * 192.168.0.0/24 0.0.0.0/0 0 0 DROP tcp -- * * 192.168.0.98 0.0.0.0/0 tcp dpt:80 Chain OUTPUT (policy DROP 0 packets, 0 bytes) pkts bytes target prot opt in out source destination 442 51256 ACCEPT all -- * * 0.0.0.0/0 192.168.0.0/24 15 1050 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 state NEW,RELATED,ESTABLISHED 0 0 DROP tcp -- * * 192.168.0.98 0.0.0.0/0 tcp dpt:80 |
|
![]() |
![]() |
![]() |
#4 |
Senior Member
Iscritto dal: Apr 2000
Città: Roma
Messaggi: 15625
|
Questa:
Codice:
Chain FORWARD (policy DROP 0 packets, 0 bytes) pkts bytes target prot opt in out source destination (...) 102 6395 ACCEPT all -- * * 192.168.0.0/24 0.0.0.0/0 Codice:
0 0 DROP tcp -- * * 192.168.0.98 0.0.0.0/0 tcp dpt:80
__________________
0: or %edi, %ecx; adc %eax, (%edx); popf; je 0b-22; pop %ebx; fadds 0x56(%ecx); lds 0x56(%ebx), %esp; mov %al, %al andeqs pc, r1, #147456; blpl 0xff8dd280; ldrgtb r4, [r6, #-472]; addgt r5, r8, r3, ror #12 |
![]() |
![]() |
![]() |
#5 |
Senior Member
Iscritto dal: Jul 2002
Città: Padova
Messaggi: 4245
|
Analizzando l'output di iptables -L -n -v, ho visto che la prima colonna (packets) è a 0 proprio nelle righe equivalenti alle regole che dovrebbero bloccare l'ip 192.168.0.98.
Questo vuol dire che le regole che ho inserito a tal proposito vengono proprio ignorate. Forse perchè già prima viene trovata una regola che dice di lasciare passare il pacchetto? |
![]() |
![]() |
![]() |
#6 |
Senior Member
Iscritto dal: Jul 2002
Città: Padova
Messaggi: 4245
|
Quindi la mia idea, di fare in modo che tramite uno script venisse aperta o chiusa la porta www per un determinato indirizzo ip, diventa più complicata del previsto
![]() |
![]() |
![]() |
![]() |
#7 |
Senior Member
Iscritto dal: Apr 2000
Città: Roma
Messaggi: 15625
|
Invece di usare iptables -A (append), usa iptables -I (insert) per le regole da sfogliare prima delle altre.
__________________
0: or %edi, %ecx; adc %eax, (%edx); popf; je 0b-22; pop %ebx; fadds 0x56(%ecx); lds 0x56(%ebx), %esp; mov %al, %al andeqs pc, r1, #147456; blpl 0xff8dd280; ldrgtb r4, [r6, #-472]; addgt r5, r8, r3, ror #12 |
![]() |
![]() |
![]() |
#8 |
Senior Member
Iscritto dal: Jul 2002
Città: Padova
Messaggi: 4245
|
L'opzione -I mi ha salvato la vita.
Grazie o inesauribile fonte di consigli!!!! ![]() |
![]() |
![]() |
![]() |
#9 |
Senior Member
Iscritto dal: Dec 2000
Città: Trento
Messaggi: 5917
|
altrimenti fatti una catena apposita (dove redirigi tutti i pacchetti con porta di destinazione 80) e poi aggiungi regole al volo in quella catena!
__________________
Linux User #272700 >+++++++++[<+++++++++>-]<+.++.>++++[<---->-]<++.+++++++. HOWTO: SSH Firewall e DMZ ɐɹdosoʇʇos oʇuǝs ıɯ |
![]() |
![]() |
![]() |
Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 20:29.