]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - html/cgi-bin/wio.cgi
suricata: Change midstream policy to "pass-flow"
[people/pmueller/ipfire-2.x.git] / html / cgi-bin / wio.cgi
CommitLineData
0d6cc79d
SF
1#!/usr/bin/perl
2#
3###############################################################################
4# #
5# IPFire.org - A linux based firewall #
730e96c9 6# Copyright (C) 2017-2021 Stephan Feddersen <sfeddersen@ipfire.org> #
0d6cc79d
SF
7# All Rights Reserved. #
8# #
9# This program is free software: you can redistribute it and/or modify #
10# it under the terms of the GNU General Public License as published by #
11# the Free Software Foundation, either version 3 of the License, or #
12# (at your option) any later version. #
13# #
14# This program is distributed in the hope that it will be useful, #
15# but WITHOUT ANY WARRANTY; without even the implied warranty of #
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
17# GNU General Public License for more details. #
18# #
19# You should have received a copy of the GNU General Public License #
20# along with this program. If not, see <http://www.gnu.org/licenses/>. #
21# #
22###############################################################################
23#
730e96c9 24# Version: 2021/02/16 21:32:23
0d6cc79d 25#
391a2459 26# This wio.cgi is based on the code from the IPCop WIO Addon
0d6cc79d
SF
27# and is extremly adapted to work with IPFire.
28#
29# Autor: Stephan Feddersen
30# Co-Autor: Alexander Marx
391a2459 31# Co-Autor: Frank Mainz (for some code for the IPCop WIO Addon)
0d6cc79d
SF
32#
33
34use strict;
35
36# enable only the following on debugging purpose
37#use warnings;
38#no warnings 'once';
39#use CGI::Carp 'fatalsToBrowser';
40
41my $debug = 0;
42
43use Socket;
44use POSIX qw(strftime);
45use File::Copy;
46use Fatal qw/ open /;
47use Net::Telnet;
48
49require '/var/ipfire/general-functions.pl';
1bee37ba 50require '/var/ipfire/network-functions.pl';
0d6cc79d
SF
51require '/var/ipfire/lang.pl';
52require '/var/ipfire/header.pl';
53require '/usr/lib/wio/wio-lib.pl';
54require '/usr/lib/wio/wio-graphs.pl';
55
56my $logdir = "/var/log/wio";
57
391a2459 58my ( %mainsettings, %mailsettings, %wiosettings, %cgiparams, %netsettings, %ipshash, %vpnsettings,
0d6cc79d
SF
59 %vpnconfighash, %ovpnconfighash, %ovpnccdconfhash, %ovpnsettings, %checked, %selected, %color ) = ();
60
61&General::readhash('/var/ipfire/main/settings', \%mainsettings);
62&General::readhash('/var/ipfire/ethernet/settings', \%netsettings);
63&General::readhash('/var/ipfire/dma/mail.conf', \%mailsettings);
64&General::readhash('/var/ipfire/wio/wio.conf', \%wiosettings);
8186b372 65&General::readhash("/srv/web/ipfire/html/themes/ipfire/include/colors.txt", \%color);
0d6cc79d
SF
66&General::readhasharray('/var/ipfire/ovpn/ovpnconfig', \%ovpnconfighash);
67&General::readhash('/var/ipfire/ovpn/settings', \%ovpnsettings);
68&General::readhasharray('/var/ipfire/ovpn/ccd.conf', \%ovpnccdconfhash);
69&General::readhasharray('/var/ipfire/vpn/config', \%vpnconfighash);
391a2459 70&General::readhash('/var/ipfire/vpn/settings', \%vpnsettings);
0d6cc79d
SF
71
72my $ipadrfile = "$logdir/wioips";
73my $onoffip = "$logdir/wioscip";
74my $wiosettings = "/var/ipfire/wio/wio.conf";
75my $dyndnsconfig = "/var/ipfire/ddns/config";
76my $importfile = "$logdir/importfile";
77my $wiofile = "$logdir/wiofile";
78my $editfile = "$logdir/editfile";
79my $hostfile = "/var/ipfire/main/hosts";
80my $dhcpfile = "/var/ipfire/dhcp/fixleases";
81my $imgstatic = "/images/wio";
82my $rrddir = "/var/log/rrd/wio";
83my $refreshbox = '<meta http-equiv="refresh" content="0;url=/cgi-bin/wio.cgi">';
84my $sortstring = '^IPADR|^HOST';
85my $ovpnaddon = "/var/ipfire/ovpn";
86my $ovpnpid = "/var/run/openvpn.pid";
87my $vpnpid = "/var/run/charon.pid";
88my $redactive = "/var/ipfire/red/active";
89my $redip = '-';
90my $now = strftime "%Y-%m-%d", localtime;
91
92if ( -e $redactive ) {
93 open(IPADDR, "/var/ipfire/red/local-ipaddress");
94 $redip = <IPADDR>;
95 close IPADDR;
96 chomp($redip);
97}
98
99my $i = 0;
100my $idarp = 0;
101my $iddyndns = 0;
102my $idvpn = 0;
103my $idovpn = 0;
104my $idsort = 0;
105my $nr = 0;
106my $count = 0;
107my $showcount = 0;
108
a25c95b3 109my $arpbuttontext = "$Lang::tr{'wio_show_table_on'}";
c1fc92a9
SFD
110my $clientimportbuttontext = "$Lang::tr{'wio_show_table_on'}";
111my $networksearchbuttontext = "$Lang::tr{'wio_show_table_on'}";
a25c95b3 112
c1fc92a9 113my ( $message, $infomessage, $errormessage, $importmessage ) = '';
0d6cc79d
SF
114
115my ( $buttontext, $host, $timestamp, $ipadr, $on, $remark, $dyndns, $dyndnsip, $sendemailon, $net, $dev, $iprange, $output, $write, $webinterface,
391a2459 116 $sendemailoff, $pingmethode, $online, $color, $bgcolor, $exitcode, $id, $line, $interface, $counter, $vpnn2nip, $vpnn2nmask, $edc,
0d6cc79d
SF
117 $edd, $wmon, $wmoff, $ipfqdn, $http, $wioscan, $statustxt, $status, $key, $ic, $text, $image ) = ();
118
119my ( @temp, @dates, @ipaddresses, @names, @remark, @sendemailon, @sendemailoff, @current, @ddns, @match, @webinterface, @arpcache, @arpadd, @line,
120 @hosts, @vpnstatus, @ovpnstatus, @activ, @dyndns, @pingmethode, @status, @id, @write, @log );
121
122my @nosaved = ('ACTION','ID','CLIENTID','TIMESTAMP','IPADR','HOST','REMARK','DYNDNS','SENDEMAILON','SENDEMAILOFF','PINGMETHODE','ONLINE','WEBINTERFACE');
123
124my @devs_color = ('GREEN','BLUE','ORANGE','RED');
125my @devs_net = ('green0','blue0','orange0','red0');
126my @devs_img = ('green.png','blue.png','orange.png','red.png');
127my @devs_alt = ('green','blue','orange','red');
128
129my %ifacecolor = ( GREEN => 'wio_run_green', BLUE => 'wio_run_blue', ORANGE => 'wio_run_orange');
130
391a2459 131
0d6cc79d
SF
132&loadips();
133
134## some wio settings
135
136$wiosettings{'ACTION'} = '';
137$wiosettings{'COUNT'} = '';
138$wiosettings{'ID'} = '';
139$wiosettings{'CLIENTID'} = '';
140$wiosettings{'SORT'} = 'IPADR';
141$wiosettings{'HOST'} = '';
142$wiosettings{'IPADR'} = '';
143$wiosettings{'EN'} = 'on';
144$wiosettings{'REMARK'} = '';
145$wiosettings{'DYNDNS'} = '';
146$wiosettings{'CLIENTREMARK'} = '';
147$wiosettings{'SENDEMAILON'} = '';
148$wiosettings{'SENDEMAILOFF'} = '';
149$wiosettings{'PINGMETHODE'} = 'ip';
150$wiosettings{'WEBINTERFACE'} = '----';
151$wiosettings{'TIMEOUT'} = '1';
152$wiosettings{'TIMESTAMP'} = '';
153$wiosettings{'ONLINE'} = 'off';
154$wiosettings{'CRON'} = '15';
155$wiosettings{'OVPNCRON'} = '5';
156$wiosettings{'ENABLE'} = 'off';
157$wiosettings{'LOGGING'} = 'off';
158$wiosettings{'MAILREMARK'} = 'off';
159$wiosettings{'MAILSTYLE'} = 'email';
160$wiosettings{'OVPNRWMAIL'} = 'off';
a25c95b3
SFD
161$wiosettings{'WIOGUISHOWARPTABLE'} = '';
162$wiosettings{'WIOGUISHOWCLIENTIMPORTTABLE'} = '';
163$wiosettings{'WIOGUISHOWNETWORKSEARCHTABLE'} = '';
0d6cc79d
SF
164
165&Header::getcgihash(\%wiosettings);
166&Header::getcgihash(\%mainsettings);
167&Header::getcgihash(\%mailsettings);
168&Header::getcgihash(\%netsettings);
169
170if ( $mailsettings{'USEMAIL'} eq 'on' ) { $wiosettings{'SENDEMAIL'} = 'on'; }
171else { $wiosettings{'SENDEMAIL'} = 'off'; }
172
173if ( -e $wiofile ) { goto WIOSCAN; }
174
175## get network ips
176foreach (@devs_color) {
177 if ( $netsettings{"${_}_DEV"} ne '' ) {
1bee37ba 178 $wiosettings{"${_}_IPLOW"} = &Network::find_next_ip_address($netsettings{"${_}_NETADDRESS"}, 1);
b67f02d5
MT
179
180 my $broadcast = &Network::get_broadcast($netsettings{"${_}_NETADDRESS"} . "/" . $netsettings{"${_}_NETMASK"});
181 $wiosettings{"${_}_IPHIGH"} = &Network::find_next_ip_address($broadcast, -1);
0d6cc79d
SF
182 }
183}
184
185## save wio settings
186
187if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_save'}.'1' ) {
188 unless ( `ps -A | grep wio.pl` ) {
189 $cgiparams{'SORT'} = $wiosettings{'SORT'};
190 $cgiparams{'CRON'} = $wiosettings{'CRON'};
191 $cgiparams{'OVPNCRON'} = $wiosettings{'OVPNCRON'};
192 $cgiparams{'ENABLE'} = $wiosettings{'ENABLE'};
193 $cgiparams{'LOGGING'} = $wiosettings{'LOGGING'};
194 $cgiparams{'TIMEOUT'} = $wiosettings{'TIMEOUT'};
195 $cgiparams{'ACTION'} = $wiosettings{'ACTION'};
196 $cgiparams{'CLIENTREMARK'} = $wiosettings{'CLIENTREMARK'};
197 $cgiparams{'MAILREMARK'} = $wiosettings{'MAILREMARK'};
198 $cgiparams{'MAILSTYLE'} = $wiosettings{'MAILSTYLE'};
199 $cgiparams{'OVPNRWMAIL'} = $wiosettings{'OVPNRWMAIL'};
0d6cc79d
SF
200
201 &General::writehash($wiosettings, \%cgiparams);
202 &General::readhash($wiosettings, \%wiosettings);
203
204 if ( $wiosettings{'ENABLE'} eq 'off' ) {
205 &WIO::clearfile($ipadrfile);
206 unlink glob "$rrddir/*";
207 }
208 }
209 else {
210 $infomessage = "$Lang::tr{'wio_error_function'}";
211 }
212}
213
214## save imported clients
215
216if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_save'}.'2' ) {
217 unless ( `ps -A | grep wio.pl` ) {
218 while ( $count < $wiosettings{'COUNT'} ) {
219 if ( defined($wiosettings{"USE$count"}) && $wiosettings{"USE$count"} eq 'on' ) {
83596e70 220 $wiosettings{'CLIENTID'} = $wiosettings{"CLIENTID$count"};
0d6cc79d
SF
221 $wiosettings{'TIMESTAMP'} = $wiosettings{"TIMESTAMP$count"};
222 $wiosettings{'IPADR'} = $wiosettings{"IPADR$count"};
223 $wiosettings{'HOST'} = $wiosettings{"HOST$count"};
224 $wiosettings{'EN'} = $wiosettings{"EN$count"};
225 $wiosettings{'REMARK'} = $wiosettings{"REMARK$count"};
226 $wiosettings{'DYNDNS'} = $wiosettings{"DYNDNS$count"};
227 $wiosettings{'SENDEMAILON'} = $wiosettings{"SENDEMAILON$count"};
228 $wiosettings{'SENDEMAILOFF'} = $wiosettings{"SENDEMAILOFF$count"};
229 $wiosettings{'PINGMETHODE'} = $wiosettings{"PINGMETHODE$count"};
230 $wiosettings{'ONLINE'} = $wiosettings{"ONLINE$count"};
83596e70 231 $wiosettings{'WEBINTERFACE'} = $wiosettings{"WEBINTERFACE$count"};
0d6cc79d
SF
232
233 &validSave();
234
235 if ($errormessage) {
236 open(FILE, ">> $editfile");
237 print FILE "$wiosettings{'CLIENTID'},$wiosettings{'TIMESTAMP'},$wiosettings{'IPADR'},$wiosettings{'HOST'},$wiosettings{'EN'},$wiosettings{'REMARK'},$wiosettings{'DYNDNS'},$wiosettings{'SENDEMAILON'},$wiosettings{'SENDEMAILOFF'},$wiosettings{'PINGMETHODE'},$wiosettings{'ONLINE'},$wiosettings{'WEBINTERFACE'}\n";
238 close(FILE);
239 $importmessage = $errormessage;
240 }
241 else {
242 $wiosettings{'CLIENTID'} = &General::findhasharraykey (\%ipshash);
243 unshift (@current, "$wiosettings{'CLIENTID'},$wiosettings{'TIMESTAMP'},$wiosettings{'IPADR'},$wiosettings{'HOST'},$wiosettings{'EN'},$wiosettings{'REMARK'},$wiosettings{'DYNDNS'},$wiosettings{'SENDEMAILON'},$wiosettings{'SENDEMAILOFF'},$wiosettings{'PINGMETHODE'},$wiosettings{'ONLINE'},$wiosettings{'WEBINTERFACE'}\n");
244 &SortDataFile('',@current);
245 }
246 }
247 $count++;
248 }
249
250 map ($wiosettings{$_} = '' ,@nosaved);
251 unlink ($importfile);
252 if ( -e "$editfile" ) { goto EDIT; }
253 }
254 else {
255 $infomessage = "$Lang::tr{'wio_error_function'}";
256 }
257}
258
259## add or update client
260
261if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_client_add'} ) {
262 unless ( `ps -A | grep wio.pl` ) {
263 &validSave();
264
265 unless ($errormessage) {
266 if ( $wiosettings{'ID'} eq '' && $wiosettings{'ACTION'} ne $Lang::tr{'edit'} ) {
267 $wiosettings{'CLIENTID'} = &General::findhasharraykey (\%ipshash);
268 unshift (@current, "$wiosettings{'CLIENTID'},$wiosettings{'TIMESTAMP'},$wiosettings{'IPADR'},$wiosettings{'HOST'},$wiosettings{'EN'},$wiosettings{'REMARK'},$wiosettings{'DYNDNS'},$wiosettings{'SENDEMAILON'},$wiosettings{'SENDEMAILOFF'},$wiosettings{'PINGMETHODE'},$wiosettings{'ONLINE'},$wiosettings{'WEBINTERFACE'}\n");
269 }
270 else {
271 @current[$wiosettings{'ID'}] = "$wiosettings{'CLIENTID'},$wiosettings{'TIMESTAMP'},$wiosettings{'IPADR'},$wiosettings{'HOST'},$wiosettings{'EN'},$wiosettings{'REMARK'},$wiosettings{'DYNDNS'},$wiosettings{'SENDEMAILON'},$wiosettings{'SENDEMAILOFF'},$wiosettings{'PINGMETHODE'},$wiosettings{'ONLINE'},$wiosettings{'WEBINTERFACE'}\n";
272 }
273 }
274 else { goto ERROR; }
275
276 map ($wiosettings{$_} = '' ,@nosaved);
277 &SortDataFile('',@current);
278 }
279 else {
280 $infomessage = "$Lang::tr{'wio_error_function'}";
281 }
282}
283
a25c95b3
SFD
284## show / hide arptable
285
c1fc92a9 286if ( $wiosettings{'WIOGUISHOWARPTABLE'} eq 'arptable' ) {
83596e70
SF
287 unless ( `ps -A | grep wio.pl` ) {
288 if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_show_table_off'} ) {
289 $wiosettings{'WIOGUISHOWARPTABLE'} = 'off';
290 $arpbuttontext = "$Lang::tr{'wio_show_table_on'}";
291 }
292 else {
293 $wiosettings{'WIOGUISHOWARPTABLE'} = 'on';
294 $arpbuttontext = "$Lang::tr{'wio_show_table_off'}";
295 }
a25c95b3
SFD
296 }
297 else {
83596e70 298 $infomessage = "$Lang::tr{'wio_error_function'}";
a25c95b3
SFD
299 }
300}
301
302## show / hide clientimporttable
303
304if ( $wiosettings{'WIOGUISHOWCLIENTIMPORTTABLE'} eq 'clientimport' ) {
83596e70
SF
305 unless ( `ps -A | grep wio.pl` ) {
306 if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_show_table_off'} ) {
307 $wiosettings{'WIOGUISHOWCLIENTIMPORTTABLE'} = 'off';
308 $clientimportbuttontext = "$Lang::tr{'wio_show_table_on'}";
309 }
310 else {
311 $wiosettings{'WIOGUISHOWCLIENTIMPORTTABLE'} = 'on';
312 $clientimportbuttontext = "$Lang::tr{'wio_show_table_off'}";
313 }
a25c95b3
SFD
314 }
315 else {
83596e70 316 $infomessage = "$Lang::tr{'wio_error_function'}";
a25c95b3
SFD
317 }
318}
319
320## show / hide networksearchtable
321
322if ( $wiosettings{'WIOGUISHOWNETWORKSEARCHTABLE'} eq 'networksearch' ) {
83596e70
SF
323 unless ( `ps -A | grep wio.pl` ) {
324 if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_show_table_off'} ) {
325 $wiosettings{'WIOGUISHOWNETWORKSEARCHTABLE'} = 'off';
326 $networksearchbuttontext = "$Lang::tr{'wio_show_table_on'}";
327 }
328 else {
329 $wiosettings{'WIOGUISHOWNETWORKSEARCHTABLE'} = 'on';
330 $networksearchbuttontext = "$Lang::tr{'wio_show_table_off'}";
331 }
a25c95b3
SFD
332 }
333 else {
83596e70 334 $infomessage = "$Lang::tr{'wio_error_function'}";
a25c95b3
SFD
335 }
336}
337
0d6cc79d
SF
338## add arp client
339
340if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_add'} ) {
341 unless ( `ps -A | grep wio.pl` ) {
342 open(FILE, "$logdir/.arpcache");
343 @arpadd = <FILE>;
344 close (FILE);
345
346 chomp(@arpadd[$wiosettings{'ID'}]);
347 @temp = split (/\,/, @arpadd[$wiosettings{'ID'}]);
348
349 $wiosettings{'CLIENTID'} = &General::findhasharraykey (\%ipshash);
350 $wiosettings{'IPADR'} = $temp[1];
351 $wiosettings{'HOST'} = $temp[2];
352 $wiosettings{'EN'} = 'on';
353
354 $wiosettings{'PINGMETHODE'} = 'ip';
355 $wiosettings{'ONLINE'} = 'off';
356
357 open(FILE, ">> $editfile");
358 print FILE "$wiosettings{'CLIENTID'},$wiosettings{'TIMESTAMP'},$wiosettings{'IPADR'},$wiosettings{'HOST'},$wiosettings{'EN'},$wiosettings{'REMARK'},$wiosettings{'DYNDNS'},$wiosettings{'SENDEMAILON'},$wiosettings{'SENDEMAILOFF'},$wiosettings{'PINGMETHODE'},$wiosettings{'ONLINE'},$wiosettings{'WEBINTERFACE'}\n";
359 close(FILE);
360
361 goto EDIT;
362 }
363 else {
364 undef($wiosettings{'ID'});
365 $infomessage = "$Lang::tr{'wio_error_function'}";
366 }
367}
368
c1fc92a9 369## enable / disable client || enable / disable dyndns || enable / disable sendemailon || enable / disable sendemailoff || change ip / fqdn
0d6cc79d
SF
370
371if ( $wiosettings{'ACTION'} eq $Lang::tr{'enable disable client'} ) { $edc = 'on'; }
372if ( $wiosettings{'ACTION'} eq $Lang::tr{'enable disable dyndns'} ) { $edd = 'on'; }
373if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_mail_online'} ) { $wmon = 'on'; }
374if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_mail_offline'} ) { $wmoff = 'on'; }
375if (( $wiosettings{'ACTION'} eq $Lang::tr{'wio_ip_on'} ) || ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_fqdn_on'} )) { $ipfqdn = 'on'; }
376
377if ( defined($edc) || defined($edd) || defined($wmon) || defined($wmoff) || defined($ipfqdn) ) {
378 unless ( `ps -A | grep wio.pl` ) {
379 chomp(@current[$wiosettings{'ID'}]);
380 @temp = split (/\,/, @current[$wiosettings{'ID'}]);
381
382 if ( $edc eq 'on' ) {
383 $temp[4] = $temp[4] ne '' ? '' : 'on';
384 $temp[10] = '';
385 $temp[11] = '';
386 $temp[1] = '';
387 unlink "$rrddir/$temp[0].rrd";
388 }
389 elsif ( $edd eq 'on' ) { $temp[6] = $temp[6] ne '' ? '' : 'on'; }
390 elsif ( $wmon eq 'on' ) { $temp[7] = $temp[7] ne '' ? '' : 'on'; }
391 elsif ( $wmoff eq 'on' ) { $temp[8] = $temp[8] ne '' ? '' : 'on'; }
392 elsif ( $ipfqdn eq 'on' ) { $temp[9] = $temp[9] eq 'fqdn' ? 'ip' : 'fqdn'; }
393
394 @current[$wiosettings{'ID'}] = join (',', @temp)."\n";
395 undef($wiosettings{'ID'});
396
397 &writeips();
398 }
399 else {
400 undef($wiosettings{'ID'});
401 $infomessage = "$Lang::tr{'wio_error_function'}";
402 }
403}
404
405## refresh wio status || refresh single client status
406
407if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_refresh'} || $wiosettings{'ACTION'} eq $Lang::tr{'wio_sc_refresh'} ) {
408
83596e70
SF
409unless ( `ps -A | grep wio.pl` ) {
410
0d6cc79d
SF
411 if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_sc_refresh'} ) {
412 open(FILE, "> $onoffip");
413 print FILE @current[$wiosettings{'ID'}];
414 close(FILE);
415
416 undef($wiosettings{'ID'});
417 }
418
0d6cc79d
SF
419&Header::showhttpheaders();
420&Header::openpage($Lang::tr{'wio'}, 1, $refreshbox);
421&Header::openbigbox('100%', 'left', '');
422&Header::openbox('100%', 'left', $Lang::tr{'wio_info'});
423
424print"
425<table align='center' width='100%'>
426 <tr><td align='center'>$Lang::tr{'wio_msg'}</td></tr>
427 <tr><td>&nbsp;</td></tr>
428 <tr><td align='center'><img align='middle' src='/images/indicator.gif' /></td></tr>
429</table>
430";
431
432&Header::closebox();
433&Header::closebigbox();
434&Header::closepage();
435
436while ( system("/usr/local/bin/wiohelper", "&") ) {}
437
83596e70 438exit 0;
0d6cc79d
SF
439}
440else {
441 $infomessage = "$Lang::tr{'wio_already_running'}";
a25c95b3 442 unlink($onoffip);
0d6cc79d
SF
443}
444
445}
446
447## refresh dyndns ip
448
449if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_dyndns_refresh'} ) {
450 unless ( `ps -A | grep wio.pl` ) {
451 chomp(@current[$wiosettings{'ID'}]);
452 @temp = split (/\,/, @current[$wiosettings{'ID'}]);
453
454 ($temp[2], $infomessage) = &WIO::getdyndnsip($temp[2], $temp[3]);
455
456 @current[$wiosettings{'ID'}] = join (',', @temp)."\n";
457
458 &writeips();
459
460 undef($wiosettings{'ID'});
461 }
462 else {
463 $infomessage = "$Lang::tr{'wio_error_function'}";
464 }
465}
466
467## edit client
468
469if ( $wiosettings{'ACTION'} eq $Lang::tr{'edit'} ) {
470 unless ( `ps -A | grep wio.pl` ) {
471 chomp(@current[$wiosettings{'ID'}]);
472 @temp = split (/\,/, @current[$wiosettings{'ID'}]);
473
474 $wiosettings{'CLIENTID'} = $temp[0];
475 $wiosettings{'TIMESTAMP'} = $temp[1];
476 $wiosettings{'IPADR'} = $temp[2];
477 $wiosettings{'HOST'} = $temp[3];
478 $wiosettings{'EN'} = $temp[4];
479 $wiosettings{'REMARK'} = $temp[5];
480 $wiosettings{'DYNDNS'} = $temp[6];
481 $wiosettings{'SENDEMAILON'} = $temp[7];
482 $wiosettings{'SENDEMAILOFF'} = $temp[8];
483 $wiosettings{'PINGMETHODE'} = $temp[9];
484 $wiosettings{'ONLINE'} = $temp[10];
485 $wiosettings{'WEBINTERFACE'} = $temp[11];
486 }
487 else {
488 undef($wiosettings{'ACTION'});
489 $infomessage = "$Lang::tr{'wio_error_function'}";
490 }
491}
492
493## remove client
494
495if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_remove_client'} ) {
496 unless ( `ps -A | grep wio.pl` ) {
497 chomp(@current[$wiosettings{'ID'}]);
498
499 @temp = split (/\,/, @current[$wiosettings{'ID'}]);
500
501 unlink "$rrddir/$temp[0].rrd";
502
503 splice (@current,$wiosettings{'ID'},1);
504
505 &writeips();
506
507 undef($wiosettings{'ID'});
508 }
509 else {
510 undef($wiosettings{'ID'});
511 $infomessage = "$Lang::tr{'wio_error_function'}";
512 }
513}
514
515## remove all clients
516
517if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_remove_all'} ) {
518 unless ( `ps -A | grep wio.pl` ) {
519 &WIO::clearfile($ipadrfile);
520 unlink glob "$rrddir/*";
521 undef(@current);
522 }
523 else {
524 $infomessage = "$Lang::tr{'wio_error_function'}";
525 }
526}
527
528## back function
529
530if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_back'} ) {
531 if ( -e "$importfile" ) { unlink ($importfile); }
532 map ($wiosettings{$_} = '' ,@nosaved);
533 undef($errormessage);
534}
535
536## import hosts, fixleases or csv file || scan networks (green/blue/orange)
537
538if ( $wiosettings{'ACTION'} eq 'wio_run_green' ||
539 $wiosettings{'ACTION'} eq 'wio_run_blue' ||
391a2459 540 $wiosettings{'ACTION'} eq 'wio_run_red' ||
0d6cc79d
SF
541 $wiosettings{'ACTION'} eq 'wio_run_orange') { $wioscan = 'on'; }
542
543if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_import'}.'1' ||
544 $wiosettings{'ACTION'} eq $Lang::tr{'wio_import'}.'2' ||
545 $wiosettings{'ACTION'} eq $Lang::tr{'wio_import'}.'3' ||
546 defined($wioscan) || defined($importmessage) ) {
547
548unless ( `ps -A | grep wio.pl` ) {
549 if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_import'}.'1' && $importmessage eq '' ) {
550
551 &Header::getcgihash(\%wiosettings, {'wantfile' => 1, 'filevar' => 'CSVFILE'});
552
553 if ( $wiosettings{'CSVFILE'} eq '' ) {
554 $errormessage = $Lang::tr{'wio_no_file_selected'};
555 $message = 2; goto ERROR;
556 }
557
558 if ( $wiosettings{'CSVFILE'} =~ /[^a-z0-9A-Z\ \.\-\_\:\\]+/ ) {
559 $errormessage = $Lang::tr{'wio_no_csv_error'};
560 $message = 2; goto ERROR;
561 }
562
563 if ( !($wiosettings{'CSVFILE'} =~ /.csv$/) ) {
564 $errormessage = $Lang::tr{'wio_no_csv'};
565 $message = 2; goto ERROR;
566 }
567
568 if (copy($wiosettings{'CSVFILE'}, "$logdir/importfile") != 1) {
569 $errormessage = $!;
570 $message = 2; goto ERROR;
571 }
572 }
573
574EDIT:
575
576&General::readhash($wiosettings, \%wiosettings);
577
578&Header::showhttpheaders();
579&Header::openpage($Lang::tr{'wio'}, 1, '');
580&Header::openbigbox('100%', 'left');
581
582if ($importmessage) {
583 &Header::openbox('100%', 'left', $Lang::tr{'wio_error'}, 'error');
584 print" <table width='100%'><tr><td><font class='base'>$importmessage</font></td></tr></table>";
585 &Header::closebox();
586}
587
588if ( -e "$editfile" ) {
589 open(FILE, "< $editfile" ); }
590elsif ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_import'}.'1' ) {
591 open(FILE, "< $importfile" ); }
592elsif ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_import'}.'2' ) {
593 open(FILE, "< $hostfile" ); }
594elsif ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_import'}.'3' ) {
595 open(FILE, "< $dhcpfile" ); }
596elsif ( $wioscan eq 'on' ) {
597
598 foreach (keys(%ifacecolor)) {
599 if ( $netsettings{"${_}_DEV"} eq $wiosettings{'ID'} ) {
600 $dev = $netsettings{"${_}_DEV"};
601 $iprange = $wiosettings{"${_}_IPLOW"} . "-" . $wiosettings{"${_}_IPHIGH"};
602
603 if ( $_ eq 'GREEN' ) { $color = "$Header::colourgreen"; $net = $Lang::tr{'wio_msg_green'}; }
604 elsif ( $_ eq 'BLUE' ) { $color = "$Header::colourblue"; $net = $Lang::tr{'wio_msg_blue'}; }
391a2459 605 elsif ( $_ eq 'RED' ) { $color = "$Header::colourred"; $net = $Lang::tr{'wio_msg_red'}; }
0d6cc79d
SF
606 else { $color = "$Header::colourorange"; $net = $Lang::tr{'wio_msg_orange'}; }
607 }
608 }
609
610&Header::openbox('100%', 'left', $Lang::tr{'wio_info'});
611 print"<table width='100%'>
391a2459 612 <tr><td align='center'><font class='base'>$Lang::tr{'wio_msg_left'} </font><font class='base' color='$color'><b>$net</b></font> $Lang::tr{'wio_msg_center'} <font class='base'> $Lang::tr{'wio_msg_right'} $Lang::tr{'wio_msg_hint'}</font></td></tr>
0d6cc79d
SF
613 <tr><td>&nbsp;</td></tr>
614 <tr><td align='center'><img align='middle' src='/images/indicator.gif' /></td></tr>
615 </table>";
616&Header::closebox();
617&Header::closebigbox();
618
619 open(FILE, "/usr/local/bin/wioscan -wsa $dev $iprange |" );
620
621}
622
623@hosts = <FILE>;
624close(FILE);
625
626if ( $wioscan ne 'on' && ! -e $wiofile ) { @hosts = sort @hosts; }
627else {
628 open(FILE, "> $wiofile");
629 print FILE @hosts;
630 close(FILE);
631
632 print"<meta http-equiv=\"refresh\" content=\"0; URL=$ENV{'SCRIPT_NAME'}\">";
633 exit 0;
634}
635
636WIOSCAN:
637
638if ( -e $wiofile ) {
639 open(FILE, "< $wiofile");
640 @hosts = <FILE>;
641 close (FILE);
642
643 &General::readhash($wiosettings, \%wiosettings);
644
645 &Header::showhttpheaders();
646 &Header::openpage($Lang::tr{'wio'}, 1, '');
647 &Header::openbigbox('100%', 'left');
648}
649
650foreach (@hosts) {
651 chomp;
652
653 @line = split (/\,/, $_);
654
655 if ( -e $editfile || -e $importfile ) {
656 $wiosettings{'CLIENTID$count'} = $line[0];
657 $wiosettings{'TIMESTAMP$count'} = $line[1];
658 $wiosettings{'IPADR$count'} = $line[2];
659 $wiosettings{'HOST$count'} = $line[3];
660 $wiosettings{'EN$count'} = $line[4];
661 $wiosettings{'REMARK$count'} = $line[5];
662 $wiosettings{'DYNDNS$count'} = $line[6];
663 $wiosettings{'SENDEMAILON$count'} = $line[7];
664 $wiosettings{'SENDEMAILOFF$count'} = $line[8];
665 $wiosettings{'PINGMETHODE$count'} = $line[9];
666 $wiosettings{'ONLINE$count'} = $line[10];
667 $wiosettings{'WEBINTERFACE$count'} = $line[11];
668 $wiosettings{'USE$count'} = 'on';
669 }
670 else {
671 $wiosettings{'IPADR$count'} = $line[1];
672 $wiosettings{'EN$count'} = 'on';
673 $wiosettings{'PINGMETHODE$count'} = 'ip';
674 $wiosettings{'USE$count'} = 'on';
675
676 if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_import'}.'2' ) {
677 $wiosettings{'HOST$count'} = $line[2];
678 $wiosettings{'DOM$count'} = $line[3];
679 $wiosettings{'REMARK$count'} = '';
680 }
681 elsif ( $wioscan eq 'on' || -e $wiofile ) {
682 $wiosettings{'HOST$count'} = gethostbyaddr(inet_aton($line[1]), AF_INET);
683 if ($wiosettings{'HOST$count'} eq '') { $wiosettings{'HOST$count'} = $line[1]; }
684 $wiosettings{'REMARK$count'} = '';
0d6cc79d
SF
685 }
686 else {
687 $wiosettings{'HOST$count'} = $line[7];
688 $wiosettings{'REMARK$count'} = $line[6];
689 }
690 }
691
692 $checked{'EN$count'}{'on'} = ($wiosettings{'EN$count'} eq '' ) ? '' : "checked='checked'";
693
694 $checked{'DYNDNS$count'}{'on'} = ($wiosettings{'DYNDNS$count'} eq '' ) ? '' : "checked='checked'";
695 $checked{'SENDEMAILON$count'}{'on'} = ($wiosettings{'SENDEMAILON$count'} eq '' ) ? '' : "checked='checked'";
696 $checked{'SENDEMAILOFF$count'}{'on'} = ($wiosettings{'SENDEMAILOFF$count'} eq '' ) ? '' : "checked='checked'";
697
698 $checked{'PINGMETHODE$count'}{'ip'} = $checked{'PINGMETHODE$count'}{'fqdn'} = '';
699 $checked{'PINGMETHODE$count'}{$wiosettings{'PINGMETHODE$count'}} = "checked='checked'";
700
701 $checked{'USE$count'}{'on'} = ($wiosettings{'USE$count'} eq '' ) ? '' : "checked='checked'";
702
703 $selected{'WEBINTERFACE$count'}{'----'} = '';
704 $selected{'WEBINTERFACE$count'}{'HTTP'} = '';
705 $selected{'WEBINTERFACE$count'}{'HTTPS'} = '';
706 $selected{'WEBINTERFACE$count'}{$wiosettings{'WEBINTERFACE$count'}} = "selected='selected'";
707
708if (! &WIO::checkinto($wiosettings{'IPADR$count'}, $wiosettings{'HOST$count'}, @current) ) {
709
710if ( $importmessage ) {
711 &Header::openbox('100%', 'left', "$Lang::tr{'wio_import_data'}'$wiosettings{'HOST$count'}'$Lang::tr{'wio_import_data1'}");
712}
713elsif ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_import'}.'1' || $wioscan eq 'on' || -e $wiofile || -e $editfile ) {
714 &Header::openbox('100%', 'left', "$Lang::tr{'wio_import_data'}'$wiosettings{'HOST$count'}'$Lang::tr{'wio_import_data2'}");
715}
716elsif ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_import'}.'2' ) {
717 &Header::openbox('100%', 'left', "$Lang::tr{'wio_import_data'}'$wiosettings{'HOST$count'}.$wiosettings{'DOM$count'}'$Lang::tr{'wio_import_data2'}");
718}
719else {
720 &Header::openbox('100%', 'left', $Lang::tr{'wio_import_leases'});
721}
722
723print"
724<form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
725<input type='hidden' name='ONLINE$count' value='$wiosettings{'ONLINE$count'}' />
726
727<table width='100%'>
728<tr>
729 <td>$Lang::tr{'wio_use'}</td>
730 <td><input type='checkbox' name='USE$count' $checked{'USE$count'}{'on'} /></td>
731</tr>
732<tr>
733 <td>$Lang::tr{'wio_client_enable'}</td>
734 <td><input type='checkbox' name='EN$count' $checked{'EN$count'}{'on'} /></td>
735</tr>
736<tr>
737 <td>$Lang::tr{'host ip'}:</td>
738 <td><input type='text' name='IPADR$count' value='$wiosettings{'IPADR$count'}' size='18' /></td>
739 <td>$Lang::tr{'hostname'}:</td>
740";
741
742if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_import'}.'2' ) {
743 print"<td><input type='text' name='HOST$count' size='18' value='$wiosettings{'HOST$count'}.$wiosettings{'DOM$count'}' /></td>";
744}
745else {
746 print"<td><input type='text' name='HOST$count' size='18' value='$wiosettings{'HOST$count'}' /></td>";
747}
748
749print"
750 <td>$Lang::tr{'remark'}:</td>
751 <td><input type='text' name='REMARK$count' value='$wiosettings{'REMARK$count'}' size='18' /></td>
752</tr>
753<tr>
754 <td class='base'>$Lang::tr{'wio_ping_send'}:</td>
755 <td align='left'><input type='radio' name='PINGMETHODE$count' value='ip' $checked{'PINGMETHODE$count'}{'ip'} />&nbsp;IP&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='radio' name='PINGMETHODE$count' value='fqdn' $checked{'PINGMETHODE$count'}{'fqdn'} />&nbsp;FQDN</td>
756 <td>$Lang::tr{'wio_dyndns'}:</td>
757 <td><input type='checkbox' name='DYNDNS$count' $checked{'DYNDNS$count'}{'on'} /></td>
758";
759
760if ( $wiosettings{'SENDEMAIL'} eq 'on' ) {
761 print"<td>$Lang::tr{'wio_sendemail'}:</td>
762 <td><input type='checkbox' name='SENDEMAILON$count' $checked{'SENDEMAILON$count'}{'on'} />&nbsp;$Lang::tr{'wio_online'}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='checkbox' name='SENDEMAILOFF$count' $checked{'SENDEMAILOFF$count'}{'on'} />&nbsp;$Lang::tr{'wio_offline'}</td>";
763}
764else {
765 print"<td colspan='2'>&nbsp;</td>";
766}
767
768print"
769</tr>
770<tr>
1bee37ba 771 <td height='30'>$Lang::tr{'wio_link_open'}:</td>
0d6cc79d
SF
772 <td align='left' colspan='5'>
773 <select size='1' name='WEBINTERFACE$count' width='80' style='width: 80px'>
774 <option value='----' $selected{'WEBINTERFACE$count'}{'----'}>----</option>
775 <option value='HTTP' $selected{'WEBINTERFACE$count'}{'HTTP'}>HTTP</option>
776 <option value='HTTPS' $selected{'WEBINTERFACE$count'}{'HTTPS'}>HTTPS</option>
777 </select>
778 </td>
779</tr>
780</table>
781";
782
783&Header::closebox();
784$showcount++;
785}
786$count++;
787}
788
789if ( $showcount gt 0 ) {
790&Header::openbox('100%', 'left', $Lang::tr{'wio_import_infos'});
791
792print"
793<table width='100%'>
794<tr>
795";
796
797if ($importmessage) { print"<td>&nbsp;</td>"; }
798else { print"<td><font color='$color{'color11'}'>$Lang::tr{'wio_import_infos_csv'}</font></td>"; }
799
800print"
801</tr>
802<tr><td colspan='4'>&nbsp;</td></tr>
803</table>
804<table width='100%'>
805<tr>
806 <td width='25%'>&nbsp;</td>
807 <td width='25%'><input type='hidden' name='COUNT' value='$count' /><input type='hidden' name='ACTION' value='$Lang::tr{'wio_save'}2' /><input type='submit' name='SUBMIT' value='$Lang::tr{'wio_save'}' /></form></td>
808 <td width='25%'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'><input type='submit' name='ACTION' value='$Lang::tr{'wio_back'}' /></form></td>
809 <td width='25%'>&nbsp;</td>
810</tr>
811</table>
812";
813
814&Header::closebox();
815&Header::closebigbox();
816&Header::closepage();
817}
818else {
819 print"<meta http-equiv=\"refresh\" content=\"0; URL=$ENV{'SCRIPT_NAME'}?INFO\">";
820}
821
822if ( -e "$editfile" ) { unlink ($editfile); }
823if ( -e "$wiofile" ) { unlink($wiofile); }
824exit 0;
825}
826else {
827 $infomessage = "$Lang::tr{'wio_error_function'}";
828}
829}
830
831## skript function
832
833if ($ENV{'QUERY_STRING'} =~ /$sortstring/ ) {
834 my $string = $ENV{'QUERY_STRING'};
835
836 if ( $string eq 'INFO' ) {
837 $infomessage = $Lang::tr{'wio_import_info_csv'};
838 }
839 else {
840 &General::readhash($wiosettings, \%wiosettings);
841
842 my $actual = $wiosettings{'SORT'};
843
844 if ($actual =~ $string) {
845 my $Rev = '';
846 if ($actual !~ 'Rev') { $Rev = 'Rev'; }
847 $string.=$Rev;
848 }
849
850 system("/bin/sed -i 's#$wiosettings{'SORT'}#$string#g' $wiosettings");
851
852 $wiosettings{'SORT'} = $string;
853 map ($wiosettings{$_} = '' ,@nosaved);
854 &SortDataFile('',@current);
855 }
856}
857
858## main part
859
860ERROR:
861
862unless($message == 1) { &General::readhash($wiosettings, \%wiosettings); }
863
864for ($i=5; $i<=60; $i+=5) { $selected{'CRON'}{$i} = ''; }
865
866$selected{'CRON'}{$wiosettings{'CRON'}} = "selected='selected'";
867
868for ($i=1; $i<=15; $i++) {
869 $selected{'TIMEOUT'}{$i} = '';
870 $selected{'OVPNCRON'}{$i} = '';
871}
872
873$selected{'TIMEOUT'}{$wiosettings{'TIMEOUT'}} = "selected='selected'";
874$selected{'OVPNCRON'}{$wiosettings{'OVPNCRON'}} = "selected='selected'";
875
876$checked{'ENABLE'}{'off'} = $checked{'ENABLE'}{'on'} = '';
877$checked{'ENABLE'}{$wiosettings{'ENABLE'}} = "checked='checked'";
878
879$checked{'LOGGING'}{'off'} = $checked{'LOGGING'}{'on'} = '';
880$checked{'LOGGING'}{$wiosettings{'LOGGING'}} = "checked='checked'";
881
882$checked{'CLIENTREMARK'}{'off'} = $checked{'CLIENTREMARK'}{'on'} = '';
883$checked{'CLIENTREMARK'}{$wiosettings{'CLIENTREMARK'}} = "checked='checked'";
884
885$checked{'MAILREMARK'}{'off'} = $checked{'MAILREMARK'}{'on'} = '';
886$checked{'MAILREMARK'}{$wiosettings{'MAILREMARK'}} = "checked='checked'";
887
888$checked{'OVPNRWMAIL'}{'off'} = $checked{'OVPNRWMAIL'}{'on'} = '';
889$checked{'OVPNRWMAIL'}{$wiosettings{'OVPNRWMAIL'}} = "checked='checked'";
890
0d6cc79d
SF
891$checked{'MAILSTYLE'}{'smail'} = $checked{'MAILSTYLE'}{'email'} = '';
892$checked{'MAILSTYLE'}{$wiosettings{'MAILSTYLE'}} = "checked='checked'";
893
894&Header::showhttpheaders();
895&Header::openpage($Lang::tr{'wio'}, 1, "<meta http-equiv='expires' content='-1'><meta http-equiv='cache-control' content='no-store, no-cache, must-revalidate'><meta http-equiv='pragma' content='no-cache'>");
896&Header::openbigbox('100%', 'left', '');
897
898## DEBUG / ERROR / INFO / UPDATE
899
900if ( $debug ) {
901 &Header::openbox('100%', 'left', 'DEBUG', 'warning');
902
903 print"errormessage: $errormessage<br />\n";
904 print"infomessage: $infomessage<br />\n";
905
906 &hrline();
a25c95b3 907
0d6cc79d
SF
908 my $wiodebug = 0;
909 foreach (sort keys %wiosettings) {
910 print"$_ = $wiosettings{$_}<br />\n";
911 $wiodebug++;
912 }
913
914 &hrline();
915
916 my $netdebug = 0;
917 foreach (sort keys %netsettings) {
918 print"$_ = $netsettings{$_}<br />\n";
919 $netdebug++;
920 }
921 &Header::closebox();
922}
923
924if ( $errormessage ) {
925 &Header::openbox('100%', 'left', $Lang::tr{'wio_error'}, 'error');
926 print"<table width='100%'><tr><td><font class='base'><b>$errormessage</b></font></td></tr></table>";
927 &Header::closebox();
928}
929
930if ( $infomessage ) {
931 &Header::openbox('100%', 'left', $Lang::tr{'wio_info'}, 'warning');
932 print"<table width='100%'><tr><td><font class='base'><b>$infomessage</b></font></td></tr></table>";
933 &Header::closebox();
934}
935
936## wio configuration
937
938if ( $wiosettings{'ACTION'} eq $Lang::tr{'edit'}.'1' || $message == 1 || $wiosettings{'ENABLE'} eq 'off' ) {
939
940&Header::openbox('100%', 'left', $Lang::tr{'wio settings'});
941
942print"
943<form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
944<table width='100%'>
945<tr>
391a2459
SF
946 <td bgcolor='$color{'color20'}' align='left'><b>$Lang::tr{'wio_settings_msg_hint'}</b></td>
947 <td colspan='2'>&nbsp;</td>
0d6cc79d 948</tr>
0d6cc79d 949<tr>
391a2459
SF
950 <td width='48%'>&nbsp;</td>
951 <td width='2%'>&nbsp;</td>
952 <td width='50%'>&nbsp;</td>
0d6cc79d 953</tr>
0d6cc79d
SF
954<tr>
955 <td align='right'>$Lang::tr{'wio enabled'}</td>
956";
957
958print"<td>&nbsp;</td>";
959
960if ( $wiosettings{'ENABLE'} eq 'on' ) {
961 print"<td align='left'><input type='checkbox' onClick=\"return confirm('$Lang::tr{'wio_disable_hint'}')\" name='ENABLE' $checked{'ENABLE'}{'on'} /></td>";
962}
963else {
964 print"<td align='left'><input type='checkbox' name='ENABLE' $checked{'ENABLE'}{'on'} /></td>";
965}
966print"
967</tr>
968<tr><td colspan='3'>&nbsp;</td></tr>
0d6cc79d
SF
969<tr>
970 <td align='right'>$Lang::tr{'wio cron'}</td>
971 <td>&nbsp;</td>
972 <td align='left'><select size='1' name='CRON' size='5'>
973";
974
fe6f676b
SF
975for ($i=5; $i<=60; $i+=5) {
976 $_ = sprintf("%02s",$i);
977 print "<option $selected{'CRON'}{$_}>$_</option>\n";
978}
0d6cc79d
SF
979
980print"
981 </select>&nbsp;$Lang::tr{'wio min'}</td>
982</tr>
983<tr><td colspan='3'>&nbsp;</td></tr>
984<tr>
985 <td align='right'>$Lang::tr{'wio timeout'}</td>
986 <td>&nbsp;</td>
987 <td align='left'><select size='1' name='TIMEOUT' size='5'>
988";
989
fe6f676b
SF
990for ($i=1; $i<=15; $i++) {
991 $_ = sprintf("%02s",$i);
992 print "<option $selected{'TIMEOUT'}{$_}>$_</option>\n";
993}
0d6cc79d 994
c1fc92a9 995print"
0d6cc79d
SF
996 </select>&nbsp;$Lang::tr{'wio sec'}</td>
997</tr>
998<tr><td colspan='3'>&nbsp;</td></tr>
999<tr>
1000 <td align='right'>$Lang::tr{'wio_logging'}</td>
1001 <td>&nbsp;</td>
1002 <td align='left'><input type='checkbox' name='LOGGING' $checked{'LOGGING'}{'on'} /></td>
1003</tr>
1004<tr><td colspan='3'>&nbsp;</td></tr>
1005<tr>
1006 <td align='right'>$Lang::tr{'wio_clientremark'}</td>
1007 <td>&nbsp;</td>
1008 <td align='left'><input type='checkbox' name='CLIENTREMARK' $checked{'CLIENTREMARK'}{'on'} /></td>
1009</tr>
1010<tr><td colspan='3'>&nbsp;</td></tr>
0d6cc79d
SF
1011";
1012
1013if ( $wiosettings{'SENDEMAIL'} eq 'on' ) {
1014print"
1015<tr>
1016 <td align='right'>$Lang::tr{'wio_mail_style'}:</td>
1017 <td>&nbsp;</td>
1018 <td align='left'><input type='radio' name='MAILSTYLE' value='smail' $checked{'MAILSTYLE'}{'smail'} />&nbsp;$Lang::tr{'wio_mail_smail'}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='radio' name='MAILSTYLE' value='email' $checked{'MAILSTYLE'}{'email'} />&nbsp;$Lang::tr{'wio_mail_email'}</td>
1019</tr>
1020<tr><td colspan='3'>&nbsp;</td></tr>
1021<tr>
1022 <td align='right'>$Lang::tr{'wio_mailremark_enabled'}</td>
1023 <td>&nbsp;</td>
1024 <td align='left'><input type='checkbox' name='MAILREMARK' $checked{'MAILREMARK'}{'on'}></td>
1025</tr>
1026<tr><td colspan='3'>&nbsp;</td></tr>
1027";
1028}
1029if ( -e "$ovpnaddon" || ! -z "/var/ipfire/vpn/config" ) {
1030print"
1031<tr>
1032 <td align='right'>$Lang::tr{'wio_mail_ovpnrw'}</td>
1033 <td>&nbsp;</td>
1034 <td align='left'><input type='checkbox' name='OVPNRWMAIL' $checked{'OVPNRWMAIL'}{'on'}></td>
1035</tr>
1036<tr><td colspan='3'>&nbsp;</td></tr>
1037<tr>
1038 <td align='right'>$Lang::tr{'wio_ovpn_cron'}</td>
1039 <td>&nbsp;</td>
1040 <td align='left'><select size='1' name='OVPNCRON' size='5'>
1041";
1042
fe6f676b
SF
1043for ($i=1; $i<=15; $i++) {
1044 $_ = sprintf("%02s",$i);
1045 print "<option $selected{'OVPNCRON'}{$_}>$_</option>\n";
1046}
0d6cc79d
SF
1047
1048print"
1049 </select>&nbsp;$Lang::tr{'wio min'}</td>
1050</tr>
1051<tr><td colspan='3'>&nbsp;</td></tr>
1052";
1053}
1054print"
1055<tr><td colspan='3'>&nbsp;</td></tr>
1056<tr>
1057 <td colspan='2'>&nbsp;</td>
1058 <td align='left'><input type='hidden' name='ACTION' value='$Lang::tr{'wio_save'}1' /><input type='submit' name='submit' value='$Lang::tr{'wio_save'}' />"
1059 .($wiosettings{'ENABLE'} ne 'off' ? "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='button' onClick='location.href=\"/cgi-bin/wio.cgi\"' value='$Lang::tr{'wio_back'}'>" : "")
1060 ."</td>
1061</tr>
1062</table>
1063</form>
1064";
1065
1066&Header::closebox();
1067&Header::closebigbox();
1068&Header::closepage();
1069exit 0;
1070}
1071
1072## wio client status
1073
1074if ( $wiosettings{'ENABLE'} eq 'on') {
1075 if ( !$errormessage && $wiosettings{'ACTION'} ne $Lang::tr{'edit'} || $message == 2 ) {
1076 &Header::openbox('100%', 'left', $Lang::tr{'wio stat'});
1077
1078 foreach (@current) {
1079 chomp;
1080
1081 ($id,$timestamp,$ipadr,$host,$on,$remark,$dyndns,$sendemailon,$sendemailoff,$pingmethode,$online,$webinterface) = split (/\,/, $_);
1082
1083 if ( defined($dyndns) && ( $dyndns =~ 'on' ) ) {
1084 ($dyndnsip, $infomessage) = &WIO::getdyndnsip($ipadr, $host);
1085
1086 if ( $dyndnsip ne $ipadr ) {
1087 $ipadr = $dyndnsip;
1088 $write = 'on';
1089 }
1090 }
1091
1092 push (@id,($id));
1093
1094 if ( $on eq 'on' ) { push (@dates,($timestamp)); }
1095 else { push (@dates,('-')); }
1096
1097 push (@ipaddresses,($ipadr));
1098 push (@names,($host));
1099 push (@activ,($on));
1100 push (@remark,($remark));
1101 push (@dyndns,($dyndns));
1102 push (@sendemailon,($sendemailon));
1103 push (@sendemailoff,($sendemailoff));
1104 push (@pingmethode,($pingmethode));
1105 push (@status,($online));
1106 push (@webinterface,($webinterface));
1107
1108 push (@write, "$id,$timestamp,$ipadr,$host,$on,$remark,$dyndns,$sendemailon,$sendemailoff,$pingmethode,$online,$webinterface\n");
1109
1110 $nr++;
1111 }
1112
1113 if ( defined($write) ) { &writeips(); }
1114
1115## wan connection
1116
1117print"
1118<table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
a25c95b3
SFD
1119<tr height='25'>
1120 <td width='33%' bgcolor='$color{'color20'}' align='left'><b>&nbsp;$Lang::tr{'wio_wan_con'}</b></td>
1121 <td width='67%' align='right'>&nbsp;</td>
0d6cc79d
SF
1122</tr>
1123<tr><td colspan='2'>&nbsp;</td></tr>
1124</table>
1125
1126<table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1127<tr bgcolor='$color{'color20'}' height='20'>
1128 <td width='3%' align='center'><b>$Lang::tr{'wio_id'}</b></td>
1129 <td width='15%' align='center'><b>$Lang::tr{'wio ipadress'}</b></td>
391a2459 1130 <td width='7%' align='center'><b>$Lang::tr{'wio network'}</b></td>
0d6cc79d
SF
1131 <td width='15%' align='center'><b>$Lang::tr{'wio_lanname'}</b></td>
1132 <td width='15%' align='center'><b>$Lang::tr{'wio_wanname'}</b></td>
391a2459 1133 <td width='20%' align='center'><b>$Lang::tr{'wio_dyndns_hosts'}</b></td>
0d6cc79d 1134 <td width='11%' align='center'><b>$Lang::tr{'wio image'}</b></td>
c1fc92a9 1135 <td width='14%' align='center'><b>$Lang::tr{'wio_connected'}</b></td>
0d6cc79d
SF
1136</tr>
1137<tr bgcolor='$color{'color22'}' height='20'>
1138 <td align='center'>01</td>
391a2459 1139 <td align='center'><font color='$Header::colourred'>$redip</font></td>
730e96c9
SF
1140";
1141
1142if ( $netsettings{"RED_TYPE"} eq 'PPPOE' ) {
1143 print"<td align='center'><img align='middle' src='$imgstatic/red.png' alt='$Lang::tr{'internet'}' title='$Lang::tr{'internet'}' /></td>";
1144}
1145else {
1146 print"<td align='center'><img align='middle' src='$imgstatic/red.png' alt='$Lang::tr{'wio_red_lan'}' title='$Lang::tr{'wio_red_lan'}' /></td>";
1147}
1148
1149print"
0d6cc79d
SF
1150 <td align='center'><font color='$Header::colourgreen'>".$mainsettings{'HOSTNAME'}.".".$mainsettings{'DOMAINNAME'}."</font></td>
1151 <td align='center'><font color='$Header::colourred'>".( $redip ne '-' ? (gethostbyaddr(pack("C4", split (/\./, $redip)), 2))[0] : '-' )."</font></td>
1152 <td align='center'>
1153";
1154
1155if ( -s "$dyndnsconfig" ) {
1156
1157open(FILE, "< $dyndnsconfig");
1158@ddns = <FILE>;
1159close (FILE);
1160
0d6cc79d
SF
1161 foreach (@ddns) {
1162 chomp;
0d6cc79d
SF
1163 @temp = split (/\,/, $_);
1164
391a2459
SF
1165 if ( $temp[7] eq "on" ) {
1166 $bgcolor = ( &General::DyndnsServiceSync (&General::GetDyndnsRedIP,$temp[1],$temp[2]) ? "$Header::colourgreen" : "$Header::colourred" );
1167 }
1168 else {
1169 $bgcolor = "blue";
1170 }
48aae162 1171
0d6cc79d 1172 print"<font color='$bgcolor'>$temp[1].$temp[2]</font>";
391a2459 1173 if ( $iddyndns++ ne (@ddns-1) ) { print"<br />\n"; }
0d6cc79d
SF
1174 }
1175}
391a2459
SF
1176else {
1177 print"-";
1178}
0d6cc79d
SF
1179
1180print"
1181 </td>
1182 <td align='center'>
1183 <table bgcolor='".( -e $redactive ? "${Header::colourgreen}" : "${Header::colourred}" )."' cellpadding='2' cellspacing='0' width='100%'>
1184 <tr height='20'>
1185 <td align='center'><font color='white'><b>".( -e $redactive ? $Lang::tr{'wio_wan_up'} : $Lang::tr{'wio_wan_down'} )."</b></font></td>
1186 </tr>
1187 </table>
1188 </td>
1189 <td align='center'><font color='$Header::colourred'>".( -e "$redactive" ? &General::age("$redactive") : '-' )."</font></td>
1190</tr>
1191<tr height='1'><td colspan='9' bgcolor='#696565'></td></tr>
1192</table>
1193";
1194
1195&hrline();
1196
1197## vpn connection(s)
1198
1199if ( -e "$vpnpid" ) {
1200
1201@vpnstatus = `/usr/local/bin/ipsecctrl I`;
1202
1203print"
1204<table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
a25c95b3
SFD
1205<tr height='25'>
1206 <td width='33%' bgcolor='$color{'color20'}' align='left'><b>&nbsp;$Lang::tr{'wio_vpn_con'}</b></td>
1207 <td width='67%'>&nbsp;</td>
0d6cc79d
SF
1208</tr>
1209<tr><td colspan='2'>&nbsp;</td></tr>
1210</table>
1211<table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1212<tr bgcolor='$color{'color20'}' height='20'>
1213 <td width='3%' align='center'><b>$Lang::tr{'wio_id'}</b></td>
1214 <td width='19%' align='center'><b>$Lang::tr{'wio checked'}</b></td>
1215 <td width='20%' align='center'><b>$Lang::tr{'name'}</b></td>
1216 <td width='8%' align='center'><b>$Lang::tr{'type'}</b></td>
1217 <td width='25%' align='center'><b>$Lang::tr{'wio_common_name'}</b></td>
1218 <td width='11%' align='center'><b>$Lang::tr{'wio image'}</b></td>
c1fc92a9 1219 <td width='14%' align='center'><b>$Lang::tr{'wio_connected'}</b></td>
0d6cc79d
SF
1220</tr>
1221";
1222
1223foreach $key (sort SortByTunnelName (keys(%vpnconfighash))) {
1224
391a2459 1225my ( $vpnclient, $vpnclientip, $vpnrwnet, $vpnn2nnet, $vpntime, $vpncheck ) = '';
0d6cc79d
SF
1226
1227$status = "bgcolor='${Header::colourred}'";
1228$statustxt = "$Lang::tr{'capsclosed'}";
953882ff 1229$vpnclient = $vpnconfighash{$key}[1];
0d6cc79d 1230
391a2459
SF
1231my ($ip,$sub) = split(/\//,$vpnsettings{'RW_NET'});
1232my @ip = split( /\./, $ip);
1233$vpnrwnet = join( '.', ( $ip[0], $ip[1], $ip[2], ) );
1234
0d6cc79d
SF
1235 if ($vpnconfighash{$key}[0] eq 'off') {
1236 $status = "bgcolor='${Header::colourblue}'";
1237 $statustxt = "$Lang::tr{'capsclosed'}";
391a2459
SF
1238 $vpnn2nnet = '-';
1239 }
1240 else {
1241 $vpnn2nnet = $vpnconfighash{$key}[11];
0d6cc79d
SF
1242 }
1243
1244 foreach (@vpnstatus) {
953882ff 1245 if ($_ =~ /$vpnclient.*ESTABLISHED/) {
0d6cc79d
SF
1246 $status = "bgcolor='${Header::colourgreen}'";
1247 $statustxt = "$Lang::tr{'capsopen'}";
953882ff
SF
1248 $vpntime = `/usr/local/bin/ipsecctrl I | grep $vpnclient.*ESTABLISHED | sed 's/^[ \t]*//' | cut -d " " -f 3-4`;
1249 $vpntime = &WIO::contime($vpntime, "ipsec");
391a2459
SF
1250 $vpnclientip = `/usr/local/bin/ipsecctrl I | grep $vpnclient.*$vpnrwnet | sed 's/^[ \t]*//' | cut -d " " -f 6 | cut -d "/" -f 1`;
1251 $vpncheck = strftime("%d.%m.%Y - %H:%M:%S",localtime);
0d6cc79d
SF
1252 last;
1253 }
1254 }
1255
1256 print"<tr".($idvpn % 2?" bgcolor='$color{'color20'}'":" bgcolor='$color{'color22'}'")." height='20'>";
1257
1258 my $vpnnr = $idvpn+1;
1259
953882ff 1260 printf ("<td align='center'>%02d</td>", $vpnnr);
0d6cc79d 1261
391a2459 1262 print"<td align='center'>".($vpncheck ne '' ? "$vpncheck" : "-")."</td>
953882ff
SF
1263 <td align='center'>$vpnclient</td>
1264 <td align='center'><img align='middle' src='$imgstatic/".($vpnconfighash{$key}[3] eq 'host' ? "vpnrw.png' alt='$Lang::tr{'wio_rw'}' title='$Lang::tr{'wio_rw'}'" : "vpnn2n.png' alt='$Lang::tr{'wio_n2n'}' title='$Lang::tr{'wio_n2n'}'")." /></td>
391a2459 1265 <td align='center'>".($vpnconfighash{$key}[3] eq 'host' ? (defined($vpnclientip) ? "$vpnclientip" : "-") : $vpnconfighash{$key}[3] eq 'net' ? "$vpnn2nnet" : "-")."</td>
0d6cc79d
SF
1266 <td align='center'>
1267 <table $status cellpadding='2' cellspacing='0' width='100%'>
1268 <tr height='20'>
1269 <td align='center'><font color='white'><b>$statustxt</b></font></td>
1270 </tr>
1271 </table>
1272 </td>
391a2459 1273 <td align='center' height='20'>".($vpntime ne '' ? "$vpntime" : "-")."</td>
0d6cc79d
SF
1274 </tr>
1275";
c1fc92a9 1276
391a2459
SF
1277if ($wiosettings{'CLIENTREMARK'} eq 'on') {
1278 print"<tr".($idvpn % 2?" bgcolor='$color{'color20'}'":" bgcolor='$color{'color22'}'")." height='20'><td>&nbsp;</td><td colspan='16' align='left'>".($vpnconfighash{$key}[25] ne '' ? "$vpnconfighash{$key}[25]" : "-")."</td></tr>";
0d6cc79d 1279}
391a2459
SF
1280
1281print"<tr height='1'><td colspan='7' bgcolor='#696565'></td></tr>";
1282$idvpn++
0d6cc79d
SF
1283}
1284
1285print"</table>";
1286&hrline();
1287}
1288
1289## openvpn connection(s)
1290
1291if ( -e "$ovpnpid" ) {
1292
1293@ovpnstatus = `cat /var/run/ovpnserver.log`;
1294
1295print"
1296<table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
a25c95b3
SFD
1297<tr height='25'>
1298 <td width='33%' bgcolor='$color{'color20'}' align='left'><b>&nbsp;$Lang::tr{'wio_ovpn_con'}</b></td>
1299 <td width='67%'>&nbsp;</td>
0d6cc79d
SF
1300</tr>
1301<tr><td colspan='2'>&nbsp;</td></tr>
1302</table>
1303<table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1304<tr bgcolor='$color{'color20'}' height='20'>
1305 <td width='3%' align='center'><b>$Lang::tr{'wio_id'}</b></td>
1306 <td width='19%' align='center'><b>$Lang::tr{'wio checked'}</b></td>
391a2459 1307 <td width='20%' align='center'><b>$Lang::tr{'name'}</b></td>
0d6cc79d 1308 <td width='8%' align='center'><b>$Lang::tr{'type'}</b></td>
391a2459 1309 <td width='25%' align='center'><b>$Lang::tr{'wio_common_name'}</b></td>
0d6cc79d 1310 <td width='11%' align='center'><b>$Lang::tr{'wio image'}</b></td>
c1fc92a9 1311 <td width='14%' align='center'><b>$Lang::tr{'wio_connected'}</b></td>
0d6cc79d
SF
1312</tr>
1313";
1314
391a2459 1315foreach $key (keys %ovpnconfighash) {
0d6cc79d 1316
391a2459 1317 my ( $ovpncheck, $ovpntime, $ovpnclt, $ovpnrwip ) = '';
0d6cc79d 1318
391a2459 1319 print"<tr".($idovpn % 2?" bgcolor='$color{'color20'}'":" bgcolor='$color{'color22'}'")." height='20'>";
0d6cc79d 1320
391a2459 1321 my $ovpnnr = $idovpn+1;
0d6cc79d 1322
391a2459 1323 printf ("<td align='center' height='20'> %02d</td>", $ovpnnr);
0d6cc79d 1324
391a2459
SF
1325 if ($ovpnconfighash{$key}[3] eq 'net') {
1326 $image = "$imgstatic/ovpnn2n.png";
1327 $text = "$Lang::tr{'wio_n2n'}";
1328 }
1329 else {
1330 $image = "$imgstatic/ovpnrw.png";
1331 $text = "$Lang::tr{'wio_rw'}";
1332 }
0d6cc79d 1333
391a2459
SF
1334 if ( $ovpnconfighash{$key}[0] eq 'off' ) {
1335 $status = "${Header::colourblue}";
1336 $statustxt = "$Lang::tr{'capsclosed'}";
1337 $ovpncheck = "-";
1338 }
1339 else {
0d6cc79d 1340 if ($ovpnconfighash{$key}[3] eq 'net') {
391a2459
SF
1341 if (-e "/var/run/$ovpnconfighash{$key}[1]n2n.pid") {
1342 my ( @output, @tustate ) = '';
1343 my $tport = $ovpnconfighash{$key}[22];
730e96c9 1344 my $tnet = new Net::Telnet (Timeout=>5, Errmode=>'return', Port=>$tport);
391a2459
SF
1345 if ($tport ne '') {
1346 $tnet->open('127.0.0.1');
1347 @output = $tnet->cmd(String => 'state', Prompt => '/(END.*\n|ERROR:.*\n)/');
1348 @tustate = split(/\,/, $output[1]);
1349 $ovpntime = &WIO::contime(scalar localtime($tustate[0]), "ovpn");
1350 $ovpncheck = strftime("%d.%m.%Y - %H:%M:%S", localtime);
1351
1352 if (($tustate[1] eq 'CONNECTED')) {
1353 $status = "${Header::colourgreen}";
1354 $statustxt = "$Lang::tr{'capsopen'}";
1355 $ovpnrwip = $ovpnconfighash{$key}[11];
1356 }
1357 else {
1358 $status = "${Header::colourred}";
1359 $statustxt = "$tustate[1]";
0d6cc79d
SF
1360 }
1361 }
1362 }
391a2459
SF
1363 }
1364 else {
1365 foreach (@ovpnstatus) {
1366 if ( $_ =~ /^(.+),(\d+\.\d+\.\d+\.\d+\:\d+),(\d+),(\d+),(.+)/ ) {
1367 @match = split (m/^(.+),(\d+\.\d+\.\d+\.\d+\:\d+),(\d+),(\d+),(.+)/, $_);
1368 $match[1] =~ s/[_]/ /g;
1369 }
0d6cc79d 1370
391a2459
SF
1371 if ( $match[1] ne "Common Name" && ($match[1] eq $ovpnconfighash{$key}[2]) ) {
1372 $ovpnclt = $match[1];
1373 $ovpntime = &WIO::contime($match[5], "ovpn");
1374 }
0d6cc79d 1375
391a2459
SF
1376 if ( $_ =~ /^(\d+\.\d+\.\d+\.\d+),(.+),(\d+\.\d+\.\d+\.\d+\:\d+),(.+)/ ) {
1377 @match = split(m/^(\d+\.\d+\.\d+\.\d+),(.+),(\d+\.\d+\.\d+\.\d+\:\d+),(.+)/, $_);
1378 }
0d6cc79d 1379
391a2459
SF
1380 if ( $match[1] ne "Virtual Address" && $match[2] eq $ovpnclt ) {
1381 $ovpnrwip = $match[1];
1382 $ovpncheck = &WIO::statustime($match[4]);
1383 }
0d6cc79d 1384
391a2459
SF
1385 if ( $ovpnclt eq $ovpnconfighash{$key}[2] ) {
1386 $status = "${Header::colourgreen}";
1387 $statustxt = "$Lang::tr{'capsopen'}";
1388 }
1389 else {
1390 $status = "${Header::colourred}";
1391 $statustxt = "$Lang::tr{'capsclosed'}";
0d6cc79d
SF
1392 }
1393 }
391a2459
SF
1394 }
1395 }
0d6cc79d 1396
391a2459
SF
1397print"
1398 <td align='center'>".(defined($ovpncheck) ? "$ovpncheck" : "-")."</td>
1399 <td align='center'>".($ovpnconfighash{$key}[2] eq '%auth-dn' ? "$ovpnconfighash{$key}[9]" : ($ovpnconfighash{$key}[4] eq 'cert' ? "$ovpnconfighash{$key}[1]": "-"))."</td>
0d6cc79d 1400 <td align='center'><img align='middle' src='$image' alt='$text' title='$text' /></td>
391a2459 1401 <td align='center'>".($ovpnrwip ne '' ? "$ovpnrwip" : "-")."</td>
0d6cc79d 1402 <td align='center'><table bgcolor='$status' cellpadding='2' cellspacing='0' width='100%'><tr height='20'><td align='center'><font color='white'><b>$statustxt</b></font></td></tr></table></td>
391a2459 1403 <td align='center'>".(defined($ovpntime) ? "$ovpntime" : "-")."</td>
0d6cc79d
SF
1404</tr>
1405";
c1fc92a9 1406
391a2459
SF
1407if ($wiosettings{'CLIENTREMARK'} eq 'on') {
1408 print"<tr".($idovpn % 2?" bgcolor='$color{'color20'}'":" bgcolor='$color{'color22'}'")." height='20'><td>&nbsp;</td><td colspan='16' align='left'>".($ovpnconfighash{$key}[25] ne '' ? "$ovpnconfighash{$key}[25]" : "-")."</td></tr>";
1409}
1410
1411print"<tr height='1'><td colspan='17' bgcolor='#696565'></td></tr>";
1412$idovpn++
1413}
1414
1415print"</table>";
1416&hrline();
0d6cc79d 1417}
0d6cc79d
SF
1418
1419## client status
1420
1421print"
1422<table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
a25c95b3
SFD
1423<tr height='25'>
1424 <td width='33%' bgcolor='$color{'color20'}' align='left'><b>&nbsp;$Lang::tr{'wio_clients'}</b></td>
1425 <td width='67%'>&nbsp;</td>
0d6cc79d
SF
1426</tr>
1427<tr><td colspan='2'>&nbsp;</td></tr>
1428</table>
1429
1430<table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1431<tr bgcolor='$color{'color20'}' height='20'>
1432 <td width='3%' align='center'><b>$Lang::tr{'wio_id'}</b></td>
1433 <td width='4%' align='center'><b>$Lang::tr{'wio_activ'}</b></td>
1434 <td width='5%' align='center'><b>$Lang::tr{'wio_check'}</b></td>
1435 <td width='15%' align='center'><b>$Lang::tr{'wio checked'}</b></td>
1436 <td width='4%' align='center'><b>$Lang::tr{'wio_webinterface'}</b></td>
1437 <td width='11%' align='center'><a href='$ENV{'SCRIPT_NAME'}?IPADR'><b>$Lang::tr{'wio ipadress'}</b></a></td>
1438 <td width='5%' align='center'><b>$Lang::tr{'wio network'}</b></td>
391a2459
SF
1439 <td width='23%' align='center'><a href='$ENV{'SCRIPT_NAME'}?HOST'><b>$Lang::tr{'wio name'}</b></a></td>
1440 <td width='9%' align='center'><b>$Lang::tr{'wio image'}</b></td>
1441 <td width='3%' align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'><input type='hidden' name='ACTION' value='$Lang::tr{'wio_refresh'}' /><input type='image' name='$Lang::tr{'wio_refresh'}' src='$imgstatic/refresh.png' align='middle' alt='$Lang::tr{'wio_refresh'}' title='$Lang::tr{'wio_refresh'}' /></form></td>
0d6cc79d
SF
1442 <td width='4%' colspan='2' align='center'><b>$Lang::tr{'wio_dyndns'}</b></td>
1443 <td width='12%' colspan='4' align='center'><b>$Lang::tr{'action'}</b></td>
1444 <td width='3%' align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'><input type='hidden' name='ACTION' value='$Lang::tr{'wio_remove_all'}' /><input type='image' name='$Lang::tr{'wio_remove_all'}' src='/images/delete.gif' align='middle' alt='$Lang::tr{'wio_remove_all'}' title='$Lang::tr{'wio_remove_all'}' onClick=\"return confirm('$Lang::tr{'wio_remove_all_hint'}')\"/></form></td>
1445</tr>
1446";
1447
1448for (my $a=0; $a<$nr; $a++) {
1449
1450my $gif = 'off.gif';
1451my $gdesc = $Lang::tr{'wio_client_off'};
1452my $dyndnsimg = 'on.gif';
1453my $dyndnsimgtxt = $Lang::tr{'wio_dyndns_on'};
1454my $mailonimg = 'wio/mailgreenon.png';
1455my $mailonimgtxt = $Lang::tr{'wio_mail_online_on'};
1456my $mailoffimg = 'wio/mailredon.png';
1457my $mailoffimgtxt = $Lang::tr{'wio_mail_offline_on'};
1458my $pingimg = '';
1459my $pingtxt = '';
1460my $webimg = '';
1461
1462if ( $activ[$a] eq 'on' ) {
1463 $gif = 'on.gif';
1464 $gdesc = $Lang::tr{'wio_client_on'};
1465}
1466
1467if ( $dyndns[$a] ne 'on' ) {
1468 $dyndnsimg = 'off.gif';
1469 $dyndnsimgtxt = $Lang::tr{'wio_dyndns_off'};
1470}
1471
1472if ( $sendemailon[$a] ne 'on' ) {
1473 $mailonimg = 'wio/mailgreenoff.png';
1474 $mailonimgtxt = $Lang::tr{'wio_mail_online_off'};
1475}
1476
1477if ( $sendemailoff[$a] ne 'on' ) {
1478 $mailoffimg = 'wio/mailredoff.png';
1479 $mailoffimgtxt = $Lang::tr{'wio_mail_offline_off'};
1480}
1481
1482if ( $webinterface[$a] eq 'HTTP' ) {
1483 $webimg = 'wio/http.png';
1484}
1485elsif ( $webinterface[$a] eq 'HTTPS' ) {
1486 $webimg = 'wio/https.png';
1487}
1488else {
1489 $webimg = 'wio/none.png';
1490}
1491
1492$bgcolor = $status[$a] eq "on" ? "${Header::colourgreen}" : ($status[$a] eq "off" && $dates[$a] eq "") ? "${Header::colourblue}" : "${Header::colourred}";
1493$statustxt = $status[$a] eq "on" ? "$Lang::tr{'wio up'}" : ($status[$a] eq "off" && $dates[$a] eq "") ? "$Lang::tr{'wio_no_image'}" : "$Lang::tr{'wio down'}";
1494
1495print"<tr".($a % 2?" bgcolor='$color{'color20'}'":" bgcolor='$color{'color22'}'")." height='20'>";
1496printf ("<td align='center'> %02d</td>", $a+1);
1497
1498print"<td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
1499 <input type='hidden' name='ACTION' value='$Lang::tr{'enable disable client'}' />
1500 <input type='image' name='$Lang::tr{'enable disable client'}' src='/images/$gif' align='middle' alt='$gdesc' title='$gdesc' />
1501 <input type='hidden' name='ID' value='$a' /></form></td>";
1502
1503if ( $pingmethode[$a] eq 'ip') {
1504 print"<td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
1505 <input type='hidden' name='ACTION' value='$Lang::tr{'wio_ip_on'}' />
1506 <input type='image' name='$Lang::tr{'wio_ip_on'}' src='/images/wio/ip.png' align='middle' alt='$Lang::tr{'wio_ip_on'}' title='$Lang::tr{'wio_ip_on'}' />
1507 <input type='hidden' name='ID' value='$a' /></form></td>";
1508}
1509else {
1510 print"<td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
1511 <input type='hidden' name='ACTION' value='$Lang::tr{'wio_fqdn_on'}' />
1512 <input type='image' name='$Lang::tr{'wio_fqdn_on'}' src='/images/wio/fqdn.png' align='middle' alt='$Lang::tr{'wio_fqdn_on'}' title='$Lang::tr{'wio_fqdn_on'}' />
1513 <input type='hidden' name='ID' value='$a' /></form></td>";
1514}
1515
1516print"<td align='center'>$dates[$a]</td>";
1517
1518print"<td align='center'><img align='middle' src='/images/$webimg' /></td>";
1519
1520if ( $webinterface[$a] eq 'HTTP' ) {
1521 print"<td align='center'><a title=\"$Lang::tr{'wio_webinterface_link'}\" href=\"http://$ipaddresses[$a]\" target=\"_blank\">$ipaddresses[$a]</a></td>";
1522}
1523elsif ( $webinterface[$a] eq 'HTTPS' ) {
1524 print"<td align='center'><a title=\"$Lang::tr{'wio_webinterface_link'}\" href=\"https://$ipaddresses[$a]\" target=\"_blank\">$ipaddresses[$a]</a></td>";
1525}
1526else {
1527 print"<td align='center'>$ipaddresses[$a]</td>";
1528}
1529
1530my $dotip = length($ipaddresses[$a]) - rindex($ipaddresses[$a],'.');
1531 SWITCH: {
1532 foreach (@devs_color) {
1533 my $in = 0;
1534 $ic = "${_}";
1535
1536 foreach $interface (@devs_net) {
f928cc5a 1537 next if ( $netsettings{"$ic"."_DEV"} eq 'red0' && $netsettings{"RED_TYPE"} eq 'PPPOE');
0d6cc79d
SF
1538 if ( $netsettings{"$ic"."_DEV"} eq $interface ) {
1539 if ( &General::IpInSubnet($ipaddresses[$a], $netsettings{"$ic"."_NETADDRESS"}, $netsettings{"$ic"."_NETMASK"}) ) {
391a2459
SF
1540 if ( $netsettings{"$ic"."_DEV"} eq 'red0' ) {
1541 print"<td align='center' height='20'><img src='$imgstatic/$devs_img[$in]' alt='$Lang::tr{'wio_red_lan'}' title='$Lang::tr{'wio_red_lan'}' /></td>";
1542 }
1543 else {
1544 print"<td align='center' height='20'><img src='$imgstatic/$devs_img[$in]' alt='$Lang::tr{$devs_alt[$in]}' title='$Lang::tr{$devs_alt[$in]}' /></td>";
391a2459
SF
1545 }
1546 last SWITCH;
0d6cc79d
SF
1547 }
1548 }
1549 $in++;
1550 }
1551 }
1552
0d6cc79d
SF
1553 if ( -e "$vpnpid" ) {
1554 foreach $key (keys(%vpnconfighash)) {
1555 next unless ($vpnconfighash{$key}[3] eq 'net');
c1fc92a9 1556
0d6cc79d 1557 my $convertip = &General::ipcidr2msk($vpnconfighash{$key}[11]);
a25c95b3 1558
0d6cc79d
SF
1559 my @net = split ("/", $convertip);
1560
1561 $vpnn2nip = $net[0];
1562 $vpnn2nmask = length($net[1]) - rindex($net[1],'.');
1563
1564 if (substr($ipaddresses[$a],0,length($ipaddresses[$a])-$dotip) eq substr($vpnn2nip,0,length($vpnn2nip)-$vpnn2nmask)) {
391a2459 1565 print"<td align='center'><img align='middle' src='$imgstatic/vpn.png' alt='IPsec' title='IPsec' /></td>";
0d6cc79d
SF
1566 last SWITCH;
1567 }
1568 }
1569 }
1570
1571 if ( $ovpnsettings{'DOVPN_SUBNET'} ne '' ) {
1572 @match = split ("/", $ovpnsettings{'DOVPN_SUBNET'});
1573
1574 if ( &General::IpInSubnet($ipaddresses[$a], $match[0], $match[1]) ) {
c1fc92a9
SFD
1575 print"<td align='center'><img src='$imgstatic/ovpn.png' alt='OpenVPN' title='OpenVPN' /></td>";
1576 last SWITCH;
0d6cc79d
SF
1577 }
1578 }
1579
1580 if ( %ovpnccdconfhash ne '' ) {
1581 foreach $key (keys(%ovpnccdconfhash)) {
c1fc92a9 1582
0d6cc79d 1583 my $convertip = &General::ipcidr2msk($ovpnccdconfhash{$key}[1]);
0d6cc79d
SF
1584 my @net = split ("/", $convertip);
1585
1586 $vpnn2nip = $net[0];
1587 $vpnn2nmask = length($net[1]) - rindex($net[1],'.');
1588
1589 if (substr($ipaddresses[$a],0,length($ipaddresses[$a])-$dotip) eq substr($vpnn2nip,0,length($vpnn2nip)-$vpnn2nmask)) {
1590 print"<td align='center'><img align='middle' src='$imgstatic/ovpn.png' alt='OpenVPN' title='OpenVPN' /></td>";
1591 last SWITCH;
1592 }
0d6cc79d
SF
1593 }
1594 }
a25c95b3 1595
f928cc5a 1596 if ( $netsettings{"RED_TYPE"} eq 'PPPOE' ) {
730e96c9
SF
1597 print"<td align='center' height='20'><img src='$imgstatic/red.png' alt='$Lang::tr{'internet'}' title='$Lang::tr{'internet'}' /></td>";
1598 last SWITCH;
c1fc92a9 1599
f928cc5a
SF
1600 }
1601 else {
a25c95b3
SFD
1602 print"<td align='center'><img align='middle' src='$imgstatic/white.png' alt='$Lang::tr{'wio_unknown_lan'}' title='$Lang::tr{'wio_unknown_lan'}' /></td>";
1603 last SWITCH;
a25c95b3 1604 }
0d6cc79d
SF
1605 }
1606
730e96c9
SF
1607print"<td align='center'>";
1608
1609 if ( $webinterface[$a] eq 'HTTP' ) {
1610 print"<a title=\"$Lang::tr{'wio_webinterface_link'}\" href=\"http://$names[$a]\" target=\"_blank\">$names[$a]</a>";
1611 }
1612 elsif ( $webinterface[$a] eq 'HTTPS' ) {
1613 print"<a title=\"$Lang::tr{'wio_webinterface_link'}\" href=\"https://$names[$a]\" target=\"_blank\">$names[$a]</a>";
1614 }
1615 else {
1616 print $names[$a];
1617 }
0d6cc79d
SF
1618
1619print"
730e96c9 1620 </td>
0d6cc79d
SF
1621 <td>
1622 <table bgcolor='$bgcolor' cellpadding='2' cellspacing='0' width='100%'>
1623 <tr height='20'>
1624 <td align='center'><font color='$color{'color21'}'><b>$statustxt</b></font></td>
1625 </tr>
1626 </table>
1627 </td>
1628
1629 <td width='3%' align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
1630 <input type='hidden' name='ACTION' value='$Lang::tr{'wio_sc_refresh'}' />
1631 <input type='image' name='$Lang::tr{'wio_sc_refresh'}' src='$imgstatic/refresh.png' align='middle' alt='$Lang::tr{'wio_sc_refresh'}' title='$Lang::tr{'wio_sc_refresh'}' />
1632 <input type='hidden' name='ID' value='$a' /></form></td>
1633
1634 <td width='3%' align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
1635 <input type='hidden' name='ACTION' value='$Lang::tr{'enable disable dyndns'}' />
1636 <input type='image' name='$Lang::tr{'enable disable dyndns'}' src='/images/$dyndnsimg' align='middle' alt='$dyndnsimgtxt' title='$dyndnsimgtxt' />
1637 <input type='hidden' name='ID' value='$a' /></form></td>";
1638
1639if ( defined($dyndns[$a]) && ($dyndns[$a] eq 'on') ) {
1640 print"<td width='3%' align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
1641 <input type='hidden' name='ACTION' value='$Lang::tr{'wio_dyndns_refresh'}' />
1642 <input type='image' name='$Lang::tr{'wio_dyndns_refresh'}' src='/images/reload.gif' align='middle' alt='$Lang::tr{'wio_dyndns_refresh'}' title='$Lang::tr{'wio_dyndns_refresh'}' />
1643 <input type='hidden' name='ID' value='$a' /></form></td>";
1644}
1645else {
1646 print"<td width='3%' align='center'>-</td>";
1647}
1648
1649if ( -e "/var/log/rrd/wio/$id[$a].rrd" ) {
1650 print"
1651 <td width='3%' align='center'><form method='post' action='/cgi-bin/wiographs.cgi' enctype='multipart/form-data'>
1652 <input type='image' name='$Lang::tr{'wio_graphs'}' src='$imgstatic/graph.png' align='middle' alt='$Lang::tr{'wio_graphs'}' title='$Lang::tr{'wio_graphs'}' />
1653 <input type='hidden' name='HOSTID' value='$id[$a]' /><input type='hidden' name='HOSTNAME' value='$names[$a]' /></form></td>
1654 ";
1655}
1656else {
1657 print "<td width='3%' align='center'><img src='$imgstatic/no_graph.png' align='middle' alt='$Lang::tr{'wio_no_graphs'}' title='$Lang::tr{'wio_no_graphs'}' /></td>";
1658}
1659
1660if ( $wiosettings{'SENDEMAIL'} eq 'on') {
1661 print"<td width='3%' align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
1662 <input type='hidden' name='ACTION' value='$Lang::tr{'wio_mail_online'}' />
1663 <input type='image' name='$Lang::tr{'wio_mail_online'}' src='/images/$mailonimg' align='middle' alt='$mailonimgtxt' title='$mailonimgtxt' />
1664 <input type='hidden' name='ID' value='$a' /></form></td>
1665 <td width='3%' align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
1666 <input type='hidden' name='ACTION' value='$Lang::tr{'wio_mail_offline'}' />
1667 <input type='image' name='$Lang::tr{'wio_mail_offline'}' src='/images/$mailoffimg' align='middle' alt='$mailoffimgtxt' title='$mailoffimgtxt' />
1668 <input type='hidden' name='ID' value='$a' /></form></td>";
1669}
1670else {
1671 print"<td width='3%' align='center'>-</td>
1672 <td width='3%' align='center'>-</td>";
1673}
1674
1675print"
1676 <td width='3%' align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
1677 <input type='hidden' name='ACTION' value='$Lang::tr{'edit'}' />
1678 <input type='image' name='$Lang::tr{'edit'}' src='/images/edit.gif' align='middle' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' />
1679 <input type='hidden' name='ID' value='$a' /></form></td>
1680
1681 <td width='3%' align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
1682 <input type='hidden' name='ACTION' value='$Lang::tr{'wio_remove_client'}' />
1683 <input type='image' name='$Lang::tr{'wio_remove_client'}' src='/images/delete.gif' align='middle' alt='$Lang::tr{'wio_remove_client'}' title='$Lang::tr{'wio_remove_client'}' onClick=\"return confirm('$Lang::tr{'wio_remove_client_hint'}')\" />
1684 <input type='hidden' name='ID' value='$a' /></form></td></tr>
1685";
1686
391a2459
SF
1687if ($wiosettings{'CLIENTREMARK'} eq 'on') {
1688 print"<tr".($a % 2?" bgcolor='$color{'color20'}'":" bgcolor='$color{'color22'}'")." height='20'><td>&nbsp;</td><td colspan='16' align='left'>".($remark[$a] ne '' ? "$remark[$a]" : "-")."</td></tr>";
0d6cc79d
SF
1689}
1690 print"<tr height='1'><td colspan='17' bgcolor='#696565'></td></tr>";
1691}
1692
1693print"</table>";
1694
1695&Header::closebox();
1696
1697}
1698
1699## add / modify client
1700
1701$checked{'EN'}{'on'} = ($wiosettings{'EN'} eq '' ) ? '' : "checked='checked'";
1702
1703$checked{'DYNDNS'}{'off'} = $checked{'DYNDNS'}{'on'} = '';
1704$checked{'DYNDNS'}{$wiosettings{'DYNDNS'}} = "checked='checked'";
1705
1706$checked{'SENDEMAILON'}{'off'} = $checked{'SENDEMAILON'}{'on'} = '';
1707$checked{'SENDEMAILON'}{$wiosettings{'SENDEMAILON'}} = "checked='checked'";
1708
1709$checked{'SENDEMAILOFF'}{'off'} = $checked{'SENDEMAILOFF'}{'on'} = '';
1710$checked{'SENDEMAILOFF'}{$wiosettings{'SENDEMAILOFF'}} = "checked='checked'";
1711
1712if (! defined($errormessage) && $wiosettings{'ACTION'} ne $Lang::tr{'edit'} ) {
1713 $wiosettings{'PINGMETHODE'} = 'ip';
1714}
1715
1716$checked{'PINGMETHODE'}{'ip'} = $checked{'PINGMETHODE'}{'fqdn'} = '';
1717$checked{'PINGMETHODE'}{$wiosettings{'PINGMETHODE'}} = "checked='checked'";
1718
1719$selected{'WEBINTERFACE'}{'----'} = '';
1720$selected{'WEBINTERFACE'}{'HTTP'} = '';
1721$selected{'WEBINTERFACE'}{'HTTPS'} = '';
1722$selected{'WEBINTERFACE'}{$wiosettings{'WEBINTERFACE'}} = "selected='selected'";
1723
1724$buttontext = $Lang::tr{'wio_client_add'};
1725
1726if ( $wiosettings{'ACTION'} eq $Lang::tr{'edit'} || defined($errormessage) && ! defined($message) ) {
1727 &Header::openbox('100%', 'left', $Lang::tr{'wio_edit_client'});
1728 $buttontext = $Lang::tr{'update'};
1729}
1730else {
1731 &Header::openbox('100%', 'left', $Lang::tr{'wio_edit_settings'});
1732}
1733
1734if (! defined($errormessage) && $wiosettings{'ACTION'} ne $Lang::tr{'edit'} ) {
1735print"
1736<table width='100%' border='0' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1737<tr>
a25c95b3
SFD
1738 <td width='33%' bgcolor='$color{'color20'}' align='left' height='25'><b>&nbsp;$Lang::tr{'wio_add'}</b></td>
1739 <td width='67%' align='right'>&nbsp;</td>
0d6cc79d
SF
1740</tr>
1741<tr>
1742 <td>&nbsp;</td>
1743</tr>
1744</table>
1745";
1746}
1747
1748print"
1749<form method='post' action='$ENV{'SCRIPT_NAME'}'>
1750<input type='hidden' name='ID' value='$wiosettings{'ID'}' />
1751<input type='hidden' name='CLIENTID' value='$wiosettings{'CLIENTID'}' />
1752<input type='hidden' name='ONLINE' value='$wiosettings{'ONLINE'}' />
1753<input type='hidden' name='TIMESTAMP' value='$wiosettings{'TIMESTAMP'}' />
1754";
1755
1756print"
1757<table width='100%' border='0' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1758<tr>
1759 <td height='30'>$Lang::tr{'wio_client_enable'}</td>
1760 <td align='left'><input type='checkbox' name='EN' $checked{'EN'}{'on'} /></td>
1761 <td colspan='4'>&nbsp;</td>
1762</tr>
1763<tr>
0407daee
AB
1764 <td class='base'>$Lang::tr{'wio ipadress'}:</td>
1765 <td><input type='text' name='IPADR' value='$wiosettings{'IPADR'}' size='18' /></td>
1766 <td class='base'>$Lang::tr{'wio name'}:</td>
1767 <td><input type='text' name='HOST' value='$wiosettings{'HOST'}' size='18' /></td>
1768 <td class='base'>$Lang::tr{'remark'}:</td>
1769 <td><input type='text' name='REMARK' value='$wiosettings{'REMARK'}' size='18' /></td>
0d6cc79d
SF
1770</tr>
1771<tr>
1772 <td height='30'>$Lang::tr{'wio_ping_send'}:</td>
1773 <td align='left'><input type='radio' name='PINGMETHODE' value='ip' $checked{'PINGMETHODE'}{'ip'} />&nbsp;IP&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='radio' name='PINGMETHODE' value='fqdn' $checked{'PINGMETHODE'}{'fqdn'} />&nbsp;FQDN</td>
1774 <td>$Lang::tr{'wio_dyndns'}:</td>
1775 <td align='left'><input type='checkbox' name='DYNDNS' $checked{'DYNDNS'}{'on'} /></td>
1776";
1777
1778if ( $wiosettings{'SENDEMAIL'} eq 'on' ) {
1779 print"<td>$Lang::tr{'wio_sendemail'}:</td>
1780 <td><input type='checkbox' name='SENDEMAILON' $checked{'SENDEMAILON'}{'on'} />&nbsp;$Lang::tr{'wio_online'}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='checkbox' name='SENDEMAILOFF' $checked{'SENDEMAILOFF'}{'on'} />&nbsp;$Lang::tr{'wio_offline'}</td>";
1781}
1782else {
1783 print"<td colspan='2'>&nbsp;</td>";
1784}
1785
1786print"
1787</tr>
1788<tr>
1bee37ba 1789 <td height='30'>$Lang::tr{'wio_link_open'}:</td>
0d6cc79d
SF
1790 <td align='left' colspan='5'>
1791 <select size='1' name='WEBINTERFACE' width='80' style='width: 80px'>
1792 <option value='----' $selected{'WEBINTERFACE'}{'----'}>----</option>
1793 <option value='HTTP' $selected{'WEBINTERFACE'}{'HTTP'}>HTTP</option>
1794 <option value='HTTPS' $selected{'WEBINTERFACE'}{'HTTPS'}>HTTPS</option>
1795 </select>
1796 </td>
1797</tr>
1798</table>
1799<table width='100%' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1800<tr>
1801 <td width='20%' align='center'>&nbsp;</td>
1802";
1803
1804if ( $buttontext eq $Lang::tr{'update'} && ( defined($errormessage) || $wiosettings{'ACTION'} eq $Lang::tr{'edit'}) && ! defined($message) ) {
1805 print"<td width='20%' align='center'>&nbsp;</td>
1806 <td width='20%' align='center'>&nbsp;</td>
1807 <td width='20%' align='center'><input type='hidden' name='ACTION' value='$Lang::tr{'wio_client_add'}' /><input type='submit' name='SUBMIT' value='$buttontext' /></td>
1808 <td width='20%' align='center'><input type='button' onClick='location.href=\"/cgi-bin/wio.cgi\"' value='$Lang::tr{'wio_back'}'></form></td>";
1809}
1810else {
1811 print"<td width='20%' align='center'>&nbsp;</td>
1812 <td width='20%' align='center'>&nbsp;</td>
1813 <td width='20%' align='center'>&nbsp;</td>
1814 <td width='20%' align='right'><input type='hidden' name='ACTION' value='$Lang::tr{'wio_client_add'}' /><input type='submit' name='SUBMIT' value='$buttontext' /></form></td>";
1815}
1816
1817print"
1818</tr>
1819</table>
1820";
1821
1822if ( $wiosettings{'ENABLE'} eq 'on' && !$errormessage && $wiosettings{'ACTION'} ne $Lang::tr{'edit'} || $message == 2 ) {
1823
1824&hrline();
1825
1826## arp table entries
1827
1828print"
1829<table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1830<tr>
a25c95b3
SFD
1831 <td width='33%' bgcolor='$color{'color20'}' align='left' height='25'><b>&nbsp;$Lang::tr{'wio_arp_table_entries'}</b></td>
1832 <td width='67%' align='right'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='WIOGUISHOWARPTABLE' value='arptable' /><input type='submit' name='ACTION' value='$arpbuttontext' /></form></td>
0d6cc79d 1833</tr>
0d6cc79d 1834</table>
a25c95b3
SFD
1835";
1836
1837if ( $wiosettings{'WIOGUISHOWARPTABLE'} eq 'on' ) {
0d6cc79d 1838
a25c95b3 1839print"
0d6cc79d 1840<table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
a25c95b3 1841<tr><td colspan='2'>&nbsp;</td></tr>
0d6cc79d
SF
1842<tr bgcolor='$color{'color20'}'>
1843 <td width='5%' align='center' height='20'><b>$Lang::tr{'wio_id'}</b></td>
1844 <td width='20%' align='center' height='20'><b>$Lang::tr{'wio_hwaddress'}</b></td>
1845 <td width='20%' align='center' height='20'><b>$Lang::tr{'wio ipadress'}</b></td>
1846 <td width='15%' align='center' height='20'><b>$Lang::tr{'wio network'}</b></td>
1847 <td width='20%' align='center' height='20'><b>$Lang::tr{'wio name'}</b></td>
1848 <td width='15%' align='center' height='20'><b>$Lang::tr{'wio_iface'}</b></td>
1849 <td width='5%' align='center' height='20'><b>$Lang::tr{'action'}</b></td>
1850</tr>
1851";
1852
1853$output = `/sbin/ip neigh list`;
1854$output = &Header::cleanhtml($output,"y");
1855
1856my $arpcnt = 0;
1857
1858foreach $line (split(/\n/, $output))
1859{
1860 if ($line =~ m/^(.*) dev ([^ ]+) lladdr ([0-9a-f:]*) (.*)$/) {
1861 my $arphost = gethostbyaddr(inet_aton($1), AF_INET);
1862 if ( $arphost eq 'localhost' ) { $arphost = ''; }
1863 push (@arpcache, "$3,$1,$arphost,$2\n");
1864 }
1865 elsif ($line =~ m/^(.*) dev ([^ ]+) (.*)$/) {
1866 my $arphost = gethostbyaddr(inet_aton($1), AF_INET);
1867 if ( $arphost eq 'localhost' ) { $arphost = ''; }
1868 push (@arpcache, ",$1,$arphost,$2\n");
1869 }
1870
1871 $arpcnt++;
1872}
1873
1874&SortDataFile('arpcache',@arpcache);
1875
1876foreach (@arpcache) {
1877 chomp;
1878
1879 @line = split (/\,/, $_);
1880
1881 print"<tr".($idarp % 2?" bgcolor='$color{'color20'}'":" bgcolor='$color{'color22'}'")." height='20'>";
1882 printf ("<td align='center'> %02d</td>", $idarp+1);
1883 print"<td align='center'>$line[0]</td>
1884 <td align='center'>$line[1]</td>";
1885
1886SWITCH: {
1887
1888 foreach (@devs_color) {
1889 my $in = 0;
1890 $ic = "${_}";
1891
1892 foreach $interface (@devs_net) {
1893 next if ( $netsettings{"$ic"."_DEV"} eq 'red0' && ($netsettings{"RED_TYPE"} eq 'DHCP' || $netsettings{"RED_TYPE"} eq 'PPPOE'));
1894
1895 if ($netsettings{"$ic"."_DEV"} eq $interface) {
1896 if ( &General::IpInSubnet($line[1], $netsettings{"$ic"."_NETADDRESS"}, $netsettings{"$ic"."_NETMASK"}) ) {
1897 print"<td align='center'><img src='$imgstatic/$devs_img[$in]' alt='$Lang::tr{$devs_alt[$in]}' title='$Lang::tr{$devs_alt[$in]}' /></td>";
1898 last SWITCH;
1899 }
1900 }
1901
1902 $in++;
1903 }
1904 }
1905
f928cc5a 1906 if ($netsettings{"RED_TYPE"} eq 'DHCP' || $netsettings{"RED_TYPE"} eq 'PPPOE' || $netsettings{"RED_TYPE"} eq 'STATIC') {
0d6cc79d
SF
1907 my $redipadr = qx'ip addr | grep red0 | grep inet | awk "{print \$2}"';
1908 my @rednet = split ("/", $redipadr);
1909 chomp ($rednet[1]);
1910 my $red_netmask = General::iporsubtodec($rednet[1]);
1911 my $red_netaddress = Network::get_netaddress("$rednet[0]/$red_netmask");
1912
1913 if ( &General::IpInSubnet($line[1], $red_netaddress, $red_netmask) ) {
391a2459 1914 print"<td align='center' height='20'><img src='$imgstatic/red.png' alt='$Lang::tr{'internet'}' title='$Lang::tr{'internet'}' /></td>";
0d6cc79d
SF
1915 last SWITCH;
1916 }
1917 else {
1918 print"<td align='center'><img align='middle' src='$imgstatic/white.png' alt='$Lang::tr{'wio_unknown_lan'}' title='$Lang::tr{'wio_unknown_lan'}' /></td>";
1919 last SWITCH;
1920 }
1921 }
1922}
1923
1924 print"<td align='center'>$line[2]</td>
1925 <td align='center'>".&WIO::color_devices($line[3])."</td>";
1926
1927 unless (&WIO::checkinto($line[1], '', @current)) {
1928 print"<td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
1929 <input type='hidden' name='ACTION' value='$Lang::tr{'wio_add'}' />
1930 <input type='image' name='$Lang::tr{'wio_add'}' src='/images/add.gif' align='middle' alt='$Lang::tr{'wio_add'}' title='$Lang::tr{'wio_add'}' />
1931 <input type='hidden' name='ID' value='$idarp' /></form></td>";
1932 }
1933 else {
1934 print"<td align='center'><img src='$imgstatic/add.png' align='middle' alt='$Lang::tr{'wio_no_add'}' title='$Lang::tr{'wio_no_add'}' /></td>";
1935 }
1936
1937print"</tr>";
1938print"<tr height='1'><td colspan='17' bgcolor='#696565'></td></tr>";
1939$idarp++
1940}
1941
1942print"
1943</table>
1944";
a25c95b3 1945}
0d6cc79d
SF
1946
1947&hrline();
1948
1949print"
1950<table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1951<tr>
a25c95b3
SFD
1952 <td width='33%' bgcolor='$color{'color20'}' align='left' height='25'><b>&nbsp;$Lang::tr{'wio_import_file'}</b></td>
1953 <td width='67%' align='right'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='WIOGUISHOWCLIENTIMPORTTABLE' value='clientimport' /><input type='submit' name='ACTION' value='$clientimportbuttontext' /></form></td>
0d6cc79d 1954</tr>
0d6cc79d 1955</table>
a25c95b3
SFD
1956";
1957
1958if ( $wiosettings{'WIOGUISHOWCLIENTIMPORTTABLE'} eq 'on' ) {
1959
1960print"
0d6cc79d 1961<table width='100%' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
a25c95b3 1962<tr><td colspan='3'>&nbsp;</td></tr>
0d6cc79d
SF
1963<tr bgcolor='$color{'color22'}'>
1964 <form method='post' action='/cgi-bin/wio.cgi' enctype='multipart/form-data'>
391a2459 1965 <td width='33%' align='right'>$Lang::tr{'wio_import_csv'}&nbsp;</td>
0d6cc79d 1966 <td width='40%' align='center'><input type='file' name='CSVFILE' size='30' /></td>
391a2459 1967 <td width='27%' align='right'><input type='hidden' name='ACTION' value='$Lang::tr{'wio_import'}1' /><input type='submit' name='SUBMIT' value='$Lang::tr{'wio_import'}' /></td>
0d6cc79d
SF
1968 </form>
1969</tr>
1970<tr><td colspan='3'>&nbsp;</td></tr>
1971<tr bgcolor='$color{'color22'}'>
1972 <form method='post' action='/cgi-bin/wio.cgi' enctype='multipart/form-data'>
391a2459 1973 <td width='33%' align='right'>$Lang::tr{'wio_import_hosts'}&nbsp;</td>
0d6cc79d 1974 <td width='40%' align='center'>&nbsp;</td>
391a2459 1975 <td width='27%' align='right'><input type='hidden' name='ACTION' value='$Lang::tr{'wio_import'}2' /><input type='submit' name='SUBMIT' value='$Lang::tr{'wio_import'}' /></td>
0d6cc79d
SF
1976 </form>
1977</tr>
1978<tr><td colspan='3'>&nbsp;</td></tr>
1979<tr bgcolor='$color{'color22'}'>
1980 <form method='post' action='/cgi-bin/wio.cgi' enctype='multipart/form-data'>
391a2459 1981 <td width='33%' align='right'>$Lang::tr{'wio_import_fixleases'}&nbsp;</td>
0d6cc79d 1982 <td width='40%' align='center'>&nbsp;</td>
391a2459 1983 <td width='27%' align='right'><input type='hidden' name='ACTION' value='$Lang::tr{'wio_import'}3' /><input type='submit' name='SUBMIT' value='$Lang::tr{'wio_import'}' /></td>
0d6cc79d
SF
1984 </form>
1985</tr>
1986</table>
1987";
a25c95b3 1988}
0d6cc79d 1989
391a2459 1990&hrline();
0d6cc79d
SF
1991
1992print"
1993<table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
1994<tr>
a25c95b3
SFD
1995 <td width='33%' bgcolor='$color{'color20'}' align='left' height='25'><b>&nbsp;$Lang::tr{'wio_net_scan'}</b></td>
1996 <td width='67%' align='right'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='WIOGUISHOWNETWORKSEARCHTABLE' value='networksearch' /><input type='submit' name='ACTION' value='$networksearchbuttontext' /></form></td>
0d6cc79d
SF
1997</tr>
1998</table>
a25c95b3
SFD
1999";
2000
2001if ( $wiosettings{'WIOGUISHOWNETWORKSEARCHTABLE'} eq 'on' ) {
2002
2003print"
0d6cc79d
SF
2004<table width='100%' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
2005<tr>
2006 <td colspan='3'>&nbsp;</td>
2007</tr>
2008";
2009
2010foreach (keys(%ifacecolor)) {
2011 if ( $_ eq 'GREEN' ) { $color = "$Header::colourgreen"; $net = $Lang::tr{'wio_net_scan_green'}; }
2012 elsif ( $_ eq 'BLUE' ) { $color = "$Header::colourblue"; $net = $Lang::tr{'wio_net_scan_blue'}; }
391a2459 2013 elsif ( $_ eq 'RED' ) { $color = "$Header::colourred"; $net = $Lang::tr{'wio_net_scan_red'}; }
0d6cc79d
SF
2014 else { $color = "$Header::colourorange"; $net = $Lang::tr{'wio_net_scan_orange'}; }
2015
2016 if ( $netsettings{"${_}_DEV"} eq 'disabled' || $netsettings{"${_}_DEV"} eq '' || $netsettings{"${_}_ADDRESS"} eq '' ) { next; }
2017 else {
2018 print <<END;
2019
2020 <tr bgcolor='$color{'color22'}'>
391a2459 2021 <td width='33%' align='right'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>$Lang::tr{'wio_net_scan_l'} <font color='$color'><b>$net&nbsp;</b></font>$Lang::tr{'wio_net_scan_r'}</td>
0d6cc79d 2022 <td width='40%' align='center'><input type='text' name='${_}_IPLOW' value='$wiosettings{"${_}_IPLOW"}' size='14' STYLE='background-color:$color; text-align: center; color:white' /> - <input type='text' name='${_}_IPHIGH' value='$wiosettings{"${_}_IPHIGH"}' size='14' STYLE='background-color:$color; text-align: center; color:white' /></td>
391a2459 2023 <td width='27%' align='right'><input type='hidden' name='ACTION' value='$ifacecolor{$_}' /><input type='hidden' name='ID' value='$netsettings{"${_}_DEV"}' /><input type='submit' name='SUBMIT' value='$Lang::tr{'wio_net_scan_run'}'></form></td>
0d6cc79d
SF
2024 </tr>
2025 <tr>
2026 <td colspan='3'>&nbsp;</td>
2027 </tr>
2028END
2029 }
2030}
2031
2032print"
2033</tr>
2034</table>
2035</form>
2036";
a25c95b3 2037}
0d6cc79d
SF
2038&Header::closebox();
2039}
2040
2041if ( $wiosettings{'ENABLE'} eq 'on' && !$errormessage && $wiosettings{'ACTION'} ne $Lang::tr{'edit'} || $message == 2 ) {
2042
2043&Header::openbox('100%', 'left', $Lang::tr{'wio_service'});
2044
2045print"
2046<table border='0' width='100%' bordercolor='$Header::bordercolour' cellspacing='0' cellpadding='0' style='border-collapse: collapse'>
2047<tr bgcolor='$color{'color22'}'>
f539ff6d 2048 <td colspan='2' align='right'></td>
fe6f676b
SF
2049";
2050
2051if ( $wiosettings{'LOGGING'} eq 'on' ) {
2052 print"<td width='10%' align='right'><form method='post' action='/cgi-bin/logs.cgi/log.dat' enctype='multipart/form-data'><input type='hidden' name='SECTION' value='wio' /><input type='submit' name='SUBMIT' value='$Lang::tr{'system logs'}' /></form></td>";
2053}
2054
2055print"
f539ff6d 2056 <td width='10%' align='right'><form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'><input type='hidden' name='ACTION' value='$Lang::tr{'edit'}1' /><input type='submit' name='SUBMIT' value='$Lang::tr{'wio_edit_set'}' /></form></td>
0d6cc79d 2057</tr>
730e96c9
SF
2058<tr><td colspan='4'><b>&nbsp;</b></td></tr>
2059<tr><td colspan='4' align='right'><b><font size='1' color='grey'>wio-1.3.2-12</font></b></td></tr>
0d6cc79d
SF
2060</table>
2061";
2062}
2063
2064&Header::closebox();
2065}
2066
2067&Header::closebigbox();
2068&Header::closepage();
2069
2070############################################################################################################################
2071
2072sub SortDataFile {
2073my ($data,@checkfile) = @_;
2074 my $idsort = 0;
2075 our %entries = ();
2076
2077 sub sortips {
2078 my $qs = '';
2079
2080 if (rindex ($wiosettings{'SORT'},'Rev') != -1) {
2081 $qs = substr ($wiosettings{'SORT'},0,length($wiosettings{'SORT'})-3);
2082
2083 if ($qs eq 'IPADR') {
2084 my @a = split (/\./,$entries{$a}->{$qs});
2085 my @b = split (/\./,$entries{$b}->{$qs});
2086 ($b[0]<=>$a[0]) ||
2087 ($b[1]<=>$a[1]) ||
2088 ($b[2]<=>$a[2]) ||
2089 ($b[3]<=>$a[3]);
2090 }
2091 else {
2092 $entries{$b}->{$qs} cmp $entries{$a}->{$qs};
2093 }
2094 }
2095 else {
2096 $qs = $wiosettings{'SORT'};
2097
2098 if ($qs eq 'IPADR') {
2099 my @a = split (/\./,$entries{$a}->{$qs});
2100 my @b = split (/\./,$entries{$b}->{$qs});
2101 ($a[0]<=>$b[0]) ||
2102 ($a[1]<=>$b[1]) ||
2103 ($a[2]<=>$b[2]) ||
2104 ($a[3]<=>$b[3]);
2105 }
2106 else {
2107 $entries{$a}->{$qs} cmp $entries{$b}->{$qs};
2108 }
2109 }
2110 }
2111
2112 if ($data eq 'arpcache') {
2113 foreach (@checkfile) {
2114 chomp;
2115 @temp = split (',', $_);
2116
2117 my @record = ('KEY',$idsort++,'MAC',$temp[0],'IPADR',$temp[1],'HOST',$temp[2],'REMARK',$temp[3],'IFACE',$temp[4]);
2118 my $record = ();
2119 %{$record} = @record;
2120 $entries{$record->{KEY}} = $record;
2121 }
2122
2123 open(FILE, "> $logdir/.arpcache");
2124
2125 foreach (sort sortips keys %entries) {
2126 print FILE "$entries{$_}->{MAC},$entries{$_}->{IPADR},$entries{$_}->{HOST},$entries{$_}->{REMARK},$entries{$_}->{IFACE},$entries{$_}->{HW}\n";
2127 }
2128
2129 close(FILE);
2130
2131 open (FILE, "$logdir/.arpcache");
2132 @arpcache = <FILE>;
2133 close (FILE);
2134 }
2135 else {
2136 foreach (@checkfile) {
2137 chomp;
2138 @temp = split (',', $_);
2139
2140 my @record = ('KEY',$idsort++,'CLIENTID',$temp[0],'TIMESTAMP',$temp[1],'IPADR',$temp[2],'HOST',$temp[3],'EN',$temp[4],'REMARK',$temp[5],'DYNDNS',$temp[6],'SENDEMAILON',$temp[7],'SENDEMAILOFF',$temp[8],'PINGMETHODE',$temp[9],'ONLINE',$temp[10],'WEBINTERFACE',$temp[11]);
2141 my $record = ();
2142 %{$record} = @record;
2143 $entries{$record->{KEY}} = $record;
2144 }
2145
2146 open(FILE, "> $ipadrfile");
2147
2148 foreach (sort sortips keys %entries) {
2149 print FILE "$entries{$_}->{CLIENTID},$entries{$_}->{TIMESTAMP},$entries{$_}->{IPADR},$entries{$_}->{HOST},$entries{$_}->{EN},$entries{$_}->{REMARK},$entries{$_}->{DYNDNS},$entries{$_}->{SENDEMAILON},$entries{$_}->{SENDEMAILOFF},$entries{$_}->{PINGMETHODE},$entries{$_}->{ONLINE},$entries{$_}->{WEBINTERFACE}\n";
2150 }
2151
2152 close(FILE);
2153
2154 &loadips();
2155 }
2156}
2157
2158############################################################################################################################
2159
2160sub hrline {
2161
2162print"<table width='100%'><tr><td colspan='2' height='35'><hr></td></tr></table>";
2163
2164}
2165
2166############################################################################################################################
0d6cc79d
SF
2167
2168sub loadips {
2169
2170&General::readhasharray($ipadrfile, \%ipshash);
2171
2172open(FILE, "< $ipadrfile");
2173@current = <FILE>;
2174close (FILE);
2175
2176}
2177
2178############################################################################################################################
2179
2180sub writeips {
2181
2182open(FILE, "> $ipadrfile");
2183if ( defined($write) ) { print FILE @write; }
2184else { print FILE @current; }
2185close(FILE);
2186
2187}
2188
2189############################################################################################################################
2190
c1fc92a9
SFD
2191sub SortByTunnelName {
2192
2193 if ($vpnconfighash{$a}[1] lt $vpnconfighash{$b}[1]) {
2194 return -1;
2195 }
2196 elsif ($vpnconfighash{$a}[1] gt $vpnconfighash{$b}[1]) {
2197 return 1;
2198 }
2199 else {
2200 return 0;
2201 }
2202
0d6cc79d
SF
2203}
2204
2205############################################################################################################################
2206
c1fc92a9
SFD
2207sub validSave {
2208
0d6cc79d
SF
2209 if ( $wiosettings{'IPADR'} eq '' && $wiosettings{'PINGMETHODE'} eq 'ip' && $wiosettings{'DYNDNS'} eq '' ) {
2210 $errormessage = $Lang::tr{'wio_ip_empty'};
2211 }
2212
2213 if ( $wiosettings{'IPADR'} ne '' && (! &General::validip($wiosettings{'IPADR'})) ) {
2214 $errormessage = $Lang::tr{'wio_ip_error'};
2215 }
2216
2217 if ( $wiosettings{'HOST'} eq '' && $wiosettings{'PINGMETHODE'} eq 'fqdn' ) {
2218 $errormessage = $Lang::tr{'wio_host_empty'};
2219 }
2220
2221 if ( $wiosettings{'HOST'} ne '' && (! &General::validdomainname($wiosettings{'HOST'})) ) {
2222 $errormessage = $Lang::tr{'wio_host_error'};
2223 }
2224
2225 if ( $wiosettings{'DYNDNS'} eq 'on' && (! defined($errormessage)) ) {
2226 unless(&General::validfqdn($wiosettings{'HOST'})) { $errormessage = $Lang::tr{'wio_fqdn_error'}; }
2227 ( $wiosettings{'IPADR'}, $infomessage ) = &WIO::getdyndnsip($wiosettings{'IPADR'}, $wiosettings{'HOST'});
2228 $wiosettings{'PINGMETHODE'} = 'fqdn';
2229 }
2230
2231 if ( $wiosettings{'ID'} eq '' && ! defined($errormessage) ) { $errormessage = &WIO::checkinto($wiosettings{'IPADR'}, $wiosettings{'HOST'}, @current); }
2232
2233 if ( $wiosettings{'REMARK'} ne '' ) { $wiosettings{'REMARK'} =~ s/,/&#44;/g; }
c1fc92a9 2234
0d6cc79d 2235}