Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Diciamo risolto] Problemi con regole iptables
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

Goto page Previous  1, 2, 3  
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian) Forum di discussione italiano
View previous topic :: View next topic  
Author Message
fbcyborg
Advocate
Advocate


Joined: 16 Oct 2005
Posts: 3056
Location: ROMA

PostPosted: Mon Jun 01, 2009 10:54 am    Post subject: Reply with quote

Ok, ti ringrazio, vedrò cosa riesco a combinare! :)
_________________
[HOWTO] Come criptare la /home usando cryptsetup e luks
[HOWTO] Abilitare il supporto al dom0 XEN su kernel 3.X
Help answer the unanswered
Back to top
View user's profile Send private message
fbcyborg
Advocate
Advocate


Joined: 16 Oct 2005
Posts: 3056
Location: ROMA

PostPosted: Tue Jun 02, 2009 8:19 pm    Post subject: Reply with quote

Stavo tentando di bloccare l'accesso a un sito se questo viene richiesto da un certo mac address, solo che ottengo un errore:
Code:
# iptables -t filter -A OUTPUT -m mac --mac-source 00:00:00:00:00:00 -d 92.60.65.198 -p tcp -m tcp --dport 80 -j DROP
iptables: No chain/target/match by that name

Qual'è il problema?

Da notare che questa prova la sto facendo in locale sul mio pc, quindi la regola penso che sarà forse leggermente diversa quando la farò sul server.
_________________
[HOWTO] Come criptare la /home usando cryptsetup e luks
[HOWTO] Abilitare il supporto al dom0 XEN su kernel 3.X
Help answer the unanswered
Back to top
View user's profile Send private message
devilheart
l33t
l33t


Joined: 17 Mar 2005
Posts: 848
Location: Villach, Austria

PostPosted: Wed Jun 03, 2009 7:28 am    Post subject: Reply with quote

ti serve CONFIG_NETFILTER_XT_MATCH_MAC
Back to top
View user's profile Send private message
fbcyborg
Advocate
Advocate


Joined: 16 Oct 2005
Posts: 3056
Location: ROMA

PostPosted: Wed Jun 03, 2009 9:30 am    Post subject: Reply with quote

L'ho compilato ma adesso mi da "iptables: invalid argument".
_________________
[HOWTO] Come criptare la /home usando cryptsetup e luks
[HOWTO] Abilitare il supporto al dom0 XEN su kernel 3.X
Help answer the unanswered
Back to top
View user's profile Send private message
devilheart
l33t
l33t


Joined: 17 Mar 2005
Posts: 848
Location: Villach, Austria

PostPosted: Wed Jun 03, 2009 10:08 am    Post subject: Reply with quote

http://www.cyberciti.biz/tips/iptables-mac-address-filtering.html
Back to top
View user's profile Send private message
fbcyborg
Advocate
Advocate


Joined: 16 Oct 2005
Posts: 3056
Location: ROMA

PostPosted: Wed Jun 03, 2009 10:13 am    Post subject: Reply with quote

Grazie,

l'avevo letto quello, ma non ci riesco. Non capisco come specificare che se quel source mac, vuole un certo dest ip, la richiesta deve essere droppata.

EDIT:
Allora, con questo riesco a bloccare il sito:
Code:
iptables -A OUTPUT -s 192.168.1.100/32 -d 92.60.65.198/32 -p tcp -m tcp -j DROP

Ora devo riuscire a bloccarlo tramite il mac address.
_________________
[HOWTO] Come criptare la /home usando cryptsetup e luks
[HOWTO] Abilitare il supporto al dom0 XEN su kernel 3.X
Help answer the unanswered
Back to top
View user's profile Send private message
devilheart
l33t
l33t


Joined: 17 Mar 2005
Posts: 848
Location: Villach, Austria

PostPosted: Wed Jun 03, 2009 5:48 pm    Post subject: Reply with quote

