OSDN Git Service

dae82f10a80b8a7942a877f96cf57d252e98b603
[opengate/opengate.git] / opengate / doc / en / install.html
1 <html>\r
2 <head>\r
3 <title>Opegnate Install</title>\r
4 <meta http-equiv="content-type" content="text/html">\r
5 <link rel="stylesheet" type="text/css" media="screen" href="style.css">\r
6 </head>\r
7 \r
8 \r
9 <body bgcolor="#fafff0">\r
10 \r
11 <h2>Opengate Install Procedure<A class=anchor href="#top" name=top>\81õ</A></h2>\r
12 <!-- Start:content table -->\r
13 <ul>\r
14         <li class="list_alpha"><A href="#outline0">Outline</A>\r
15         <ul>\r
16                 <li class="list_num"><A href="#outline1">System Configuration</A></li>\r
17                 <li class="list_num"><A href="#outline2">Install Procedure</A></li>\r
18                 <li class="list_num"><A href="#outline3">Support Page</A></li>\r
19         </ul></li>\r
20         <li class="list_alpha"><A href="#freebsd0">FreeBSD Install</A>\r
21         <ul>\r
22                 <li class="list_num"><A href="#freebsd1">Bssic Install</A></li>\r
23                 <li class="list_num"><A href="#freebsd2">Addition of NAT and Firewal</A></li>\r
24                 <li class="list_num"><A href="#freebsd3">Setup of IPv6</A></li>\r
25         </ul></li>\r
26         <li class="list_alpha"><A href="#bind0">BIND9 Install(Optional)</A>\r
27         <ul>\r
28                 <li class="list_num"><A href="#bind1">Ports Install</A></li>\r
29                 <li class="list_num"><A href="#bind2">Making RNDC Key</A></li>\r
30                 <li class="list_num"><A href="#bind3">Setup of named.conf</A></li>\r
31                 <li class="list_num"><A href="#bind4">Setup of Zone</A></li>\r
32                 <li class="list_num"><A href="#bind5">Checking Behavior</A></li>\r
33         </ul></li>\r
34         <li class="list_alpha"><A href="#dhcp0">isc-dhcp3 Install(Optional)</A>\r
35         <ul>\r
36                 <li class="list_num"><A href="#dhcp1">Ports Install</A></li>\r
37                 <li class="list_num"><A href="#dhcp2">Setup of DHCP</A></li>\r
38         </ul></li>\r
39         <li class="list_alpha"><A href="#apache0">Apache2 Install</A>\r
40         <ul>\r
41                 <li class="list_num"><A href="#apache1">Ports Install</A></li>\r
42                 <li class="list_num"><A href="#apache2">Making Certificate</A></li>\r
43                 <li class="list_num"><A href="#apache3">Setup of VertualHost</A></li>\r
44                 <li class="list_num"><A href="#apache4">Other Setup and check</A></li>\r
45         </ul></li>\r
46         <li class="list_alpha"><A href="#opengate0">Opengate Install</A>\r
47         <ul>\r
48                 <li class="list_num"><A href="#opengate1">Opengate Package</A></li>\r
49                 <li class="list_num"><A href="#opengate2">Install</A></li>\r
50                 <li class="list_num"><A href="#opengate3">Setup of Config File</A></li>\r
51                 <li class="list_num"><A href="#opengate4">Setup of ipfw</A></li>\r
52                 <li class="list_num"><A href="#opengate5">Setup of ip6fw</A></li>\r
53                 <li class="list_num"><A href="#opengate6">Setup of syslog</A></li>\r
54                 <li class="list_num"><A href="#opengate6">Checking Behavior</A></li>\r
55         </ul></li>\r
56         <li class="list_alpha"><A href="#mrtg0">MRTG Install(Optional)</A>\r
57         <ul>\r
58                 <li class="list_num"><A href="#mrtg1">Ports Install</A></li>\r
59                 <li class="list_num"><A href="#mrtg2">Setup</A></li>\r
60                 <li class="list_num"><A href="#mrtg3">Check Behavior</A></li>\r
61                 <li class="list_num"><A href="#mrtg4">Regist to Crontab</A></li>\r
62         </ul></li>\r
63     <li class="list_alpha"><A href="#rulechk">rulechk Install(Optional)</A>\r
64         </li>\r
65 </ul>\r
66 \r
67 <!-- End:content table  -->\r
68 <hr>\r
69 <!-- Start:Outline -->\r
70 <h3>A&nbsp;Outline<A class=anchor href="#outline0" name=outline0>\81õ</A></h3>\r
71 \r
72         <ul>\r
73                 <li class="list_num"><A href="#outline1">System Configuration</A></li>\r
74                 <li class="list_num"><A href="#outline2">Install Procedure</A></li>\r
75         </ul>\r
76         \r
77 <!-- ************1************* -->\r
78 <h4>A.1&nbsp;System Configuration<A class=anchor href="#outline1" name=outline1>\81õ</A></h4>\r
79 \r
80 <ul>\r
81         <li>Gateway Machine \r
82   \r
83         <ul>\r
84                 <li>FreeBSD Ver 4.x, 5.x, or 6.x </li>\r
85     \r
86                 <li>Having Two or more NICs</li>\r
87         </ul> </li>\r
88 </ul>\r
89 \r
90 <p>In this document, we use the system configuration as follows. The network connecting terminals is called as lower-side network and the network having servers is called upper-side network.</p>\r
91 \r
92 \r
93 <table><tr><td><pre>\r
94 upper-side network:192.168.0.0/24, 2001:1:2:3/64\r
95 Gateway to upper-side network:fxp1, 192.168.0.124, 2001:1:2:3::4\r
96 Gateway to lower-side network:fxp0, 192.168.1.1, 2001:5:6:7::1\r
97 lower-side network:192.168.1.0/24, 2001:5:6:7/64\r
98 </pre></td></tr></table>\r
99 \r
100 <p>Opengate recognizes the both addresses of IPv4 and IPv6, and controles the both firewalls. It can be used for IPv4 control only under the FreeBSD system that does not set up IPv6 environments.</p>\r
101 \r
102 \r
103 <!-- ***********2************** -->\r
104 <h4>A.2&nbsp;Install Procedure<A class=anchor href="#outline2" name=outline2>\81õ</A></h4>\r
105 \r
106 <p>Following is the proceddure of Opengate. The '*'mark means the mandatory items.</p>\r
107 \r
108 <ul>  \r
109         <li class="list_num">FreeBSD Install&nbsp;*</li>\r
110         <li class="list_num">Addition of Firewall&nbsp;*</li>\r
111         <li class="list_num">BIND9 Install and Setup</li>\r
112         <li class="list_num">DHCP Install and Setup</li>\r
113         <li class="list_num">Apache2 Install and Setup&nbsp;*</li>\r
114         <li class="list_num">Opengate Install and Setup&nbsp;*</li></ul>\r
115 \r
116 \r
117 <!-- ***********3************** -->\r
118 <h4>A.2&nbsp;Support Page<A class=anchor href="#outline3" name=outline3>\81õ</A></h4>\r
119 \r
120 We prepare the Opengate support page as follows.\r
121 \r
122 <table><tr><td><pre>\r
123   http://www.cc.saga-u.ac.jp/opengate/index-e.html\r
124 </pre></td></tr></table>\r
125 \r
126 \r
127 \r
128 <div align="right"><A href="#outline0">back</A>&nbsp;<A href="#top">top</A></div>\r
129 \r
130 <hr>\r
131 <!-- Start:FreeBSD Install-->\r
132 <h3>B&nbsp;FreeBSD Install<A class=anchor href="#freebsd0" name=freebsd0>\81õ</A></h3>\r
133 \r
134         <ul>\r
135                 <li class="list_num"><A href="#freebsd1">Basic Install</A></li>\r
136                 <li class="list_num"><A href="#freebsd2">Addition of NAT and Firewall</A></li>\r
137                 <li class="list_num"><A href="#freebsd3">Setup of IPv6</A></li>\r
138         </ul>\r
139         \r
140 <!-- ************1************* -->\r
141 <h4>B.1&nbsp;Basic Install<A class=anchor href="#freebsd1" name=freebsd1>\81õ</A></h4>\r
142 \r
143 <p>Use FreeBSD4.x or later. FreeBSD6.1 or later is desirable.  \r
144 Choose distribution Developer(Full sources, binaries and doc) or all, because we have to prepare a kernel.</p>\r
145 <p>Add next line to "/etc/rc.conf", because you enable the gateway function.</p>\r
146 \r
147 <table>\r
148   <TR>\r
149 <td><code>gateway_enable="YES"</code></td></TR>\r
150 </table>\r
151 \r
152 <div align="right"><A href="#freebsd0">back</A>&nbsp;<A href="#top">top</A></div>\r
153 \r
154 \r
155 \r
156 <!-- ************ 2 ************** -->\r
157 <h4>B.2&nbsp;Addition of NAT and Firewall<A class=anchor href="#freebsd2" name=freebsd2>\81õ</A></h4>\r
158 \r
159 <p>Prepare kernel having ipfw and ip6fw functions.</p>\r
160 \r
161 <p>Copy kernel options file.</p>\r
162 \r
163 <table><tr><td><pre>\r
164 # cd /usr/src/sys/i386/conf\r
165 # cp GENERIC MYKERNEL\r
166 </pre></td></tr></table>\r
167 \r
168 <p>Add next lines to the kernel.</p>\r
169 \r
170 <p>(For FreeBSD6.0 or earlier)</p>\r
171 \r
172 <table><tr><td><pre>\r
173 options IPDIVERT\r
174 \r
175 options IPFIREWALL\r
176 options IPFIREWALL_FORWARD\r
177 options IPFIREWALL_VERBOSE\r
178 options IPFIREWALL_VERBOSE_LIMIT=100\r
179 \r
180 options IPV6FIREWALL\r
181 options IPV6FIREWALL_VERBOSE\r
182 options IPV6FIREWALL_VERBOSE_LIMIT=100\r
183 \r
184 options IPSEC\r
185 options IPSEC_ESP\r
186 options TCP_DROP_SYNFIN\r
187 </pre></td></tr></table>\r
188 \r
189 <p>(For FreeBSD6.1 or later)</p>\r
190 \r
191 <table><tr><td><pre>\r
192 options IPDIVERT\r
193 \r
194 options IPFIREWALL\r
195 options IPFIREWALL_FORWARD\r
196 options IPFIREWALL_VERBOSE\r
197 options IPFIREWALL_VERBOSE_LIMIT=100\r
198 \r
199 options IPSEC\r
200 device crypto\r
201 </pre></td></tr></table>\r
202 \r
203 \r
204 <p>compile and install kernel having ipfw (and ip6fw) supports.</p>\r
205 \r
206 \r
207 <table><tr><td><pre>\r
208 # config MYKERNEL\r
209 # cd ../compile/MYKERNEL\r
210 # make depend\r
211 # make\r
212 # make install\r
213 </pre></td></tr></table>\r
214 \r
215 <p>"make clean" might be requested before "make depend".</p>\r
216 \r
217 <p>Add next lines to "/etc/rc.conf".</p>\r
218 \r
219 <p>(For FreeBSD6.0 or earlier)</p>\r
220 \r
221 <table><tr><td><pre>\r
222 firewall_enable="YES"\r
223 firewall_script="/etc/rc.firewall"\r
224 firewall_type="open"\r
225 \r
226 ipv6_firewall_enable="YES"\r
227 ipv6_firewall_script="/etc/rc.firewall6"\r
228 ipv6_firewall_type="open"\r
229 \r
230 natd_enable="YES"\r
231 natd_interface="fxp1"\r
232 </pre></td></tr></table>\r
233 \r
234 <p>(For FreeBSD6.1 or later)</p>\r
235 <table><tr><td><pre>\r
236 firewall_enable="YES"\r
237 firewall_script="/etc/rc.firewall"\r
238 firewall_type="open"\r
239 \r
240 natd_enable="YES"\r
241 natd_interface="fxp1"\r
242 </pre></td></tr></table>\r
243 \r
244 <p>When setting the ipfw(and ip6fw) enable, be care to set the type 'OPEN' as to prevent mysteryous system behavior in installing procedure. For NAT, Enable natd and setup natd interface(Upper-side interface).</p>\r
245 \r
246 <p>Connect PC to the lower-side network and check the IPv4 behavior.</p>\r
247 \r
248 <p>As the DHCP does not setup yet, The PC network must be setup manually.</p>\r
249 \r
250 \r
251 \r
252 <div align="right"><A href="#freebsd0">back</A>&nbsp;<A href="#top">top</A></div>\r
253 \r
254 <!-- ************ 3 ************** -->\r
255 <h4>B.3&nbsp;Setup of IPv6<A class=anchor href="#freebsd3" name=freebsd3>\81õ</A></h4>\r
256 \r
257 <p>If you need IPv4 only, this section can be skipped. Though explanation is omitted, many pareameters like the following sample might be set in /etc/rc.conf. You must study about IPv6 and setup carefully. </p>\r
258 \r
259 <table><tr><td><pre>\r
260 ##ENABLE IPv6\r
261 ipv6_enable="YES"\r
262 ipv6_network_interfaces="gif0 fxp0"\r
263 \r
264 ##TUNNELLING INTERFACE\r
265 gif_interfaces="gif0"\r
266 gifconfig_gif0="192.168.0.124 192.168.0.126"\r
267 \r
268 ##IPv6 ADDRESS \r
269 ipv6_prefix_fxp0="2001:5:6:7"\r
270 ipv6_ifconfig_fxp0="2001:5:6:7::1 prefixlen 64"\r
271 \r
272 ##ADVERTISE\r
273 rtadvd_enable="YES"\r
274 rtadvd_interfaces="fxp0"\r
275 \r
276 ##DEFAULT GATEWAY\r
277 ipv6_default_interface="gif0"\r
278 ipv6_defaultrouter="fe80::a:b:c:d%gif0"\r
279 \r
280 ##ROUTING(RIPv6)\r
281 ipv6_gateway_enable="YES"\r
282 ipv6_router_enable="YES"\r
283 ipv6_router="/usr/sbin/route6d"\r
284 ipv6_router_flags="-O 2001:5:6:7::/64,gif0"\r
285 </pre></td></tr></table>\r
286 \r
287 <p>Connect a PC to the lower-side network and check the behavior of IPv6</p>\r
288 <p>In WindowsPC, a command "ipv6 install" might be needed to activate IPv6.</p>\r
289 \r
290 \r
291 <div align="right"><A href="#ipfw0">back</A>&nbsp;<A href="#top">top</A></div>\r
292 \r
293 <hr>\r
294 \r
295 \r
296 <!-- Start:BIND9 Install -->\r
297 <h3>C&nbsp;BIND9 Install(Optional)<A class=anchor href="#bind0" name=bind0>\81õ</A></h3>\r
298 \r
299 <ul>\r
300         <li class="list_num"><A href="#bind1">Ports Install</A></li>\r
301         <li class="list_num"><A href="#bind2">Making RNDC Key</A></li>\r
302         <li class="list_num"><A href="#bind3">Setup of named.conf</A></li>\r
303         <li class="list_num"><A href="#bind4">Setup of Zone</A></li>\r
304         <li class="list_num"><A href="#bind5">Checking Behavior</A></li>\r
305 </ul>\r
306 \r
307 <!-- ********** 1 *********** -->\r
308 <h4>C.1&nbsp;Ports Install<A class=anchor href="#bind1" name=bind1>\81õ</A></h4>\r
309 \r
310 <p>You can ignore the DNS setting, if you control with IP address base or use existing DNS servers.</p>\r
311 \r
312 <p>Installing BIND9 from ports is as follows. The "sysinstall" command can also be used for installation.</p> \r
313 \r
314 \r
315 <table><tr><td><pre>\r
316 # cd /usr/ports/dns/bind9/\r
317 # make clean\r
318 # make install clean ; rehash\r
319 </pre></td></tr></table>\r
320 \r
321 <p>The directory "/etc/namedb(/var/named/etc/namedb)" is made in the installation.</p>\r
322 \r
323 \r
324 <div align="right"><A href="#bind0">back</A>&nbsp;<A href="#top">top</A></div>\r
325 \r
326 <!-- ********** 2 ********** -->\r
327 <h4>C.2&nbsp;Making RNDC key<A class=anchor href="#bind2" name=bind2>\81õ</A></h4>\r
328 \r
329 <p>For security, BIND9 is controlled by rndc command.</p>\r
330 \r
331 <p>Create the rndc key as follows.</p>\r
332 \r
333 <table><tr><td><pre>\r
334 # cd /etc/namebd/\r
335 # rndc-confgen -b 512 > rndc.conf\r
336 </pre></td></tr></table>\r
337 \r
338 <p>By the command, following "rndc.conf" file is generated.</p>\r
339 \r
340 <table><tr><td><pre>\r
341 # Start of rndc.conf\r
342 key "rndc-key" {\r
343         algorithm hmac-md5;\r
344         secret "wMpASEmnRVnD602MtEb+RqtMee5+n0RVgpaUrlAHvPpgH3SoK7f2nRZBUH7a0urvmyBuAg0dwtk/Otg9Ker3gA==";\r
345 };\r
346 \r
347 options {\r
348         default-key "rndc-key";\r
349         default-server 127.0.0.1;\r
350         default-port 953;\r
351 };\r
352 # End of rndc.conf\r
353 \r
354 # Use with the following in named.conf, adjusting the allow list as needed:\r
355 # key "rndc-key" {\r
356 #       algorithm hmac-md5;\r
357 #       secret "wMpASEmnRVnD602MtEb+RqtMee5+n0RVgpaUrlAHvPpgH3SoK7f2nRZBUH7a0urvmyBuAg0dwtk/Otg9Ker3gA==";\r
358 # };\r
359\r
360 # controls {\r
361 #       inet 127.0.0.1 port 953\r
362 #               allow { 127.0.0.1; } keys { "rndc-key"; };\r
363 # };\r
364 # End of named.conf\r
365 </pre></td></tr></table>\r
366 \r
367 \r
368 <div align="right"><A href="#bind0">back</A>&nbsp;<A href="#top">top</A></div>\r
369 \r
370 <!-- ********* 3 ********* -->\r
371 <h4>C.3&nbsp;Setup of named.conf<A class=anchor href="#bind3" name=bind3>\81õ</A></h4>\r
372 \r
373 <p>There is "/etc/namedb/named.conf" after installation.</p>\r
374 \r
375 <p>Copy later half of "rndc.conf" file, remove comment, and add IPv6 configuration(if required).</p>\r
376 \r
377 <table><tr><td><pre>\r
378 # Use with the following in named.conf, adjusting the allow list as needed:\r
379 key "rndc-key" {\r
380         algorithm hmac-md5;\r
381         secret "wMpASEmnRVnD602MtEb+RqtMee5+n0RVgpaUrlAHvPpgH3SoK7f2nRZBUH7a0urvmyBuAg0dwtk/Otg9Ker3gA==";\r
382 };\r
383 \r
384 controls {\r
385         inet ::1 port 953 allow { ::1; } keys { "rndc-key"; };\r
386         inet 127.0.0.1 port 953 allow { 127.0.0.1; } keys { "rndc-key"; };\r
387 };\r
388 # End of named.conf\r
389 </pre></td></tr></table>\r
390 \r
391 <p>For security, it is better to write the "key" directive in the other file.</p>\r
392 \r
393 <p>Edit "options" directive in "named.conf".</p>\r
394 \r
395 <table><tr><td><pre>\r
396 options {\r
397         directory "/etc/namedb";\r
398         pid-file "/var/run/named/pid";\r
399         auth-nxdomain yes;\r
400         listen-on-v6 { any; };\r
401 };\r
402 </pre></td></tr></table>\r
403 \r
404 <p>Make the corresponding directory to put "pid".</p>\r
405 \r
406 \r
407 <div align="right"><A href="#bind0">back</A>&nbsp;<A href="#top">top</A></div>\r
408 \r
409 <!-- ******** 4 ********* -->\r
410 <h4>C.4&nbsp;Setup of Zone<A class=anchor href="#bind4" name=bind4>\81õ</A></h4>\r
411 \r
412 <p>Edit "view" and "zone" directive in "named.conf".</p>\r
413 \r
414 <p>The "view" directive is implemented in BIND9.  Replying to the inquiry from matched-clients, BIND9 sends the information described in the corresponding view.</p>\r
415 \r
416 \r
417 \r
418 <table><tr><td><pre>\r
419 view "og" {\r
420         match-clients\r
421         {\r
422         192.168.1.0/24;\r
423         };\r
424 \r
425         recursion yes;\r
426 \r
427         zone "." {\r
428                 type hint;\r
429                 file "named.root";\r
430         };\r
431 \r
432         zone "og.saga-u.ac.jp" {\r
433                 type master;\r
434                 file "og.saga-u.ac.jp";\r
435         };\r
436 \r
437         zone "0.0.127.IN-ADDR.ARPA" {\r
438                 type master;\r
439                 file "master/localhost.rev";\r
440         };\r
441 \r
442         // RFC 3152\r
443         zone "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.\\r
444               0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.IP6.ARPA" {\r
445                 type master;\r
446                 file "master/localhost-v6.rev";\r
447         };\r
448 \r
449         // RFC 1886 -- deprecated\r
450         zone "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.\\r
451               0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.IP6.INT" {\r
452                 type master;\r
453                 file "master/localhost-v6.rev";\r
454         };\r
455 };\r
456 </pre></td></tr></table>\r
457 \r
458 <p>Make a "zone" file for the domain as "og.saga-u.ac.jp".  \r
459 The domain name and IPv4/6 addresses should be modified properly. \r
460 If you don't need IPv6, the line "AAAA ...." should be removed.</p>\r
461 \r
462 <table><tr><td><pre>\r
463 $TTL    3600\r
464 $ORIGIN og.saga-u.ac.jp.\r
465 \r
466 @       IN      SOA     ns.og.saga-u.ac.jp. postmaster (\r
467                         2005051702 ;\r
468                         3600\r
469                         1200\r
470                         2419200\r
471                         86400 )\r
472                 IN      NS      ns.og.saga-u.ac.jp.\r
473                 IN      A       192.168.1.1\r
474                 IN      MX      10 opengate.og.saga-u.ac.jp.\r
475 \r
476 ns              IN      A       192.168.1.1\r
477 \r
478 opengate        IN      A       192.168.1.1\r
479                         AAAA    2001:5:6:7::1\r
480 </pre></td></tr></table>\r
481 \r
482 <div align="right"><A href="#bind0">back</A>&nbsp;<A href="#top">top</A></div>\r
483 \r
484 <!-- ********* 5 ********* -->\r
485 <h4>C.5&nbsp;Checking Behavior<A class=anchor href="#bind5" name=bind5>\81õ</A></h4>\r
486 \r
487 <p>Confirm starting of "named" after setting was completed.</p>\r
488 \r
489 <table><tr><td><pre>\r
490 # /usr/local/sbin/named -u bind -c /etc/namedb/named.conf\r
491 </pre></td></tr></table>\r
492 \r
493 <p>If "named" starts without problems, Add next lines to "/etc/rc.conf" for auto start.</p>\r
494 \r
495 <table><tr><td><pre>named_enable="YES"\r
496 named_program="/usr/local/sbin/named"\r
497 named_flags="-u bind -c /etc/namedb/named.conf"\r
498 </pre></td></tr></table>\r
499 \r
500 <p>Because the management of a DNS server is complicated, You need to read manual of BIND9 carefully, and refer other document.</p>\r
501 \r
502 \r
503 <div align="right"><A href="#bind0">back</A>&nbsp;<A href="#top">top</A></div>\r
504 <hr>\r
505 \r
506 <!-- Start:isc-dhcp3 Install -->\r
507 <h3>D&nbsp;isc-dhcp3 Install(Optional)<A class=anchor href="#dhcp0" name=dhcp0>\81õ</A></h3>\r
508 \r
509 <ul>\r
510         <li class="list_num"><A href="#dhcp1">Ports Install</A></li>\r
511         <li class="list_num"><A href="#dhcp2">Setting of DHCP</A></li>\r
512 </ul>\r
513 \r
514 <!-- *********** 1 ************* -->\r
515 <h4>D.1&nbsp;Ports Install<A class=anchor href="#dhcp1" name=dhcp1>\81õ</A></h4>\r
516 \r
517 <p>Many client PCs are connected.  Thus the DHCP might be a desireble solution for assginment of IP addresses to these clients.</p>\r
518 \r
519 <p>Installing isc-dhcp3 from ports is as follows. The "sysinstall" command can also be used for intallation.</p>\r
520 \r
521 <table><tr><td><pre>\r
522 # cd /usr/ports/net/isc-dhcp3-server\r
523 # make clean\r
524 # make install clean ; rehash\r
525 </pre></td></tr></table>\r
526 \r
527 <div align="right"><A href="#dhcp0">back</A>&nbsp;<A href="#top">top</A></div>\r
528 \r
529 \r
530 <!-- ************ 2 ************** -->\r
531 <h4>D.2&nbsp;Setup of DHCP<A class=anchor href="#dhcp2" name=dhcp2>\81õ</A></h4>\r
532 \r
533 <p>There is a configuration file "/usr/local/etc/dhcpd.conf.sample" after instalation. Copy "dhcpd.conf.sample" to "dhcpd.conf" and edit the file. Following is an example setup. The lease time must be greater than the maximum usage duration (Duration/Max in opengatesrv.conf).</p>\r
534 <p>The domain name and IP addresses should be modified. </p>\r
535 \r
536 <table><tr><td><pre>\r
537 option domain-name "og.saga-u.ac.jp";\r
538 option domain-name-servers 192.168.1.1;\r
539 option subnet-mask 255.255.255.0;\r
540 option broadcast-address 192.168.1.255;\r
541 option routers 192.168.1.1;\r
542 \r
543 default-lease-time 86400;\r
544 max-lease-time 604800;\r
545 ddns-update-style none;\r
546 log-facility local7;\r
547 \r
548 subnet 192.168.55.0 netmask 255.255.255.0 {\r
549   range 192.168.1.10 192.168.1.250;\r
550 }\r
551 </pre></td></tr></table>\r
552 \r
553 <p>Add next lines to "/etc/rc.conf" for auto start.</p>\r
554 \r
555 <table><tr><td><pre>\r
556 dhcpd_enable="YES"\r
557 dhcpd_ifaces="fxp0"\r
558 dhcpd_conf="/usr/local/etc/dhcpd.conf"\r
559 </pre></td></tr></table>\r
560 \r
561 <p>In this description, the value of "dhcpd_ifaces" is the interface for DHCP service(the lower-side network).</p>\r
562 \r
563 <div align="right"><A href="#dhcp0">back</A>&nbsp;<A href="#top">top</A></div>\r
564 \r
565 <hr>\r
566 \r
567 <!-- Start:Apache2 Install-->\r
568 <h3>E&nbsp;Apache2 Install<A class=anchor href="#apache0" name=apache0>\81õ</A></h3>\r
569 <ul>\r
570         <li class="list_num"><A href="#apache1">Ports Install</A></li>\r
571         <li class="list_num"><A href="#apache2">Making Certificate</A></li>\r
572         <li class="list_num"><A href="#apache3">Setup SSL</A></li>\r
573         <li class="list_num"><A href="#apache4">Other Setting and Checking</A></li>\r
574 </ul>\r
575 \r
576 <!-- ************ 1 ************** -->\r
577 <h4>E.1&nbsp;Ports Install<A class=anchor href="#apache1" name=apache1>\81õ</A></h4>\r
578 \r
579 <p>When using IPv6 function, Opengate needs Apache2 supporting IPv6. In default, Apache2 supports SSL which is desirable for secure authentication.</p>\r
580 \r
581 \r
582 <p>Installing Apache2 from ports is as follows. The "sysinstall" command can also be used for installation.</p>\r
583 \r
584 <table><tr><td><pre>\r
585 # cd /usr/ports/www/apache22\r
586 # make clean\r
587 # make install clean ; rehash\r
588 </pre></td></tr></table>\r
589 \r
590 \r
591 \r
592 <div align="right"><A href="#apache0">back</A>&nbsp;<A href="#top">top</A></div>\r
593 \r
594 <!-- ************ 2 ************** -->\r
595 <h4>E.2&nbsp;Making Certificate<A class=anchor href="#apache2" name=apache2>\81õ</A></h4>\r
596 \r
597 <p>It is better to obtain a formal key from some CA. But we shows the procedure to make a self-signed private key and certificate. </p>\r
598 \r
599 \r
600 <p>Make a private key as follows.</p>\r
601 \r
602 <table><tr><td><pre>\r
603 # cd /usr/local/etc/apache22\r
604 # mkdir ssl.key ssl.crt\r
605 # chmod 700 ssl.key ssl.crt\r
606 \r
607 # /usr/bin/openssl genrsa -out /usr/local/etc/apache22/server.key 1024\r
608 </pre></td></tr></table>\r
609 \r
610 <p>Make a certificate from the key as follows.</p>\r
611 \r
612 <table><tr><td><pre>\r
613 # /usr/bin/openssl req -new -x509 -days 365 \\r
614     -key /usr/local/etc/apache22/server.key \\r
615     -out /usr/local/etc/apache22/server.crt\r
616 \r
617 You are about to be asked to enter information that will be incorporated\r
618 into your certificate request.\r
619 What you are about to enter is what is called a Distinguished Name or a DN.\r
620 There are quite a few fields but you can leave some blank\r
621 For some fields there will be a default value,\r
622 If you enter '.', the field will be left blank.\r
623 -----\r
624 Country Name (2 letter code) [AU]:JP\r
625 State or Province Name (full name) [Some-State]:Saga\r
626 Locality Name (eg, city) []:Saga-city\r
627 Organization Name (eg, company) [Internet Widgits Pty Ltd]:Saga-university\r
628 Organizational Unit Name (eg, subsection) []:Opengate Management\r
629 Common Name (eg, YOUR name) []:opengate.og.saga-u.ac.jp\r
630 Email Address []:administrator@opengate.og.saga-u.ac.jp\r
631 \r
632 Please enter the following 'extra' attributes\r
633 to be sent with your certificate request\r
634 A challenge password []:\r
635 An optional company name []:\r
636 \r
637 </pre></td></tr></table>\r
638 \r
639 <div align="right"><A href="#apache0">back</A>&nbsp;<A href="#top">top</A></div>\r
640 \r
641 <!-- ************ 4 ************** -->\r
642 <h4>E.4&nbsp Setup of SSL<A class=anchor href="#apache3" name=apache3>\81õ</A></h4>\r
643 \r
644 \r
645 <p>Edit "/usr/local/etc/apache22/extra/httpd-ssl.conf" like the following example.</p>\r
646 \r
647 <table><tr><td>ssl.conf\r
648 </td></tr><tr><td><pre>\r
649 &lt;VirtualHost _default_:443&gt;\r
650     DocumentRoot "/usr/local/www/apache22/data"\r
651     ServerName opengate.og.saga-u.ac.jp:443\r
652     ServerAdmin administrator@opengate.og.saga-u.ac.jp\r
653     ErrorLog "|/usr/bin/logger -p local6.info"\r
654     CustomLog "|/usr/bin/logger -p local5.info" combined\r
655 \r
656     SSLEngine on\r
657     SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL\r
658     SSLCertificateFile /usr/local/etc/apache22/server.crt\r
659     SSLCertificateKeyFile /usr/local/etc/apache22/server.key\r
660 &lt;/VirtualHost&gt;\r
661 </pre></td></tr></table>\r
662 \r
663 <p>As Apache2 has many settings, be familiar with Apache2 configuration for adequate control.</p>\r
664 \r
665 \r
666 \r
667 <div align="right"><A href="#apache0">back</A>&nbsp;<A href="#top">top</A></div>\r
668 \r
669 <!-- ************ 5 ************** -->\r
670 <h4>E.5&nbsp;Other Setting and Checking<A class=anchor href="#apache4" name=apache4>\81õ</A></h4>\r
671 \r
672 <p>Edit "/usr/local/etc/apache22/httpd.conf" as follows.</p>\r
673 \r
674 <p>Opengate send back the authentication page for any kind of HTTP request. To do so, add next line to httpd.conf. This means that the top page is sent back at HTTP_ERROR 404(file not found) error.</p>\r
675 \r
676 \r
677 \r
678 <table><tr><td><pre>\r
679 ErrorDocument 404 /\r
680 </pre></td></tr></table>\r
681 \r
682 <p>Add ExecCGI to execute CGI program in cgi-bin directory.</p>\r
683 <table><tr><td><pre>\r
684 &lt;Directory "/usr/local/www/cgi-bin"&gt;\r
685     ...\r
686     Options ExecCGI\r
687     ...\r
688 &lt;/Directory&gt;\r
689 </pre></td></tr></table>\r
690 \r
691 <p>\r
692 Remove the comment mark to enable the following setting\r
693 <table><tr><td><pre>\r
694 AddHandler cgi-script .cgi\r
695 AddHandler type-map .var\r
696 </pre></td></tr></table>\r
697 </p>\r
698 \r
699 <p>\r
700 Add "index.html.var" into DirectoryIndex.\r
701 <table><tr><td><pre>\r
702 DirectoryIndex index.html.var index.html\r
703 </pre></td></tr></table>\r
704 </p>\r
705 \r
706 <p>\r
707 Include ssl conf file.\r
708 <table><tr><td><pre>\r
709 Include etc/apache22/extra/httpd-ssl.conf\r
710 </pre></td></tr></table>\r
711 </p>\r
712 \r
713 <p>\r
714 Set Server name.\r
715 <table><tr><td><pre>\r
716 ServerName opengate.og.saga-u.ac.jp\r
717 </pre></td></tr></table>\r
718 </p>\r
719 \r
720 <p>Start Apache2 with "apachectl start" and check the normal action. \r
721 Then add next lines to "/etc/rc.conf" for auto start.</p>\r
722 \r
723 <table><tr><td><pre>\r
724 apache22_enable="YES"\r
725 apache22ssl_enable="YES"\r
726 </pre></td></tr></table>\r
727 \r
728 <p>\r
729 If the system shows "Failed to enable the 'httpready' Accept Filter",\r
730 add following into /boot/loader.conf\r
731 <table><tr><td><pre>\r
732 accf_http_load="YES"\r
733 </pre></td></tr></table>\r
734 </p>\r
735 \r
736 <div align="right"><A href="#apache0">back</A>&nbsp;<A href="#top">top</A></div>\r
737 \r
738 <hr>\r
739 \r
740 <!-- Start:Opengate Install -->\r
741 <h3>F&nbsp;Opengate Install<A class=anchor href="#opengate0" name=opengate0>\81õ</A></h3>\r
742 \r
743         <ul>\r
744                 <li class="list_num"><A href="#opengate1">Opengate Package</A></li>\r
745                 <li class="list_num"><A href="#opengate2">Install</A></li>\r
746                 <li class="list_num"><A href="#opengate3">Setup of Config File</A></li>\r
747                 <li class="list_num"><A href="#opengate4">Setup of ipfw</A></li>\r
748                 <li class="list_num"><A href="#opengate5">Setup of ip6fw</A></li>\r
749                 <li class="list_num"><A href="#opengate6">Setup of syslog</A></li>\r
750                 <li class="list_num"><A href="#opengate7">Checking Behavior</A></li>\r
751         </ul>\r
752         \r
753 <!-- ************1************* -->\r
754 <h4>F.1&nbsp;Opengate Package<A class=anchor href="#opengate1" name=opengate1>\81õ</A></h4>\r
755 \r
756 <p>Unfold the package of Opengate. </p>\r
757 \r
758 <table><tr><td><pre>\r
759 # tar xzvf opengatexxxx.tar.gz\r
760 </pre></td></tr></table>\r
761 \r
762 <p>It have following directorys.</p>\r
763 \r
764 <table>\r
765 <tr><td><pre>\r
766 doc: Documentations\r
767 conf: Configuration file and firewall control perl script sample\r
768 javahtml: Client Java Programs and  HTML files\r
769 opengatesrv: Server CGI programs\r
770 tools: Some related tools\r
771 ezxml: XML parser (Copyright Aaron Voisine)\r
772 </pre>\r
773 </td></tr>\r
774 </table>\r
775 <div align="right"><A href="#opengate0">back</A>&nbsp;<A href="#top">top</A></div>\r
776 \r
777 <!-- ************2************* -->\r
778 \r
779 <h4>F.2&nbsp;Install<A class=anchor href="#opengate2" name=opengate2>\81õ</A></h4>\r
780 \r
781 <p>Check setting in "opengatesrv/Makefile" and modify properly.</p>\r
782 \r
783 <table>\r
784 <tr><td><pre>\r
785 HTMLTOP = /usr/local/www/apache22\r
786 DOCDIR = /data\r
787 CGIDIR = /cgi-bin\r
788 OPENGATEDIR = /opengate\r
789 CONFIGPATH = /etc/opengate\r
790 </pre>\r
791 </td></tr>\r
792 </table>\r
793 \r
794 <p>Compile and Install.</p>\r
795 \r
796 <table><tr><td><pre>\r
797 # make clean\r
798 # make install\r
799 </pre></td></tr></table>\r
800 \r
801 \r
802 <div align="right"><A href="#opengate0">back</A>&nbsp;<A href="#top">top</A></div>\r
803 \r
804 \r
805 <!-- ************ 3 ************** -->\r
806 <h4>F.3&nbsp;Setup of Config File<A class=anchor href="#opengate3" name=opengate3>\81õ</A></h4>\r
807 \r
808 \r
809 <p>Copy sample config file "/etc/opengate/opengatesrv.conf.sample" to "/etc/opengate/opengatesrv.conf" and modify. Following settings must be changed.</p>\r
810 \r
811 <table><tr><td><pre>\r
812         &lt;OpengateServerName&gt;opengate.og.saga-u.ac.jp&lt;/OpengateServerName&gt;\r
813 \r
814         &lt;AuthServer&gt;\r
815                 &lt;Protocol&gt;pop3s&lt;/Protocol&gt;\r
816                 &lt;Address&gt;192.168.0.2&lt;/Address&gt;\r
817         &lt;/AuthServer&gt;\r
818 </pre></td></tr></table>\r
819 \r
820 <p>In &lt;OpengateServerName&gt;, set HOSTNAME(FQDN) or IP address of opengate gateway server. If you \r
821 want to use IPv6 function, you need to set FQDN corresponding to IPv4 and IPv6 both addresses.</p>\r
822 <p>In &lt;AuthServer&gt;, set the information of authentication server.  Opengate support various auth protocols. See the config file for details.  To separate the problem between auth server and opengate server, try the following setting firstly. This means that any userid and password are accepted.</p>\r
823 \r
824 \r
825 <table><tr><td><pre>\r
826  ****Do not use this setting in real service****\r
827         &lt;AuthServer&gt;\r
828                 &lt;Protocol&gt;accept&lt;/Protocol&gt; \r
829         &lt;AuthServer&gt;\r
830 </pre></td></tr></table>\r
831 \r
832 <p>The config file is XML form.  The # mark in the file does not mean the start of a comment. Use XML-formed comment as &lt;!-- Comment String --&gt; to disable description.</p>\r
833 \r
834 <p>Opengate can switch auth setting with "userid@extid" pattern. See the config file for details. By this function, you can divide the authentication servers for many sections or guests.</P>\r
835 \r
836 <p>When default auth server is not replied, Opengate can re-request to other auth servers. See the config file for details.</P>\r
837 \r
838 <p>Caution: Do not delete the IPv6 related setting in config file.  The IPv6 access is executed when the FQDN for IPv6 is prepared.</P>\r
839 \r
840 <div align="right"><A href="#opengate0">back</A>&nbsp;<A href="#top">top</A></div>\r
841 \r
842 \r
843 <!-- ************ 4 ************** -->\r
844 <h4>F.4&nbsp;Setup of ipfw<A class=anchor href="#opengate4" name=opengate4>\81õ</A></h4>\r
845 \r
846 <p>Write ipfw rules for Opengate. \r
847 \r
848 \r
849 <p>(For FreeBSD6.0 or earlier)</p>\r
850 \r
851 <p>IPv4 packets are controlled by ipfw, and IPv6 packets by ip6fw.</p>\r
852 <p>Sample setup scripts for both commands are prepared as "/etc/opengate/rc.firewall4.sample" and "/etc/opengate/rc.firewall6.sample"</p>\r
853 <p>Copy these script and modify properly.</p>\r
854 \r
855 <table><tr><td><pre>\r
856 # cd /etc/opengate\r
857 # cp rc.firewall4.sample rc.firewall4\r
858 # cp rc.firewall6.sample rc.firewall6\r
859 # vi rc.firewall4\r
860 # vi rc.firewall6\r
861 </pre></td></tr></table>\r
862 \r
863 <p>Modify firewall setting in /erc/rc.conf as follows. Be care that accesses after this setting might be denied by the firewall.</p>\r
864 \r
865 <table><tr><td><pre>\r
866 firewall_enable="YES"\r
867 firewall_script="/etc/opengate/rc.firewall4"\r
868 \r
869 ipv6_firewall_enable="YES"\r
870 ipv6_firewall_script="/etc/opengate/rc.firewall6"\r
871 </pre></td></tr></table>\r
872 \r
873 <p>Then modify "/etc/opengatesrv.conf" from &lt;Ip6fwPath&gt;/sbin/ipfw&lt;/Ip6fwPath&gt; to &lt;Ip6fwPath&gt;/sbin/ip6fw&lt;/Ip6fwPath&gt; </p>\r
874 \r
875 \r
876 <p>(For FreeBSD6.1 or later)</p>\r
877 \r
878 <p>Both of IPv4 and IPv6 packets are controlled by ipfw.</p>\r
879 <p>Sample setup scripts for the system are prepared as "/etc/opengate/rc.firewall.sample"</p>\r
880 <p>Copy the script and modify properly. If you don't know IPv6, set IPv6 addresses as localhost(*net6="0", *ip6="::1").</p>\r
881 \r
882 <table><tr><td><pre>\r
883 # cd /etc/opengate\r
884 # cp rc.firewall.sample rc.firewall\r
885 # vi rc.virewall\r
886 </pre></td></tr></table>\r
887 \r
888 <p>Modify firewall setting in /erc/rc.conf as follows. Be care that accesses after this setting might be denied by the firewall.</p>\r
889 \r
890 <table><tr><td><pre>\r
891 firewall_enable="YES"\r
892 firewall_script="/etc/opengate/rc.firewall"\r
893 </pre></td></tr></table>\r
894 \r
895 \r
896 <p>Be familiar with the ipfw command. Opengate is a software to send out ipfw add/delete command.</p>\r
897 \r
898 <p>Opengate adds/removes the allow rule (rule number:10000-40000) for the authenticated terminals.  And the forward rule is exists in less priority position(rule number:60000) in the initial setting.  Thus the packets for authenticated terminals pass the gateway, and the Web access from other terminals results the authentication page.\r
899 </p>\r
900 \r
901 <div align="right"><A href="#opengate0">back</A>&nbsp;<A href="#top">top</A></div>\r
902 \r
903 <!-- ************ 5 ************** -->\r
904 <h4>F.5&nbsp;Setup of syslog<A class=anchor href="#opengate5" name=opengate5>\81õ</A></h4>\r
905 \r
906 <p>Edit /etc/syslog.conf to save log file for Opengate.</p>\r
907 \r
908 <table><tr><td><pre>\r
909          | Separeted by TAB code\r
910          V\r
911 local1.*   /var/log/opengate.log\r
912 </pre></td></tr></table>\r
913 \r
914 <p>Make the log file as follows. Be care to control the size of this log file.</p>\r
915 \r
916 <table><tr><td><pre>\r
917 # touch /var/log/opengate.log\r
918 </pre></td></tr></table>\r
919 \r
920 <div align="right"><A href="#opengate0">back</A>&nbsp;<A href="#top">top</A></div>\r
921 \r
922 <!-- ************ 6 ************** -->\r
923 <h4>F.6&nbsp;Checking Behavior<A class=anchor href="#opengate6" name=opengate6>\81õ</A></h4>\r
924 \r
925 <p>Connect a PC to the lower-side network and access to a site in the upper-side network. If it does not work properly, refer doc/progflow.html and doc/protocol.txt to understand the procedure. And see the log file for Opengate, httpd, system and others. To dump more information from Opengate, set the &lt;Debug&gt; switch "2" in opengatesrv.conf. Check also the functions of related software. The error checking document(errcheck.html) and Q and A document (qa.html, recentqa.html in web) might be used for problem solving.</p>\r
926 \r
927 <div align="right"><A href="#opengate0">back</A>&nbsp;<A href="#top">top</A></div>\r
928 \r
929 <!-- ************ 7 ************** -->\r
930 <h4>F.7&nbsp;Modification of Pages<A class=anchor href="#opengate7" name=opengate7>\81õ</A></h4>\r
931 \r
932 <p>\r
933 If you want to modify the contents of web pages, edit the html files in Opengate directories. The relative path cannot use in httpkeep.html. Use the URL of full description. The descriptions such as %%XXX%% are variables replaced with some proper values in CGI. </p>\r
934 \r
935 <div align="right"><A href="#opengate0">back</A>&nbsp;<A href="#top">top</A></div>\r
936 \r
937 \r
938 <hr>\r
939 <!-- Start:Install MRTG -->\r
940 <h3>G&nbsp;MRTG Install(Optional)<A class=anchor href="#mrtg0" name=mrtg0>&dagger;</A></h3>\r
941 \r
942 <ul>\r
943         <li class="list_num"><A href="#mrtg1">Install (ports)</A></li>\r
944         <li class="list_num"><A href="#mrtg2">Setup MRTG</A></li>\r
945         <li class="list_num"><A href="#mrtg3">Start confirmation</A></li>\r
946         <li class="list_num"><A href="#mrtg4">Setup crontab</A></li>\r
947 </ul>\r
948 \r
949 <!-- ************ 1 ************** -->\r
950 <h4>G.1&nbsp;Ports Install<A class=anchor href="#mrtg1" name=mrtg1>&dagger;</A></h4>\r
951 \r
952 <p>This is optional.  When you want to watch the state of Opengate, MRTG can be used but is not required usually.</p>\r
953 \r
954 <p><a href="http://people.ee.ethz.ch/~oetiker/webtools/mrtg/" target="_blank">MRTG</a>(Multi Router Traffic Grapher) is system to watch network traffic. \r
955 MRTG makes graphic images and HTML files. </p>\r
956 \r
957 <p>You can install MRTG to gateway server or another server. If you must watch plural Opengate, you \r
958 had better install MRTG to another server.</p>\r
959 \r
960 <table><tr><td><pre>\r
961 # cd /usr/ports/net-mgmt/mrtg/\r
962 # make clean\r
963 # make install clean ; rehash\r
964 </pre></td></tr></table>\r
965 \r
966 <div align="right"><A href="#mrtg0">back</A>&nbsp;<A href="#top">top</A></div><!-- ************ 2 ************** -->\r
967 <h4>G.2&nbsp;Setup of MRTG<A class=anchor href="#mrtg2" name=mrtg2>&dagger;</A></h4>\r
968 \r
969 <p>There is "/usr/local/etc/mrtg/mrtg.cfg.sample" as configuration file after instalation. \r
970 Copy mrtg.cfg.sample to opengate.cfg and edit configuration file.</p>\r
971 \r
972 <table><tr><td><pre>\r
973 ##################################################\r
974 #  opengate user counter\r
975 \r
976 WorkDir: /usr/home/user/public_html/mrtg/opengate/\r
977 \r
978 ##### Options\r
979 Options[^]: growright,gauge,nopercent,integer\r
980 \r
981 Target[opengate]:`/usr/home/user/bin/input.sh`\r
982 Title[opengate]: Opengate user counter\r
983 \r
984 PageTop[opengate]: &lt;h1&gt;Opengate user counter&lt;/h1&gt;\r
985  &lt;p&gt;Show the number of people using Opengate&lt;/p&gt;\r
986 \r
987 # Max Number\r
988 MaxBytes[opengate]: 200\r
989 \r
990 # Title of Y axis\r
991 YLegend[opengate]: Opengate User\r
992 # unit\r
993 ShortLegend[opengate]: s\r
994 # Title of graph LegendI: first line LegendO: second line\r
995 LegendI[opengate]: IPv6 Users\r
996 LegendO[opengate]: Total Users\r
997 </pre></td></tr></table>\r
998 \r
999 <p>make a directory which you appointed in "WorkDir". MRTG makes graphic images and HTML files in WorkDir.</p>\r
1000 \r
1001 <p>"Target[opengate]" is path to program to hand data to MRTG. explain below th details.</p>\r
1002 \r
1003 \r
1004 \r
1005 <h5>G.2.1&nbsp;Case of gateway server<A class=anchor href="#mrtg21" name=mrtg21>&dagger;</A></h5>\r
1006 \r
1007 <p>Put this shellscript as "/usr/home/user/bin/input.sh".</p>\r
1008 \r
1009 <table><tr><td><pre>\r
1010 #!/bin/sh\r
1011 \r
1012 #######################################\r
1013 ##\r
1014 ## show opengate status for MRTG\r
1015 ##\r
1016 ##   1 line : IPv6 Users\r
1017 ##   2 line : Total Users\r
1018 ##   3 line : uptime\r
1019 ##   4 line : comment for data\r
1020 ##\r
1021 #######################################\r
1022 \r
1023 LANG=C\r
1024 COLUMNS=256\r
1025 \r
1026 export LANG\r
1027 export COLUMNS\r
1028 \r
1029 ### IPv6 prefix\r
1030 prefix="2001:2f8:22:801:"\r
1031 ###opengateprocessname\r
1032 process="opengatesrv.cgi" \r
1033 \r
1034 ###tmp file  name\r
1035 tmp_all="/tmp/og_count_all.tmp"\r
1036 tmp_6="/tmp/og_count_6.tmp"\r
1037 \r
1038 ######################################################\r
1039 psax | grep $process &gt; $tmp_all\r
1040 COUNT = `wc-l $tmp_all | awk '{print $1}'` \r
1041 grep $prefix $tmp_all &gt;  $tmp_6\r
1042 COUNT6=`wc -l $tmp_6 | awk '{print $1}'`\r
1043 UPTIME=`uptime | awk '{print $3$4}' | sed -e "s/,//g"`\r
1044 \r
1045 rm $tmp_all\r
1046 rm $tmp_6\r
1047 \r
1048 echo "$COUNT6"\r
1049 echo "$COUNT"\r
1050 echo "$UPTIME"\r
1051 echo "Opengate User Counter"\r
1052 </pre></td></tr></table>\r
1053 \r
1054 <p>carry out this shell script alone and confirm that you can acquire the following data.</p>\r
1055 \r
1056 <table><tr><td><pre>5\r
1057 48\r
1058 10days\r
1059 Opengate User Counter\r
1060 </pre></td></tr></table>\r
1061 \r
1062 \r
1063 <h5>G.2.2&nbsp;Case of another server<A class=anchor href="#mrtg22" name=mrtg22>&dagger;</A></h5>\r
1064 \r
1065 <p>Put this shellscript as "/usr/home/user/bin/input.sh" on another server.</p>\r
1066 \r
1067 <table><tr><td><pre>\r
1068 #!/bin/sh\r
1069 \r
1070 #######################################\r
1071 ##\r
1072 ## input data for MRTG\r
1073 ##\r
1074 ##   1 line : IPv6 Users\r
1075 ##   2 line : Total Users\r
1076 ##   3 line : uptime\r
1077 ##   4 line : comment for data\r
1078 ##\r
1079 #######################################\r
1080 \r
1081 # tmp file name\r
1082 file="/tmp/opengate.tmp"\r
1083 \r
1084 # URL of output.sh at opengate\r
1085 url="http://opengate.saga-u.ac.jp/cgi-bin/output.sh"\r
1086 \r
1087 fetch -o $file $url &amp;&gt; /dev/null\r
1088 \r
1089 more $file\r
1090 </pre></td></tr></table>\r
1091 \r
1092 <p>Put this shell script as "/usr/local/apache2/cgi-bin/output.sh" on Opengate server. \r
1093 And set this URL to $url in script explained by the above.</p>\r
1094 \r
1095 <table><tr><td><pre>\r
1096 #!/bin/sh\r
1097 \r
1098 #######################################\r
1099 ##\r
1100 ## show opengate status for MRTG\r
1101 ##\r
1102 ##   1 line : IPv6 Users\r
1103 ##   2 line : Total Users\r
1104 ##   3 line : uptime\r
1105 ##   4 line : comment for data\r
1106 ##\r
1107 #######################################\r
1108 \r
1109 LANG=C\r
1110 COLUMNS=256\r
1111 \r
1112 export LANG\r
1113 export COLUMNS\r
1114 \r
1115 ### IPv6 prefix\r
1116 prefix="2001:2f8:22:801:"\r
1117 ###opengateprocessname\r
1118 process="opengatesrv.cgi" \r
1119 \r
1120 ###tmp file name\r
1121 tmp_all="/tmp/og_count_all.tmp"\r
1122 tmp_6="/tmp/og_count_6.tmp"\r
1123 \r
1124 ######################################################\r
1125 psax | grep $process &gt; $tmp_all \r
1126 COUNT = `wc-l $tmp_all | awk '{print $1}'` \r
1127 grep $prefix $tmp_all &gt;  $tmp_6\r
1128 COUNT6=`wc -l $tmp_6 | awk '{print $1}'`\r
1129 UPTIME=`uptime | awk '{print $3$4}' | sed -e "s/,//g"`\r
1130 rm $tmp_all\r
1131 rm $tmp_6\r
1132 \r
1133 echo "Content-type: text/plain; charset=iso-8859-1"\r
1134 echo\r
1135 \r
1136 echo "$COUNT6"\r
1137 echo "$COUNT"\r
1138 echo "$UPTIME"\r
1139 echo "Opengate User Counter"\r
1140 </pre></td></tr></table>\r
1141 \r
1142 <p>carry out "input.sh" shell script on another server and confirm that you can acquire the following data.</p>\r
1143 \r
1144 <table><tr><td><pre>5\r
1145 48\r
1146 10days\r
1147 Opengate User Counter\r
1148 </pre></td></tr></table>\r
1149 \r
1150 <div align="right"><A href="#mrtg0">back</A>&nbsp;<A href="#top">top</A></div><!-- ************ 3 ************** -->\r
1151 <h4>G.3&nbsp;Start confirmation<A class=anchor href="#mrtg3" name=mrtg3>&dagger;</A></h4>\r
1152 \r
1153 <p>Confirm after setting was completed.</p>\r
1154 \r
1155 <table><tr><td><pre>\r
1156 # /usr/local/bin/mrtg /usr/local/etc/mrtg/opengate.cfg\r
1157 </pre></td></tr></table>\r
1158 \r
1159 <p>Various WARNING is output the first and second time.</p>\r
1160 \r
1161 <p>There is some files in "WorkDir".</p>\r
1162 \r
1163 <table><tr><td><pre>&gt; ls -l\r
1164 -rw-r--r--  1 root  wheel    538 12 14 04:40 mrtg-l.png\r
1165 -rw-r--r--  1 root  wheel    414 12 14 04:40 mrtg-m.png\r
1166 -rw-r--r--  1 root  wheel   1759 12 14 04:40 mrtg-r.png\r
1167 -rw-r--r--  1 root  wheel   2941 12 20 15:15 opengate-day.png\r
1168 -rw-r--r--  1 root  wheel   2146 12 20 14:35 opengate-month.png\r
1169 -rw-r--r--  1 root  wheel   2867 12 20 14:55 opengate-week.png\r
1170 -rw-r--r--  1 root  wheel   1897 12 20 05:00 opengate-year.png\r
1171 -rw-r--r--  1 root  wheel   5961 12 20 15:15 opengate.html\r
1172 -rw-r--r--  1 root  wheel  48786 12 20 15:15 opengate.log\r
1173 -rw-r--r--  1 root  wheel  48784 12 20 15:10 opengate.old\r
1174 </pre></td></tr></table>\r
1175 \r
1176 <div align="right"><A href="#mrtg0">back</A>&nbsp;<A href="#top">top</A></div>\r
1177 \r
1178 <!-- ************ 4 ************** -->\r
1179 <h4>G.4&nbsp;Setup crontab<A class=anchor href="#mrtg4" name=mrtg4>&dagger;</A></h4>\r
1180 \r
1181 <p>Add next line to "/etc/crontab".</p>\r
1182 \r
1183 <table><tr><td><pre>\r
1184 */5 * * * * root /usr/local/bin/mrtg /usr/local/etc/mrtg/opengate.cfg\r
1185 </pre></td></tr></table>\r
1186 \r
1187 <div align="right"><A href="#mrtg0">back</A>&nbsp;<A href="#top">top</A></div>\r
1188 \r
1189 \r
1190 <!-- ************ 1 ************** -->\r
1191 <h3>H&nbsp;rulechk Install(Optional)<A class=anchor href="#rulechk" name=rulechk>&dagger;</A></h3>\r
1192 \r
1193 <p>This is optional. At the abnormal termination of Opengate process, superfluous rule might be left bihind. \r
1194 Though it is very rare, a script dealing with the case is prepared in tools/rulechk. This script is compatible with Opengate Ver1.3.1 or later.\r
1195 This script compares the Opengate process list and the firewall rule list, and deletes the superfluous rules.\r
1196 </p>\r
1197 <div align="right"><A href="#rulechk">back</A>&nbsp;<A href="#top">top</A></div>\r
1198 \r
1199 </body>\r
1200 </html>\r