Zoek een goede firewall

Pagina: 1
Acties:

  • Slaiter
  • Registratie: Juni 2001
  • Niet online

Slaiter

Firesnake

Topicstarter
Ik zoek een goede firewall voor linux met een niet al te hoge leercurve.
Ik heb al wat geprobeerd met iptables, maar daar kom ik totaal niet uit (krijg niets op stealth) en dus heb ik ook maar eens guarddog geprobeerd (wel alles stealth) echter als ik die gebruik kan mijn vriendin niet meer op internet (aangezien die via mijn pc (=workstation&router) op het internet gaat.
Is er ook een simpele firewall (grafisch) die gewoon mijn ip masq met rust laat :?

Heb al het nodige geprobeerd o.a.
netfilter geprobeerd (krijg elke keer de melkding dat iptables dood is :? )
Easyfirewall (zo easy is die niet)
en Guarddog (nogtoe de meest handige, maar geen lan mogelijkheid)

  • Flappie
  • Registratie: Februari 2001
  • Laatst online: 07:03
Smoothwall het complete besturings systeem met firewall, IP routing enzow.

PC draait dan alleen nog als server en kan NIET op worden gewerkt!

  • LAN
  • Registratie: Oktober 2000
  • Niet online

LAN

portsentry is niet al te moeilijk.

  • 2P
  • Registratie: November 2001
  • Laatst online: 21-06 01:34

2P

:wq

Als je de poort op stealth mode wilt zetten moet je gebruik maken van 'DROP'. Als iemand op die poort probeert te connecten zal je Linux server niets doen. De client zal dan na een paar seconden een timeout krijgen. Dit wordt dan stealth genoemt.
Gebruik je 'DENY' op een bepaalde poort en iemand probeert op die poort te connecten dan zal je Linux server tegen de client zeggen dat dat niet mag ;) dus poort closed.
Ok dit moest ik even kwijt over stealth mode etc...

Ik post hier maar even mijn firewall script (met NAT).
Heb ik niet helemaal zelf gemaakt, veel dingen afgekeken van andere scripts :Y)
En verder is het heel erg simpel. Let wel op dat je huidige iptables instellingen worden verwijderd door dit script.
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/bin/sh
#
# rc.firewall - Very easy iptables firewall/masquerading script
#

# location of iptables program
IPTABLES="/usr/local/sbin/iptables"

# static ip on internet
INET_IP="123.123.123.123"

# interface for internet
INET_INTERFACE="eth0"


echo "iptables firewall/masquerading script started..."

# flush all rules in filter/NAT table
$IPTABLES --flush
$IPTABLES --table nat --flush

# Masquerading / NAT
$IPTABLES --append POSTROUTING --table nat --out-interface $INET_INTERFACE --jump SNAT --to $INET_IP

# Allow any existing connections or anything related
$IPTABLES --append INPUT --match state --state ESTABLISHED,RELATED --jump ACCEPT

# Allow new connections only from our network (the ! means anything BUT)
$IPTABLES --append INPUT --match state --state NEW --in-interface ! $INET_INTERFACE --jump ACCEPT

# Deny everything else
$IPTABLES --policy INPUT DROP

$IPTABLES --append FORWARD --in-interface $INET_INTERFACE --out-interface $INET_INTERFACE --jump REJECT


#
# ICMP rules
#

# Echo reply
$IPTABLES -A INPUT -p ICMP -s 0/0 --icmp-type 0 -j ACCEPT

# Errors
$IPTABLES -A INPUT -p ICMP -s 0/0 --icmp-type 3 -j ACCEPT

# Redirection
$IPTABLES -A INPUT -p ICMP -s 0/0 --icmp-type 5 -j ACCEPT

# Echo request
#$IPTABLES -A INPUT -p ICMP -s 0/0 --icmp-type 8 -j ACCEPT

# Time to Live (TTL)
$IPTABLES -A INPUT -p ICMP -s 0/0 --icmp-type 11 -j ACCEPT


#
# TCP rules
#

# ftp-data (20) and ftp (21)
$IPTABLES --append INPUT --protocol tcp --dport 20 --jump ACCEPT
$IPTABLES --append INPUT --protocol tcp --dport 21 --jump ACCEPT

# ssh (22)
$IPTABLES --append INPUT --protocol tcp --dport 22 --jump ACCEPT

# smtp (25)
$IPTABLES --append INPUT --protocol tcp --dport 25 --jump ACCEPT