e mettere solo la destinazione? una semplice regola che blocca tutto quello che vuole andare su 92.60.65.198, indipendentemente da chi ci vuole andare
Back to top
View user's profile Send private message
fbcyborg
Advocate
Advocate


Joined: 16 Oct 2005
Posts: 3056
Location: ROMA

PostPosted: Wed Jun 03, 2009 5:51 pm    Post subject: Reply with quote

Sarebbe una buona idea, ma ripensandoci alla fine il discorso è sempre lo stesso: usa un proxy e baypassa il filtro.
_________________
[HOWTO] Come criptare la /home usando cryptsetup e luks
[HOWTO] Abilitare il supporto al dom0 XEN su kernel 3.X
Help answer the unanswered
Back to top
View user's profile Send private message
Kernel78
Moderator
Moderator


Joined: 24 Jun 2005
Posts: 3654

PostPosted: Wed Jun 03, 2009 6:17 pm    Post subject: Reply with quote

La questione mi interessa e mi piacerebbe discuterla più approfonditamente ma non ne ho il tempo.

Intanto mi permetto di farti notare che il mac address di una scheda lo cambi in meno di 3 secondi e se non sbaglio c'è almeno un sw in portage che consente di farlo quindi ti sconsiglio di usarlo come criterio per filtrare
fbcyborg wrote:
Sarebbe una buona idea, ma ripensandoci alla fine il discorso è sempre lo stesso: usa un proxy e baypassa il filtro.

basta usare whitelist che non contemplino questi proxy o una blacklist in cui li inserisci ...
_________________
Le tre grandi virtù di un programmatore: pigrizia, impazienza e arroganza. (Larry Wall).
Prima di postare un file togli i commenti con
Code:
grep -vE '(^[[:space:]]*($|(#|!|;|//)))'
Back to top
View user's profile Send private message
fbcyborg
Advocate
Advocate


Joined: 16 Oct 2005
Posts: 3056
Location: ROMA

PostPosted: Wed Jun 03, 2009 6:23 pm    Post subject: Reply with quote

Infatti uso blacklist che bloccano questi proxy, ma non puoi bloccarli tutti, infatti ogni tanto trovo nella lista degli url visitati, un proxy nuovo.

Per quanto riguarda il programma lo so, si chiama macchanger, ma magari su winzozz è più difficile, e magari lo smanettone di turno forse non ci pensa.
_________________
[HOWTO] Come criptare la /home usando cryptsetup e luks
[HOWTO] Abilitare il supporto al dom0 XEN su kernel 3.X
Help answer the unanswered
Back to top
View user's profile Send private message
djinnZ
Advocate
Advocate


Joined: 02 Nov 2006
Posts: 4831
Location: somewhere in L.O.S.

PostPosted: Thu Jun 04, 2009 2:10 pm    Post subject: Reply with quote

Kernel78 wrote:
ti sconsiglio di usarlo come criterio per filtrare
a meno che non stai parlando di bloccare un router (almeno il mio non è in grado di cambiare mac) il filtro è poco utile e complicato.
Usare l'arp statico, il dhcp per mac, ed arpwatch invece è più utile e costruttivo.
_________________
scita et risus abundant in ore stultorum sed etiam semper severi insani sunt:wink:
mala tempora currunt...mater stultorum semper pregna est :evil:
Murpy'sLaw:If anything can go wrong, it will - O'Toole's Corollary:Murphy was an optimist :wink:
Back to top
View user's profile Send private message
fbcyborg
Advocate
Advocate


Joined: 16 Oct 2005
Posts: 3056
Location: ROMA

PostPosted: Thu Jun 04, 2009 2:18 pm    Post subject: Reply with quote

Fico arpwatch! Devo capire bene come funziona però, perché l'ho fatto partire come servizio, e poi?
_________________
[HOWTO] Come criptare la /home usando cryptsetup e luks
[HOWTO] Abilitare il supporto al dom0 XEN su kernel 3.X
Help answer the unanswered
Back to top
View user's profile Send private message
fbcyborg
Advocate
Advocate


Joined: 16 Oct 2005
Posts: 3056
Location: ROMA

