diff --git a/el_GR.ISO8859-7/books/handbook/firewalls/chapter.sgml b/el_GR.ISO8859-7/books/handbook/firewalls/chapter.sgml index cf5858dbab..d25c15496f 100644 --- a/el_GR.ISO8859-7/books/handbook/firewalls/chapter.sgml +++ b/el_GR.ISO8859-7/books/handbook/firewalls/chapter.sgml @@ -1,3398 +1,3562 @@ Joseph J. Barbish - Συνεισφορά από τον + Συνεισφορά του Brad Davis Μετατράπηκε σε SGML και ανανεώθηκε από τον Firewalls firewall ασφάλεια - firewalls Σύνοψη - Το firewall (τοίχος προστασίας) καθιστά δυνατό το φιλτράρισμα της + Το firewall (τείχος προστασίας) καθιστά δυνατό το φιλτράρισμα της εισερχόμενης και εξερχόμενης κίνησης που διέρχεται από το σύστημα σας. Ένα firewall μπορεί να χρησιμοποιεί ένα ή περισσότερα σετ - κανόνων για να επιθεωρεί τα πακέτα κατά την είσοδο ή + κανόνων για να επιθεωρεί τα πακέτα κατά την είσοδο ή έξοδο τους από μια δικτυακή σύνδεση, και να τα επιτρέπει ή να τα - απορρίπτει. Οι κανόνες του firewall μπορούν να ελέγχουν ένα ή + απορρίπτει. Οι κανόνες του firewall μπορούν να ελέγχουν ένα ή περισσότερα χαρακτηριστικά των πακέτων, συμπεριλαμβανομένων μεταξύ άλλων - και του τύπου του πρωτοκόλλου, καθώς και την διεύθυνση ή/και πόρτα της - αφετηρίας ή του προορισμού. + και του τύπου του πρωτοκόλλου, καθώς και την διεύθυνση ή/και θύρα + (port) της αφετηρίας ή του προορισμού. - Τα Firewalls μπορούν να ενισχύσουν σημαντικά την ασφάλεια ενός - κόμβου ή ενός δικτύου. Μπορούν να χρησιμοποιηθούν για μια ή περισσότερες - από τις ακόλουθες λειτουργίες: + Τα firewalls μπορούν να ενισχύσουν σημαντικά την ασφάλεια ενός + κόμβου ή ενός δικτύου. Μπορούν να χρησιμοποιηθούν για μία ή + περισσότερες από τις ακόλουθες λειτουργίες: - Να προστατεύουν και να απομονώνουν τις εφαρμογές, υπηρεσίες και - τα μηχανήματα του εσωτερικού σας δικτύου από ανεπιθύμητη κίνηση που - προέρχεται από το Internet. + Να προστατεύουν και να απομονώνουν τις εφαρμογές, τις υπηρεσίες + και τα μηχανήματα του εσωτερικού σας δικτύου από ανεπιθύμητη κίνηση + που προέρχεται από το Internet. Να περιορίζουν ή να αποκλείουν την πρόσβαση μηχανημάτων του - εσωτερικού δικτύου σε υπηρεσίες του Internet. + εσωτερικού δικτύου σε υπηρεσίες του Internet. - Να υποστηρίζουν μετάφραση δικτυακών διευθύνσεων (NAT - ), η οποία επιτρέπει στο εσωτερικό σας δίκτυο να - χρησιμοποιεί ιδιωτικές IP διευθύνσεις και να - μοιράζεται μία μοναδική σύνδεση με το Internet (είτε μέσω μίας - IP διεύθυνσης, είτε μέσω ενός πλήθους δημοσίων - διευθύνσεων που ανατίθενται αυτόματα). + Να υποστηρίζουν μετάφραση δικτυακών διευθύνσεων + (NAT), η οποία επιτρέπει στο εσωτερικό σας + δίκτυο να χρησιμοποιεί ιδιωτικές IP διευθύνσεις + και να μοιράζεται μία μοναδική σύνδεση με το Internet (είτε μέσω + μίας μοναδικής δημόσιας IP διεύθυνσης, είτε μέσω + ενός πλήθους δημοσίων διευθύνσεων που ανατίθενται αυτόματα). Αφού διαβάσετε αυτό το κεφάλαιο, θα ξέρετε: - Πως να ορίσετε σωστά κανόνες φιλτραρίσματος πακέτων. + Πως να δημιουργήσετε σωστούς κανόνες φιλτραρίσματος + πακέτων. Τους διάφορους τύπους firewall που υπάρχουν στο &os; και τις - διαφορές τους. + διαφορές τους. - Πως να χρησιμοποιήσετε και να ρυθμίσετε το firewall - PF του OpenBSD. + Πως να ρυθμίσετε και να χρησιμοποιήσετε το + PF firewall του OpenBSD. Πως να ρυθμίσετε και να χρησιμοποιήσετε το IPFILTER. Πως να ρυθμίσετε και να χρησιμοποιήσετε το IPFW. Πριν διαβάσετε αυτό το κεφάλαιο, θα πρέπει: Να κατανοείτε βασικές αρχές του &os; και του Internet. - Firewall Concepts + Βασικές Έννοιες των Firewalls firewall - rulesets - There are two basic ways to create firewall rulesets: - inclusive or exclusive. An - exclusive firewall allows all traffic through except for the - traffic matching the ruleset. An inclusive firewall does the - reverse. It only allows traffic matching the rules through and - blocks everything else. - - Inclusive firewalls are generally safer than exclusive - firewalls because they significantly reduce the risk of allowing - unwanted traffic to pass through the firewall. - - Security can be tightened further using a stateful - firewall. With a stateful firewall the firewall keeps - track of which connections are opened through the firewall and - will only allow traffic through which either matches an existing - connection or opens a new one. The disadvantage of a stateful - firewall is that it can be vulnerable to Denial of Service - (DoS) attacks if a lot of new connections are - opened very fast. With most firewalls it is possible to use a - combination of stateful and non-stateful behavior to make an - optimal firewall for the site. + Υπάρχουν δύο βασικοί τρόποι για τη δημιουργία κανόνων σε ένα + firewall: ο inclusive και ο exclusive. + Ένα exclusive firewall επιτρέπει τη διέλευση όλης της κίνησης, εκτός + από αυτή που ταιριάζει με τους κανόνες του. Ένα inclusive firewall + κάνει το ανάποδο. Επιτρέπει μόνο τη διέλευση της κίνησης που ταιριάζει + με τους κανόνες του, και αποκλείει οτιδήποτε άλλο. + + Τα inclusive firewalls προσφέρουν πολύ καλύτερο έλεγχο της + εξερχόμενης κίνησης και για το λόγο αυτό είναι καλύτερα για συστήματα + που προσφέρουν υπηρεσίες στο δημόσιο Internet. Ελέγχουν επίσης και + τα πακέτα που προέρχονται από το δημόσιο Internet με προορισμό το + ιδιωτικό σας δίκτυο. Από προεπιλογή, όλη η κίνηση που δεν ταιριάζει + με τους κανόνες απορρίπτεται και καταγράφεται. Τα inclusive firewalls + είναι γενικά ασφαλέστερα από τα exclusive, καθώς μειώνουν σημαντικά + την πιθανότητα διέλευσης ανεπιθύμητης κίνησης μέσα από αυτά. + + + Εκτός και αν αναφέρεται διαφορετικά, όλα τα παραδείγματα + ρυθμίσεων και κανόνων που φαίνονται σε αυτό το κεφάλαιο, δημιουργούν + inclusive firewalls. + + + Η ασφάλεια μπορεί να γίνει ακόμα ισχυρότερη με τη χρήση ενός + stateful firewall. Αυτός ο τύπος firewall αποθηκεύει + την κατάσταση των συνδέσεων που μεταφέρουν δεδομένα μέσα από αυτό, και + επιτρέπει μόνο την κίνηση που είτε ταιριάζει με μια από τις υπάρχουσες + συνδέσεις, ή που ξεκινά μια νέα σύνδεση. Το μειονέκτημα ενός stateful + firewall είναι ότι μπορεί να είναι ευάλωτο σε επιθέσεις Denial of + Service (Άρνησης Υπηρεσίας, DoS) αν δεχθεί + ταυτόχρονα πολλές αιτήσεις για άνοιγμα νέων συνδέσεων σε μικρό χρονικό + διάστημα. Με τα περισσότερα firewalls, είναι δυνατόν να γίνει + συνδυασμός και των δύο συμπεριφορών (τόσο stateful όσο και μη-stateful) + ώστε να δημιουργηθεί το βέλτιστο firewall για την συγκεκριμένη + χρήση. - Firewall Packages - - &os; has three different firewall packages built - into the base system. They are: IPFILTER - (also known as IPF), - IPFIREWALL (also known as IPFW), - and OpenBSD's PacketFilter (also known as - PF). &os; also has two built in packages for - traffic shaping (basically controlling bandwidth usage): - &man.altq.4; and &man.dummynet.4;. Dummynet has traditionally been - closely tied with IPFW, and - ALTQ with - IPF/PF. IPF, - IPFW, and PF all use rules to control the access of packets to and - from your system, although they go about it different ways and - have different rule syntaxes. - - The reason that &os; has multiple built in firewall packages - is that different people have different requirements and - preferences. No single firewall package is the best. - - The author prefers IPFILTER because its stateful rules are - much less complicated to use in a NAT - environment and it has a built in ftp proxy that simplifies the - rules to allow secure outbound FTP usage. - - Since all firewalls are based on inspecting the values of - selected packet control fields, the creator of the firewall - rulesets must have an understanding of how - TCP/IP works, what the different values in - the packet control fields are and how these values are used in a - normal session conversation. For a good explanation go to: - Προγράμματα Firewall + + Το &os; έχει τρία διαφορετικά προγράμματα firewall ενσωματωμένα στο + βασικό σύστημα. Είναι τα: IPFILTER (γνωστό επίσης + και ως IPF), το IPFIREWALL + (γνωστό επίσης και ως IPFW), και το + PacketFilter του OpenBSD + (γνωστό επίσης και ως PF). Το &os; ενσωματώνει + επίσης δύο προγράμματα για διαμόρφωση κυκλοφορίας (traffic shaping, + έλεγχος του διαθέσιμου εύρους ζώνης): το &man.altq.4; και το + &man.dummynet.4;. Το Dummynet είναι κατά παράδοση στενά συνδεμένο με + το IPFW, και το ALTQ με το + PF. Η διαμόρφωση κυκλοφορίας για το IPFILTER μπορεί + τη δεδομένη στιγμή να γίνει με το IPFILTER για το NAT και το + φιλτράρισμα και με το IPFW σε συνδυασμό με το + &man.dummynet.4; ή χρησιμοποιώντας το + PF σε συνδυασμό με το ALTQ. + Τόσο το IPFW όσο και το PF χρησιμοποιούν κανόνες για να ελέγξουν την + κίνηση των πακέτων από και προς το σύστημά σας, αν και διαθέτουν + διαφορετικούς τρόπους για να το επιτύχουν, και οι κανόνες τους + χρησιμοποιούν διαφορετική σύνταξη. + + Ο λόγος για τον οποίο το &os; διαθέτει πολλαπλά firewall, είναι ότι + διαφορετικοί άνθρωποι έχουν διαφορετικές ανάγκες και προτιμήσεις. Δεν + υπάρχει ένα και μοναδικό firewall που να είναι το καλύτερο. + + Ο συγγραφέας προτιμά το IPFILTER, καθώς οι κανόνες τύπου stateful + που διαθέτει είναι λιγότερο πολύπλοκοι όταν χρησιμοποιούνται σε ένα + περιβάλλον NAT, ενώ διαθέτει και ενσωματωμένο ftp + proxy το οποίο τους απλοποιεί ακόμα περισσότερο, επιτρέποντας ασφαλή + σύνδεση σε εξωτερικούς εξυπηρετητές FTP. + + Καθώς όλα τα firewall βασίζονται στην επιθεώρηση τιμών ελέγχου των + πακέτων, ο διαχειριστής που πρόκειται να δημιουργήσει τους κανόνες + πρέπει να κατανοεί τον τρόπο λειτουργίας του TCP/IP, + το ρόλο των διαφόρων τιμών στα πεδία ελέγχου των πακέτων και πως + χρησιμοποιούνται στην ανταλλαγή πληροφοριών σε μια συνηθισμένη + συνεδρία. Για περισσότερες λεπτομέρειες, διαβάστε το . - The OpenBSD Packet Filter (PF) and - <acronym>ALTQ</acronym> + + + + John + Ferrell + Αναθεωρήθηκε και ενημερώθηκε από τον + + + + + + Το Packet Filter (PF) και το <acronym>ALTQ</acronym> του + OpenBSD firewall - PF - As of July 2003 the OpenBSD firewall software application - known as PF was ported to &os; and was made - available in the &os; Ports Collection; the first release that - contained PF as an integrated part of the - base system was &os; 5.3 in November 2004. - PF is a complete, fully featured firewall - that has optional support for ALTQ (Alternate - Queuing). ALTQ provides Quality of Service - (QoS) bandwidth shaping that allows - guaranteeing bandwidth to different services based on filtering - rules. The OpenBSD Project does an outstanding job of - maintaining the PF User's Guide that it will not be made part of - this handbook firewall section as that would just be duplicated - effort. - - More info can be found at the PF for &os; web site: Τον Ιούλιο του 2003, η εφαρμογή firewall του OpenBSD (γνωστή ως + PF) μεταφέρθηκε στο &os; και έγινε διαθέσιμη στην + Συλλογή των Ports. Το &os; 5.3 που κυκλοφόρησε το 2004, ήταν η + πρώτη επίσημη έκδοση η οποία περιείχε το PF ως + τμήμα του βασικού πλέον συστήματος. Το PF είναι + ένα ολοκληρωμένο firewall, με πλήθος χαρακτηριστικών, το οποίο επίσης + διαθέτει προαιρετικά υποστήριξη για το ALTQ + (Alternate Queuing). Το ALTQ προσφέρει υπηρεσίες + Διασφάλισης Ποιότητας (Quality of Service, + QoS). + + Το OpenBSD Project κάνει εξαιρετική δουλειά στη συντήρηση του + PF FAQ. Για το + λόγο αυτό, η παρούσα ενότητα του Εγχειριδίου εστιάζει κυρίως στις + ιδιαιτερότητες του PF όσο αφορά το &os;, ενώ παρέχει + και μερικές γενικές πληροφορίες σχετικά με τη χρήση του. Για πιο + λεπτομερείς πληροφορίες σχετικά με τη χρήση του PF, + παρακαλούμε διαβάστε το PF FAQ. + + Περισσότερες πληροφορίες σχετικά με το PF στο + &os; μπορείτε να βρείτε στο . - Enabling PF - - PF is included in the basic &os; install for versions newer - than 5.3 as a separate run time loadable module. The system - will dynamically load the PF kernel loadable module when the - rc.conf statement pf_enable="YES" is used. - The loadable module was created with &man.pflog.4; logging - enabled. + Χρησιμοποιώντας το Άρθρωμα του Πυρήνα για το PF + + Από το &os; 5.3 και μετά, το PF περιλαμβάνεται στην + βασική εγκατάσταση ως χωριστό άρθρωμα που μπορεί να φορτωθεί στον + πυρήνα. Το σύστημα θα φορτώσει δυναμικά το άρθρωμα αν υπάρχει η + καταχώριση pf_enable="YES" στο &man.rc.conf.5;. + Το άρθρωμα του PF ωστόσο δεν θα φορτωθεί, αν το + σύστημα δεν μπορέσει να εντοπίσει το κατάλληλο αρχείο κανόνων. + Η προεπιλεγμένη θέση είναι το /etc/pf.conf. + Αν το δικό σας αρχείο κανόνων του PF βρίσκεται + κάπου αλλού, βάλτε την καταχώριση + pf_rules="/path/pf.rules" + στο αρχείο ρυθμίσεων /etc/rc.conf για να + καθορίσετε τη θέση. - The module assumes the presence of options - INET and device bpf. Unless - NOINET6 for &os; prior to 6.0-RELEASE and - NO_INET6 for later releases (for example in - &man.make.conf.5;) was defined during the build, it also - requiresoptions INET6. + Από το &os; 7.0 και μετά, το υπόδειγμα του + pf.conf το οποίο βρίσκονταν στον κατάλογο + /etc/, μεταφέρθηκε στον + κατάλογο /usr/share/examples/pf/. Στις + εκδόσεις του &os; πριν από την 7.0, υπήρχε από προεπιλογή ένα + αρχείο /etc/pf.conf. - Once the kernel module is loaded or the kernel is statically - built with PF support, it is possible to enable or disable - pf with the pfctl - command. + Το άρθρωμα PF μπορεί επίσης να φορτωθεί + χειροκίνητα από την γραμμή εντολών: - This example demonstrates how to enable - pf: + &prompt.root; kldload pf.ko - &prompt.root; pfctl -e - - The pfctl command provides a way to work - with the pf firewall. It is a good - idea to check the &man.pfctl.8; manual page to find out more - information about using it. + Το άρθρωμα του πυρήνα έχει δημιουργηθεί με ενεργοποιημένο το + &man.pflog.4; και υποστηρίζει έτσι δυνατότητα καταγραφής. + Αν χρειάζεστε κάποιες από τις επιπλέον δυνατότητες του + PF, θα χρειαστεί να μεταγλωττίσετε την υποστήριξη + του PF απευθείας μέσα στον πυρήνα. - Kernel options + Επιλογές του PF για τον Πυρήνα kernel options - device pf kernel options - device pflog kernel options - device pfsync - It is not a mandatory requirement that you enable PF by - compiling the following options into the &os; kernel. It is - only presented here as background information. Compiling PF - into the kernel causes the loadable module to never be - used. - - Sample kernel config PF option statements are in the - /usr/src/sys/conf/NOTES kernel source and - are reproduced here: + Αν και δεν είναι απαραίτητο να μεταγλωττίσετε την υποστήριξη + PF μέσα στον πυρήνα του &os;, ίσως να θέλετε να + χρησιμοποιήσετε ένα από τα προχωρημένα χαρακτηριστικά του PF το + οποίο δεν περιλαμβάνεται στο άρθρωμα του πυρήνα: το &man.pfsync.4;. + Πρόκειται για μια ψευδο-συσκευή η οποία αποκαλύπτει συγκεκριμένες + αλλαγές στον πίνακα καταστάσεων που χρησιμοποιείται από το + PF. Μπορεί να συνδυαστεί με το &man.carp.4; για + να δημιουργηθούν με το PF firewalls με δυνατότητα + αυτόματης αλλαγής σε περίπτωση αποτυχίας (failover). Περισσότερες + πληροφορίες σχετικά με το CARP μπορείτε να βρείτε + στο του Εγχειριδίου. + + Μπορείτε να δείτε όλες τις επιλογές πυρήνα για το + PF στο αρχείο + /usr/src/sys/conf/NOTES. Οι επιλογές φαίνονται + επίσης παρακάτω: device pf device pflog device pfsync - device pf enables support for the - Packet Filter firewall. + Η επιλογή device pf ενεργοποιεί την υποστήριξη + για το firewall Packet Filter (&man.pf.4;). - device pflog enables the optional - &man.pflog.4; pseudo network device which can be used to log - traffic to a &man.bpf.4; descriptor. The &man.pflogd.8; daemon - can be used to store the logging information to disk. + Η επιλογή device pflog ενεργοποιεί την + προαιρετική ψευδο-δικτυακή συσκευή &man.pflog.4; που μπορεί να + χρησιμοποιηθεί για την καταγραφή της κίνησης σε ένα &man.bpf.4; + descriptor. Ο δαίμονας &man.pflogd.8; μπορεί να αποθηκεύσει την + καταγραφή αυτή στο σκληρό δίσκο. - device pfsync enables the optional - &man.pfsync.4; pseudo network device that is used to monitor - state changes. As this is not part of the - loadable module one has to build a custom kernel to use - it. - - These settings will take effect only after you have built - and installed a kernel with them set. + Η επιλογή device pfsync ενεργοποιεί την + προαιρετική ψευδό-δικτυακή συσκευή &man.pfsync.4; η οποία + χρησιμοποιείται για να ανιχνεύει + αλλαγές κατάστασης. - Available rc.conf Options + Επιλογές στο rc.conf - You need the following statements in - /etc/rc.conf to activate PF at boot - time: + Το PF και το &man.pflog.4; μπορούν να + ρυθμιστούν κατά την εκκίνηση με τις παρακάτω καταχωρίσεις στο + &man.rc.conf.5;: pf_enable="YES" # Enable PF (load module if required) pf_rules="/etc/pf.conf" # rules definition file for pf pf_flags="" # additional flags for pfctl startup pflog_enable="YES" # start pflogd(8) pflog_logfile="/var/log/pflog" # where pflogd should store the logfile pflog_flags="" # additional flags for pflogd startup - If you have a LAN behind this firewall and have to forward - packets for the computers in the LAN or want to do NAT, you - have to enable the following option as well: + Αν πίσω από αυτό το firewall υπάρχει κάποιο τοπικό δίκτυο (LAN) + προς το οποίο επιθυμείτε να προωθήσετε πακέτα, ή αν θέλετε να + χρησιμοποιήσετε NAT, θα χρειαστείτε επίσης και την παρακάτω + επιλογή: gateway_enable="YES" # Enable as LAN gateway - Enabling <acronym>ALTQ</acronym> + Δημιουργία Κανόνων Φιλτραρίσματος + + Το PF διαβάζει τις ρυθμίσεις του από το + &man.pf.conf.5; (η προεπιλεγμένη τοποθεσία είναι στο + /etc/pf.conf) και τροποποιεί, απορρίπτει ή + αποδέχεται πακέτα σύμφωνα με τους κανόνες και τους ορισμούς που + περιέχονται σε αυτό. Η εγκατάσταση του &os; περιλαμβάνει αρκετά + υποδείγματα αρχείων ρύθμισης, στην τοποθεσία + /usr/share/examples/pf/. Παρακαλούμε να + διαβάσετε το PF FAQ για πλήρη + ανάλυση των κανόνων του PF. + + + Καθώς διαβάζετε το PF FAQ, + να έχετε υπόψη σας ότι διαφορετικές εκδόσεις του &os; περιέχουν + διαφορετικές εκδόσεις του PF: + + + + &os; 5.X — + Το PF είναι στην έκδοση που υπάρχει στο + OpenBSD 3.5 + + + + &os; 6.X — + Το PF είναι στην έκδοση που υπάρχει στο + OpenBSD 3.7 + + + + &os; 7.X — + Το PF είναι στην έκδοση που υπάρχει στο + OpenBSD 4.1 + + + + + Η &a.pf; είναι ένα καλό μέρος για να κάνετε ερωτήσεις + σχετικές με τη ρύθμιση και τη λειτουργία του PF + firewall. Μη ξεχάσετε να ελέγξετε τα αρχεία της λίστας πριν + ξεκινήσετε τις ερωτήσεις! + + + + Δουλεύοντας με το PF + + Χρησιμοποιήστε το &man.pfctl.8; για να ελέγξετε το + PF. Παρακάτω θα βρείτε κάποιες χρήσιμες εντολές + (βεβαιωθείτε ότι έχετε διαβάσει τη σελίδα manual του &man.pfctl.8; για + να δείτε όλες τις διαθέσιμες επιλογές): + + + + + + Εντολή + Σκοπός + + + + + + pfctl + Ενεργοποίηση του PF + + + + pfctl + Απενεργοποίηση του PF + + + + pfctl all /etc/pf.conf + Διαγραφή όλων των κανόνων (nat, filter, state, table, + κ.λ.π.) και εκ νέου ανάγνωση από το αρχείο + /etc/pf.conf + + + + pfctl [ rules | nat | state ] + Εκτύπωση αναφοράς σχετικά με τους κανόνες του φίλτρου, + του NAT, ή του πίνακα κατάστασης + + + + pfctl /etc/pf.conf + Ελέγχει το /etc/pf.conf για λάθη, + αλλά δεν φορτώνει τους κανόνες + + + + + + + + Ενεργοποίηση του <acronym>ALTQ</acronym> - ALTQ is only available by compiling the - options into the &os; Kernel. ALTQ is not - supported by all of the available network card drivers. Please - see the &man.altq.4; manual page for a list of drivers that are - supported in your release of &os;. The following options will - enable ALTQ and add additional - functionality. + Το ALTQ διατίθεται μόνο αν μεταγλωττίσετε + απευθείας την υποστήριξη του μέσα στον πυρήνα του &os;. + Το ALTQ δεν υποστηρίζεται από όλα τα προγράμματα + οδήγησης καρτών δικτύου. Παρακαλούμε δείτε τη σελίδα manual του + &man.altq.4; για τη λίστα των οδηγών που υποστηρίζονται στην έκδοση + του &os; που διαθέτετε. + + Οι παρακάτω επιλογές του πυρήνα ενεργοποιούν το + ALTQ και παρέχουν επιπρόσθετες λειτουργίες: options ALTQ options ALTQ_CBQ # Class Bases Queuing (CBQ) options ALTQ_RED # Random Early Detection (RED) options ALTQ_RIO # RED In/Out options ALTQ_HFSC # Hierarchical Packet Scheduler (HFSC) options ALTQ_PRIQ # Priority Queuing (PRIQ) options ALTQ_NOPCC # Required for SMP build - options ALTQ enables the - ALTQ framework. - - options ALTQ_CBQ enables Class Based - Queuing (CBQ). CBQ - allows you to divide a connection's bandwidth into different - classes or queues to prioritize traffic based on filter - rules. - - options ALTQ_RED enables Random Early - Detection (RED). RED is - used to avoid network congestion. RED does - this by measuring the length of the queue and comparing it to - the minimum and maximum thresholds for the queue. If the - queue is over the maximum all new packets will be dropped. - True to its name, RED drops packets from - different connections randomly. - - options ALTQ_RIO enables Random Early - Detection In and Out. - - options ALTQ_HFSC enables the - Hierarchical Fair Service Curve Packet Scheduler. For more - information about HFSC see: Η γραμμή options ALTQ ενεργοποιεί το πλαίσιο + λειτουργιών ALTQ. + + Η γραμμή options ALTQ_CBQ ενεργοποιεί το + Class Based Queuing (CBQ). + Το CBQ σας επιτρέπει να χωρίσετε το εύρος ζώνης + μιας σύνδεσης σε διαφορετικές κλάσεις ή ουρές, ώστε να δίνονται + προτεραιότητες στην κίνηση ανάλογα με τους κανόνες του φίλτρου. + + Η γραμμή options ALTQ_RED ενεργοποιεί το + Random Early Detection (RED). + Το RED χρησιμοποιείται για να αποφευχθεί η + συμφόρηση του δικτύου. Για το σκοπό αυτό, το RED + μετράει το μήκος της ουράς και το συγκρίνει με το μέγιστο και + ελάχιστο όριο της. Αν η ουρά είναι πάνω από το μέγιστο, όλα + τα νέα πακέτα θα απορρίπτονται. Σύμφωνα και με το όνομα του, το + RED απορρίπτει πακέτα από διάφορες συνδέσεις με + τυχαίο τρόπο. + + Η γραμμή options ALTQ_RIO ενεργοποιεί το + Random Early Detection In and Out. + + Η γραμμή options ALTQ_HFSC ενεργοποιεί το + Hierarchical Fair Service Curve Packet Scheduler. + Για περισσότερες πληροφορίες σχετικά με το HFSC + δείτε: . - options ALTQ_PRIQ enables Priority - Queuing (PRIQ). PRIQ - will always pass traffic that is in a higher queue - first. - - options ALTQ_NOPCC enables - SMP support for ALTQ. - This option is required on SMP - systems. - - - - Creating Filtering Rules - - The Packet Filter reads its configuration rules from the - &man.pf.conf.5; file and it modifies, drops or passes packets - according to the rules or definitions specified there. The &os; - installation comes with a default - /etc/pf.conf which contains useful examples - and explanations. - - Although &os; has its own /etc/pf.conf - the syntax is the same as one used in OpenBSD. A great - resource for configuring the pf - firewall has been written by OpenBSD team and is available at - . + Η γραμμή options ALTQ_PRIQ ενεργοποιεί το + Priority Queuing (PRIQ). + Το PRIQ πάντοτε περνάει πρώτα την κίνηση με τη + μεγαλύτερη προτεραιότητα. - - When browsing the pf user's guide, please keep in mind that - different versions of &os; contain different versions of pf. The - pf firewall in &os; 5.X is at the level - of OpenBSD version 3.5 and in &os; 6.X is at the level of OpenBSD - version 3.7. - - - The &a.pf; is a good place to ask questions about - configuring and running the pf - firewall. Do not forget to check the mailing list archives - before asking questions. + Η γραμμή options ALTQ_NOPCC ενεργοποιεί την + υποστήριξη SMP για το ALTQ. + Η επιλογή αυτή απαιτείται σε συστήματα SMP. - The IPFILTER (IPF) Firewall + Το IPFILTER (IPF) Firewall firewall - IPFILTER - - This section is work in progress. The contents might - not be accurate at all times. - - - The author of IPFILTER is Darren Reed. IPFILTER is not - operating system dependent: it is an open source application and - has been ported to &os;, NetBSD, OpenBSD, &sunos;, HP/UX, and - &solaris; operating systems. IPFILTER is actively being - supported and maintained, with updated versions being released - regularly. - - IPFILTER is based on a kernel-side firewall and - NAT mechanism that can be controlled and - monitored by userland interface programs. The firewall rules can - be set or deleted with the &man.ipf.8; utility. The - NAT rules can be set or deleted with the - &man.ipnat.1; utility. The &man.ipfstat.8; utility can print - run-time statistics for the kernel parts of IPFILTER. The - &man.ipmon.8; program can log IPFILTER actions to the system log - files. - - IPF was originally written using a rule processing logic of - the last matching rule wins and used only - stateless type of rules. Over time IPF has been enhanced to - include a quick option and a stateful keep - state option which drastically modernized the rules - processing logic. IPF's official documentation covers the legacy - rule coding parameters and the legacy rule file processing - logic. The modernized functions are only included as additional - options, completely understating their benefits in producing a - far superior secure firewall. - - The instructions contained in this section are based on - using rules that contain the quick option and the - stateful keep state option. This is the basic - framework for coding an inclusive firewall rule set. - - - - An inclusive firewall only allows packets matching the rules - to pass through. This way you can control what services can - originate behind the firewall destined for the public Internet - and also control the services which can originate from the - public Internet accessing your private network. Everything else - is blocked and logged by default design. Inclusive firewalls are - much, much more secure than exclusive firewall rule sets and is - the only rule set type covered herein. - - For detailed explanation of the legacy rules processing - method see: Ο συγγραφέας του IPFILTER είναι ο Darren Reed. Το IPFILTER δεν + εξαρτάται από το λειτουργικό σύστημα: είναι μια εφαρμογή ανοικτού + κώδικα που έχει μεταφερθεί στο &os;, το NetBSD, το OpenBSD, το + &sunos;, το HP/UX και το &solaris;. Το IPFILTER είναι υπό διαρκή + και ενεργή ανάπτυξη και συντήρηση, και κυκλοφορούν τακτικά οι νέες + εκδόσεις του. + + Το IPFILTER είναι ένα firewall και μηχανισμός + NAT που λειτουργεί στον πυρήνα και μπορεί να + ελέγχεται και να παρακολουθείται από προγράμματα χρήστη. Οι κανόνες + του firewall μπορούν να τίθενται σε ισχύ ή να διαγράφονται μέσω του + βοηθητικού προγράμματος &man.ipf.8;. Οι κανόνες για το + NAT μπορούν να τίθενται σε ισχύ ή να διαγράφονται + μέσω του βοηθητικού προγράμματος &man.ipnat.1;. Το βοηθητικό πρόγραμμα + &man.ipfstat.8; μπορεί να εκτυπώσει στατιστικά εκτέλεσης για το τμήμα + του IPFILTER που εκτελείται στον πυρήνα. Το πρόγραμμα &man.ipmon.8; + μπορεί να καταγράψει τις ενέργειες του IPFILTER στο αρχεία καταγραφής + συμβάντων του συστήματος. + + Το IPF γράφηκε αρχικά χρησιμοποιώντας μια λογική επεξεργασίας + κανόνων του τύπου ο τελευταίο κανόνας που ταιριάζει, είναι και + ο νικητής και χρησιμοποιούσε μόνο κανόνες τύπου stateless. + Με την πάροδο του χρόνου, το IPF βελτιώθηκε για να περιλαμβάνει την + επιλογή quick και την επιλογή keep state + για stateful κανόνες. Οι επιλογές αυτές εκσυγχρόνισαν δραματικά τη + λογική επεξεργασίας των κανόνων. Η επίσημη τεκμηρίωση του IPF καλύπτει + μόνο τις παλιές παραμέτρους ρύθμισης και επεξεργασίας των κανόνων. + Οι σύγχρονες λειτουργίες καλύπτονται μόνο ως πρόσθετες επιλογές, και + έτσι δεν τονίζονται αρκετά τα πλεονεκτήματα τους στη δημιουργία ενός + πολύ καλύτερου και ασφαλέστερου firewall. + + Οι οδηγίες που περιέχονται σε αυτή την ενότητα, βασίζονται στη + χρήση κανόνων που περιέχουν την επιλογή quick καθώς και + την stateful επιλογή keep state. Αυτό είναι και το + βασικό πλαίσιο λειτουργιών για την δημιουργία του σετ κανόνων ενός + inclusive firewall. + + Για λεπτομέρειες σχετικά με τον παλιότερο τρόπο επεξεργασίας των + κανόνων, δείτε: - and . - The IPF FAQ is at Μπορείτε να δείτε το IPF FAQ στην τοποθεσία . - A searchable archive of the open-source IPFilter mailing list is - available at . + Μπορείτε να βρείτε τις παλαιότερες δημοσιεύσεις τις λίστας + ταχυδρομείου του IPFILTER στο . Παρέχεται + δυνατότητα αναζήτησης. - Enabling IPF + Ενεργοποιώντας το IPF IPFILTER - enabling - IPF is included in the basic &os; install as a separate run - time loadable module. The system will dynamically load the IPF - kernel loadable module when the rc.conf statement - ipfilter_enable="YES" is used. The loadable - module was created with logging enabled and the - default pass all options. You do not need - to compile IPF into the &os; kernel just to change the default - to block all, you can do that by just coding - a block all rule at the end of your rule set. + Το IPF περιλαμβάνεται στη βασική εγκατάσταση του &os; ως άρθρωμα + το οποίο μπορεί να φορτωθεί χωριστά. Το σύστημα θα φορτώσει δυναμικά + το άρθρωμα του IPF αν υπάρχει η καταχώριση + ipfilter_enable="YES" στο αρχείο + /etc/rc.conf. Το άρθρωμα έχει δημιουργηθεί με + ενεργοποιημένη την δυνατότητα καταγραφής και με την επιλογή + default pass all. Για να αλλάξετε αυτή την + προεπιλογή σε block all, μπορείτε απλώς να + προσθέσετε τον κανόνα απόρριψης (block all) στο τέλος των κανόνων σας. + Δεν χρειάζεται να μεταγλωττίσετε την επιλογή IPF στο πυρήνα του &os; + για το σκοπό αυτό. - Kernel options + Επιλογές για τον Πυρήνα kernel options - IPFILTER kernel options - IPFILTER_LOG kernel options - IPFILTER_DEFAULT_BLOCK IPFILTER - kernel options - It is not a mandatory requirement that you enable IPF by - compiling the following options into the &os; kernel. It is - only presented here as background information. Compiling IPF - into the kernel causes the loadable module to never be - used. + Δεν είναι υποχρεωτικό να μεταγλωττίσετε τις παρακάτω επιλογές στον + πυρήνα του &os; για να ενεργοποιήσετε το IPF. Η παρουσίαση τους εδώ + είναι καθαρά ενημερωτική. Αν μεταγλωττίσετε το IPF απευθείας + στον πυρήνα, δεν θα χρησιμοποιηθεί ποτέ το αντίστοιχο άρθρωμα. - Sample kernel config IPF option statements are in the - /usr/src/sys/conf/NOTES kernel source - and are reproduced here: + Στο αρχείο /usr/src/sys/conf/NOTES θα βρείτε + παραδείγματα καταχωρίσεων IPF για το αρχείο ρύθμισης του πυρήνα. Οι + επιλογές αυτές φαίνονται επίσης παρακάτω: options IPFILTER options IPFILTER_LOG options IPFILTER_DEFAULT_BLOCK - options IPFILTER enables support for the - IPFILTER firewall. + Η επιλογή options IPFILTER ενεργοποιεί την + υποστήριξη για το IPFILTER firewall. - options IPFILTER_LOG enables the option - to have IPF log traffic by writing to the - ipl packet logging pseudo—device - for every rule that has the log - keyword. + Η επιλογή options IPFILTER_LOG ενεργοποιεί την + υποστήριξη καταγραφής του IPF, η οποία γράφει στην ψευδο-συσκευή + καταγραφής πακέτων ipl για κάθε κανόνα που + περιλαμβάνει την επιλογή log. - options IPFILTER_DEFAULT_BLOCK changes - the default behavior so any packet not matching a firewall - pass rule gets blocked. + Η επιλογή options IPFILTER_DEFAULT_BLOCK + αλλάζει την προεπιλεγμένη συμπεριφορά, ώστε κάθε πακέτο που δεν + ταιριάζει με κάποιο κανόνα pass του firewall, + να απορρίπτεται αυτόματα. - These settings will take effect only after you have built - and installed a kernel with them set. + Οι παραπάνω επιλογές θα ενεργοποιηθούν μόνο αφού μεταγλωττίσετε + και εγκαταστήσετε ένα προσαρμοσμένο πυρήνα που να τις + περιλαμβάνει. - Available rc.conf Options + Διαθέσιμες Επιλογές για το rc.conf - You need the following statements in - /etc/rc.conf to activate IPF at boot - time: + Χρειάζεστε τις παρακάτω καταχωρίσεις στο + /etc/rc.conf για να ενεργοποιήσετε το IPF κατά + την εκκίνηση του υπολογιστή: ipfilter_enable="YES" # Start ipf firewall ipfilter_rules="/etc/ipf.rules" # loads rules definition text file ipmon_enable="YES" # Start IP monitor log ipmon_flags="-Ds" # D = start as daemon # s = log to syslog # v = log tcp window, ack, seq # n = map IP & port to names - If you have a LAN behind this firewall that uses the - reserved private IP address ranges, then you need to add the - following to enable NAT - functionality: + Αν πίσω από αυτό το firewall υπάρχει κάποιο LAN που χρησιμοποιεί + δεσμευμένες ιδιωτικές διευθύνσεις, θα χρειαστεί να προσθέσετε τις + παρακάτω καταχωρίσεις για να ενεργοποιήσετε τη λειτουργία + NAT: gateway_enable="YES" # Enable as LAN gateway ipnat_enable="YES" # Start ipnat function ipnat_rules="/etc/ipnat.rules" # rules definition file for ipnat IPF ipf - The ipf command is used to load your rules file. Normally - you create a file containing your custom rules and use this - command to replace in mass the currently running firewall - internal rules: + Η εντολή &man.ipf.8; χρησιμοποιείται για να φορτώσει το αρχείο + των κανόνων. Φυσιολογικά, θα δημιουργήσετε ένα αρχείο με τους δικούς + σας προσαρμοσμένους κανόνες και θα αντικαταστήσετε με αυτό + εξ'ολοκλήρου τους ενσωματωμένους κανόνες του firewall: &prompt.root; ipf -Fa -f /etc/ipf.rules - means flush all internal rules - tables. + Η επιλογή αδειάζει τους κανόνες από τους + εσωτερικούς πίνακες του firewall. - means this is the file to read for the - rules to load. + Η επιλογή καθορίζει το αρχείο των κανόνων που + θα φορτωθεί. - This gives you the ability to make changes to your custom - rules file, run the above IPF command, and thus update the - running firewall with a fresh copy of all the rules without - having to reboot the system. This method is very convenient - for testing new rules as the procedure can be executed as many - times as needed. + Αυτό σας δίνει την δυνατότητα να αλλάξετε το αρχείο κανόνων σας, + να εκτελέσετε την εντολή IPF που αναφέραμε παραπάνω, και + να ανανεώσετε με αυτό τον τρόπο τους κανόνες στο firewall που + εκτελείται ήδη με καινούργιους, χωρίς να χρειαστεί να επανεκκινήσετε + το σύστημα σας. Η μέθοδος αυτή είναι πολύ βολική για να δοκιμάσετε + νέους κανόνες, καθώς μπορεί να επαναληφθεί όσες φορές θέλετε. - See the &man.ipf.8; manual page for details on the other - flags available with this command. + Δείτε τη σελίδα manual του &man.ipf.8; για λεπτομέρειες σχετικά με + τις υπόλοιπες επιλογές που μπορείτε να χρησιμοποιήσετε με την εντολή + αυτή. - The &man.ipf.8; command expects the rules file to be a - standard text file. It will not accept a rules file written as - a script with symbolic substitution. + Η εντολή &man.ipf.8; αναμένει ένα απλό αρχείο κειμένου ως αρχείο + κανόνων. Δεν θα δεχθεί αρχείο κανόνων γραμμένο ως script με + συμβολικές αντικαταστάσεις. - There is a way to build IPF rules that utilizes the power - of script symbolic substitution. For more information, see + Υπάρχει ωστόσο τρόπος να γράψετε κανόνες IPF που να χρησιμοποιούν + την ισχύ των συμβολικών αντικαταστάσεων. Για περισσότερες + πληροφορίες, δείτε το . IPFSTAT ipfstat - IPFILTER - statistics - The default behavior of &man.ipfstat.8; is to retrieve and - display the totals of the accumulated statistics gathered as a - result of applying the user coded rules against packets going - in and out of the firewall since it was last started, or since - the last time the accumulators were reset to zero by the - ipf -Z command. + Η προεπιλεγμένη συμπεριφορά του &man.ipfstat.8; είναι να ανακτά + και να απεικονίζει το σύνολο των στατιστικών που συγκεντρώθηκαν ως + αποτέλεσμα της εφαρμογής των κανόνων του χρήστη στα πακέτα που + εισέρχονται και εξέρχονται από το firewall, από τη στιγμή της + τελευταίας του εκκίνησης ή από τον τελευταίο τους μηδενισμό μέσω της + εντολής ipf -Z. - See the &man.ipfstat.8; manual page for details. + Δείτε τη σελίδα manual &man.ipfstat.8; για λεπτομέρειες. - The default &man.ipfstat.8; command output will look - something like this: + Η προεπιλεγμένη έξοδος της εντολής &man.ipfstat.8; θα μοιάζει με + την παρακάτω: input packets: blocked 99286 passed 1255609 nomatch 14686 counted 0 output packets: blocked 4200 passed 1284345 nomatch 14687 counted 0 input packets logged: blocked 99286 passed 0 output packets logged: blocked 0 passed 0 packets logged: input 0 output 0 log failures: input 3898 output 0 fragment state(in): kept 0 lost 0 fragment state(out): kept 0 lost 0 packet state(in): kept 169364 lost 0 packet state(out): kept 431395 lost 0 ICMP replies: 0 TCP RSTs sent: 0 Result cache hits(in): 1215208 (out): 1098963 IN Pullups succeeded: 2 failed: 0 OUT Pullups succeeded: 0 failed: 0 Fastroute successes: 0 failures: 0 TCP cksum fails(in): 0 (out): 0 Packet log flags set: (0) - When supplied with either for inbound - or for outbound, it will retrieve and - display the appropriate list of filter rules currently - installed and in use by the kernel. + Όταν χρησιμοποιηθεί η επιλογή για τα + εισερχόμενα ή η επιλογή για τα εξερχόμενα πακέτα, + η εντολή θα ανακτήσει και θα απεικονίσει την αντίστοιχη λίστα + κανόνων που είναι εγκατεστημένη και χρησιμοποιείται από τον πυρήνα τη + δεδομένη στιγμή. - ipfstat -in displays the inbound - internal rules table with rule number. + Η εντολή ipfstat -in δείχνει ένα αριθμημένο + πίνακα κανόνων για εισερχόμενα πακέτα. - ipfstat -on displays the outbound - internal rules table with the rule number. + Η εντολή ipfstat -on δείχνει ένα αριθμημένο + πίνακα κανόνων για εξερχόμενα πακέτα. - The output will look something like this: + Η έξοδος θα μοιάζει με την παρακάτω: @1 pass out on xl0 from any to any @2 block out on dc0 from any to any @3 pass out quick on dc0 proto tcp/udp from any to any keep state - ipfstat -ih displays the inbound - internal rules table, prefixing each rule with a count of how - many times the rule was matched. + Η εντολή ipfstat -ih δείχνει τον πίνακα + κανόνων για τα εισερχόμενα πακέτα, τοποθετώντας μπροστά από τον + κάθε κανόνα ένα αριθμό που δείχνει πόσες φορές έχει + χρησιμοποιηθεί. - ipfstat -oh displays the outbound - internal rules table, prefixing each rule with a count of how - many times the rule was matched. + Η εντολή ipfstat -oh δείχνει τον πίνακα + κανόνων για τα εξερχόμενα πακέτα, τοποθετώντας μπροστά από τον + κάθε κανόνα ένα αριθμό που δείχνει πόσες φορές έχει + χρησιμοποιηθεί. - The output will look something like this: + Η έξοδος θα μοιάζει με την παρακάτω: 2451423 pass out on xl0 from any to any 354727 block out on dc0 from any to any 430918 pass out quick on dc0 proto tcp/udp from any to any keep state - One of the most important functions of the - ipfstat command is the - flag which displays the state table in a way similar to the way - &man.top.1; shows the &os; running process table. When your - firewall is under attack this function gives you the ability to - identify, drill down to, and see the attacking packets. The - optional sub-flags give the ability to select the destination - or source IP, port, or protocol that you want to monitor in - real time. See the &man.ipfstat.8; manual page for - details. + Μια από τις πιο σημαντικές λειτουργίες της εντολής + ipfstat είναι η επιλογή η + οποία απεικονίζει τον πίνακα καταστάσεων, με τρόπο όμοιο με αυτό + που χρησιμοποιεί η εντολή &man.top.1; για να δείξει τον πίνακα + διεργασιών που εκτελούνται στο &os;. Όταν το firewall σας δέχεται + επίθεση, η λειτουργία αυτή σας δίνει την δυνατότητα να αναγνωρίσετε + και να εστιάσετε στα ίδια τα πακέτα που την αποτελούν. + Οι προαιρετικές υπο-επιλογές σας δίνουν την δυνατότητα να επιλέξετε + το IP αφετηρίας ή προορισμού, την θύρα, ή το πρωτόκολλο το οποίο + θέλετε να παρακολουθήσετε σε πραγματικό χρόνο. Δείτε τη σελίδα + manual του &man.ipfstat.8; για περισσότερες λεπτομέρειες. IPMON ipmon - IPFILTER - logging - In order for ipmon to work properly, the - kernel option IPFILTER_LOG must be turned on. This command has - two different modes that it can be used in. Native mode is the - default mode when you type the command on the command line - without the flag. - - Daemon mode is for when you want to have a continuous - system log file available so that you can review logging of - past events. This is how &os; and IPFILTER are configured to - work together. &os; has a built in facility to automatically - rotate system logs. That is why outputting the log information - to syslogd is better than the default of outputting to a - regular file. In the default rc.conf file - you see the ipmon_flags statement uses the - flags: + Για να λειτουργήσει σωστά η εντολή ipmon, + θα πρέπει να ενεργοποιηθεί η επιλογή IPFILTER_LOG + στον πυρήνα. Η εντολή αυτή διαθέτει δύο διαφορετικούς τρόπους + λειτουργίας. Ο προεπιλεγμένος κανονικός τρόπος λειτουργίας + ενεργοποιείται όταν η εντολή χρησιμοποιείται χωρίς την επιλογή + . + + Η εντολή μπορεί να χρησιμοποιηθεί σε λειτουργία δαίμονα όταν + επιθυμείτε να έχετε ένα συνεχόμενο αρχείο καταγραφής ώστε να μπορείτε + να εξετάσετε τις προηγούμενες εγγραφές. Αυτός είναι και ο τρόπος με + τον οποίο έχει ρυθμιστεί να συνεργάζεται το &os; με το IPFILTER. + Το &os; έχει ενσωματωμένη δυνατότητα εναλλαγής αρχείων καταγραφής. + Για αυτό το λόγο, είναι καλύτερο η καταγραφή να γίνεται μέσω του + &man.syslogd.8; παρά σε ένα συνηθισμένο αρχείο. Από προεπιλογή, η + ρύθμιση ipmon_flags στο αρχείο + rc.conf χρησιμοποιεί τις επιλογές + : ipmon_flags="-Ds" # D = start as daemon # s = log to syslog # v = log tcp window, ack, seq # n = map IP & port to names - The benefits of logging are obvious. It provides the - ability to review, after the fact, information such as which - packets had been dropped, what addresses they came from and - where they were going. These all give you a significant edge - in tracking down attackers. - - Even with the logging facility enabled, IPF will not - generate any rule logging on its own. The firewall - administrator decides what rules in the rule set he wants to - log and adds the log keyword to those rules. Normally only - deny rules are logged. - - It is very customary to include a default deny everything - rule with the log keyword included as your last rule in the - rule set. This way you get to see all the packets that did not - match any of the rules in the rule set. + Τα πλεονεκτήματα της καταγραφής είναι προφανή. Παρέχει την + δυνατότητα επισκόπησης πληροφοριών όπως τα πακέτα που απορρίφθηκαν, + τις διευθύνσεις από τις οποίες λήφθηκαν, και τον προορισμό τους. + Έχετε έτσι ένα σημαντικό πλεονέκτημα όταν προσπαθείτε να αναγνωρίσετε + ένα εισβολέα. + + Ακόμα και όταν ενεργοποιήσετε την δυνατότητα καταγραφής, το IPF + δεν θα καταγράψει τίποτα αν δεν έχει γίνει η αντίστοιχη ρύθμιση στους + κανόνες. Ο διαχειριστής του firewall αποφασίζει για ποιους κανόνες + του σετ θέλει να ενεργοποιήσει την καταγραφή, και προσθέτει σε αυτούς + την λέξη log. Φυσιολογικά, η καταγραφή ενεργοποιείται μόνο σε κανόνες + που απορρίπτουν πακέτα. + + Είναι πολύ συνηθισμένο να περιλαμβάνεται ένας κανόνας στο τέλος + του συνόλου, που να απορρίπτει από προεπιλογή όλα τα πακέτα που + φτάνουν μέχρι εκεί (default deny). Με τον τρόπο αυτό μπορείτε να + δείτε όλα τα πακέτα που δεν ταίριαξαν με κανένα κανόνα του σετ. - IPMON Logging - - Syslogd uses its own special - method for segregation of log data. It uses special groupings - called facility and level. IPMON - in mode uses security - as the facility - name. All IPMON logged data goes to security - The following levels can be - used to further segregate the logged data if desired: + Καταγραφή του IPMON + + Το syslogd χρησιμοποιεί τη δική του + ειδική μέθοδο για το διαχωρισμό των δεδομένων καταγραφής. + Διαθέτει ειδικές ομαδοποιήσεις που ονομάζονται + facility και level. Όταν το IPMON + χρησιμοποιείται με την επιλογή , χρησιμοποιεί το + security ως όνομα facility. + Όλα τα δεδομένα που καταγράφονται από το IPMON καταλήγουν στο + security. Αν το επιθυμείτε, μπορείτε να + χρησιμοποιήσετε τα παρακάτω επίπεδα για περαιτέρω διαχωρισμό των + δεδομένων καταγραφής: LOG_INFO - packets logged using the "log" keyword as the action rather than pass or block. LOG_NOTICE - packets logged which are also passed LOG_WARNING - packets logged which are also blocked LOG_ERR - packets which have been logged and which can be considered short - To setup IPFILTER to log all data to - /var/log/ipfilter.log, you will need to - create the file. The following command will do that: + Για να ρυθμίσετε το IPFILTER να καταγράφει όλα τα δεδομένα στο + /var/log/ipfilter.log, θα χρειαστεί να + δημιουργήσετε από πριν το αρχείο. Αυτό μπορεί να γίνει με την + παρακάτω εντολή: - &prompt.root; touch /var/log/ipfilter.log + &prompt.root; touch /var/log/ipfilter.log - The syslog function is controlled by definition statements - in the /etc/syslog.conf file. The - syslog.conf file offers considerable - flexibility in how syslog will deal with system messages issued - by software applications like IPF. + Η λειτουργία του &man.syslogd.8; μπορεί να ρυθμιστεί με + καταχωρίσεις στο αρχείο /etc/syslog.conf. + Το αρχείο syslog.conf προσφέρει σημαντική + ευελιξία στον τρόπο με τον οποίο το syslog + αντιμετωπίζει τα μηνύματα συστήματος που προέρχονται από εφαρμογές + όπως το IPF. - Add the following statement to + Προσθέστε την παρακάτω καταχώριση στο αρχείο /etc/syslog.conf: security.* /var/log/ipfilter.log - The security.* - means to write all the logged messages to the coded - file location. + Το security.* σημαίνει ότι θα γίνεται + καταγραφή όλων των μηνυμάτων αυτού του τύπου στην τοποθεσία που έχει + οριστεί. - To activate the changes to /etc/syslog.conf - you can reboot or bump the syslog task into - re-reading /etc/syslog.conf by running + Για να ενεργοποιήσετε τις αλλαγές στο + /etc/syslog.conf θα πρέπει να επανεκκινήσετε το + μηχάνημα ή να αναγκάσετε το &man.syslogd.8; να ξαναδιαβάσει το + /etc/syslog.conf, εκτελώντας την εντολή /etc/rc.d/syslogd reload - Do not forget to change - /etc/newsyslog.conf to rotate the new log - you just created above. + Μην ξεχάσετε να τροποποιήσετε το + /etc/newsyslog.conf ώστε να εναλλάσσει το αρχείο + καταγραφής που δημιουργήσατε παραπάνω. - The Format of Logged Messages + Η Μορφή των Μηνυμάτων Καταγραφής - Messages generated by ipmon consist of - data fields separated by white space. Fields common to all - messages are: + Τα μηνύματα που παράγονται από την ipmon + αποτελούνται από πεδία δεδομένων που χωρίζονται από λευκό διάστημα. + Τα πεδία που είναι κοινά σε όλα τα μηνύματα, είναι τα παρακάτω: - The date of packet receipt. + Η ημερομηνία παραλαβής του πακέτου - The time of packet receipt. This is in the form - HH:MM:SS.F, for hours, minutes, seconds, and fractions of a - second (which can be several digits long). + Η ώρα παραλαβής του πακέτου. Έχει την μορφή HH:MM:SS.F, + η οποία υποδηλώνει ώρες, λεπτά, δευτερόλεπτα και κλάσματα + δευτερολέπτου (τα οποία μπορεί να είναι πολλά δεκαδικά + ψηφία). - The name of the interface the packet was processed on, - e.g. dc0. + Το όνομα της διεπαφής στην οποία έγινε η επεξεργασία του + πακέτου π.χ. dc0. - The group and rule number of the rule, e.g. + Ο αριθμός ομάδας και ο αύξων αριθμός του κανόνα, π.χ. @0:17. - These can be viewed with ipfstat - -in. + Μπορείτε να δείτε τα παρακάτω με την εντολή + ipfstat -in: - The action: p for passed, b for blocked, S for a short - packet, n did not match any rules, L for a log rule. The - order of precedence in showing flags is: S, p, b, n, L. A - capital P or B means that the packet has been logged due to - a global logging setting, not a particular rule. + Το είδος της ενέργειας: p αν το πακέτο πέρασε, b αν το πακέτο + απορρίφθηκε, S για σύντομο πακέτο, n αν δεν ταίριαξε με κανένα + κανόνα, L για κανόνα με καταγραφή. Η σειρά προτεραιότητας στην + απεικόνιση των παραπάνω, είναι S, p, b, n, L. Το κεφαλαίο P ή + το B σημαίνουν ότι η καταγραφή του πακέτου έγινε λόγω κάποιας + γενικής ρύθμισης καταγραφής και όχι εξαιτίας κάποιου + κανόνα. - The addresses. This is actually three fields: the - source address and port (separated by a comma), the -> - symbol, and the destination address and port. - 209.53.17.22,80 -> 198.73.220.17,1722. + Οι διευθύνσεις. Πρόκειται στην πραγματικότητα για τρία + πεδία: τη διεύθυνση και τη θύρα αφετηρίας (χωρίζονται με κόμμα), + το σύμβολο -> και την διεύθυνση και θύρα προορισμού, π.χ. + 209.53.17.22,80 -> 198.73.220.17,1722. - PR followed by the protocol name or - number, e.g. PR tcp. + Το PR ακολουθούμενο από το όνομα ή τον + αριθμό του πρωτοκόλλου, π.χ. PR tcp. - len followed by the header length - and total length of the packet, e.g. len 20 40. + Το len ακολουθούμενο από το μήκος της + επικεφαλίδας και το συνολικό μήκος του πακέτου, π.χ. + len 20 40. - If the packet is a TCP packet, there - will be an additional field starting with a hyphen followed by - letters corresponding to any flags that were set. See the - &man.ipmon.8; manual page for a list of letters and their - flags. - - If the packet is an ICMP packet, there will be two fields - at the end, the first always being ICMP, and the - next being the ICMP message and sub-message type, separated by - a slash, e.g. ICMP 3/3 for a port unreachable message. + Αν πρόκειται για πακέτο TCP, θα υπάρχει ένα + επιπλέον πεδίο το οποίο θα ξεκινάει με μια παύλα και θα ακολουθείται + από γράμματα τα οποία αντιστοιχούν στις επιλογές (flags) που έχουν + τεθεί. Δείτε τη σελίδα manual &man.ipmon.8; για τη λίστα των + γραμμάτων και των αντίστοιχων flags. + + Αν πρόκειται για πακέτο ICMP, θα υπάρχουν δύο πεδία στο τέλος, + το πρώτο θα είναι πάντα ICMP και το επόμενο θα είναι + ο τύπος του μηνύματος και του υπό-μηνύματος ICMP, χωρισμένα με μια + κάθετο, π.χ. ICMP 3/3 για ένα μήνυμα μη προσβάσιμης θύρας (port + unreachable). - Building the Rule Script with Symbolic - Substitution + Δημιουργία Script Κανόνων με Συμβολική Υποκατάσταση - Some experienced IPF users create a file containing the - rules and code them in a manner compatible with running them as - a script with symbolic substitution. The major benefit of - doing this is that you only have to change the value associated - with the symbolic name and when the script is run all the rules - containing the symbolic name will have the value substituted in - the rules. Being a script, you can use symbolic substitution - to code frequently used values and substitute them in multiple - rules. You will see this in the following example. + Ορισμένοι έμπειροι χρήστες του IPF δημιουργούν ένα αρχείο + κανόνων το οποίο μπορεί να εκτελεστεί ως script με δυνατότητα + συμβολικής υποκατάστασης. Το βασικό όφελος του παραπάνω, είναι ότι + χρειάζεται να αλλάξετε μόνο την τιμή που σχετίζεται με το συμβολικό + όνομα και όταν το script εκτελεστεί, η τιμή θα υποκατασταθεί σε όλους + τους κανόνες που περιέχουν το όνομα αυτό. Καθώς πρόκειται για + script, μπορείτε να χρησιμοποιήσετε συμβολική υποκατάσταση για να + κωδικοποιήσετε συχνά χρησιμοποιούμενες τιμές και να τις υποκαθιστάτε + σε πολλαπλούς κανόνες. Αυτό φαίνεται και στο παράδειγμα που + ακολουθεί. - The script syntax used here is compatible with the sh, csh, - and tcsh shells. + Η σύνταξη του script που χρησιμοποιείται εδώ, είναι συμβατή με τα + κελύφη &man.sh.1;, &man.csh.1;, και &man.tcsh.1;. - Symbolic substitution fields are prefixed with a dollar - sign: $. + Τα πεδία στα οποία γίνεται συμβολική υποκατάσταση προσημειώνονται + με το σήμα του δολαρίου: $. - Symbolic fields do not have the $ prefix. + Τα συμβολικά πεδία δεν έχουν την προσημείωση με το + $. - The value to populate the symbolic field must be enclosed - with double quotes ("). + Η τιμή που θα χρησιμοποιηθεί στο συμβολικό πεδίο, θα πρέπει να + εσωκλείεται σε διπλά εισαγωγικά ("). - Start your rule file with something like this: + Ξεκινήστε το αρχείο των κανόνων σας με κάτι αντίστοιχο με το + παρακάτω: ############# Start of IPF rules script ######################## oif="dc0" # name of the outbound interface odns="192.0.2.11" # ISP's DNS server IP address myip="192.0.2.7" # my static IP address from ISP ks="keep state" fks="flags S keep state" # You can choose between building /etc/ipf.rules file # from this script or running this script "as is". # # Uncomment only one line and comment out another. # # 1) This can be used for building /etc/ipf.rules: #cat > /etc/ipf.rules << EOF # # 2) This can be used to run script "as is": /sbin/ipf -Fa -f - << EOF # Allow out access to my ISP's Domain name server. pass out quick on $oif proto tcp from any to $odns port = 53 $fks pass out quick on $oif proto udp from any to $odns port = 53 $ks # Allow out non-secure standard www function pass out quick on $oif proto tcp from $myip to any port = 80 $fks # Allow out secure www function https over TLS SSL pass out quick on $oif proto tcp from $myip to any port = 443 $fks EOF ################## End of IPF rules script ######################## - That is all there is to it. The rules are not important in - this example; how the symbolic substitution fields are - populated and used are. If the above example was in a file - named /etc/ipf.rules.script, you could - reload these rules by entering the following command: + Αυτό είναι όλο. Στο παραπάνω παράδειγμα δεν είναι σημαντικοί + οι κανόνες, αλλά ο τρόπος με τον οποίο λειτουργούν και παίρνουν τιμές + τα πεδία υποκατάστασης. Αν το παραπάνω παράδειγμα βρίσκονταν σε ένα + αρχείο με το όνομα /etc/ipf.rules.script, + θα μπορούσατε να επαναφορτώσετε αυτούς τους κανόνες με την παρακάτω + εντολή: &prompt.root; sh /etc/ipf.rules.script - There is one problem with using a rules file with embedded - symbolics: IPF does not understand symbolic substitution, and - cannot read such scripts directly. + Υπάρχει ένα πρόβλημα όταν χρησιμοποιούνται αρχεία κανόνων με + ενσωματωμένους συμβολισμούς: Το IPF δεν καταλαβαίνει τη συμβολική + υποκατάσταση, και δεν μπορεί να διαβάσει αυτά τα scripts άμεσα. - This script can be used in one of two ways: + Ένα τέτοιο script μπορεί να χρησιμοποιηθεί με ένα από τους δύο + παρακάτω τρόπους: - Uncomment the line that begins with - cat, and comment out the line that - begins with /sbin/ipf. Place - ipfilter_enable="YES" into - /etc/rc.conf as usual, and run script - once after each modification to create or update - /etc/ipf.rules. + Αφαιρέστε το σχόλιο από τη γραμμή που ξεκινάει με + cat, και μετατρέψτε σε σχόλιο τη γραμμή που + ξεκινάει με /sbin/ipf. Τοποθετήστε το + ipfilter_enable="YES" στο αρχείο + /etc/rc.conf όπως συνήθως, και εκτελέστε + το script μια φορά μετά από κάθε αλλαγή για να δημιουργήσετε ή να + ενημερώσετε το /etc/ipf.rules. - Disable IPFILTER in system startup scripts by adding - ipfilter_enable="NO" (this is default - value) into /etc/rc.conf file. - - Add a script like the following to your - /usr/local/etc/rc.d/ startup - directory. The script should have an obvious name like - ipf.loadrules.sh. The - .sh extension is mandatory. + Απενεργοποιήστε το IPFILTER στα scripts εκκίνησης του + συστήματος, προσθέτοντας την καταχώριση + ipfilter_enable="NO" (πρόκειται για την + προεπιλεγμένη τιμή) στο αρχείο + /etc/rc.conf. + + Προσθέστε ένα script όπως το παρακάτω στον κατάλογο εκκίνησης + /usr/local/etc/rc.d/. Το + script θα πρέπει να έχει ένα προφανές όνομα, όπως + ipf.loadrules.sh. Η επέκταση + .sh είναι υποχρεωτική. #!/bin/sh sh /etc/ipf.rules.script - The permissions on this script file must be read, - write, execute for owner root. + Οι άδειες σε αυτό το αρχείο, θα πρέπει να επιτρέπουν ανάγνωση, + εγγραφή και εκτέλεση για τον χρήστη + root. &prompt.root; chmod 700 /usr/local/etc/rc.d/ipf.loadrules.sh - Now, when your system boots, your IPF rules will be - loaded. + Οι κανόνες του IPF θα φορτώνονται πλέον κατά την εκκίνηση του + συστήματος σας. - IPF Rule Sets - - - - A rule set is a group of ipf rules coded to pass or block - packets based on the values contained in the packet. The - bi-directional exchange of packets between hosts comprises a - session conversation. The firewall rule set processes the - packet two times, once on its arrival from the public Internet - host and again as it leaves for its return trip back to the - public Internet host. Each TCP/IP service (i.e. telnet, www, - mail, etc.) is predefined by its protocol, source and - destination IP address, or the source and destination port - number. This is the basic selection criteria used to create - rules which will pass or block services. + Το Σύνολο Κανόνων του IPF + + Ως σύνολο κανόνων στο IPF, ορίζουμε μια ομάδα + κανόνων που έχουν γραφεί για να επιτρέπουν ή να απορρίπτουν πακέτα + ανάλογα με τις τιμές που περιέχονται σε αυτά. Η διπλής κατεύθυνσης + ανταλλαγή πακέτων μεταξύ υπολογιστών αποτελεί μια συνεδρία. + Το σύνολο κανόνων του firewall επεξεργάζεται τόσο τα πακέτα που + έρχονται από το Internet, όσο και τα πακέτα που παράγονται από το + σύστημα ως απάντηση σε αυτά. Κάθε υπηρεσία TCP/IP + (π.χ. telnet, www, mail, κ.λ.π.) καθορίζεται από το πρωτόκολλο και + την προνομιακή (privileged) θύρα που χρησιμοποιεί για να δέχεται + αιτήματα εξυπηρέτησης. Τα πακέτα που προορίζονται για μια + συγκεκριμένη υπηρεσία, ξεκινούν από τη διεύθυνση αφετηρίας + χρησιμοποιώντας μια μη-προνομιακή θύρα και καταλήγουν στη + συγκεκριμένη θύρα υπηρεσίας στον προορισμό. Όλες οι παραπάνω + παράμετροι (θύρες και διευθύνσεις) μπορούν να χρησιμοποιηθούν + ως κριτήρια επιλογής για την δημιουργία κανόνων που επιτρέπουν + ή εμποδίζουν την πρόσβαση σε υπηρεσίες. IPFILTER - rule processing order - - - IPF was originally written using a rules processing logic - of the last matching rule wins and used only - stateless rules. Over time IPF has been enhanced to include a - quick option and a stateful keep - state option which drastically modernized the rule - processing logic. - - The instructions contained in this section are based on - using rules that contain the quick option and - the stateful keep state option. This is the - basic framework for coding an inclusive firewall rule - set. - - - - An inclusive firewall only allows services matching the - rules through. This way you can control what services can - originate behind the firewall destined for the public Internet - and also control the services which can originate from the - public Internet accessing your private network. Everything - else is blocked and logged by default design. Inclusive - firewalls are much, much securer than exclusive firewall rule - sets and is the only rule set type covered herein. + + + Το IPF γράφτηκε αρχικά χρησιμοποιώντας μια λογική επεξεργασίας + κανόνων του τύπου ο τελευταίος κανόνας που ταιριάζει, είναι ο + νικητής και χρησιμοποιούσε μόνο κανόνες stateless. Με την + πάροδο του χρόνου, το IPF ενισχύθηκε με την επιλογή + quick και με δυνατότητα αποθήκευσης κατάστασης + μέσω της επιλογής keep state. Με τον τρόπο αυτό, + εκσυγχρονίστηκε δραματικά η λογική επεξεργασίας των κανόνων. + + Οι οδηγίες που περιέχονται σε αυτή την ενότητα βασίζονται στη + χρήση κανόνων που περιέχουν την επιλογή quick και την + επιλογή keep state για τη διατήρηση της κατάστασης. + Αυτές είναι και οι βασικές λειτουργίες για την κωδικοποίηση του + συνόλου κανόνων ενός inclusive firewall. - When working with the firewall rules, be very - careful. Some configurations will - lock you out of the server. To be on the safe - side, you may wish to consider performing the initial - firewall configuration from the local console rather than - doing it remotely e.g. via - ssh. + Όταν δουλεύετε με τους κανόνες του firewall, θα πρέπει να είστε + πολύ προσεκτικοί. Αν βάλετε λανθασμένες + ρυθμίσεις, μπορεί να κλειδωθείτε έξω από τον + εξυπηρετητή σας. Για να είστε ασφαλείς, είναι προτιμότερο να + κάνετε τις αρχικές σας ρυθμίσεις από την τοπική κονσόλα, παρά μέσω + απομακρυσμένης σύνδεσης (π.χ. μέσω + ssh). - Rule Syntax + Συντακτικό Κανόνων IPFILTER - rule syntax - The rule syntax presented here has been simplified to only - address the modern stateful rule context and first - matching rule wins logic. For the complete legacy rule - syntax description see the &man.ipf.8; manual page. - - A # character is used to mark the start - of a comment and may appear at the end of a rule line or on its - own line. Blank lines are ignored. - - Rules contain keywords. These keywords have to be coded in - a specific order from left to right on the line. Keywords are - identified in bold type. Some keywords have sub-options which - may be keywords themselves and also include more sub-options. - Each of the headings in the below syntax has a bold section - header which expands on the content. + Το συντακτικό των κανόνων που παρουσιάζουμε εδώ, έχει απλοποιηθεί + ώστε να απεικονίζει τη σύγχρονη stateful υλοποίηση και τη λογική + του τύπου ο πρώτος κανόνας που ταιριάζει είναι και ο + νικητής. Για την περιγραφή του παλιότερου τρόπου λειτουργίας, + διαβάστε τη σελίδα manual του &man.ipf.8;. + + Ο χαρακτήρας # χρησιμοποιείται για να + επισημάνει την αρχή ενός σχολίου, και μπορεί να εμφανίζεται στο τέλος + μιας γραμμής κανόνα ή στη δική του γραμμή. Οι κενές γραμμές + αγνοούνται. + + Οι κανόνες περιέχουν λέξεις-κλειδιά. Οι λέξεις αυτές θα πρέπει + να κωδικοποιηθούν με συγκεκριμένη σειρά από τα αριστερά προς τα δεξιά + της γραμμής. Οι λέξεις-κλειδιά φαίνονται παρακάτω με έντονα γράμματα. + Μερικές λέξεις έχουν υπο-επιλογές οι οποίες μπορεί να είναι επίσης + λέξεις-κλειδιά και να περιλαμβάνουν επίσης περισσότερες υπο-επιλογές. + Κάθε μια από τις επικεφαλίδες στο παράδειγμα που φαίνεται παρακάτω + έχει μια κεφαλίδα με έντονα γράμματα η οποία επεξηγεί το περιεχόμενο + της. ACTION IN-OUT OPTIONS SELECTION STATEFUL PROTO SRC_ADDR,DST_ADDR OBJECT PORT_NUM TCP_FLAG STATEFUL ACTION = block | pass IN-OUT = in | out OPTIONS = log | quick | on interface-name SELECTION = proto value | source/destination IP | port = number | flags flag-value PROTO = tcp/udp | udp | tcp | icmp SRC_ADD,DST_ADDR = all | from object to object OBJECT = IP address | any PORT_NUM = port number TCP_FLAG = S STATEFUL = keep state ACTION - The action indicates what to do with the packet if it - matches the rest of the filter rule. Each rule - must have a action. The following - actions are recognized: + Η ενέργεια (action) δείχνει τι πρέπει να γίνει με το πακέτο αν + ταιριάζει με τον κανόνα του φίλτρου. Κάθε κανόνας + πρέπει να διαθέτει μια ενέργεια. Οι ενέργειες + που αναγνωρίζονται, φαίνονται παρακάτω: - block indicates that the packet should - be dropped if the selection parameters match the - packet. + Το block δείχνει ότι το πακέτο θα πρέπει να + απορριφθεί αν ταιριάζει με τις παραμέτρους επιλογής του + κανόνα. - pass indicates that the packet should - exit the firewall if the selection parameters match the - packet. + Το pass δείχνει ότι το πακέτο θα πρέπει να + εξέλθει από το firewall, αν ταιριάζει με τις παραμέτρους επιλογής + του κανόνα. IN-OUT - A mandatory requirement is that each filter rule - explicitly state which side of the I/O it is to be used on. - The next keyword must be either in or out and one or the - other has to be coded or the rule will not pass syntax - checks. + Κάθε κανόνας του φίλτρου πρέπει υποχρεωτικά να διευκρινίζει + με σαφήνεια αν αναφέρεται στην είσοδο ή την έξοδο πακέτων. + Η επόμενη λέξη-κλειδί πρέπει να είναι in ή + out και αν δεν υπάρχει, ο κανόνας θα αποτύχει + κατά το συντακτικό έλεγχο. - in means this rule is being applied - against an inbound packet which has just been received on the - interface facing the public Internet. + Το in σημαίνει ότι ο κανόνας θα εφαρμοστεί + σε ένα εισερχόμενο πακέτο το οποίο μόλις λήφθηκε στη διεπαφή που + συνδέεται με το Διαδίκτυο. - out means this rule is being applied - against an outbound packet destined for the interface facing - the public Internet. + Το out σημαίνει ότι ο κανόνας θα εφαρμοστεί + σε ένα πακέτο που προορίζεται για έξοδο μέσω της διεπαφής που + συνδέεται με το Διαδίκτυο. OPTIONS - These options must be used in the order shown - here. + Οι παρακάτω επιλογές πρέπει να χρησιμοποιηθούν με τη σειρά + που φαίνονται εδώ. - log indicates that the packet header - will be written to + Το log δείχνει ότι η επικεφαλίδα του πακέτου + θα γραφεί στο αρχείο καταγραφής του - the ipl log (as described in the - LOGGING section below) if the selection parameters match the - packet. - - quick indicates that if the selection - parameters match the packet, this rule will be the last rule - checked, allowing a short-circuit path to avoid processing - any following rules for this packet. This option is a - mandatory requirement for the modernized rules processing - logic. - - on indicates the interface name to be - incorporated into the selection parameters. Interface names - are as displayed by &man.ifconfig.8;. Using this option, the - rule will only match if the packet is going through that - interface in the specified direction (in/out). This option - is a mandatory requirement for the modernized rules - processing logic. - - When a packet is logged, the headers of the packet are - written to the IPL packet logging pseudo-device. - Immediately following the log keyword, the following - qualifiers may be used (in this order): - - body indicates that the first 128 - bytes of the packet contents will be logged after the - headers. - - first If the log - keyword is being used in conjunction with a keep - state option, it is recommended that this option is - also applied so that only the triggering packet is logged and - not every packet which thereafter matches the keep - state information. + ipl (όπως περιγράφεται στην ενότητα + LOGGING που ακολουθεί) αν οι παράμετροι της επιλογής ταιριάζουν με + το πακέτο. + + To quick δείχνει ότι αν οι παράμετροι της + επιλογής ταιριάζουν με το πακέτο, ο συγκεκριμένος κανόνας θα είναι + και ο τελευταίος κανόνας που θα ελεγχθεί. Η επιλογή αυτή είναι + υποχρεωτική για τη σύγχρονη λογική επεξεργασίας πακέτων. + + Το on δείχνει το όνομα της διεπαφής που θα + ενσωματωθεί στις παραμέτρους επιλογής. Τα ονόματα των διεπαφών + φαίνονται όταν εκτελείται η εντολή &man.ifconfig.8;. + Χρησιμοποιώντας την επιλογή αυτή, ο κανόνας θα ελεγχθεί μόνο αν το + πακέτο διέρχεται μέσω της συγκεκριμένης διεπαφής και προς τη + συγκεκριμένη κατεύθυνση (εισερχόμενα/εξερχόμενα). Η επιλογή αυτή + είναι υποχρεωτική για την σύγχρονη λογική επεξεργασίας των + κανόνων. + + Όταν γίνεται καταγραφή ενός πακέτου, οι επικεφαλίδες γράφονται + στην ψευδο-συσκευή καταγραφής πακέτων IPL. + Μετά την εντολή log, μπορούν να χρησιμοποιηθούν + οι παρακάτω παράμετροι (με τη σειρά που φαίνονται): + + Το body δείχνει ότι θα γίνει καταγραφή των + πρώτων 128 bytes των περιεχομένων του πακέτου, που βρίσκονται αμέσως + μετά την επικεφαλίδα. + + Η επιλογή first συνίσταται να χρησιμοποιηθεί + αν η επιλογή log χρησιμοποιείται σε συνδυασμό + με την keep state. Με τον τρόπο αυτό γίνεται + καταγραφή μόνο του πρώτου πακέτου (με το οποίο ξεκίνησε η + επικοινωνία), και όχι όλων των υπολοίπων τα οποία ταιριάζουν με την + πληροφορία keep state. SELECTION - The keywords described in this section are used to - describe attributes of the packet to be interrogated when - determining whether rules match or not. There is a - keyword subject, and it has sub-option keywords, one of - which has to be selected. The following general-purpose - attributes are provided for matching, and must be used in - this order: + Οι λέξεις κλειδιά που περιγράφονται σε αυτή την ενότητα, + χρησιμοποιούνται για να περιγράψουν ποιες ιδιότητες του πακέτου + θα διερευνηθούν για να καθοριστεί αν ταιριάζει ή όχι με τους + κανόνες. Μια λέξη-κλειδί ορίζει το κεντρικό θέμα και ακολουθείται + από άλλες λέξεις που ορίζουν τις ακριβείς επιλογές. Πρέπει πάντοτε + να επιλέγεται μια από αυτές τις λέξεις. Παρέχονται οι παρακάτω + ιδιότητες γενικής χρήσης οι οποίες πρέπει να χρησιμοποιηθούν με + αυτή τη σειρά: PROTO - proto is the subject keyword and must - be coded along with one of its corresponding keyword - sub-option values. The value allows a specific protocol to - be matched against. This option is a mandatory requirement - for the modernized rules processing logic. - - tcp/udp | udp | tcp | icmp or any - protocol names found in /etc/protocols - are recognized and may be used. The special protocol keyword - tcp/udp may be used to match either a - TCP or a UDP packet, and has been added as - a convenience to save duplication of otherwise identical - rules. + Το proto είναι η βασική λέξη, και πρέπει + να γράφεται μαζί με κάποια αντίστοιχη τιμή για περαιτέρω επιλογή. + Η τιμή επιτρέπει το ταίριασμα με ένα συγκεκριμένο πρωτόκολλο. Είναι + υποχρεωτικό να χρησιμοποιηθεί για να λειτουργεί η σύγχρονη λογική + επεξεργασίας των κανόνων. + + Τα ονόματα πρωτοκόλλων που αναγνωρίζονται και μπορούν να + χρησιμοποιηθούν, είναι τα + tcp/udp | udp | tcp | icmp ή οποιαδήποτε άλλα + εμφανίζονται στο /etc/protocols. Μπορείτε να + χρησιμοποιήσετε το ειδικό όνομα tcp/udp το οποίο + ταιριάζει είτε με πακέτο TCP είτε με + UDP. Η ειδική αυτή ονομασία προστέθηκε ώστε να + αποφεύγονται διπλοί, αλλά κατά τα άλλα όμοιοι, κανόνες. SRC_ADDR/DST_ADDR - The all keyword is essentially a - synonym for from any to any with no other - match parameters. - - from src to dst: the from and to - keywords are used to match against IP addresses. Rules must - specify BOTH source and destination parameters. - any is a special keyword that matches any - IP address. Examples of use: from any to any - or from 0.0.0.0/0 to any or from any to - 0.0.0.0/0 or from 0.0.0.0 to any or - from any to 0.0.0.0. - - - - IP addresses may be specified as a dotted IP address - numeric form/mask-length, or as single dotted IP address - numeric form. - - There is no way to match ranges of IP addresses which - do not express themselves easily as mask-length. See this - web page for help on writing mask-length: Η λέξη all είναι ουσιαστικά συνώνυμη με την + φράση from any to any χωρίς να υπάρχουν άλλες + παράμετροι για το ταίριασμα. + + Όταν χρησιμοποιείται το from src to dst, οι + λέξεις from και to δηλώνουν + διευθύνσεις IP που θα χρησιμοποιηθούν για το ταίριασμα. Οι κανόνες + πρέπει να καθορίζουν τις παραμέτρους τόσο της αφετηρίας όσο και του + προορισμού. Η λέξη any έχει την ειδική ιδιότητα + να ταιριάζει με οποιαδήποτε διεύθυνση IP. Παραδείγματα χρήσης: + from any to any ή + from 0.0.0.0/0 to any ή + from any to 0.0.0.0/0 ή + from 0.0.0.0 to any ή + from any to 0.0.0.0. + + Δεν υπάρχει τρόπος να περιγραφούν περιοχές IP διευθύνσεων που + δεν μπορούν να εκφραστούν εύκολα με τη μορφή αριθμών χωρισμένων με + τελείες / μάσκας υποδικτύου. Μπορείτε να χρησιμοποιήσετε το + βοηθητικό πρόγραμμα net-mgmt/ipcalc για διευκόλυνση σας + στους υπολογισμούς. Δείτε την δικτυακή τοποθεσία του προγράμματος + για περισσότερες πληροφορίες: . PORT - If a port match is included, for either or both of source - and destination, then it is only applied to - TCP and UDP packets. When composing port - comparisons, either the service name from - /etc/services or an integer port number - may be used. When the port appears as part of the from - object, it matches the source port number; when it appears - as part of the to object, it matches the destination port - number. The use of the port option with the - to object is a mandatory requirement for - the modernized rules processing logic. Example of use: - from any to any port = 80 - - - - Port comparisons may be done in a number of forms, with - a number of comparison operators, or port ranges may be - specified. + Το ταίριασμα με κάποια συγκεκριμένη θύρα αφετηρίας ή/και + προορισμού (αν υπάρχει) εφαρμόζεται μόνο σε πακέτα + TCP και UDP. Κατά την + δημιουργία συγκρίσεων με θύρες, μπορείτε είτε να χρησιμοποιήσετε τον + αριθμό της θύρας, είτε το όνομα της αντίστοιχης υπηρεσίας + από το αρχείο /etc/services. Όταν η θύρα + εμφανίζεται ως τμήμα του αντικειμένου from, το + ταίριασμα θα γίνει με την θύρα της αφετηρίας. Όταν εμφανίζεται ως + τμήμα του αντικειμένου to, το ταίριασμα θα γίνει + με τη θύρα προορισμού. Για να λειτουργεί η σύγχρονη λογική + ταιριάσματος κανόνων, θα πρέπει οπωσδήποτε να υπάρχει η επιλογή + θύρας στο αντικείμενο to. Παράδειγμα χρήσης: + from any to any port = 80 + + + + Οι συγκρίσεις που αναφέρονται σε μια μόνο θύρα, μπορούν να + γίνουν με πολλούς διαφορετικούς τρόπους, χρησιμοποιώντας + διαφορετικούς τελεστές σύγκρισης. Είναι επίσης δυνατόν να + καθοριστούν ολόκληρες περιοχές από θύρες. port "=" | "!=" | "<" | ">" | "<=" | ">=" | "eq" | "ne" | "lt" | "gt" | "le" | "ge". - To specify port ranges, port "<>" | - "><" + Για να καθορίσετε περιοχές θυρών, χρησιμοποιήστε + port "<>" | "><" - Following the source and destination matching - parameters, the following two parameters are mandatory - requirements for the modernized rules processing - logic. + Μετά τις παραμέτρους για το ταίριασμα της αφετηρίας και του + προορισμού, οι παρακάτω δύο παράμετροι είναι υποχρεωτικές για να + λειτουργεί η σύγχρονη λογική επεξεργασίας των κανόνων. <acronym>TCP</acronym>_FLAG - Flags are only effective for TCP - filtering. The letters represents one of the possible flags - that can be interrogated in the TCP packet - header. + Τα flags είναι ενεργά μόνο στο φιλτράρισμα του πρωτοκόλλου + TCP. Το κάθε γράμμα αντιπροσωπεύει ένα πιθανό + flag το για το οποίο γίνεται ανίχνευση στην επικεφαλίδα του πακέτου + TCP. - The modernized rules processing logic uses the - flags S parameter to identify the tcp - session start request. + Η σύγχρονη λογική επεξεργασίας των κανόνων, χρησιμοποιεί την + παράμετρο flags S για την αναγνώριση της έναρξης + μια συνεδρίας tcp. STATEFUL - keep state indicates that on a pass - rule, any packets that match the rules selection parameters - should activate the stateful filtering facility. + Σε ένα κανόνα που επιτρέπει (pass) το πέρασμα των πακέτων, η + επιλογή keep state δείχνει ότι θα πρέπει να + ενεργοποιείται η λειτουργία stateful filtering όταν το πακέτο + ταιριάζει με τα κριτήρια επιλογής. - This option is a mandatory requirement for the - modernized rules processing logic. + Η επιλογή αυτή είναι υποχρεωτική για τη λειτουργία της + σύγχρονης λογικής επεξεργασίας κανόνων. - Stateful Filtering + Φιλτράρισμα με Διατήρηση της Κατάστασης (stateful) IPFILTER - stateful filtering - Stateful filtering treats traffic as a bi-directional - exchange of packets comprising a session conversation. When - activated, keep-state dynamically generates internal rules for - each anticipated packet being exchanged during the - bi-directional session conversation. It has the interrogation - abilities to determine if the session conversation between the - originating sender and the destination are following the valid - procedure of bi-directional packet exchange. Any packets that - do not properly fit the session conversation template are - automatically rejected as impostors. - - Keep state will also allow ICMP packets related to a - TCP or UDP session through. So if you get - ICMP type 3 code 4 in response to some web surfing allowed out - by a keep state rule, they will be automatically allowed in. - Any packet that IPF can be certain is part of an active - session, even if it is a different protocol, will be let - in. - - What happens is: - - Packets destined to go out the interface connected to the - public Internet are first checked against the dynamic state - table, if the packet matches the next expected packet - comprising in a active session conversation, then it exits the - firewall and the state of the session conversation flow is - updated in the dynamic state table, the remaining packets get - checked against the outbound rule set. - - Packets coming in to the interface connected to the public - Internet are first checked against the dynamic state table, if - the packet matches the next expected packet comprising a - active session conversation, then it exits the firewall and - the state of the session conversation flow is updated in the - dynamic state table, the remaining packets get checked against - the inbound rule set. - - When the conversation completes it is removed from the - dynamic state table. - - Stateful filtering allows you to focus on blocking/passing - new sessions. If the new session is passed, all its subsequent - packets will be allowed through automatically and any impostors - automatically rejected. If a new session is blocked, none of - its subsequent packets will be allowed through. Stateful - filtering has technically advanced interrogation abilities - capable of defending against the flood of different attack - methods currently employed by attackers. + Το stateful φιλτράρισμα, αντιμετωπίζει την κίνηση του δικτύου ως + μιας διπλής κατεύθυνσης ανταλλαγή πακέτων τα οποία δημιουργούν μια + συνεδρία. Όταν ενεργοποιηθεί, η διατήρηση της κατάστασης + (keep-state) δημιουργεί δυναμικά εσωτερικούς κανόνες για κάθε πακέτο + το οποίο ανταλλάσσεται κατά τη διάρκεια αυτής της συνεδρίας. + Έχει επίσης τη δυνατότητα να διερευνήσει αν ακολουθούνται οι έγκυροι + κανόνες ανταλλαγής μηνυμάτων μεταξύ του αποστολέα και του παραλήπτη. + Οποιαδήποτε πακέτα δεν ταιριάζουν με το πρότυπο αυτής της + επικοινωνίας, απορρίπτονται ως ψεύτικα. + + Η διατήρηση της κατάστασης επιτρέπει επίσης να περάσουν τα + πακέτα ICMP που σχετίζονται με μια συνεδρία + TCP ή UDP. Έτσι, αν ληφθούν + πακέτα ICMP τύπου 3 code 4 ως απάντηση κατά τη + διάρκεια της επίσκεψης σας σε μια ιστοσελίδα, (η οποία επιτρέπεται + από τον αντίστοιχο κανόνα εξερχομένων), θα τους επιτραπεί η είσοδος. + Οποιοδήποτε πακέτο για το οποίο το IPF είναι σίγουρο ότι πρόκειται + για τμήμα μιας ενεργής συνεδρίας, θα περάσει ακόμα και αν είναι + διαφορετικό πρωτόκολλο. + + Αυτό που συμβαίνει είναι το παρακάτω: + + Τα πακέτα που προορίζονται να εξέλθουν μέσω της διεπαφής που + συνδέεται στο Internet, ελέγχονται αρχικά σύμφωνα με το δυναμικό + πίνακα καταστάσεων. Αν το πακέτο ταιριάζει με το επόμενο που + αναμένεται σε μια ενεργή συνεδρία, εξέρχεται από το firewall και + ταυτόχρονα ενημερώνεται η κατάσταση της συγκεκριμένης συνεδρίας στον + παραπάνω δυναμικό πίνακα. Τα υπόλοιπα πακέτα (που δεν ταιριάζουν με + κάποια συνεδρία σε εξέλιξη) ελέγχονται σύμφωνα με το σύνολο κανόνων + για τα εξερχόμενα πακέτα. + + Τα πακέτα που έρχονται από τη διεπαφή που είναι συνδεμένη με το + Internet, ελέγχονται αρχικά μέσω του δυναμικού πίνακα καταστάσεων. + Αν το πακέτο ταιριάζει με το επόμενο που αναμένεται σε μια ενεργή + συνεδρία, εξέρχεται από το firewall και ταυτόχρονα ενημερώνεται + η κατάσταση της συγκεκριμένης συνεδρίας στον παραπάνω πίνακα. Τα + υπόλοιπα πακέτα (που δεν ταιριάζουν με κάποια συνεδρία σε εξέλιξη) + ελέγχονται σύμφωνα με το σύνολο κανόνων για τα εισερχόμενα + πακέτα. + + Όταν η επικοινωνία ολοκληρωθεί, διαγράφεται από τον δυναμικό + πίνακα καταστάσεων. + + Το stateful φιλτράρισμα επιτρέπει να εστιάσουμε την προσοχή μας + στην αποδοχή ή απόρριψη των νέων συνδέσεων. Αν επιτραπεί μια νέα + συνεδρία, όλα τα υπόλοιπα πακέτα της θα επιτρέπονται αυτόματα, ενώ + τυχόν ψεύτικα πακέτα θα απορρίπτονται επίσης αυτόματα. Το stateful + φιλτράρισμα διαθέτει μια σειρά από προχωρημένες ικανότητες διερεύνησης + των πακέτων, με δυνατότητα να αμύνεται σε πολλές διαφορετικές + μεθόδους που χρησιμοποιούν οι επιτιθέμενοι. - Inclusive Rule Set Example - - The following rule set is an example of how to code a very - secure inclusive type of firewall. An inclusive firewall only - allows services matching pass rules through and blocks all - other by default. All firewalls have at the minimum two - interfaces which have to have rules to allow the firewall to - function. - - All &unix; flavored systems including &os; are designed to - use interface lo0 and IP address - 127.0.0.1 for internal - communication within the operating system. The firewall rules - must contain rules to allow free unmolested movement of these - special internally used packets. - - The interface which faces the public Internet is the one - where you place your rules to authorize and control access out - to the public Internet and access requests arriving from the - public Internet. This can be your user PPP - tun0 interface or your NIC that is - connected to your DSL or cable modem. - - In cases where one or more NICs are cabled to private LANs - behind the firewall, those interfaces must have a rule coded to - allow free unmolested movement of packets originating from - those LAN interfaces. - - The rules should be first organized into three major - sections: all the free unmolested interfaces, the public - interface outbound, and the public interface inbound. - - The rules in each of the public interface sections should - have the most frequently matched rules placed before less - commonly matched rules, with the last rule in the section - blocking and logging all packets on that interface and - direction. - - The Outbound section in the following rule set only - contains 'pass' rules which contain selection values that - uniquely identify the service that is authorized for public - Internet access. All the rules have the 'quick', 'on', - 'proto', 'port', and 'keep state' option coded. The 'proto - tcp' rules have the 'flag' option included to identify the - session start request as the triggering packet to activate the - stateful facility. - - The Inbound section has all the blocking of undesirable - packets first, for two different reasons. The first is that - these things being blocked may be part of an otherwise valid - packet which may be allowed in by the later authorized service - rules. The second reason is that by having a rule that - explicitly blocks selected packets that I receive on an - infrequent basis and that I do not want to see in the log, they - will not be caught by the last rule in the section which blocks - and logs all packets which have fallen through the rules. The - last rule in the section which blocks and logs all packets is - how you create the legal evidence needed to prosecute the - people who are attacking your system. - - Another thing you should take note of, is there is no - response returned for any of the undesirable stuff, their - packets just get dropped and vanish. This way the attacker - has no knowledge if his packets have reached your system. The - less the attackers can learn about your system, the more - time they must invest before actually doing something bad. - The inbound 'nmap OS fingerprint' attempts rule I log - - - - the first occurrence because this is something a attacker - would do. - - Any time you see log messages on a rule with 'log first'. - You should do an ipfstat -hio command to see - the number of times the rule has been matched so you know if - you are being flooded, i.e. under attack. - - When you log packets with port numbers you do not - recognize, look it up in /etc/services or - go to Παράδειγμα Συνόλου Κανόνων για ένα Inclusive Firewall + + Το παρακάτω σύνολο κανόνων δίνεται ως παράδειγμα για + να φτιάξετε ένα ιδιαίτερα ασφαλές inclusive firewall. Ένα inclusive + firewall επιτρέπει το πέρασμα μόνο των υπηρεσιών που ταιριάζουν με + τους κανόνες που έχει για αποδοχή πακέτων, και απορρίπτει όλα τα + υπόλοιπα. Τα firewalls που προστατεύουν άλλα μηχανήματα (τα οποία + καλούνται και network firewalls) θα πρέπει να διαθέτουν + τουλάχιστον δύο διεπαφές. Η μια διεπαφή συνδέεται με το τοπικό δίκτυο + (LAN) το οποίο θεωρείται έμπιστο, και η άλλη με + το δημόσιο Internet. Εναλλακτικά, ένα firewall μπορεί να + προστατεύει μόνο το σύστημα στο οποίο εκτελείται—αυτό καλείται + host based firewall και είναι κατάλληλο ιδιαίτερα + για εξυπηρετητές που λειτουργούν σε μη έμπιστα δίκτυα. + + Όλα τα συστήματα τύπου &unix;, συμπεριλαμβανομένου και του &os;, + έχουν σχεδιαστεί να χρησιμοποιούν την διεπαφή + lo0 και την IP διεύθυνση + 127.0.0.1 για εσωτερική επικοινωνία + μέσα στο ίδιο το λειτουργικό σύστημα. Το firewall πρέπει να περιέχει + κανόνες που να επιτρέπουν την ελεύθερη και χωρίς περιορισμούς κίνηση + των ειδικών αυτών εσωτερικών πακέτων. + + Οι κανόνες που εξουσιοδοτούν την πρόσβαση προς το Internet, + ορίζονται στην διεπαφή του δικτύου που συνδέεται σε αυτό. Οι κανόνες + αυτοί ελέγχουν τόσο την εισερχόμενη όσο και την εξερχόμενη κίνηση + στο Internet. Η διεπαφή αυτή μπορεί να είναι η + tun0 που χρησιμοποιείται στο PPP χρήστη, ή + ακόμα και η κάρτα δικτύου που συνδέεται σε ένα DSL router ή + modem. + + Σε περίπτωση που μια ή περισσότερες κάρτες δικτύου συνδέονται σε + εσωτερικά ιδιωτικά δίκτυα πίσω από το firewall, θα πρέπει να υπάρχουν + οι αντίστοιχοι κανόνες που να επιτρέπουν την ελεύθερη διακίνηση των + πακέτων ανάμεσα στις διεπαφές αυτές ή/και στο Internet. + + Οι κανόνες πρέπει να οργανώνονται σε τρεις κύριες ενότητες: αρχικά + όλες οι διεπαφές στις οποίες επιτρέπεται η ελεύθερη διακίνηση + δεδομένων, έπειτα η διεπαφή από την οποία εξέρχονται τα πακέτα προς + το δημόσιο δίκτυο (Internet) και τέλος η διεπαφή από την οποία + λαμβάνονται πακέτα από το Internet. + + Σε κάθε μια από τις ενότητες των διεπαφών που + συνδέονται στο Internet, πρέπει να τοποθετούνται πρώτοι οι κανόνες + που ταιριάζουν συχνότερα με την αντίστοιχη κίνηση. Ο τελευταίος + κανόνας της ενότητας θα πρέπει να απορρίπτει και να καταγράφει όλα τα + πακέτα της συγκεκριμένης διεπαφής/κατεύθυνσης. + + Η ενότητα των Εξερχομένων (Outbound) στο ακόλουθο σύνολο κανόνων, + περιέχει μόνο κανόνες τύπου pass οι οποίοι + επιτρέπουν (μέσω κατάλληλων τιμών στις παραμέτρους τους) σε + συγκεκριμένες υπηρεσίες να αποκτήσουν πρόσβαση στο Internet. Όλοι οι + κανόνες διαθέτουν τις επιλογές quick, + on, proto, + port και keep state. Οι κανόνες + proto tcp περιλαμβάνουν την επιλογή + flag ώστε να αναγνωρίζουν την αίτηση έναρξης της + συνεδρίας και να ενεργοποιούν τη λειτουργία διατήρησης της + κατάστασης (stateful). + + Στην ενότητα των εισερχόμενων πακέτων (Inbound) που φαίνεται + παρακάτω, πρώτοι εμφανίζονται οι κανόνες που χρησιμοποιούνται για την + απόρριψη των ανεπιθύμητων πακέτων. Αυτό γίνεται για δύο διαφορετικούς + λόγους. Ο πρώτος είναι ότι τα κακόβουλα πακέτα μπορεί εν μέρει να + ταιριάζουν με κάποια χαρακτηριστικά της έγκυρης κίνησης. Τα πακέτα + αυτά θα πρέπει να απορριφθούν, αντί να γίνουν δεκτά από κάποιο + επόμενο κανόνα allow. Ο δεύτερος είναι ότι + μπορείτε να απορρίψετε συγκεκριμένα πακέτα τα οποία γνωρίζετε ότι δεν + είναι έγκυρα, αλλά σας είναι αδιάφορη η καταγραφή τους. Με τον τρόπο + αυτό εμποδίζεται η λήψη και καταγραφή τους από τον τελευταίο κανόνα. + Ο τελευταίος κανόνας τυπικά απορρίπτει και καταγράφει όλα τα πακέτα + που έφτασαν μέχρι αυτόν. Ο κανόνας αυτός χρησιμοποιείται για την + παροχή νομικών αποδείξεων σε περίπτωση που κινήσετε δικαστική + διαδικασία κατά ατόμων που προέβησαν σε επιθέσεις στο σύστημα + σας. + + Θα πρέπει επίσης να εξασφαλίσετε ότι το σύστημα σας δεν θα δώσει + καμιά απάντηση σε κανένα από τα ανεπιθύμητα πακέτα. Τα πακέτα αυτά + θα πρέπει να απορριφθούν και να εξαφανιστούν. Με τον τρόπο αυτό, ο + επιτιθέμενος δεν έχει καμιά γνώση αν τα πακέτα του έφτασαν μέχρι το + σύστημα σας. Όσο λιγότερα μπορούν να μάθουν οι επιτιθέμενοι σχετικά + με το σύστημα σας, τόσο περισσότερο χρόνο θα χρειαστεί να επενδύσουν + για να καταφέρουν να σας βλάψουν στα αλήθεια. Οι κανόνες με την + επιλογή log first καταγράφουν το συμβάν μόνο την + πρώτη φορά που ενεργοποιούνται. Η επιλογή αυτή περιλαμβάνεται στον + κανόνα nmap OS fingerprint στο παράδειγμα που + φαίνεται παρακάτω. Το βοηθητικό πρόγραμμα security/nmap χρησιμοποιείται συχνά + από κακόβουλα άτομα, που προσπαθούν με αυτό τον τρόπο να + αναγνωρίσουν το λειτουργικό σύστημα του μηχανήματος σας. + + Κάθε φορά που υπάρχει καταγραφή από κάποιο κανόνα με την επιλογή + log first, θα πρέπει να εκτελέσετε την εντολή + ipfstat -hio για να δείτε πόσες φορές έχει + ενεργοποιηθεί αυτός ο κανόνας συνολικά. Έτσι θα ξέρετε αν π.χ. σας + κάνουν επίθεση υπερχείλισης (flood). + + Δείτε το αρχείο /etc/services για να βρείτε + αριθμούς θυρών που δεν αναγνωρίζετε. Μπορείτε επίσης να επισκεφθείτε + την τοποθεσία - and do a port number lookup to find what the purpose of that - port number is. + και να κάνετε αναζήτηση για τη συγκεκριμένη θύρα, ώστε να δείτε ποια + υπηρεσία εξυπηρετεί. - Check out this link for port numbers used by Trojans Δείτε την επόμενη τοποθεσία για τις θύρες που χρησιμοποιούνται + συνήθως από κακόβουλα προγράμματα (trojans): . - The following rule set is a complete very secure - 'inclusive' type of firewall rule set that I have used on my - system. You can not go wrong using this rule set for your own. - Just comment out any pass rules for services that you do not - want to authorize. - - If you see messages in your log that you want to stop - seeing just add a block rule in the inbound section. - - You have to change the dc0 - interface name in every rule to the interface name of the Nic - card that connects your system to the public Internet. For - user PPP it would be tun0. - - Add the following statements to + Το παρακάτω σύνολο κανόνων είναι αρκετά πλήρες και πολύ ασφαλές. + Δημιουργεί firewall τύπου inclusive, και έχει + δοκιμαστεί σε πραγματικές συνθήκες λειτουργίας. Μπορεί να + εξυπηρετήσει το ίδιο καλά και το δικό σας σύστημα. Απλώς μετατρέψτε + σε σχόλιο τους κανόνες για τις υπηρεσίες που δεν θέλετε να + ενεργοποιήσετε. + + Για να αποφύγετε την καταγραφή ανεπιθύμητων μηνυμάτων, + απλώς προσθέστε ένα αντίστοιχο κανόνα απόρριψης + (block) στην ενότητα των εισερχομένων + (inbound). + + Θα πρέπει να αλλάξετε το όνομα της διεπαφής + dc0 του παραδείγματος, με το πραγματικό όνομα + της κάρτας δικτύου που συνδέει το σύστημα σας με το Internet. Για + όσους χρησιμοποιούν το PPP χρήστη, το όνομα θα είναι + tun0. + + Προσθέστε τις ακόλουθες καταχωρίσεις στο αρχείο /etc/ipf.rules: ################################################################# # No restrictions on Inside LAN Interface for private network # Not needed unless you have LAN ################################################################# #pass out quick on xl0 all #pass in quick on xl0 all ################################################################# # No restrictions on Loopback Interface ################################################################# pass in quick on lo0 all pass out quick on lo0 all ################################################################# # Interface facing Public Internet (Outbound Section) -# Interrogate session start requests originating from behind the +# Match session start requests originating from behind the # firewall on the private network -# or from this gateway server destine for the public Internet. +# or from this gateway server destined for the public Internet. ################################################################# # Allow out access to my ISP's Domain name server. # xxx must be the IP address of your ISP's DNS. # Dup these lines if your ISP has more than one DNS server # Get the IP addresses from /etc/resolv.conf file pass out quick on dc0 proto tcp from any to xxx port = 53 flags S keep state pass out quick on dc0 proto udp from any to xxx port = 53 keep state # Allow out access to my ISP's DHCP server for cable or DSL networks. # This rule is not needed for 'user ppp' type connection to the # public Internet, so you can delete this whole group. # Use the following rule and check log for IP address. # Then put IP address in commented out rule & delete first rule pass out log quick on dc0 proto udp from any to any port = 67 keep state #pass out quick on dc0 proto udp from any to z.z.z.z port = 67 keep state # Allow out non-secure standard www function pass out quick on dc0 proto tcp from any to any port = 80 flags S keep state # Allow out secure www function https over TLS SSL pass out quick on dc0 proto tcp from any to any port = 443 flags S keep state # Allow out send & get email function pass out quick on dc0 proto tcp from any to any port = 110 flags S keep state pass out quick on dc0 proto tcp from any to any port = 25 flags S keep state # Allow out Time pass out quick on dc0 proto tcp from any to any port = 37 flags S keep state # Allow out nntp news pass out quick on dc0 proto tcp from any to any port = 119 flags S keep state -# Allow out gateway & LAN users non-secure FTP ( both passive & active modes) +# Allow out gateway & LAN users' non-secure FTP ( both passive & active modes) # This function uses the IPNAT built in FTP proxy function coded in # the nat rules file to make this single rule function correctly. # If you want to use the pkg_add command to install application packages # on your gateway system you need this rule. pass out quick on dc0 proto tcp from any to any port = 21 flags S keep state -# Allow out secure FTP, Telnet, and SCP +# Allow out ssh/sftp/scp (telnet/rlogin/FTP replacements) # This function is using SSH (secure shell) pass out quick on dc0 proto tcp from any to any port = 22 flags S keep state -# Allow out non-secure Telnet +# Allow out insecure Telnet pass out quick on dc0 proto tcp from any to any port = 23 flags S keep state -# Allow out FBSD CVSUP function +# Allow out FreeBSD CVSup function pass out quick on dc0 proto tcp from any to any port = 5999 flags S keep state # Allow out ping to public Internet pass out quick on dc0 proto icmp from any to any icmp-type 8 keep state -# Allow out whois for LAN PC to public Internet +# Allow out whois from LAN to public Internet pass out quick on dc0 proto tcp from any to any port = 43 flags S keep state # Block and log only the first occurrence of everything # else that's trying to get out. -# This rule enforces the block all by default logic. +# This rule implements the default block block out log first quick on dc0 all ################################################################# # Interface facing Public Internet (Inbound Section) -# Interrogate packets originating from the public Internet -# destine for this gateway server or the private network. +# Match packets originating from the public Internet +# destined for this gateway server or the private network. ################################################################# # Block all inbound traffic from non-routable or reserved address spaces block in quick on dc0 from 192.168.0.0/16 to any #RFC 1918 private IP block in quick on dc0 from 172.16.0.0/12 to any #RFC 1918 private IP block in quick on dc0 from 10.0.0.0/8 to any #RFC 1918 private IP block in quick on dc0 from 127.0.0.0/8 to any #loopback block in quick on dc0 from 0.0.0.0/8 to any #loopback block in quick on dc0 from 169.254.0.0/16 to any #DHCP auto-config block in quick on dc0 from 192.0.2.0/24 to any #reserved for docs block in quick on dc0 from 204.152.64.0/23 to any #Sun cluster interconnect block in quick on dc0 from 224.0.0.0/3 to any #Class D & E multicast ##### Block a bunch of different nasty things. ############ # That I do not want to see in the log # Block frags block in quick on dc0 all with frags # Block short tcp packets block in quick on dc0 proto tcp all with short # block source routed packets block in quick on dc0 all with opt lsrr block in quick on dc0 all with opt ssrr # Block nmap OS fingerprint attempts # Log first occurrence of these so I can get their IP address block in log first quick on dc0 proto tcp from any to any flags FUP # Block anything with special options block in quick on dc0 all with ipopts # Block public pings block in quick on dc0 proto icmp all icmp-type 8 # Block ident block in quick on dc0 proto tcp from any to any port = 113 # Block all Netbios service. 137=name, 138=datagram, 139=session # Netbios is MS/Windows sharing services. # Block MS/Windows hosts2 name server requests 81 block in log first quick on dc0 proto tcp/udp from any to any port = 137 block in log first quick on dc0 proto tcp/udp from any to any port = 138 block in log first quick on dc0 proto tcp/udp from any to any port = 139 block in log first quick on dc0 proto tcp/udp from any to any port = 81 # Allow traffic in from ISP's DHCP server. This rule must contain # the IP address of your ISP's DHCP server as it's the only # authorized source to send this packet type. Only necessary for # cable or DSL configurations. This rule is not needed for # 'user ppp' type connection to the public Internet. # This is the same IP address you captured and # used in the outbound section. pass in quick on dc0 proto udp from z.z.z.z to any port = 68 keep state # Allow in standard www function because I have apache server pass in quick on dc0 proto tcp from any to any port = 80 flags S keep state # Allow in non-secure Telnet session from public Internet # labeled non-secure because ID/PW passed over public Internet as clear text. # Delete this sample group if you do not have telnet server enabled. #pass in quick on dc0 proto tcp from any to any port = 23 flags S keep state # Allow in secure FTP, Telnet, and SCP from public Internet # This function is using SSH (secure shell) pass in quick on dc0 proto tcp from any to any port = 22 flags S keep state # Block and log only first occurrence of all remaining traffic # coming into the firewall. The logging of only the first -# occurrence stops a .denial of service. attack targeted -# at filling up your log file space. -# This rule enforces the block all by default logic. +# occurrence avoids filling up disk with Denial of Service logs. +# This rule implements the default block. block in log first quick on dc0 all ################### End of rules file ##################################### <acronym>NAT</acronym> - NAT IP masquerading - NAT network address translation - NAT - NAT stands for Network Address - Translation. To those familiar with &linux;, this concept is - called IP Masquerading; NAT and IP - Masquerading are the same thing. One of the many things the - IPF NAT function enables is the ability to - have a private Local Area Network (LAN) behind the firewall - sharing a single ISP assigned IP address on the public - Internet. - - You may ask why would someone want to do this. ISPs - normally assign a dynamic IP address to their non-commercial - users. Dynamic means that the IP address can be different each - time you dial in and log on to your ISP, or for cable and DSL - modem users when you power off and then power on your modems - you can get assigned a different IP address. This IP address - is how you are known to the public Internet. - - Now lets say you have five PCs at home and each one needs - Internet access. You would have to pay your ISP for an - individual Internet account for each PC and have five phone - lines. - - With NAT you only need a single account - with your ISP, then cable your other four PCs to a switch and - the switch to the NIC in your &os; system which is going to - service your LAN as a gateway. NAT will - automatically translate the private LAN IP address for each - separate PC on the LAN to the single public IP address as it - exits the firewall bound for the public Internet. It also does - the reverse translation for returning packets. - - NAT is most often accomplished without - the approval, or knowledge, of your ISP and in most cases is - grounds for your ISP terminating your account if found out. - Commercial users pay a lot more for their Internet connection - and usually get assigned a block of static IP address which - never change. The ISP also expects and consents to their - Commercial customers using NAT for their - internal private LANs. - - There is a special range of IP addresses reserved for - NATed private LAN IP address. According to - RFC 1918, you can use the following IP ranges for private nets - which will never be routed directly to the public + Το NAT είναι ακρωνύμιο των λέξεων + Network Address Translation ή Μετάφραση + Διευθύνσεων Δικτύου. Για όσους είναι εξοικειωμένοι με το &linux;, + βασίζεται στην αρχή του IP Masquerading. Στην πραγματικότητα το + NAT και το IP Masquerading είναι το ίδιο πράγμα. + Μια από τις πολλές δυνατότητες που παρέχει η λειτουργία + NAT του IPF, είναι και η δυνατότητα να έχουμε ένα + ιδιωτικό τοπικό δίκτυο (LAN) πίσω από το firewall το οποίο να + μοιράζεται μια μοναδική δημόσια διεύθυνση IP στο Internet. + + Ίσως να αναρωτηθείτε γιατί να θέλει κάποιος να το κάνει αυτό. + Οι ISPs συνήθως αποδίδουν δυναμικές διευθύνσεις σε μη εταιρικούς + πελάτες. Αυτό ουσιαστικά σημαίνει ότι η διεύθυνση IP που + αποδίδεται στο μηχάνημα σας, μπορεί να είναι διαφορετική κάθε φορά + που κάνετε κλήση για να συνδεθείτε. Για τους χρήστες DSL modem και + router, η αλλαγή διεύθυνσης πραγματοποιείται κάθε φορά που + ενεργοποιείται το modem. Η διεύθυνση IP που σας αποδίδεται από + τον ISP σας, είναι αυτή με την οποία φαίνεστε στο Internet. + + Ας υποθέσουμε τώρα ότι έχετε πέντε PC στο σπίτι σας, και + χρειάζεστε σε όλα σύνδεση Internet. Κανονικά, θα έπρεπε να πληρώσετε + τον ISP σας χωριστό λογαριασμό για κάθε PC και να διαθέτετε πέντε + γραμμές τηλεφώνου. + + Με το NAT, χρειάζεστε μόνο ένα λογαριασμό με + τον ISP σας. Μπορείτε απλώς να συνδέσετε τα τέσσερα PC σε ένα + διανομέα ή switch στο οποίο θα συνδέσετε επίσης και το &os; μηχάνημα + σας. Το μηχάνημα αυτό θα ενεργεί ως πύλη του τοπικού σας δικτύου για + το Internet. Το NAT θα μεταφράσει αυτόματα τις + ιδιωτικές διευθύνσεις IP του κάθε μηχανήματος στην μοναδική δημόσια + IP διεύθυνση που έχετε, καθώς το πακέτο φεύγει από το firewall και + κατευθύνεται προς το Internet. Εκτελεί επίσης και την αντίστροφη + μετάφραση για τα πακέτα που επιστρέφουν. + + Υπάρχει μια ειδική περιοχή διευθύνσεων IP που έχουν παραχωρηθεί + για χρήση σε τοπικά δίκτυα με NAT. Σύμφωνα με το + RFC 1918, μπορείτε να χρησιμοποιήσετε για αυτό το σκοπό τις παρακάτω + περιοχές, οι οποίες δεν δρομολογούνται ποτέ απευθείας στο δημόσιο Internet: - Start IP 10.0.0.0 + Αρχικό IP 10.0.0.0 - - Ending IP 10.255.255.255 + Τελικό IP 10.255.255.255 - Start IP 172.16.0.0 + Αρχικό IP 172.16.0.0 - - Ending IP 172.31.255.255 + Τελικό IP 172.31.255.255 - Start IP 192.168.0.0 + Αρχικό IP 192.168.0.0 - - Ending IP 192.168.255.255 + Τελικό IP 192.168.255.255 IP<acronym>NAT</acronym> NAT - and IPFILTER ipnat - NAT rules are loaded by using the - ipnat command. Typically the - NAT rules are stored in - /etc/ipnat.rules. See &man.ipnat.1; for - details. + Οι κανόνες του NAT φορτώνονται με τη χρήση της + εντολής ipnat. Τυπικά, οι κανόνες του + NAT αποθηκεύονται στο αρχείο + /etc/ipnat.rules. Δείτε τη σελίδα manual του + &man.ipnat.1; για λεπτομέρειες. - When changing the NAT rules after - NAT has been started, make your changes to - the file containing the NAT rules, then run ipnat command with - the flags to delete the internal in use - NAT rules and flush the contents of the - translation table of all active entries. + Για να αλλάξετε τους κανόνες του NAT καθώς αυτό + εκτελείται, τροποποιήστε το αρχείο που τους περιέχει, και εκτελέστε + την εντολή ipnat με την παράμετρο + για να διαγράψετε τους εσωτερικούς κανόνες του + NAT και να αδειάσετε όλες τις ενεργές καταχωρίσεις + του πίνακα μεταφράσεων. - To reload the NAT rules issue a command - like this: + Για να φορτώσετε τους κανόνες του NAT από την + αρχή, εκτελέστε μια εντολή όπως την παρακάτω: &prompt.root; ipnat -CF -f /etc/ipnat.rules - To display some statistics about your - NAT, use this command: + Για να δείτε κάποια στατιστικά σχετικά με το + NAT, χρησιμοποιήστε την παρακάτω εντολή: &prompt.root; ipnat -s - To list the NAT table's current - mappings, use this command: + Για να δείτε μια λίστα με τις τρέχουσες καταχωρίσεις του πίνακα + NAT, χρησιμοποιήστε την παρακάτω εντολή: &prompt.root; ipnat -l - To turn verbose mode on, and display information relating - to rule processing and active rules/table entries: + Για να ενεργοποιήσετε την λεπτομερή απεικόνιση μηνυμάτων και να + δείτε πληροφορίες που σχετίζονται με την επεξεργασία των κανόνων και + τους ενεργούς κανόνες και καταχωρίσεις στον πίνακα, γράψτε: &prompt.root; ipnat -v - IP<acronym>NAT</acronym> Rules + Κανόνες του IP<acronym>NAT</acronym> - NAT rules are very flexible and can - accomplish many different things to fit the needs of commercial - and home users. + Οι κανόνες του NAT είναι αρκετά ευέλικτοι, + και διαθέτουν πλήθος δυνατοτήτων ώστε να καλύπτουν τις ανάγκες + των οικιακών αλλά και των επιχειρησιακών χρηστών. - The rule syntax presented here has been simplified to what - is most commonly used in a non-commercial environment. For a - complete rule syntax description see the &man.ipnat.5; manual - page. + Η σύνταξη των κανόνων που παρουσιάζεται εδώ, έχει απλοποιηθεί + ώστε να συμβαδίζει με τη συνήθη χρήση σε μη-εμπορικά περιβάλλοντα. + Για πιο πλήρη περιγραφή της σύνταξης, δείτε τη σελίδα manual του + &man.ipnat.5;. - The syntax for a NAT rule looks - something like this: + Η σύνταξη ενός κανόνα NAT μοιάζει με την + παρακάτω: map IF LAN_IP_RANGE -> PUBLIC_ADDRESS - The keyword map starts the rule. + Ο κανόνας ξεκινάει με τη λέξη map. - Replace IF with the external - interface. + Αντικαταστήστε το IF με την εξωτερική + διεπαφή (τη κάρτα δικτύου που συνδέεται στο Internet). - The LAN_IP_RANGE is what your - internal clients use for IP Addressing, usually this is - something like Η παράμετρος LAN_IP_RANGE είναι η + περιοχή διευθύνσεων που χρησιμοποιείται από το εσωτερικό σας δίκτυο. + Στην πραγματικότητα θα μοιάζει με κάτι σαν το 192.168.1.0/24. - The PUBLIC_ADDRESS can either - be the external IP address or the special keyword - 0/32, which means to use the IP address - assigned to IF. + Η παράμετρος PUBLIC_ADDRESS μπορεί να + είναι είτε η εξωτερική IP διεύθυνση, είτε η ειδική λέξη + 0/32, η οποία σημαίνει ότι θα χρησιμοποιηθεί η + IP διεύθυνση που έχει αποδοθεί στο + IF. - How <acronym>NAT</acronym> works - - A packet arrives at the firewall from the LAN with a public - destination. It passes through the outbound filter rules, - NAT gets his turn at the packet and applies - its rules top down, first matching rule wins. - NAT tests each of its rules against the - packets interface name and source IP address. When a packets - interface name matches a NAT rule then the - [source IP address, i.e. private LAN IP address] of the packet - is checked to see if it falls within the IP address range - specified to the left of the arrow symbol on the - NAT rule. On a match the packet has its - source IP address rewritten with the public IP address - obtained by the 0/32 keyword. - NAT posts a entry in its internal - NAT table so when the packet returns from - the public Internet it can be mapped back to its original - private IP address and then passed to the filter rules for - processing. + Πως λειτουργεί το <acronym>NAT</acronym> + + Ένα πακέτο φτάνει στο firewall από το LAN με προορισμό το + Internet. Περνάει διαμέσου των κανόνων φιλτραρίσματος εξερχομένων, + όπου γίνεται η επεξεργασία του από το NAT. + Οι κανόνες εφαρμόζονται από τον πρώτο και προς τα κάτω, και κερδίζει + ο πρώτος που ταιριάζει. Ο έλεγχος γίνεται με βάση τη διεπαφή από την + οποία λήφθηκε το πακέτο και τη διεύθυνση IP από την οποία προέρχεται. + Όταν το όνομα της διεπαφής ενός πακέτου ταιριάζει με κάποιο κανόνα του + NAT, η διεύθυνση IP της αφετηρίας (που προέρχεται + από το ιδιωτικό δίκτυο) ελέγχεται για να εξακριβωθεί αν ταιριάζει με + την περιοχή διευθύνσεων που καθορίζεται στην αριστερά πλευρά του + συμβόλου (βέλος) του κανόνα NAT. Αν ταιριάζει, η + διεύθυνση του πακέτου ξαναγράφεται, χρησιμοποιώντας τη δημόσια + διεύθυνση IP η οποία παρέχεται από το 0/32. Το + NAT δημιουργεί μια καταχώριση στον εσωτερικό του + πίνακα, έτσι ώστε όταν επιστρέψει η απάντηση από το Internet, να + μπορεί να αντιστοιχηθεί ξανά στην αρχική ιδιωτική διεύθυνση IP και να + περάσει έπειτα από τους κανόνες του φίλτρου για περαιτέρω + επεξεργασία. - Enabling IP<acronym>NAT</acronym> + Ενεργοποιώντας το IP<acronym>NAT</acronym> - To enable IPNAT add these statements to - /etc/rc.conf. + Για να ενεργοποιήσετε το IPNAT, προσθέστε τις + παρακάτω γραμμές στο /etc/rc.conf. - To enable your machine to route traffic between - interfaces: + Για να επιτρέψετε στο μηχάνημα σας να δρομολογεί πακέτα μεταξύ + διεπαφών δικτύου: gateway_enable="YES" - To start IPNAT automatically each - time: + Για να ξεκινάει αυτόματα το IPNAT σε κάθε + εκκίνηση: ipnat_enable="YES" - To specify where to load the IPNAT rules - from: + Για να καθορίσετε από που επιθυμείτε να φορτώνονται οι κανόνες + του IPNAT: ipnat_rules="/etc/ipnat.rules" - <acronym>NAT</acronym> for a very large LAN + Το <acronym>NAT</acronym> σε Ένα Μεγάλο Τοπικό Δίκτυο - For networks that have large numbers of PC's on the LAN or - networks with more than a single LAN, the process of funneling - all those private IP addresses into a single public IP address - becomes a resource problem that may cause problems with the - same port numbers being used many times across many - NATed LAN PC's, causing collisions. There - are two ways to relieve this resource problem. + Για τοπικά δίκτυα με μεγάλο αριθμό υπολογιστών, ή για δίκτυα που + διασυνδέουν περισσότερα από ένα LAN, η διαδικασία της μετατροπής όλων + αυτών των ιδιωτικών διευθύνσεων σε μια μοναδική δημόσια διεύθυνση, + δημιουργεί πρόβλημα κατανομής πόρων, καθώς χρησιμοποιούνται πολλές + φορές οι ίδιοι αριθμοί θυρών, οδηγώντας τα PC του δικτύου σε + συγκρούσεις. Υπάρχουν δύο τρόποι για να ελαττώσουμε αυτό το + πρόβλημα. - Assigning Ports to Use + Ανάθεση των θυρών που θα Χρησιμοποιηθούν - A normal NAT rule would look like: + Ένα συνηθισμένος κανόνας NAT μοιάζει με τον παρακάτω: map dc0 192.168.1.0/24 -> 0/32 - In the above rule the packet's source port is unchanged - as the packet passes through IPNAT. By - adding the portmap keyword you can tell - IPNAT to only use source ports in a range. - For example the following rule will tell - IPNAT to modify the source port to be - within that range: + Στον παραπάνω κανόνα, η θύρα αφετηρίας του πακέτου παραμένει + αναλλοίωτη καθώς το πακέτο διέρχεται μέσω του + IPNAT. Αν προσθέσετε την λέξη-κλειδί + portmap, μπορείτε να ρυθμίσετε το + IPNAT να χρησιμοποιεί θύρες που ανήκουν σε μια + καθορισμένη περιοχή. Για παράδειγμα, ο παρακάτω κανόνας θα + οδηγήσει το NAT να τροποποιήσει την θύρα της + αφετηρίας, ώστε να είναι μέσα στην περιοχή που φαίνεται: map dc0 192.168.1.0/24 -> 0/32 portmap tcp/udp 20000:60000 - Additionally we can make things even easier by using the - auto keyword to tell - IPNAT to determine by itself which ports - are available to use: + Μπορούμε επίσης να απλοποιήσουμε ακόμα περισσότερο τη + διαδικασία χρησιμοποιώντας τη λέξη auto ώστε το + IPNAT να καθορίζει από μόνο του ποιες θύρες είναι + διαθέσιμες για χρήση: map dc0 192.168.1.0/24 -> 0/32 portmap tcp/udp auto - Using a pool of public addresses + Χρησιμοποιώντας ένα Απόθεμα Δυναμικών Διευθύνσεων - In very large LANs there comes a point where there are just too - many LAN addresses to fit into a single public address. If a block - of public IP addresses is available, you can use these addresses as - a pool, and let IPNAT pick one of - the public IP addresses as packet-addresses are mapped on their way - out. + Σε ένα πολύ μεγάλο τοπικό δίκτυο, αργά ή γρήγορα φτάνουμε στο + σημείο που μια μοναδική δημόσια διεύθυνση δεν επαρκεί για να καλύψει + τόσες πολλές ιδιωτικές. Αν υπάρχει διαθέσιμο ένα εύρος δημοσίων + διευθύνσεων, μπορούν να χρησιμοποιηθούν ως + απόθεμα (pool), επιτρέποντας στην + IPNAT να επιλέξει μια από αυτές καθώς αντιστοιχεί + τα πακέτα κατά την έξοδο τους προς το δημόσιο δίκτυο. - For example, instead of mapping all packets through a single - public IP address, as in: + Για παράδειγμα, αντί να αντιστοιχούν όλα τα πακέτα μέσω μιας + μοναδικής δημόσιας IP διεύθυνσης όπως παρακάτω: map dc0 192.168.1.0/24 -> 204.134.75.1 - A range of public IP addresses can be specified either with a - netmask: + μπορούμε να χρησιμοποιήσουμε ένα εύρος IP διευθύνσεων, είτε με + τη χρήση μάσκας δικτύου: map dc0 192.168.1.0/24 -> 204.134.75.0/255.255.255.0 - or using CIDR notation: + είτε με συμβολισμό CIDR: map dc0 192.168.1.0/24 -> 204.134.75.0/24 - Port Redirection - - A very common practice is to have a web server, email - server, database server and DNS server each segregated to a - different PC on the LAN. In this case the traffic from these - servers still have to be NATed, but there - has to be some way to direct the inbound traffic to the - correct LAN PCs. IPNAT has the redirection - facilities of NAT to solve this problem. - Lets say you have your web server on LAN address 10.0.10.25 and your single public IP - address is 20.20.20.5 you would - code the rule like this: + Ανακατεύθυνση Θυρών + + Είναι κοινή πρακτική να εγκαθίστανται υπηρεσίες όπως ο + εξυπηρετητής ιστοσελίδων, ταχυδρομείου, βάσης δεδομένων και DNS σε + διαφορετικά PC στο τοπικό δίκτυο. Στην περίπτωση αυτή, η κίνηση + πακέτων από αυτά τα μηχανήματα εξακολουθεί να χρειάζεται το + NAT, αλλά χρειάζεται επίσης να υπάρχει κάποιος + τρόπος να κατευθύνεται η εισερχόμενη κίνηση στα σωστά PC του δικτύου. + Το IPNAT έχει τις κατάλληλες δυνατότητες για την + επίλυση αυτού του προβλήματος. Για παράδειγμα, έστω ότι ένας + εξυπηρετητής ιστοσελίδων βρίσκεται στην διεύθυνση LAN 10.0.10.25 και η μοναδική δημόσια IP + είναι 20.20.20.5. Ο κανόνας που θα + γράφατε θα έμοιαζε με τον παρακάτω: rdr dc0 20.20.20.5/32 port 80 -> 10.0.10.25 port 80 - or: + ή: rdr dc0 0.0.0.0/0 port 80 -> 10.0.10.25 port 80 - or for a LAN DNS Server on LAN address of 10.0.10.33 that needs to receive - public DNS requests: + ή για ένα εξυπηρετητή DNS με διεύθυνση στο τοπικό δίκτυο 10.0.10.33 ο οποίος πρέπει να δέχεται + αναζητήσεις από το δημόσιο δίκτυο: rdr dc0 20.20.20.5/32 port 53 -> 10.0.10.33 port 53 udp - FTP and <acronym>NAT</acronym> - - FTP is a dinosaur left over from the time before the - Internet as it is known today, when research universities were - leased lined together and FTP was used to share files among - research Scientists. This was a time when data security was - not a consideration. Over the years the FTP protocol became - buried into the backbone of the emerging Internet and its - username and password being sent in clear text was never - changed to address new security concerns. FTP has two flavors, - it can run in active mode or passive mode. The difference is - in how the data channel is acquired. Passive mode is more - secure as the data channel is acquired be the ordinal ftp - session requester. For a real good explanation of FTP and the - different modes see FTP και NAT + + Το FTP είναι ένας δεινόσαυρος που έχει απομείνει από την εποχή + που το Internet ήταν στα αρχικά του στάδια, όπου τα ερευνητικά + εργαστήρια των πανεπιστήμιων ήταν συνδεμένα μεταξύ τους με + μισθωμένες γραμμές και οι ερευνητές το χρησιμοποιούσαν για να + στέλνουν αρχεία ο ένας στον άλλο. Την εποχή εκείνη, δεν υπήρχαν + ανησυχίες σχετικά με την ασφάλεια. Με το πέρασμα του χρόνου, το + FTP θάφτηκε στο πίσω μέρος του ταχέως εξελισσόμενου Internet. Δεν + εξελίχθηκε ποτέ ώστε να ξεπεράσει προβλήματα ασφάλειας, όπως π.χ. το + γεγονός ότι στέλνει το όνομα και τον κωδικό του χρήστη ως απλό + κείμενο. Το FTP έχει δυο καταστάσεις λειτουργίας, την ενεργή και την + παθητική. Η διαφορά είναι στο πως γίνεται η ανάκτηση του καναλιού + δεδομένων. Η παθητική λειτουργία είναι πιο ασφαλής, καθώς το + κανάλι δεδομένων αποτελεί το κύριο κανάλι της συνεδρίας. Μπορείτε να + βρείτε πολύ καλή περιγραφή του πρωτοκόλλου και των διαφορετικών τρόπων + λειτουργίας του, στο . - IP<acronym>NAT</acronym> Rules - - IPNAT has a special built in FTP proxy - option which can be specified on the NAT - map rule. It can monitor all outbound packet traffic for FTP - active or passive start session requests and dynamically - create temporary filter rules containing only the port number - really in use for the data channel. This eliminates the - security risk FTP normally exposes the firewall to from - having large ranges of high order port numbers open. - - This rule will handle all the traffic for the internal - LAN: + Κανόνες του IP<acronym>NAT</acronym> + + Το IPNAT διαθέτει μια ειδική επιλογή για + διαμεσολάβηση FTP (proxy) η οποία μπορεί να καθοριστεί στον + κατάλληλο κανόνα του NAT. Μπορεί να + παρακολουθήσει όλα τα εξερχόμενα πακέτα για να ανιχνεύσει την + έναρξη μιας ενεργής ή παθητικής συνεδρίας FTP, και να δημιουργήσει + δυναμικά προσωρινούς κανόνες στο φίλτρο που να περιέχουν μόνο τον + αριθμό της θύρας που χρησιμοποιείται από το κανάλι δεδομένων. Αυτό + εξαλείφει το πρόβλημα ασφάλειας που δημιουργείται από το γεγονός + ότι διαφορετικά θα χρειαζόταν να ανοιχθεί μια μεγάλη περιοχή θυρών + (στην υψηλή περιοχή) στο firewall. + + Ο παρακάτω κανόνας χειρίζεται όλα τα δεδομένα για το εσωτερικό + δίκτυο (LAN): map dc0 10.0.10.0/29 -> 0/32 proxy port 21 ftp/tcp - This rule handles the FTP traffic from the - gateway: + Ο παρακάτω κανόνας χειρίζεται την κίνηση FTP από την + πύλη (gateway): map dc0 0.0.0.0/0 -> 0/32 proxy port 21 ftp/tcp - This rule handles all non-FTP traffic from the internal - LAN: + Ο παρακάτω κανόνας χειρίζεται όλη την κίνηση από το εσωτερικό + LAN που δεν ανήκει στο πρωτόκολλο FTP: map dc0 10.0.10.0/29 -> 0/32 - The FTP map rule goes before our regular map rule. All - packets are tested against the first rule from the top. - Matches on interface name, then private LAN source IP - address, and then is it a FTP packet. If all that matches - then the special FTP proxy creates temp filter rules to let - the FTP session packets pass in and out, in addition to also - NATing the FTP packets. All LAN packets - that are not FTP do not match the first rule and fall - through to the third rule and are tested, matching on - interface and source IP, then are - NATed. + Ο κανόνας χαρτογράφησης του FTP τοποθετείται πριν από τον + κανονικό κανόνα χαρτογράφησης. Κάθε πακέτο ελέγχεται αρχικά από + τον κανόνα που βρίσκεται στην κορυφή. Αν ταιριάζει στη διεπαφή και + στην ιδιωτική διεύθυνση IP και πρόκειται για πακέτο FTP, + ο διαμεσολαβητής FTP δημιουργεί προσωρινούς κανόνες στο φίλτρο + οι οποίοι επιτρέπουν την εισερχόμενη και εξερχόμενη κίνηση FTP ενώ + ταυτόχρονα εκτελούν και την απαραίτητη μετάφραση + NAT. Όλα τα πακέτα που δεν ανήκουν σε μετάδοση + FTP δεν ταιριάζουν με τον πρώτο κανόνα, έτσι κατευθύνονται στον + τρίτο κανόνα, εξετάζονται όσο αφορά τη διεπαφή και το IP από το + οποίο προέρχονται, και γίνεται η αντίστοιχη μετάφραση τους από το + NAT. - IP<acronym>NAT</acronym> FTP Filter Rules + Κανόνες Φίλτρου για το IP<acronym>NAT</acronym> - Only one filter rule is needed for FTP if the - NAT FTP proxy is used. + Όταν χρησιμοποιείται ο μεσολαβητής FTP, χρειάζεται μόνο ένας + κανόνας για το NAT. - Without the FTP Proxy you will need the following three - rules: + Χωρίς το μεσολαβητή FTP, χρειάζονται οι παρακάτω τρεις + κανόνες: # Allow out LAN PC client FTP to public Internet # Active and passive modes pass out quick on rl0 proto tcp from any to any port = 21 flags S keep state # Allow out passive mode data channel high order port numbers pass out quick on rl0 proto tcp from any to any port > 1024 flags S keep state # Active mode let data channel in from FTP server pass in quick on rl0 proto tcp from any to any port = 20 flags S keep state - - - FTP <acronym>NAT</acronym> Proxy Bug - - As of IPFILTER version 3.4.31 - the FTP proxy works as documented during the FTP session - until the session is told to close. When the close happens - packets returning from the remote FTP server are blocked and - logged coming in on port 21. The NAT - FTP/proxy appears to remove its temp rules prematurely, - before receiving the response from the remote FTP server - acknowledging the close. A problem report was posted to the - IPF mailing list. - - The solution is to add a filter rule to get rid of these - unwanted log messages or do nothing and ignore FTP inbound - error messages in your log. Most people do not use outbound - FTP too often. - - block in quick on rl0 proto tcp from any to any port = 21 - IPFW firewall - IPFW - - This section is work in progress. The contents might - not be accurate at all times. - - - The IPFIREWALL (IPFW) is a &os; sponsored firewall software - application authored and maintained by &os; volunteer staff - members. It uses the legacy stateless rules and a legacy rule - coding technique to achieve what is referred to as Simple - Stateful logic. - - The IPFW sample rule set (found in - /etc/rc.firewall) in the standard &os; - install is rather simple and it is not expected that it used - directly without modifications. The example does not use - stateful filtering, which is beneficial in most setups, so it - will not be used as base for this section. - - The IPFW stateless rule syntax is empowered with technically - sophisticated selection capabilities which far surpasses the - knowledge level of the customary firewall installer. IPFW is - targeted at the professional user or the advanced technical - computer hobbyist who have advanced packet selection - requirements. A high degree of detailed knowledge into how - different protocols use and create their unique packet header - information is necessary before the power of the IPFW rules can - be unleashed. Providing that level of explanation is out of the - scope of this section of the handbook. - - IPFW is composed of seven components, the primary component - is the kernel firewall filter rule processor and its integrated - packet accounting facility, the logging facility, the 'divert' - rule which triggers the NAT facility, and the - advanced special purpose facilities, the dummynet traffic shaper - facilities, the 'fwd rule' forward facility, the bridge - facility, and the ipstealth facility. + Το IPFIREWALL (IPFW) είναι λογισμικό που + αναπτύχθηκε για το &os;. Έχει γραφεί και συντηρείται από εθελοντές που + ανήκουν στο Project. Χρησιμοποιεί τους κλασικούς κανόνες χωρίς + διατήρηση της κατάστασης (stateless) καθώς και μια τεχνική + κωδικοποίησης που επιτυγχάνει αυτό που αναφέρεται ως Απλή Stateful + Λογική (Simple Stateful Logic). + + Το υπόδειγμα κανόνων για το IPFW (στα αρχεία + /etc/rc.firewall και + /etc/rc.firewall6) της τυπικής εγκατάστασης του + &os; είναι μάλλον απλό και θα χρειαστεί να κάνετε κάποιες αλλαγές + πριν το χρησιμοποιήσετε. Το παράδειγμα δεν χρησιμοποιεί φιλτράρισμα + τύπου stateful. Η stateful λειτουργία είναι ευεργετική στις + περισσότερες περιπτώσεις, έτσι δεν θα χρησιμοποιήσουμε αυτό το + παράδειγμα ως βάση αυτής της ενότητας. + + Η σύνταξη των κανόνων stateless του IPFW έχει ενισχυθεί με + εξελιγμένες δυνατότητες επιλογής οι οποίες συνήθως ξεπερνάνε κατά πολύ + τις τυπικές γνώσεις του ατόμου που καλείται να το ρυθμίσει. Το IPFW + απευθύνεται στον επαγγελματία χρήστη ή τον τεχνικά προχωρημένο χομπίστα, + ο οποίος έχει ανάγκη προχωρημένου φιλτραρίσματος πακέτων. Η πραγματική + δύναμη των κανόνων του IPFW αποκαλύπτεται μόνο αν διαθέτετε προχωρημένες + γνώσεις σχετικά με το πως διαφορετικά πρωτόκολλα δημιουργούν και + χρησιμοποιούν την επικεφαλίδα των πακέτων τους. Τέτοιο επίπεδο + επεξηγήσεων είναι πέρα από το σκοπό αυτής της ενότητας του + Εγχειριδίου. + + Το IPFW αποτελείται από επτά εξαρτήματα. Το βασικό εξάρτημα είναι + ο επεξεργαστής κανόνων του firewall στον πυρήνα, με ενσωματωμένη τη + δυνατότητα καταγραφής. Τα υπόλοιπα εξαρτήματα είναι το σύστημα + καταγραφής (logging), ο κανόνας divert ο οποίος + ενεργοποιεί τη λειτουργία NAT, καθώς και οι + προχωρημένες δυνατότητες ειδικού σκοπού: το σύστημα διαμόρφωσης κίνησης + (traffic shaper) dummynet, η δυνατότητα προώθησης μέσω του + fwd rule, η δυνατότητα γεφύρωσης (bridge) καθώς και + η δυνατότητα απόκρυψης (ipstealth). To IPFW υποστηρίζει τόσο το + πρωτόκολλο IPv4 όσο και το IPv6. - Enabling IPFW + Ενεργοποιώντας το IPFW IPFW - enabling - IPFW is included in the basic &os; install as a separate - run time loadable module. The system will dynamically load the - kernel module when the rc.conf statement - firewall_enable="YES" is used. You do not - need to compile IPFW into the &os; kernel unless you want - NAT function enabled. + Το IPFW περιλαμβάνεται στην βασική εγκατάσταση του &os; ως άρθρωμα + του πυρήνα το οποίο μπορεί να φορτωθεί δυναμικά. Το σύστημα θα + φορτώσει δυναμικά το άρθρωμα όταν βρει την καταχώριση + firewall_enable="YES" στο αρχείο + /etc/rc.conf. Δεν χρειάζεται να μεταγλωττίσετε + το IPFW μέσα στον πυρήνα, εκτός αν θέλετε να χρησιμοποιήσετε τις + λειτουργίες NAT που παρέχει. - After rebooting your system with - firewall_enable="YES" in - rc.conf the following white highlighted - message is displayed on the screen as part of the boot - process: + Αφού επανεκκινήσετε το σύστημα σας με την καταχώριση + firewall_enable="YES" στο + rc.conf, θα δείτε με άσπρα έντονα γράμματα το + ακόλουθο μήνυμα κατά τη διαδικασία της εκκίνησης: ipfw2 initialized, divert disabled, rule-based forwarding disabled, default to deny, logging disabled - The loadable module does have logging ability - compiled in. To enable logging and set the verbose logging - limit, there is a knob you can set in - /etc/sysctl.conf by adding these - statements, logging will be enabled on future reboots: + Το άρθρωμα έχει ενσωματωμένη τη δυνατότητα καταγραφής. Για να + ενεργοποιήσετε την καταγραφή και να θέσετε το επίπεδο λεπτομέρειας, + υπάρχουν κάποιες ρυθμίσεις που μπορείτε να θέσετε στο + /etc/sysctl.conf. Προσθέτοντας τις παρακάτω + καταχωρίσεις, θα ενεργοποιηθεί η καταγραφή στις επόμενες + εκκινήσεις: net.inet.ip.fw.verbose=1 net.inet.ip.fw.verbose_limit=5 - Kernel Options + Επιλογές του Πυρήνα kernel options - IPFIREWALL kernel options - IPFIREWALL_VERBOSE kernel options - IPFIREWALL_VERBOSE_LIMIT IPFW - kernel options - It is not a mandatory requirement that you enable IPFW by - compiling the following options into the &os; kernel unless - you need NAT function. It is presented here - as background information. + Δεν είναι υποχρεωτικό να ενεργοποιήσετε το IPFW μεταγλωττίζοντας + τις παρακάτω επιλογές στον πυρήνα του &os;, εκτός και αν θέλετε να + χρησιμοποιήσετε NAT. Ο σκοπός αυτής της + παρουσίασης είναι καθαρά ενημερωτικός. options IPFIREWALL - This option enables IPFW as part of the kernel + Η επιλογή αυτή ενεργοποιεί το IPFW ως μέρος του πυρήνα. options IPFIREWALL_VERBOSE - Enables logging of packets that pass through IPFW and have - the 'log' keyword specified in the rule set. + Ενεργοποιεί την καταγραφή των πακέτων που περνούν μέσω του IPFW + και περιλαμβάνουν τη λέξη log στον κανόνα + τους. options IPFIREWALL_VERBOSE_LIMIT=5 - Limits the number of packets logged through &man.syslogd.8; - on a per entry basis. You may wish to use this option in - hostile environments which you want to log firewall activity. - This will close a possible denial of service attack via syslog - flooding. + Περιορίζει τον πλήθος των πακέτων που καταγράφονται μέσω του + &man.syslogd.8; σε συγκεκριμένο αριθμό ανά καταχώριση. Η ρύθμιση + είναι χρήσιμη σε εχθρικά περιβάλλοντα στα οποία είναι επιθυμητή + η καταγραφή. Με αυτό τον τρόπο μπορεί να αποφευχθεί μια πιθανή + επίθεση με στόχο την υπερχείλιση των αρχείων καταγραφής. kernel options - IPFIREWALL_DEFAULT_TO_ACCEPT options IPFIREWALL_DEFAULT_TO_ACCEPT - This option will allow everything to pass through the - firewall by default, which is a good idea when you are first - setting up your firewall. - - options IPV6FIREWALL -options IPV6FIREWALL_VERBOSE -options IPV6FIREWALL_VERBOSE_LIMIT -options IPV6FIREWALL_DEFAULT_TO_ACCEPT - - These options are exactly the same as the IPv4 options but - they are for IPv6. If you do not use IPv6 you might want to - use IPV6FIREWALL without any rules to block all IPv6 + Η επιλογή αυτή αφήνει τα πάντα να περνάνε μέσα από το firewall, + το οποίο είναι καλή ιδέα την πρώτη φορά που ρυθμίζετε το firewall + σας. kernel options - IPDIVERT options IPDIVERT - This enables the use of NAT - functionality. + Η επιλογή αυτή ενεργοποιεί τη λειτουργία + NAT. - If you do not include IPFIREWALL_DEFAULT_TO_ACCEPT or set - your rules to allow incoming packets you will block all - packets going to and from this machine. + Το firewall θα απορρίπτει όλα τα πακέτα που κατευθύνονται από + και προς το μηχάνημα, αν δεν περιλάβετε την επιλογή + IPFIREWALL_DEFAULT_TO_ACCEPT ή αν δεν ρυθμίσετε + ένα κατάλληλο κανόνα που να επιτρέπει αυτές τις συνδέσεις. - <filename>/etc/rc.conf</filename> Options + Επιλογές στο <filename>/etc/rc.conf</filename> - Enable the firewall: + Ενεργοποιήστε το firewall: firewall_enable="YES" - To select one of the default firewall types provided by - &os;, select one by reading the - /etc/rc.firewall file and place it in - the following: + Για να επιλέξετε ένα από τους προεπιλεγμένους τύπους firewall που + υποστηρίζονται από το &os;, διαβάστε το αρχείο + /etc/rc.firewall και δημιουργήστε μια εγγραφή + όπως την παρακάτω: firewall_type="open" - Available values for this setting are: + Οι διαθέσιμες τιμές για αυτή τη ρύθμιση είναι: - open — pass all traffic. + open — επιτρέπει τη διέλευση όλης + της κίνησης. + - client — will protect only this - machine. + client — προστατεύει μόνο το + συγκεκριμένο μηχάνημα. + - simple — protect the whole - network. + simple — προστατεύει ολόκληρο το + δίκτυο. + - closed — entirely disables IP - traffic except for the loopback interface. + closed — απενεργοποιεί εντελώς την + κίνηση πακέτων, εκτός από την εσωτερική διεπαφή (loopback). + - UNKNOWN — disables the loading - of firewall rules. + UNKNOWN — απενεργοποιεί την φόρτωση + κανόνων του firewall. + - filename — absolute path of - file containing firewall rules. + filename + — το πλήρες μονοπάτι του αρχείου που περιέχει τους κανόνες + του firewall. - It is possible to use two different ways to load custom - rules for ipfw firewall. One is - by setting firewall_type variable to absolute - path of file, which contains firewall rules - without any command-line options for &man.ipfw.8; itself. A - simple examble of ruleset file can be following: + Μπορείτε να χρησιμοποιήσετε δύο διαφορετικούς τρόπους για να + φορτώσετε προσαρμοσμένους κανόνες στο + ipfw firewall. Ο ένας είναι θέτοντας τη + μεταβλητή firewall_type στην απόλυτη διαδρομή του + αρχείου που περιέχει τους κανόνες του firewall, + χωρίς να δώσετε ορίσματα στην γραμμή εντολών για το ίδιο το + &man.ipfw.8;. Ένα απλό παράδειγμα τέτοιου αρχείου κανόνων μπορεί + να είναι το παρακάτω: - add block in all + add block in all add block out all - On the other hand, it is possible to set - firewall_script variable to absolute path of - executable script that includes ipfw commands - being executed at system boot time. A valid ruleset script that - would be equivalent to the ruleset file shown above would - be following: + Από την άλλη μεριά, είναι επίσης δυνατό να θέσετε τη μεταβλητή + firewall_script στην απόλυτη διαδρομή ενός + εκτελέσιμου script που περιλαμβάνει μια σειρά από εντολές + ipfw που θα εκτελεστούν κατά την εκκίνηση. + Ένα έγκυρο τέτοιο script το οποίο είναι αντίστοιχο με το αρχείο + κανόνων που δείξαμε παραπάνω, είναι το ακόλουθο: - #!/bin/sh + #!/bin/sh ipfw -q flush ipfw add block in all ipfw add block out all - If firewall_type is set to either - client or simple, the - default rules found in /etc/rc.firewall - should be reviewed to fit to the configuration of the given - machine. Also note that the examples used in this chapter - expect that the firewall_script is set to - /etc/ipfw.rules. + Αν θέσετε την τιμή του firewall_type είτε + σε client είτε σε simple, + θα πρέπει να ελέγξετε ότι οι προεπιλεγμένοι κανόνες που περιέχονται + στο /etc/rc.firewall ταιριάζουν με τις + ρυθμίσεις του συγκεκριμένου μηχανήματος. Παρατηρήστε επίσης ότι τα + παραδείγματα που χρησιμοποιούνται σε αυτό το κεφάλαιο αναμένουν να + να έχετε θέσει τη μεταβλητή firewall_script στην + τιμή /etc/ipfw.rules. - Enable logging: + Ενεργοποιήστε την καταγραφή: firewall_logging="YES" - The only thing that the - firewall_logging variable will do is - setting the net.inet.ip.fw.verbose sysctl - variable to the value of 1 (see ). There is no - rc.conf variable to set log limitations, - but it can be set via sysctl variable, manually or from the - /etc/sysctl.conf file: + Το μόνο πράγμα που κάνει η μεταβλητή + firewall_logging είναι να θέσει την τιμή + της μεταβλητής sysctl net.inet.ip.fw.verbose στην + τιμή 1 (δείτε το ). Δεν υπάρχει μεταβλητή του + rc.conf που να ορίζει περιορισμούς στην + καταγραφή, αλλά αυτό μπορεί να ρυθμιστεί μέσω της παραπάνω + μεταβλητής sysctl είτε χειροκίνητα, είτε μέσω του αρχείου + /etc/sysctl.conf: net.inet.ip.fw.verbose_limit=5 - If your machine is acting as a gateway, i.e. providing - Network Address Translation (NAT) via &man.natd.8;, please - refer to for information - regarding the required /etc/rc.conf - options. + Αν το μηχάνημα σας λειτουργεί ως πύλη (gateway), δηλαδή παρέχει + υπηρεσία μετάφρασης διευθύνσεων δικτύου (Network Address + Translation, NAT) μέσω του &man.natd.8;, παρακαλούμε να διαβάσετε το + για πληροφορίες σχετικά με τις + ρυθμίσεις που απαιτούνται στο αρχείο + /etc/rc.conf. - The IPFW Command + Η Εντολή IPFW ipfw - The ipfw command is the normal vehicle for making manual - single rule additions or deletions to the firewall active - internal rules while it is running. The problem with using - this method is once your system is shutdown or halted all the - rules you added or changed or deleted are lost. Writing all - your rules in a file and using that file to load the rules at - boot time, or to replace in mass the currently running firewall - rules with changes you made to the files content is the - recommended method used here. - - The ipfw command is still a very useful to display the - running firewall rules to the console screen. The IPFW - accounting facility dynamically creates a counter for each - rule that counts each packet that matches the rule. During the - process of testing a rule, listing the rule with its counter - is the one of the ways of determining if the rule is - functioning. - - To list all the rules in sequence: + Η εντολή ipfw είναι ο συνήθης τρόπος για την + προσθήκη η διαγραφή κανόνων στους εσωτερικούς ενεργούς κανόνες του + firewall, καθώς αυτό εκτελείται. Το πρόβλημα με τη χρήση αυτής της + μεθόδου είναι ότι οι αλλαγές χάνονται με τον τερματισμό λειτουργίας + του μηχανήματος. Μπορείτε να γράψετε όλους τους κανόνες σας σε ένα + αρχείο και να το χρησιμοποιείτε για να τους φορτώνετε στην εκκίνηση. + Μπορείτε να χρησιμοποιήσετε το ίδιο αρχείο για να αντικαταστήσετε + τους τρέχοντες κανόνες του firewall, την ώρα που αυτό εκτελείται. + Αυτός είναι και ο συνιστώμενος τρόπος που χρησιμοποιούμε στα + παραδείγματα μας. + + Η εντολή ipfw είναι επίσης χρήσιμη για να + απεικονίζει τους τρέχοντες κανόνες στη κονσόλα σας. Το σύστημα + καταγραφής χρήσης της IPFW δημιουργεί αυτόματα ένα μετρητή για κάθε + κανόνα, ο οποίος μετράει πόσα πακέτα ταίριαξαν με αυτόν. Κατά τη + διάρκεια των δοκιμών, η δυνατότητα να ελέγξετε την τιμή του μετρητή + είναι ένας τρόπος για να διαπιστώσετε αν ο κανόνας λειτουργεί + κανονικά. + + Για να δείτε όλους τους κανόνες με τη σειρά: &prompt.root; ipfw list - To list all the rules with a time stamp of when the last - time the rule was matched: + Για να δείτε μια λίστα όλων των κανόνων, μαζί με την ώρα που + ενεργοποιήθηκε τελευταία φορά ο κάθε κανόνας, γράψτε: &prompt.root; ipfw -t list - To list the accounting information, packet count for - matched rules along with the rules themselves. The first - column is the rule number, followed by the number of outgoing - matched packets, followed by the number of incoming matched - packets, and then the rule itself. + Το επόμενο παράδειγμα δείχνει τον αριθμό των πακέτων που ταίριαξαν + μαζί με τον αντίστοιχο κανόνα. Η πρώτη στήλη δείχνει τον αριθμό του + κανόνα, ακολουθείται από τον αριθμό πακέτων που ταίριαξαν (πρώτα τα + εξερχόμενα και μετά τα εισερχόμενα) και τέλος από τον ίδιο τον + κανόνα. &prompt.root; ipfw -a list - List the dynamic rules in addition to the static - rules: + Για να δείτε μια λίστα που να περιλαμβάνει τόσο τους δυναμικούς + όσο και τους στατικούς κανόνες: &prompt.root; ipfw -d list - Also show the expired dynamic rules: + Για να δείτε και τους δυναμικούς κανόνες που έχουν λήξει: &prompt.root; ipfw -d -e list - Zero the counters: + Για να μηδενίσετε τους μετρητές: &prompt.root; ipfw zero - Zero the counters for just rule + Για να μηδενίσετε τους μετρητές μόνο για τον κανόνα με τον αριθμό NUM: - &prompt.root; ipfw zero NUM + &prompt.root; ipfw zero NUM - IPFW Rule Sets - - - - A rule set is a group of ipfw rules coded to allow or deny - packets based on the values contained in the packet. The - bi-directional exchange of packets between hosts comprises a - session conversation. The firewall rule set processes the - packet twice: once on its arrival from the public Internet host - and again as it leaves for its return trip back to the public - Internet host. Each tcp/ip service (i.e. telnet, www, mail, - etc.) is predefined by its protocol, and port number. This is - the basic selection criteria used to create rules which will - allow or deny services. + Το Σύνολο Κανόνων του IPFW + + + + Ως σύνολο κανόνων στο IPFW, ορίζουμε μια ομάδα + κανόνων που έχουν γραφεί για να επιτρέπουν ή να απορρίπτουν πακέτα + ανάλογα με τις τιμές που περιέχονται σε αυτά. Η διπλής κατεύθυνσης + ανταλλαγή πακέτων μεταξύ υπολογιστών αποτελεί μια συνεδρία. + Το σύνολο κανόνων του firewall επεξεργάζεται τόσο τα πακέτα που + έρχονται από το Internet, όσο και τα πακέτα που παράγονται από το + σύστημα ως απάντηση σε αυτά. Κάθε υπηρεσία TCP/IP + (π.χ. telnet, www, mail, κ.λ.π.) καθορίζεται από το πρωτόκολλο και + την προνομιακή (privileged) θύρα που χρησιμοποιεί για να δέχεται + αιτήματα εξυπηρέτησης. Τα πακέτα που προορίζονται για μια + συγκεκριμένη υπηρεσία, ξεκινούν από τη διεύθυνση αφετηρίας + χρησιμοποιώντας μια μη-προνομιακή θύρα και καταλήγουν στη + συγκεκριμένη θύρα υπηρεσίας στον προορισμό. Όλες οι παραπάνω + παράμετροι (θύρες και διευθύνσεις) μπορούν να χρησιμοποιηθούν ως + κριτήρια επιλογής για την δημιουργία κανόνων που επιτρέπουν + ή εμποδίζουν την πρόσβαση σε υπηρεσίες. IPFW - rule processing order - When a packet enters the firewall it is compared against - the first rule in the rule set and progress one rule at a time - moving from top to bottom of the set in ascending rule number - sequence order. When the packet matches a rule selection - parameters, the rules action field value is executed and the - search of the rule set terminates for that packet. This is - referred to as the first match wins search - method. If the packet does not match any of the rules, it gets - caught by the mandatory ipfw default rule, number 65535 which - denies all packets and discards them without any reply back to - the originating destination. + Όταν ένα πακέτο εισέρχεται στο firewall, συγκρίνεται με βάση τον + πρώτο κανόνα. Η σύγκριση συνεχίζεται διαδοχικά με τους υπόλοιπους + κανόνες, από τον πρώτο προς τον τελευταίο, με βάση τον αύξοντα αριθμό + τους. Όταν το πακέτο ταιριάξει με τις παραμέτρους επιλογής κάποιου + κανόνα, εκτελείται η οδηγία που αναφέρεται στο πεδίο ενεργειών του + κανόνα αυτού και η αναζήτηση κανόνων για το συγκεκριμένο πακέτο + τερματίζεται. Σε αυτή τη μέθοδο αναζήτησης, + ο πρώτος κανόνας που ταιριάζει, είναι ο νικητής. Αν + το πακέτο δεν ταιριάζει με κανένα από τους κανόνες, θα ληφθεί από τον + υποχρεωτικό προεπιλεγμένο κανόνα του IPFW, με αριθμό 65535, ο οποίος + εμποδίζει τη διέλευση όλων των πακέτων, και τα απορρίπτει χωρίς να + στείλει καμιά απάντηση στον αρχικό αποστολέα τους. - The search continues after count, - skipto and tee - rules. + Η αναζήτηση συνεχίζεται μετά από κανόνες τύπου + count, skipto και + tee. - The instructions contained here are based on using rules - that contain the stateful 'keep state', 'limit', 'in'/'out', - and via options. This is the basic framework for coding an - inclusive type firewall rule set. - - - - An inclusive firewall only allows services matching the - rules through. This way you can control what services can - originate behind the firewall destine for the public Internet - and also control the services which can originate from the - public Internet accessing your private network. Everything - else is denied by default design. Inclusive firewalls are - much, much more secure than exclusive firewall rule sets and - is the only rule set type covered here in. + Οι οδηγίες που φαίνονται εδώ, βασίζονται στη χρήση κανόνων που + περιέχουν τις οδηγίες keep state, + limit, in, + out και via. Αυτές είναι και + οι βασικές λειτουργίες για την δόμηση ενός firewall τύπου + inclusive με stateful λειτουργία. - When working with the firewall rules be careful, you can - end up locking your self out. + Να δίνετε μεγάλη προσοχή όταν δουλεύετε με τους κανόνες ενός + firewall. Μπορεί άθελα σας να κλειδωθείτε έξω από το σύστημα + σας. - Rule Syntax + Σύνταξη Κανόνων IPFW - rule syntax - The rule syntax presented here has been simplified to - what is necessary to create a standard inclusive type - firewall rule set. For a complete rule syntax description - see the &man.ipfw.8; manual page. + Στην ενότητα αυτή, θα παρουσιάσουμε μια απλοποιημένη σύνταξη + κανόνων. Δείχνουμε μόνο ότι χρειάζεται για να δημιουργηθεί ένα + τυποποιημένο σύνολο κανόνων για ένα inclusive firewall. Για πλήρη + περιγραφή, δείτε τη σελίδα manual του &man.ipfw.8;. - Rules contain keywords: these keywords have to be coded - in a specific order from left to right on the line. Keywords - are identified in bold type. Some keywords have sub-options - which may be keywords them selves and also include more - sub-options. + Οι κανόνες περιέχουν λέξεις-κλειδιά. Οι λέξεις αυτές θα πρέπει + να κωδικοποιηθούν με συγκεκριμένη σειρά από τα αριστερά προς τα + δεξιά της γραμμής. Οι λέξεις-κλειδιά φαίνονται παρακάτω με έντονα + γράμματα. Μερικές λέξεις έχουν υπο-επιλογές οι οποίες μπορεί να + είναι επίσης λέξεις-κλειδιά και να περιλαμβάνουν επίσης ακόμα + περισσότερες υπο-επιλογές. - # is used to mark the start of a - comment and may appear at the end of a rule line or on its - own lines. Blank lines are ignored. + Η αρχή ενός σχολίου, σηματοδοτείται με το σύμβολο + #, το οποίο μπορεί να εμφανίζεται στο τέλος μιας + γραμμής κανόνα, ή και σε μια δική του γραμμή. Οι κενές γραμμές + αγνοούνται. CMD RULE_NUMBER ACTION LOGGING SELECTION STATEFUL CMD - Each new rule has to be prefixed with - add to add the - rule to the internal table. + Για να γίνει η προσθήκη ενός νέου κανόνα στον εσωτερικό + πίνακα, τοποθετείται μπροστά από αυτόν η παράμετρος + add. RULE_NUMBER - Each rule has to have a rule number to go with - it. + Κάθε κανόνας πρέπει να διαθέτει ένα αριθμό που να τον + χαρακτηρίζει. ACTION - A rule can be associated with one of the following - actions, which will be executed when the packet matches - the selection criterion of the rule. + Ένας κανόνας μπορεί να σχετίζεται με μια ή περισσότερες + ενέργειες, οι οποίες εκτελούνται όταν το πακέτο ταιριάζει με τα + κριτήρια επιλογής αυτού του κανόνα. allow | accept | pass | permit - These all mean the same thing which is to allow packets - that match the rule to exit the firewall rule processing. - The search terminates at this rule. + Όλα τα παραπάνω έχουν το ίδιο αποτέλεσμα: το πακέτο εξέρχεται + από την σύστημα του firewall. Η αναζήτηση για το συγκεκριμένο + πακέτο τερματίζεται σε αυτό τον κανόνα. check-state - Checks the packet against the dynamic rules table. If - a match is found, execute the action associated with the - rule which generated this dynamic rule, otherwise move to - the next rule. The check-state rule does not have - selection criterion. If no check-state rule is present in - the rule set, the dynamic rules table is checked at the - first keep-state or limit rule. + Ελέγχει το πακέτο με βάση το δυναμικό πίνακα κανόνων. Αν + βρεθεί κανόνας που να ταιριάζει, θα εκτελεστεί η ενέργεια του + κανόνα ο οποίος δημιούργησε τον συγκεκριμένο δυναμικό κανόνα. + Διαφορετικά, η αναζήτηση συνεχίζεται με τον επόμενο κανόνα. + Ένας κανόνας check-state δεν έχει κριτήρια επιλογής. Αν δεν + υπάρχει κανόνας check-state στο σύνολο κανόνων, ο έλεγχος του + πίνακα δυναμικών κανόνων ξεκινάει από τον πρώτο κανόνα τύπου + keep-state ή limit. deny | drop - Both words mean the same thing which is to discard - packets that match this rule. The search - terminates. + Και οι δύο λέξεις σημαίνουν το ίδιο πράγμα: τα πακέτα που + ταιριάζουν με αυτό τον κανόνα απορρίπτονται. Η αναζήτηση + τερματίζεται. - Logging + Καταγραφή - log or + log ή logamount - When a packet matches a rule with the log keyword, a - message will be logged to syslogd with a facility name of - SECURITY. The logging only occurs if the number of - packets logged so far for that particular rule does not - exceed the logamount parameter. If no logamount is - specified, the limit is taken from the sysctl variable - net.inet.ip.fw.verbose_limit. In both cases, a value of - zero removes the logging limit. Once the limit is - reached, logging can be re-enabled by clearing the - logging counter or the packet counter for that rule, see - the ipfw reset log command. + Όταν ένα πακέτο ταιριάζει με ένα κανόνα που περιέχει τη λέξη + log, γίνεται καταγραφή του μηνύματος μέσω του + &man.syslogd.8; στη δυνατότητα SECURITY. Η καταγραφή συμβαίνει + μόνο αν ο αριθμός των πακέτων που έχει καταγραφεί μέχρι στιγμής + δεν υπερβαίνει την παράμετρο logamount. Αν η + παράμετρος αυτή δεν έχει καθοριστεί, το όριο ρυθμίζεται με βάση + την τιμή της μεταβλητής sysctl + net.inet.ip.fw.verbose_limit. Και στις δύο + περιπτώσεις, μια μηδενική τιμή σημαίνει ότι δεν θα υπάρχει όριο + στην καταγραφή. Μόλις η καταγραφή φτάσει στο όριο, μπορεί να + γίνει επανενεργοποίηση της με το μηδενισμό του μετρητή + καταγραφής, ή του μετρητή για το συγκεκριμένο κανόνα. Δείτε την + εντολή ipfw reset log. - Logging is done after - all other packet matching conditions have been - successfully verified, and before performing the final - action (accept, deny) on the packet. It is up to you to - decide which rules you want to enable logging on. + Η καταγραφή γίνεται μόνο αφού επαληθευθούν όλες οι άλλες + συνθήκες ταιριάσματος του πακέτου, και πριν την τελική αποδοχή + ή απόρριψη του. Είναι στη δική σας ευχέρεια να αποφασίσετε σε + ποιους κανόνες θα ενεργοποιήσετε την καταγραφή. - Selection + Επιλογή - The keywords described in this section are used to - describe attributes of the packet to be interrogated when - determining whether rules match the packet or not. - The following general-purpose attributes are provided for - matching, and must be used in this order: + Οι λέξεις-κλειδιά που περιγράφονται σε αυτή την ενότητα, + χρησιμοποιούνται για να περιγράψουν χαρακτηριστικά του πακέτου που + θα πρέπει να διερευνηθούν για να καθοριστεί αν το πακέτο ταιριάζει + ή όχι με τον κανόνα. Η επιλογή μπορεί να γίνει με βάση τα + παρακάτω γενικής φύσεως χαρακτηριστικά, τα οποία και θα πρέπει να + χρησιμοποιηθούν με τη σειρά που φαίνονται: udp | tcp | icmp - or any protocol names found in - /etc/protocols are recognized and may - be used. The value specified is protocol to be matched - against. This is a mandatory requirement. + Μπορούν επίσης να χρησιμοποιηθούν τα πρωτόκολλα που + περιέχονται στο αρχείο /etc/protocols. + Η τιμή που καθορίζεται χρησιμοποιείται για το ταίριασμα του + πρωτοκόλλου. Πρόκειται για υποχρεωτική παράμετρο. from src to dst - The from and to keywords are used to match against IP - addresses. Rules must specify BOTH source and destination - parameters. any is a special keyword - that matches any IP address. me is a - special keyword that matches any IP address configured on - an interface in your &os; system to represent the PC the - firewall is running on (i.e. this box) as in 'from me to - any' or 'from any to me' or 'from 0.0.0.0/0 to any' or - 'from any to 0.0.0.0/0' or 'from 0.0.0.0 to any' or 'from - any to 0.0.0.0' or 'from me to 0.0.0.0'. IP addresses are - specified as a dotted IP address numeric form/mask-length, - or as single dotted IP address numeric form. This is a - mandatory requirement. See this link for help on writing - mask-lengths. + Οι λέξεις from και to + χρησιμοποιούνται για το ταίριασμα IP διευθύνσεων. Οι κανόνες + πρέπει να καθορίζουν τόσο την πηγή όσο και + τον προορισμό. Η λέξη any μπορεί να + χρησιμοποιηθεί για ταίριασμα με οποιαδήποτε διεύθυνση. Η λέξη + me έχει επίσης ειδική σημασία. Ταιριάζει με + οποιαδήποτε διεύθυνση που έχει ρυθμιστεί σε κάποια διεπαφή του + συστήματος σας, αντιπροσωπεύοντας έτσι το PC στο οποίο εκτελείται + το firewall. Μπορούν έτσι να γραφούν κανόνες του τύπου + from me to any ή + from any to me ή + from any to 0.0.0.0/0 ή + from 0.0.0.0/0 to me ή + from any to 0.0.0.0 ή + from me to 0.0.0.0. Οι διευθύνσεις IP + καθορίζονται ως αριθμητικές οκτάδες χωρισμένες με τελείες + και ακολουθούνται από το μήκος της μάσκας υποδικτύου. Μια + IP διεύθυνση μπορεί να καθορίζεται με αριθμούς που χωρίζονται + με τελείες. Μπορεί επίσης να ακολουθείται από το μέγεθος της + μάσκας υποδικτύου (μορφή CIDR). Πρόκειται για υποχρεωτική + παράμετρο. Μπορείτε να χρησιμοποιήσετε το βοηθητικό πρόγραμμα + net-mgmt/ipcalc για + διευκόλυνση σας στους υπολογισμούς. Δείτε την δικτυακή τοποθεσία + του προγράμματος για περισσότερες πληροφορίες: . port number - For protocols which support port numbers (such as - TCP and UDP). It is mandatory that you - code the port number of the service you want to match - on. Service names (from - /etc/services) may be used instead of - numeric port values. + Χρησιμοποιείται σε πρωτόκολλα που υποστηρίζουν αριθμούς θυρών + (όπως είναι τα TCP και UDP). + Είναι υποχρεωτικό να δίνεται ο αριθμός θύρας της υπηρεσίας + που θέλετε να ταιριάξετε. Μπορείτε να χρησιμοποιήσετε τα + ονόματα των υπηρεσιών (μπορείτε να τα βρείτε στο αρχείο + /etc/services) αντί για τους κανονικούς + αριθμούς θυρών. in | out - Matches incoming or outgoing packets, respectively. - The in and out are keywords and it is mandatory that you - code one or the other as part of your rule matching - criterion. + Με το παραπάνω μπορεί να καθοριστεί αν το ταίριασμα θα + γίνεται σε εισερχόμενα ή σε εξερχόμενα πακέτα αντίστοιχα. Είναι + υποχρεωτικό να έχετε ως μέρος των κριτηρίων του κανόνα σας, είτε + τη λέξη in είτε τη λέξη + out. via IF - Matches packets going through the interface specified - by exact name. The via keyword causes - the interface to always be checked as part of the match - process. + Ταιριάζει τα πακέτα τα οποία διέρχονται μέσω της διεπαφής με + το όνομα που καθορίζεται. Η λέξη via + εξασφαλίζει ότι το όνομα της διεπαφής θα είναι πάντα μέρος των + κριτηρίων κατά τη διαδικασία ταιριάσματος. setup - This is a mandatory keyword that identifies the session - start request for TCP packets. + Πρόκειται για υποχρεωτική παράμετρο που αναγνωρίζει την + αίτηση έναρξης μιας συνεδρίας για πακέτα + TCP. keep-state - This is a mandatory> keyword. Upon a match, the - firewall will create a dynamic rule, whose default behavior - is to match bidirectional traffic between source and - destination IP/port using the same protocol. + Πρόκειται για υποχρεωτική παράμετρο. Μόλις υπάρξει ταίριασμα, + το firewall θα δημιουργήσει ένα δυναμικό κανόνα, του οποίου η + προεπιλεγμένη συμπεριφορά είναι να ταιριάζει επικοινωνία διπλής + κατεύθυνσης μεταξύ της διεύθυνσης IP και της θύρας αφετηρίας και + προορισμού, χρησιμοποιώντας το ίδιο πρωτόκολλο. limit {src-addr | src-port | dst-addr | dst-port} - The firewall will only allow - N connections with the same set - of parameters as specified in the rule. One or more of - source and destination addresses and ports can be - specified. The 'limit' and 'keep-state' can not be used on - same rule. Limit provides the same stateful function as - 'keep-state' plus its own functions. + Το firewall θα επιτρέψει μόνο N + πλήθος συνδέσεων με τις παραμέτρους που περιγράφονται σε αυτό + τον κανόνα. Μπορούν να καθοριστούν περισσότερες από μια + διευθύνσεις και πόρτες αφετηρίας και προορισμού. Δεν μπορούν + να χρησιμοποιηθούν στον ίδιο κανόνα οι παράμετροι + limit και keep-state. + Η επιλογή limit παρέχει την ίδια λειτουργία + stateful με την keep-state, καθώς και + επιπρόσθετες δικές της λειτουργίες. - Stateful Rule Option + Επιλογή για Stateful Κανόνες IPFW - stateful filtering - Stateful filtering treats traffic as a bi-directional - exchange of packets comprising a session conversation. It - has the interrogation abilities to determine if the session - conversation between the originating sender and the - destination are following the valid procedure of - bi-directional packet exchange. Any packets that do not - properly fit the session conversation template are - automatically rejected as impostors. - - 'check-state' is used to identify where in the IPFW rules - set the packet is to be tested against the dynamic rules - facility. On a match the packet exits the firewall to - continue on its way and a new rule is dynamic created for - the next anticipated packet being exchanged during this - bi-directional session conversation. On a no match the - packet advances to the next rule in the rule set for - testing. - - The dynamic rules facility is vulnerable to resource - depletion from a SYN-flood attack which would open a huge - number of dynamic rules. To counter this attack, &os; - added another new option named limit. This - option is used to limit the number of simultaneous session - conversations by interrogating the rules source or - destinations fields as directed by the limit option and - using the packet's IP address found there, in a search of - the open dynamic rules counting the number of times this - rule and IP address combination occurred, if this count is - greater that the value specified on the limit option, the - packet is discarded. + Το stateful φιλτράρισμα, αντιμετωπίζει την κίνηση του δικτύου ως + διπλής κατεύθυνσης ανταλλαγή πακέτων τα οποία δημιουργούν μια + συνεδρία. Έχει επίσης τη δυνατότητα να διερευνήσει αν τηρούνται + οι έγκυροι κανόνες ανταλλαγής μηνυμάτων μεταξύ του αποστολέα και + του παραλήπτη. Οποιαδήποτε πακέτα δεν ταιριάζουν με το πρότυπο + αυτής της επικοινωνίας, απορρίπτονται ως ψεύτικα. + + Η επιλογή check-state χρησιμοποιείται για + να αναγνωριστεί σε ποιο σημείο του συνόλου κανόνων του IPFW θα + ελεγχθεί το πακέτο με βάση τη δυνατότητα των δυναμικών κανόνων. + Σε περίπτωση ταιριάσματος, το πακέτο εξέρχεται από το firewall και + συνεχίζει την πορεία του, ενώ την ίδια στιγμή δημιουργείται ένας + νέος δυναμικός κανόνας για το επόμενο πακέτο που αναμένεται να + έρθει με βάση τη συγκεκριμένη διπλής κατεύθυνσης επικοινωνία. Σε + περίπτωση που το πακέτο δεν ταιριάζει με το δυναμικό κανόνα, θα + προχωρήσει για να ελεγχθεί από τον επόμενο κανόνα του + firewall. + + Η δυνατότητα δυναμικών κανόνων είναι ευάλωτη σε εξάντληση πόρων + σε περίπτωση επίθεσης υπερχείλισης (flood) SYN. Η επίθεση αυτή + μπορεί να δημιουργήσει πολύ μεγάλο πλήθος δυναμικών κανόνων. + Για την αντιμετώπιση μιας τέτοιας επίθεσης, το &os; χρησιμοποιεί + μια ακόμα επιλογή που ονομάζεται limit. + Η επιλογή αυτή μπορεί να περιορίσει τον αριθμό των ταυτόχρονων + συνεδριών, εξετάζοντας τα πεδία αφετηρίας και προορισμού των + κανόνων. Ανιχνεύει με αυτό τον τρόπο το πλήθος των δυναμικών + κανόνων και πόσες φορές έχει χρησιμοποιηθεί ο καθένας από + τη συγκεκριμένη IP διεύθυνση. Αν ο αριθμός αυτός ξεπερνάει το + όριο που έχει τεθεί με την επιλογή limit, το + πακέτο απορρίπτεται. - Logging Firewall Messages + Καταγραφή Μηνυμάτων του Firewall IPFW - logging - The benefits of logging are obvious: it provides the - ability to review after the fact the rules you activated - logging on which provides information like, what packets had - been dropped, what addresses they came from, where they were - going, giving you a significant edge in tracking down - attackers. - - Even with the logging facility enabled, IPFW will not - generate any rule logging on it's own. The firewall - administrator decides what rules in the rule set he wants - to log and adds the log verb to those rules. Normally only - deny rules are logged, like the deny rule for incoming - ICMP pings. It is very customary to - duplicate the ipfw default deny everything rule with the - log verb included as your last rule in the rule set. This - way you get to see all the packets that did not match any - of the rules in the rule set. - - Logging is a two edged sword, if you are not careful, you - can lose yourself in the over abundance of log data and fill - your disk up with growing log files. DoS attacks that fill - up disk drives is one of the oldest attacks around. These - log message are not only written to syslogd, but also are - displayed on the root console screen and soon become very - annoying. - - The IPFIREWALL_VERBOSE_LIMIT=5 - kernel option limits the number of consecutive messages - sent to the system logger syslogd, concerning the packet - matching of a given rule. When this option is enabled in - the kernel, the number of consecutive messages concerning - a particular rule is capped at the number specified. There - is nothing to be gained from 200 log messages saying the - same identical thing. For instance, five consecutive - messages concerning a particular rule would be logged to - syslogd, the remainder identical consecutive messages would - be counted and posted to the syslogd with a phrase like - this: + Τα πλεονεκτήματα της καταγραφής συμβάντων του firewall, είναι + προφανή: παρέχουν τη δυνατότητα να δείτε για ποιο λόγο + ενεργοποιήθηκαν οι κανόνες στους οποίους έχετε ενεργοποιήσει την + καταγραφή. Οι πληροφορίες περιλαμβάνουν τα πακέτα που απορρίφθηκαν, + τις διευθύνσεις από τις οποίες προήλθαν και που κατευθύνονταν. + Με αυτό τον τρόπο, έχετε ένα σημαντικό πλεονέκτημα στην ανίχνευση + των εισβολέων. + + Ακόμα και αν ενεργοποιήσετε τη λειτουργία καταγραφής, το IPFW + δεν θα αρχίσει από μόνο του την καταγραφή για κανένα κανόνα. + Ο διαχειριστής του firewall θα αποφασίσει σε ποιους από όλους τους + κανόνες θα ενεργοποιήσει την καταγραφή, και θα προσθέσει την + λέξη log στην αντίστοιχη καταχώριση. + Φυσιολογικά, γίνεται καταγραφή μόνο για κανόνες που απορρίπτουν + πακέτα (κανόνες deny), όπως για παράδειγμα ο + κανόνας απόρριψης των εισερχόμενων ICMP pings. + Είναι κοινή πρακτική, να αντιγράφεται στο τέλος των κανόνων ο + κανόνας ipfw default deny everything και να + προστίθεται σε αυτόν η επιλογή log. + Με τον τρόπο αυτό, μπορείτε να δείτε όλα τα πακέτα που δεν + ταίριαξαν με κανένα κανόνα του συνόλου. + + Η καταγραφή συμβάντων είναι δίκοπο μαχαίρι. Αν δεν είστε + προσεκτικός, θα χαθείτε μέσα στο πλήθος των δεδομένων της + καταγραφής και θα γεμίσετε το δίσκο σας με άχρηστα αρχεία. Οι πιο + παλιές και κοινές επιθέσεις τύπου άρνησης υπηρεσίας (DoS), είναι + αυτές που προσπαθούν να γεμίσουν τους δίσκους σας. Τα μηνύματα + αυτά όχι μόνο καταγράφονται στο syslogd, + αλλά εμφανίζονται και στην κονσόλα του συστήματος σας, και σύντομα + γίνονται πολύ ενοχλητικά. + + Η επιλογή IPFIREWALL_VERBOSE_LIMIT=5 στον + πυρήνα, περιορίζει τον αριθμό των συνεχόμενων όμοιων μηνυμάτων που + στέλνονται στον καταγραφέα συστήματος &man.syslogd.8; σχετικά με + το ταίριασμα πακέτων ενός συγκεκριμένου κανόνα. Όταν ενεργοποιείται + αυτή η επιλογή στον πυρήνα, ο αριθμός των συνεχόμενων μηνυμάτων + ενός συγκεκριμένου κανόνα, σταματάει μετά τον αριθμό που + καθορίζεται. Δεν υπάρχει κανένα όφελος από 200 συνεχόμενα μηνύματα + με το ίδιο ακριβώς περιεχόμενο. Για παράδειγμα, πέντε συνεχόμενα + μηνύματα για ένα συγκεκριμένο κανόνα θα καταγράφονταν κανονικά στο + syslogd. Τα υπόλοιπα όμοια μηνύματα θα + καταμετρηθούν και θα καταγραφούν όπως φαίνεται παρακάτω: last message repeated 45 times - All logged packets messages are written by default to - /var/log/security file, which is defined - in the /etc/syslog.conf file. + Όλα τα μηνύματα καταγραφής των πακέτων, γράφονται από προεπιλογή + στο αρχείο /var/log/security το οποίο + καθορίζεται στο αρχείο /etc/syslog.conf. - Building a Rule Script - - Most experienced IPFW users create a file containing the - rules and code them in a manner compatible with running them - as a script. The major benefit of doing this is the firewall - rules can be refreshed in mass without the need of rebooting - the system to activate the new rules. This method is very - convenient in testing new rules as the procedure can be - executed as many times as needed. Being a script, you can - use symbolic substitution to code frequent used values and - substitution them in multiple rules. You will see this in - the following example. - - The script syntax used here is compatible with the 'sh', - 'csh', 'tcsh' shells. Symbolic substitution fields are - prefixed with a dollar sign $. Symbolic fields do not - have the $ prefix. The value to populate the Symbolic - field must be enclosed to "double quotes". - - Start your rules file like this: + Δημιουργία Ενός Script Κανόνων + + Οι περισσότεροι έμπειροι χρήστες του IPFW, δημιουργούν ένα + αρχείο που περιέχει τους κανόνες και το γράφουν με τέτοιο τρόπο + ώστε να να μπορεί να εκτελεστεί ως script. Το βασικό πλεονέκτημα + του παραπάνω τρόπου, είναι ότι οι κανόνες του firewall μπορούν να + ανανεωθούν χωρίς την ανάγκη να επανεκκινήσει το σύστημα για να + φορτωθούν οι νέοι. Η μέθοδος αυτή είναι πολύ βολική για + την δοκιμή νέων κανόνων, καθώς η διαδικασία μπορεί να επαναληφθεί + όσες φορές χρειάζεται. Καθώς πρόκειται για κανονικό script, + μπορείτε να χρησιμοποιήσετε συμβολική υποκατάσταση για να + κωδικοποιήσετε και να υποκαταστήσετε συχνά χρησιμοποιούμενες τιμές + σε πολλαπλούς κανόνες. Αυτό φαίνεται στο παρακάτω + παράδειγμα. + + Η σύνταξη που χρησιμοποιείται εδώ, είναι συμβατή με τα κελύφη + &man.sh.1;, &man.csh.1; και &man.tcsh.1;. Μπροστά από τα πεδία + της συμβολικής υποκατάστασης, υπάρχει το σήμα του δολαρίου, + $. Το σύμβολο αυτό δεν υπάρχει μπροστά από τα συμβολικά + πεδία. Η τιμή που θα αποδοθεί στο συμβολικό πεδίο, πρέπει να + εσωκλείεται σε διπλά εισαγωγικά. + + Ξεκινήστε το αρχείο των κανόνων σας όπως φαίνεται + παρακάτω: ############### start of example ipfw rules script ############# # ipfw -q -f flush # Delete all rules # Set defaults oif="tun0" # out interface odns="192.0.2.11" # ISP's DNS server IP address cmd="ipfw -q add " # build rule prefix ks="keep-state" # just too lazy to key this each time $cmd 00500 check-state $cmd 00502 deny all from any to any frag $cmd 00501 deny tcp from any to any established $cmd 00600 allow tcp from any to any 80 out via $oif setup $ks $cmd 00610 allow tcp from any to $odns 53 out via $oif setup $ks $cmd 00611 allow udp from any to $odns 53 out via $oif $ks ################### End of example ipfw rules script ############ - That is all there is to it. The rules are not important - in this example, how the Symbolic substitution field are - populated and used are. + Αυτό είναι όλο. Στο παράδειγμα αυτό δεν είναι σημαντικοί οι + κανόνες, αλλά ο τρόπος με τον οποίο λειτουργούν και παίρνουν τιμές + τα πεδία συμβολικής υποκατάστασης. - If the above example was in - /etc/ipfw.rules file, you could reload - these rules by entering on the command line. + Αν το παραπάνω παράδειγμα ήταν στο αρχείο + /etc/ipfw.rules θα μπορούσατε να φορτώσετε + αυτούς τους κανόνες, γράφοντας την παρακάτω εντολή: &prompt.root; sh /etc/ipfw.rules - The /etc/ipfw.rules file could be - located anywhere you want and the file could be named any - thing you would like. + Το αρχείο /etc/ipfw.rules μπορεί να + βρίσκεται σε όποιο κατάλογο θέλετε, και να ονομάζεται επίσης όπως + θέλετε. - The same thing could also be accomplished by running - these commands by hand: + Θα μπορούσατε να επιτύχετε το ίδιο πράγμα, εκτελώντας τις + παρακάτω εντολές χειροκίνητα: &prompt.root; ipfw -q -f flush &prompt.root; ipfw -q add check-state &prompt.root; ipfw -q add deny all from any to any frag &prompt.root; ipfw -q add deny tcp from any to any established &prompt.root; ipfw -q add allow tcp from any to any 80 out via tun0 setup keep-state &prompt.root; ipfw -q add allow tcp from any to 192.0.2.11 53 out via tun0 setup keep-state &prompt.root; ipfw -q add 00611 allow udp from any to 192.0.2.11 53 out via tun0 keep-state - Stateful Ruleset - - The following non-NATed rule set is an - example of how to code a very secure 'inclusive' type of - firewall. An inclusive firewall only allows services - matching pass rules through and blocks all other by default. - All firewalls have at the minimum two interfaces which have - to have rules to allow the firewall to function. - - All &unix; flavored operating systems, &os; included, are - designed to use interface lo0 and IP - address 127.0.0.1 for internal - communication with in the operating system. The firewall - rules must contain rules to allow free unmolested movement of - these special internally used packets. - - The interface which faces the public Internet, is the one - which you code your rules to authorize and control access out - to the public Internet and access requests arriving from the - public Internet. This can be your ppp - tun0 interface or your NIC that is - connected to your DSL or cable modem. - - In cases where one or more than one NIC are connected to - a private LANs behind the firewall, those interfaces must - have rules coded to allow free unmolested movement of - packets originating from those LAN interfaces. - - The rules should be first organized into three major - sections, all the free unmolested interfaces, public - interface outbound, and the public interface inbound. - - The order of the rules in each of the public interface - sections should be in order of the most used rules being - placed before less often used rules with the last rule in - the section being a block log all packets on that interface - and direction. - - The Outbound section in the following rule set only - contains 'allow' rules which contain selection values that - uniquely identify the service that is authorized for public - Internet access. All the rules have the, proto, port, - in/out, via and keep state option coded. The 'proto tcp' - rules have the 'setup' option included to identify the start - session request as the trigger packet to be posted to the - keep state stateful table. - - The Inbound section has all the blocking of undesirable - packets first for two different reasons. First is these - things being blocked may be part of an otherwise valid packet - which may be allowed in by the later authorized service - rules. Second reason is that by having a rule that - explicitly blocks selected packets that I receive on an - infrequent bases and do not want to see in the log, this - keeps them from being caught by the last rule in the section - which blocks and logs all packets which have fallen through - the rules. The last rule in the section which blocks and - logs all packets is how you create the legal evidence needed - to prosecute the people who are attacking your system. - - Another thing you should take note of, is there is no - response returned for any of the undesirable stuff, their - packets just get dropped and vanish. This way the attackers - has no knowledge if his packets have reached your system. - The less the attackers can learn about your system the more - secure it is. When you log packets with port numbers you do - not recognize, look the numbers up in - /etc/services/ or go to Σύνολο Κανόνων Stateful + + Το παρακάτω σύνολο κανόνων (που δεν περιέχει κανόνες για + NAT) είναι ένα παράδειγμα γραφής ενός inclusive + firewall. Ένα inclusive firewall επιτρέπει την είσοδο μόνο των + πακέτων που ταιριάζουν με τους κανόνες αποδοχής (pass) και + απορρίπτει από προεπιλογή όλα τα άλλα. Τα firewalls που έχουν + σχεδιαστεί να προστατεύουν ολόκληρα δίκτυα, διαθέτουν το λιγότερο + δύο διεπαφές, στις οποίες πρέπει να υπάρχουν κανόνες ώστε το + firewall να λειτουργεί. + + Όλα τα λειτουργικά συστήματα τύπου &unix;, συμπεριλαμβανομένου + και του &os;, έχουν σχεδιαστεί να χρησιμοποιούν τη διεπαφή + lo0 και τη διεύθυνση IP + 127.0.0.1 για εσωτερική επικοινωνία + με το λειτουργικό σύστημα. Το firewall πρέπει να περιέχει κανόνες + που να επιτρέπουν την απρόσκοπτη κίνηση αυτών των ειδικών, για + εσωτερική χρήση, πακέτων. + + Οι κανόνες που ορίζουν την πρόσβαση εισερχόμενων και + εξερχόμενων πακέτων, γράφονται για τη διεπαφή που συνδέεται στο + δημόσιο Internet. Η διεπαφή αυτή μπορεί να είναι για παράδειγμα η + tun0 (σε περίπτωση που χρησιμοποιείτε το + PPP χρήστη), ή η κάρτα δικτύου που συνδέεται στο + καλωδιακό ή DSL modem σας. + + Σε περίπτωση που μια ή περισσότερες κάρτες δικτύου συνδέονται σε + εσωτερικά ιδιωτικά δίκτυα πίσω από το firewall, θα πρέπει να + υπάρχουν οι αντίστοιχοι κανόνες που να επιτρέπουν την ελεύθερη + διακίνηση των πακέτων ανάμεσα στις διεπαφές αυτές ή/και στο + Internet. + + Οι κανόνες πρέπει να οργανώνονται σε τρεις κύριες ενότητες: + αρχικά όλες οι διεπαφές στις οποίες επιτρέπεται η ελεύθερη διακίνηση + δεδομένων, έπειτα η διεπαφή από την οποία εξέρχονται τα πακέτα προς + το δημόσιο δίκτυο (Internet) και τέλος η διεπαφή από την οποία + λαμβάνονται πακέτα από το Internet. + + Σε κάθε μια από τις ενότητες των διεπαφών που συνδέονται στο + Internet, πρέπει να τοποθετούνται πρώτοι οι κανόνες που ταιριάζουν + συχνότερα με την αντίστοιχη κίνηση. Ο τελευταίος κανόνας της + ενότητας θα πρέπει να απορρίπτει και να καταγράφει όλα τα πακέτα + της συγκεκριμένης διεπαφής/κατεύθυνσης. + + Η ενότητα εξερχομένων (Outbound) στο σύνολο κανόνων που φαίνεται + παρακάτω, περιέχει μόνο κανόνες τύπου allow. Οι + κανόνες αυτοί περιέχουν συγκεκριμένες επιλεγμένες τιμές, με τις + οποίες αναγνωρίζεται με μοναδικό τρόπο η υπηρεσία στην οποία + επιτρέπεται η πρόσβαση από το δημόσιο Internet. Όλοι οι κανόνες + έχουν τις επιλογές proto, + port, in/out και + keep-state. Οι κανόνες τύπου + proto tcp περιέχουν την επιλογή + setup για την αναγνώριση του πακέτου έναρξης της + συνεδρίας, ώστε να γίνει η καταχώριση της στον πίνακα συνδέσεων + (stateful). + + Στην ενότητα των εισερχόμενων πακέτων (Inbound) που φαίνεται + παρακάτω, εμφανίζονται πρώτοι οι κανόνες που χρησιμοποιούνται για + την απόρριψη των ανεπιθύμητων πακέτων. Αυτό γίνεται για δύο + διαφορετικούς λόγους. Ο πρώτος είναι ότι τα κακόβουλα πακέτα + μπορεί εν μέρει να ταιριάζουν με κάποια χαρακτηριστικά της έγκυρης + κίνησης. Τα πακέτα αυτά θα πρέπει να απορριφθούν, αντί να γίνουν + δεκτά από κάποιο επόμενο κανόνα allow. + Ο δεύτερος είναι ότι μπορείτε να απορρίψετε συγκεκριμένα πακέτα τα + οποία γνωρίζετε ότι δεν είναι έγκυρα, αλλά σας είναι αδιάφορη η + καταγραφή τους. Με τον τρόπο αυτό εμποδίζεται η λήψη και καταγραφή + τους από τον τελευταίο κανόνα. Ο τελευταίος κανόνας τυπικά + απορρίπτει και καταγράφει όλα τα πακέτα που έφτασαν μέχρι αυτόν. + Ο κανόνας αυτός χρησιμοποιείται για την παροχή νομικών αποδείξεων + σε περίπτωση που κινήσετε νομική διαδικασία κατά ατόμων που + προέβησαν σε επιθέσεις στο σύστημα σας. + + Θα πρέπει επίσης να εξασφαλίσετε ότι το σύστημα σας δεν θα + δώσει καμιά απάντηση σε κανένα από τα ανεπιθύμητα πακέτα. + Τα πακέτα αυτά θα πρέπει να απορριφθούν και να εξαφανιστούν. + Με τον τρόπο αυτό, ο επιτιθέμενος δεν έχει καμιά γνώση αν τα πακέτα + του έφτασαν μέχρι το σύστημα σας. Όσο λιγότερα μπορούν να μάθουν + οι επιτιθέμενοι σχετικά με το σύστημα σας, τόσο πιο ασφαλές + είναι. Όταν εκτελείτε καταγραφή πακέτων με αριθμούς θυρών που δεν + αναγνωρίζετε, κοιτάξτε στο αρχείο + /etc/services/ ή δείτε το - and do a port number lookup to find what the purpose of that - port number is. Check out this link for port numbers used by - Trojans: . + και αναζητήστε τον αριθμό της θύρας για να δείτε ποιος είναι ο + σκοπός της. Ελέγξτε την παρακάτω τοποθεσία για τους αριθμούς θυρών + που χρησιμοποιούνται συχνά από κακόβουλα προγράμματα (Trojans): + . - An Example Inclusive Ruleset - - The following non-NATed rule set is a - complete inclusive type ruleset. You can not go wrong using - this rule set for you own. Just comment out any pass rules - for services you do not want. If you see messages in your - log that you want to stop seeing just add a deny rule in the - inbound section. You have to change the 'dc0' interface name - in every rule to the interface name of the NIC that connects - your system to the public Internet. For user ppp it would be - 'tun0'. - - You will see a pattern in the usage of these - rules. + Ένα Υπόδειγμα Συνόλου Κανόνων Inclusive + + Το παρακάτω σύνολο κανόνων (στο οποίο δεν υλοποιείται λειτουργία + NAT) είναι αρκετά πλήρες και πολύ ασφαλές. + Δημιουργεί firewall τύπου inclusive, και έχει δοκιμαστεί σε + πραγματικές συνθήκες λειτουργίας. Μπορεί να εξυπηρετήσει το ίδιο + καλά και το δικό σας σύστημα. Απλώς μετατρέψτε σε σχόλιο τους + κανόνες pass για τις υπηρεσίες που δεν θέλετε + να ενεργοποιήσετε. Για να αποφύγετε την καταγραφή ανεπιθύμητων + μηνυμάτων, απλώς προσθέστε ένα κανόνα τύπου + deny στην ενότητα των εισερχομένων. Σε όλους + τους κανόνες, Θα πρέπει να αλλάξετε το όνομα της διεπαφής από + dc0 στο πραγματικό όνομα της διεπαφής που + συνδέεται στο δημόσιο Internet. Σε περίπτωση που χρησιμοποιείτε το + PPP χρήστη, το όνομα της διεπαφής θα είναι + tun0. + + Θα διαπιστώσετε ότι υπάρχει μια συγκεκριμένη λογική στη χρήση + αυτών των κανόνων. - All statements that are a request to start a session - to the public Internet use keep-state. + Όλοι οι κανόνες που αποτελούν αίτηση για έναρξη μιας νέας + συνεδρίας με το δημόσιο Internet, χρησιμοποιούν την επιλογή + keep-state. - All the authorized services that originate from the - public Internet have the limit option to stop - flooding. + Όλες οι διαπιστευμένες υπηρεσίες που προέρχονται από το + δημόσιο Internet, διαθέτουν την επιλογή + limit, για την αποφυγή επιθέσεων + υπερχείλισης (flooding). - All rules use in or out to clarify direction. + Όλοι οι κανόνες χρησιμοποιούν τις επιλογές + in ή out για να + διευκρινίζουν την κατεύθυνση της επικοινωνίας. - All rules use via interface name to specify the - interface the packet is traveling over. + Όλοι οι κανόνες χρησιμοποιούν την επιλογή + via όνομα-διεπαφής + για να καθορίσουν τη διεπαφή από την οποία διέρχεται το + πακέτο. - The following rules go into + Οι κανόνες που φαίνονται παρακάτω, θα πρέπει να γραφούν στο /etc/ipfw.rules. ################ Start of IPFW rules file ############################### # Flush out the list before we begin. ipfw -q -f flush # Set rules command prefix cmd="ipfw -q add" pif="dc0" # public interface name of NIC # facing the public Internet ################################################################# # No restrictions on Inside LAN Interface for private network # Not needed unless you have LAN. # Change xl0 to your LAN NIC interface name ################################################################# #$cmd 00005 allow all from any to any via xl0 ################################################################# # No restrictions on Loopback Interface ################################################################# $cmd 00010 allow all from any to any via lo0 ################################################################# # Allow the packet through if it has previous been added to the # the "dynamic" rules table by a allow keep-state statement. ################################################################# $cmd 00015 check-state ################################################################# # Interface facing Public Internet (Outbound Section) -# Interrogate session start requests originating from behind the +# Check session start requests originating from behind the # firewall on the private network or from this gateway server -# destine for the public Internet. +# destined for the public Internet. ################################################################# # Allow out access to my ISP's Domain name server. # x.x.x.x must be the IP address of your ISP.s DNS # Dup these lines if your ISP has more than one DNS server # Get the IP addresses from /etc/resolv.conf file $cmd 00110 allow tcp from any to x.x.x.x 53 out via $pif setup keep-state $cmd 00111 allow udp from any to x.x.x.x 53 out via $pif keep-state # Allow out access to my ISP's DHCP server for cable/DSL configurations. # This rule is not needed for .user ppp. connection to the public Internet. # so you can delete this whole group. # Use the following rule and check log for IP address. # Then put IP address in commented out rule & delete first rule $cmd 00120 allow log udp from any to any 67 out via $pif keep-state #$cmd 00120 allow udp from any to x.x.x.x 67 out via $pif keep-state # Allow out non-secure standard www function $cmd 00200 allow tcp from any to any 80 out via $pif setup keep-state # Allow out secure www function https over TLS SSL $cmd 00220 allow tcp from any to any 443 out via $pif setup keep-state # Allow out send & get email function $cmd 00230 allow tcp from any to any 25 out via $pif setup keep-state $cmd 00231 allow tcp from any to any 110 out via $pif setup keep-state # Allow out FBSD (make install & CVSUP) functions # Basically give user root "GOD" privileges. $cmd 00240 allow tcp from me to any out via $pif setup keep-state uid root # Allow out ping $cmd 00250 allow icmp from any to any out via $pif keep-state # Allow out Time $cmd 00260 allow tcp from any to any 37 out via $pif setup keep-state # Allow out nntp news (i.e. news groups) $cmd 00270 allow tcp from any to any 119 out via $pif setup keep-state # Allow out secure FTP, Telnet, and SCP # This function is using SSH (secure shell) $cmd 00280 allow tcp from any to any 22 out via $pif setup keep-state # Allow out whois $cmd 00290 allow tcp from any to any 43 out via $pif setup keep-state # deny and log everything else that.s trying to get out. # This rule enforces the block all by default logic. $cmd 00299 deny log all from any to any out via $pif ################################################################# # Interface facing Public Internet (Inbound Section) -# Interrogate packets originating from the public Internet -# destine for this gateway server or the private network. +# Check packets originating from the public Internet +# destined for this gateway server or the private network. ################################################################# # Deny all inbound traffic from non-routable reserved address spaces $cmd 00300 deny all from 192.168.0.0/16 to any in via $pif #RFC 1918 private IP $cmd 00301 deny all from 172.16.0.0/12 to any in via $pif #RFC 1918 private IP $cmd 00302 deny all from 10.0.0.0/8 to any in via $pif #RFC 1918 private IP $cmd 00303 deny all from 127.0.0.0/8 to any in via $pif #loopback $cmd 00304 deny all from 0.0.0.0/8 to any in via $pif #loopback $cmd 00305 deny all from 169.254.0.0/16 to any in via $pif #DHCP auto-config $cmd 00306 deny all from 192.0.2.0/24 to any in via $pif #reserved for docs $cmd 00307 deny all from 204.152.64.0/23 to any in via $pif #Sun cluster interconnect $cmd 00308 deny all from 224.0.0.0/3 to any in via $pif #Class D & E multicast # Deny public pings $cmd 00310 deny icmp from any to any in via $pif # Deny ident $cmd 00315 deny tcp from any to any 113 in via $pif # Deny all Netbios service. 137=name, 138=datagram, 139=session # Netbios is MS/Windows sharing services. # Block MS/Windows hosts2 name server requests 81 $cmd 00320 deny tcp from any to any 137 in via $pif $cmd 00321 deny tcp from any to any 138 in via $pif $cmd 00322 deny tcp from any to any 139 in via $pif $cmd 00323 deny tcp from any to any 81 in via $pif # Deny any late arriving packets $cmd 00330 deny all from any to any frag in via $pif # Deny ACK packets that did not match the dynamic rule table $cmd 00332 deny tcp from any to any established in via $pif # Allow traffic in from ISP's DHCP server. This rule must contain # the IP address of your ISP.s DHCP server as it.s the only # authorized source to send this packet type. # Only necessary for cable or DSL configurations. # This rule is not needed for .user ppp. type connection to # the public Internet. This is the same IP address you captured # and used in the outbound section. #$cmd 00360 allow udp from any to x.x.x.x 67 in via $pif keep-state # Allow in standard www function because I have apache server $cmd 00400 allow tcp from any to me 80 in via $pif setup limit src-addr 2 # Allow in secure FTP, Telnet, and SCP from public Internet $cmd 00410 allow tcp from any to me 22 in via $pif setup limit src-addr 2 # Allow in non-secure Telnet session from public Internet # labeled non-secure because ID & PW are passed over public # Internet as clear text. # Delete this sample group if you do not have telnet server enabled. $cmd 00420 allow tcp from any to me 23 in via $pif setup limit src-addr 2 # Reject & Log all incoming connections from the outside $cmd 00499 deny log all from any to any in via $pif # Everything else is denied by default # deny and log all packets that fell through to see what they are $cmd 00999 deny log all from any to any ################ End of IPFW rules file ############################### - An Example <acronym>NAT</acronym> and Stateful - Ruleset + Ένα Υπόδειγμα <acronym>NAT</acronym> με Stateful Σύνολο + Κανόνων NAT - and IPFW - There are some additional configuration statements that - need to be enabled to activate the NAT - function of IPFW. The kernel source needs 'option divert' - statement added to the other IPFIREWALL statements compiled - into a custom kernel. + Για να ενεργοποιηθεί η λειτουργία NAT στο + IPFW, χρειάζονται κάποιες επιπλέον ρυθμίσεις. Θα πρέπει να + προσθέσετε την επιλογή option IPDIVERT μαζί με + τις υπόλοιπες επιλογές για το IPFIREWALL στο αρχείο ρυθμίσεων του + πυρήνα. Θα πρέπει έπειτα να μεταγλωττίσετε και να εγκαταστήσετε + το νέο σας προσαρμοσμένο πυρήνα. - In addition to the normal IPFW options in - /etc/rc.conf, the following are - needed. + Εκτός από τις συνηθισμένες επιλογές για το IPFW, θα πρέπει να + προσθέσετε και τις παρακάτω στο αρχείο + /etc/rc.conf: natd_enable="YES" # Enable NATD function natd_interface="rl0" # interface name of public Internet NIC natd_flags="-dynamic -m" # -m = preserve port numbers if possible - Utilizing stateful rules with divert natd rule (Network - Address Translation) greatly complicates the rule set coding - logic. The positioning of the check-state, and 'divert natd' - rules in the rule set becomes very critical. This is no - longer a simple fall-through logic flow. A new action type - is used, called 'skipto'. To use the skipto command it is - mandatory that you number each rule so you know exactly - where the skipto rule number is you are really jumping - to. - - The following is an uncommented example of one coding - method, selected here to explain the sequence of the packet - flow through the rule sets. - - The processing flow starts with the first rule from the - top of the rule file and progress one rule at a time deeper - into the file until the end is reach or the packet being - tested to the selection criteria matches and the packet is - released out of the firewall. It is important to take notice - of the location of rule numbers 100 101, 450, 500, and 510. - These rules control the translation of the outbound and - inbound packets so their entries in the keep-state dynamic - table always register the private LAN IP address. Next - notice that all the allow and deny rules specified the - direction the packet is going (IE outbound or inbound) and - the interface. Also notice that all the start outbound - session requests all skipto rule 500 for the network address - translation. - - Lets say a LAN user uses their web browser to get a web - page. Web pages use port 80 to communicate over. So the - packet enters the firewall, It does not match 100 because it - is headed out not in. It passes rule 101 because this is the - first packet so it has not been posted to the keep-state - dynamic table yet. The packet finally comes to rule 125 a - matches. It is outbound through the NIC facing the public - Internet. The packet still has it's source IP address as a - private LAN IP address. On the match to this rule, two - actions take place. The keep-state option will post this - rule into the keep-state dynamic rules table and the - specified action is executed. The action is part of the info - posted to the dynamic table. In this case it is "skipto rule - 500". Rule 500 NATs the packet IP address - and out it goes. Remember this, this is very important. - This packet makes its way to the destination and returns and - enters the top of the rule set. This time it does match rule - 100 and has it destination IP address mapped back to its - corresponding LAN IP address. It then is processed by the - check-state rule, it's found in the table as an existing - session conversation and released to the LAN. It goes to the - LAN PC that sent it and a new packet is sent requesting - another segment of the data from the remote server. This - time it gets checked by the check-state rule and its outbound - entry is found, the associated action, 'skipto 500', is - executed. The packet jumps to rule 500 gets - NATed and released on it's way out. - - On the inbound side, everything coming in that is part - of an existing session conversation is being automatically - handled by the check-state rule and the properly placed - divert natd rules. All we have to address is denying all the - bad packets and only allowing in the authorized services. - Lets say there is a apache server running on the firewall box - and we want people on the public Internet to be able to - access the local web site. The new inbound start request - packet matches rule 100 and its IP address is mapped to LAN - IP for the firewall box. The packet is them matched against - all the nasty things we want to check for and finally matches - against rule 425. On a match two things occur. The packet - rule is posted to the keep-state dynamic table but this time - any new session requests originating from that source IP - address is limited to 2. This defends against DoS attacks of - service running on the specified port number. The action is - allow so the packet is released to the LAN. On return the - check-state rule recognizes the packet as belonging to an - existing session conversation sends it to rule 500 for - NATing and released to outbound - interface. - - Example Ruleset #1: + Η χρήση κανόνων stateful μαζί με τον κανόνα + divert natd (NAT), περιπλέκει πολύ την λογική + συγγραφής των κανόνων. Η θέση εμφάνισης των κανόνων + check-state και divert natd + μέσα στο σύνολο κανόνων γίνεται πολύ κρίσιμη. Δεν πρόκειται πλέον + για απλή λογική περάσματος από τον ένα κανόνα στον επόμενο. + Χρησιμοποιείται ένα νέο είδος ενέργειας που ονομάζεται + skipto. Για να χρησιμοποιηθεί η εντολή + skipto, είναι υποχρεωτικό να έχετε αριθμήσει τους + κανόνες, ώστε να ξέρετε σε ποιο κανόνα θα καταλήξει το άλμα που θα + εκτελεστεί από την εντολή αυτή. + + Παρακάτω θα βρείτε ένα υπόδειγμα (χωρίς πρόσθετα σχόλια) μιας + μεθόδου συγγραφής που επιλέξαμε εδώ για να εξηγήσουμε την ακολουθία + ροής του πακέτου μέσα στο σύνολο κανόνων. + + Η ροή της επεξεργασίας ξεκινάει με τον πρώτο από την κορυφή + κανόνα και συνεχίζει ένα κανόνα κάθε φορά προς τα κάτω, είτε μέχρι + να φτάσει τον τελευταίο, ή μέχρι το πακέτο να ταιριάξει με τα + κριτήρια επιλογής κάποιου κανόνα και να ελευθερωθεί από το firewall. + Είναι σημαντικό να παρατηρήσουμε τη θέση των κανόνων με αριθμούς + 100, 101, 450, 500 και 510. Οι κανόνες αυτοί ελέγχουν την + μετάφραση των εξερχόμενων και εισερχόμενων πακέτων, ώστε οι + καταχωρήσεις τους στο δυναμικό πίνακα καταστάσεων να περιέχουν + πάντα την ιδιωτική IP διεύθυνση του τοπικού δικτύου. Παρατηρήστε + επίσης ότι όλοι οι κανόνες allow και deny καθορίζουν την κατεύθυνση + κίνησης του πακέτου καθώς και την διεπαφή. Επίσης, όλες οι + εξερχόμενες αιτήσεις για νέες συνεδρίες μεταφέρονται απευθείας + (μέσω του skipto rule 500) στον κανόνα 500 για + να γίνει η μετάφραση διευθύνσεων δικτύου (NAT). + + Ας υποθέσουμε ότι ένα χρήστης του τοπικού δικτύου χρησιμοποιεί + τον φυλλομετρητή του για να δει μια ιστοσελίδα. Οι ιστοσελίδες + χρησιμοποιούν την πόρτα 80 για την επικοινωνία. Το πακέτο + εισέρχεται στο firewall. Δεν ταιριάζει με τον κανόνα 100 γιατί + είναι εξερχόμενο και όχι εισερχόμενο. Περνάει τον κανόνα 101 γιατί + πρόκειται για νέα επικοινωνία και έτσι δεν υπάρχει ακόμα στον + δυναμικό πίνακα καταστάσεων. Το πακέτο τελικά φτάνει στον κανόνα + 125 με τον οποίο και ταιριάζει. Εξέρχεται μέσω της κάρτας δικτύου + που συνδέεται στο δημόσιο Internet. Το πακέτο έχει ακόμα ως IP + αφετηρίας την ιδιωτική διεύθυνση του τοπικού δικτύου. Το ταίριασμα + με αυτό τον κανόνα προκαλεί δύο ενέργειες. Η επιλογή + keep-state θα δημιουργήσει ένα νέο δυναμικό + κανόνα, θα τον καταχωρήσει στον πίνακα, και θα εκτελέσει την + αντίστοιχη ενέργεια. Η ενέργεια αυτή είναι μέρος της πληροφορίας + που γράφεται στον δυναμικό πίνακα. Στην περίπτωση αυτή είναι + η skipto rule 500. Ο κανόνας 500 μεταφράζει μέσω + NAT τη διεύθυνση IP του πακέτου, πριν αυτό + εξέλθει προς το Internet. Αυτό είναι ιδιαίτερα σημαντικό. + Το πακέτο κατευθύνεται προς τον προορισμό του, όπου δημιουργείται + και αποστέλλεται ένα νέο πακέτο ως απάντηση. Το νέο αυτό πακέτο + εισέρχεται ξανά στο firewall, στον κανόνα που είναι στην κορυφή + της λίστας. Αυτή τη φορά ταιριάζει με τον κανόνα 100 και η + διεύθυνση προορισμού του αλλάζει ξανά στην αρχική του τοπικού + δικτύου. Έπειτα, γίνεται η επεξεργασία του από τον κανόνα + check-state ο οποίος ανακαλύπτει ότι πρόκειται + για πακέτο συνεδρίας σε εξέλιξη και το απελευθερώνει στο τοπικό + δίκτυο. Κατευθύνεται προς τον υπολογιστή του τοπικού δικτύου που το + έστειλε, ο οποίος στέλνει ένα νέο πακέτο ζητώντας περισσότερα + δεδομένα από τον απομακρυσμένο εξυπηρετητή. Το πακέτο αυτό + ελέγχεται από τον κανόνα check-state, ο οποίος + βρίσκει την καταχώριση του στα εξερχόμενα και εκτελεί την αντίστοιχη + ενέργεια που σε αυτή την περίπτωση είναι skipto 500. + Το πακέτο προωθείται στον κανόνα 500, γίνεται η μετάφραση της + διεύθυνσης του μέσω NAT και απελευθερώνεται στο + Internet. + + Από την μεριά των εισερχόμενων, όποιο πακέτο αναγνωρίζεται ως + μέρος μιας υπάρχουσας συνεδρίας, ελέγχεται αυτόματα από τον κανόνα + check-state και τους αντίστοιχους κανόνες + divert natd. Το μόνο που χρειάζεται να + αντιμετωπίσουμε είναι η απόρριψη όλων των προβληματικών πακέτων και + η έγκριση μόνο των πακέτων που προορίζονται για εγκεκριμένες + υπηρεσίες. Ας υποθέσουμε ότι έχουμε ένα εξυπηρετητή apache ο οποίος + εκτελείται στο μηχάνημα με το firewall, και επιθυμούμε το τοπικό + site να είναι προσβάσιμο από το δημόσιο Internet. Η εισερχόμενη + αίτηση νέας συνεδρίας ταιριάζει με τον κανόνα 100 και η IP διεύθυνση + της αντιστοιχίζεται στο τοπικό IP του μηχανήματος με το firewall. + Το πακέτο έπειτα ελέγχεται για οποιοδήποτε πρόβλημα μπορεί να έχει + σύμφωνα με τους κανόνες που χρησιμοποιούμε, και τελικά ταιριάζει με + τον κανόνα 425. Στην περίπτωση αυτή συμβαίνουν δύο πράγματα. + Ο κανόνας για το πακέτο γράφεται στο δυναμικό πίνακα καταστάσεων, + αλλά αυτή τη φορά περιορίζεται ο αριθμός αιτήσεων νέας συνεδρίας + από το συγκεκριμένο IP σε 2. Με αυτό τον τρόπο μπορούμε να + αμυνθούμε σε επιθέσεις τύπου άρνησης υπηρεσίας (DoS) όσο αφορά τη + συγκεκριμένη θύρα επικοινωνίας. Η ενέργεια του κανόνα είναι το + allow, και έτσι το πακέτο απελευθερώνεται στο + τοπικό δίκτυο. Το πακέτο που παράγεται ως απάντηση, ελέγχεται από + τον κανόνα check-state, ο οποίος αναγνωρίζει ότι + ανήκει σε μια ήδη ενεργή συνεδρία, και αποστέλλεται στον κανόνα 500 + όπου γίνεται η μετάφραση της διεύθυνσης του μέσω + NAT. Το πακέτο τελικά απελευθερώνεται μέσω της + διεπαφής εξερχομένων. + + Υπόδειγμα Κανόνων #1: #!/bin/sh cmd="ipfw -q add" skip="skipto 500" pif=rl0 ks="keep-state" good_tcpo="22,25,37,43,53,80,443,110,119" ipfw -q -f flush $cmd 002 allow all from any to any via xl0 # exclude LAN traffic $cmd 003 allow all from any to any via lo0 # exclude loopback traffic $cmd 100 divert natd ip from any to any in via $pif $cmd 101 check-state # Authorized outbound packets $cmd 120 $skip udp from any to xx.168.240.2 53 out via $pif $ks $cmd 121 $skip udp from any to xx.168.240.5 53 out via $pif $ks $cmd 125 $skip tcp from any to any $good_tcpo out via $pif setup $ks $cmd 130 $skip icmp from any to any out via $pif $ks $cmd 135 $skip udp from any to any 123 out via $pif $ks # Deny all inbound traffic from non-routable reserved address spaces $cmd 300 deny all from 192.168.0.0/16 to any in via $pif #RFC 1918 private IP $cmd 301 deny all from 172.16.0.0/12 to any in via $pif #RFC 1918 private IP $cmd 302 deny all from 10.0.0.0/8 to any in via $pif #RFC 1918 private IP $cmd 303 deny all from 127.0.0.0/8 to any in via $pif #loopback $cmd 304 deny all from 0.0.0.0/8 to any in via $pif #loopback $cmd 305 deny all from 169.254.0.0/16 to any in via $pif #DHCP auto-config $cmd 306 deny all from 192.0.2.0/24 to any in via $pif #reserved for docs $cmd 307 deny all from 204.152.64.0/23 to any in via $pif #Sun cluster $cmd 308 deny all from 224.0.0.0/3 to any in via $pif #Class D & E multicast # Authorized inbound packets $cmd 400 allow udp from xx.70.207.54 to any 68 in $ks $cmd 420 allow tcp from any to me 80 in via $pif setup limit src-addr 1 $cmd 450 deny log ip from any to any # This is skipto location for outbound stateful rules $cmd 500 divert natd ip from any to any out via $pif $cmd 510 allow ip from any to any ######################## end of rules ################## - The following is pretty much the same as above, but uses - a self documenting coding style full of description comments - to help the inexperienced IPFW rule writer to better - understand what the rules are doing. + Οι παρακάτω κανόνες είναι σχεδόν ίδιοι με τους παραπάνω, αλλά + περιέχουν περισσότερα σχόλια για να βοηθήσουν τον αρχάριο χρήστη + του IPFW να καταλάβει καλύτερα πως λειτουργούν. - Example Ruleset #2: + Υπόδειγμα Κανόνων #2: #!/bin/sh ################ Start of IPFW rules file ############################### # Flush out the list before we begin. ipfw -q -f flush # Set rules command prefix cmd="ipfw -q add" skip="skipto 800" pif="rl0" # public interface name of NIC # facing the public Internet ################################################################# # No restrictions on Inside LAN Interface for private network # Change xl0 to your LAN NIC interface name ################################################################# $cmd 005 allow all from any to any via xl0 ################################################################# # No restrictions on Loopback Interface ################################################################# $cmd 010 allow all from any to any via lo0 ################################################################# # check if packet is inbound and nat address if it is ################################################################# $cmd 014 divert natd ip from any to any in via $pif ################################################################# # Allow the packet through if it has previous been added to the # the "dynamic" rules table by a allow keep-state statement. ################################################################# $cmd 015 check-state ################################################################# # Interface facing Public Internet (Outbound Section) -# Interrogate session start requests originating from behind the +# Check session start requests originating from behind the # firewall on the private network or from this gateway server -# destine for the public Internet. +# destined for the public Internet. ################################################################# # Allow out access to my ISP's Domain name server. # x.x.x.x must be the IP address of your ISP's DNS # Dup these lines if your ISP has more than one DNS server # Get the IP addresses from /etc/resolv.conf file $cmd 020 $skip tcp from any to x.x.x.x 53 out via $pif setup keep-state # Allow out access to my ISP's DHCP server for cable/DSL configurations. $cmd 030 $skip udp from any to x.x.x.x 67 out via $pif keep-state # Allow out non-secure standard www function $cmd 040 $skip tcp from any to any 80 out via $pif setup keep-state # Allow out secure www function https over TLS SSL $cmd 050 $skip tcp from any to any 443 out via $pif setup keep-state # Allow out send & get email function $cmd 060 $skip tcp from any to any 25 out via $pif setup keep-state $cmd 061 $skip tcp from any to any 110 out via $pif setup keep-state # Allow out FreeBSD (make install & CVSUP) functions # Basically give user root "GOD" privileges. $cmd 070 $skip tcp from me to any out via $pif setup keep-state uid root # Allow out ping $cmd 080 $skip icmp from any to any out via $pif keep-state # Allow out Time $cmd 090 $skip tcp from any to any 37 out via $pif setup keep-state # Allow out nntp news (i.e. news groups) $cmd 100 $skip tcp from any to any 119 out via $pif setup keep-state # Allow out secure FTP, Telnet, and SCP # This function is using SSH (secure shell) $cmd 110 $skip tcp from any to any 22 out via $pif setup keep-state # Allow out whois $cmd 120 $skip tcp from any to any 43 out via $pif setup keep-state # Allow ntp time server $cmd 130 $skip udp from any to any 123 out via $pif keep-state ################################################################# # Interface facing Public Internet (Inbound Section) -# Interrogate packets originating from the public Internet -# destine for this gateway server or the private network. +# Check packets originating from the public Internet +# destined for this gateway server or the private network. ################################################################# # Deny all inbound traffic from non-routable reserved address spaces $cmd 300 deny all from 192.168.0.0/16 to any in via $pif #RFC 1918 private IP $cmd 301 deny all from 172.16.0.0/12 to any in via $pif #RFC 1918 private IP $cmd 302 deny all from 10.0.0.0/8 to any in via $pif #RFC 1918 private IP $cmd 303 deny all from 127.0.0.0/8 to any in via $pif #loopback $cmd 304 deny all from 0.0.0.0/8 to any in via $pif #loopback $cmd 305 deny all from 169.254.0.0/16 to any in via $pif #DHCP auto-config $cmd 306 deny all from 192.0.2.0/24 to any in via $pif #reserved for docs $cmd 307 deny all from 204.152.64.0/23 to any in via $pif #Sun cluster $cmd 308 deny all from 224.0.0.0/3 to any in via $pif #Class D & E multicast # Deny ident $cmd 315 deny tcp from any to any 113 in via $pif # Deny all Netbios service. 137=name, 138=datagram, 139=session # Netbios is MS/Windows sharing services. # Block MS/Windows hosts2 name server requests 81 $cmd 320 deny tcp from any to any 137 in via $pif $cmd 321 deny tcp from any to any 138 in via $pif $cmd 322 deny tcp from any to any 139 in via $pif $cmd 323 deny tcp from any to any 81 in via $pif # Deny any late arriving packets $cmd 330 deny all from any to any frag in via $pif # Deny ACK packets that did not match the dynamic rule table $cmd 332 deny tcp from any to any established in via $pif # Allow traffic in from ISP's DHCP server. This rule must contain # the IP address of your ISP's DHCP server as it's the only # authorized source to send this packet type. # Only necessary for cable or DSL configurations. # This rule is not needed for 'user ppp' type connection to # the public Internet. This is the same IP address you captured # and used in the outbound section. $cmd 360 allow udp from x.x.x.x to any 68 in via $pif keep-state # Allow in standard www function because I have Apache server $cmd 370 allow tcp from any to me 80 in via $pif setup limit src-addr 2 # Allow in secure FTP, Telnet, and SCP from public Internet $cmd 380 allow tcp from any to me 22 in via $pif setup limit src-addr 2 # Allow in non-secure Telnet session from public Internet # labeled non-secure because ID & PW are passed over public # Internet as clear text. # Delete this sample group if you do not have telnet server enabled. $cmd 390 allow tcp from any to me 23 in via $pif setup limit src-addr 2 # Reject & Log all unauthorized incoming connections from the public Internet $cmd 400 deny log all from any to any in via $pif # Reject & Log all unauthorized out going connections to the public Internet $cmd 450 deny log all from any to any out via $pif # This is skipto location for outbound stateful rules $cmd 800 divert natd ip from any to any out via $pif $cmd 801 allow ip from any to any # Everything else is denied by default # deny and log all packets that fell through to see what they are $cmd 999 deny log all from any to any ################ End of IPFW rules file ###############################