[FreeBSD] eigen server mag ik niet op...

Pagina: 1
Acties:

  • TriLithium
  • Registratie: December 1999
  • Laatst online: 16-08 16:12

TriLithium

7800Wp E/W + 7.5 kW Ecodan

Topicstarter
Vaag probleem. zit hier met een firewall/server die ik gisteren van ipfw naar ipf heb gemaakt. voor dit alles heb ik een make world gedaan op de oude kernel config, ging goed, alles werkte nog, toen nieuwe kernel gemaakt voor ipfilter, dit door:
code:
1
2
3
4
5
6
7
8
options   IPFIREWALL          #firewall
options   IPDIVERT          #divert sockets
options   IPFIREWALL_VERBOSE    #print information about
                            # dropped packets
options   IPFIREWALL_VERBOSE_LIMIT=100 #limit verbosity
options   TCP_DROP_SYNFIN      #drop TCP packets with SYN+FIN
options   TCP_RESTRICT_RST    #restrict emission of TCP RST
options   ICMP_BANDLIM

te veranderen in dit:
code:
1
2
3
options    IPFILTER
options    IPFILTER_LOG
options    IPFILTER_DEFAULT_BLOCK

mooi, ff rottelen, kernel klaar.
Direkt in /etc/rc.conf van
code:
1
2
3
4
5
6
7
8
firewall_enable="YES"       # Set to YES to enable firewall functionality
firewall_quiet="NO"     # Set to YES to suppress rule display
firewall_script="/etc/rc.firewall"  # Which script to run to set up the firewall
firewall_type="open"         # Firewall type (see /etc/rc.firewall)
natd_enable="YES"         # Enable natd (if firewall_enable == YES).
natd_flags="-f /etc/natd.conf" # Additional flags for natd.
natd_interface="xl0"         # Public interface or IPaddress to use.
natd_program="/sbin/natd"   # path to natd, if you want a different one.

naar
code:
1
2
3
4
ipfilter_enable="YES"
ipmon_enable="YES"
ipmon_flags="-Dsvn"
ipnat_enable="YES"

gegaan. lijkt mij allemaal goed te zijn.
Ook even een /etc/ipf.rules gemaakt:
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
#################################################################
# Outside Interface
#################################################################

#----------------------------------------------------------------
# Allow out all TCP, UDP, and ICMP traffic & keep state on it
# so that it's allowed back in.
#----------------------------------------------------------------
pass out quick on xl0 proto tcp from any to any keep state
pass out quick on xl0 proto udp from any to any keep state
pass out quick on xl0 proto icmp from any to any keep state
block out quick on xl0 all

#----------------------------------------------------------------
# Different Services Are Allowed In.
#----------------------------------------------------------------

# SSH
pass in quick on xl0 proto tcp/udp from any to any port = ssh keep state
# DHCP
pass in quick on xl0 proto tcp/udp from 212.142.28.180/32 to any port = bootpc keep state
# Apache
pass in quick on xl0 proto tcp from any to any port = http flags S keep state
# Ident requests
pass in quick on xl0 proto tcp/udp from any to any port = ident keep state
# Socks Server
pass in quick on xl0 proto tcp/udp from any to any port = socks keep state
# DNETC Proxy
pass in quick on xl0 proto tcp/udp from any to any port = 2064 keep state
                             
#----------------------------------------------------------------
# Block and log all remaining traffic coming into the firewall
# - Block TCP with a RST (to make it appear as if the service
# isn't listening)               
# - Block UDP with an ICMP Port Unreachable (to make it appear
# as if the service isn't listening)     
# - Block all remaining traffic the good 'ol fashioned way
#----------------------------------------------------------------
block return-rst in log quick on xl0 proto tcp from any to any
block return-icmp-as-dest(port-unr) in log quick on xl0 proto udp from any to any
block in log quick on xl0 all         

#################################################################
# Inside Interface
#################################################################