PostPosted: Mon Oct 12, 2009 4:46 pm    Post subject: Reply with quote

Eccomi di nuovo con dei problemi con iptables.

Sul router di alice (192.168.1.1) ho inoltrato tutte le richieste che arrivano sulla 5060 UDP e dalla 10000 alla 10040 UDP verso il server 192.168.1.2 (eth1).
Il server sull'interfaccia eth0 ha l'IP 10.0.0.1. Ora vorrei fare in modo che tutte le richieste che arrivano sul server sulla 5060 UDP e dalla 10000 alla 10040 UDP vengano inoltrate all'IP 10.0.0.10.

Ho provato la seguente regola di iptables ma non c'è verso che funzioni.
Code:
iptables -t nat -A PREROUTING -i eth1 -p udp -m multiport --dport 5060,10000:10040 -j DNAT --to-destination 10.0.0.10


Ho provato anche con "-i eth0", tante volte avessi sbagliato lì, ma non funziona.

Quale può essere il problema?

Grazie
_________________
[HOWTO] Come criptare la /home usando cryptsetup e luks
[HOWTO] Abilitare il supporto al dom0 XEN su kernel 3.X
Help answer the unanswered
Back to top
View user's profile Send private message
fbcyborg
Advocate
Advocate


Joined: 16 Oct 2005
Posts: 3056
Location: ROMA

PostPosted: Sat Jun 05, 2010 5:20 pm    Post subject: Reply with quote

Aiuto,

ho una regola di iptables, nel mio file rules-save come la seguente:
Code:
[6:288] -A INPUT -s ! 10.0.0.2/32 -d 10.0.0.1/32 -p tcp -m tcp --dport 10000 -j DROP

Vorrei fare in modo che anche l'indirizzo 10.0.0.3 possa fare richieste sulla porta 10000. Come posso aggiungere che l'INPUT -s sia diverso da 10.0.0.2 e da 10.0.0.3 ?
Devo per forza mettere un'altra regola del tipo:
Code:
iptables -A INPUT -s ! 10.0.0.3/32 -d 10.0.0.1/32 -p tcp -m tcp --dport 10000 -j DROP

Ma poi non cozza con quella sopra?
Oppure posso droppare tutte le richieste sulla 10000 (però solo quelle provenienti dalla sottorete 10.0.0.0) e abilitare successivamente dagli IP che voglio.. Ma mi date una mano?
_________________
[HOWTO] Come criptare la /home usando cryptsetup e luks
[HOWTO] Abilitare il supporto al dom0 XEN su kernel 3.X
Help answer the unanswered
Back to top
View user's profile Send private message
gutter
Bodhisattva
Bodhisattva


Joined: 13 Mar 2004
Posts: 7162
Location: Aarau, Aargau, Switzerland

PostPosted: Sun Jun 06, 2010 9:21 am    Post subject: Reply with quote

Potresti pensare di usare una /30 ... in questo modo includi però anche il .1

Davide
_________________
Registered as User #281564 and Machines #163761
Back to top
View user's profile Send private message
fbcyborg
Advocate
Advocate


Joined: 16 Oct 2005
Posts: 3056
Location: ROMA

PostPosted: Sun Jun 06, 2010 9:24 am    Post subject: Reply with quote

Grazie,

per ora ho trovato questa soluzione:
Code:
iptables -A INPUT -m iprange --src-range 10.0.0.4-10.0.0.255 -d 10.0.0.1/32 -p tcp -m tcp --dport 10000 -j DROP

Mi consente l'accesso sulla 10000 solo da 10.0.0.1 (che è appunto il server) a 10.0.0.3.

Mi va anche bene tutto sommato! :)
_________________
[HOWTO] Come criptare la /home usando cryptsetup e luks
[HOWTO] Abilitare il supporto al dom0 XEN su kernel 3.X
Help answer the unanswered
Back to top
View user's profile Send private message
gutter
Bodhisattva
Bodhisattva


