Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Tip] Uno script di init per iptables
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

Goto page Previous  1, 2, 3, 4  Next  
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian) Risorse italiane (documentazione e tools)
View previous topic :: View next topic  
Author Message
Cazzantonio
Bodhisattva
Bodhisattva


Joined: 20 Mar 2004
Posts: 4514
Location: Somewere around the world

PostPosted: Wed Aug 24, 2005 1:30 pm    Post subject: Reply with quote

L'output è quello che ti esce dal pc... l'input quello che ti entra...
Se ha intenzione di limitare gli utenti della tua macchina allora è buona cosa mettere delle regole su OUTPUT, altrimenti per chiudere le porte in entrata (e quindi evitare che determinati demoni possano stare in ascolto sulla rete anche se attivi) basta chiudere quelle in INPUT :roll:

Dipende quello che vuoi fare...

Mi ricordo che sotto windows il firewall serviva effettivamente più a bloccare tutti i programmini del cazzo che tentavano di conntettersi ad internet che per bloccare il traffico in entrata... se sei appena arrivato da windows capisco questa tua perplessita... :D
Sotto linux per fortuna i vari programmi (essendo opensource) non dovrebbero contenere backdoor o bachi strani per cui non hai il controllo delle informazioni che il tuo pc trasmette su internet... :roll: :D
Se però usi programmi closed-source e vuoi garantirti un discreto livello di paranoia allora puoi bloccare il traffico in uscita di questi programmi (di cui evidentemente non ti fidi) con una riga tipo questa:
Code:
#Per bloccare ACROREAD in uscita
 $IPTABLES -A OUTPUT -m owner --cmd-owner acroread -j DROP

_________________
Any mans death diminishes me, because I am involved in Mankinde; and therefore never send to know for whom the bell tolls; It tolls for thee.
-John Donne
Back to top
View user's profile Send private message
power83
l33t
l33t


Joined: 28 Nov 2004
Posts: 638

PostPosted: Wed Aug 24, 2005 10:13 pm    Post subject: Reply with quote

grazie, ora direi che posso procedere!

Sto facendo anche io un mega script usando il tuo come esempio, appena pronto lo posto
Back to top
View user's profile Send private message
pistodj
Apprentice
Apprentice


Joined: 26 Jan 2005
Posts: 229

PostPosted: Thu Aug 25, 2005 3:51 pm    Post subject: Reply with quote

diciamo che solitamente preferisco chiudere le porte che non mi servono in quanto il firewol che sto progettando sarà da bariera ad un quarantinadi pc winzoz e sicuramente avranno di quelle schifezze installate che nemmebno immagino!!

in'oltre sorreggimi se sbaglio chiudendo le porte sopra la 1024 impedisco il p2p :D
Back to top
View user's profile Send private message
Cazzantonio
Bodhisattva
Bodhisattva


Joined: 20 Mar 2004
Posts: 4514
Location: Somewere around the world

PostPosted: Thu Aug 25, 2005 4:47 pm    Post subject: Reply with quote

beh si... anche se ti consiglio vivamente di mettere le porte di ssh, telnet o qualsiasi altro servizio che ti dia una accesso ad una console sopra la 1024.... in una alta a caso in modo da evitare tutti gli attacchi automatici dai vari bot sparsi per la rete :wink:

Se devi bloccare una rete windows ti consiglio di sbarrare tutte le porte tranne quelle che usi te (anche sotto la 1024...), e comunque io il controllo lo effettuerei sulle policy "FORWARD", "POSTROUTING" e "PREROUTING" visto che il tuo server farà da gateway....

Siccome lo script era concepito principalmente come firewall casalingo ti toccherà smanettarlo un minimo cambiando le regole ed inserendo eventualmente quello che ti serve... se poi lo posti si può cercare di ampliare quello iniziale in modo da renderlo usabile anche su un gateway (senza complicarlo eccessivamente però :wink: )
_________________
Any mans death diminishes me, because I am involved in Mankinde; and therefore never send to know for whom the bell tolls; It tolls for thee.
-John Donne
Back to top
View user's profile Send private message
pistodj
Apprentice
Apprentice


Joined: 26 Jan 2005
Posts: 229

PostPosted: Fri Aug 26, 2005 6:38 am    Post subject: Reply with quote

Ci puoi contare, la mettero non appena ultimata!!
così magari se m'è sfuggito qualcosa la correggo!!:wink:
Back to top
View user's profile Send private message
Ciccio Bueo
l33t
l33t


Joined: 19 Oct 2004
Posts: 834
Location: Treviso

PostPosted: Mon Sep 12, 2005 3:05 pm    Post subject: Reply with quote

Scusatemi se sono fuori luogo... non sto usando lo script di Cazzantonio... ma non se se sia o meno il caso di postare qui la domanda... (posto qui perchè vorrei appunto usarlo ma con alcune modifiche)


allora se digito:

Code:
 iptables -L -x -v -n --line-numbers


mi trovo:

Code:
Chain INPUT (policy ACCEPT 2577173 packets, 3652312711 bytes)
num      pkts      bytes target     prot opt in     out     source               destination
1           0        0 ACCEPT     all  --  lo     *       0.0.0.0/0            0.0.0.0/0
2         294    42723 ACCEPT     all  --  eth0   *       0.0.0.0/0            0.0.0.0/0
3           0        0 REJECT     udp  --  !eth0  *       0.0.0.0/0            0.0.0.0/0           udp dpt:67 reject-with icmp-port-unreachable
4           0        0 REJECT     udp  --  !eth0  *       0.0.0.0/0            0.0.0.0/0           udp dpt:53 reject-with icmp-port-unreachable
5           1       60 ACCEPT     tcp  --  ppp0   *       0.0.0.0/0            0.0.0.0/0           tcp dpt:22
6        1020    49884 DROP       tcp  --  !eth0  *       0.0.0.0/0            0.0.0.0/0           tcp dpts:0:1023
7           2      156 DROP       udp  --  !eth0  *       0.0.0.0/0            0.0.0.0/0           udp dpts:0:1023

Chain FORWARD (policy DROP 0 packets, 0 bytes)
num      pkts      bytes target     prot opt in     out     source               destination
1           0        0 DROP       all  --  eth0   *       0.0.0.0/0            192.168.0.0/16
2      272774 127291597 ACCEPT     all  --  eth0   *       192.168.0.0/16       0.0.0.0/0
3      230920 26946954 ACCEPT     all  --  ppp0   *       0.0.0.0/0            192.168.0.0/16
4           0        0 ACCEPT     all  --  pan0   *       0.0.0.0/0            0.0.0.0/0
5           0        0 ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED

Chain OUTPUT (policy ACCEPT 4541296 packets, 3551966863 bytes)
num      pkts      bytes target     prot opt in     out     source               destination


