| 24 | == Proxy packet filtering firewall == |
| 25 | We gebruiken ipfw (aanzetten in /etc/rc.conf). Script ipfw.sh: |
| 26 | |
| 27 | {{{ |
| 28 | #!/bin/sh - |
| 29 | # Based on /etc/rc.firewall |
| 30 | |
| 31 | allowed2internet="80,443" |
| 32 | maxconnections="10" |
| 33 | |
| 34 | # Suck in the configuration variables. |
| 35 | if [ -z "${source_rc_confs_defined}" ]; then |
| 36 | if [ -r /etc/defaults/rc.conf ]; then |
| 37 | . /etc/defaults/rc.conf |
| 38 | source_rc_confs |
| 39 | elif [ -r /etc/rc.conf ]; then |
| 40 | . /etc/rc.conf |
| 41 | fi |
| 42 | fi |
| 43 | |
| 44 | setup_loopback () { |
| 45 | ############ |
| 46 | # Only in rare cases do you want to change these rules |
| 47 | # |
| 48 | ${fwcmd} add 100 pass all from any to any via lo0 |
| 49 | ${fwcmd} add 200 deny all from any to 127.0.0.0/8 |
| 50 | ${fwcmd} add 300 deny ip from 127.0.0.0/8 to any |
| 51 | } |
| 52 | |
| 53 | ############ |
| 54 | # Set quiet mode if requested |
| 55 | # |
| 56 | case ${firewall_quiet} in |
| 57 | [Yy][Ee][Ss]) |
| 58 | fwcmd="/sbin/ipfw -q" |
| 59 | ;; |
| 60 | *) |
| 61 | fwcmd="/sbin/ipfw" |
| 62 | ;; |
| 63 | esac |
| 64 | |
| 65 | ########### |
| 66 | # Set Internal/External Interface |
| 67 | # |
| 68 | driver=`echo ${internalif} | sed 's/[0-9]*//g'` |
| 69 | seq=`echo ${internalif} | sed 's/[a-zA-Z]*//g'` |
| 70 | |
| 71 | if [ ${seq} = 0 ]; then |
| 72 | seq=`expr ${seq} \+ 1` |
| 73 | else |
| 74 | seq=`expr ${seq} \- 1` |
| 75 | fi |
| 76 | |
| 77 | externalif="$driver$seq" |
| 78 | |
| 79 | # Get public ip |
| 80 | externalip=`ifconfig $externalif | awk '/inet/ { print $2 }'` |
| 81 | ############ |
| 82 | # Flush out the list before we begin. |
| 83 | # |
| 84 | ${fwcmd} -f flush |
| 85 | |
| 86 | setup_loopback |
| 87 | |
| 88 | |
| 89 | ############ |
| 90 | # Block the hosters network (and maybe others) |
| 91 | |
| 92 | for IP in ${firewall_block} |
| 93 | do |
| 94 | ${fwcmd} add deny ip from any to ${IP} in via $internalif |
| 95 | done |
| 96 | |
| 97 | ############# |
| 98 | # Outbound NAT setup |
| 99 | |
| 100 | ${fwcmd} add nat 100 all from 172.16.0.0/12 to any out via $externalif |
| 101 | ${fwcmd} add nat 100 all from any to $externalip in via $externalif |
| 102 | ${fwcmd} nat 100 config if $externalif |
| 103 | |
| 104 | ############# |
| 105 | # WL -> Internet |
| 106 | # Stateful firewalling |
| 107 | |
| 108 | ${fwcmd} add 3000 check-state |
| 109 | # HTTP |
| 110 | ${fwcmd} add 3001 allow tcp from 172.16.0.0/12 to any $allowed2internet in via $internalif setup limit src-addr $maxconnections |
| 111 | # HTTPS |
| 112 | |
| 113 | # Allow anything originating from me |
| 114 | ${fwcmd} add 4001 allow ip from me to any keep-state |
| 115 | |
| 116 | # Allow on any interface |
| 117 | # Allow SSH |
| 118 | ${fwcmd} add 5001 allow tcp from any to me 22 keep-state |
| 119 | |
| 120 | # Allow on internal interface |
| 121 | # DNS |
| 122 | ${fwcmd} add 6001 allow ip from any to me 53 via $internalif keep-state |
| 123 | |
| 124 | # NTP |
| 125 | ${fwcmd} add 6002 allow udp from any to me 123 via $internalif keep-state |
| 126 | |
| 127 | # HTTP-PROXY |
| 128 | ${fwcmd} add 6003 allow tcp from any to me 3128 via $internalif keep-state |
| 129 | |
| 130 | # lvrouted |
| 131 | ${fwcmd} add 6004 allow udp from 172.16.0.0/12 to me 12345 via $internalif keep-state |
| 132 | |
| 133 | # SNMP |
| 134 | ${fwcmd} add 6005 allow udp from any to me 161 via $internalif keep-state |
| 135 | |
| 136 | # Block anything else |
| 137 | ${fwcmd} add 65000 deny ip from any to any |
| 138 | }}} |
| 139 | |
| 140 | == lvrouted == |
| 141 | Ook op de proxy wordt lvrouted gedraaid. |
| 142 | |
| 143 | Voor de nodes is aan lvrouted de -z optie toegevoegd: de default gateway (naar internet). In tegenstelling tot de configuratie met pen en proxies (waarbij de snelste internetverbinding werd gekozen) wordt nu gekozen voor de dichtstbijzijnde gateway (kleinste aantal hops) die beschikbaar is. |
| 144 | |
| 145 | |
| 146 | |
41 | | |
42 | | "[wiki:TracAdmin trac-admin] ''yourenvdir'' initenv" created |
43 | | a new Trac environment, containing a default set of wiki pages and some sample |
44 | | data. This newly created environment also contains |
45 | | [wiki:TracGuide documentation] to help you get started with your project. |
46 | | |
47 | | You can use [wiki:TracAdmin trac-admin] to configure |
48 | | [http://trac.edgewall.org/ Trac] to better fit your project, especially in |
49 | | regard to ''components'', ''versions'' and ''milestones''. |
50 | | |
51 | | |
52 | | TracGuide is a good place to start. |
53 | | |
54 | | Enjoy! [[BR]] |
55 | | ''The Trac Team'' |