OSDN Git Service

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