#----------------------------------------------------------------
# Allow out all TCP, UDP, and ICMP traffic & keep state
#----------------------------------------------------------------
pass out quick on xl1 proto tcp from any to any keep state
pass out quick on xl1 proto udp from any to any keep state
pass out quick on xl1 proto icmp from any to any keep state

#----------------------------------------------------------------
# Allow in all TCP, UDP, and ICMP traffic & keep state
#----------------------------------------------------------------
pass in quick on xl1 proto tcp from any to any keep state
pass in quick on xl1 proto udp from any to any keep state
pass in quick on xl1 proto icmp from any to any keep state

lijkt mij allemaal goed te zijn, wat is nu het probleem na zo'n lang verhaal, nou iedereen die ik gevraagd heb kan op de normale manier op m'n web server komen behalve ik zelf en alle pc die achter die firewall zitten, die geven "No route to host" errors aan.
Alles werkt verder nog perfect zoals eerst behalve m'n webserver is voor interne netwerk niet te bereiken, ik heb na een middag zitten kloten en zoeken niks kunnen vinden.
Weet een van jullie een oplossing?????

  • TriLithium
  • Registratie: December 1999
  • Laatst online: 16-08 16:12

TriLithium

7800Wp E/W + 7.5 kW Ecodan

Topicstarter
ben er ook achter gekomen dat cron niet draait in de nieuwe config.

Heb ook /etc/rc.conf even terug gezet naar de oude situatie en de oude kernel geboot, en dan werkt alles weer. wel met ipfw dan dus, maar dat wil ik niet.

Ik sta echt voor een raadsel, kan iemand helpen???

  • Infern0
  • Registratie: September 2000
  • Laatst online: 13:36

Infern0

Hou die ontzettende rust!!

Kan nu niet op onze server komen @HOMO ligt plat denk ik.

Zodra @HOME up is geef ik mijn conf files wel ff

http://www.bsdfreaks.nl Home site: http://rob.lensen.nu /me was RobL


  • TriLithium
  • Registratie: December 1999
  • Laatst online: 16-08 16:12

TriLithium

7800Wp E/W + 7.5 kW Ecodan

Topicstarter
dat zou wel top zijn, tenmisnte iets om te vergelijken

  • Infern0
  • Registratie: September 2000
  • Laatst online: 13:36

Infern0

Hou die ontzettende rust!!

mijn conf files
Situatie:
@home kabel
|
freebsd met ipfilter
|
intern lan

mijn rc.conf
code:
1
2
3
4
5
6
7
8
network_interfaces="de0 rl0 lo0"
ifconfig_lo0="inet 127.0.0.1"           
ifconfig_de0="DHCP"
ifconfig_rl0="inet 192.168.1.1 netmask 255.255.255.0"
ipfilter_enable="YES"
ipmon_enable="NO"
ipmon_flags="-Dsvn"             
ipnat_enable="YES"

mijn ipfilter rules:
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
#################################################################
# Outside Interface
#################################################################

#----------------------------------------------------------------
# Allow out all TCP, UDP, and ICMP traffic & keep state on it
# so that it's allowed back in.
#----------------------------------------------------------------
pass out quick on de0 proto tcp from any to any keep state
pass out quick on de0 proto udp from any to any keep state
pass out quick on de0 proto icmp from any to any keep state
block out quick on de0 all

#----------------------------------------------------------------
# Allow bootp traffic in from your ISP's DHCP server only.
# Replace X.X.X.X/32 with your ISP's DHCP server address.
#----------------------------------------------------------------
pass in quick on de0 proto udp from xxx.xxxx.xx.xxx/32 to any port = 68 keep state

# loopback pakets left unmolested 
pass in quick on lo0 all 
pass out quick on lo0 all 

# This host only runs sshd, no other services
pass in quick on de0 proto tcp from any to any port = 22 flags S keep state

# Apache Webserver
pass in quick proto tcp from any to any port = 80

# Pop3 server
# pass in quick proto tcp from any to any port = 110 flags S keep state 

# SMTP
pass in quick proto tcp from any to any port = 25 flags S keep state