# http (80)
$IPTABLES --append INPUT --protocol tcp --dport 80 --jump ACCEPT

# ident (113)
$IPTABLES --append INPUT --protocol tcp --dport 113 --jump ACCEPT

# IMAP (143)
$IPTABLES --append INPUT --protocol tcp --dport 143 --jump ACCEPT

# https (443)
$IPTABLES --append INPUT --protocol tcp --dport 443 --jump ACCEPT

# IRC (6667-7000)
$IPTABLES --append INPUT --protocol tcp --dport 6667:7000 --jump ACCEPT


#
# UDP rules
#


# Direct Connect search mode (412)
$IPTABLES --append INPUT --protocol udp --source-port 412 --jump ACCEPT

# ICQ (4000)
$IPTABLES --append INPUT --protocol udp --source-port 4000 --jump ACCEPT

# Unreal Tournament (7777)
$IPTABLES --append INPUT --protocol udp --source-port 7777 --jump ACCEPT


#
# Block obviously spoofed ip's
#

$IPTABLES -A INPUT -i $INET_INTERFACE -s 192.168.0.0/16 -j DROP
$IPTABLES -A INPUT -i $INET_INTERFACE -s 10.0.0.0/8 -j DROP
$IPTABLES -A INPUT -i $INET_INTERFACE -s 172.16.0.0/12 -j DROP


echo "done."

  • deadinspace
  • Registratie: Juni 2001
  • Laatst online: 16-08 16:08

deadinspace

The what goes where now?

Op maandag 22 april 2002 18:05 schreef LAN het volgende:
portsentry is niet al te moeilijk.
Ik kan me vergissen, maar volgensmij is portsentry alleen een IDS, geen firewall config tool...

  • 2P
  • Registratie: November 2001
  • Laatst online: 21-06 01:34

2P

:wq

Op maandag 22 april 2002 18:05 schreef LAN het volgende:
portsentry is niet al te moeilijk.
portsentry is geen firewall.
Dit is een progsel die portscans kan detecteren, meer niet ;)

  • LAN
  • Registratie: Oktober 2000
  • Niet online

LAN

Op maandag 22 april 2002 18:09 schreef 2P het volgende:

[..]

portsentry is geen firewall.
Dit is een progsel die portscans kan detecteren, meer niet ;)
Okido, weten we dat ook weer.

  • Eärendil
  • Registratie: Februari 2002
  • Laatst online: 08:05
Ik gebruik het volgende:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/sh
#Bootstrapping Iptables
# Insert connection-tracking modules (only needed if not built into the kernel).

modprobe ip_tables
modprobe ip_conntrack
modprobe ip_conntrack_ftp    # (needed only if you plan on using FTP)

# Set the default policies - sets the default actions of the built-in chains.

iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT

# Flush chains

iptables -F
iptables -F -t nat

# Blocks all new connections unless initiated from the "protected" network.

iptables -N state_chk
iptables -A state_chk -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A state_chk -m state --state NEW -i ! eth1 -j ACCEPT
iptables -A state_chk -j DROP

# Jump to the state_chk chain from INPUT and FORWARD chains.

iptables -A INPUT -j state_chk
iptables -A FORWARD -j state_chk
#Masquerade connections - only needed on the firewall box if you have an internal network that you wish to route traffic to and from the Internet.

# Enable IP forwarding between the interfaces - remember to disable this if you're going to unload the Iptables rules.

echo "1" > /proc/sys/net/ipv4/ip_forward

# Load the NAT modules - needed only if you compiled as modules

modprobe iptable_nat
modprobe ip_nat_ftp  #(needed only if you plan on using FTP)

# Enable IP masquerading - Use if your eth0 has a dynamic IP address. For static IP, it's recommended that you use source NAT instead.

#iptables -t nat -A POSTROUTING -o eth1 -s 192.168.0.0/24 -j MASQUERADE

# Enable source NAT - Use if your eth0 has a static IP address.

iptables -t nat -A POSTROUTING -o eth1 -s 192.168.0.0/24 -j SNAT --to 10.0.0.150

Even wat uitleg:
eth0 = 192.168.0.1 = intern
eth1 = 10.0.0.150 = extern

Alle bestaande en related verbindingen worden toegestaan, nieuwe verbindingen die niet op de externe interface komen ook toegestaan, de rest: DROP

Internet wordt voor het lokale netwerk gedeeld met SNAT
Pagina: 1