questo vuol dire che il mio firewall è finto? cioè non sta facendo nulla?

allora... al momento il firewall è sul server router, a cui si collegano i client win/linux, sto impazzando per fare anche un NAP Bluetooth (https://forums.gentoo.org/viewtopic-t-368375.html), e non riesco a collegarmi forse perchè sbaglio la conf di iptables...

insomma... cosa devo modificare sullo script di Cazzantonio per perchè funzioni l'interfaccia pan/bnep del bluetooth? :roll:

graziel
Back to top
View user's profile Send private message
Cazzantonio
Bodhisattva
Bodhisattva


Joined: 20 Mar 2004
Posts: 4514
Location: Somewere around the world

PostPosted: Tue Sep 13, 2005 7:15 am    Post subject: Reply with quote

Mi sa che fai prima ad aprire un altro topic dove posti tutte le tue regole di iptables.... :?
_________________
Any mans death diminishes me, because I am involved in Mankinde; and therefore never send to know for whom the bell tolls; It tolls for thee.
-John Donne
Back to top
View user's profile Send private message
Ciccio Bueo
l33t
l33t


Joined: 19 Oct 2004
Posts: 834
Location: Treviso

PostPosted: Tue Sep 13, 2005 1:34 pm    Post subject: Reply with quote

ok. grazie.... una cosa sola, con quella configurazione blocco o non blocco nulla?
Back to top
View user's profile Send private message
Cazzantonio
Bodhisattva
Bodhisattva


Joined: 20 Mar 2004
Posts: 4514
Location: Somewere around the world

PostPosted: Mon Dec 26, 2005 12:48 am    Post subject: Reply with quote

UP:
Aggiornato lo script per ovviare ad una falla che impediva il corretto logging dei portscan
Che nessuno se ne sia accorto conferma che nessuno li legge i log... :evil: potete anche togliere quella regola che tanto è inutile se poi non andate a verificare i log :twisted:
In ogni caso visto che finora nemmeno io me ne ero accorto sono anch'io nel gruppo dei "disattenti" :wink:

Aggiunto inoltre un piccolo suggerimento su come modificare syslog-ng per loggare in maniera pulita e precisa gli eventi del firewall
_________________
Any mans death diminishes me, because I am involved in Mankinde; and therefore never send to know for whom the bell tolls; It tolls for thee.
-John Donne
Back to top
View user's profile Send private message
MonsterMord
Guru
Guru


Joined: 28 Apr 2004
Posts: 395
Location: Italy --> Forli'

PostPosted: Mon Dec 26, 2005 12:21 pm    Post subject: Reply with quote

Partendo dal lavoro di Cazzantonio ho effettuato delle modifiche per il mio PC casalingo che funge da router tra internet e la lan casalinga.
Metto qui' il mio file di configurazione, nel caso possa essere di utilita' ad altri.
Preciso che l'ho costruito per imparare ad usare net_filter, non per creare un firewall a regola d'arte, i puristi della sicurezza mi perdonino.

Problemi noti:
1)la regola per il syn-flood invalida tutte le regole seguenti, tutto cio' che non e' syn-flood viene accettato metre bisognerebbe farla proseguire nella lista delle catene.

2) Nella guida http://www.gentoo.org/doc/en/security/security-handbook.xml?part=1&chap=12 la regola per il postscan e' applicata anche per le catene OUTPUT e FORWARD, non ne capisco il motivo.

3) Per il traffico FTP ricordarsi di caricare il modulo "ip_conntrack_ftp"


Code:

#!/bin/bash

# Autore originale: Cazzantonio from gentoo italian forum
# Modifiche e personalizzazioni di MonsterMord from gentoo italian forum

# catene in USCITA:
#    EFACE : servizi forniti dal server locale verso l'esterno (internet), esempio connessione SSH
#    IFACE : servizi forniti dal server locale verso l'interno (lan), esempio HTTPD
# catene di ENTRATA:
#    EFACE : servizi forniti dall'esterno (internet) e richiesti dal server
#    IFACE : servizi forniti dall'interno (lan) e richiesti dal server
# dove c'e' una entrata ci deve essere una uscita su una porta non privilegiata,
# da cui la catena CONNESSIONI AVVIATE sulle porte non privilegiate.

# Defininco la posizione degli eseguibili di iptables
IPTABLES=/sbin/iptables
IPTABLESSAVE=/sbin/iptables-save
IPTABLESRESTORE=/sbin/iptables-restore

# Interfacce
IFACE=eth0 # Interfaccia interna LAN
EFACE=ppp+ # Interfaccia esterna INTERNET
LAN=192.168.0.0/24
# Nameservers
NAMESERVER_1=85.37.17.47
NAMESERVER_2=151.99.125.1

# Definizioni delle porte
FTP_PORT=21
SSH_PORT=22
SMTP_PORT=25
TIMESERVER_PORT=37
DNS_PORT=53
POP3_PORT=110
HTTP_PORT=80
NETBIOS_PORTS=137:139
HTTPS_PORT=443
MICROSOFT_DS_PORT=445
REALTIME_PORT=554
IPP_PORT=631
RSYNC_PORT=873
POP3S_PORT=995
MS_STREAMING_PORT=1755
MSN_MESSANGER_PORT=1863
    # tcp 14300
    # udp 7790 12352
GNUNET_PORT=2086
SKYPE_PORT=2424
ED2K_PORTS=4662:4666
AMULE_PORT=4672
ICQ_PORT=5190
JABBER_PORT=5222
BITTORRENT_PORTS=6881:6889
BITTORRENT_TRACKER_PORT=6969
MSN_FILE_VOICE_PORTS=6891:6901
FREENET_PORT=19577
P_PORTS=0:1023
UP_PORTS=1024:65535


##########################################################################
# Pulisco tutte le regole e ripristino quelle di default (ACCEPT)
##########################################################################

  $IPTABLES -F
  $IPTABLES -F -t mangle
  $IPTABLES -F -t nat
  $IPTABLES -X
  $IPTABLES -X -t mangle
  $IPTABLES -X -t nat
# Set Defaults to ACCEPT
  $IPTABLES -P INPUT ACCEPT
  $IPTABLES -P OUTPUT ACCEPT
  $IPTABLES -P FORWARD ACCEPT


##########################################################################
# Definisco la policy di default
##########################################################################

  $IPTABLES -P INPUT DROP
  $IPTABLES -P OUTPUT DROP
  $IPTABLES -P FORWARD DROP


##########################################################################
# Definisco le catene per i vari tipi di paccehtti
##########################################################################

# Catena per il traffico ICMP in uscita verso rete esterna ed interna, abilito tutto
  $IPTABLES -N icmp_out
  $IPTABLES -F icmp_out
  $IPTABLES -A icmp_out -o $EFACE -p icmp -j ACCEPT
  $IPTABLES -A icmp_out -o $IFACE -p icmp -j ACCEPT