# FTP Server
pass in quick proto tcp from any to 212.204.164.169/32 port = 21 flags S keep state
pass out proto tcp all keep state

 
# WinVNC
pass in quick on de0 proto tcp from any to any port = 5900

# ICQ
pass in quick on de0 proto tcp/udp from any to any port 2000 >< 2400

#ProxyPer
pass in quick on de0 proto tcp from any to any port = 2064 

# To receive traceroute replies
pass in quick on de0 proto icmp from any to any icmp-type timex keep state

# Outbound traffic from our own IPs is allowed
# Could be made more strict for icmp
pass out quick on de0 proto tcp/udp from 212.204.164.169/32 to any keep state
pass out quick on de0 proto tcp/udp from 192.168.1.0/24 to any keep state
pass out quick on de0 proto icmp from 212.204.164.169/32 to any keep state
pass out quick on de0 proto icmp from 192.168.1.0/24 to any keep state# Block and log all remaining traffic coming into the firewall

# - Block TCP with a RST (to make it appear as if the service
# isn't listening)
# - Block UDP with an ICMP Port Unreachable (to make it appear
# as if the service isn't listening)
# - Block all remaining traffic the good 'ol fashioned way
#----------------------------------------------------------------
block return-rst in log quick on de0 proto tcp from any to any
block return-icmp-as-dest(port-unr) in log quick on de0 proto udp from any to any
block in log quick on de0 all


#################################################################
# Inside Interface
#################################################################

#----------------------------------------------------------------
 # Allow out all TCP, UDP, and ICMP traffic & keep state
#----------------------------------------------------------------
pass out quick on rl0 proto tcp from any to any keep state
pass out quick on rl0 proto udp from any to any keep state
pass out quick on rl0 proto icmp from any to any keep state

#----------------------------------------------------------------
 # Allow in all TCP, UDP, and ICMP traffic & keep state
#----------------------------------------------------------------
pass in quick on rl0 proto tcp from any to any keep state
pass in quick on rl0 proto udp from any to any keep state
pass in quick on rl0 proto icmp from any to any keep state

ipnat rules
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
# Map every IP
# on the local net to our Internet IP
map de0 192.168.1.0/24 -> 212.204.164.169/32 proxy port 21 ftp/tcp
map de0 192.168.1.0/24 -> 0/32

# Redirect some UDP ports for RealAudio to Rick's Machine
rdr de0 212.204.164.169/32 port 6970 -> 192.168.1.2 port 6970 udp
# rdr de0 212.120.117/32 port 6971 -> 192.168.1.2 port 6971 udp
# rdr de0 ${extip}/32 port 6972 -> 192.168.1.2 port 6972 udp
# rdr de0 ${extip}/32 port 6973 -> 192.168.1.2 port 6973 udp
# rdr de0 ${extip}/32 port 6974 -> 192.168.1.2 port 6974 udp
#rdr de0 ${extip}/32 port 6975 -> 192.168.1.2 port 6975 udp


# Redirect some ports from outside for ICQ

rdr de0 xxx.xxxx.xx.xxx/32 port 2000-2048 -> 192.168.1.2 port 2000 tcp/udp
rdr de0 xxx.xxxx.xx.xxx/32 port 2065-2100 -> 192.168.1.3 port 2065 tcp/udp
rdr de0 xxx.xxxx.xx.xxx/32 port 2101-2150 -> 192.168.1.4 port 2101 tcp/udp
rdr de0 xxx.xxxx.xx.xxx/32 port 2151-2200 -> 192.168.1.5 port 2151 tcp/udp
rdr de0 xxx.xxxx.xx.xxx/32 port 2201-2250 -> 192.168.1.6 port 2201 tcp/udp
rdr de0 xxx.xxxx.xx.xxx/32 port 2251-2300 -> 192.168.1.7 port 2251 tcp/udp

# Redirect the same ports on the internal interface
rdr rl0 xxx.xxxx.xx.xxx/32 port 2000-2048 -> 192.168.1.2 port 2000 tcp/udp

# WinVNC

