Changeset ad04bbc3dc5adfe3e75690b34a04448840efeffb

Show
Ignore:
Timestamp:
04/18/09 12:33:01 (3 years ago)
Author:
Neutron Soutmun <neo.neutron@…>
Children:
ebf1b313a3bf00f239329f7fe3a81e40e23b0296
Parents:
ae7e7e4f3e3672207f051839f33df6649f41dca1
git-committer:
Neutron Soutmun <neo.neutron@…> (04/18/09 12:33:01)
Message:

Handle dhcp request, tune http access performance

2009-04-18 Neutron Soutmun <neo.neutron@…>

  • example/{rahunas,rahunas-vserver}.conf.in, tools/firewall.sh.in:
    • Remove dhcp field from vserver config due to the dhcp request is broadcast message could not be classified which vserver it is.
    • Remove dhcp_range from vserver config which will consider later how to handle it.
    • Move the dhcp firewall code from vserver section to policy.
    • Adjust the webserver access limit rate for performance tuning.
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • ChangeLog

    rae7e7e4 rad04bbc  
     12009-04-18  Neutron Soutmun <neo.neutron@gmail.com> 
     2 
     3        * example/{rahunas,rahunas-vserver}.conf.in, tools/firewall.sh.in: 
     4          - Remove dhcp field from vserver config due to the dhcp request is broadcast 
     5            message could not be classified which vserver it is. 
     6          - Remove dhcp_range from vserver config which will consider later how to 
     7            handle it. 
     8          - Move the dhcp firewall code from vserver section to policy. 
     9          - Adjust the webserver access limit rate for performance tuning. 
     10 
    1112009-04-18  Neutron Soutmun <neo.neutron@gmail.com> 
    212 
  • example/rahunas-vserver.conf.in

    rd7b5c9e rad04bbc  
    1717  idle_timeout = "600" 
    1818 
    19   dhcp = "yes" 
    20   dhcp_range = "172.30.0.10 172.30.3.254" 
    2119  dns = "yes" 
    2220  ssh = "yes" 
  • example/rahunas.conf.in

    rd7b5c9e rad04bbc  
    99  log_file = "@localstatedir@/log/rahunas/rahunas.log" 
    1010 
     11  dhcp = "yes" 
     12 
    1113  bandwidth_shape = "yes"   
    1214  bittorrent_download_max = "512" 
  • tools/firewall.sh.in

    rae7e7e4 rad04bbc  
    4848MAIN_BITTORRENT_DOWNLOAD_MAX=`get_config_value main bittorrent_download_max $RAHUNAS_CONFIG` 
    4949MAIN_BITTORRENT_UPLOAD_MAX=`get_config_value main bittorrent_upload_max $RAHUNAS_CONFIG` 
     50MAIN_DHCP=`get_config_value main dhcp $RAHUNAS_CONFIG` 
    5051 
    5152# Virtual Server : config 
     
    6061EXCLUDED= 
    6162BANDWIDTH_SHAPE= 
    62 DHCP= 
    6363DNS= 
    6464SSH= 
     
    124124  EXCLUDED=`get_config_value $NAME excluded $file` 
    125125  BANDWIDTH_SHAPE=$MAIN_BANDWIDTH_SHAPE 
    126   DHCP=`get_config_value $NAME dhcp $file` 
    127126  DNS=`get_config_value $NAME dns $file` 
    128127  SSH=`get_config_value $NAME ssh $file` 
     
    379378 
    380379  $IPTABLES -A INPUT -i lo -j ACCEPT 
     380 
     381  # DHCP Settings 
     382 
     383  if [ "$MAIN_DHCP" = "yes" ]; then 
     384    $IPTABLES -A INPUT -p udp --dport 67:68 -j ACCEPT  
     385    $IPTABLES -A FORWARD -p udp --dport 67:68 -j DROP 
     386  elif [ "$MAIN_DHCP" = "no" ]; then 
     387    $IPTABLES -A INPUT -p udp --dport 67:68 -j DROP  
     388    $IPTABLES -A FORWARD -p udp --dport 67:68 -j DROP 
     389  elif [ "$MAIN_DHCP" = "forward" ]; then 
     390    $IPTABLES -A INPUT -p udp --dport 67:68 -j DROP  
     391    $IPTABLES -A FORWARD -p udp --dport 67:68 -j ACCEPT 
     392  fi 
    381393} 
    382394 
     
    388400 
    389401  $IPTABLES -D INPUT -i lo -j ACCEPT 
     402 
     403  # DHCP Settings 
     404 
     405  if [ "$MAIN_DHCP" = "yes" ]; then 
     406    $IPTABLES -D INPUT -p udp --dport 67:68 -j ACCEPT  
     407    $IPTABLES -D FORWARD -p udp --dport 67:68 -j DROP 
     408  elif [ "$MAIN_DHCP" = "no" ]; then 
     409    $IPTABLES -D INPUT -p udp --dport 67:68 -j DROP  
     410    $IPTABLES -D FORWARD -p udp --dport 67:68 -j DROP 
     411  elif [ "$MAIN_DHCP" = "forward" ]; then 
     412    $IPTABLES -D INPUT -p udp --dport 67:68 -j DROP  
     413    $IPTABLES -D FORWARD -p udp --dport 67:68 -j ACCEPT 
     414  fi 
    390415} 
    391416 
     
    422447  $IPTABLES -A $CHAIN_INPUT -p tcp -m multiport -d $VSERVER_IP\ 
    423448     --dports $VSERVER_PORTS_ALLOW \ 
    424     -m recent --rcheck --seconds 15 --name incoming_throttle -j DROP 
     449    -m recent --rcheck --seconds 6 --name incoming_throttle -j DROP 
    425450 
    426451  $IPTABLES -A $CHAIN_INPUT -p tcp -m multiport -d $VSERVER_IP \ 
    427452    --dports $VSERVER_PORTS_ALLOW \ 
    428     -m hashlimit --hashlimit 5/sec \ 
    429     --hashlimit-mode srcip --hashlimit-burst 10 \ 
    430     --hashlimit-htable-expire 15000 --hashlimit-name incoming \ 
     453    -m hashlimit --hashlimit 20/sec \ 
     454    --hashlimit-mode srcip --hashlimit-burst 30 \ 
     455    --hashlimit-htable-expire 4000 --hashlimit-name incoming \ 
    431456    -j ACCEPT 
    432457 
     
    448473    -d $VSERVER_IP -j ACCEPT 
    449474 
    450   ## 
    451   # Allow incoming DHCP request 
    452   ## 
    453  
    454   if [ "$DHCP" = "yes" ]; then 
    455     $IPTABLES -A $CHAIN_INPUT -p udp --dport 67:68 -j ACCEPT  
    456     $IPTABLES -A $CHAIN_FORWARD -p udp --dport 67:68 -j DROP 
    457   elif [ "$DHCP" = "no" ]; then 
    458     $IPTABLES -A $CHAIN_INPUT -p udp --dport 67:68 -j DROP  
    459     $IPTABLES -A $CHAIN_FORWARD -p udp --dport 67:68 -j DROP 
    460   elif [ "$DHCP" = "forward" ]; then 
    461     $IPTABLES -A $CHAIN_INPUT -p udp --dport 67:68 -j DROP  
    462     $IPTABLES -A $CHAIN_FORWARD -p udp --dport 67:68 -j ACCEPT 
    463   fi 
     475 
    464476 
    465477  ##