# Catena per il traffico ICMP in entrata
# ICMP (in entrata) Solo se fanno parte di connessioni preesistenti, cioè si
# tratta di una risposta ad un pacchetto inviato dalla nostra rete
  $IPTABLES -N icmp_in
  $IPTABLES -F icmp_in
  $IPTABLES -A icmp_in -p icmp --icmp-type time-exceeded -j ACCEPT
  $IPTABLES -A icmp_in -p icmp --icmp-type destination-unreachable -j ACCEPT
  $IPTABLES -A icmp_in -p icmp --icmp-type ping -m limit --limit 1/s -j ACCEPT
  $IPTABLES -A icmp_in -p icmp -j LOG --log-prefix "FW:Bad ICMP traffic:"

# Protezione dai SYN-FLOOD
# ATTENZIONE: NON ATTIVARE QUESTA REGOLA !!!
  $IPTABLES -N syn_flood
  $IPTABLES -F syn_flood
  $IPTABLES -A syn_flood -p tcp --syn -m limit --limit 1/s --limit-burst 4 -j ACCEPT
  $IPTABLES -A syn_flood -p tcp --syn -j DROP

# Catena per FTP in uscita, abilita le connessioni FTP verso esterno ed interno
# FTP (in uscita)
  $IPTABLES -N ftp_out
  $IPTABLES -F ftp_out
  $IPTABLES -A ftp_out -o $EFACE -p tcp --dport $FTP_PORT -m state --state NEW,ESTABLISHED -j ACCEPT
  $IPTABLES -A ftp_out -o $IFACE -p tcp --dport $FTP_PORT -m state --state NEW,ESTABLISHED -j ACCEPT

# Catena per FTP in entrata, solo per l'interno
  $IPTABLES -N ftp_in
  $IPTABLES -F ftp_in
  $IPTABLES -A ftp_in -i $IFACE -p tcp --dport $FTP_PORT -m state --state NEW,ESTABLISHED -j ACCEPT

# Catena per SSH in uscita, abilita le connessioni SSH verso esterno e interno
  $IPTABLES -N ssh_out
  $IPTABLES -F ssh_out
  $IPTABLES -A ssh_out -o $EFACE -p tcp --dport $SSH_PORT -m state --state NEW,ESTABLISHED -j ACCEPT
  $IPTABLES -A ssh_out -o $IFACE -p tcp --dport $SSH_PORT -m state --state NEW,ESTABLISHED -j ACCEPT

# Catena per SSH in entrata dall'esterno e dall'interno
# SSH (in entrata) In entrata abilitato il traffico per la porta $SSH_PORT
# Limtati i pacchetti RST FIN e SYN a 1/seondo
  $IPTABLES -N ssh_in
  $IPTABLES -F ssh_in
  $IPTABLES -A ssh_in -m limit --limit 1/second -p tcp --tcp-flags ALL RST --dport $SSH_PORT -j ACCEPT
  $IPTABLES -A ssh_in -m limit --limit 1/second -p tcp --tcp-flags ALL FIN --dport $SSH_PORT -j ACCEPT
  $IPTABLES -A ssh_in -m limit --limit 1/second -p tcp --tcp-flags ALL SYN --dport $SSH_PORT -j ACCEPT
  $IPTABLES -A ssh_in -i $EFACE -p tcp --dport $SSH_PORT -m state --state RELATED,ESTABLISHED -j ACCEPT
  $IPTABLES -A ssh_in -i $IFACE -p tcp --dport $SSH_PORT -m state --state RELATED,ESTABLISHED -j ACCEPT

# Catena per SMTP in uscita, abilita le connessioni SMTP verso server esterni
  $IPTABLES -N smtp_out
  $IPTABLES -F smtp_out
  $IPTABLES -A smtp_out -o $EFACE -p tcp --dport $SMTP_PORT -m state --state NEW,ESTABLISHED -j ACCEPT

# Catena per TIMESERVER in uscita, abilita le connessioni TIMESERVER verso server esterni
  $IPTABLES -N timeserver_out
  $IPTABLES -F timeserver_out
  $IPTABLES -A timeserver_out -o $EFACE -p tcp --dport $TIMESERVER_PORT -m state --state NEW,ESTABLISHED -j ACCEPT
  $IPTABLES -A timeserver_out -o $EFACE -p udp --dport $TIMESERVER_PORT -m state --state NEW,ESTABLISHED -j ACCEPT

# Catena per il DNS query in uscita
# DNS (client -> server) Vengono abilitate le query in uscita ai DNS servers
  $IPTABLES -N dns_out
  $IPTABLES -F dns_out
  $IPTABLES -A dns_out -o $EFACE -p udp -d $NAMESERVER_1 --dport $DNS_PORT -m state --state NEW,ESTABLISHED -j ACCEPT
  $IPTABLES -A dns_out -o $EFACE -p udp -d $NAMESERVER_2 --dport $DNS_PORT -m state --state NEW,ESTABLISHED -j ACCEPT

# Catena per POP3 in uscita, abilita le connessioni POP3 verso server esterni
  $IPTABLES -N pop3_out
  $IPTABLES -F pop3_out
  $IPTABLES -A pop3_out -o $EFACE -p tcp --dport $POP3_PORT -m state --state NEW,ESTABLISHED -j ACCEPT

# Catena per il traffico NETBIOS in uscita sulla rete interna
  $IPTABLES -N netbios_out
  $IPTABLES -F netbios_out
  $IPTABLES -A netbios_out -o $IFACE -p tcp --dport $NETBIOS_PORTS -m state --state NEW,ESTABLISHED -j ACCEPT
  $IPTABLES -A netbios_out -o $IFACE -p udp --dport $NETBIOS_PORTS -m state --state NEW,ESTABLISHED -j ACCEPT

# Catena per il traffico HTTP in uscita
  $IPTABLES -N http_out
  $IPTABLES -F http_out
  $IPTABLES -A http_out -o $IFACE -p tcp --dport $HTTP_PORT -m state --state NEW,ESTABLISHED -j ACCEPT
  $IPTABLES -A http_out -o $EFACE -p tcp --dport $HTTP_PORT -m state --state NEW,ESTABLISHED -j ACCEPT

# Catena per il traffico HTTP in entrata solo per l'interno
  $IPTABLES -N http_in
  $IPTABLES -F http_in
  $IPTABLES -A http_in -i $IFACE -p tcp --dport $HTTP_PORT -m state --state NEW,ESTABLISHED -j ACCEPT

# Catena per il traffico HTTPS in uscita
  $IPTABLES -N https_out
  $IPTABLES -F https_out
  $IPTABLES -A https_out -o $EFACE -p tcp --dport $HTTPS_PORT -m state --state NEW,ESTABLISHED -j ACCEPT

