View previous topic :: View next topic |
Author |
Message |
Manuelixm l33t
Joined: 03 Apr 2004 Posts: 832 Location: Brescia
|
Posted: Wed Oct 27, 2004 9:03 am Post subject: |
|
|
man iptables |
|
Back to top |
|
|
rota l33t
Joined: 13 Aug 2003 Posts: 960
|
Posted: Wed Oct 27, 2004 9:22 am Post subject: |
|
|
allora io o impostato cosi ...iptables
!/bin/sh
# masquerade
iptables -t nat -A POSTROUTING -o eth1 -s 192.168.0.0/255.255.255.0 -j MASQUERADE
iptables -A FORWARD -i ppp0 -m state --state NEW,INVALID -j REJECT
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
# chiude tutte le porte tranne la porta 80
# iptables -A INPUT -i eth1 -p tcp --syn --destination-port ! 80 -j DROP
# iptables -A INPUT -i ppp0 -p tcp --syn --destination-port ! 80 -j DROP
# apri la porta 21/FTP
iptables -A INPUT -p tcp -i eth1 --dport 21 -j ACCEPT
#apri la porta 22/SH
iptables -A INPUT -p tcp -i eth1 --dport 22 -j ACCEPT
#apri la porta 23/TELENT
iptables -A INPUT -p tcp -i eth1 --dport 23 -j ACCEPT
#apri la porta 25/SMTP
iptables -A INPUT -p tcp -i eth1 --dport 25 -j ACCEPT
iptables -A INPUT -p tcp -i eth1 --sport 21 -j ACCEPT
#apri la porta 80/HTTP
iptables -A INPUT -p tcp -i eth1 --dport 80 -j ACCEPT
#apri la porta 110/POP3
iptables -A INPUT -p tcp -i eth1 --dport 110 -j ACCEPT
iptables -A INPUT -j DROP
~
lo scrip mi chide tuttw le porte -- pero o il prb cche mi chiude anche cuelle che mi servono tipo andare su internet
|
|
Back to top |
|
|
comio Advocate
Joined: 03 Jul 2003 Posts: 2191 Location: Taranto
|
Posted: Wed Oct 27, 2004 10:12 am Post subject: |
|
|
HINT1: --sport --dport... source port, destination port... non voglio essere petulante, ma dovresti studiare un po' di IP/TCP e di filtering in generale, altrimeni tutto sarà oscuro...
HINT2: se devi andare su internet... magari ti serve una regola del tipo:
Code: |
iptables -A OUTPUT -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
|
perché?
HINT3: studia prima a tavolino le regole per ogni chain di default (INPUT, OUTPUT, FORWARD, PREROUTING, POSTROUTING)
ciao _________________ RTFM!!!!
e
http://www.comio.it
|
|
Back to top |
|
|
rota l33t
Joined: 13 Aug 2003 Posts: 960
|
Posted: Wed Oct 27, 2004 10:28 am Post subject: |
|
|
iptables -A OUTPUT -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
sta regola mica mi e tanto chiara ... io devvo scrivere cosi come me lai detta??? |
|
Back to top |
|
|
rota l33t
Joined: 13 Aug 2003 Posts: 960
|
Posted: Wed Oct 27, 2004 10:43 am Post subject: |
|
|
non ce sto a capi piu niente
o letto pure le guide che mi avete consigliato ..ma mi sono fatto una capa tanta che non ne vengo piu
adesso tirate fuori anxhe sta regola
iptables -A OUTPUT -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
mo non so piu che fare .. vabbe vaddo un momentino a spaccare la testa contro il muro poi torno ... |
|
Back to top |
|
|
comio Advocate
Joined: 03 Jul 2003 Posts: 2191 Location: Taranto
|
|
Back to top |
|
|
oRDeX Veteran
Joined: 19 Oct 2003 Posts: 1325 Location: Italy
|
Posted: Wed Oct 27, 2004 9:15 pm Post subject: |
|
|
in certe situazioni anche io dico: RTFM - man iptables |
|
Back to top |
|
|
rota l33t
Joined: 13 Aug 2003 Posts: 960
|
Posted: Thu Oct 28, 2004 7:08 am Post subject: |
|
|
vi ringrayyio per la vostra paziienza ..... |
|
Back to top |
|
|
rota l33t
Joined: 13 Aug 2003 Posts: 960
|
Posted: Thu Nov 04, 2004 11:36 am Post subject: |
|
|
nioente da fare o ancora probblemi.. io riesco a ricevere la posta ma non posso inviarla ....
allora io o impostato cosi lo script che mi gestisce le regole ....
iptables -t nat -A POSTROUTING -o eth1 -s 192.168.0.1/255.255.255.0 -j MASQUERADE
io cosi dovrei fare un masquerade delle 2 schedde di rete e dovrei avere i stessi servizzi sia che su eth1 che su eth0... man on e cosi ...
se faccio
nmap -sT localhost
Starting nmap 3.55 ( http://www.insecure.org/nmap/ ) at 2004-11-04 13:32 CET
Interesting ports on sofemared (127.0.0.1):
(The 1655 ports scanned but not shown below are in state: closed)
PORT STATE SERVICE
68/tcp open dhcpclient
111/tcp open rpcbind
139/tcp open netbios-ssn
445/tcp open microsoft-ds
631/tcp open ipp
mi fa vedre solo cueste porte ..la 25 la 110 non le veddo.... ma come faccio ad aprire ste benedette porte ???? o guiardato il file /etc/services
ma non o capito se e cuesto il file che mi permette di aprire le porte eccc...
o fatto anche cuello che mi avete suggerito ...o usato :
iptables -A INPUT -p tcp --dport 25 -j ACCEP
iptables -D INPUT -p tcp --dport 110-j ACCEP
ma non me le apre .....
|
|
Back to top |
|
|
Manuelixm l33t
Joined: 03 Apr 2004 Posts: 832 Location: Brescia
|
Posted: Thu Nov 04, 2004 12:04 pm Post subject: |
|
|
Dubito che ti abbiano suggerito così
Code: |
iptables -A INPUT -p tcp --dport 25 -j ACCEP
iptables -D INPUT -p tcp --dport 110-j ACCEP
|
per 2 motivi:
- ACCEP è un errore di scrittura -> ACCEPT
- con il primo comando aggiungi un regola alla tabella INPUT, con la seconda la cancelli.
Se non ho scritto c...ate dovrei aver capito un po' come funziona il tutto. _________________ Linux user#370732 |
|
Back to top |
|
|
rota l33t
Joined: 13 Aug 2003 Posts: 960
|
Posted: Thu Nov 04, 2004 12:16 pm Post subject: |
|
|
o solo scritto male...am il comando da terminale l,o scritto bene ... a me non compare nessun errore ..... e solo che non mi apre le porte ... |
|
Back to top |
|
|
grentis Guru
Joined: 20 Jul 2004 Posts: 321
|
Posted: Thu Nov 04, 2004 1:04 pm Post subject: |
|
|
Perchè la seconda regola non deve essere
Code: | iptables -D INPUT -p tcp --dport 110 -j ACCEPT |
ma
Code: | iptables -A INPUT -p tcp --dport 110 -j ACCEPT |
O almeno mi sembra.... |
|
Back to top |
|
|
Manuelixm l33t
Joined: 03 Apr 2004 Posts: 832 Location: Brescia
|
Posted: Thu Nov 04, 2004 1:14 pm Post subject: |
|
|
Esatto, che svista, non ho fatto caso alle porte che erano diverse, cmq come ti è già stato suggerito, è meglio che ti leggi la documentazione o che usi il man iptables per vedere cosa significano i vari parametri. _________________ Linux user#370732 |
|
Back to top |
|
|
|