Toon posts:

[LINUX Firewall rulebase] overzetten -> nieuw sys

Pagina: 1
Acties:

Verwijderd

Topicstarter
ok pfft is moeilijker dan ik dacht...
heb jullie kennins en hulp nodig mensen. :)

Het probleem:
een klant wil zijn huidige linux bak voor wat anders gaan gebruiken.Dus de firewall moet naar een ander systeem over gezet worden.. (heb niet zo heel veel verstand van linux)
maar dit is nog wel te doen dacht ik...

heb thuis even een redhat 7.2 geinstall. met 3 Nic er in..
het enige wat ik van de klant heb is de rulebase van de firewall. das toch niet genoeg informatie naar mijn kennins.

ik heb de naam van de klant en public ipadressen geweizig!
om bekende redenen, wand zoals de rulebase er nu uit ziet heeft de klant volgens mij helemaal geen firewall,,, tis meer een rulebase gemaakt om alles door te laten..
zucht...

Verwijderd

:?
post eens een vraag ofzow ??

  • Arjan A
  • Registratie: November 2000
  • Laatst online: 22:03

Arjan A

Cenosillicafoob

Op zondag 05 mei 2002 22:58 schreef myst het volgende:
:?
post eens een vraag ofzow ??
Bijkbaar is het overzetten mislukt :+

Canon EOS | DJI M2P
Fotoblog · Mijn werk aan jouw muur


Verwijderd

Topicstarter
de rulebase:
#!/bin/sh
# aantekeningen MM_Zork
# [aantekening]
#linuxbox met 3 nics!
#eth0 is ip 166.85.191.33 dit is het ISP #adres waar mee de linuxbox aan het
#internet verbonden is!
#de WAN NIC is de de Klant router!
INETIF='eth0'#WAN interface
# [wat me nog niet helemaal duidelijk is: hoe komende de onderstaande
# IPadressen binnen op de linuxbox? Zit er ergens nog een router tussen?]
# [of is de eth0 muli homed? Dus staan op eth0 alle ipadressen actief?]

INET1IP='166.85.191.34'#www/smtp klant.nl
INET2IP='166.85.191.35' #www/smtp klant2.com
INET3IP='166.85.191.36'#www rerouting prolog (www.klant.nl/pmwebsite6)
INET4IP='166.85.191.37' #www rerouting mlx (www.klant.nl/mlxweb)
INET5IP='166.85.191.38' #M------
INET6IP='166.85.191.39' #B------odE
INET7IP='166.85.191.40' #Website3
INET8IP='166.85.191.41' #Website4
INET9IP='166.85.191.42' #qmserver
INET10ip='166.85.191.43'#colserver
INET11ip='166.85.191.44'#betaplus

LANIF='eth1' #LAN interface
LANIP='192.168.1.230' #Lan ip firewall
DMZIF='eth2'#DMZ interface [ja hoor! Hoe haal je het in je botte
# kop!!!!!]
DMZIP='192.168.2.3' #Klant2 ip, temporarily in dmz

ROUTER='166.85.191.33' #Klant router [Wan link eth0!]

#[interne ip adressen en servers over nic eth1 en eth2]

WWW1IP='192.168.1.1' #Standard webserver
FTPIP='192.168.1.1' #Ftp server
WWW2IP='192.168.2.200' #Prolog server
WWW3IP='192.168.1.4' #MLX webserver
WWW4IP='192.168.2.1' #Klant2 webserver
WWW5IP='192.168.1.231' #MbK (M------)
WWW6IP='192.168.1.232' #XMLS (B------)
WWW7IP='192.168.1.161' #qmserver
WWW8ip='192.168.1.162'#colserver
WWW9ip='192.168.2.181'#betaplus

#[exchange server is ook webserver????? {WWW1IP}]
MAILIP='192.168.1.1' #Exchange server
MAIL2IP='192.168.2.1' #Exchange server Klant2
FILEIP='192.168.1.1' #Fileserver Klant
FILE2IP='192.168.2.1' #Fileserver Klant2
SQLIP='192.168.1.1' #Sql server
MBK1IP='192.168.1.231'#MBK1 server
MBK2IP='192.168.1.232'#MBK2 server, XML server

KLANTNET='192.168.1.0' #Klant local subnet
BOUWNET='192.168.2.0' #Klant2 local subnet
ANY='0/0'#Any wildcard
UNPRIV='1024:65535' #The unprivileged ports
PRIV='1:1023'#The privileged counterpart

#Since we do not have asymmetric routing, we can turn anti-spoofing on:
for f in /proc/sys/net/ipv4/conf/*/rp_filter; do echo 1 > $f; done

#Turn on forwarding, should be disabled by default:
echo 1 > /proc/sys/net/ipv4/ip_forward

#No ICMP Redirection please:
for f in /proc/sys/net/ipv4/conf/*/accept_redirects; do echo 0 > $f; done

#Turn on TCP SYN protection:
echo 1 > /proc/sys/net/ipv4/tcp_syncookies