# Catena per il traffico MICROSOFT_DS in uscita sulla rete interna
  $IPTABLES -N microsoft_ds_out
  $IPTABLES -F microsoft_ds_out
  $IPTABLES -A microsoft_ds_out -o $IFACE -p tcp --dport $MICROSOFT_DS_PORT -m state --state NEW,ESTABLISHED -j ACCEPT
  $IPTABLES -A microsoft_ds_out -o $IFACE -p udp --dport $MICROSOFT_DS_PORT -m state --state NEW,ESTABLISHED -j ACCEPT

# Catena per il traffico REALTIME in uscita
  $IPTABLES -N realtime_out
  $IPTABLES -F realtime_out
  $IPTABLES -A realtime_out -o $EFACE -p tcp --dport $REALTIME_PORT -m state --state NEW,ESTABLISHED -j ACCEPT
  $IPTABLES -A realtime_out -o $EFACE -p udp --dport $REALTIME_PORT -m state --state NEW,ESTABLISHED -j ACCEPT

# Catena per il traffico IPP in uscita sulla rete interna
  $IPTABLES -N ipp_out
  $IPTABLES -F ipp_out
  $IPTABLES -A ipp_out -o $IFACE -p tcp --dport $IPP_PORT -m state --state NEW,ESTABLISHED -j ACCEPT

# Catena per il traffico IPP in entrata solo per l'interno
  $IPTABLES -N ipp_in
  $IPTABLES -F ipp_in
  $IPTABLES -A ipp_in -i $IFACE -p tcp --dport $IPP_PORT -m state --state NEW,ESTABLISHED -j ACCEPT

# Catena per RSYNC in uscita
  $IPTABLES -N rsync_out
  $IPTABLES -F rsync_out
  $IPTABLES -A rsync_out -o $EFACE -p tcp --dport $RSYNC_PORT -m state --state NEW,ESTABLISHED -j ACCEPT
  $IPTABLES -A rsync_out -o $IFACE -p tcp --dport $RSYNC_PORT -m state --state NEW,ESTABLISHED -j ACCEPT

# Catena per RSYNC in entrata solo per l'interno
  $IPTABLES -N rsync_in
  $IPTABLES -F rsync_in
  $IPTABLES -A rsync_in -i $IFACE -p tcp --dport $RSYNC_PORT -m state --state NEW,ESTABLISHED -j ACCEPT

# Catena per POP3S in uscita, abilita le connessioni POP3S verso server esterni
  $IPTABLES -N pop3s_out
  $IPTABLES -F pop3s_out
  $IPTABLES -A pop3s_out -o $EFACE -p tcp --dport $POP3S_PORT -m state --state NEW,ESTABLISHED -j ACCEPT

# Catena per MS_STREAMING in uscita, abilita le connessioni MMS
  $IPTABLES -N ms_streaming_out
  $IPTABLES -F ms_streaming_out
  $IPTABLES -A ms_streaming_out -o $EFACE -p tcp --dport $MS_STREAMING_PORT -m state --state NEW,ESTABLISHED -j ACCEPT
  $IPTABLES -A ms_streaming_out -o $EFACE -p udp --dport $MS_STREAMING_PORT -m state --state NEW,ESTABLISHED -j ACCEPT

# Catena per MSN_MESSANGER in uscita, abilita le connessioni MSN_MESSANGER verso server esterni
  $IPTABLES -N msn_messanger_out
  $IPTABLES -F msn_messanger_out
  $IPTABLES -A msn_messanger_out -o $EFACE -p tcp --dport $MSN_MESSANGER_PORT -m state --state NEW,ESTABLISHED -j ACCEPT

# Catena per SKYPE in uscita, abilita le connessioni SKYPE
  $IPTABLES -N skype_out
  $IPTABLES -F skype_out
  $IPTABLES -A skype_out -o $EFACE -p udp --dport $SKYPE_PORT -m state --state NEW,ESTABLISHED -j ACCEPT

# Catena per ED2K in uscita
  $IPTABLES -N ed2k_out
  $IPTABLES -F ed2k_out
  $IPTABLES -A ed2k_out -p tcp --dport $ED2K_PORTS -m state --state NEW,ESTABLISHED -j ACCEPT
  $IPTABLES -A ed2k_out -p udp --dport $ED2K_PORTS -m state --state NEW,ESTABLISHED -j ACCEPT

# Catena per ED2K in entrata
  $IPTABLES -N ed2k_in
  $IPTABLES -F ed2k_in
  $IPTABLES -A ed2k_in -p tcp --dport $ED2K_PORTS -m state --state NEW,ESTABLISHED -j ACCEPT
  $IPTABLES -A ed2k_in -p udp --dport $ED2K_PORTS -m state --state NEW,ESTABLISHED -j ACCEPT

# Catena per AMULE in uscita
  $IPTABLES -N amule_out
  $IPTABLES -F amule_out
  $IPTABLES -A amule_out -p udp --dport $AMULE_PORT -m state --state NEW,ESTABLISHED -j ACCEPT

# Catena per AMULE in entrata
  $IPTABLES -N amule_in
  $IPTABLES -F amule_in
  $IPTABLES -A amule_in -p udp --dport $AMULE_PORT -m state --state NEW,ESTABLISHED -j ACCEPT

# Catena per GNUNET in uscita
  $IPTABLES -N gnunet_out
  $IPTABLES -F gnunet_out
  $IPTABLES -A gnunet_out -p tcp --dport $GNUNET_PORT -m state --state NEW,ESTABLISHED -j ACCEPT
  $IPTABLES -A gnunet_out -p udp --dport $GNUNET_PORT -m state --state NEW,ESTABLISHED -j ACCEPT

# Catena per GNUNET in entrata
  $IPTABLES -N gnunet_in
  $IPTABLES -F gnunet_in
  $IPTABLES -A gnunet_in -p tcp --dport $GNUNET_PORT -m state --state NEW,ESTABLISHED -j ACCEPT
  $IPTABLES -A gnunet_in -p udp --dport $GNUNET_PORT -m state --state NEW,ESTABLISHED -j ACCEPT

# Catena per ICQ in uscita, abilita le connessioni ICQ verso server esterni
  $IPTABLES -N icq_out
  $IPTABLES -F icq_out
  $IPTABLES -A icq_out -o $EFACE -p tcp --dport $ICQ_PORT -m state --state NEW,ESTABLISHED -j ACCEPT

# Catena per JABBER in uscita, abilita le connessioni JABBER verso server esterni
  $IPTABLES -N jabber_out
  $IPTABLES -F jabber_out
  $IPTABLES -A jabber_out -o $EFACE -p tcp --dport $JABBER_PORT -m state --state NEW,ESTABLISHED -j ACCEPT