rdr de0 xxx.xxxx.xx.xxx/32 port 5900 ->  192.168.1.2 port 5900 tcp/udp

kernel options
code:
1
2
3
options  IPFILTER
options  IPFILTER_LOG
options  IPFILTER_DEFAULT_BLOCK

dit was het dan hoop dat je er iets mee kan

http://www.bsdfreaks.nl Home site: http://rob.lensen.nu /me was RobL


  • serkoon
  • Registratie: April 2000
  • Niet online

serkoon

mekker.

"No route to host" is een -routing- kwestie en heeft dus niks met ipfilter te maken.

Controleer dus je routing :)

Als het toch iets anders is, maar daar geeft die error geen reden toe op het eerste gezicht, controleer dan je interne interface en ipnat nog even.

Ik heb een

map xl1 10.0.0.0/24 -> 213.51.67.12/32
en niet
map xl1 10.0.0.0/24 -> 0/32

hoewel dat opzich niet uit zou moeten maken dachtik.


Wie weet heb je d'r wat aan.

  • TriLithium
  • Registratie: December 1999
  • Laatst online: 16-08 16:12

TriLithium

7800Wp E/W + 7.5 kW Ecodan

Topicstarter
controleer je routing zegt ie, tjsa wil ik best doen, maar lijkt me niet logisch als het met ipfw config en kernel wel werkt en met ipf en kernel niet werkt. maar ik zal morgen nog ff naar die ipnat.rules kijken voor die 0>>IP.
Daarna naar die andere configs. al harstikke bedankt voor je ipf.rules daar ben ik al heel blij mee.
De rest hoop ik niet nodig te hebben, maar je weet het niet nou.
Zal morgen weer bezig, nu wel weer genoeg gezien van deze wereld voor vandaag

  • TriLithium
  • Registratie: December 1999
  • Laatst online: 16-08 16:12

TriLithium

7800Wp E/W + 7.5 kW Ecodan

Topicstarter
ok werkt, beiden bedankt, heb weer wat geleerd.
Alleen nog een vraag, voor www.watchmyserver.com is er nodig dat ping wel werkt, maar dat doet ie nu dus niet. hoe krijg ik dit wel werken, kweet dat het met icmp moet, maar hoe pass in dat netjes, kom er niet helemaal uit...

  • serkoon
  • Registratie: April 2000
  • Niet online

serkoon

mekker.

ipfw add $no allow icmp from $watchmyserverip to $myip icmptypes 8

ipfw add $no allow icmp from $myip to $watchmyserverip icmptypes 0

Maarrr.. kan wel gespoofed worden..

  • Infern0
  • Registratie: September 2000
  • Laatst online: 13:36

Infern0

Hou die ontzettende rust!!

Op vrijdag 10 augustus 2001 16:49 schreef serkoon het volgende:
ipfw add $no allow icmp from $watchmyserverip to $myip icmptypes 8

ipfw add $no allow icmp from $myip to $watchmyserverip icmptypes 0

Maarrr.. kan wel gespoofed worden..
mmm niet echt opgelet hij gebruikt ipfilter dus geen ipfw!!!

hier staat hoe:
http://www.obfuscation.org/ipf/ipf-howto.html#TOC_16

zoiezo goed om deze te lezen

http://www.bsdfreaks.nl Home site: http://rob.lensen.nu /me was RobL


  • Leon
  • Registratie: Maart 2000
  • Laatst online: 19-08 12:12

Leon

Rise Of The Robots

pass in quick on de0 proto icmp from 195.179.115.45 to any

Dit is toch goed of niet :?

Eeuwige n00b


  • Infern0
  • Registratie: September 2000
  • Laatst online: 13:36

Infern0

Hou die ontzettende rust!!

zo dus:
code:
1
2
pass in quick on de0 proto icmp from any to extip/24 icmp-type 0
pass in quick on de0 proto icmp from any to extip/24 icmp-type 11

http://www.bsdfreaks.nl Home site: http://rob.lensen.nu /me was RobL

Pagina: 1