#No ip source routing:
for f in /proc/sys/net/ipv4/conf/*/accept_source_route; do echo 0 > $f; done

insmod ip_conntrack
insmod ip_nat_ftp
insmod ip_conntrack_ftp

#Start clean
#

iptables -F
iptables -X
iptables -Z

#Local loopback is OK, anything else we deny, these will be removed
#in the final part of the initialization
#

iptables -A INPUT -i ! lo -j DROP
iptables -A OUTPUT -o ! lo -j DROP
iptables -A FORWARD -j DROP

#Local loopback is OK, in general
#

iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT

#Let's define our custom chains
#

iptables -N lan-inet
iptables -N inet-lan
iptables -N lan-dmz
iptables -N dmz-lan
iptables -N dmz-inet
iptables -N inet-dmz

#A chain for accepting standard ICMP messages
#

iptables -N icmp-acc

#Jump to it
#Jump to the userdef chain
#

iptables -A FORWARD -s $KLANTNET/24 ! -d $BOUWNET/24 -j lan-inet
iptables -A FORWARD ! -s $BOUWNET/24 -d $KLANTNET/24 -j inet-lan
iptables -A FORWARD -s $BOUWNET/24 -d $KLANTNET/24 -j dmz-lan
iptables -A FORWARD -s $KLANTNET/24 -d $BOUWNET/24 -j lan-dmz
iptables -A FORWARD -s $BOUWNET/24 ! -d $KLANTNET/24 -j dmz-inet
iptables -A FORWARD ! -s $KLANTNET/24 -d $BOUWNET/24 -j inet-dmz

#Put rules in our icmp-accept chain
#

iptables -A icmp-acc -p icmp --icmp-type destination-unreachable -j ACCEPT
iptables -A icmp-acc -p icmp --icmp-type source-quench -j ACCEPT
iptables -A icmp-acc -p icmp --icmp-type time-exceeded -j ACCEPT
iptables -A icmp-acc -p icmp --icmp-type parameter-problem -j ACCEPT

#lan-dmz:Windows NT Trust, Browsing, Exchange, Switch Mgmt, Staffware
#

iptables -A lan-dmz -p tcp -j ACCEPT
iptables -A lan-dmz -p udp -j ACCEPT
iptables -A lan-dmz -p icmp -j ACCEPT
iptables -A lan-dmz -j LOG
iptables -A lan-dmz -j DROP

#dmz-lan:Windows NT Trust, Browsing, Exchange, Staffware
#

iptables -A dmz-lan -p tcp -j ACCEPT
iptables -A dmz-lan -p udp -j ACCEPT
iptables -A dmz-lan -p icmp -j ACCEPT
iptables -A dmz-lan -j LOG
iptables -A dmz-lan -j DROP

#Chain lan-inet:www, dns, ftp, Netscape Download Center
#

iptables -A lan-inet -p tcp --dport domain -j ACCEPT #DNS
iptables -A lan-inet -p udp --dport domain -j ACCEPT #DNS
iptables -A lan-inet -p tcp --dport www -j ACCEPT #HTTP
iptables -A lan-inet -p tcp --dport https -j ACCEPT #HTTPS
iptables -A lan-inet -p udp --dport https -j ACCEPT #HTTPS
iptables -A lan-inet -p tcp --dport ftp -j ACCEPT #FTP
iptables -A lan-inet -p udp --dport ftp -j ACCEPT #FTP
iptables -A lan-inet -p tcp --dport ftp-data -j ACCEPT #FTP
iptables -A lan-inet -p udp --dport ftp-data -j ACCEPT #FTP
iptables -A lan-inet -p tcp --dport nntp -j ACCEPT #NEWS
iptables -A lan-inet -p tcp --dport pop3 -j ACCEPT #POP3
iptables -A lan-inet -p tcp --dport smtp -j ACCEPT #SMTP
iptables -A lan-inet -p tcp --dport 5190 -j ACCEPT #
iptables -A lan-inet -p tcp --dport 5900 -j ACCEPT #VNC
iptables -A lan-inet -p tcp --dport 1604 -j ACCEPT #
iptables -A lan-inet -p tcp --dport 1494 -j ACCEPT #
iptables -A lan-inet -p tcp --dport telnet -j ACCEPT #TELNET
iptables -A lan-inet -p tcp --dport ssh -j ACCEPT #SSH
iptables -A lan-inet -p udp --dport ssh -j ACCEPT #SSH
iptables -A lan-inet -p tcp --dport 1723 -j ACCEPT #
iptables -A lan-inet -p tcp --dport 7070 -j ACCEPT #RealAudio
iptables -A lan-inet -p tcp --dport 8080 -j ACCEPT #Proxy
#iptables -A lan-inet -p tcp --dport 389 -j ACCEPT #LapLink
#iptables -A lan-inet -p tcp --dport 1547 -j ACCEPT #LapLink
#iptables -A lan-inet -p tcp --sport 1547 -j ACCEPT #LapLink
iptables -A lan-inet -p tcp --dport 8880 -j ACCEPT #CDDB

iptables -t nat -A POSTROUTING -o $INETIF -j SNAT --to $INET1IP

#Return traffic for public services: Klant
#

iptables -A lan-inet -p tcp -s $WWW1IP --sport www -j ACCEPT
iptables -A lan-inet -p tcp -s $WWW2IP --sport www -j ACCEPT
iptables -A lan-inet -p tcp -s $WWW3IP --sport www -j ACCEPT
iptables -A lan-inet -p tcp -s $MBK1IP --sport www -j ACCEPT
#iptables -A lan-inet -p tcp -s $WWWTESTIP -j ACCEPT #Laplink host op testserver
iptables -A lan-inet -p tcp -s $WWW7IP --sport www -j ACCEPT #www op testserver
iptables -a lan-inet -p tcp -s $WWW8ip -sport www -j accept
iptables -a lan-inet -p tcp -s $WWW9ip -sport www -j accept
iptables -A lan-inet -p tcp -s $MBK1IP --sport ftp -j ACCEPT
iptables -A lan-inet -p tcp -s $MBK1IP --sport ftp-data -j ACCEPT
iptables -A lan-inet -p tcp -s $MBK2IP --sport www -j ACCEPT
iptables -A lan-inet -p tcp -s $MBK2IP --sport 5900 -j ACCEPT #VNC
iptables -A lan-inet -p tcp -s $MAILIP --sport smtp -j ACCEPT
iptables -A lan-inet -p tcp -s $MAILIP --sport pop3 -j ACCEPT
iptables -A lan-inet -p tcp -s $FTPIP --sport ftp -j ACCEPT
iptables -A lan-inet -p tcp -s $FTPIP --sport ftp-data -j ACCEPT
iptables -A lan-inet -p icmp --icmp-type echo-request -j ACCEPT

#How to handle all other traffic: Klant
#

iptables -A lan-inet -p icmp -j icmp-acc
iptables -A lan-inet -j LOG
iptables -A lan-inet -j DROP


#Chain inet-lan: www1 -> s1empr, www2 -> prolog smtp -> s1empr
#Make services public: Klant
#

iptables -A PREROUTING -t nat -p tcp -d $INET1IP --dport www -j DNAT --to $WWW1IP
iptables -A PREROUTING -t nat -p tcp -d $INET1IP --dport smtp -j DNAT --to $MAILIP
iptables -A PREROUTING -t nat -p tcp -d $INET1IP --dport pop3 -j DNAT --to $MAILIP
iptables -A PREROUTING -t nat -p tcp -d $INET1IP --dport ftp -j DNAT --to $FTPIP
iptables -A PREROUTING -t nat -p tcp -d $INET1IP --dport ftp-data -j DNAT --to $FTPIP
iptables -A PREROUTING -t nat -p tcp -d $INET2IP --dport www -j DNAT --to $WWW1IP
iptables -A PREROUTING -t nat -p tcp -d $INET3IP --dport www -j DNAT --to $WWW2IP
iptables -A PREROUTING -t nat -p tcp -d $INET4IP --dport www -j DNAT --to $WWW3IP
iptables -A PREROUTING -t nat -p tcp -d $INET5IP --dport www -j DNAT --to $MBK1IP
iptables -A PREROUTING -t nat -p tcp -d $INET5IP --dport ftp -j DNAT --to $MBK1IP
iptables -A PREROUTING -t nat -p tcp -d $INET5IP --dport ftp-data -j DNAT --to $MBK1IP
iptables -A PREROUTING -t nat -p tcp -d $INET6IP --dport www -j DNAT --to $MBK2IP
iptables -A PREROUTING -t nat -p tcp -d $INET6IP --dport 5900 -j DNAT --to $MBK2IP #VNC
iptables -A PREROUTING -t nat -p tcp -d $INET7IP --dport www -j DNAT --to $WWW3IP
iptables -A PREROUTING -t nat -p tcp -d $INET8IP --dport smtp -j DNAT --to $MAILIP
iptables -A PREROUTING -t nat -p tcp -d $INET9IP --dport www -j DNAT --to $WWW7IP #CyberDOCS
iptables -A PREROUTING -t nat -p tcp -d $INET10IP --dport www -j DNAT --to $WWW8IP #Colserver
iptables -A PREROUTING -t nat -p tcp -d $INET11IP --dport www -j DNAT --to $WWW9IP #Betaplus
#iptables -A PREROUTING -t nat -p tcp -d $INET9IP --dport 1547 -j DNAT --to $WWWTESTIP #LapLink host op testserver
#iptables -A PREROUTING -t nat -p tcp -d $INET9IP --dport 389 -j DNAT --to $WWWTESTIP #LapLink host op testserver

#Allow packets to public services: Klant
#

iptables -A inet-lan -p tcp -s $ANY -d $WWW1IP --dport www -j ACCEPT
iptables -A inet-lan -p tcp -s $ANY -d $WWW2IP --dport www -j ACCEPT
iptables -A inet-lan -p tcp -s $ANY -d $WWW3IP --dport www -j ACCEPT
iptables -A inet-lan -p tcp -s $ANY -d $MBK1IP --dport www -j ACCEPT
iptables -A inet-lan -p tcp -s $ANY -d $MBK1IP --dport ftp -j ACCEPT
iptables -A inet-lan -p udp -s $ANY -d $MBK1IP --dport ftp -j ACCEPT
iptables -A inet-lan -p tcp -s $ANY -d $MBK1IP --dport ftp-data -j ACCEPT
iptables -A inet-lan -p udp -s $ANY -d $MBK1IP --dport ftp-data -j ACCEPT
iptables -A inet-lan -p tcp -s $ANY -d $MBK2IP --dport www -j ACCEPT
iptables -A inet-lan -p tcp -s $ANY -d $MBK2IP --dport 5900 -j ACCEPT #VNC
iptables -A inet-lan -p tcp -s $ANY -d $MAILIP --dport smtp -j ACCEPT
iptables -A inet-lan -p tcp -s $ANY -d $MAILIP --dport pop3 -j ACCEPT
iptables -A inet-lan -p tcp -s $ANY -d $FTPIP --dport ftp -j ACCEPT
iptables -A inet-lan -p udp -s $ANY -d $FTPIP --dport ftp -j ACCEPT
iptables -A inet-lan -p tcp -s $ANY -d $FTPIP --dport ftp-data -j ACCEPT
iptables -A inet-lan -p udp -s $ANY -d $FTPIP --dport ftp-data -j ACCEPT
#iptables -A inet-lan -p tcp -s $ANY -d $WWWTESTIP -j ACCEPT #LapLink host op testserver
iptables -A inet-lan -p tcp -s $ANY -d $WWW7IP --dport www -j ACCEPT #CyberDOCS
iptables -A inet-lan -p tcp -s $ANY -d $WWW8IP --dport www -j ACCEPT
iptables -A inet-lan -p tcp -s $ANY -d $WWW9IP --dport www -j ACCEPT

#Other traffic allowed: Klant
#

iptables -A inet-lan -p icmp --icmp-type echo-reply -j ACCEPT
iptables -A inet-lan -p tcp --sport domain -j ACCEPT
iptables -A inet-lan -p udp --sport domain -j ACCEPT
iptables -A inet-lan -p tcp --sport www -j ACCEPT
iptables -A inet-lan -p tcp --sport ssh -j ACCEPT
iptables -A inet-lan -p udp --sport ssh -j ACCEPT
iptables -A inet-lan -p tcp --sport https -j ACCEPT
iptables -A inet-lan -p udp --sport https -j ACCEPT
iptables -A inet-lan -p tcp --sport ftp -j ACCEPT
iptables -A inet-lan -p tcp --sport ftp-data -j ACCEPT
iptables -A inet-lan -p tcp --sport nntp -j ACCEPT
iptables -A inet-lan -p tcp --sport pop3 -j ACCEPT
iptables -A inet-lan -p tcp --sport smtp -j ACCEPT
iptables -A inet-lan -p tcp --sport 1723 -j ACCEPT
iptables -A inet-lan -p tcp ! --syn --sport 7070 -j ACCEPT #RealAudio
iptables -A inet-lan -p tcp ! --syn --sport 8080 -j ACCEPT #Proxy
iptables -A inet-lan -p tcp --sport 389 -j ACCEPT #LapLink
iptables -A inet-lan -p tcp --sport 1547 -j ACCEPT #LapLink
iptables -A inet-lan -p tcp --dport 1547 -j ACCEPT #LapLink
iptables -A inet-lan -p tcp ! --syn --sport telnet -j ACCEPT
iptables -A inet-lan -p tcp ! --syn --sport 5190 -j ACCEPT
iptables -A inet-lan -p tcp ! --syn --sport 1604 -j ACCEPT
iptables -A inet-lan -p tcp ! --syn --sport 1494 -j ACCEPT
iptables -A inet-lan -p tcp ! --syn --sport 8880 -j ACCEPT #CDDB
iptables -A inet-lan -p tcp --sport 5900 -j ACCEPT

#How to handle all other traffic: Klant
#

iptables -A inet-lan -p icmp -j icmp-acc
iptables -A inet-lan -j LOG
iptables -A inet-lan -j DROP

#Chain inet-dmz
#Make services public: Klant2
#

iptables -A PREROUTING -t nat -p tcp -d $INET2IP --dport smtp -j DNAT --to $MAIL2IP
iptables -A PREROUTING -t nat -p tcp -d $INET2IP --dport pop3 -j DNAT --to $MAIL2IP
iptables -A PREROUTING -t nat -p tcp -d $INET3IP --dport www -j DNAT --to $WWW2IP

#Allow packets to public services: Klant2
#

iptables -A inet-dmz -p tcp -s $ANY -d $WWW2IP --dport www -j ACCEPT
iptables -A inet-dmz -p tcp -s $ANY -d $MAIL2IP --dport pop3 -j ACCEPT
iptables -A inet-dmz -p tcp -s $ANY -d $MAIL2IP --dport smtp -j ACCEPT

#Allow other traffic: Klant2
#

iptables -A inet-dmz -p tcp --sport domain -j ACCEPT
iptables -A inet-dmz -p udp --sport domain -j ACCEPT
iptables -A inet-dmz -p tcp --sport www -j ACCEPT
iptables -A inet-dmz -p tcp --sport https -j ACCEPT
iptables -A inet-dmz -p udp --sport https -j ACCEPT
iptables -A inet-dmz -p tcp --sport ftp -j ACCEPT
iptables -A inet-dmz -p udp --sport ftp -j ACCEPT
iptables -A inet-dmz -p tcp --sport ftp-data -j ACCEPT
iptables -A inet-dmz -p udp --sport ftp-data -j ACCEPT
iptables -A inet-dmz -p tcp --sport nntp -j ACCEPT
iptables -A inet-dmz -p tcp --sport pop3 -j ACCEPT
iptables -A inet-dmz -p tcp --sport smtp -j ACCEPT
iptables -A inet-dmz -p tcp ! --syn --sport 5190 -j ACCEPT
iptables -A inet-dmz -p tcp ! --syn --sport 7070 -j ACCEPT #RealAudio
iptables -A inet-dmz -p tcp ! --syn --sport 1863 -j ACCEPT
iptables -A inet-dmz -p tcp ! --syn --sport 1604 -j ACCEPT
iptables -A inet-dmz -p tcp ! --syn --sport 1494 -j ACCEPT

#How to handle all other traffic: Klant2
#

iptables -A inet-dmz -p icmp -j icmp-acc
iptables -A inet-dmz -j LOG
iptables -A inet-dmz -j DROP

#Chain dmz-inet
#

#Return traffic for public services: Klant2
#

iptables -A dmz-inet -p tcp -s $WWW2IP --sport www -j ACCEPT
iptables -A dmz-inet -p tcp -s $MAIL2IP --sport smtp -j ACCEPT
iptables -A dmz-inet -p tcp -s $MAIL2IP --sport pop3 -j ACCEPT

#Other traffic: Klant2
#

iptables -A dmz-inet -p tcp --dport domain -j ACCEPT
iptables -A dmz-inet -p udp --dport domain -j ACCEPT
iptables -A dmz-inet -p tcp --dport www -j ACCEPT
iptables -A dmz-inet -p tcp --dport https -j ACCEPT
iptables -A dmz-inet -p udp --dport https -j ACCEPT
iptables -A dmz-inet -p tcp --dport ftp -j ACCEPT
iptables -A dmz-inet -p udp --dport ftp -j ACCEPT
iptables -A dmz-inet -p tcp --dport ftp-data -j ACCEPT
iptables -A dmz-inet -p udp --dport ftp-data -j ACCEPT
iptables -A dmz-inet -p tcp --dport nntp -j ACCEPT
iptables -A dmz-inet -p tcp --dport pop3 -j ACCEPT
iptables -A dmz-inet -p tcp --dport smtp -j ACCEPT
iptables -A dmz-inet -p tcp --dport 5190 -j ACCEPT
iptables -A dmz-inet -p tcp --dport 1863 -j ACCEPT
iptables -A dmz-inet -p tcp --dport 1604 -j ACCEPT
iptables -A dmz-inet -p tcp --dport 7070 -j ACCEPT #RealAudio
iptables -A dmz-inet -p tcp --dport 1494 -j ACCEPT

#How to handle all other traffic: Klant2
#

iptables -A dmz-inet -p icmp -j icmp-acc
iptables -A dmz-inet -j LOG
iptables -A dmz-inet -j DROP

#Internal to external ip routing
#Workaround for the source-nat-destination-nat problem
#

iptables -t nat -A POSTROUTING -d $WWW1IP -s $KLANTNET/24 -p tcp --dport www -j SNAT --to $LANIP
iptables -t nat -A POSTROUTING -d $WWW2IP -s $KLANTNET/24 -p tcp --dport www -j SNAT --to $LANIP
iptables -t nat -A POSTROUTING -d $WWW3IP -s $KLANTNET/24 -p tcp --dport www -j SNAT --to $LANIP
iptables -t nat -A POSTROUTING -d $WWW4IP -s $KLANTNET/24 -p tcp --dport www -j SNAT --to $LANIP
iptables -t nat -A POSTROUTING -d $WWW5IP -s $KLANTNET/24 -p tcp --dport www -j SNAT --to $LANIP
iptables -t nat -A POSTROUTING -d $WWW6IP -s $KLANTNET/24 -p tcp --dport www -j SNAT --to $LANIP
iptables -t nat -A POSTROUTING -d $WWW1IP -s $KLANTNET/24 -p tcp --dport ftp -j SNAT --to $LANIP
iptables -t nat -A POSTROUTING -d $WWW1IP -s $KLANTNET/24 -p tcp --dport ftp-data -j SNAT --to $LANIP
iptables -t nat -A POSTROUTING -d $MAILIP -s $KLANTNET/24 -p tcp --dport pop3 -j SNAT --to $LANIP
iptables -t nat -A POSTROUTING -d $MAILIP -s $KLANTNET/24 -p tcp --dport smtp -j SNAT --to $LANIP
iptables -t nat -A POSTROUTING -d $MBK2IP -s $KLANTNET/24 -p tcp --dport 5900 -j SNAT --to $LANIP
iptables -t nat -A POSTROUTING -d $MBK1IP -s $KLANTNET/24 -p tcp --dport ftp -j SNAT --to $LANIP
iptables -t nat -A POSTROUTING -d $MBK1IP -s $KLANTNET/24 -p tcp --dport ftp-data -j SNAT --to $LANIP
iptables -t nat -A POSTROUTING -d $WWWTESTIP -s $KLANTNET/24 -p tcp --dport 1547 -j SNAT --to $LANIP #Laplink op testserver
iptables -t nat -A POSTROUTING -d $WWWTESTIP -s $KLANTNET/24 -p tcp --sport 1547 -j SNAT --to $LANIP #Laplink op testserver
iptables -t nat -A POSTROUTING -d $WWWTESTIP -s $KLANTNET/24 -p tcp --dport 389 -j SNAT --to $LANIP #Laplink op testserver
iptables -t nat -A POSTROUTING -d $WWW7IP -s $KLANTNET/24 -p tcp --dport www -j SNAT --to $LANIP #www op testserver
iptables -t nat -A POSTROUTING -d $WWW8IP -s $KLANTNET/24 -p tcp --dport www -j SNAT --to $LANIP
iptables -t nat -A POSTROUTING -d $WWW1IP -s $BOUWNET/24 -p tcp --dport www -j SNAT --to $DMZIP
iptables -t nat -A POSTROUTING -d $WWW2IP -s $BOUWNET/24 -p tcp --dport www -j SNAT --to $DMZIP
iptables -t nat -A POSTROUTING -d $WWW3IP -s $BOUWNET/24 -p tcp --dport www -j SNAT --to $DMZIP
iptables -t nat -A POSTROUTING -d $WWW4IP -s $BOUWNET/24 -p tcp --dport www -j SNAT --to $DMZIP
iptables -t nat -A POSTROUTING -d $WWW5IP -s $BOUWNET/24 -p tcp --dport www -j SNAT --to $DMZIP
iptables -t nat -A POSTROUTING -d $WWW6IP -s $BOUWNET/24 -p tcp --dport www -j SNAT --to $DMZIP
iptables -t nat -A POSTROUTING -d $WWW1IP -s $BOUWNET/24 -p tcp --dport ftp -j SNAT --to $DMZIP
iptables -t nat -A POSTROUTING -d $WWW1IP -s $BOUWNET/24 -p tcp --dport ftp-data -j SNAT --to $DMZIP
iptables -t nat -A POSTROUTING -d $WWW9IP -s $BOUWNET /24 -p tcp --dport www -j SNAT --to $LANIP


#Chains for the box itself
#

iptables -N inet-if
iptables -N lan-if
iptables -N dmz-if

#Jump to it
#

iptables -A INPUT -d $INET1IP -j inet-if
iptables -A INPUT -d $INET2IP -j inet-if
iptables -A INPUT -d $INET3IP -j inet-if
iptables -A INPUT -d $INET4IP -j inet-if
iptables -A INPUT -d $INET5IP -j inet-if
iptables -A INPUT -d $INET6IP -j inet-if
iptables -A INPUT -d $INET9IP -j inet-if
iptables -A INPUT -d $INET10IP -j inet-if
iptables -A INPUT -d $INET11IP -j inet-if
iptables -A INPUT -d $DMZIP -j dmz-if
iptables -A INPUT -d $LANIP -j lan-if

#Chain dmz-if
#

iptables -A dmz-if -p icmp -j icmp-acc
iptables -A dmz-if -j LOG
iptables -A dmz-if -j DROP

#Chain inet-if: return MASQ, www, ftp/ftp-data, telnet to router
#

iptables -A inet-if -p tcp --sport ftp -j ACCEPT
iptables -A inet-if -p udp --sport ftp -j ACCEPT
iptables -A inet-if -p tcp --sport ftp-data -j ACCEPT
iptables -A inet-if -p udp --sport ftp-data -j ACCEPT
iptables -A inet-if -p icmp -j icmp-acc
iptables -A inet-if -j LOG
iptables -A inet-if -j DROP

#Chain lan-if: ssh only, ftp, logcheck mail
#

iptables -A lan-if -p tcp --dport ssh -j ACCEPT
iptables -A lan-if -p udp --dport ssh -j ACCEPT
iptables -A lan-if -p icmp -j icmp-acc
iptables -A lan-if -j LOG
iptables -A lan-if -j DROP

#Clearing the block rules
#

iptables -D INPUT 1
iptables -D OUTPUT 1
iptables -D FORWARD 1

Verwijderd

Topicstarter
Ok pfft wat een waslijst he...
maar goed ben dus met mijn eigen linux bak bezig.
en zit me nu toch echt aftevragen waar ik die waslijst
neer moet zetten.
ben op het internet wezen kijken en vindt daar niet echt het antwoord..

mijn config tot nu toe.
redhat 7.2 laaste updates van redhat er overheen
pc met 3 nics
eth0 eth1 eth2
ok nu die rulebase er in.....
HOE?
en wat moet ik hier aan veranderen om de firewall ook echt een firewall te laten zijn?
wand volgens mij staat hij HELEMAAL open!

  • Arjan A
  • Registratie: November 2000
  • Laatst online: 22:03

Arjan A

Cenosillicafoob

#!/bin/sh
Dit is dus een shell script, je kan hem gewoon vanaf de shell laden. Als hij bij boot geladen moet worden zet je hem inde /etc/rc.d directory, een start je hem op vanuit /etc/rc.d/rc.local .

Type eens man iptables voor uitleg over de parameters op iptables. Dan zul je de commando's in je script ook begrijpen. Als ik er snel* langslees zie ik dat eerst alles geflushed wordt, de boel dichtgegooid wordt en dan per service geaccepteerd wordt.

* ) Dus misschien niet volledig of juist

Canon EOS | DJI M2P
Fotoblog · Mijn werk aan jouw muur


Verwijderd

Topicstarter
[Dit is dus een shell script, je kan hem gewoon vanaf de shell laden. Als hij bij boot geladen moet worden zet je hem inde /etc/rc.d directory, een start je hem op vanuit /etc/rc.d/rc.local]

ok cool. :P
ben de man iptables nu aan het lezen.
had dat ook al op het internet gedaan.

Verwijderd

Topicstarter
ok maar hoe kan ik het script nu handmatig laten draaien?

ik heb hem nu in mijn home staan als "test"
als ik het script nu uit voer door in de shell
test [enter] te typen
krijg ik gewoon de promt weer terug ...
hoe kan ik nu testen dat het ook daat werkelijk wat doet?

  • Arjan A
  • Registratie: November 2000
  • Laatst online: 22:03

Arjan A

Cenosillicafoob

Op maandag 06 mei 2002 00:31 schreef MM_Zork het volgende:
ok maar hoe kan ik het script nu handmatig laten draaien?

met zoiets als exec 'bestandnaam" ???
Kan op twee manieren:

./bestandsnaam (vooropgesteld dat je in de juiste directory zit)
sh bestandsnaam (bestandsnaam moet eventueel het hele pad bevatten)

Canon EOS | DJI M2P
Fotoblog · Mijn werk aan jouw muur


  • Arjan A
  • Registratie: November 2000
  • Laatst online: 22:03

Arjan A

Cenosillicafoob

Op maandag 06 mei 2002 00:31 schreef MM_Zork het volgende:
ok maar hoe kan ik het script nu handmatig laten draaien?

ik heb hem nu in mijn home staan als "test"
als ik het script nu uit voer door in de shell
test [enter] te typen
krijg ik gewoon de promt weer terug ...
hoe kan ik nu testen dat het ook daat werkelijk wat doet?
Hehe, niet gan editen als ik ook aan het replyen ben :D
Als je wil weten of-ie het doet, moet je gewoon hier en daar een echo zetten, bijv
code:
1
echo -n "Starting to flush..."

Om te checken of alles werkt kan je

iptables -L

doen. Dit geeft een List van alle rules. check de manpage :)

Canon EOS | DJI M2P
Fotoblog · Mijn werk aan jouw muur


Verwijderd

Topicstarter
hehe lol
ok ./test in root werkte niet
sh test wel...
maar krijg errors :(

"iptables v1.2.4: can't initialize iptables table `nat": iptables who? (do you need to insmod?)
Perhaps iptables or you kernel needs to be upgraded."

ik hoop het laaste niet... :(

  • Arjan A
  • Registratie: November 2000
  • Laatst online: 22:03

Arjan A

Cenosillicafoob

Op maandag 06 mei 2002 01:00 schreef MM_Zork het volgende:
hehe lol
ok ./test in root werkte niet
sh test wel...
maar krijg errors :(

"iptables v1.2.4: can't initialize iptables table `nat": iptables who? (do you need to insmod?)
Perhaps iptables or you kernel needs to be upgraded."

ik hoop het laaste niet... :(
Perhaps wel dus :)
Voordeel: je kan hem als module compilen (dus zonder de kernel te hoeven recompilen).
Als je de sources hebt:
make (x|menu|)config
zet iptables op module
make modules
make modules_install
probeer nogeens het script uit te voeren

PS als je ./test wil uitvoeren, moet je

chmod +x test

doen, dat maakt ./test uitvoerbaar (=eXecutable) :)

Canon EOS | DJI M2P
Fotoblog · Mijn werk aan jouw muur


Verwijderd

Topicstarter
Niet leuk :(

na eerst maar eens een reboot

Verwijderd

Topicstarter
ok reboot
en chmod +x test gedaan
netwerk kaarten gecontroleerd en op redhad gekeken of ik de laaste updates heb... [dat is het geval ja]

hier een dump van de foutmeldingen die me hier om de oren vliegen.

[root@localhost root]# ./test
Using /lib/modules/2.4.7-10/kernel/net/ipv4/netfilter/ip_conntrack.o
/lib/modules/2.4.7-10/kernel/net/ipv4/netfilter/ip_conntrack.o: init_module: Device or resource busy
Hint: insmod errors can be caused by incorrect module parameters, including invalid IO or IRQ parameters
Using /lib/modules/2.4.7-10/kernel/net/ipv4/netfilter/ip_nat_ftp.o
/lib/modules/2.4.7-10/kernel/net/ipv4/netfilter/ip_nat_ftp.o: unresolved symbol ip_nat_mangle_tcp_packet_R5dd99449
/lib/modules/2.4.7-10/kernel/net/ipv4/netfilter/ip_nat_ftp.o: unresolved symbol ip_nat_expect_register_Rbc0770d1/lib/modules/2.4.7-10/kernel/net/ipv4/netfilter/ip_nat_ftp.o: unresolved symbol ip_nat_setup_info_R760e15ae
/lib/modules/2.4.7-10/kernel/net/ipv4/netfilter/ip_nat_ftp.o: unresolved symbol ip_nat_helper_register_R8d4a323e/lib/modules/2.4.7-10/kernel/net/ipv4/netfilter/ip_nat_ftp.o: unresolved symbol ip_nat_expect_unregister_R0070b59d
/lib/modules/2.4.7-10/kernel/net/ipv4/netfilter/ip_nat_ftp.o: unresolved symbol ip_conntrack_expect_related_R4360eabc
/lib/modules/2.4.7-10/kernel/net/ipv4/netfilter/ip_nat_ftp.o: unresolved symbol ip_nat_seq_adjust_Rb67e3eb2
/lib/modules/2.4.7-10/kernel/net/ipv4/netfilter/ip_nat_ftp.o: unresolved symbol ip_nat_helper_unregister_Rdc66d756
/lib/modules/2.4.7-10/kernel/net/ipv4/netfilter/ip_nat_ftp.o: unresolved symbol ip_nat_delete_sack_R83a92205
/lib/modules/2.4.7-10/kernel/net/ipv4/netfilter/ip_nat_ftp.o:
Hint: You are trying to load a module without a GPL compatible license
and it has unresolved symbols. Contact the module supplier for
assistance, only they can help you.

Using /lib/modules/2.4.7-10/kernel/net/ipv4/netfilter/ip_conntrack_ftp.o
/lib/modules/2.4.7-10/kernel/net/ipv4/netfilter/ip_conntrack_ftp.o: unresolved symbol ip_conntrack_helper_unregister_Rad948df5
/lib/modules/2.4.7-10/kernel/net/ipv4/netfilter/ip_conntrack_ftp.o: unresolved symbol ip_conntrack_expect_related_R4360eabc
/lib/modules/2.4.7-10/kernel/net/ipv4/netfilter/ip_conntrack_ftp.o: unresolved symbol ip_conntrack_helper_register_R5999fe2b
/lib/modules/2.4.7-10/kernel/net/ipv4/netfilter/ip_conntrack_ftp.o:
Hint: You are trying to load a module without a GPL compatible license
and it has unresolved symbols. Contact the module supplier for
assistance, only they can help you.

/lib/modules/2.4.7-10/kernel/net/ipv4/netfilter/ip_tables.o: init_module: Device or resource busy
Hint: insmod errors can be caused by incorrect module parameters, including invalid IO or IRQ parameters
/lib/modules/2.4.7-10/kernel/net/ipv4/netfilter/ip_tables.o: insmod /lib/modules/2.4.7-10/kernel/net/ipv4/netfilter/ip_tables.o failed
/lib/modules/2.4.7-10/kernel/net/ipv4/netfilter/ip_tables.o: insmod ip_tables failed
iptables v1.2.4: can't initialize iptables table `filter': iptables who? (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.

ok wat moet ik nu precies doen?
:'(

  • Arjan A
  • Registratie: November 2000
  • Laatst online: 22:03

Arjan A

Cenosillicafoob

Op maandag 06 mei 2002 01:48 schreef MM_Zork het volgende:
<knip ellende>

ok wat moet ik nu precies doen?
:'(
Ik denk dat je eens een nieuwe kernel moet downloaden, die configureren naar jouw behoeften op die machine, en compilen, eventueel met de modules.
Die "unresolved symbols" geven aan dat er meer niet is gecompileerd in die kernel. Zal wel een standaard RedHat kernel zijn.
Dit is BTW wel je kans om je van je linux-n00b status af te komen >:)
Mijn tip:
Nieuwe kernel binnenhalen, documentatie erbij lezen (vooral de requirements voor de rest v/d packages, hoewel je die volgens mij niet nodig hebt aangezien ik ook op RH7.2 een iptables-firewall draai)
configureren
compilen
installeren
rebooten

Ik draai nu kernel 2.4.18 onder een RH7(.2?) install, sommige configuraties op mijn systeem bestaan al vanaf kernel 2.0.32!

BTW ik ga je beginpost nog een keer lezen voor achtergrondinformatie :)

Canon EOS | DJI M2P
Fotoblog · Mijn werk aan jouw muur


  • Koffie
  • Registratie: Augustus 2000
  • Laatst online: 23:08

Koffie

Koffiebierbrouwer

Braaimeneer

Move [forum=24] > [forum=23]

Braaikamer - Smoke&BBQ

Pagina: 1