# Catena per BITTORRENT in uscita
  $IPTABLES -N bittorrent_out
  $IPTABLES -F bittorrent_out
  $IPTABLES -A bittorrent_out -p tcp --dport $BITTORRENT_PORTS -m state --state NEW,ESTABLISHED -j ACCEPT

# Catena per BITTORRENT in entrata
  $IPTABLES -N bittorrent_in
  $IPTABLES -F bittorrent_in
  $IPTABLES -A bittorrent_in -p tcp --dport $BITTORRENT_PORTS -m state --state NEW,ESTABLISHED -j ACCEPT

# Catena per BITTORRENT TRACKER in uscita
  $IPTABLES -N bittorrent_tracker_out
  $IPTABLES -F bittorrent_tracker_out
  $IPTABLES -A bittorrent_tracker_out -p tcp --dport $BITTORRENT_TRACKER_PORT -m state --state NEW,ESTABLISHED -j ACCEPT

# Catena per FREENET in uscita
  $IPTABLES -N freenet_out
  $IPTABLES -F freenet_out
  $IPTABLES -A freenet_out -p tcp --dport $FREENET_PORT -m state --state NEW,ESTABLISHED -j ACCEPT

# Catena per FREENET in entrata
  $IPTABLES -N freenet_in
  $IPTABLES -F freenet_in
  $IPTABLES -A freenet_in -p tcp --dport $FREENET_PORT -m state --state NEW,ESTABLISHED -j ACCEPT

# Catena per le connessioni già avviate (da mettere in fondo alle regole)
  $IPTABLES -N connessioni_avviate
  $IPTABLES -F connessioni_avviate
  $IPTABLES -A connessioni_avviate -m state --state ESTABLISHED,RELATED -j ACCEPT
  #$IPTABLES -A connessioni_avviate -i $EFACE -m limit -j LOG --log-prefix "FW:Bad packet from ${EFACE}:"
  #$IPTABLES -A connessioni_avviate -i $IFACE -m limit -j LOG --log-prefix "FW:Bad packet from ${IFACE}:"
  $IPTABLES -A connessioni_avviate -i $EFACE -j LOG --log-prefix "FW:Bad packet from ${EFACE}:"
  $IPTABLES -A connessioni_avviate -i $IFACE -j LOG --log-prefix "FW:Bad packet from ${IFACE}:"
  $IPTABLES -A connessioni_avviate -j DROP


##########################################################################
# Definisco la catene per intercettare i portscan
##########################################################################

# Catena per loggare i portscan
  $IPTABLES -N portscan
  $IPTABLES -F portscan

 # NMAP-XMAS
  $IPTABLES -A portscan -p tcp --tcp-flags ALL FIN,URG,PSH -m limit \
            --limit 5/minute -j LOG --log-level alert --log-prefix "FW:SCAN:NMAP-XMAS:"
  $IPTABLES -A portscan -p tcp --tcp-flags ALL FIN,URG,PSH -j DROP

 # XMAS
  $IPTABLES -A portscan -p tcp --tcp-flags ALL ALL -m limit \
            --limit 5/minute -j LOG --log-level 1 --log-prefix "FW:SCAN:XMAS:"
  $IPTABLES -A portscan -p tcp --tcp-flags ALL ALL -j DROP

 # XMAS-PSH
  $IPTABLES -A portscan -p tcp --tcp-flags ALL SYN,RST,ACK,FIN,URG -m limit \
            --limit 5/minute -j LOG --log-level 1 --log-prefix "FW:SCAN:XMAS-PSH:"
  $IPTABLES -A portscan -p tcp --tcp-flags ALL SYN,RST,ACK,FIN,URG -j DROP

 # NULL_SCAN
  $IPTABLES -A portscan -p tcp --tcp-flags ALL NONE -m limit \
            --limit 5/minute -j LOG --log-level 1 --log-prefix "FW:SCAN:NULL_SCAN:"
  $IPTABLES -A portscan -p tcp --tcp-flags ALL NONE -j DROP

 # SYN/RST
  $IPTABLES -A portscan -p tcp --tcp-flags SYN,RST SYN,RST -m limit \
            --limit 5/minute -j LOG --log-level 5 --log-prefix "FW:SCAN:SYN/RST:"
  $IPTABLES -A portscan -p tcp --tcp-flags SYN,RST SYN,RST -j DROP

 # SYN/FIN
  $IPTABLES -A portscan -p tcp --tcp-flags SYN,FIN SYN,FIN -m limit \
            --limit 5/minute -j LOG --log-level 5 --log-prefix "FW:SCAN:SYN/FIN:"
  $IPTABLES -A portscan -p tcp --tcp-flags SYN,FIN SYN,FIN -j DROP

##########################################################################
# Applico le catene a INPUT, OUTPUT e FORWARD
# Scarto i pacchetti INVALID
##########################################################################

# Applico le catene a INPUT
  $IPTABLES -A INPUT -j portscan
  $IPTABLES -A INPUT -m state --state INVALID -j DROP
  $IPTABLES -A INPUT -j icmp_in
  #$IPTABLES -A INPUT -j syn_flood # NON ATTIVARE, invalida tutte le successive regole!
  $IPTABLES -A INPUT -i lo -j ACCEPT
  $IPTABLES -A INPUT -j ftp_in
  $IPTABLES -A INPUT -j ssh_in
  $IPTABLES -A INPUT -j http_in
  $IPTABLES -A INPUT -j ipp_in
  $IPTABLES -A INPUT -j rsync_in
  $IPTABLES -A INPUT -j ed2k_in
  $IPTABLES -A INPUT -j amule_in
  #$IPTABLES -A INPUT -j gnunet_in
  $IPTABLES -A INPUT -j bittorrent_in
  #$IPTABLES -A INPUT -i freenet_in
  $IPTABLES -A INPUT -j connessioni_avviate

# Applico le catene a OUTPUT
  $IPTABLES -A OUTPUT -m state --state INVALID -j DROP
  $IPTABLES -A OUTPUT -j icmp_out
  #$IPTABLES -A OUTPUT -j portscan
  $IPTABLES -A OUTPUT -o lo -j ACCEPT
  $IPTABLES -A OUTPUT -j ftp_out
  $IPTABLES -A OUTPUT -j ssh_out
  $IPTABLES -A OUTPUT -j smtp_out
  $IPTABLES -A OUTPUT -j timeserver_out
  $IPTABLES -A OUTPUT -j dns_out
  $IPTABLES -A OUTPUT -j pop3_out
  $IPTABLES -A OUTPUT -j netbios_out
  $IPTABLES -A OUTPUT -j http_out
  $IPTABLES -A OUTPUT -j microsoft_ds_out
  $IPTABLES -A OUTPUT -j https_out
  $IPTABLES -A OUTPUT -j realtime_out
  $IPTABLES -A OUTPUT -j ipp_out
  $IPTABLES -A OUTPUT -j rsync_out
  $IPTABLES -A OUTPUT -j pop3s_out
  $IPTABLES -A OUTPUT -j ms_streaming_out
  $IPTABLES -A OUTPUT -j msn_messanger_out
  #$IPTABLES -A OUTPUT -j gnunet_out
  $IPTABLES -A OUTPUT -j skype_out
  $IPTABLES -A OUTPUT -j ed2k_out
  $IPTABLES -A OUTPUT -j amule_out
  $IPTABLES -A OUTPUT -j icq_out
  $IPTABLES -A OUTPUT -j jabber_out
  $IPTABLES -A OUTPUT -j bittorrent_out
  $IPTABLES -A OUTPUT -j bittorrent_tracker_out
  #$IPTABLES -A OUTPUT -j freenet_out
  $IPTABLES -A OUTPUT -j connessioni_avviate