Joined: 13 Mar 2004
Posts: 7162
Location: Aarau, Aargau, Switzerland

PostPosted: Sun Jun 06, 2010 9:28 am    Post subject: Reply with quote

fbcyborg wrote:

Mi va anche bene tutto sommato! :)


Perfetto ... sarebbe interessante vedere se iptables supporta qualcosa in stile wildcard mask ... che in queste situazioni sono più versatili :)
_________________
Registered as User #281564 and Machines #163761
Back to top
View user's profile Send private message
fbcyborg
Advocate
Advocate


Joined: 16 Oct 2005
Posts: 3056
Location: ROMA

PostPosted: Sun Jun 06, 2010 9:34 am    Post subject: Reply with quote

Non lo conosco, però a prima vista il mio intento era quello di dire: se la richiesta non proviene da 10.0.0.2 oppure da 10.0.0.3 droppa. Quindi volevo mettere un !(10.0.0.2 OR 10.0.0.3) invece che solo ! 10.0.0.2. Strano che non si possa fare, o meglio, mica lo so se è possibile.
_________________
[HOWTO] Come criptare la /home usando cryptsetup e luks
[HOWTO] Abilitare il supporto al dom0 XEN su kernel 3.X
Help answer the unanswered
Back to top
View user's profile Send private message
oRDeX
Veteran
Veteran


Joined: 19 Oct 2003
Posts: 1325
Location: Italy

PostPosted: Fri Jun 11, 2010 5:47 pm    Post subject: Reply with quote

Bhè iptables, in quanto firewall, deve essere il più semplice ed efficiente possibile..ricordiamoci che ogni pacchetto raggiunto dalla macchina attarversa le varie chain...quindi mettersi a valutare espressioni booleane comincerebbe a diventare pesante :wink:
Back to top
View user's profile Send private message
fbcyborg
Advocate
Advocate


Joined: 16 Oct 2005
Posts: 3056
Location: ROMA

PostPosted: Fri Jun 11, 2010 5:51 pm    Post subject: Reply with quote

Capisco, e soprattutto grazie per la risposta. Con questo ho avuto la conferma che quello che volevo fare io non si può fare! :)
_________________
[HOWTO] Come criptare la /home usando cryptsetup e luks
[HOWTO] Abilitare il supporto al dom0 XEN su kernel 3.X
Help answer the unanswered
Back to top
View user's profile Send private message
gutter
Bodhisattva
Bodhisattva


Joined: 13 Mar 2004
Posts: 7162
Location: Aarau, Aargau, Switzerland

PostPosted: Sat Jun 12, 2010 6:45 pm    Post subject: Reply with quote

oRDeX wrote:
Bhè iptables, in quanto firewall, deve essere il più semplice ed efficiente possibile..ricordiamoci che ogni pacchetto raggiunto dalla macchina attarversa le varie chain...quindi mettersi a valutare espressioni booleane comincerebbe a diventare pesante :wink:


Non penso che il problema sia il costo computazionale ... pensa solo a come viene deciso su quale interfaccia instradare un pacchetto in base all'AND tra indirizzo IP e Netmask :wink:
_________________
Registered as User #281564 and Machines #163761
Back to top
View user's profile Send private message
devilheart
l33t
l33t


Joined: 17 Mar 2005
Posts: 848
Location: Villach, Austria

PostPosted: Wed Jun 16, 2010 11:51 am    Post subject: Reply with quote

fbcyborg wrote:
Non lo conosco, però a prima vista il mio intento era quello di dire: se la richiesta non proviene da 10.0.0.2 oppure da 10.0.0.3 droppa. Quindi volevo mettere un !(10.0.0.2 OR 10.0.0.3) invece che solo ! 10.0.0.2. Strano che non si possa fare, o meglio, mica lo so se è possibile.
puoi fare una chain con default policy drop e due regole che accettano il traffico da 10.0.0.2 e 10.0.0.3
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian) Forum di discussione italiano All times are GMT
Goto page Previous  1, 2, 3
Page 3 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum