ich erkläre euch wie ihr eine ipfw firewall auf FreeBSD installiert ich übernehme keine Verantwortung für irgend welche fehlt Einstellung oder sonstiges wenn ihr die Sachen einfach kopiert selbst schuld
was brauche ich?
1 FreeBSD root
1 metin2 Server
1 ein wenig Grips
und die Ports die der metin2 Server braucht
Putty
2. testen ob ipfw möglich ist
das macht ihr mit
Code:
ipfw list
Code:
ipfw: getsockopt(IP_FW_GET): Protocol not available
ihr erstelle eine neue datei namens ipfw.rules
wir müssen naturlich auch den ssh port ec auch freigeben da ihr sonst nicht mehr euch per ssh zu euren root verbinden könnt
ich habe hier ma eine standart regel gemacht für metin2 und einem channel
dies basiert ledeglich auf den Standart ports!
ihr gebt also folgenden Text ein in eure ipfw.rules Datei
Code:
IPF="ipfw -q add" ipfw -q -f flush #loopback $IPF 10 allow all from any to any via lo0 $IPF 20 deny all from any to 127.0.0.0/8 $IPF 30 deny all from 127.0.0.0/8 to any $IPF 40 deny tcp from any to any frag # statefull $IPF 50 check-state $IPF 60 allow tcp from any to any established $IPF 70 allow all from any to any out keep-state $IPF 80 allow icmp from any to any # open port ftp (20,21), ssh (22), mail (25) # http (80), dns (53) etc $IPF 110 allow tcp from any to any 21 in $IPF 120 allow tcp from any to any 21 out $IPF 130 allow tcp from any to any 22 in $IPF 140 allow tcp from any to any 22 out $IPF 170 allow udp from any to any 53 in $IPF 175 allow tcp from any to any 53 in $IPF 180 allow udp from any to any 53 out $IPF 185 allow tcp from any to any 53 out # metin2 ch1 ports $IPF 200 allow tcp from any to any 11002 in $IPF 210 allow tcp from any to any 11002 out $IPF 200 allow udp from any to any 11002 in $IPF 210 allow udp from any to any 11002 out $IPF 200 allow tcp from any to any 13000 in $IPF 210 allow tcp from any to any 13000 out $IPF 200 allow tcp from any to any 13001 in $IPF 210 allow tcp from any to any 13001 out $IPF 200 allow tcp from any to any 13002 in $IPF 210 allow tcp from any to any 13002 out $IPF 200 allow tcp from any to any 13003 in $IPF 210 allow tcp from any to any 13003 out $IPF 200 allow tcp from any to any 13004 in $IPF 210 allow tcp from any to any 13004 out $IPF 200 allow tcp from any to any 13061 in $IPF 210 allow tcp from any to any 13061 out $IPF 200 allow tcp from any to any 13099 in $IPF 210 allow tcp from any to any 13099 out
/etc/ipfw.rules
und zu guter lezt müssen wir das ganze in die rc.conf einfügen am schnellsten geht das so
1.ihr könnt naturlich die ipfw.rules auch in einem anderen Verzeichnis packen nur den müsst ihr den pfad anpassen das bleibt euch überlassen
Code:
echo 'firewall_enable="YES"' >> /etc/rc.conf echo 'firewall_script="/etc/ipfw.rules"' >> /etc/rc.conf
Code:
reboot
Code:
/etc/rc.d/ipfw restart
ipfw show
Mit ipfw ips bannen
wenn ihr ma einen Angreifer habt auf euren freebsd root und es defentive als ddos indefiziren könt den kann man mit ipfw auch ips bannen
das geht so
Code:
ipfw add deny ip from 123.145.167.123 to any
Code:
ipfw add allow ip from 123.145.167.123 to any
ich habe jeze nur eine beispiel ip genommen ihr sezte naturlich die ip des angreifers ein
ipfw im kernel kompilieren
ich möchte darauf hinweisen in 99% der falle braucht man es nicht ich werde hier nicht erklären wie ihr an die source bzw kernel source kommt zum compilen ich werden lediglich zeigen wie ihr es in den kernel bzw in den source editiert und kompilieren
als erste gebt ihr das ein
Code:
grep IPFIREWALL /usr/src/sys/i386/conf
Code:
cd /usr/src/sys/i386/conf
Code:
cp GENERIC IPFWKERNEL
ihr könnt vi oder ee nehm ich personlich zihe ee vor
Code:
ee IPFWKERNEL
Code:
options IPFIREWALL # required for IPFW options IPFIREWALL_VERBOSE # optional; logging options IPFIREWALL_VERBOSE_LIMIT=10 # optional; don't get too many log entries options IPDIVERT # needed for natd
Code:
cd /usr/src
Code:
make buildkernel KERNCONF=IPFWKERNEL
Code:
make installkernel KERNCONF=IPFWKERNEL
Code:
reboot
quelle

wenn euch gefallen hat gebt mir ein thanks
virus total scan:

/update 2 kernconfig mit PAE+Ipfw für OVH Server hinzugefügt