# Applico le catene a FORWARD
  $IPTABLES -A FORWARD -m state --state INVALID -j DROP
  $IPTABLES -A FORWARD -j icmp_out
  #$IPTABLES -A FORWARD -j portscan
  $IPTABLES -A FORWARD -o lo -j ACCEPT
  $IPTABLES -A FORWARD -j ftp_out
  $IPTABLES -A FORWARD -j smtp_out
  $IPTABLES -A FORWARD -j timeserver_out
  $IPTABLES -A FORWARD -j dns_out
  $IPTABLES -A FORWARD -j pop3_out
  $IPTABLES -A FORWARD -j http_out
  $IPTABLES -A FORWARD -j https_out
  $IPTABLES -A FORWARD -j realtime_out
  $IPTABLES -A FORWARD -j rsync_out
  $IPTABLES -A FORWARD -j pop3s_out
  $IPTABLES -A FORWARD -j ms_streaming_out
  $IPTABLES -A FORWARD -j msn_messanger_out
  #$IPTABLES -A FORWARD -j gnunet_out
  $IPTABLES -A FORWARD -j skype_out
  $IPTABLES -A FORWARD -j ed2k_out
  $IPTABLES -A FORWARD -j amule_out
  $IPTABLES -A FORWARD -j icq_out
  $IPTABLES -A FORWARD -j jabber_out
  #$IPTABLES -A FORWARD -j bittorrent_out
  #$IPTABLES -A FORWARD -j bittorrent_tracker_out
  #$IPTABLES -A FORWARD -j freenet_out
  $IPTABLES -A FORWARD -j connessioni_avviate


##########################################################################
# NAT CHAIN
##########################################################################
  #$IPTABLES -I FORWARD -i $IFACE -d 192.168.0.0/255.255.0.0 -j DROP
  #$IPTABLES -A FORWARD -i $IFACE -s 192.168.0.0/255.255.0.0 -j ACCEPT
  #$IPTABLES -A FORWARD -i $EFACE -d 192.168.0.0/255.255.0.0 -j ACCEPT
  $IPTABLES -t nat -A POSTROUTING -o $EFACE -j MASQUERADE


##########################################################################
# Variabili SYS-CTL
##########################################################################

# Abilita o disabilita l'IP FORWARDING
# echo "1" > /proc/sys/net/ipv4/ip_forward
/bin/echo "1" > /proc/sys/net/ipv4/ip_forward

# DYNAMIC ADDRESSING (utile per il forwarding)
# /bin/echo "1" > /proc/sys/net/ipv4/ip_dynaddr

# Disabilita l'IP Spoofing
/bin/echo "1" > /proc/sys/net/ipv4/conf/all/rp_filter

# Non rispondere ai PING
# /bin/echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_all

# Non rispondere agli ICMP BROADCAST (attacchi smurf)
# /bin/echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts

# Disabilita l'accettazione dei REDIRECT
/bin/echo "0" > /proc/sys/net/ipv4/conf/all/accept_redirects
/bin/echo "0" > /proc/sys/net/ipv4/conf/all/secure_redirects

# Protezione verso i messaggi di errore ICMP malformati
/bin/echo "1" > /proc/sys/net/ipv4/icmp_ignore_bogus_error_responses

# Disabilita i pacchetti source routed (previene dal guardare attraverso il NAT)
/bin/echo "0" > /proc/sys/net/ipv4/conf/all/accept_source_route

# Abilita LOG_MARTIANS (effettua il log dei pacchetti strani)
/bin/echo "1" > /proc/sys/net/ipv4/conf/all/log_martians

