View Full Version : [HELP] Apt-get e firewall = Non mi scarica + i pacchetti...
Come da topic, mi sono configurato a mano, e poi messo in uno script, il firewall utilizzando le regole di iptables. Il fw funziona perfettamente, dal PC riesco a navigare ed anke a scaricare via browser, tutti i servizi ke ho deciso d aprire funzionano anke dall'esterno ecc ecc MA nn riesco a capire come mai nn mi fa scaricare ne' l'update della source.list ne' tanto meno i pacchetti.
Se tolgo il fw invece tutto funziona correttamente...
Come mai ?
Apt-get utilizza una porta particolare per il DL ? Se si qual'č ?
Grazie a tutti
#!/bin/sh
13-10-2003, 15:55
a quanto ne so dipende dai repository: se sopn ftp usa ftp, se sopno http usa http. sųdevi stappare quelle porte sulle chain INPUT e OUTPUT.
Originariamente inviato da #!/bin/sh
a quanto ne so dipende dai repository: se sopn ftp usa ftp, se sopno http usa http. sųdevi stappare quelle porte sulle chain INPUT e OUTPUT.
eh eh, sembrerebbe cosė semplice... IO quelle porte le ho aperte e la prova č il fatto ke ho sia un server ftp ke un server web attivo e funzionante ^_^
#!/bin/sh
13-10-2003, 16:20
posta il firewall
strano, che regole hai usato?
#
# Variabili
rete=192.168.0.0/24
server=192.168.0.1
athlon=192.168.0.2
wan=ppp0
lan=eth0
#-----------------------------------------------------------
# Reset di Tutto
iptables -F
iptables -X
iptables -t nat -F
#-----------------------------------------------------------
# Catena di Firewall di Default Con logging
iptables -N STOP
iptables -A STOP -j LOG --log-level info --log-prefix "Firewall: "
iptables -A STOP -j DROP
#------------------------------------------------------------------
# Blocco dei Pacchetti Non Validi
iptables -A INPUT -j STOP -m state --state INVALID
iptables -A OUTPUT -j STOP -m state --state INVALID
iptables -A INPUT -j STOP -f
iptables -A OUTPUT -j STOP -f
#---------------------------------------------------------------------
# Abilitazione del traffico interno alla macchina
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT
#-----------------------------------------------------------------------
# Accetto pacchetti solo dagli indirizzi a me noti nella mia rete interna
# e ignoro quelli provenienti da e per il mio stesso indirizzo
iptables -A INPUT -i $lan -j STOP -s $server
iptables -A OUTPUT -o $lan -j STOP -d $server
iptables -A INPUT -i $lan -j ACCEPT -s $athlon
iptables -A OUTPUT -o $lan -j ACCEPT -d $athlon
iptables -A INPUT -i $lan -j STOP
iptables -A OUTPUT -o $lan -j STOP
#----------------------------------------------------------------
# Blocco Brutalmente tutti i pacchetti provenienti da internet
# con indirizzi privati
iptables -A INPUT -i $wan -j STOP -d 10.0.0.0/8
iptables -A INPUT -i $wan -j STOP -s 10.0.0.0/8
iptables -A INPUT -i $wan -j STOP -d 172.16.0.0/12
iptables -A INPUT -i $wan -j STOP -s 172.26.0.0/12
iptables -A INPUT -i $wan -j STOP -d 192.168.0.0/16
iptables -A INPUT -i $wan -j STOP -s 192.168.0.0/16
iptables -A INPUT -i $wan -j STOP -d 240.0.0.0/5
iptables -A INPUT -i $wan -j STOP -s 240.0.0.0/5
iptables -A INPUT -i $wan -j STOP -d 127.0.0.0/8
iptables -A INPUT -i $wan -j STOP -s 127.0.0.0/8
iptables -A INPUT -i $wan -j STOP -d 0.0.0.0
iptables -A INPUT -i $wan -j STOP -s 0.0.0.0
iptables -A INPUT -i $wan -j STOP -d 255.255.255.255
iptables -A INPUT -i $wan -j STOP -s 255.255.255.255
#----------------------------------------------------------------
# Blocco Brutalmente tutti i pacchetti verso internet
# con indirizzi privati
iptables -A OUTPUT -o $wan -j STOP -d 10.0.0.0/8
iptables -A OUTPUT -o $wan -j STOP -s 10.0.0.0/8
iptables -A OUTPUT -o $wan -j STOP -d 172.16.0.0/12
iptables -A OUTPUT -o $wan -j STOP -s 172.26.0.0/12
iptables -A OUTPUT -o $wan -j STOP -d 192.168.0.0/16
iptables -A OUTPUT -o $wan -j STOP -s 192.168.0.0/16
iptables -A OUTPUT -o $wan -j STOP -d 240.0.0.0/5
iptables -A OUTPUT -o $wan -j STOP -s 240.0.0.0/5
iptables -A OUTPUT -o $wan -j STOP -d 127.0.0.0/8
iptables -A OUTPUT -o $wan -j STOP -s 127.0.0.0/8
iptables -A OUTPUT -o $wan -j STOP -d 0.0.0.0
iptables -A OUTPUT -o $wan -j STOP -s 0.0.0.0
iptables -A OUTPUT -o $wan -j STOP -d 255.255.255.255
iptables -A OUTPUT -o $wan -j STOP -s 255.255.255.255
#----------------------------------------------------------------
# Blocco di tutto il traffico multicast in ingresso ad
# eccezzione di quello in udp a patto che non sia troppo veloce
# !!! NON ESEGUO IL LOG SU QUESTO !!!
iptables -A INPUT -i $wan -j DROP -s 224.0.0.0/4
iptables -A INPUT -i $wan -j ACCEPT -d 224.0.0.0/4 -p udp -m limit --limit 5/second --limit-burst 10
#--------------------------------------------------------------
# Apro i servizi a cui voglio accedere
# DNS
iptables -A OUTPUT -o $wan -j ACCEPT -p udp --sport 1024:65535 --dport 53 -m state --state NEW,ESTABLISHED
iptables -A INPUT -i $wan -j ACCEPT -p udp --dport 1024:65535 --sport 53 -m state --state ESTABLISHED
#HTTP
iptables -A OUTPUT -o $wan -j ACCEPT -p tcp --sport 1024:65535 --dport 80 -m state --state NEW,ESTABLISHED
iptables -A INPUT -i $wan -j ACCEPT -p tcp --dport 1024:65535 --sport 80 -m state --state ESTABLISHED
iptables -A INPUT -i $wan -p tcp --dport 80:80 -j ACCEPT
#FTP
#iptables -A OUTPUT -o $wan -j ACCEPT -p tcp --sport 1024:65535 --dport 21 -m state --state NEW,ESTABLISHED
iptables -A INPUT -i $wan -p tcp --dport 21 -j LOG --log-level notice --log-prefix "FTP Access :"
#iptables -A INPUT -i $wan -j ACCEPT -p tcp --dport 1024:65535 --sport 21 -m state --state ESTABLISHED
iptables -A INPUT -i $wan -p tcp --dport 21 -j ACCEPT
#SSH
iptables -A INPUT -i $wan -p tcp --dport 22 -j LOG --log-level notice --log-prefix "SSH Access :"
iptables -A INPUT -i $wan -j ACCEPT -p tcp --sport 1024:65535 --dport 22
iptables -A OUTPUT -o $wan -j ACCEPT -p tcp --dport 1024:65535 --sport 22
#ICMP
iptables -A OUTPUT -o $wan -j ACCEPT -p icmp -m state --state NEW
iptables -A INPUT -i $wan -j ACCEPT -p icmp -m state --state RELATED,ESTABLISHED
#TRACEROUTE
iptables -A OUTPUT -o $wan -j ACCEPT -p udp --sport 32769:65535 --dport 33434:33523 -m state --state NEW
#xMule
iptables -A INPUT -i $wan -j ACCEPT -p tcp --dport 4662 --sport 1024:65535 -m state --state NEW,ESTABLISHED
iptables -A INPUT -i $wan -j ACCEPT -p tcp -m state --state ESTABLISHED,RELATED
iptables -A OUTPUT -o $wan -j ACCEPT -p tcp --dport 1024:65535
iptables -A INPUT -i $wan -j ACCEPT -p udp --dport 4672 --sport 1024:65535 -m state --state NEW,ESTABLISHED
iptables -A OUTPUT -o $wan -j ACCEPT -p udp --dport 1024:65535
#WebMin
iptables -A INPUT -i $lan -j ACCEPT -p tcp --dport 3110 -m state --state NEW,ESTABLISHED
iptables -A OUTPUT -o $lan -j ACCEPT -p tcp --sport 3110 -m state --state ESTABLISHED
#-----------------------------------------------------------------
# Blocco di TUTTO
iptables -A INPUT -j STOP
iptables -A OUTPUT -j STOP
#-------------------------------------------------------------------
# Abilito il Masquerating
iptables -t nat -A POSTROUTING -j MASQUERADE
#!/bin/sh
13-10-2003, 18:13
le regole tipo queste:
iptables -A OUTPUT -o $wan -j ACCEPT -p udp --sport 1024:65535 --dport 53 -m state --state NEW,ESTABLISHED
iptables -A INPUT -i $wan -j ACCEPT -p udp --dport 1024:65535 --sport 53 -m state --state ESTABLISHED
prova a modificarle cosė:
iptables -A OUTPUT -o $wan -j ACCEPT -p udp --dport 53 -m state --state NEW,ESTABLISHED
iptables -A INPUT -i $wan -j ACCEPT -p udp --sport 53 -m state --state ESTABLISHED
#HTTP
iptables -A OUTPUT -o $wan -j ACCEPT -p tcp --dport 80 -m state --state NEW,ESTABLISHED
iptables -A INPUT -i $wan -j ACCEPT -p tcp --sport 80 -m state --state ESTABLISHED
io di solito specifico per una regola o solo la porta sorgente o solo la porta di destinazione.
vBulletin® v3.6.4, Copyright ©2000-2025, Jelsoft Enterprises Ltd.