Iptables probleempjuh

Pagina: 1
Acties:

  • DeVoTioN
  • Registratie: Augustus 2001
  • Laatst online: 07-03-2022
Op me oude bak draai ik nu rh 7.2 en heb daarop een Quake3 server geinstalleerd. Alleen ik zie de server niet intern of extern :( Volgens mij ligt het aan me firewall alleen ik weet nog niet zoveel van iptables.
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
112
113
114
115
116
117
118
119
#!/bin/sh

IPTABLES="/sbin/iptables"

#Time to clean house

#Clear out any existing firewall rules, and any chains that might have
#been created
$IPTABLES -F
$IPTABLES -F INPUT
$IPTABLES -F OUTPUT
$IPTABLES -F FORWARD
$IPTABLES -F -t mangle
$IPTABLES -F -t nat
$IPTABLES -X

#Setup our policies
$IPTABLES -P INPUT DROP
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -P FORWARD ACCEPT

#This enables ip forwarding, and thus by extension, NAT
#Turn this on if you're going to be doing NAT or Masquerading
echo 1 > /proc/sys/net/ipv4/ip_forward


#Our actual rules

#Our NAT stuff

#Source NAT everything heading out the eth0 (external) interface to be the
#given IP. If you have a dynamic ip or a DHCP ip that changes
#semi-regularly, comment this and uncomment the second line
#
#Remember to change the ip address to your static ip
#
$IPTABLES -t nat -A POSTROUTING -o eth0 -j SNAT --to 213.51.72.9

#$IPTABLES -t nat -A POSTROUTING -o eth0 -j MASQUERADE

#These are port-forwarding examples for several different cases.
#These map the specified ports to the specified ip address.
#
#This one maps port 80 to 192.168.1.1. Anything incoming over eth0 to
#the server will be redirected invisibly to port 80 on 192.168.1.1
$IPTABLES -t nat -A PREROUTING -i eth0 -p udp --dport 27960 -j DNAT --to 192.168.1.20
#
#These two redirect a block of ports, in both udp and tcp.
#$IPTABLES -t nat -A PREROUTING -i eth0 -p tcp --dport 2300:2400 -j DNAT --to 192.168.1.1
#$IPTABLES -t nat -A PREROUTING -i eth0 -p udp --dport 2300:2400 -j DNAT --to 192.168.1.1


#Now, our firewall chain
#We use the limit commands to cap the rate at which it alerts to 15
#log messages per minute
$IPTABLES -N firewall
$IPTABLES -A firewall -m limit --limit 15/minute -j LOG --log-prefix Firewall:
$IPTABLES -A firewall -j DROP

#Now, our dropwall chain, for the final catchall filter
$IPTABLES -N dropwall
$IPTABLES -A dropwall -m limit --limit 15/minute -j LOG --log-prefix Dropwall:
$IPTABLES -A dropwall -j DROP

#Our "hey, them's some bad tcp flags!" chain
$IPTABLES -N badflags
$IPTABLES -A badflags -m limit --limit 15/minute -j LOG --log-prefix Badflags:
$IPTABLES -A badflags -j DROP

#And our silent logging chain
$IPTABLES -N silent
$IPTABLES -A silent -j DROP


#Accept ourselves (loopback interface), 'cause we're all warm and friendly
$IPTABLES -A INPUT -i lo -j ACCEPT

#Drop those nasty packets!
#These are all TCP flag combinations that should never, ever occur in the
#wild. All of these are illegal combinations that are used to attack a box
#in various ways, so we just drop them and log them here.
$IPTABLES -A INPUT -p tcp --tcp-flags ALL FIN,URG,PSH -j badflags
$IPTABLES -A INPUT -p tcp --tcp-flags ALL ALL -j badflags
$IPTABLES -A INPUT -p tcp --tcp-flags ALL SYN,RST,ACK,FIN,URG -j badflags
$IPTABLES -A INPUT -p tcp --tcp-flags ALL NONE -j badflags
$IPTABLES -A INPUT -p tcp --tcp-flags SYN,RST SYN,RST -j badflags
$IPTABLES -A INPUT -p tcp --tcp-flags SYN,FIN SYN,FIN -j badflags

#Drop icmp, but only after letting certain types through
$IPTABLES -A INPUT -p icmp --icmp-type 0 -j ACCEPT
$IPTABLES -A INPUT -p icmp --icmp-type 3 -j ACCEPT
$IPTABLES -A INPUT -p icmp --icmp-type 11 -j ACCEPT
$IPTABLES -A INPUT -p icmp --icmp-type 8 -m limit --limit 1/second -j ACCEPT
$IPTABLES -A INPUT -p icmp -j firewall

#Accept SSH connections from everywhere.
#Uncomment this if you're running SSH and want to be able to access it
#from the outside world.
#
#$IPTABLES -I in_udp -p udp --dport 22 -j ACCEPT

#Accept all from eth1
$IPTABLES -A INPUT -i eth1 -s 192.168.1.0/24 -j ACCEPT

#Lets do some basic state-matching
#This allows us to accept related and established connections, so
#client-side things like ftp work properly, for example.
$IPTABLES -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT

#Uncomment to drop port 137 netbios packets silently. We don't like
#that netbios stuff, and it's #way too spammy with windows machines on
#the network.
#
$IPTABLES -A INPUT -p udp --sport 137 --dport 137 -j silent

#Our final trap. Everything on INPUT goes to the dropwall so we don't get silent drops
$IPTABLES -A INPUT -j dropwall

echo "*** === FIREWALL UP ! === ***"

Ik heb ook logcheck installed die me elk uur mailed en daar staat dit in :
code:
1
2
3
4
Unusual System Events
=-=-=-=-=-=-=-=-=-=-=
Feb  7 23:00:04 cp11582-a kernel: Dropwall:IN=eth0 OUT= MAC=ff:ff:ff:ff:ff:ff:00:00:c5:0d:fe:c7:08:00 SRC=217.120.121.7 DST=255.255.255.255 LEN=160 TOS=0x00 PREC=0x00 TTL=128 ID=49872 PROTO=UDP SPT=1663 DPT=1900 LEN=140 
Feb  7 23:00:04 cp11582-a kernel: Dropwall:IN=eth0 OUT= MAC=ff:ff:ff:ff:ff:ff:00:00:c5:0d:fe:c7:08:00 SRC=217.120.121.7 DST=255.255.255.255 LEN=161 TOS=0x00 PREC=0x00 TTL=128 ID=50128 PROTO=UDP SPT=1663 DPT=1900 LEN=141

enz....

Weet iemand wat er fout is in mn firewall :? bvd.

  • DeVoTioN
  • Registratie: Augustus 2001
  • Laatst online: 07-03-2022
Niemand :?

Weet iemand wat die log errors betekene ?

Verwijderd

Lijkt erop dat je firewall een aantal udp packets met als destination port 1900 denied.
code:
1
iptables -A INPUT -s 217.120.121.7 -p udp --dport 1900 -j ACCEPT

Verder lijkt het mij ook niet zo slim om de default policy van forward op accept te zetten ;)