# Abilita il  REVERSE PATH FILTERING
for i in /proc/sys/net/ipv4/conf/*; do
  /bin/echo "1" > $i/rp_filter
done

_________________
Gentoo GNU/Linux on DELL Inspiron 8500
Back to top
View user's profile Send private message
Cazzantonio
Bodhisattva
Bodhisattva


Joined: 20 Mar 2004
Posts: 4514
Location: Somewere around the world

PostPosted: Mon Dec 26, 2005 4:13 pm    Post subject: Reply with quote

MonsterMord wrote:
2) Nella guida http://www.gentoo.org/doc/en/security/security-handbook.xml?part=1&chap=12 la regola per il postscan e' applicata anche per le catene OUTPUT e FORWARD, non ne capisco il motivo.

Se la regola per i portscan viene messa dopo quella che droppa i pacchetti "INVALID" allora non prende niente... La maggior parte dei pacchetti usati per i portscan sono appunto INVALID quindi vengono droppati prima di essere loggati :wink:

P.S. hai delle particolari ragioni per autorizzare solo determinate porte in uscita? Altrimenti che senso ha mettere delle regole in uscita? Serve solo a limitare gli utenti...

Non ho mai usato la regola per i syn-flood ma penso che si posa togliere semplicemente l'ultima riga (quella del drop)
Mi pare inoltre che i syn-flood non funzionino nemmeno con i kernel recenti (ma non confermo)... mi sa che tolgo proprio la regola dallo script iniziale :wink:
_________________
Any mans death diminishes me, because I am involved in Mankinde; and therefore never send to know for whom the bell tolls; It tolls for thee.
-John Donne
Back to top
View user's profile Send private message
MonsterMord
Guru
Guru


Joined: 28 Apr 2004
Posts: 395
Location: Italy --> Forli'

PostPosted: Wed Dec 28, 2005 1:33 pm    Post subject: Reply with quote

Cazzantonio wrote:

P.S. hai delle particolari ragioni per autorizzare solo determinate porte in uscita? Altrimenti che senso ha mettere delle regole in uscita? Serve solo a limitare gli utenti...


Serve a chiudermi fuori dalla rete :-D
A parte gli scherzi, nella pratica non serve a niente (come del resto l'uso del mio firewall, con il tcpwrapper avrei avuto lo stesso grado di sicurezza).
L'ho abilitato per puro scopo didattico; ho client win98 e winnt, se qualcuno volesse accedere all'esterno senza autorizzazione ne sarei informato. Per quello ho abilitato il LOG di tutto il traffico Bad.
_________________
Gentoo GNU/Linux on DELL Inspiron 8500
Back to top
View user's profile Send private message
Dr.Dran
l33t
l33t


Joined: 08 Oct 2004
Posts: 766
Location: Imola - Italy

PostPosted: Thu Dec 29, 2005 11:52 pm    Post subject: Reply with quote

k.gothmog wrote:
ho quasi paura a fare questa domanda: non vorrei si scatenasse un flame...
ma mi dite che senso ha fare uno script di avvio per il firewall?
non si possono scrivere le regole in /var/lib/iptables/rules-save? sarebbe un enorme risparmio di tempo, e mette al sicuro dai potenziali errori di scrittura del firewall


Scusate se arrivo in ampio ritardo... comunque gli script che avete presentato sono molto carini... però sono della medesima opinione di k.gothmog di cui cito integralmente il post... dal mio punto di vista è inutile preparare script per le varie configurazioni, nel senso che uno scritp di questo tipo non è flessibile e non è riutilizzabile in qualsiasi situazione... sarebbe molto + interessante sviluppare una piccola interfaccia semplice ed intuitiva per creare regole di firewalling con iptables... lo so che esistono programmai che faano già questo... ma secondo voi sono veramente usabili? Cosa manca? Beh per quello che riguarda la mia esperienza che viene dalla shell (quindi un ambiente non definibile come usabile) le interfaccie che sono in giro fanno schifo... (citando Icaza direi un bel "sucks") :D :D :D

Scusate se sono andato un pochino Off-Topic... ma mi sembrava una cosa + sensata...

Ciauz :D :D :D
_________________
:: [Dr.Dran] Details ::
- Linux User # 286282
- IT FreeLance Consultant
- President of ImoLUG [Imola & Faenza Linux User Group]
Back to top
View user's profile Send private message
Cazzantonio
Bodhisattva
Bodhisattva


Joined: 20 Mar 2004
Posts: 4514
Location: Somewere around the world

PostPosted: Fri Dec 30, 2005 12:41 am    Post subject: Reply with quote

DranXXX wrote:
dal mio punto di vista è inutile preparare script per le varie configurazioni, nel senso che uno scritp di questo tipo non è flessibile e non è riutilizzabile in qualsiasi situazione...

Beh lo script serve solo per lanciare iptables (che è discretamente flessibile)... sei liberissimo di scrivere regole personalizzate e di lanciare mettendo una riga in /etc/conf.d/local.start... io continuo a preferire lo script di init per via dei simpatici ok verdi che mi stampa a destra dello schermo :wink:
DranXXX wrote:
Scusate se sono andato un pochino Off-Topic... ma mi sembrava una cosa + sensata...

Scrivere una gui per iptables richiede due balle grosse come una casa e tanto tempo da perderci... il mio script mi ha preso al massimo un'oretta... questo mi pare sensato :wink:
Le balle grosse come una casa servono perché una gui per iptables che contenesse tutte le opzioni che puoi dare da terminale dovrebbe essere fatta troppo bene e troppo complicata imho (ma non ho mai usato delle gui per iptables quindi...)
In ogni caso scusa ma non capisco l'affermazione "a me non piace usare script di init" dentro questo thread... liberissimo... tuttavia mica ti costringo ad usarlo...
_________________
Any mans death diminishes me, because I am involved in Mankinde; and therefore never send to know for whom the bell tolls; It tolls for thee.
-John Donne
Back to top
View user's profile Send private message
Dr.Dran
l33t
l33t


Joined: 08 Oct 2004
Posts: 766
Location: Imola - Italy

PostPosted: Fri Dec 30, 2005 10:14 am    Post subject: Reply with quote

Cazzantonio wrote:
In ogni caso scusa ma non capisco l'affermazione "a me non piace usare script di init" dentro questo thread... liberissimo... tuttavia mica ti costringo ad usarlo...


Ma chi l'ha detto? :wink: Io non ho scritto questo :wink:
Il concetto è che esiste già lo script di iptables e che basta editare come diceva k.gothmog il file var/lib/iptables/rules-save... perchè scrivere uno script ex novo? Tutto qui... :wink:

[OT]Mah, la mia è solo una provocazione, il problema è che quando devi dare in mano un servizio come un server o un router con sopra installato linux a un CED esterno... di solito è sempre un macello... il + delle volte quando si parla di modificare file di conf a manina ti storcono il naso... anche perchè la competenza è abbastanza limitata... :wink: [/OT]

EDIT: scusate, ma ogni tanto sclero un pochino... sapete fare 2 lavori massacra un pochino! (contorsione linguistica) :D
_________________
:: [Dr.Dran] Details ::
- Linux User # 286282
- IT FreeLance Consultant
- President of ImoLUG [Imola & Faenza Linux User Group]
Back to top
View user's profile Send private message
Ilvalle
Guru
Guru


Joined: 07 Mar 2005
Posts: 325
Location: Gallarate - ITALY

PostPosted: Mon Mar 13, 2006 9:11 pm    Post subject: Reply with quote

Ciao, ho provato il firewall
l'ho modificato un po a mio piacimento, e cercando un po in giro non mi sembra
di aver fatto delle castronerie.
ora il problema sono i portscan
questo è la mia config
http://www.cs.unibo.it/~valleri/files/fw
Se faccio anche solo
Code:

valleri@prosecco:~$ nmap -P0 masia5.homelinux.org -p 22

Starting Nmap 4.00 ( http://www.insecure.org/nmap/ ) at 2006-03-13 22:10 CET
Interesting ports on adsl-ull-186-3.41-151.net24.it (151.41.3.186):
PORT   STATE SERVICE
22/tcp open  ssh

Nmap finished: 1 IP address (1 host up) scanned in 1.205 seconds

cosa sbaglio??

Paolo
Back to top
View user's profile Send private message
neryo
Veteran
Veteran


Joined: 09 Oct 2004
Posts: 1292
Location: Ferrara, Italy, Europe

PostPosted: Mon Mar 13, 2006 9:39 pm    Post subject: Reply with quote

@Ilvalle in che senso hai problemi con i port scan? non vuoi vedere la porta ssh aperta?
_________________
cache: a safe place for hiding or storing things..

D-link DWL-G650 AirPlus
Apache Php Mysql
Back to top
View user's profile Send private message
Ilvalle
Guru
Guru


Joined: 07 Mar 2005
Posts: 325
Location: Gallarate - ITALY

PostPosted: Mon Mar 13, 2006 9:44 pm    Post subject: Reply with quote

Si,
il problema è che non vorrei che con i portscan si possa sapere
quali servizi offre il mio server...
Infatti nelle impostazioni del fw, i portscan dovrebbere essere droppati.


Paolo
Back to top
View user's profile Send private message
neryo
Veteran
Veteran


Joined: 09 Oct 2004
Posts: 1292
Location: Ferrara, Italy, Europe

PostPosted: Mon Mar 13, 2006 9:53 pm    Post subject: Reply with quote

Ilvalle wrote:
Si,
il problema è che non vorrei che con i portscan si possa sapere
quali servizi offre il mio server...
Infatti nelle impostazioni del fw, i portscan dovrebbere essere droppati.


potresti usare il port knocking...

http://www.portknocking.org/

oppure usare per ssh una porta diversa, tanto sicuramente se usi una buon user e password e hai disabilitato il login da root e' piu che sicuro.. non trovi?
_________________
cache: a safe place for hiding or storing things..

D-link DWL-G650 AirPlus
Apache Php Mysql
Back to top
View user's profile Send private message
Ilvalle
Guru
Guru


Joined: 07 Mar 2005
Posts: 325
Location: Gallarate - ITALY

PostPosted: Mon Mar 13, 2006 10:08 pm    Post subject: Reply with quote

Ciao,
Ho già qualche livello di sicurezza, il motivo del post era la non presenza
dei log quando faccio i portscan, vedi il caso che ho postato prima i log
non ne sanno nulla...

Cmq, da root non ti puoi collegare via ssh
l'unico che fa parte del gruppo wheel è il mio.
utilizzo un demone
denyhosts, che evita gli ssh automatici.
Qualche altro consiglio?


Per i portnocking, per ora non credo di averne bisogno

Sicuri non si è mai,
andando un po in OT,per esempio il chroot, è una delle syscall di sistema + bacata che ci sia...


Paolo
Back to top
View user's profile Send private message
Cazzantonio
Bodhisattva
Bodhisattva


Joined: 20 Mar 2004
Posts: 4514
Location: Somewere around the world

PostPosted: Tue Mar 14, 2006 12:19 am    Post subject: Reply with quote

il fatto è che se la porta è aperta puoi farci poco... i portscan vengono loggati ma solo se usano pacchetti malformati...
una richiesta legittima di connessione su una porta aperta viene vista e ovviamente passa... ti consiglio di chiudere la porta o spostarla su una >1024 (anzi >10000 già che ci sei)
_________________
Any mans death diminishes me, because I am involved in Mankinde; and therefore never send to know for whom the bell tolls; It tolls for thee.
-John Donne
Back to top
View user's profile Send private message
Ilvalle
Guru
Guru


Joined: 07 Mar 2005
Posts: 325
Location: Gallarate - ITALY

PostPosted: Tue Mar 14, 2006 10:42 am    Post subject: Reply with quote

Cosa cambierebbe spostare la porta ssh su porte cosi alte?

Dunque tutti i portscan con relativi log e drop, fanno poco cmq.
droppano pacchetti strani, ma se la porta e' aperta lo possono
capire.

La situazione di sicurezza e' "tranquilla" a livello dell'ssh,
prodotto bsd, se non erro.
Mi allarmo, quando la macchina in questione ha dei demoni in ascolto
"deboli", vedi cvs per esempio.

Paolo
Back to top
View user's profile Send private message
Cazzantonio
Bodhisattva
Bodhisattva


Joined: 20 Mar 2004
Posts: 4514
Location: Somewere around the world

PostPosted: Tue Mar 14, 2006 1:31 pm    Post subject: Reply with quote

Ilvalle wrote:
Cosa cambierebbe spostare la porta ssh su porte cosi alte?

Minori tentativi di accesso da parte di programmini automatici che tentano utente+password a caso sulla porta standard 22.... io da quando ho spostato la porta non ricevo più alcun tentativo di connessione.
L'unico problema è scrivere ogni volta "-p <porta>" davanti al comando ssh che se lo fai spesso può diventare una seccatura... puoi aiutarti creando qualche alias :wink:
_________________
Any mans death diminishes me, because I am involved in Mankinde; and therefore never send to know for whom the bell tolls; It tolls for thee.
-John Donne
Back to top
View user's profile Send private message
Ilvalle
Guru
Guru


Joined: 07 Mar 2005
Posts: 325
Location: Gallarate - ITALY

PostPosted: Tue Mar 14, 2006 2:07 pm    Post subject: Reply with quote

Per quel problema, uso denyhosts, dopo tot tentaviti viene negato
all'ip di collegarsi alla macchina.
cambiare la porta e' facile se solo tu accedi, al contrario non e'
possibile. E' per questo che si sono gli standard!

E' un -p nel caso dell'ssh, un -P per l' scp ecc ecc
Ogni programma ha le sue opzioni : (

Paolo
Back to top
View user's profile Send private message
quantumwire
Guru
Guru


Joined: 15 Oct 2003
Posts: 403
Location: Lausanne

PostPosted: Fri Mar 17, 2006 5:31 pm    Post subject: Re: [Tip] Uno script di init per iptables Reply with quote

Cazzantonio wrote:
A giro per la rete (e per le guide gentoo) ho raccattato un po' di script di init per iptables e ne ho fatto un copia&incolla ragionato...


Sai se e' possibile introdurre pure la possibilita' di montare sul PC che runna il tuo firewall un fs via nfs presente su eth0
ovvero esportato da un pc presente su quella interfaccia?

Ho provato a rendere non dinamiche le porte relative al servizio rpc/nfs sul pc firewall:

Code:
[matteo@hydrogen ~]$ cat /etc/conf.d/nfs
# /etc/conf.d/nfs

# If you wish to set the port numbers for lockd,
# please see /etc/sysctl.conf

# Number of servers to be started up by default
RPCNFSDCOUNT=8

# Options to pass to rpc.mountd
# ex. RPCMOUNTDOPTS="-p 32767"
RPCMOUNTDOPTS="-p 32767"

# Options to pass to rpc.statd
# ex. RPCSTATDOPTS="-p 32765 -o 32766"
RPCSTATDOPTS="-p 32765 -o 32766"

# OPTIONS to pass to rpc.rquotad
# ex. RPCRQUOTADOPTS="-p 32764"
RPCRQUOTADOPTS="-p 32764"

# Options to pass to rpc.idmapd
RPCIDMAPDOPTS=""

# Options to pass to rpc.gssd
RPCGSSDOPTS=""

# Options to pass to rpc.svcgssd
RPCSVCGSSDOPTS=""

# Timeout (in seconds) for exportfs
EXPORTFSTIMEOUT=30


ma non so se devono essere aggiunte delle opportune regole regole al tuo script.

Grazie.
_________________
HOWTO 1: Spegnere il laptop!
HOWTO 2: Comprimere i DVDs!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian) Risorse italiane (documentazione e tools) All times are GMT
Goto page Previous  1, 2, 3, 4  Next
Page 3 of 4

 
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