From: <abe...@us...> - 2011-10-25 15:06:23
|
Revision: 5236 http://astlinux.svn.sourceforge.net/astlinux/?rev=5236&view=rev Author: abelbeck Date: 2011-10-25 15:06:13 +0000 (Tue, 25 Oct 2011) Log Message: ----------- web interface, Edit tab, Active DNSmasq Leases file, '/mnt/kd/dnsmasq.leases' may be editied, New version number 1.8.01 Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/edit.php branches/1.0/package/webinterface/altweb/common/license-packages.txt branches/1.0/package/webinterface/altweb/common/version.php Modified: branches/1.0/package/webinterface/altweb/admin/edit.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/edit.php 2011-10-24 20:56:38 UTC (rev 5235) +++ branches/1.0/package/webinterface/altweb/admin/edit.php 2011-10-25 15:06:13 UTC (rev 5236) @@ -372,8 +372,12 @@ } if (is_writable($file = '/mnt/kd/dnsmasq.static')) { $sel = ($file === $openfile) ? ' selected="selected"' : ''; - putHtml('<option value="'.$file.'"'.$sel.'>'.basename($file).' - Static DNSmasq Leases</option>'); + putHtml('<option value="'.$file.'"'.$sel.'>'.basename($file).' - Additional DNSmasq Config</option>'); } + if (is_writable($file = '/mnt/kd/dnsmasq.leases')) { + $sel = ($file === $openfile) ? ' selected="selected"' : ''; + putHtml('<option value="'.$file.'"'.$sel.'>'.basename($file).' - Active DNSmasq Leases</option>'); + } if (is_writable($file = '/mnt/kd/blocked-hosts')) { $sel = ($file === $openfile) ? ' selected="selected"' : ''; putHtml('<option value="'.$file.'"'.$sel.'>'.basename($file).' - Firewall Blocked Hosts</option>'); Modified: branches/1.0/package/webinterface/altweb/common/license-packages.txt =================================================================== --- branches/1.0/package/webinterface/altweb/common/license-packages.txt 2011-10-24 20:56:38 UTC (rev 5235) +++ branches/1.0/package/webinterface/altweb/common/license-packages.txt 2011-10-25 15:06:13 UTC (rev 5236) @@ -5,6 +5,7 @@ ## 2) Automatically sorted by package name ## 3) Lines beginning with a '#' are treated as comments ## +ex-vi~Copyright (c) Caldera International Inc. 2001-2002. All rights reserved. RUNNIX~Copyright (c) 2006-2011 by Kristian Kielhofner. libSRTP~Copyright (c) 2001-2005 Cisco Systems, Inc. All rights reserved. Web Interface~Copyright (c) 2008-2011 Lonnie Abelbeck. @@ -16,7 +17,7 @@ OpenSSL~Copyright (c) 1998-2010 The OpenSSL Project. All rights reserved. OpenSSH~Copyright (c) 1995 Tatu Ylonen <yl...@cs...>, Espoo, Finland. All rights reserved. OpenVPN~Copyright (c) 2002-2010 OpenVPN Technologies, Inc. <sa...@op...> -PHP5~Copyright (c) 1999-2009 The PHP Group. All rights reserved. +PHP~Copyright (c) 1999-2009 The PHP Group. All rights reserved. ntpd~Copyright (c) 1992-2009 David L. Mills. vsftpd~Copyright (c) 2001 Daniel Jacobowitz. <da...@de...> lighttpd~Copyright (c) 2004-2010, Jan Kneschke. @@ -29,6 +30,6 @@ curl~Copyright (c) 1996-2010 Daniel Stenberg, <da...@ha...>. mDNS~Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved. rp-pppoe~Copyright (c) 2001-2005 Roaring Penguin Software Inc. -zabbix~Copyright (c) 2000-2005 SIA Zabbix. +zabbix~Copyright (c) 2000-2011 SIA Zabbix. zlib~Copyright (c) 1995-2005 Jean-loup Gailly. MS-Win Installer~Copyright (c) 2010-2011 Tom Chadwin, Nullsoft, et al. Modified: branches/1.0/package/webinterface/altweb/common/version.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/version.php 2011-10-24 20:56:38 UTC (rev 5235) +++ branches/1.0/package/webinterface/altweb/common/version.php 2011-10-25 15:06:13 UTC (rev 5236) @@ -1,6 +1,6 @@ <?php // version.php for AstLinux Alternate Web Interface -$GUI_VERSION = '1.7.30'; +$GUI_VERSION = '1.8.01'; ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2011-11-01 17:06:47
|
Revision: 5241 http://astlinux.svn.sourceforge.net/astlinux/?rev=5241&view=rev Author: abelbeck Date: 2011-11-01 17:06:38 +0000 (Tue, 01 Nov 2011) Log Message: ----------- web interface, make 'http://mirror.astlinux.org/ast18-firmware-1.x' the default Repository URL, a few license tweaks Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/prefs.php branches/1.0/package/webinterface/altweb/admin/system.php branches/1.0/package/webinterface/altweb/common/license-packages.txt Modified: branches/1.0/package/webinterface/altweb/admin/prefs.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/prefs.php 2011-11-01 16:45:03 UTC (rev 5240) +++ branches/1.0/package/webinterface/altweb/admin/prefs.php 2011-11-01 17:06:38 UTC (rev 5241) @@ -793,7 +793,7 @@ putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">Repository URL:</td><td colspan="4">'); if (($value = getPREFdef($global_prefs, 'system_firmware_repository_url')) === '') { - $value = 'http://mirror.astlinux.org/firmware'; + $value = 'http://mirror.astlinux.org/ast18-firmware-1.x'; } putHtml('<input type="text" size="48" maxlength="128" value="'.$value.'" name="repository_url" /></td></tr>'); Modified: branches/1.0/package/webinterface/altweb/admin/system.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/system.php 2011-11-01 16:45:03 UTC (rev 5240) +++ branches/1.0/package/webinterface/altweb/admin/system.php 2011-11-01 17:06:38 UTC (rev 5241) @@ -28,7 +28,7 @@ require_once '../common/users-password.php'; if (($REPOSITORY_URL = getPREFdef($global_prefs, 'system_firmware_repository_url')) === '') { - $REPOSITORY_URL = 'http://mirror.astlinux.org/firmware'; + $REPOSITORY_URL = 'http://mirror.astlinux.org/ast18-firmware-1.x'; } if (($SOUNDS_URL = getPREFdef($global_prefs, 'system_asterisk_sounds_url')) === '') { Modified: branches/1.0/package/webinterface/altweb/common/license-packages.txt =================================================================== --- branches/1.0/package/webinterface/altweb/common/license-packages.txt 2011-11-01 16:45:03 UTC (rev 5240) +++ branches/1.0/package/webinterface/altweb/common/license-packages.txt 2011-11-01 17:06:38 UTC (rev 5241) @@ -5,7 +5,7 @@ ## 2) Automatically sorted by package name ## 3) Lines beginning with a '#' are treated as comments ## -ex-vi~Copyright (c) Caldera International Inc. 2001-2002. All rights reserved. +ex-vi~Copyright (c) 2001-2002 Caldera International Inc. All rights reserved. RUNNIX~Copyright (c) 2006-2011 by Kristian Kielhofner. libSRTP~Copyright (c) 2001-2005 Cisco Systems, Inc. All rights reserved. Web Interface~Copyright (c) 2008-2011 Lonnie Abelbeck. @@ -13,21 +13,21 @@ DAHDI~Copyright (c) 2001-2011 Digium, Inc. libPRI~Copyright (c) 2001-2010 Digium, Inc. Arno's Firewall~Copyright (c) 2001-2011 by Arno van Amersfoort. -dnsmasq~Copyright (c) 2000-2010 Simon Kelley. -OpenSSL~Copyright (c) 1998-2010 The OpenSSL Project. All rights reserved. +dnsmasq~Copyright (c) 2000-2011 Simon Kelley. +OpenSSL~Copyright (c) 1998-2011 The OpenSSL Project. All rights reserved. OpenSSH~Copyright (c) 1995 Tatu Ylonen <yl...@cs...>, Espoo, Finland. All rights reserved. OpenVPN~Copyright (c) 2002-2010 OpenVPN Technologies, Inc. <sa...@op...> -PHP~Copyright (c) 1999-2009 The PHP Group. All rights reserved. +PHP~Copyright (c) 1999-2011 The PHP Group. All rights reserved. ntpd~Copyright (c) 1992-2009 David L. Mills. vsftpd~Copyright (c) 2001 Daniel Jacobowitz. <da...@de...> lighttpd~Copyright (c) 2004-2010, Jan Kneschke. -radvd~Copyright (c) 1996-2008 by Lars Fenneberg <lf...@el...> +radvd~Copyright (c) 1996-2011 by Lars Fenneberg <lf...@el...> msmtp~Copyright (c) 2000-2010 Martin Lambers <ma...@ma...> libxml2~Copyright (c) 1998-2003 Daniel Veillard. All Rights Reserved. libtiff~Copyright (c) 1988-1997 Sam Leffler, Copyright (c) 1991-1997 Silicon Graphics, Inc. libjpeg~Copyright (c) 1991-2010, Thomas G. Lane, Guido Vollbeding. iptables~Copyright (c) 2000-2002 by the netfilter coreteam <cor...@ne...> -curl~Copyright (c) 1996-2010 Daniel Stenberg, <da...@ha...>. +curl~Copyright (c) 1996-2011 Daniel Stenberg, <da...@ha...>. mDNS~Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved. rp-pppoe~Copyright (c) 2001-2005 Roaring Penguin Software Inc. zabbix~Copyright (c) 2000-2011 SIA Zabbix. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2011-11-26 17:44:27
|
Revision: 5272 http://astlinux.svn.sourceforge.net/astlinux/?rev=5272&view=rev Author: abelbeck Date: 2011-11-26 17:44:20 +0000 (Sat, 26 Nov 2011) Log Message: ----------- web interface, Prefs tab, new option General Options -> External CLI Link Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/prefs.php branches/1.0/package/webinterface/altweb/common/header.php branches/1.0/package/webinterface/altweb/common/status.inc branches/1.0/package/webinterface/altweb/common/version.php Modified: branches/1.0/package/webinterface/altweb/admin/prefs.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/prefs.php 2011-11-26 04:52:22 UTC (rev 5271) +++ branches/1.0/package/webinterface/altweb/admin/prefs.php 2011-11-26 17:44:20 UTC (rev 5272) @@ -307,6 +307,10 @@ $value = 'external_url_name_cmdstr = "'.$value.'"'; fwrite($fp, $value."\n"); } + if (($value = trim($_POST['external_cli_link'])) !== '') { + $value = 'external_cli_link_cmdstr = "'.$value.'"'; + fwrite($fp, $value."\n"); + } if (isset($_POST['tab_directory'])) { $value = 'tab_directory_show = yes'; @@ -847,6 +851,9 @@ putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">External URL Name:</td><td colspan="4">'); $value = getPREFdef($global_prefs, 'external_url_name_cmdstr'); putHtml('<input type="text" size="48" maxlength="64" value="'.$value.'" name="external_url_name" /></td></tr>'); + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">External CLI Link:</td><td colspan="4">'); + $value = getPREFdef($global_prefs, 'external_cli_link_cmdstr'); + putHtml('<input type="text" size="48" maxlength="128" value="'.$value.'" name="external_cli_link" /></td></tr>'); putHtml('<tr class="dtrow1"><td style="text-align: right;">'); $sel = (getPREFdef($global_prefs, 'tab_directory_show') === 'yes') ? ' checked="checked"' : ''; Modified: branches/1.0/package/webinterface/altweb/common/header.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/header.php 2011-11-26 04:52:22 UTC (rev 5271) +++ branches/1.0/package/webinterface/altweb/common/header.php 2011-11-26 17:44:20 UTC (rev 5272) @@ -65,6 +65,21 @@ return(htmlspecialchars($cmd)); } +// Function: getCLIlink +// +function getCLIlink($g_prefs) { + if (($cmd = getPREFdef($g_prefs, 'external_cli_link_cmdstr')) !== '') { + if (strpos($cmd, '@localhost') !== FALSE) { + $host = $_SERVER['HTTP_HOST']; + if (($pos = strpos($host, ':')) !== FALSE) { + $host = substr($host, 0, $pos); + } + $cmd = str_replace('@localhost', '@'.$host, $cmd); + } + } + return(htmlspecialchars($cmd)); +} + // Function: putUSERerror // function putUSERerror($user, $tab) { @@ -120,8 +135,17 @@ putHtml('<table class="headerTable"><tr>'); putHtml('<td width="140"><img src="/common/logo-small.gif" width="113" height="23" alt="AstLinux" /></td>'); putHtml('<td><h1>'.getTITLEname($global_prefs).'</h1></td>'); - if (($URLlink = getURLlink($global_prefs)) !== '') { - putHtml('<td style="text-align: right;"><a href="'.$URLlink.'" class="headerText" target="_blank">'.getURLname($global_prefs).'</a></td>'); + $URLlink = getURLlink($global_prefs); + $CLIlink = getCLIlink($global_prefs); + if ($URLlink !== '' || ($global_admin && $CLIlink !== '')) { + putHtml('<td style="text-align: right;">'); + if ($URLlink !== '') { + putHtml('<a href="'.$URLlink.'" class="headerText" target="_blank">'.getURLname($global_prefs).'</a>'); + } + if ($global_admin && $CLIlink !== '') { + putHtml('<a href="'.$CLIlink.'" class="headerText">CLI</a>'); + } + putHtml('</td>'); } putHtml('</tr></table>'); putHtml('<div id="tabs">'); Modified: branches/1.0/package/webinterface/altweb/common/status.inc =================================================================== --- branches/1.0/package/webinterface/altweb/common/status.inc 2011-11-26 04:52:22 UTC (rev 5271) +++ branches/1.0/package/webinterface/altweb/common/status.inc 2011-11-26 17:44:20 UTC (rev 5272) @@ -992,7 +992,7 @@ $ph = @fopen($tmpfile, "r"); while (! feof($ph)) { - if ($line = trim(fgets($ph, 1024))) { + if ($line = rtrim(fgets($ph, 1024))) { putText($line); } } Modified: branches/1.0/package/webinterface/altweb/common/version.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/version.php 2011-11-26 04:52:22 UTC (rev 5271) +++ branches/1.0/package/webinterface/altweb/common/version.php 2011-11-26 17:44:20 UTC (rev 5272) @@ -1,6 +1,6 @@ <?php // version.php for AstLinux Alternate Web Interface -$GUI_VERSION = '1.8.01'; +$GUI_VERSION = '1.8.02'; ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2011-12-04 00:55:59
|
Revision: 5281 http://astlinux.svn.sourceforge.net/astlinux/?rev=5281&view=rev Author: abelbeck Date: 2011-12-04 00:55:52 +0000 (Sun, 04 Dec 2011) Log Message: ----------- web interface, add support for shellinaboxd and lighttpd access logging variables Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/network.php branches/1.0/package/webinterface/altweb/admin/prefs.php branches/1.0/package/webinterface/altweb/common/header.php branches/1.0/package/webinterface/altweb/common/license-packages.txt branches/1.0/package/webinterface/altweb/common/version.php Added Paths: ----------- branches/1.0/package/webinterface/altweb/admin/cli.php Added: branches/1.0/package/webinterface/altweb/admin/cli.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/cli.php (rev 0) +++ branches/1.0/package/webinterface/altweb/admin/cli.php 2011-12-04 00:55:52 UTC (rev 5281) @@ -0,0 +1,57 @@ +<?php + +// Copyright (C) 2008-2011 Lonnie Abelbeck +// This is free software, licensed under the GNU General Public License +// version 3 as published by the Free Software Foundation; you can +// redistribute it and/or modify it under the terms of the GNU +// General Public License; and comes with ABSOLUTELY NO WARRANTY. + +// cli.php for AstLinux +// 12-01-2011 +// + +$myself = $_SERVER['PHP_SELF']; + +require_once '../common/functions.php'; + +if ($_SERVER['REQUEST_METHOD'] === 'POST') { + $result = 1; + if (! $global_admin) { + $result = 999; + } + header('Location: '.$myself.'?result='.$result); + exit; +} else { // Start of HTTP GET +$ACCESS_RIGHTS = 'admin'; +require_once '../common/header.php'; + + putHtml("<center>"); + putHtml('<p> </p>'); + putHtml("</center>"); +?> + <center> + <table class="layoutNOpad" width="100%"><tr><td><center> + <table class="stdtable"> + <tr><td style="text-align: center;" colspan="3"> + <h2>Command Line Interface:</h2> + </td></tr></table> +<?php + + if (($rows = getPREFdef($global_prefs, 'edit_text_rows_cmdstr')) === '') { + $rows = '30'; + } + $height = ($rows - 1) * 20; + putHtml('<table class="stdtable" width="100%"><tr><td style="text-align: center;">'); + if (is_file('/var/run/shellinaboxd.pid')) { + echo '<iframe src="/admin/cli/" frameborder="1" width="95%" height="'.$height.'">'; + putHtml('</iframe>'); + } else { + putHtml('<p style="color: red;">The CLI Proxy Server is not running, enable via the Network Tab.</p>'); + } + putHtml('</td></tr></table>'); + putHtml("</center></td></tr></table>"); + putHtml("</center>"); +} // End of HTTP GET +require_once '../common/footer.php'; + +?> Property changes on: branches/1.0/package/webinterface/altweb/admin/cli.php ___________________________________________________________________ Added: svn:executable + * Modified: branches/1.0/package/webinterface/altweb/admin/network.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/network.php 2011-12-04 00:48:24 UTC (rev 5280) +++ branches/1.0/package/webinterface/altweb/admin/network.php 2011-12-04 00:55:52 UTC (rev 5281) @@ -28,6 +28,7 @@ // 03-24-2011, Removed deprecated HTTPUSER and HTTPSUSER support // 03-24-2011, Added HTTP_LISTING and HTTPS_LISTING support // 05-24-2011, Added SIP Monitoring +// 12-03-2011, Added HTTP_ACCESSLOG and HTTPS_ACCESSLOG support // // System location of rc.conf file $CONFFILE = '/etc/rc.conf'; @@ -380,6 +381,9 @@ $value = 'TFTPD="'.$_POST['tftp'].'"'; fwrite($fp, "### TFTP Server\n".$value."\n"); + $value = 'CLI_PROXY_SERVER="'.$_POST['cli_proxy'].'"'; + fwrite($fp, "### CLI Proxy Server\n".$value."\n"); + $value = 'HTTPDIR="'.trim($_POST['http_dir']).'"'; fwrite($fp, "### HTTP Server Directory\n".$value."\n"); @@ -389,6 +393,9 @@ $value = isset($_POST['http_listing']) ? 'HTTP_LISTING="yes"' : 'HTTP_LISTING="no"'; fwrite($fp, "### HTTP directory listing\n".$value."\n"); + $value = isset($_POST['http_accesslog']) ? 'HTTP_ACCESSLOG="yes"' : 'HTTP_ACCESSLOG="no"'; + fwrite($fp, "### HTTP access logging\n".$value."\n"); + $value = 'HTTPSDIR="'.trim($_POST['https_dir']).'"'; fwrite($fp, "### HTTPS Server Directory\n".$value."\n"); @@ -398,6 +405,9 @@ $value = isset($_POST['https_listing']) ? 'HTTPS_LISTING="yes"' : 'HTTPS_LISTING="no"'; fwrite($fp, "### HTTPS directory listing\n".$value."\n"); + $value = isset($_POST['https_accesslog']) ? 'HTTPS_ACCESSLOG="yes"' : 'HTTPS_ACCESSLOG="no"'; + fwrite($fp, "### HTTPS access logging\n".$value."\n"); + $value = 'HTTPSCERT="'.trim($_POST['https_cert']).'"'; if (isset($_POST['create_cert']) && is_opensslHERE()) { if (($countryName = getPREFdef($global_prefs, 'dn_country_name_cmdstr')) === '') { @@ -1315,27 +1325,48 @@ $sel = ($value === 'dnsmasq' || $value === 'tftpd' || $value === 'inetd') ? ' selected="selected"' : ''; putHtml('<option value="dnsmasq"'.$sel.'>enabled</option>'); putHtml('</select></td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: left;" colspan="6">'); + putHtml('CLI Proxy Server:'); + putHtml('<select name="cli_proxy">'); + putHtml('<option value="">disabled</option>'); + $value = getVARdef($db, 'CLI_PROXY_SERVER', $cur_db); + $sel = ($value === 'shellinaboxd') ? ' selected="selected"' : ''; + putHtml('<option value="shellinaboxd"'.$sel.'>enabled</option>'); + putHtml('</select>'); + putHtml(' <i>(https://'.$_SERVER['HTTP_HOST'].'/admin/cli/ or CLI Tab)</i>'); + putHtml('</td></tr>'); - putHtml('<tr class="dtrow1"><td style="text-align: left;" colspan="4">'); + putHtml('<tr class="dtrow1"><td style="text-align: left;" colspan="6">'); $value = getVARdef($db, 'HTTPDIR', $cur_db); - putHtml('HTTP Server Directory:<input type="text" size="36" maxlength="64" value="'.$value.'" name="http_dir" /></td>'); - putHtml('<td style="text-align: left;" colspan="2">'); + putHtml('HTTP Server Directory:<input type="text" size="45" maxlength="64" value="'.$value.'" name="http_dir" />'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: left;" colspan="6">'); + putHtml('HTTP Server Options:'); $sel = (getVARdef($db, 'HTTPCGI', $cur_db) === 'yes') ? ' checked="checked"' : ''; putHtml('<input type="checkbox" value="http_cgi" name="http_cgi"'.$sel.' /> HTTP CGI '); $sel = (getVARdef($db, 'HTTP_LISTING', $cur_db) === 'yes') ? ' checked="checked"' : ''; putHtml('<input type="checkbox" value="http_listing" name="http_listing"'.$sel.' /> Allow Listing'); + $sel = (getVARdef($db, 'HTTP_ACCESSLOG', $cur_db) === 'yes') ? ' checked="checked"' : ''; + putHtml('<input type="checkbox" value="http_accesslog" name="http_accesslog"'.$sel.' /> Access Logging'); putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: left;" colspan="6">'); + $value = getVARdef($db, 'HTTPSDIR', $cur_db); + putHtml('HTTPS Server Directory:<input type="text" size="45" maxlength="64" value="'.$value.'" name="https_dir" />'); + putHtml('</td></tr>'); - putHtml('<tr class="dtrow1"><td style="text-align: left;" colspan="4">'); - $value = getVARdef($db, 'HTTPSDIR', $cur_db); - putHtml('HTTPS Server Directory:<input type="text" size="36" maxlength="64" value="'.$value.'" name="https_dir" /></td>'); - putHtml('<td style="text-align: left;" colspan="2">'); + putHtml('<tr class="dtrow1"><td style="text-align: left;" colspan="6">'); + putHtml('HTTPS Server Options:'); $sel = (getVARdef($db, 'HTTPSCGI', $cur_db) === 'yes') ? ' checked="checked"' : ''; putHtml('<input type="checkbox" value="https_cgi" name="https_cgi"'.$sel.' /> HTTPS CGI '); $sel = (getVARdef($db, 'HTTPS_LISTING', $cur_db) === 'yes') ? ' checked="checked"' : ''; putHtml('<input type="checkbox" value="https_listing" name="https_listing"'.$sel.' /> Allow Listing'); + $sel = (getVARdef($db, 'HTTPS_ACCESSLOG', $cur_db) === 'yes') ? ' checked="checked"' : ''; + putHtml('<input type="checkbox" value="https_accesslog" name="https_accesslog"'.$sel.' /> Access Logging'); putHtml('</td></tr>'); - + if (is_opensslHERE()) { putHtml('<tr class="dtrow1"><td style="text-align: left;" colspan="4">'); $value = getVARdef($db, 'HTTPSCERT', $cur_db); Modified: branches/1.0/package/webinterface/altweb/admin/prefs.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/prefs.php 2011-12-04 00:48:24 UTC (rev 5280) +++ branches/1.0/package/webinterface/altweb/admin/prefs.php 2011-12-04 00:55:52 UTC (rev 5281) @@ -376,6 +376,10 @@ $value = 'tab_edit_show = no'; fwrite($fp, $value."\n"); } + if (isset($_POST['tab_cli'])) { + $value = 'tab_cli_show = yes'; + fwrite($fp, $value."\n"); + } if (! isset($_POST['tab_staff'])) { $value = 'tab_staff_disable_staff = yes'; fwrite($fp, $value."\n"); @@ -917,6 +921,10 @@ putHtml('<input type="checkbox" value="tab_edit" name="tab_edit"'.$sel.' /></td><td colspan="5">Show Edit Tab</td></tr>'); putHtml('<tr class="dtrow1"><td style="text-align: right;">'); + $sel = (getPREFdef($global_prefs, 'tab_cli_show') === 'yes') ? ' checked="checked"' : ''; + putHtml('<input type="checkbox" value="tab_cli" name="tab_cli"'.$sel.' /></td><td colspan="5">Show CLI Tab</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;">'); $sel = (getPREFdef($global_prefs, 'tab_staff_disable_staff') !== 'yes') ? ' checked="checked"' : ''; putHtml('<input type="checkbox" value="tab_staff" name="tab_staff"'.$sel.' /></td><td colspan="5">Show Staff Tab for "staff" user</td></tr>'); Modified: branches/1.0/package/webinterface/altweb/common/header.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/header.php 2011-12-04 00:48:24 UTC (rev 5280) +++ branches/1.0/package/webinterface/altweb/common/header.php 2011-12-04 00:55:52 UTC (rev 5281) @@ -41,17 +41,37 @@ return(htmlspecialchars($cmd)); } +// Function: url_localhost_handler +// +function url_localhost_handler($str) { + if (strpos($str, '://localhost') !== FALSE) { + $host = $_SERVER['HTTP_HOST']; + if (($pos = strpos($host, ':')) !== FALSE && strpos($str, '://localhost:') !== FALSE) { + $host = substr($host, 0, $pos); + } + $str = str_replace('://localhost', '://'.$host, $str); + } + return($str); +} + +// Function: ssh_localhost_handler +// +function ssh_localhost_handler($str) { + if (strpos($str, '@localhost') !== FALSE) { + $host = $_SERVER['HTTP_HOST']; + if (($pos = strpos($host, ':')) !== FALSE) { + $host = substr($host, 0, $pos); + } + $str = str_replace('@localhost', '@'.$host, $str); + } + return($str); +} + // Function: getURLlink // function getURLlink($g_prefs) { if (($cmd = getPREFdef($g_prefs, 'external_url_link_cmdstr')) !== '') { - if (strpos($cmd, '://localhost') !== FALSE) { - $host = $_SERVER['HTTP_HOST']; - if (($pos = strpos($host, ':')) !== FALSE && strpos($cmd, '://localhost:') !== FALSE) { - $host = substr($host, 0, $pos); - } - $cmd = str_replace('://localhost', '://'.$host, $cmd); - } + $cmd = url_localhost_handler($cmd); } return(htmlspecialchars($cmd)); } @@ -69,12 +89,10 @@ // function getCLIlink($g_prefs) { if (($cmd = getPREFdef($g_prefs, 'external_cli_link_cmdstr')) !== '') { - if (strpos($cmd, '@localhost') !== FALSE) { - $host = $_SERVER['HTTP_HOST']; - if (($pos = strpos($host, ':')) !== FALSE) { - $host = substr($host, 0, $pos); - } - $cmd = str_replace('@localhost', '@'.$host, $cmd); + if (strncmp($cmd, 'ssh://', 6) == 0) { + $cmd = ssh_localhost_handler($cmd); + } else { + $cmd = url_localhost_handler($cmd); } } return(htmlspecialchars($cmd)); @@ -143,7 +161,11 @@ putHtml('<a href="'.$URLlink.'" class="headerText" target="_blank">'.getURLname($global_prefs).'</a>'); } if ($global_admin && $CLIlink !== '') { - putHtml('<a href="'.$CLIlink.'" class="headerText">CLI</a>'); + if (strncmp($CLIlink, 'ssh://', 6) == 0) { + putHtml('<a href="'.$CLIlink.'" class="headerText">CLI</a>'); + } else { + putHtml('<a href="'.$CLIlink.'" class="headerText" target="_blank">CLI</a>'); + } } putHtml('</td>'); } @@ -201,6 +223,9 @@ if ($global_admin && (getPREFdef($global_prefs, 'tab_edit_show') !== 'no')) { putHtml('<li><a href="/admin/edit.php"><span>Edit</span></a></li>'); } + if ($global_admin && (getPREFdef($global_prefs, 'tab_cli_show') === 'yes')) { + putHtml('<li><a href="/admin/cli.php"><span>CLI</span></a></li>'); + } if ($global_admin && (getPREFdef($global_prefs, 'tab_prefs_show') !== 'no')) { putHtml('<li><a href="/admin/prefs.php"><span>Prefs</span></a></li>'); } Modified: branches/1.0/package/webinterface/altweb/common/license-packages.txt =================================================================== --- branches/1.0/package/webinterface/altweb/common/license-packages.txt 2011-12-04 00:48:24 UTC (rev 5280) +++ branches/1.0/package/webinterface/altweb/common/license-packages.txt 2011-12-04 00:55:52 UTC (rev 5281) @@ -9,6 +9,7 @@ RUNNIX~Copyright (c) 2006-2011 by Kristian Kielhofner. libSRTP~Copyright (c) 2001-2005 Cisco Systems, Inc. All rights reserved. Web Interface~Copyright (c) 2008-2011 Lonnie Abelbeck. +shellinabox~Copyright (c) 2008-2010 Markus Gutschke. Asterisk~Copyright (c) 1999-2011 Digium, Inc. DAHDI~Copyright (c) 2001-2011 Digium, Inc. libPRI~Copyright (c) 2001-2010 Digium, Inc. Modified: branches/1.0/package/webinterface/altweb/common/version.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/version.php 2011-12-04 00:48:24 UTC (rev 5280) +++ branches/1.0/package/webinterface/altweb/common/version.php 2011-12-04 00:55:52 UTC (rev 5281) @@ -1,6 +1,6 @@ <?php // version.php for AstLinux Alternate Web Interface -$GUI_VERSION = '1.8.02'; +$GUI_VERSION = '1.8.03'; ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2012-01-03 00:24:06
|
Revision: 5352 http://astlinux.svn.sourceforge.net/astlinux/?rev=5352&view=rev Author: abelbeck Date: 2012-01-03 00:24:00 +0000 (Tue, 03 Jan 2012) Log Message: ----------- web interface, Status tab, add Jabber Status section. Enabled via the Prefs tab. Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/prefs.php branches/1.0/package/webinterface/altweb/common/status.inc branches/1.0/package/webinterface/altweb/common/version.php Modified: branches/1.0/package/webinterface/altweb/admin/prefs.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/prefs.php 2012-01-02 21:16:22 UTC (rev 5351) +++ branches/1.0/package/webinterface/altweb/admin/prefs.php 2012-01-03 00:24:00 UTC (rev 5352) @@ -1,6 +1,6 @@ <?php -// Copyright (C) 2008-2010 Lonnie Abelbeck +// Copyright (C) 2008-2012 Lonnie Abelbeck // This is free software, licensed under the GNU General Public License // version 3 as published by the Free Software Foundation; you can // redistribute it and/or modify it under the terms of the GNU @@ -11,6 +11,7 @@ // 04-20-2008, Never-ending Additions // 08-19-2008, Added CDR Log Format Menu // 08-24-2008, Added /mnt/kd/ prefs file support +// 01-02-2012, Added Show Jabber Status/Command // $myself = $_SERVER['PHP_SELF']; @@ -91,6 +92,10 @@ $value = 'status_dahdi_show_status = yes'; fwrite($fp, $value."\n"); } + if (isset($_POST['jabber_status'])) { + $value = 'status_jabber_show_status = yes'; + fwrite($fp, $value."\n"); + } if (isset($_POST['firewall_states'])) { $value = 'status_show_firewall_states = yes'; fwrite($fp, $value."\n"); @@ -137,6 +142,8 @@ fwrite($fp, $value."\n"); $value = 'status_dahdi_status_cmdstr = "'.trim($_POST['dahdi_cmd']).'"'; fwrite($fp, $value."\n"); + $value = 'status_jabber_status_cmdstr = "'.trim($_POST['jabber_cmd']).'"'; + fwrite($fp, $value."\n"); $value = 'sysdial_ext_prefix_cmdstr = "'.trim($_POST['ext_prefix']).'"'; fwrite($fp, $value."\n"); @@ -501,6 +508,15 @@ putHtml('<input type="text" size="28" maxlength="64" value="'.$value.'" name="dahdi_cmd" /></td></tr>'); putHtml('<tr class="dtrow1"><td style="text-align: right;">'); + $sel = (getPREFdef($global_prefs, 'status_jabber_show_status') === 'yes') ? ' checked="checked"' : ''; + putHtml('<input type="checkbox" value="jabber_status" name="jabber_status"'.$sel.' /></td><td colspan="5">Show Jabber Status</td></tr>'); + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="3">Jabber Status Command:</td><td colspan="3">'); + if (($value = getPREFdef($global_prefs, 'status_jabber_status_cmdstr')) === '') { + $value = 'jabber show connections'; + } + putHtml('<input type="text" size="28" maxlength="64" value="'.$value.'" name="jabber_cmd" /></td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;">'); $sel = (getPREFdef($global_prefs, 'status_show_firewall_states') === 'yes') ? ' checked="checked"' : ''; putHtml('<input type="checkbox" value="firewall_states" name="firewall_states"'.$sel.' /></td><td colspan="5">Show Firewall States</td></tr>'); putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">Hide SRC Ports:</td><td colspan="4">'); Modified: branches/1.0/package/webinterface/altweb/common/status.inc =================================================================== --- branches/1.0/package/webinterface/altweb/common/status.inc 2012-01-02 21:16:22 UTC (rev 5351) +++ branches/1.0/package/webinterface/altweb/common/status.inc 2012-01-03 00:24:00 UTC (rev 5352) @@ -1,6 +1,6 @@ <?php -// Copyright (C) 2008-2011 Lonnie Abelbeck +// Copyright (C) 2008-2012 Lonnie Abelbeck // This is free software, licensed under the GNU General Public License // version 3 as published by the Free Software Foundation; you can // redistribute it and/or modify it under the terms of the GNU @@ -24,6 +24,7 @@ // 11-06-2009, Added Reboot Scheduled notice // 05-05-2011, Added DAHDI Status and Hardware Monitoring sections // 08-10-2011, Added APC UPS Status +// 01-02-2012, Added Jabber Status // // System location of OpenVPN Client logfile $OVPNCLOGFILE = '/var/log/openvpnclient-status.log'; @@ -889,6 +890,27 @@ @unlink($tmpfile); putHtml("</pre>"); } + + if ($status == 0 && getPREFdef($global_prefs, 'status_jabber_show_status') === 'yes') { + if (($cmd = getPREFdef($global_prefs, 'status_jabber_status_cmdstr')) === '') { + $cmd = 'jabber show connections'; + } + putHtml("<h2>Jabber Status:</h2>"); + putHtml("<pre>"); + $tmpfile = tempnam("/tmp", "PHP_"); + asteriskCMD($cmd, $tmpfile); + $ph = @fopen($tmpfile, "r"); + while (! feof($ph)) { + if ($line = trim(fgets($ph, 1024))) { + if (strncasecmp($line, 'verbosity ', 10)) { + putText($line); + } + } + } + fclose($ph); + @unlink($tmpfile); + putHtml("</pre>"); + } } if (is_file($CONNTRACK)) { Modified: branches/1.0/package/webinterface/altweb/common/version.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/version.php 2012-01-02 21:16:22 UTC (rev 5351) +++ branches/1.0/package/webinterface/altweb/common/version.php 2012-01-03 00:24:00 UTC (rev 5352) @@ -1,6 +1,6 @@ <?php // version.php for AstLinux Alternate Web Interface -$GUI_VERSION = '1.8.04'; +$GUI_VERSION = '1.8.05'; ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2012-01-12 22:24:44
|
Revision: 5375 http://astlinux.svn.sourceforge.net/astlinux/?rev=5375&view=rev Author: abelbeck Date: 2012-01-12 22:24:33 +0000 (Thu, 12 Jan 2012) Log Message: ----------- web interface, Prefs tab and System tab, if the Repository URL: has not been defined (initial configuration), the default value will be based on the installed Asterisk version. Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/prefs.php branches/1.0/package/webinterface/altweb/admin/system.php branches/1.0/package/webinterface/altweb/common/functions.php branches/1.0/package/webinterface/altweb/common/version.php Modified: branches/1.0/package/webinterface/altweb/admin/prefs.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/prefs.php 2012-01-12 16:55:55 UTC (rev 5374) +++ branches/1.0/package/webinterface/altweb/admin/prefs.php 2012-01-12 22:24:33 UTC (rev 5375) @@ -817,7 +817,7 @@ putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">Repository URL:</td><td colspan="4">'); if (($value = getPREFdef($global_prefs, 'system_firmware_repository_url')) === '') { - $value = 'http://mirror.astlinux.org/ast18-firmware-1.x'; + $value = asteriskURLrepo(); } putHtml('<input type="text" size="48" maxlength="128" value="'.$value.'" name="repository_url" /></td></tr>'); Modified: branches/1.0/package/webinterface/altweb/admin/system.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/system.php 2012-01-12 16:55:55 UTC (rev 5374) +++ branches/1.0/package/webinterface/altweb/admin/system.php 2012-01-12 22:24:33 UTC (rev 5375) @@ -1,6 +1,6 @@ <?php -// Copyright (C) 2008-2011 Lonnie Abelbeck +// Copyright (C) 2008-2012 Lonnie Abelbeck // This is free software, licensed under the GNU General Public License // version 3 as published by the Free Software Foundation; you can // redistribute it and/or modify it under the terms of the GNU @@ -28,7 +28,7 @@ require_once '../common/users-password.php'; if (($REPOSITORY_URL = getPREFdef($global_prefs, 'system_firmware_repository_url')) === '') { - $REPOSITORY_URL = 'http://mirror.astlinux.org/ast18-firmware-1.x'; + $REPOSITORY_URL = asteriskURLrepo(); } if (($SOUNDS_URL = getPREFdef($global_prefs, 'system_asterisk_sounds_url')) === '') { Modified: branches/1.0/package/webinterface/altweb/common/functions.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/functions.php 2012-01-12 16:55:55 UTC (rev 5374) +++ branches/1.0/package/webinterface/altweb/common/functions.php 2012-01-12 22:24:33 UTC (rev 5375) @@ -1,6 +1,6 @@ <?php -// Copyright (C) 2008-2011 Lonnie Abelbeck +// Copyright (C) 2008-2012 Lonnie Abelbeck // This is free software, licensed under the GNU General Public License // version 3 as published by the Free Software Foundation; you can // redistribute it and/or modify it under the terms of the GNU @@ -15,6 +15,7 @@ // 08-20-2008, Added asteriskCMD() // 09-06-2008, Added restartPROCESS() // 12-12-2009, Added systemSHUTDOWN() +// 01-12-2012, Added asteriskURLrepo() // // System location of prefs file $KD_PREFS_LOCATION = '/mnt/kd/webgui-prefs.txt'; @@ -447,6 +448,20 @@ return($db_R); } +// Function: asteriskURLrepo +// +function asteriskURLrepo() { + + $version = trim(shell_exec('/usr/sbin/asterisk -V')); + + if (strncmp($version, 'Asterisk 1.4.', 13) == 0) { + $str = 'http://mirror.astlinux.org/firmware-1.x'; + } else { + $str = 'http://mirror.astlinux.org/ast18-firmware-1.x'; + } + return($str); +} + // Function: asteriskERROR // function asteriskERROR($result) { Modified: branches/1.0/package/webinterface/altweb/common/version.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/version.php 2012-01-12 16:55:55 UTC (rev 5374) +++ branches/1.0/package/webinterface/altweb/common/version.php 2012-01-12 22:24:33 UTC (rev 5375) @@ -1,6 +1,6 @@ <?php // version.php for AstLinux Alternate Web Interface -$GUI_VERSION = '1.8.05'; +$GUI_VERSION = '1.8.06'; ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2012-02-21 18:03:28
|
Revision: 5463 http://astlinux.svn.sourceforge.net/astlinux/?rev=5463&view=rev Author: abelbeck Date: 2012-02-21 18:03:21 +0000 (Tue, 21 Feb 2012) Log Message: ----------- web interface, Prefs tab and CDR Log tab, add support for 'uniqueid' CDR value Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/cdrlog.php branches/1.0/package/webinterface/altweb/admin/prefs.php branches/1.0/package/webinterface/altweb/common/version.php Modified: branches/1.0/package/webinterface/altweb/admin/cdrlog.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/cdrlog.php 2012-02-21 18:00:01 UTC (rev 5462) +++ branches/1.0/package/webinterface/altweb/admin/cdrlog.php 2012-02-21 18:03:21 UTC (rev 5463) @@ -67,6 +67,8 @@ return($def ? 14 : 15); case 'accountcode': return($def ? 15 : 0); + case 'uniqueid': + return($def ? 16 : 16); case 'userfield': return($def ? 17 : 17); } @@ -185,6 +187,9 @@ if (isset($map['accountcode'])) { $str .= ',"'.trim($linetokens[$map['accountcode']], '"').'"'; } + if (isset($map['uniqueid'])) { + $str .= ',"'.trim($linetokens[$map['uniqueid']], '"').'"'; + } if (isset($map['userfield'])) { $str .= ',"'.trim($linetokens[$map['userfield']], '"').'"'; } @@ -316,6 +321,9 @@ if (isset($map['accountcode'])) { $db['data'][$id]['accountcode'] = trim($linetokens[$map['accountcode']], '"'); } + if (isset($map['uniqueid'])) { + $db['data'][$id]['uniqueid'] = trim($linetokens[$map['uniqueid']], '"'); + } if (isset($map['userfield'])) { $db['data'][$id]['userfield'] = trim($linetokens[$map['userfield']], '"'); } Modified: branches/1.0/package/webinterface/altweb/admin/prefs.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/prefs.php 2012-02-21 18:00:01 UTC (rev 5462) +++ branches/1.0/package/webinterface/altweb/admin/prefs.php 2012-02-21 18:03:21 UTC (rev 5463) @@ -656,6 +656,8 @@ putHtml('<option value="amaflags"'.$sel.'>amaflags</option>'); $sel = (getPREFdef($global_prefs, 'cdrlog_last_cmd') === 'accountcode') ? ' selected="selected"' : ''; putHtml('<option value="accountcode"'.$sel.'>accountcode</option>'); + $sel = (getPREFdef($global_prefs, 'cdrlog_last_cmd') === 'uniqueid') ? ' selected="selected"' : ''; + putHtml('<option value="uniqueid"'.$sel.'>uniqueid</option>'); $sel = (getPREFdef($global_prefs, 'cdrlog_last_cmd') === 'userfield') ? ' selected="selected"' : ''; putHtml('<option value="userfield"'.$sel.'>userfield</option>'); putHtml('</select>'); Modified: branches/1.0/package/webinterface/altweb/common/version.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/version.php 2012-02-21 18:00:01 UTC (rev 5462) +++ branches/1.0/package/webinterface/altweb/common/version.php 2012-02-21 18:03:21 UTC (rev 5463) @@ -1,6 +1,6 @@ <?php // version.php for AstLinux Alternate Web Interface -$GUI_VERSION = '1.8.06'; +$GUI_VERSION = '1.8.07'; ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2012-03-29 01:30:26
|
Revision: 5497 http://astlinux.svn.sourceforge.net/astlinux/?rev=5497&view=rev Author: abelbeck Date: 2012-03-29 01:30:20 +0000 (Thu, 29 Mar 2012) Log Message: ----------- web interface, Firewall sub-tab, for [ NAT EXT->LAN ] and [ NAT EXT->DMZ ] actions, allow to restrict the NAT to a single IPv4 external address (or aliased interface). This feature allows multiple public IPv4 addresses to be individually NAT'ed to private internal addresses by port or range of ports. Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/firewall.php branches/1.0/package/webinterface/altweb/common/version.php Modified: branches/1.0/package/webinterface/altweb/admin/firewall.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/firewall.php 2012-03-21 19:24:24 UTC (rev 5496) +++ branches/1.0/package/webinterface/altweb/admin/firewall.php 2012-03-29 01:30:20 UTC (rev 5497) @@ -16,6 +16,7 @@ // 07-14-2009, Added LAN to LAN support // 08-23-2009, Added TCP/UDP protocol // 10-14-2010, Added IPv6 support +// 03-28-2012, Added NAT EXT support // // System location of /mnt/kd/rc.conf.d directory $FIREWALLCONFDIR = '/mnt/kd/rc.conf.d'; @@ -69,6 +70,7 @@ '50' => 'ESP', '51' => 'AH', '47' => 'GRE', + '1' => 'ICMP', '58' => 'ICMPv6', '41' => '6to4' ); @@ -129,10 +131,11 @@ break; case 'NAT_EXT_LAN': case 'NAT_EXT_DMZ': + $str = ($data['e_addr'] === '' || $data['e_addr'] === '0/0') ? '' : $data['e_addr'].'#'; if ($is_ip) { - $str = ($data['s_addr'] === '0/0' ? '' : $data['s_addr'].$col).$data['proto'].'>'.$data['d_addr']; + $str .= $data['s_addr'].$col.$data['proto'].'>'.$data['d_addr']; } else { - $str = ($data['s_addr'] === '0/0' ? '' : $data['s_addr'].$col).$data['s_lport']; + $str .= $data['s_addr'].$col.$data['s_lport']; if ($data['s_uport'] !== '') { $str .= ':'.$data['s_uport']; } @@ -239,6 +242,7 @@ if ($db['data'][$i]['comment'] !== '') { $value .= str_replace('~', '-', str_replace('"', "'", stripslashes($db['data'][$i]['comment']))); } + $value .= '~'.$db['data'][$i]['e_addr']; fwrite($fp, $value."\n"); } } @@ -371,6 +375,7 @@ $db['data'][$id]['d_lport'] = $datatokens[7]; $db['data'][$id]['d_uport'] = $datatokens[8]; $db['data'][$id]['comment'] = (isset($datatokens[9]) ? $datatokens[9] : ''); + $db['data'][$id]['e_addr'] = (isset($datatokens[10]) ? $datatokens[10] : ''); $id++; } } @@ -421,6 +426,7 @@ $d_addr = isset($_POST['d_addr']) ? str_replace(' ', '', $_POST['d_addr']) : ''; $d_lport = isset($_POST['d_lport']) ? str_replace(' ', '', $_POST['d_lport']) : ''; $d_uport = isset($_POST['d_uport']) ? str_replace(' ', '', $_POST['d_uport']) : ''; + $e_addr = isset($_POST['e_addr']) ? str_replace(' ', '', $_POST['e_addr']) : ''; $comment = isset($_POST['comment']) ? trim($_POST['comment']) : ''; switch ($action) { @@ -437,6 +443,7 @@ $d_addr = ''; $d_lport = ''; $d_uport = ''; + $e_addr = ''; break; case 'NAT_EXT_LAN': case 'NAT_EXT_DMZ': @@ -446,6 +453,9 @@ if ($s_addr === '' || $d_addr === '' || $d_addr === '0/0') { return(FALSE); } + if ($e_addr === '') { + $e_addr = '0/0'; + } $d_uport = ''; break; case 'PASS_EXT_LAN': @@ -462,6 +472,7 @@ } $s_lport = ''; $s_uport = ''; + $e_addr = ''; break; case 'DENY_LOCAL_EXT': case 'LOG_LOCAL_OUT': @@ -471,6 +482,7 @@ $s_addr = ''; $s_lport = ''; $s_uport = ''; + $e_addr = ''; break; default: return(0); @@ -484,6 +496,7 @@ if (($eid = existFWRule($db, $action, $proto, $s_addr, $s_lport, $s_uport, $d_addr, $d_lport, $d_uport)) !== FALSE) { $db['data'][$eid]['comment'] = $comment; + $db['data'][$eid]['e_addr'] = $e_addr; return(0); } @@ -497,10 +510,11 @@ $db['data'][$id]['d_lport'] = $d_lport; $db['data'][$id]['d_uport'] = $d_uport; $db['data'][$id]['comment'] = $comment; + $db['data'][$id]['e_addr'] = $e_addr; return(TRUE); } - + $TRAFFIC_SHAPER_FILE = NULL; $TRAFFIC_SHAPER_ENABLE = NULL; if (($plugins = getARNOplugins()) !== FALSE) { @@ -617,6 +631,7 @@ //<![CDATA[ function action_change() { var form = document.getElementById("iform"); + var nat_ext = document.getElementById("nat_ext"); switch (form.action.selectedIndex) { case 0: // -- select -- form.s_addr.disabled = 1; @@ -626,6 +641,7 @@ form.d_lport.disabled = 1; form.d_uport.disabled = 1; form.comment.disabled = 1; + nat_ext.style.visibility = "hidden"; break; case 3: // PASS_EXT_LOCAL case 6: // PASS_DMZ_LOCAL @@ -641,6 +657,7 @@ form.d_lport.disabled = 1; form.d_uport.value = ""; form.d_uport.disabled = 1; + nat_ext.style.visibility = "hidden"; break; case 1: // NAT_EXT_LAN case 2: // NAT_EXT_DMZ @@ -652,6 +669,7 @@ form.comment.disabled = 0; form.d_uport.value = ""; form.d_uport.disabled = 1; + nat_ext.style.visibility = "visible"; break; case 4: // PASS_EXT_LAN case 5: // PASS_EXT_DMZ @@ -668,6 +686,7 @@ form.s_lport.disabled = 1; form.s_uport.value = ""; form.s_uport.disabled = 1; + nat_ext.style.visibility = "hidden"; break; case 10: // DENY_LOCAL_EXT case 13: // LOG_LOCAL_OUT @@ -681,6 +700,7 @@ form.s_lport.disabled = 1; form.s_uport.value = ""; form.s_uport.disabled = 1; + nat_ext.style.visibility = "hidden"; break; } switch (form.proto.selectedIndex) { @@ -736,7 +756,12 @@ if (is_null($ldb)) { $ldb['s_addr'] = '0/0'; $ldb['d_addr'] = '0/0'; + $ldb['e_addr'] = '0/0'; $ldb['comment'] = ''; + } else { + if ($ldb['e_addr'] === '') { + $ldb['e_addr'] = '0/0'; + } } putHtml('<table width="100%" class="stdtable">'); putHtml('<tr class="dtrow0"><td> </td></tr>'); @@ -773,7 +798,10 @@ putHtml('Port:<input type="text" size="18" maxlength="64" name="d_lport" value="'.$ldb['d_lport'].'" />'); putHtml('– <input type="text" size="6" maxlength="5" name="d_uport" value="'.$ldb['d_uport'].'" />'); putHtml('</td></tr>'); - putHtml('<tr><td> </td><td colspan="2" class="dialogText" style="text-align: right;">'); + putHtml('<tr><td id="nat_ext" class="dialogText" style="visibility: hidden;">'); + putHtml('NAT EXT:'); + putHtml('<input type="text" size="16" maxlength="18" name="e_addr" value="'.$ldb['e_addr'].'" />'); + putHtml('</td><td colspan="2" class="dialogText" style="text-align: right;">'); putHtml('Comment <i>(optional)</i>:<input type="text" size="64" maxlength="64" name="comment" value="'.htmlspecialchars($ldb['comment']).'" />'); putHtml('</td></tr>'); putHtml('<tr><td colspan="3" class="dialogText" style="text-align: center;">'); @@ -820,6 +848,13 @@ } echo '<td colspan="2"> </td>'; } + if ($db['data'][$i]['e_addr'] !== '' && $db['data'][$i]['e_addr'] !== '0/0') { + putHtml("</tr>"); + echo '<tr ', ($i % 2 == 0) ? 'class="dtrow0"' : 'class="dtrow1"', '>'; + echo '<td> </td>'; + echo '<td colspan="2" class="dialogText" style="font-weight: bold;text-align: right;">NAT EXT:</td>'; + echo '<td colspan="4">', $db['data'][$i]['e_addr'], '</td>'; + } if ($db['data'][$i]['comment'] !== '') { putHtml("</tr>"); echo '<tr ', ($i % 2 == 0) ? 'class="dtrow0"' : 'class="dtrow1"', '>'; Modified: branches/1.0/package/webinterface/altweb/common/version.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/version.php 2012-03-21 19:24:24 UTC (rev 5496) +++ branches/1.0/package/webinterface/altweb/common/version.php 2012-03-29 01:30:20 UTC (rev 5497) @@ -1,6 +1,6 @@ <?php // version.php for AstLinux Alternate Web Interface -$GUI_VERSION = '1.8.07'; +$GUI_VERSION = '1.8.08'; ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2012-04-16 21:18:02
|
Revision: 5516 http://astlinux.svn.sourceforge.net/astlinux/?rev=5516&view=rev Author: abelbeck Date: 2012-04-16 21:17:55 +0000 (Mon, 16 Apr 2012) Log Message: ----------- web interface, add IPsec Mobile XAuth support Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/ipsecmobile.php branches/1.0/package/webinterface/altweb/admin/openvpn.php branches/1.0/package/webinterface/altweb/admin/pptp.php branches/1.0/package/webinterface/altweb/admin/system.php branches/1.0/package/webinterface/altweb/common/openssl-ipsecmobile.php branches/1.0/package/webinterface/altweb/common/version.php Added Paths: ----------- branches/1.0/package/webinterface/altweb/admin/ipsecxauth.php Modified: branches/1.0/package/webinterface/altweb/admin/ipsecmobile.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/ipsecmobile.php 2012-04-16 18:11:21 UTC (rev 5515) +++ branches/1.0/package/webinterface/altweb/admin/ipsecmobile.php 2012-04-16 21:17:55 UTC (rev 5516) @@ -22,13 +22,25 @@ require_once '../common/openssl.php'; +if (is_file($IPSECMCONFFILE)) { + $db = parseRCconf($IPSECMCONFFILE); +} else { + $db = NULL; +} + // Function: ipsecmobile_openssl() // -function ipsecmobile_openssl() { +function ipsecmobile_openssl($keysize, $dnsname) { global $global_prefs; // System location of gui.network.conf file $NETCONFFILE = '/mnt/kd/rc.conf.d/gui.network.conf'; + if ($keysize === '') { + $keysize = '1024'; + } + $opts['keysize'] = (int)$keysize; + $opts['dnsname'] = $dnsname; + if (($countryName = getPREFdef($global_prefs, 'dn_country_name_cmdstr')) === '') { $countryName = 'US'; } @@ -48,8 +60,8 @@ } if (($commonName = getPREFdef($global_prefs, 'dn_common_name_cmdstr')) === '') { if (is_file($NETCONFFILE)) { - $db = parseRCconf($NETCONFFILE); - if (($commonName = getVARdef($db, 'HOSTNAME').'.'.getVARdef($db, 'DOMAIN')) === '') { + $vars = parseRCconf($NETCONFFILE); + if (($commonName = getVARdef($vars, 'HOSTNAME').'.'.getVARdef($vars, 'DOMAIN')) === '') { $commonName = 'pbx.astlinux'; } } else { @@ -59,10 +71,12 @@ if (($email = getPREFdef($global_prefs, 'dn_email_address_cmdstr')) === '') { $email = 'in...@as...'; } - $ssl = ipsecmobileSETUP($countryName, $stateName, $localityName, $orgName, $orgUnit, $commonName, $email); + $ssl = ipsecmobileSETUP($opts, $countryName, $stateName, $localityName, $orgName, $orgUnit, $commonName, $email); return($ssl); } -$openssl = ipsecmobile_openssl(); +$key_size = getVARdef($db, 'IPSECM_CERT_KEYSIZE'); +$dns_name = getVARdef($db, 'IPSECM_CERT_DNSNAME'); +$openssl = ipsecmobile_openssl($key_size, $dns_name); $nat_t_menu = array ( 'off' => 'Disable', @@ -78,6 +92,11 @@ 'debug' => 'Debug' ); +$auth_method_menu = array ( + 'rsasig' => 'Certificate', + 'xauth_rsa_server' => 'XAuth RSA' +); + $p1_cypher_menu = array ( 'aes 128' => 'AES 128', 'aes 192' => 'AES 192', @@ -112,6 +131,11 @@ 'modp1536' => '1536 (5)' ); +$key_size_menu = array ( + '1024' => '1024 Bits', + '2048' => '2048 Bits' +); + // Function: saveIPSECMsettings // function saveIPSECMsettings($conf_dir, $conf_file) { @@ -142,6 +166,9 @@ } fwrite($fp, '"'."\n"); + $value = 'IPSECM_AUTH_METHOD="'.$_POST['auth_method'].'"'; + fwrite($fp, "### Auth Method\n".$value."\n"); + $value = 'IPSECM_P1_CYPHER="'.$_POST['p1_cypher'].'"'; fwrite($fp, "### Phase 1 Encryption\n".$value."\n"); @@ -180,6 +207,12 @@ $value = 'IPSECM_P2_LIFETIME="'.trim($_POST['p2_lifetime']).'"'; fwrite($fp, "### Phase 2 Lifetime\n".$value."\n"); + $value = 'IPSECM_CERT_KEYSIZE="'.$_POST['key_size'].'"'; + fwrite($fp, "### Private Key Size\n".$value."\n"); + + $value = 'IPSECM_CERT_DNSNAME="'.str_replace(' ', '', $_POST['dns_name']).'"'; + fwrite($fp, "### Server Cert DNS Name\n".$value."\n"); + if (opensslIPSECMOBILEis_valid($openssl)) { $value = 'IPSECM_RSA_PATH="'.$openssl['key_dir'].'"'; fwrite($fp, "### Certificate Directory\n".$value."\n"); @@ -223,13 +256,25 @@ } else { $result = 2; } + } elseif (isset($_POST['submit_xauth'])) { + $result = saveIPSECMsettings($IPSECMCONFDIR, $IPSECMCONFFILE); + header('Location: /admin/ipsecxauth.php'); + exit; } elseif (isset($_POST['submit_new_server'])) { $result = 99; if (isset($_POST['confirm_new_server'])) { opensslDELETEkeys($openssl); - if (opensslCREATEselfCert($openssl)) { - if (opensslCREATEserverCert($openssl)) { - $result = 30; + if (is_file($openssl['config'])) { + @unlink($openssl['config']); + } + // Rebuild openssl.cnf template for new CA + $key_size = $_POST['key_size']; + $dns_name = str_replace(' ', '', $_POST['dns_name']); + if (($openssl = ipsecmobile_openssl($key_size, $dns_name)) !== FALSE) { + if (opensslCREATEselfCert($openssl)) { + if (opensslCREATEserverCert($openssl)) { + $result = 30; + } } } saveIPSECMsettings($IPSECMCONFDIR, $IPSECMCONFFILE); @@ -312,12 +357,6 @@ $ACCESS_RIGHTS = 'admin'; require_once '../common/header.php'; - if (is_file($IPSECMCONFFILE)) { - $db = parseRCconf($IPSECMCONFFILE); - } else { - $db = NULL; - } - putHtml("<center>"); if (isset($_GET['result'])) { $result = $_GET['result']; @@ -353,9 +392,24 @@ } putHtml("</center>"); ?> + <script language="JavaScript" type="text/javascript"> + //<![CDATA[ + function auth_method_change() { + var form = document.getElementById("iform"); + switch (form.auth_method.selectedIndex) { + case 0: // Certificate + form.submit_xauth.style.visibility = "hidden"; + break; + case 1: // XAuth RSA + form.submit_xauth.style.visibility = "visible"; + break; + } + } + //]]> + </script> <center> <table class="layout"><tr><td><center> - <form method="post" action="<?php echo $myself;?>"> + <form id="iform" method="post" action="<?php echo $myself;?>"> <table width="100%" class="stdtable"> <tr><td style="text-align: center;" colspan="2"> <h2>IPsec Mobile Server Configuration:</h2> @@ -418,6 +472,22 @@ putHtml('</td></tr>'); putHtml('<tr class="dtrow1"><td style="text-align: right;">'); + putHtml('Auth Method:'); + putHtml('</td><td style="text-align: left;" colspan="2">'); + if (($auth_method = getVARdef($db, 'IPSECM_AUTH_METHOD')) === '') { + $auth_method = 'rsasig'; + } + putHtml('<select name="auth_method" onchange="auth_method_change()">'); + foreach ($auth_method_menu as $key => $value) { + $sel = ($auth_method === $key) ? ' selected="selected"' : ''; + putHtml('<option value="'.$key.'"'.$sel.'>'.$value.'</option>'); + } + putHtml('</select>'); + putHtml('</td><td style="text-align: left;" colspan="3">'); + putHtml('<input type="submit" value="XAuth Configuration" name="submit_xauth" class="button" />'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;">'); putHtml('Encryption:'); putHtml('</td><td style="text-align: left;" colspan="5">'); if (($p1_cypher = getVARdef($db, 'IPSECM_P1_CYPHER')) === '') { @@ -519,6 +589,25 @@ putHtml('<tr class="dtrow0"><td class="dialogText" style="text-align: left;" colspan="6">'); putHtml('<strong>Server Certificate and Key:</strong>'); putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">'); + putHtml('Private Key Size:</td><td style="text-align: left;" colspan="4">'); + if (($key_size = getVARdef($db, 'IPSECM_CERT_KEYSIZE')) === '') { + $key_size = '1024'; + } + putHtml('<select name="key_size">'); + foreach ($key_size_menu as $key => $value) { + $sel = ($key_size === (string)$key) ? ' selected="selected"' : ''; + putHtml('<option value="'.$key.'"'.$sel.'>'.$value.'</option>'); + } + putHtml('</select>'); + putHtml('</td></tr>'); + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">'); + putHtml('Server Cert DNS Name:</td><td style="text-align: left;" colspan="4">'); + $value = getVARdef($db, 'IPSECM_CERT_DNSNAME'); + putHtml('<input type="text" size="24" maxlength="128" value="'.$value.'" name="dns_name" />'); + putHtml('</td></tr>'); + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="3">'); putHtml('Create New Certificate and Key:</td><td class="dialogText" style="text-align: left;" colspan="3">'); putHtml('<input type="submit" value="Create New" name="submit_new_server" />'); @@ -612,6 +701,11 @@ putHtml('</form>'); putHtml('</center></td></tr></table>'); putHtml('</center>'); + putHtml('<script language="JavaScript" type="text/javascript">'); + putHtml('//<![CDATA['); + putHtml('auth_method_change();'); + putHtml('//]]>'); + putHtml('</script>'); } // End of HTTP GET require_once '../common/footer.php'; Added: branches/1.0/package/webinterface/altweb/admin/ipsecxauth.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/ipsecxauth.php (rev 0) +++ branches/1.0/package/webinterface/altweb/admin/ipsecxauth.php 2012-04-16 21:17:55 UTC (rev 5516) @@ -0,0 +1,354 @@ +<?php + +// Copyright (C) 2012 Lonnie Abelbeck +// This is free software, licensed under the GNU General Public License +// version 3 as published by the Free Software Foundation; you can +// redistribute it and/or modify it under the terms of the GNU +// General Public License; and comes with ABSOLUTELY NO WARRANTY. + +// ipsecxauth.php for AstLinux +// 16-04-2012 +// +// System location of /mnt/kd/rc.conf.d directory +$IPSECXAUTHCONFDIR = '/mnt/kd/rc.conf.d'; +// System location of gui.ipsecxauth.conf file +$IPSECXAUTHCONFFILE = '/mnt/kd/rc.conf.d/gui.ipsecxauth.conf'; + +$connections_menu = array ( + '2' => '2 Users', + '4' => '4 Users', + '8' => '8 Users', + '16' => '16 Users', + '32' => '32 Users', + '64' => '64 Users' +); + +$myself = $_SERVER['PHP_SELF']; + +require_once '../common/functions.php'; + +// Function: ipsecGETclients +// +function ipsecGETclients($vars) { + $id = 0; + + if (($line = getVARdef($vars, 'IPSECM_XAUTH_USER_PASS')) !== '') { + $linetokens = explode("\n", $line); + foreach ($linetokens as $data) { + if ($data !== '') { + $datatokens = explode(' ', $data); + $db['data'][$id]['user'] = $datatokens[0]; + $db['data'][$id]['pass'] = $datatokens[1]; + $id++; + } + } + } + // Sort by Username + if ($id > 1) { + foreach ($db['data'] as $key => $row) { + $user[$key] = $row['user']; + } + array_multisort($user, SORT_ASC, SORT_STRING, $db['data']); + } + return($db); +} + +// Function: saveIPSECsettings +// +function saveIPSECsettings($conf_dir, $conf_file, $db, $delete = NULL) { + $result = 11; + + if (! is_dir($conf_dir)) { + return(3); + } + if (($fp = @fopen($conf_file,"wb")) === FALSE) { + return(3); + } + fwrite($fp, "### gui.ipsecxauth.conf - start ###\n###\n"); + + $value = 'IPSECM_XAUTH_USER_PASS="'; + fwrite($fp, "### Authentication\n".$value."\n"); + if (count($db['data']) > 0) { + foreach ($db['data'] as $data) { + if ($data['user'] !== '' && $data['pass'] !== '') { + $skip = FALSE; + if (! is_null($delete)) { + foreach ($delete as $deluser) { + if ($deluser === $data['user']) { + $skip = TRUE; + break; + } + } + } + if (! $skip) { + fwrite($fp, $data['user'].' '.$data['pass']."\n"); + } + } + } + } + fwrite($fp, '"'."\n"); + + $value = 'IPSECM_XAUTH_POOLSIZE="'.$_POST['pool_size'].'"'; + fwrite($fp, "### Pool Size\n".$value."\n"); + + $value = 'IPSECM_XAUTH_POOLBASE="'.trim($_POST['pool_base']).'"'; + fwrite($fp, "### Pool Base\n".$value."\n"); + + $value = 'IPSECM_XAUTH_POOLMASK="'.trim($_POST['pool_mask']).'"'; + fwrite($fp, "### Pool Mask\n".$value."\n"); + + $value = 'IPSECM_XAUTH_DNS="'.trim($_POST['dns']).'"'; + fwrite($fp, "### MS DNS\n".$value."\n"); + + $value = 'IPSECM_XAUTH_WINS="'.trim($_POST['wins']).'"'; + fwrite($fp, "### MS WINS\n".$value."\n"); + + $value = 'IPSECM_XAUTH_NETWORK="'.trim($_POST['network']).'"'; + fwrite($fp, "### Network\n".$value."\n"); + + $value = 'IPSECM_XAUTH_DOMAIN="'.trim($_POST['domain']).'"'; + fwrite($fp, "### Default Domain\n".$value."\n"); + + $value = 'IPSECM_XAUTH_BANNER="'.trim($_POST['banner']).'"'; + fwrite($fp, "### Login Message\n".$value."\n"); + + $value = 'IPSECM_XAUTH_SAVE_PASSWD="'.$_POST['save_passwd'].'"'; + fwrite($fp, "### Save Password\n".$value."\n"); + + fwrite($fp, "### gui.ipsecxauth.conf - end ###\n"); + fclose($fp); + + return($result); +} + +// Function: addUserPass +// +function addUserPass(&$db, $id) { + + $user = str_replace(' ', '', $_POST['user']); + $pass = str_replace(' ', '', stripslashes($_POST['pass'])); + + if ($user === '') { + return(FALSE); + } + if ($pass === '') { + return(1); + } + + $db['data'][$id]['user'] = $user; + $db['data'][$id]['pass'] = $pass; + + return(TRUE); +} + +if (is_file($IPSECXAUTHCONFFILE)) { + $vars = parseRCconf($IPSECXAUTHCONFFILE); +} else { + $vars = NULL; +} +$db = ipsecGETclients($vars); + +if ($_SERVER['REQUEST_METHOD'] === 'POST') { + $result = 1; + if (! $global_admin) { + $result = 999; + } elseif (isset($_POST['submit_save']) || isset($_POST['submit_ipsec_config'])) { + $n = count($db['data']); + $id = $n; + for ($i = 0; $i < $n; $i++) { + if ($db['data'][$i]['user'] === str_replace(' ', '', $_POST['user'])) { + $id = $i; + break; + } + } + $ok = addUserPass($db, $id); + $result = saveIPSECsettings($IPSECXAUTHCONFDIR, $IPSECXAUTHCONFFILE, $db); + if ($result == 11 && $ok === 1) { + $result = 12; + } + if (isset($_POST['submit_ipsec_config'])) { + header('Location: /admin/ipsecmobile.php'); + exit; + } + } elseif (isset($_POST['submit_delete'])) { + $delete = $_POST['delete']; + if (count($delete) > 0) { + $result = saveIPSECsettings($IPSECXAUTHCONFDIR, $IPSECXAUTHCONFFILE, $db, $delete); + } + } + header('Location: '.$myself.'?result='.$result); + exit; +} else { // Start of HTTP GET +$ACCESS_RIGHTS = 'admin'; +require_once '../common/header.php'; + + putHtml('<center>'); + if (isset($_GET['result'])) { + $result = $_GET['result']; + if ($result == 2) { + putHtml('<p style="color: red;">No Action, check "Confirm" for this action.</p>'); + } elseif ($result == 3) { + putHtml('<p style="color: red;">Error creating file.</p>'); + } elseif ($result == 11) { + putHtml('<p style="color: green;">Settings saved, click "IPsec Configuration" to return to previous screen.</p>'); + } elseif ($result == 12) { + putHtml('<p style="color: red;">Missing Password, User not added.</p>'); + } elseif ($result == 99) { + putHtml('<p style="color: red;">Action Failed.</p>'); + } elseif ($result == 999) { + putHtml('<p style="color: red;">Permission denied for user "'.$global_user.'".</p>'); + } else { + putHtml('<p style="color: orange;">No Action.</p>'); + } + } else { + putHtml('<p> </p>'); + } + putHtml('</center>'); +?> + <center> + <table class="layout"><tr><td><center> + <form method="post" action="<?php echo $myself;?>"> + <table width="100%" class="stdtable"> + <tr><td style="text-align: center;" colspan="3"> + <h2>IPsec XAuth Configuration:</h2> + </td></tr><tr><td style="text-align: center;"> + <input type="submit" class="formbtn" value="Save Settings" name="submit_save" /> + </td><td style="text-align: center;"> + <input type="submit" value="IPsec Configuration" name="submit_ipsec_config" class="button" /> + </td><td style="text-align: center;"> + <input type="submit" class="formbtn" value="Delete Checked" name="submit_delete" /> + </td></tr></table> +<?php + + if (isset($_GET['id'])) { + $id = $_GET['id']; + $n = count($db['data']); + for ($i = 0; $i < $n; $i++) { + if ($id === $db['data'][$i]['user']) { + $ldb = $db['data'][$i]; + break; + } + } + } + if (is_null($ldb)) { + $ldb['user'] = ''; + $ldb['pass'] = ''; + } + + putHtml('<table width="100%" class="stdtable">'); + putHtml('<tr class="dtrow0"><td width="180"> </td><td> </td></tr>'); + putHtml('<tr class="dtrow0"><td class="dialogText" style="text-align: left;" colspan="2">'); + putHtml('<strong>XAuth Client Options:</strong>'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;">'); + putHtml('Max. Connections:'); + putHtml('</td><td style="text-align: left;">'); + if (($pool_size = getVARdef($vars, 'IPSECM_XAUTH_POOLSIZE')) === '') { + $pool_size = '8'; + } + putHtml('<select name="pool_size">'); + foreach ($connections_menu as $key => $value) { + $sel = ($pool_size === (string)$key) ? ' selected="selected"' : ''; + putHtml('<option value="'.$key.'"'.$sel.'>'.$value.'</option>'); + } + putHtml('</select>'); + putHtml('</td></tr>'); + putHtml('<tr class="dtrow1"><td style="text-align: right;">'); + putHtml('Remote IPv4 Base:'); + putHtml('</td><td style="text-align: left;">'); + if (($value = getVARdef($vars, 'IPSECM_XAUTH_POOLBASE')) === '') { + $value = '10.9.1.1'; + } + putHtml('<input type="text" size="36" maxlength="64" name="pool_base" value="'.$value.'" />'); + putHtml('</td></tr>'); + putHtml('<tr class="dtrow1"><td style="text-align: right;">'); + putHtml('Remote IPv4 Mask:'); + putHtml('</td><td style="text-align: left;">'); + if (($value = getVARdef($vars, 'IPSECM_XAUTH_POOLMASK')) === '') { + $value = '255.255.255.0'; + } + putHtml('<input type="text" size="36" maxlength="64" name="pool_mask" value="'.$value.'" />'); + putHtml('</td></tr>'); + putHtml('<tr class="dtrow1"><td style="text-align: right;">'); + putHtml('DNS Default Domain:'); + putHtml('</td><td style="text-align: left;">'); + $value = getVARdef($vars, 'IPSECM_XAUTH_DOMAIN'); + putHtml('<input type="text" size="36" maxlength="128" name="domain" value="'.$value.'" />'); + putHtml('</td></tr>'); + putHtml('<tr class="dtrow1"><td style="text-align: right;">'); + putHtml('DNS:'); + putHtml('</td><td style="text-align: left;">'); + $value = getVARdef($vars, 'IPSECM_XAUTH_DNS'); + putHtml('<input type="text" size="56" maxlength="128" name="dns" value="'.$value.'" />'); + putHtml('</td></tr>'); + putHtml('<tr class="dtrow1"><td style="text-align: right;">'); + putHtml('WINS:'); + putHtml('</td><td style="text-align: left;">'); + $value = getVARdef($vars, 'IPSECM_XAUTH_WINS'); + putHtml('<input type="text" size="56" maxlength="128" name="wins" value="'.$value.'" />'); + putHtml('</td></tr>'); + putHtml('<tr class="dtrow1"><td style="text-align: right;">'); + putHtml('Push Network(s):'); + putHtml('</td><td style="text-align: left;">'); + $value = getVARdef($vars, 'IPSECM_XAUTH_NETWORK'); + putHtml('<input type="text" size="56" maxlength="128" name="network" value="'.$value.'" />'); + putHtml('</td></tr>'); + putHtml('<tr class="dtrow1"><td style="text-align: right;">'); + putHtml('Connect Message:'); + putHtml('</td><td style="text-align: left;">'); + $value = getVARdef($vars, 'IPSECM_XAUTH_BANNER'); + putHtml('<input type="text" size="56" maxlength="200" name="banner" value="'.$value.'" />'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;">'); + putHtml('Save Remote Password:'); + putHtml('</td><td style="text-align: left;">'); + putHtml('<select name="save_passwd">'); + $value = getVARdef($vars, 'IPSECM_XAUTH_SAVE_PASSWD'); + $sel = ($value === 'no') ? ' selected="selected"' : ''; + putHtml('<option value="no"'.$sel.'>No</option>'); + $sel = ($value === 'yes') ? ' selected="selected"' : ''; + putHtml('<option value="yes"'.$sel.'>Yes</option>'); + putHtml('</select>'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow0"><td class="dialogText" style="text-align: left;" colspan="2">'); + putHtml('<strong>Client Credentials:</strong>'); + putHtml('</td></tr>'); + putHtml('<tr><td style="text-align: right;">'); + putHtml('Username:'); + putHtml('</td><td style="text-align: left;">'); + putHtml('<input type="text" size="36" maxlength="64" name="user" value="'.$ldb['user'].'" />'); + putHtml('</td></tr>'); + putHtml('<tr><td style="text-align: right;">'); + putHtml('Password:'); + putHtml('</td><td style="text-align: left;">'); + putHtml('<input type="password" size="36" maxlength="128" name="pass" value="'.$ldb['pass'].'" />'); + putHtml('</td></tr>'); + putHtml('</table>'); + + putHtml('<table width="66%" class="datatable">'); + putHtml("<tr>"); + + if (($n = count($db['data'])) > 0) { + echo '<td class="dialogText" style="text-align: left; font-weight: bold;">', "Users", "</td>"; + echo '<td class="dialogText" style="text-align: center; font-weight: bold;">', "Delete", "</td>"; + for ($i = 0; $i < $n; $i++) { + putHtml("</tr>"); + echo '<tr ', ($i % 2 == 0) ? 'class="dtrow0"' : 'class="dtrow1"', '>'; + echo '<td><a href="'.$myself.'?id='.$db['data'][$i]['user'].'" class="actionText">'.$db['data'][$i]['user'].'</a>', '</td>'; + echo '<td style="text-align: center;">', '<input type="checkbox" name="delete[]" value="', $db['data'][$i]['user'], '" />', '</td>'; + } + } else { + echo '<td style="color: orange; text-align: center;">No Client Credentials.', '</td>'; + } + putHtml("</tr>"); + putHtml("</table>"); + putHtml("</form>"); + putHtml("</center></td></tr></table>"); + putHtml("</center>"); +} // End of HTTP GET +require_once '../common/footer.php'; + +?> Property changes on: branches/1.0/package/webinterface/altweb/admin/ipsecxauth.php ___________________________________________________________________ Added: svn:executable + * Modified: branches/1.0/package/webinterface/altweb/admin/openvpn.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/openvpn.php 2012-04-16 18:11:21 UTC (rev 5515) +++ branches/1.0/package/webinterface/altweb/admin/openvpn.php 2012-04-16 21:17:55 UTC (rev 5516) @@ -226,10 +226,16 @@ $result = 99; if (isset($_POST['confirm_new_server'])) { opensslDELETEkeys($openssl); - if (opensslCREATEselfCert($openssl)) { - if (opensslCREATEserverCert($openssl)) { - if (opensslCREATEdh_pem($openssl)) { - $result = 30; + if (is_file($openssl['config'])) { + @unlink($openssl['config']); + } + // Rebuild openssl.cnf template for new CA + if (($openssl = openvpn_openssl()) !== FALSE) { + if (opensslCREATEselfCert($openssl)) { + if (opensslCREATEserverCert($openssl)) { + if (opensslCREATEdh_pem($openssl)) { + $result = 30; + } } } } Modified: branches/1.0/package/webinterface/altweb/admin/pptp.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/pptp.php 2012-04-16 18:11:21 UTC (rev 5515) +++ branches/1.0/package/webinterface/altweb/admin/pptp.php 2012-04-16 21:17:55 UTC (rev 5516) @@ -107,20 +107,22 @@ $value = 'PPTP_USER_PASS="'; fwrite($fp, "### Authentication\n".$value."\n"); - foreach ($db['data'] as $data) { - if ($data['user'] !== '' && $data['pass'] !== '') { - $skip = FALSE; - if (! is_null($delete)) { - foreach ($delete as $deluser) { - if ($deluser === $data['user']) { - $skip = TRUE; - break; + if (count($db['data']) > 0) { + foreach ($db['data'] as $data) { + if ($data['user'] !== '' && $data['pass'] !== '') { + $skip = FALSE; + if (! is_null($delete)) { + foreach ($delete as $deluser) { + if ($deluser === $data['user']) { + $skip = TRUE; + break; + } } } + if (! $skip) { + fwrite($fp, $data['user'].' '.$data['pass']."\n"); + } } - if (! $skip) { - fwrite($fp, $data['user'].' '.$data['pass']."\n"); - } } } fwrite($fp, '"'."\n"); Modified: branches/1.0/package/webinterface/altweb/admin/system.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/system.php 2012-04-16 18:11:21 UTC (rev 5515) +++ branches/1.0/package/webinterface/altweb/admin/system.php 2012-04-16 21:17:55 UTC (rev 5516) @@ -767,6 +767,7 @@ $var === 'GUI_FIREWALL_RULES' || $var === 'STATICHOSTS' || $var === 'PPTP_USER_PASS' || + $var === 'IPSECM_XAUTH_USER_PASS' || $var === 'IPSEC_PSK_ASSOCIATIONS') { $value = '********'; } elseif (strlen($value) > 56) { Modified: branches/1.0/package/webinterface/altweb/common/openssl-ipsecmobile.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/openssl-ipsecmobile.php 2012-04-16 18:11:21 UTC (rev 5515) +++ branches/1.0/package/webinterface/altweb/common/openssl-ipsecmobile.php 2012-04-16 21:17:55 UTC (rev 5516) @@ -12,7 +12,7 @@ // Function: ipsecmobileSETUP() // -function ipsecmobileSETUP($countryName, $stateName, $localityName, $orgName, $orgUnit, $commonName, $email) { +function ipsecmobileSETUP($opts, $countryName, $stateName, $localityName, $orgName, $orgUnit, $commonName, $email) { // System location of OpenSSL default configuration file $OPENSSL_CNF = '/usr/lib/ssl/openssl.cnf'; @@ -30,6 +30,7 @@ '', '[ ipsecmobile_server ]', 'basicConstraints=CA:FALSE', + ($opts['dnsname'] !== '' ? 'subjectAltName=DNS:'.$opts['dnsname'] : '#subjectAltName=DNS:vpn.astlinux.org'), 'nsCertType=server', 'nsComment="IPsec Mobile Server Certificate"', 'subjectKeyIdentifier=hash', @@ -41,27 +42,27 @@ $ssl['configArgs'] = array( 'config' => $ssl['config'], 'digest_alg' => 'sha1', - 'private_key_bits' => 1024, + 'private_key_bits' => $opts['keysize'], 'encrypt_key' => FALSE ); $ssl['sign_ca'] = array( 'config' => $ssl['config'], 'digest_alg' => 'sha1', - 'private_key_bits' => 1024, + 'private_key_bits' => $opts['keysize'], 'x509_extensions' => 'v3_ca', 'encrypt_key' => FALSE ); $ssl['sign_server'] = array( 'config' => $ssl['config'], 'digest_alg' => 'sha1', - 'private_key_bits' => 1024, + 'private_key_bits' => $opts['keysize'], 'x509_extensions' => 'ipsecmobile_server', 'encrypt_key' => FALSE ); $ssl['sign_client'] = array( 'config' => $ssl['config'], 'digest_alg' => 'sha1', - 'private_key_bits' => 1024, + 'private_key_bits' => $opts['keysize'], 'x509_extensions' => 'usr_cert', 'encrypt_key' => FALSE ); Modified: branches/1.0/package/webinterface/altweb/common/version.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/version.php 2012-04-16 18:11:21 UTC (rev 5515) +++ branches/1.0/package/webinterface/altweb/common/version.php 2012-04-16 21:17:55 UTC (rev 5516) @@ -1,6 +1,6 @@ <?php // version.php for AstLinux Alternate Web Interface -$GUI_VERSION = '1.8.08'; +$GUI_VERSION = '1.8.09'; ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2012-04-30 22:27:05
|
Revision: 5523 http://astlinux.svn.sourceforge.net/astlinux/?rev=5523&view=rev Author: abelbeck Date: 2012-04-30 21:14:41 +0000 (Mon, 30 Apr 2012) Log Message: ----------- web interface, Network tab, add 'pairNIC' dynamic DNS service type Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/network.php branches/1.0/package/webinterface/altweb/common/version.php Modified: branches/1.0/package/webinterface/altweb/admin/network.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/network.php 2012-04-30 20:56:51 UTC (rev 5522) +++ branches/1.0/package/webinterface/altweb/admin/network.php 2012-04-30 21:14:41 UTC (rev 5523) @@ -69,7 +69,8 @@ 'DynDNS [custom]' => 'cu...@dy...', 'No-IP' => 'de...@no...', 'FreeDNS' => 'de...@fr...', - 'DNS-O-Matic' => 'de...@dn...' + 'DNS-O-Matic' => 'de...@dn...', + 'pairNIC' => 'de...@pa...' ); $select_dyndns_getip = array ( Modified: branches/1.0/package/webinterface/altweb/common/version.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/version.php 2012-04-30 20:56:51 UTC (rev 5522) +++ branches/1.0/package/webinterface/altweb/common/version.php 2012-04-30 21:14:41 UTC (rev 5523) @@ -1,6 +1,6 @@ <?php // version.php for AstLinux Alternate Web Interface -$GUI_VERSION = '1.8.09'; +$GUI_VERSION = '1.8.10'; ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2012-05-07 00:46:08
|
Revision: 5536 http://astlinux.svn.sourceforge.net/astlinux/?rev=5536&view=rev Author: abelbeck Date: 2012-05-07 00:46:01 +0000 (Mon, 07 May 2012) Log Message: ----------- web interface, add openvpn user/pass auth option Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/openvpn.php branches/1.0/package/webinterface/altweb/admin/system.php branches/1.0/package/webinterface/altweb/common/version.php Added Paths: ----------- branches/1.0/package/webinterface/altweb/admin/openvpnuserpass.php Modified: branches/1.0/package/webinterface/altweb/admin/openvpn.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/openvpn.php 2012-05-06 21:47:45 UTC (rev 5535) +++ branches/1.0/package/webinterface/altweb/admin/openvpn.php 2012-05-07 00:46:01 UTC (rev 5536) @@ -82,6 +82,11 @@ '0' => 'None' ); +$auth_method_menu = array ( + 'no' => 'Certificate', + 'yes' => 'Cert. + User/Pass' +); + // Function: saveOVPNsettings // function saveOVPNsettings($conf_dir, $conf_file, $disabled = NULL) { @@ -97,6 +102,9 @@ } fwrite($fp, "### gui.openvpn.conf - start ###\n###\n"); + $value = 'OVPN_USER_PASS_VERIFY="'.$_POST['auth_method'].'"'; + fwrite($fp, "### Auth Method\n".$value."\n"); + $value = 'OVPN_DEV="'.$_POST['device'].'"'; fwrite($fp, "### Device\n".$value."\n"); @@ -222,6 +230,11 @@ } else { $result = 2; } + } elseif (isset($_POST['submit_user_pass'])) { + $disabled = isset($_POST['disabled']) ? $_POST['disabled'] : NULL; + $result = saveOVPNsettings($OVPNCONFDIR, $OVPNCONFFILE, $disabled); + header('Location: /admin/openvpnuserpass.php'); + exit; } elseif (isset($_POST['submit_new_server'])) { $result = 99; if (isset($_POST['confirm_new_server'])) { @@ -361,9 +374,24 @@ } putHtml("</center>"); ?> + <script language="JavaScript" type="text/javascript"> + //<![CDATA[ + function auth_method_change() { + var form = document.getElementById("iform"); + switch (form.auth_method.selectedIndex) { + case 0: // Certificate + form.submit_user_pass.style.visibility = "hidden"; + break; + case 1: // Cert. + User/Pass + form.submit_user_pass.style.visibility = "visible"; + break; + } + } + //]]> + </script> <center> <table class="layout"><tr><td><center> - <form method="post" action="<?php echo $myself;?>"> + <form id="iform" method="post" action="<?php echo $myself;?>"> <table width="100%" class="stdtable"> <tr><td style="text-align: center;" colspan="2"> <h2>OpenVPN Server Configuration:</h2> @@ -380,7 +408,24 @@ putHtml('<tr class="dtrow0"><td class="dialogText" style="text-align: left;" colspan="6">'); putHtml('<strong>Tunnel Options:</strong>'); putHtml('</td></tr>'); + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">'); + putHtml('Auth Method:'); + putHtml('</td><td style="text-align: left;" colspan="2">'); + if (($auth_method = getVARdef($db, 'OVPN_USER_PASS_VERIFY')) === '') { + $auth_method = 'no'; + } + putHtml('<select name="auth_method" onchange="auth_method_change()">'); + foreach ($auth_method_menu as $key => $value) { + $sel = ($auth_method === $key) ? ' selected="selected"' : ''; + putHtml('<option value="'.$key.'"'.$sel.'>'.$value.'</option>'); + } + putHtml('</select>'); + putHtml('</td><td style="text-align: left;" colspan="2">'); + putHtml('<input type="submit" value="User/Pass" name="submit_user_pass" class="button" />'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">'); putHtml('Protocol:'); putHtml('</td><td style="text-align: left;" colspan="1">'); putHtml('<select name="protocol">'); @@ -602,6 +647,11 @@ putHtml('</form>'); putHtml('</center></td></tr></table>'); putHtml('</center>'); + putHtml('<script language="JavaScript" type="text/javascript">'); + putHtml('//<![CDATA['); + putHtml('auth_method_change();'); + putHtml('//]]>'); + putHtml('</script>'); } // End of HTTP GET require_once '../common/footer.php'; Added: branches/1.0/package/webinterface/altweb/admin/openvpnuserpass.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/openvpnuserpass.php (rev 0) +++ branches/1.0/package/webinterface/altweb/admin/openvpnuserpass.php 2012-05-07 00:46:01 UTC (rev 5536) @@ -0,0 +1,245 @@ +<?php + +// Copyright (C) 2012 Lonnie Abelbeck +// This is free software, licensed under the GNU General Public License +// version 3 as published by the Free Software Foundation; you can +// redistribute it and/or modify it under the terms of the GNU +// General Public License; and comes with ABSOLUTELY NO WARRANTY. + +// openvpnuserpass.php for AstLinux +// 06-05-2012 +// +// System location of /mnt/kd/rc.conf.d directory +$OPENVPNUSERPASSCONFDIR = '/mnt/kd/rc.conf.d'; +// System location of gui.openvpnuserpass.conf file +$OPENVPNUSERPASSCONFFILE = '/mnt/kd/rc.conf.d/gui.openvpnuserpass.conf'; + +$myself = $_SERVER['PHP_SELF']; + +require_once '../common/functions.php'; + +// Function: openvpnGETclients +// +function openvpnGETclients($vars) { + $id = 0; + + if (($line = getVARdef($vars, 'OVPN_USER_PASS')) !== '') { + $linetokens = explode("\n", $line); + foreach ($linetokens as $data) { + if ($data !== '') { + $datatokens = explode(' ', $data); + $db['data'][$id]['user'] = $datatokens[0]; + $db['data'][$id]['pass'] = $datatokens[1]; + $id++; + } + } + } + // Sort by Username + if ($id > 1) { + foreach ($db['data'] as $key => $row) { + $user[$key] = $row['user']; + } + array_multisort($user, SORT_ASC, SORT_STRING, $db['data']); + } + return($db); +} + +// Function: saveOPENVPNsettings +// +function saveOPENVPNsettings($conf_dir, $conf_file, $db, $delete = NULL) { + $result = 11; + + if (! is_dir($conf_dir)) { + return(3); + } + if (($fp = @fopen($conf_file,"wb")) === FALSE) { + return(3); + } + fwrite($fp, "### gui.openvpnuserpass.conf - start ###\n###\n"); + + $value = 'OVPN_USER_PASS="'; + fwrite($fp, "### Authentication\n".$value."\n"); + if (count($db['data']) > 0) { + foreach ($db['data'] as $data) { + if ($data['user'] !== '' && $data['pass'] !== '') { + $skip = FALSE; + if (! is_null($delete)) { + foreach ($delete as $deluser) { + if ($deluser === $data['user']) { + $skip = TRUE; + break; + } + } + } + if (! $skip) { + fwrite($fp, $data['user'].' '.$data['pass']."\n"); + } + } + } + } + fwrite($fp, '"'."\n"); + + fwrite($fp, "### gui.openvpnuserpass.conf - end ###\n"); + fclose($fp); + + return($result); +} + +// Function: addUserPass +// +function addUserPass(&$db, $id) { + + $user = str_replace(' ', '', $_POST['user']); + $pass = str_replace(' ', '', stripslashes($_POST['pass'])); + + if ($user === '') { + return(FALSE); + } + if ($pass === '') { + return(1); + } + + $db['data'][$id]['user'] = $user; + $db['data'][$id]['pass'] = $pass; + + return(TRUE); +} + +if (is_file($OPENVPNUSERPASSCONFFILE)) { + $vars = parseRCconf($OPENVPNUSERPASSCONFFILE); +} else { + $vars = NULL; +} +$db = openvpnGETclients($vars); + +if ($_SERVER['REQUEST_METHOD'] === 'POST') { + $result = 1; + if (! $global_admin) { + $result = 999; + } elseif (isset($_POST['submit_save']) || isset($_POST['submit_openvpn_config'])) { + $n = count($db['data']); + $id = $n; + for ($i = 0; $i < $n; $i++) { + if ($db['data'][$i]['user'] === str_replace(' ', '', $_POST['user'])) { + $id = $i; + break; + } + } + $ok = addUserPass($db, $id); + $result = saveOPENVPNsettings($OPENVPNUSERPASSCONFDIR, $OPENVPNUSERPASSCONFFILE, $db); + if ($result == 11 && $ok === 1) { + $result = 12; + } + if (isset($_POST['submit_openvpn_config'])) { + header('Location: /admin/openvpn.php'); + exit; + } + } elseif (isset($_POST['submit_delete'])) { + $delete = $_POST['delete']; + if (count($delete) > 0) { + $result = saveOPENVPNsettings($OPENVPNUSERPASSCONFDIR, $OPENVPNUSERPASSCONFFILE, $db, $delete); + } + } + header('Location: '.$myself.'?result='.$result); + exit; +} else { // Start of HTTP GET +$ACCESS_RIGHTS = 'admin'; +require_once '../common/header.php'; + + putHtml('<center>'); + if (isset($_GET['result'])) { + $result = $_GET['result']; + if ($result == 2) { + putHtml('<p style="color: red;">No Action, check "Confirm" for this action.</p>'); + } elseif ($result == 3) { + putHtml('<p style="color: red;">Error creating file.</p>'); + } elseif ($result == 11) { + putHtml('<p style="color: green;">Settings saved, click "OpenVPN Configuration" to return to previous screen.</p>'); + } elseif ($result == 12) { + putHtml('<p style="color: red;">Missing Password, User not added.</p>'); + } elseif ($result == 99) { + putHtml('<p style="color: red;">Action Failed.</p>'); + } elseif ($result == 999) { + putHtml('<p style="color: red;">Permission denied for user "'.$global_user.'".</p>'); + } else { + putHtml('<p style="color: orange;">No Action.</p>'); + } + } else { + putHtml('<p> </p>'); + } + putHtml('</center>'); +?> + <center> + <table class="layout"><tr><td><center> + <form method="post" action="<?php echo $myself;?>"> + <table width="100%" class="stdtable"> + <tr><td style="text-align: center;" colspan="5"> + <h2>OpenVPN Server User/Pass:</h2> + </td></tr><tr><td style="text-align: center;"> + <input type="submit" class="formbtn" value="Save Settings" name="submit_save" /> + </td><td width="30"> + </td><td style="text-align: center;"> + <input type="submit" value="OpenVPN Configuration" name="submit_openvpn_config" class="button" /> + </td><td width="30"> + </td><td style="text-align: center;"> + <input type="submit" class="formbtn" value="Delete Checked" name="submit_delete" /> + </td></tr></table> +<?php + + if (isset($_GET['id'])) { + $id = $_GET['id']; + $n = count($db['data']); + for ($i = 0; $i < $n; $i++) { + if ($id === $db['data'][$i]['user']) { + $ldb = $db['data'][$i]; + break; + } + } + } + if (is_null($ldb)) { + $ldb['user'] = ''; + $ldb['pass'] = ''; + } + + putHtml('<table width="100%" class="stdtable">'); + putHtml('<tr class="dtrow0"><td width="160"> </td><td> </td></tr>'); + + putHtml('<tr class="dtrow0"><td class="dialogText" style="text-align: left;" colspan="2">'); + putHtml('<strong>Client Credentials:</strong>'); + putHtml('</td></tr>'); + putHtml('<tr><td style="text-align: right;">'); + putHtml('Username:'); + putHtml('</td><td style="text-align: left;">'); + putHtml('<input type="text" size="36" maxlength="64" name="user" value="'.$ldb['user'].'" />'); + putHtml('</td></tr>'); + putHtml('<tr><td style="text-align: right;">'); + putHtml('Password:'); + putHtml('</td><td style="text-align: left;">'); + putHtml('<input type="password" size="36" maxlength="128" name="pass" value="'.$ldb['pass'].'" />'); + putHtml('</td></tr>'); + putHtml('</table>'); + + putHtml('<table width="66%" class="datatable">'); + putHtml("<tr>"); + + if (($n = count($db['data'])) > 0) { + echo '<td class="dialogText" style="text-align: left; font-weight: bold;">', "Users", "</td>"; + echo '<td class="dialogText" style="text-align: center; font-weight: bold;">', "Delete", "</td>"; + for ($i = 0; $i < $n; $i++) { + putHtml("</tr>"); + echo '<tr ', ($i % 2 == 0) ? 'class="dtrow0"' : 'class="dtrow1"', '>'; + echo '<td><a href="'.$myself.'?id='.$db['data'][$i]['user'].'" class="actionText">'.$db['data'][$i]['user'].'</a>', '</td>'; + echo '<td style="text-align: center;">', '<input type="checkbox" name="delete[]" value="', $db['data'][$i]['user'], '" />', '</td>'; + } + } else { + echo '<td style="color: orange; text-align: center;">No Client Credentials.', '</td>'; + } + putHtml("</tr>"); + putHtml("</table>"); + putHtml("</form>"); + putHtml("</center></td></tr></table>"); + putHtml("</center>"); +} // End of HTTP GET +require_once '../common/footer.php'; + +?> Property changes on: branches/1.0/package/webinterface/altweb/admin/openvpnuserpass.php ___________________________________________________________________ Added: svn:executable + * Modified: branches/1.0/package/webinterface/altweb/admin/system.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/system.php 2012-05-06 21:47:45 UTC (rev 5535) +++ branches/1.0/package/webinterface/altweb/admin/system.php 2012-05-07 00:46:01 UTC (rev 5536) @@ -767,6 +767,7 @@ $var === 'GUI_FIREWALL_RULES' || $var === 'STATICHOSTS' || $var === 'PPTP_USER_PASS' || + $var === 'OVPN_USER_PASS' || $var === 'IPSECM_XAUTH_USER_PASS' || $var === 'IPSEC_PSK_ASSOCIATIONS') { $value = '********'; Modified: branches/1.0/package/webinterface/altweb/common/version.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/version.php 2012-05-06 21:47:45 UTC (rev 5535) +++ branches/1.0/package/webinterface/altweb/common/version.php 2012-05-07 00:46:01 UTC (rev 5536) @@ -1,6 +1,6 @@ <?php // version.php for AstLinux Alternate Web Interface -$GUI_VERSION = '1.8.10'; +$GUI_VERSION = '1.8.11'; ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2012-05-21 22:39:43
|
Revision: 5544 http://astlinux.svn.sourceforge.net/astlinux/?rev=5544&view=rev Author: abelbeck Date: 2012-05-21 22:39:36 +0000 (Mon, 21 May 2012) Log Message: ----------- web interface, add new MeetMe tab to manage Conferences, special thanks to James Babiak for the blueprint Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/prefs.php branches/1.0/package/webinterface/altweb/common/header.php branches/1.0/package/webinterface/altweb/common/version.php Added Paths: ----------- branches/1.0/package/webinterface/altweb/admin/meetme.php Added: branches/1.0/package/webinterface/altweb/admin/meetme.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/meetme.php (rev 0) +++ branches/1.0/package/webinterface/altweb/admin/meetme.php 2012-05-21 22:39:36 UTC (rev 5544) @@ -0,0 +1,426 @@ +<?php + +// Copyright (C) 2012 Lonnie Abelbeck +// This is free software, licensed under the GNU General Public License +// version 3 as published by the Free Software Foundation; you can +// redistribute it and/or modify it under the terms of the GNU +// General Public License; and comes with ABSOLUTELY NO WARRANTY. + +// Inspired by: +// AstLinux Conference Manager v1.0 +// -James Babiak + +// meetme.php for AstLinux +// 05-16-2012 +// + +$myself = $_SERVER['PHP_SELF']; + +require_once '../common/functions.php'; + +$isASTERISKv1_4 = isASTERISKv1_4(); + +// Function: getASTERISKversion +// +function getASTERISKversion() { + + $list = explode(' ', trim(shell_exec('/usr/sbin/asterisk -V'))); + return($list[1]); +} + +// Function: isASTERISKv1_4 +// +function isASTERISKv1_4() { + + $list = explode('.', getASTERISKversion()); + if ($list[0] === '1' && $list[1] === '4') { + return(TRUE); + } + return(FALSE); +} + +// Function: isTALKING +// +function isTALKING($option) { + + $str = 'No'; + if ($option > 0) { + $str = 'Yes'; + } elseif ($option < 0) { + $str = ''; + } + return($str); +} + +// Function: getCommentURL +// +function getCommentURL($comment) { + + $str = ''; + if (! is_null($comment)) { + if ($comment !== '') { + $str = '&comment='.rawurlencode($comment); + } + } + return($str); +} + +// Function: userRedirect +// +function userRedirect($chan, $path) { + + $list = explode(',', $path); + + $cont = isset($list[0]) ? $list[0] : 'default'; + $ext = isset($list[1]) ? $list[1] : 's'; + $prio = isset($list[2]) ? $list[2] : '1'; + + if (($socket = @fsockopen('127.0.0.1', '5038', $errno, $errstr, 5)) === FALSE) { + return(FALSE); + } + fputs($socket, "Action: login\r\n"); + fputs($socket, "Username: webinterface\r\n"); + fputs($socket, "Secret: webinterface\r\n"); + fputs($socket, "Events: off\r\n\r\n"); + + fputs($socket, "Action: redirect\r\n"); + fputs($socket, "Context: $cont\r\n"); + fputs($socket, "Channel: $chan\r\n"); + fputs($socket, "Exten: $ext\r\n"); + fputs($socket, "Priority: $prio\r\n\r\n"); + + fputs($socket, "Action: logoff\r\n\r\n"); + + stream_set_timeout($socket, 5); + $info = stream_get_meta_data($socket); + while (! feof($socket) && ! $info['timed_out']) { + $line = fgets($socket, 256); + $info = stream_get_meta_data($socket); + if (strncasecmp($line, 'Response: Error', 15) == 0) { + while (! feof($socket) && ! $info['timed_out']) { + fgets($socket, 256); + $info = stream_get_meta_data($socket); + } + fclose($socket); + return(FALSE); + } + if (strncasecmp($line, 'Message: Redirect successful', 28) == 0) { + break; + } + } + while (! feof($socket) && ! $info['timed_out']) { + fgets($socket, 256); + $info = stream_get_meta_data($socket); + } + fclose($socket); + + sleep(1); + return(0); +} + +// Function: userMute +// +function userMute($user, $mute) { + + if (strpos($user, ',') === FALSE) { + return(FALSE); + } + $ips = explode(',', $user); + $status = asteriskCMD('meetme '.$mute.' '.$ips[0].' '.$ips[1], ''); + if ($status != 0) { + return(FALSE); + } + return(0); +} + +// Function: userKick +// +function userKick($user) { + + if (strpos($user, ',') === FALSE) { + return(FALSE); + } + $ips = explode(',', $user); + $status = asteriskCMD('meetme kick '.$ips[0].' '.$ips[1], ''); + if ($status != 0) { + return(FALSE); + } + + sleep(5); + return(0); +} + +// Function: confLock +// +function confLock($conf, $lock) { + + $status = asteriskCMD('meetme '.$lock.' '.$conf, ''); + if ($status != 0) { + return(FALSE); + } + return(0); +} + +// Function: getMEETMErooms +// +function getMEETMErooms() { + global $isASTERISKv1_4; + $id = 0; + $cmd = $isASTERISKv1_4 ? 'meetme' : 'meetme list concise'; + + $tmpfile = tempnam("/tmp", "PHP_"); + $status = asteriskCMD($cmd, $tmpfile); + if ($status == 0) { + $ph = @fopen($tmpfile, "r"); + while (! feof($ph)) { + if ($line = trim(fgets($ph, 1024))) { + if ($isASTERISKv1_4) { + if (preg_match('/^([0-9][0-9]*) .*$/', $line, $ips)) { + $rooms[$id]['room'] = $ips[1]; + $rooms[$id]['locked'] = '-1'; + $id++; + } + } else { + if (strpos($line, '!') !== FALSE) { + $ips = explode('!', $line); + $rooms[$id]['room'] = $ips[0]; + $rooms[$id]['locked'] = $ips[5]; + $id++; + } + } + } + } + fclose($ph); + } + @unlink($tmpfile); + + return($rooms); +} + +// Function: parseMEETMEdata +// +function parseMEETMEdata($room_list) { + global $isASTERISKv1_4; + $id = 0; + + for ($i = 0; $i < count($room_list); $i++) { + $tmpfile = tempnam("/tmp", "PHP_"); + $status = asteriskCMD('meetme list '.$room_list[$i]['room'].' concise', $tmpfile); + if ($status == 0) { + $ph = @fopen($tmpfile, "r"); + while (! feof($ph)) { + if ($line = trim(fgets($ph, 1024))) { + if (strpos($line, '!') !== FALSE) { + $ips = explode('!', $line); + $db['data'][$id]['room'] = $room_list[$i]['room']; + $db['data'][$id]['user'] = $ips[0]; + $db['data'][$id]['cidnum'] = $ips[1]; + $db['data'][$id]['cidname'] = $ips[2]; + $db['data'][$id]['channel'] = $ips[3]; + $db['data'][$id]['mute'] = $ips[6]; + $db['data'][$id]['talking'] = $isASTERISKv1_4 ? $ips[7] : $ips[8]; + $db['data'][$id]['duration'] = $isASTERISKv1_4 ? $ips[8] : $ips[9]; + $id++; + } + } + } + fclose($ph); + } + @unlink($tmpfile); + } + + return($db); +} + +if ($_SERVER['REQUEST_METHOD'] === 'POST') { + $result = 1; + if (! $global_staff) { + $result = 999; + } elseif (isset($_POST['submit_reload'])) { + header('Location: '.$myself); + exit; + } elseif (isset($_POST['submit_autorefresh'])) { + header('Location: '.$myself.'?autorefresh'); + exit; + } elseif (isset($_POST['submit_stoprefresh'])) { + header('Location: '.$myself); + exit; + } + header('Location: '.$myself.'?result='.$result); + exit; +} else { // Start of HTTP GET +$ACCESS_RIGHTS = 'staff'; +require_once '../common/header.php'; + + $autorefresh = isset($_GET['autorefresh']) ? '&autorefresh' : ''; + + $ok_redirect = TRUE; + if (isset($_GET['redirect'])) { + $redirect_path = getPREFdef($global_prefs, 'meetme_redirect_path_cmdstr'); + $ok_redirect = userRedirect(rawurldecode($_GET['redirect']), $redirect_path); + } + $ok = TRUE; + if (isset($_GET['lock'])) { + $ok = confLock($_GET['lock'], 'lock'); + } + if (isset($_GET['unlock'])) { + $ok = confLock($_GET['unlock'], 'unlock'); + } + if (isset($_GET['mute'])) { + $ok = userMute($_GET['mute'], 'mute'); + } + if (isset($_GET['unmute'])) { + $ok = userMute($_GET['unmute'], 'unmute'); + } + if (isset($_GET['kick'])) { + $ok = userKick($_GET['kick']); + } + + putHtml('<center>'); + if (isset($_GET['result'])) { + $result = $_GET['result']; + if ($result == 1) { + putHtml('<p style="color: orange;">No Action.</p>'); + } elseif ($result == 99) { + putHtml('<p style="color: red;">Action Failed.</p>'); + } elseif ($result == 999) { + putHtml('<p style="color: red;">Permission denied for user "'.$global_user.'".</p>'); + } else { + putHtml('<p> </p>'); + } + } elseif ($ok_redirect === FALSE) { + putHtml('<p style="color: red;">Asterisk Action Failed. Redirect requires "call" AMI privileges for [webinterface].</p>'); + } elseif ($ok === FALSE) { + putHtml('<p style="color: red;">Asterisk Action Failed.</p>'); + } else { + putHtml('<p> </p>'); + } + putHtml('</center>'); +?> + <script language="JavaScript" type="text/javascript"> + //<![CDATA[ + var refresh_timeout; + function auto_refresh() { + refresh_timeout = setTimeout("refresh()", 10000); // 10 seconds + } + function stop_refresh() { + if (typeof(refresh_timeout) != 'undefined') { + clearTimeout(refresh_timeout); + refresh_timeout = undefined; + } + } + function refresh() { + window.location.replace("/admin/meetme.php?autorefresh"); + } + //]]> + </script> + <center> + <table class="layout"><tr><td><center> + <form method="post" action="<?php echo $myself;?>"> + <table width="100%" class="stdtable"> + <tr><td style="text-align: center;" colspan="5"> + <h2>MeetMe Conference Management:</h2> + </td></tr><tr><td width="50"> + </td><td style="text-align: center;"> +<?php + if ($autorefresh === '') { + putHtml('<input type="submit" class="formbtn" value="Refresh List" name="submit_reload" />'); + } else { + putHtml('<input type="submit" class="formbtn" value="Refresh List" name="submit_autorefresh" />'); + } +?> + </td><td width="50"> + </td><td style="text-align: center;"> +<?php + if ($autorefresh === '') { + putHtml('<input type="submit" class="formbtn" value="Auto Refresh List" name="submit_autorefresh" />'); + } else { + putHtml('<input type="submit" class="formbtn" value="Stop Auto Refresh" onclick="stop_refresh()" name="submit_stoprefresh" />'); + } +?> + </td><td width="50"> + </td></tr> + </table> +<?php + $room_list = getMEETMErooms(); + $db = parseMEETMEdata($room_list); + + $channel = (getPREFdef($global_prefs, 'meetme_channel_show') === 'yes'); + + for ($rnum = 0; $rnum < count($room_list); $rnum++) { + $room = $room_list[$rnum]['room']; + putHtml('<p class="dialogText" style="text-align: left;">'); + putHtml(' <strong>Conference: </strong>'.$room.' '); + if ($room_list[$rnum]['locked'] === '0') { + echo '<a href="'.$myself.'?lock='.$room.$autorefresh.'" onclick="stop_refresh()" class="actionText">Lock</a>'; + } elseif ($room_list[$rnum]['locked'] > 0) { + echo '<a href="'.$myself.'?unlock='.$room.$autorefresh.'" onclick="stop_refresh()" class="actionText">Unlock</a>'; + } else { + echo '<a href="'.$myself.'?lock='.$room.$autorefresh.'" onclick="stop_refresh()" class="actionText">Lock</a>'; + echo ' '; + echo '<a href="'.$myself.'?unlock='.$room.$autorefresh.'" onclick="stop_refresh()" class="actionText">Unlock</a>'; + } + putHtml('</p>'); + + putHtml('<table width="100%" class="datatable">'); + putHtml("<tr>"); + + if (($n = count($db['data'])) > 0) { + echo '<td class="dialogText" style="text-align: left; font-weight: bold;">', "User#", "</td>"; + echo '<td class="dialogText" style="text-align: left; font-weight: bold;">', "CID Num", "</td>"; + echo '<td class="dialogText" style="text-align: left; font-weight: bold;">', "CID Name", "</td>"; + if ($channel) { + echo '<td class="dialogText" style="text-align: left; font-weight: bold;">', "Channel", "</td>"; + } + echo '<td class="dialogText" style="text-align: center; font-weight: bold;">', "Talking", "</td>"; + echo '<td class="dialogText" style="text-align: right; font-weight: bold;">', "Duration", "</td>"; + echo '<td class="dialogText" style="text-align: center; font-weight: bold;">', "-- Actions --", "</td>"; + for ($i = 0; $i < $n; $i++) { + $data = $db['data'][$i]; + if ($data['room'] !== $room) { // skip + continue; + } + $room_user = $data['room'].','.$data['user']; + putHtml("</tr>"); + echo '<tr ', ($i % 2 == 0) ? 'class="dtrow0"' : 'class="dtrow1"', '>'; + echo '<td style="text-align: left;">', $data['user'], '</td>'; + echo '<td style="text-align: left;">', $data['cidnum'], '</td>'; + echo '<td style="text-align: left;">', htmlspecialchars($data['cidname']), '</td>'; + if ($channel) { + echo '<td style="text-align: left;">', $data['channel'], '</td>'; + } + echo '<td style="text-align: center;">', isTALKING($data['talking']), '</td>'; + echo '<td style="text-align: right;">', $data['duration'], '</td>'; + + echo '<td style="text-align: right; padding-top: 8px; padding-bottom: 8px;">'; + if ($data['mute'] === '') { + echo '<a href="'.$myself.'?mute='.$room_user.$autorefresh.'" onclick="stop_refresh()" class="actionText">Mute</a>'; + } else { + echo '<a href="'.$myself.'?unmute='.$room_user.$autorefresh.'" onclick="stop_refresh()" class="actionText">Unmute</a>'; + } + echo ' <a href="'.$myself.'?redirect='.rawurlencode($data['channel']).$autorefresh.'" onclick="stop_refresh()" class="actionText">Redirect</a>'; + echo ' <a href="/admin/blacklist.php?num='.$data['cidnum'].getCommentURL($data['cidname']).'" onclick="stop_refresh()" class="actionText">Blacklist</a>'; + echo ' <a href="'.$myself.'?kick='.$room_user.$autorefresh.'" onclick="stop_refresh()" class="actionText">Kick</a>'; + echo '</td>'; + } + } + putHtml("</tr>"); + putHtml("</table>"); + } + if (count($room_list) == 0) { + putHtml('<p>No active MeetMe conferences.</p>'); + } + putHtml("</form>"); + putHtml("</center></td></tr></table>"); + putHtml("</center>"); + if ($autorefresh !== '') { + putHtml('<script language="JavaScript" type="text/javascript">'); + putHtml('//<![CDATA['); + putHtml('auto_refresh();'); + putHtml('//]]>'); + putHtml('</script>'); + } +} // End of HTTP GET +require_once '../common/footer.php'; + +?> Property changes on: branches/1.0/package/webinterface/altweb/admin/meetme.php ___________________________________________________________________ Added: svn:executable + * Modified: branches/1.0/package/webinterface/altweb/admin/prefs.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/prefs.php 2012-05-21 17:44:02 UTC (rev 5543) +++ branches/1.0/package/webinterface/altweb/admin/prefs.php 2012-05-21 22:39:36 UTC (rev 5544) @@ -191,6 +191,15 @@ fwrite($fp, $value."\n"); } + if (($value = str_replace(' ', '', $_POST['meetme_redirect'])) !== '') { + $value = 'meetme_redirect_path_cmdstr = "'.$value.'"'; + fwrite($fp, $value."\n"); + } + if (isset($_POST['meetme_channel'])) { + $value = 'meetme_channel_show = yes'; + fwrite($fp, $value."\n"); + } + $value = 'cdrlog_default_format = "'.$_POST['cdr_default'].'"'; fwrite($fp, $value."\n"); $value = 'cdrlog_log_file_cmdstr = "'.trim($_POST['cdr_logfile']).'"'; @@ -375,6 +384,10 @@ $value = 'tab_followme_disable_staff = yes'; fwrite($fp, $value."\n"); } + if (isset($_POST['tab_meetme'])) { + $value = 'tab_meetme_show = yes'; + fwrite($fp, $value."\n"); + } if (! isset($_POST['tab_network'])) { $value = 'tab_network_show = no'; fwrite($fp, $value."\n"); @@ -615,6 +628,22 @@ putHtml('<tr class="dtrow0"><td colspan="6"> </td></tr>'); putHtml('<tr class="dtrow0"><td class="dialogText" style="text-align: left;" colspan="6">'); + putHtml('<strong>MeetMe Tab Options:</strong>'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">Redirect Path:</td><td colspan="4">'); + if (($value = getPREFdef($global_prefs, 'meetme_redirect_path_cmdstr')) === '') { + $value = 'default,s,1'; + } + putHtml('<input type="text" size="48" maxlength="96" value="'.$value.'" name="meetme_redirect" /></td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;">'); + $sel = (getPREFdef($global_prefs, 'meetme_channel_show') === 'yes') ? ' checked="checked"' : ''; + putHtml('<input type="checkbox" value="meetme_channel" name="meetme_channel"'.$sel.' /></td><td colspan="5">Display channel values in MeetMe Tab</td></tr>'); + + putHtml('<tr class="dtrow0"><td colspan="6"> </td></tr>'); + + putHtml('<tr class="dtrow0"><td class="dialogText" style="text-align: left;" colspan="6">'); putHtml('<strong>CDR Log Tab Options:</strong>'); putHtml('</td></tr>'); @@ -907,6 +936,10 @@ putHtml('<input type="checkbox" value="followme_disable_staff" name="followme_disable_staff"'.$sel.' /> Disable Follow-Me Tab for "staff" user</td></tr>'); putHtml('<tr class="dtrow1"><td style="text-align: right;">'); + $sel = (getPREFdef($global_prefs, 'tab_meetme_show') === 'yes') ? ' checked="checked"' : ''; + putHtml('<input type="checkbox" value="tab_meetme" name="tab_meetme"'.$sel.' /></td><td colspan="5">Show MeetMe Tab</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;">'); $sel = (getPREFdef($global_prefs, 'tab_cdrlog_show') !== 'no') ? ' checked="checked"' : ''; putHtml('<input type="checkbox" value="tab_cdrlog" name="tab_cdrlog"'.$sel.' /></td><td colspan="5">Show CDR Log Tab</td></tr>'); Modified: branches/1.0/package/webinterface/altweb/common/header.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/header.php 2012-05-21 17:44:02 UTC (rev 5543) +++ branches/1.0/package/webinterface/altweb/common/header.php 2012-05-21 22:39:36 UTC (rev 5544) @@ -188,6 +188,9 @@ if ((! $global_staff_disable_followme) && getPREFdef($global_prefs, 'tab_followme_show') === 'yes') { putHtml('<li><a href="/admin/followme.php"><span>Follow-Me</span></a></li>'); } + if ($global_staff && (getPREFdef($global_prefs, 'tab_meetme_show') === 'yes')) { + putHtml('<li><a href="/admin/meetme.php"><span>MeetMe</span></a></li>'); + } if ($global_staff && (getPREFdef($global_prefs, 'tab_cdrlog_show') !== 'no')) { putHtml('<li><a href="/admin/cdrlog.php"><span>CDR Log</span></a></li>'); } Modified: branches/1.0/package/webinterface/altweb/common/version.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/version.php 2012-05-21 17:44:02 UTC (rev 5543) +++ branches/1.0/package/webinterface/altweb/common/version.php 2012-05-21 22:39:36 UTC (rev 5544) @@ -1,6 +1,6 @@ <?php // version.php for AstLinux Alternate Web Interface -$GUI_VERSION = '1.8.11'; +$GUI_VERSION = '1.8.12'; ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2012-07-08 01:36:12
|
Revision: 5597 http://astlinux.svn.sourceforge.net/astlinux/?rev=5597&view=rev Author: abelbeck Date: 2012-07-08 01:36:05 +0000 (Sun, 08 Jul 2012) Log Message: ----------- webinterface, add support for miniupnpd Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/edit.php branches/1.0/package/webinterface/altweb/admin/network.php branches/1.0/package/webinterface/altweb/common/status.inc branches/1.0/package/webinterface/altweb/common/version.php Modified: branches/1.0/package/webinterface/altweb/admin/edit.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/edit.php 2012-07-07 21:26:26 UTC (rev 5596) +++ branches/1.0/package/webinterface/altweb/admin/edit.php 2012-07-08 01:36:05 UTC (rev 5597) @@ -27,6 +27,7 @@ 'openvpnclient' => 'Restart OpenVPN Client', 'racoon' => 'Restart IPsec VPN', 'pptpd' => 'Restart PPTP VPN Server', + 'miniupnpd' => 'Restart Univ. Plug\'n\'Play', 'apcupsd' => 'Restart UPS Daemon', 'asterisk' => 'Restart Asterisk', 'cron' => 'Reload Cron for root' @@ -198,8 +199,10 @@ $result = restartPROCESS($process, 32, $result, 'init'); } elseif ($process === 'pptpd') { $result = restartPROCESS($process, 33, $result, 'init'); + } elseif ($process === 'miniupnpd') { + $result = restartPROCESS($process, 34, $result, 'init'); } elseif ($process === 'apcupsd') { - $result = restartPROCESS($process, 34, $result, 'init'); + $result = restartPROCESS($process, 35, $result, 'init'); } elseif ($process === 'cron') { $result = updateCRON('root', 30, $result); } @@ -302,6 +305,8 @@ } elseif ($result == 33) { putHtml('<p style="color: green;">PPTP VPN Server has Restarted.</p>'); } elseif ($result == 34) { + putHtml('<p style="color: green;">Universal Plug\'n\'Play has Restarted.</p>'); + } elseif ($result == 35) { putHtml('<p style="color: green;">UPS Daemon has Restarted.</p>'); } elseif ($result == 99) { putHtml('<p style="color: red;">Action Failed.</p>'); Modified: branches/1.0/package/webinterface/altweb/admin/network.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/network.php 2012-07-07 21:26:26 UTC (rev 5596) +++ branches/1.0/package/webinterface/altweb/admin/network.php 2012-07-08 01:36:05 UTC (rev 5597) @@ -30,6 +30,7 @@ // 05-24-2011, Added SIP Monitoring // 12-03-2011, Added HTTP_ACCESSLOG and HTTPS_ACCESSLOG support // 01-28-2012, Added LOCALDNS_LOCAL_DOMAIN support +// 07-07-2012, Added Universal Plug & Play support // // System location of rc.conf file $CONFFILE = '/etc/rc.conf'; @@ -98,6 +99,13 @@ 'simple' => 'simple' ); +$select_upnp = array ( + 'disabled' => 'no:no', + 'NAT-PMP only' => 'yes:no', + 'UPnP only' => 'no:yes', + 'NAT-PMP & UPnP' => 'yes:yes' +); + // Function: checkNETWORKsettings // function checkNETWORKsettings() { @@ -389,6 +397,29 @@ $value = 'CLI_PROXY_SERVER="'.$_POST['cli_proxy'].'"'; fwrite($fp, "### CLI Proxy Server\n".$value."\n"); + $x_value = $_POST['upnp']; + $tokens = explode(':', $x_value); + $value = 'UPNP_ENABLE_NATPMP="'.$tokens[0].'"'; + fwrite($fp, "### UPnP NAT-PMP\n".$value."\n"); + $value = 'UPNP_ENABLE_UPNP="'.$tokens[1].'"'; + fwrite($fp, "### UPnP Enable\n".$value."\n"); + + $x_value = ''; + if (isset($_POST['upnp_INTIF'])) { + $x_value .= ' INTIF'; + } + if (isset($_POST['upnp_INT2IF'])) { + $x_value .= ' INT2IF'; + } + if (isset($_POST['upnp_INT3IF'])) { + $x_value .= ' INT3IF'; + } + if (isset($_POST['upnp_DMZIF'])) { + $x_value .= ' DMZIF'; + } + $value = 'UPNP_LISTEN="'.trim($x_value).'"'; + fwrite($fp, "### UPnP Listen Interfaces\n".$value."\n"); + $value = 'HTTPDIR="'.trim($_POST['http_dir']).'"'; fwrite($fp, "### HTTP Server Directory\n".$value."\n"); @@ -835,8 +866,10 @@ $result = restartPROCESS($process, 32, $result, 'init'); } elseif ($process === 'pptpd') { $result = restartPROCESS($process, 33, $result, 'init'); + } elseif ($process === 'miniupnpd') { + $result = restartPROCESS($process, 34, $result, 'init'); } elseif ($process === 'apcupsd') { - $result = restartPROCESS($process, 34, $result, 'init'); + $result = restartPROCESS($process, 35, $result, 'init'); } } else { $result = 2; @@ -902,6 +935,8 @@ } elseif ($result == 33) { putHtml('<p style="color: green;">PPTP VPN Server has Restarted.</p>'); } elseif ($result == 34) { + putHtml('<p style="color: green;">Universal Plug\'n\'Play has Restarted.</p>'); + } elseif ($result == 35) { putHtml('<p style="color: green;">UPS Daemon has Restarted.</p>'); } elseif ($result == 99) { putHtml('<p style="color: red;">Action Failed.</p>'); @@ -921,9 +956,27 @@ } putHtml("</center>"); ?> + <script language="JavaScript" type="text/javascript"> + //<![CDATA[ + function upnp_change() { + var form = document.getElementById("iform"); + switch (form.upnp.selectedIndex) { + case 0: // disabled + break; + case 1: + case 2: + case 3: + alert('WARNING: Enabling either NAT-PMP or UPnP has security implications!\ +\n\nNAT EXT->LAN rules can be created automatically.\ +\n\nIf you must, try NAT-PMP only.'); + break; + } + } + //]]> + </script> <center> <table class="layout"><tr><td><center> - <form method="post" action="<?php echo $myself;?>"> + <form id="iform" method="post" action="<?php echo $myself;?>"> <table width="100%" class="stdtable"> <tr><td style="text-align: center;" colspan="2"> <h2>Network Configuration Settings:</h2> @@ -960,6 +1013,8 @@ putHtml('<option value="racoon"'.$sel.'>Restart IPsec VPN</option>'); $sel = ($reboot_restart === 'pptpd') ? ' selected="selected"' : ''; putHtml('<option value="pptpd"'.$sel.'>Restart PPTP VPN Server</option>'); + $sel = ($reboot_restart === 'miniupnpd') ? ' selected="selected"' : ''; + putHtml('<option value="miniupnpd"'.$sel.'>Restart Univ. Plug\'n\'Play</option>'); $sel = ($reboot_restart === 'apcupsd') ? ' selected="selected"' : ''; putHtml('<option value="apcupsd"'.$sel.'>Restart UPS Daemon</option>'); $sel = ($reboot_restart === 'asterisk') ? ' selected="selected"' : ''; @@ -1354,6 +1409,27 @@ putHtml('</td></tr>'); putHtml('<tr class="dtrow1"><td style="text-align: left;" colspan="6">'); + putHtml("Universal Plug'n'Play:"); + $upnp_natpmp = getVARdef($db, 'UPNP_ENABLE_NATPMP', $cur_db) === 'yes' ? 'yes' : 'no'; + $upnp_upnp = getVARdef($db, 'UPNP_ENABLE_UPNP', $cur_db) === 'yes' ? 'yes' : 'no'; + putHtml('<select name="upnp" onchange="upnp_change()">'); + foreach ($select_upnp as $key => $value) { + $sel = ("$upnp_natpmp:$upnp_upnp" === $value) ? ' selected="selected"' : ''; + putHtml('<option value="'.$value.'"'.$sel.'>'.$key.'</option>'); + } + putHtml('</select>'); + putHtml('– Interfaces:'); + $sel = isVARtype('UPNP_LISTEN', $db, $cur_db, 'INTIF') ? ' checked="checked"' : ''; + putHtml('<input type="checkbox" value="upnp_INTIF" name="upnp_INTIF"'.$sel.' /> 1st LAN'); + $sel = isVARtype('UPNP_LISTEN', $db, $cur_db, 'INT2IF') ? ' checked="checked"' : ''; + putHtml('<input type="checkbox" value="upnp_INT2IF" name="upnp_INT2IF"'.$sel.' /> 2nd LAN'); + $sel = isVARtype('UPNP_LISTEN', $db, $cur_db, 'INT3IF') ? ' checked="checked"' : ''; + putHtml('<input type="checkbox" value="upnp_INT3IF" name="upnp_INT3IF"'.$sel.' /> 3rd LAN'); + $sel = isVARtype('UPNP_LISTEN', $db, $cur_db, 'DMZIF') ? ' checked="checked"' : ''; + putHtml('<input type="checkbox" value="upnp_DMZIF" name="upnp_DMZIF"'.$sel.' /> DMZ'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: left;" colspan="6">'); $value = getVARdef($db, 'HTTPDIR', $cur_db); putHtml('HTTP Server Directory:<input type="text" size="45" maxlength="64" value="'.$value.'" name="http_dir" />'); putHtml('</td></tr>'); Modified: branches/1.0/package/webinterface/altweb/common/status.inc =================================================================== --- branches/1.0/package/webinterface/altweb/common/status.inc 2012-07-07 21:26:26 UTC (rev 5596) +++ branches/1.0/package/webinterface/altweb/common/status.inc 2012-07-08 01:36:05 UTC (rev 5597) @@ -25,11 +25,14 @@ // 05-05-2011, Added DAHDI Status and Hardware Monitoring sections // 08-10-2011, Added APC UPS Status // 01-02-2012, Added Jabber Status +// 07-07-2012, Added UPnP Status // // System location of OpenVPN Client logfile $OVPNCLOGFILE = '/var/log/openvpnclient-status.log'; // System location of OpenVPN Server logfile $OVPNLOGFILE = '/var/log/openvpn-status.log'; +// System location of MINIUPNPD leases +$MINIUPNPDLEASES = '/var/db/upnp.leases'; // System location of DNSMASQ leases $DNSMASQLEASES = '/var/db/dnsmasq.leases'; // System location of nf_conntrack file @@ -60,6 +63,7 @@ function getDaemons() { $status['asterisk'] = 0; $status['ntpd'] = 0; + $status['miniupnpd'] = 0; $status['dnsmasq'] = 0; $status['openvpn'] = 0; $status['racoon'] = 0; @@ -77,6 +81,8 @@ $status['asterisk']++; } elseif (strpos($line, ' ntpd') !== FALSE || strpos($line, '/ntpd') !== FALSE) { $status['ntpd']++; + } elseif (strpos($line, ' miniupnpd') !== FALSE || strpos($line, '/miniupnpd') !== FALSE) { + $status['miniupnpd']++; } elseif (strpos($line, ' dnsmasq') !== FALSE || strpos($line, '/dnsmasq') !== FALSE) { $status['dnsmasq']++; } elseif (strpos($line, ' syslogd') !== FALSE || strpos($line, '/syslogd') !== FALSE) { @@ -312,6 +318,37 @@ return($status != 0); } +// Function: parseMINIUPNPDleases +// +function parseMINIUPNPDleases($log) { + $cid = 0; + if (($ph = @fopen($log, "r")) !== FALSE) { + while (! feof($ph)) { + if ($line = trim(fgets($ph, 1024))) { + $linetokens = explode(':', $line); + if (isset($linetokens[4])) { + $status['clients'][$cid]['proto'] = $linetokens[0]; + $status['clients'][$cid]['p_port'] = $linetokens[1]; + $status['clients'][$cid]['l_ip'] = $linetokens[2]; + $status['clients'][$cid]['l_port'] = $linetokens[3]; + $status['clients'][$cid]['expire'] = $linetokens[4]; + $status['clients'][$cid]['desc'] = $linetokens[5]; + $cid++; + } + } + } + fclose($ph); + } + // Sort by Public Port + if ($cid > 1) { + foreach ($status['clients'] as $key => $row) { + $p_port[$key] = $row['p_port']; + } + array_multisort($p_port, SORT_ASC, SORT_STRING, $status['clients']); + } + return($status); +} + // Function: parseDNSMASQleases // function parseDNSMASQleases($log) { @@ -620,6 +657,45 @@ } } +if ($daemon['miniupnpd'] > 0) { + if (getPREFdef($global_prefs, 'status_show_miniupnpd_leases') !== 'no') { // currently not set in the Prefs tab + putHtml("<h2>Universal Plug'n'Play (NAT-PMP and UPnP) Leases:</h2>"); + + if (is_null($upnp = parseMINIUPNPDleases($MINIUPNPDLEASES))) { + putHtml("<pre>"); + putText('No Active NAT-PMP or UPnP Leases'); + putHtml("</pre>"); + } else { + putHtml('<pre><table class="statusdatatable">'); + putHtml("<tr>"); + $cur_time = time(); + if (($n = count($upnp['clients'])) > 0) { + echo "<td>", "Public Port", "</td>"; + echo "<td>", "Protocol", "</td>"; + echo "<td>", "Local IPv4", "</td>"; + echo "<td>", "Local Port", "</td>"; + echo "<td>", "Expire Time", "</td>"; + echo "<td>", "Description", "</td>"; + for ($i = 0; $i < $n; $i++) { + putHtml("</tr><tr>"); + echo "<td>", $upnp['clients'][$i]['p_port'], "</td>"; + echo "<td>", $upnp['clients'][$i]['proto'], "</td>"; + echo "<td>", $upnp['clients'][$i]['l_ip'], "</td>"; + echo "<td>", $upnp['clients'][$i]['l_port'], "</td>"; + if ($upnp['clients'][$i]['expire'] > $cur_time) { + echo "<td>", date('Y-m-d H:i:s', $upnp['clients'][$i]['expire']), "</td>"; + } else { + echo "<td>N/A</td>"; + } + echo "<td>", htmlspecialchars($upnp['clients'][$i]['desc']), "</td>"; + } + } + putHtml("</tr>"); + putHtml("</table></pre>"); + } + } +} + if ($daemon['dnsmasq'] > 0) { if (getPREFdef($global_prefs, 'status_show_dhcp_leases') !== 'no' && isDHCPactive()) { putHtml("<h2>DHCP Leases:</h2>"); Modified: branches/1.0/package/webinterface/altweb/common/version.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/version.php 2012-07-07 21:26:26 UTC (rev 5596) +++ branches/1.0/package/webinterface/altweb/common/version.php 2012-07-08 01:36:05 UTC (rev 5597) @@ -1,6 +1,6 @@ <?php // version.php for AstLinux Alternate Web Interface -$GUI_VERSION = '1.8.12'; +$GUI_VERSION = '1.8.13'; ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2012-07-18 16:55:57
|
Revision: 5618 http://astlinux.svn.sourceforge.net/astlinux/?rev=5618&view=rev Author: abelbeck Date: 2012-07-18 16:55:50 +0000 (Wed, 18 Jul 2012) Log Message: ----------- web interface, Firewall sub-tab, add 'Pass LAN->EXT' and 'Pass DMZ->EXT' actions, and add support for LAN->EXT and DMZ->EXT Default Policies Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/firewall.php branches/1.0/package/webinterface/altweb/common/version.php Modified: branches/1.0/package/webinterface/altweb/admin/firewall.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/firewall.php 2012-07-18 16:23:48 UTC (rev 5617) +++ branches/1.0/package/webinterface/altweb/admin/firewall.php 2012-07-18 16:55:50 UTC (rev 5618) @@ -17,6 +17,7 @@ // 08-23-2009, Added TCP/UDP protocol // 10-14-2010, Added IPv6 support // 03-28-2012, Added NAT EXT support +// 07-16-2012, Added "Pass LAN->EXT" and "Pass DMZ->EXT" actions // // System location of /mnt/kd/rc.conf.d directory $FIREWALLCONFDIR = '/mnt/kd/rc.conf.d'; @@ -42,6 +43,8 @@ 'DENY_LOCAL_EXT' => 'Deny Local->EXT', 'DENY_EXT_DMZ' => 'Deny EXT->DMZ', 'DENY_DMZ_EXT' => 'Deny DMZ->EXT', + 'PASS_LAN_EXT' => 'Pass LAN->EXT', + 'PASS_DMZ_EXT' => 'Pass DMZ->EXT', 'LOG_LOCAL_OUT' => 'Log Local Out', 'LOG_LOCAL_IN' => 'Log Local In' ); @@ -59,6 +62,8 @@ 'DENY_LOCAL_EXT' => 'HOST_DENY_xxx_OUTPUT', 'DENY_EXT_DMZ' => 'INET_DMZ_HOST_DENY_xxx', 'DENY_DMZ_EXT' => 'DMZ_INET_HOST_DENY_xxx', + 'PASS_LAN_EXT' => 'LAN_INET_HOST_OPEN_xxx', + 'PASS_DMZ_EXT' => 'DMZ_INET_HOST_OPEN_xxx', 'LOG_LOCAL_OUT' => 'LOG_HOST_OUTPUT_xxx', 'LOG_LOCAL_IN' => 'LOG_HOST_INPUT_xxx' ); @@ -91,6 +96,16 @@ 'INT3IF' => '3rd LAN Interface' ); +$lan_default_policy_label = array ( + '0' => 'Pass LAN->EXT', + '1' => 'Deny LAN->EXT' +); + +$dmz_default_policy_label = array ( + '0' => 'Pass DMZ->EXT', + '1' => 'Deny DMZ->EXT' +); + // Get arno firewall version //$MY_VERSION = trim(shell_exec('grep -m1 \'^MY_VERSION=\' /usr/sbin/arno-iptables-firewall | sed -e \'s/MY_VERSION=//\' -e \'s/"//g\'')); //$arno_vers = (strncmp($MY_VERSION, '1.8.', 4) == 0) ? 18 : 19; @@ -151,6 +166,8 @@ case 'DENY_EXT_DMZ': case 'DENY_DMZ_EXT': case 'PASS_DMZ_LAN': + case 'PASS_LAN_EXT': + case 'PASS_DMZ_EXT': if ($is_ip) { $str = $data['s_addr'].'>'.$data['d_addr'].$col.$data['proto']; } else { @@ -263,6 +280,10 @@ fwrite($fp, $value."\n"); fwrite($fp, "### Options\n"); + $value = 'LAN_INET_DEFAULT_POLICY_DROP="'.$_POST['lan_DP'].'"'; + fwrite($fp, $value."\n"); + $value = 'DMZ_INET_DEFAULT_POLICY_DROP="'.$_POST['dmz_DP'].'"'; + fwrite($fp, $value."\n"); $value = 'ALLOWLANS="'.(isset($_POST['is_allowlans']) ? $_POST['allowlans'] : '').'"'; fwrite($fp, $value."\n"); $value = 'OVPNC_ALLOWLAN="'.(isset($_POST['is_ovpnc_allowlan']) ? $_POST['ovpnc_allowlan'] : '').'"'; @@ -465,6 +486,8 @@ case 'DENY_EXT_DMZ': case 'DENY_DMZ_EXT': case 'PASS_DMZ_LAN': + case 'PASS_LAN_EXT': + case 'PASS_DMZ_EXT': if ($s_addr === '' || $d_addr === '') { return(FALSE); } @@ -646,7 +669,7 @@ case 3: // PASS_EXT_LOCAL case 6: // PASS_DMZ_LOCAL case 9: // DENY_LAN_LOCAL - case 14: // LOG_LOCAL_IN + case 16: // LOG_LOCAL_IN form.s_addr.disabled = 0; form.s_lport.disabled = 0; form.s_uport.disabled = 0; @@ -677,6 +700,8 @@ case 8: // DENY_LAN_EXT case 11: // DENY_EXT_DMZ case 12: // DENY_DMZ_EXT + case 13: // PASS_LAN_EXT + case 14: // PASS_DMZ_EXT form.s_addr.disabled = 0; form.d_addr.disabled = 0; form.d_lport.disabled = 0; @@ -689,7 +714,7 @@ nat_ext.style.visibility = "hidden"; break; case 10: // DENY_LOCAL_EXT - case 13: // LOG_LOCAL_OUT + case 15: // LOG_LOCAL_OUT form.d_addr.disabled = 0; form.d_lport.disabled = 0; form.d_uport.disabled = 0; @@ -916,6 +941,29 @@ putHtml('<tr class="dtrow0"><td class="dialogText" style="text-align: left;" colspan="2">'); putHtml('<strong>Firewall Options:</strong>'); putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td width="75" style="text-align: right;"> </td><td>'); + putHtml('Default Policy for LAN to EXT:'); + $lan_DP = getVARdef($vars, 'LAN_INET_DEFAULT_POLICY_DROP'); + putHtml('<select name="lan_DP">'); + foreach ($lan_default_policy_label as $key => $value) { + $sel = ($lan_DP == $key) ? ' selected="selected"' : ''; + putHtml('<option value="'.$key.'"'.$sel.'>'.$value.'</option>'); + } + putHtml('</select>'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td width="75" style="text-align: right;"> </td><td>'); + putHtml('Default Policy for DMZ to EXT:'); + $dmz_DP = getVARdef($vars, 'DMZ_INET_DEFAULT_POLICY_DROP'); + putHtml('<select name="dmz_DP">'); + foreach ($dmz_default_policy_label as $key => $value) { + $sel = ($dmz_DP == $key) ? ' selected="selected"' : ''; + putHtml('<option value="'.$key.'"'.$sel.'>'.$value.'</option>'); + } + putHtml('</select>'); + putHtml('</td></tr>'); + putHtml('<tr class="dtrow1"><td width="75" style="text-align: right;">'); $allowlans = getVARdef($vars, 'ALLOWLANS'); $sel = ($allowlans !== '') ? ' checked="checked"' : ''; Modified: branches/1.0/package/webinterface/altweb/common/version.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/version.php 2012-07-18 16:23:48 UTC (rev 5617) +++ branches/1.0/package/webinterface/altweb/common/version.php 2012-07-18 16:55:50 UTC (rev 5618) @@ -1,6 +1,6 @@ <?php // version.php for AstLinux Alternate Web Interface -$GUI_VERSION = '1.8.13'; +$GUI_VERSION = '1.8.14'; ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2012-09-01 19:18:06
|
Revision: 5655 http://astlinux.svn.sourceforge.net/astlinux/?rev=5655&view=rev Author: abelbeck Date: 2012-09-01 19:17:59 +0000 (Sat, 01 Sep 2012) Log Message: ----------- web interface, add Zabbix Monitoring support Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/edit.php branches/1.0/package/webinterface/altweb/admin/network.php branches/1.0/package/webinterface/altweb/common/functions.php branches/1.0/package/webinterface/altweb/common/status.inc branches/1.0/package/webinterface/altweb/common/version.php Added Paths: ----------- branches/1.0/package/webinterface/altweb/admin/zabbix.php Modified: branches/1.0/package/webinterface/altweb/admin/edit.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/edit.php 2012-09-01 14:35:35 UTC (rev 5654) +++ branches/1.0/package/webinterface/altweb/admin/edit.php 2012-09-01 19:17:59 UTC (rev 5655) @@ -29,6 +29,7 @@ 'pptpd' => 'Restart PPTP VPN Server', 'miniupnpd' => 'Restart Univ. Plug\'n\'Play', 'apcupsd' => 'Restart UPS Daemon', + 'zabbix' => 'Restart Zabbix Monitor', 'asterisk' => 'Restart Asterisk', 'cron' => 'Reload Cron for root' ); @@ -203,6 +204,8 @@ $result = restartPROCESS($process, 34, $result, 'init'); } elseif ($process === 'apcupsd') { $result = restartPROCESS($process, 35, $result, 'init'); + } elseif ($process === 'zabbix') { + $result = restartPROCESS($process, 36, $result, 'init', 4); } elseif ($process === 'cron') { $result = updateCRON('root', 30, $result); } @@ -308,6 +311,8 @@ putHtml('<p style="color: green;">Universal Plug\'n\'Play has Restarted.</p>'); } elseif ($result == 35) { putHtml('<p style="color: green;">UPS Daemon has Restarted.</p>'); + } elseif ($result == 36) { + putHtml('<p style="color: green;">Zabbix Monitoring has Restarted.</p>'); } elseif ($result == 99) { putHtml('<p style="color: red;">Action Failed.</p>'); } elseif ($result == 999) { Modified: branches/1.0/package/webinterface/altweb/admin/network.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/network.php 2012-09-01 14:35:35 UTC (rev 5654) +++ branches/1.0/package/webinterface/altweb/admin/network.php 2012-09-01 19:17:59 UTC (rev 5655) @@ -775,6 +775,10 @@ $result = saveNETWORKsettings($NETCONFDIR, $NETCONFFILE); header('Location: /admin/dnshosts.php'); exit; + } elseif (isset($_POST['submit_zabbix'])) { + $result = saveNETWORKsettings($NETCONFDIR, $NETCONFFILE); + header('Location: /admin/zabbix.php'); + exit; } elseif (isset($_POST['submit_edit_dnsmasq_conf'])) { $result = saveNETWORKsettings($NETCONFDIR, $NETCONFFILE); if (is_writable($file = '/mnt/kd/dnsmasq.conf')) { @@ -870,6 +874,8 @@ $result = restartPROCESS($process, 34, $result, 'init'); } elseif ($process === 'apcupsd') { $result = restartPROCESS($process, 35, $result, 'init'); + } elseif ($process === 'zabbix') { + $result = restartPROCESS($process, 36, $result, 'init', 4); } } else { $result = 2; @@ -938,6 +944,8 @@ putHtml('<p style="color: green;">Universal Plug\'n\'Play has Restarted.</p>'); } elseif ($result == 35) { putHtml('<p style="color: green;">UPS Daemon has Restarted.</p>'); + } elseif ($result == 36) { + putHtml('<p style="color: green;">Zabbix Monitoring has Restarted.</p>'); } elseif ($result == 99) { putHtml('<p style="color: red;">Action Failed.</p>'); } elseif ($result == 100) { @@ -1017,6 +1025,8 @@ putHtml('<option value="miniupnpd"'.$sel.'>Restart Univ. Plug\'n\'Play</option>'); $sel = ($reboot_restart === 'apcupsd') ? ' selected="selected"' : ''; putHtml('<option value="apcupsd"'.$sel.'>Restart UPS Daemon</option>'); + $sel = ($reboot_restart === 'zabbix') ? ' selected="selected"' : ''; + putHtml('<option value="zabbix"'.$sel.'>Restart Zabbix Monitor</option>'); $sel = ($reboot_restart === 'asterisk') ? ' selected="selected"' : ''; putHtml('<option value="asterisk"'.$sel.'>Restart Asterisk</option>'); putHtml('</select>'); @@ -1381,6 +1391,9 @@ putHtml('DNS Forwarder & DHCP Server:'); putHtml('<input type="submit" value="Configure DNS Hosts" name="submit_dns_hosts" class="button" /></td></tr>'); putHtml('<tr class="dtrow1"><td style="text-align: left;" colspan="6">'); + putHtml('Zabbix Monitoring:'); + putHtml('<input type="submit" value="Configure Zabbix" name="submit_zabbix" class="button" /></td></tr>'); + putHtml('<tr class="dtrow1"><td style="text-align: left;" colspan="6">'); putHtml('FTP Server:'); putHtml('<select name="ftp">'); putHtml('<option value="">disabled</option>'); Added: branches/1.0/package/webinterface/altweb/admin/zabbix.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/zabbix.php (rev 0) +++ branches/1.0/package/webinterface/altweb/admin/zabbix.php 2012-09-01 19:17:59 UTC (rev 5655) @@ -0,0 +1,328 @@ +<?php + +// Copyright (C) 2012 Lonnie Abelbeck +// This is free software, licensed under the GNU General Public License +// version 3 as published by the Free Software Foundation; you can +// redistribute it and/or modify it under the terms of the GNU +// General Public License; and comes with ABSOLUTELY NO WARRANTY. + +// zabbix.php for AstLinux +// 08-31-2012 +// +// System location of rc.conf file +$CONFFILE = '/etc/rc.conf'; +// System location of /mnt/kd/rc.conf.d directory +$ZABBIXCONFDIR = '/mnt/kd/rc.conf.d'; +// System location of gui.zabbix.conf file +$ZABBIXCONFFILE = '/mnt/kd/rc.conf.d/gui.zabbix.conf'; + +$myself = $_SERVER['PHP_SELF']; + +require_once '../common/functions.php'; + +$startagents_menu = array ( + '1' => '1', + '2' => '2', + '3' => '3', + '4' => '4', + '8' => '8', + '12' => '12', + '16' => '16' +); + +$debuglevel_menu = array ( + '0' => 'none', + '1' => 'critical', + '2' => 'error', + '3' => 'warning', + '4' => 'debug' +); + +$timeout_menu = array ( + '1' => '1', + '2' => '2', + '3' => '3', + '4' => '4', + '5' => '5', + '10' => '10', + '20' => '20', + '30' => '30' +); + +// Function: saveZABBIXsettings +// +function saveZABBIXsettings($conf_dir, $conf_file) { + global $openssl; + + $result = 11; + + if (! is_dir($conf_dir)) { + return(3); + } + if (($fp = @fopen($conf_file,"wb")) === FALSE) { + return(3); + } + fwrite($fp, "### gui.zabbix.conf - start ###\n###\n"); + + $value = 'GUI_ZABBIX_DATA="'.$_POST['zabbix_enabled'].'~'.trim($_POST['zabbix_server']).'"'; + fwrite($fp, "### GUI Data\n".$value."\n"); + + if ($_POST['zabbix_enabled'] == '1') { + $value = 'ZABBIX_SERVER="'.trim($_POST['zabbix_server']).'"'; + } else { + $value = 'ZABBIX_SERVER=""'; + } + fwrite($fp, "### Server\n".$value."\n"); + + $value = 'ZABBIX_HOSTNAME="'.trim($_POST['agent_hostname']).'"'; + fwrite($fp, "### Agent Hostname\n".$value."\n"); + + $value = 'ZABBIX_LISTENPORT="'.trim($_POST['agent_listenport']).'"'; + fwrite($fp, "### Agent Listen Port\n".$value."\n"); + + $value = 'ZABBIX_STARTAGENTS="'.$_POST['zabbix_startagents'].'"'; + fwrite($fp, "### StartAgents\n".$value."\n"); + + $value = 'ZABBIX_DEBUGLEVEL="'.$_POST['zabbix_debuglevel'].'"'; + fwrite($fp, "### DebugLevel\n".$value."\n"); + + $value = 'ZABBIX_TIMEOUT="'.$_POST['zabbix_timeout'].'"'; + fwrite($fp, "### Timeout\n".$value."\n"); + + $value = 'ZABBIX_PROXY="'.$_POST['zabbix_proxy'].'"'; + fwrite($fp, "### Proxy Enable\n".$value."\n"); + + $value = 'ZABBIX_PROXY_HOSTNAME="'.trim($_POST['zabbix_proxy_hostname']).'"'; + fwrite($fp, "### Proxy Hostname\n".$value."\n"); + + $value = 'ZABBIX_SERVER_PORT="'.trim($_POST['zabbix_server_port']).'"'; + fwrite($fp, "### Server Port\n".$value."\n"); + + $value = 'ZABBIX_PROXY_AGENT="'.$_POST['zabbix_proxy_agent'].'"'; + fwrite($fp, "### Route Agent via Proxy\n".$value."\n"); + + fwrite($fp, "### gui.zabbix.conf - end ###\n"); + fclose($fp); + + return($result); +} + +if ($_SERVER['REQUEST_METHOD'] === 'POST') { + $result = 1; + if (! $global_admin) { + $result = 999; + } elseif (isset($_POST['submit_save'])) { + $result = saveZABBIXsettings($ZABBIXCONFDIR, $ZABBIXCONFFILE); + } elseif (isset($_POST['submit_restart'])) { + $result = 99; + if (isset($_POST['confirm_restart'])) { + $result = restartPROCESS('zabbix', 10, $result, 'init', 4); + } else { + $result = 2; + } + } + header('Location: '.$myself.'?result='.$result); + exit; +} else { // Start of HTTP GET +$ACCESS_RIGHTS = 'admin'; +require_once '../common/header.php'; + + if (is_file($ZABBIXCONFFILE)) { + $db = parseRCconf($ZABBIXCONFFILE); + $cur_db = parseRCconf($CONFFILE); + } else { + $db = parseRCconf($CONFFILE); + $cur_db = NULL; + } + + putHtml("<center>"); + if (isset($_GET['result'])) { + $result = $_GET['result']; + if ($result == 2) { + putHtml('<p style="color: red;">No Action, check "Confirm" for this action.</p>'); + } elseif ($result == 3) { + putHtml('<p style="color: red;">Error creating file.</p>'); + } elseif ($result == 10) { + putHtml('<p style="color: green;">Zabbix Monitoring has Restarted.</p>'); + } elseif ($result == 11) { + putHtml('<p style="color: green;">Settings saved, click "Restart Client" to apply any changed settings.</p>'); + } elseif ($result == 99) { + putHtml('<p style="color: red;">Action Failed.</p>'); + } elseif ($result == 999) { + putHtml('<p style="color: red;">Permission denied for user "'.$global_user.'".</p>'); + } else { + putHtml('<p style="color: orange;">No Action.</p>'); + } + } else { + putHtml('<p> </p>'); + } + putHtml("</center>"); +?> + <center> + <table class="layout"><tr><td><center> + <form method="post" action="<?php echo $myself;?>"> + <table width="100%" class="stdtable"> + <tr><td style="text-align: center;" colspan="2"> + <h2>Zabbix Monitoring Configuration:</h2> + </td></tr><tr><td width="240" style="text-align: center;"> + <input type="submit" class="formbtn" value="Save Settings" name="submit_save" /> + </td><td class="dialogText" style="text-align: center;"> + <input type="submit" class="formbtn" value="Restart Zabbix" name="submit_restart" /> + – + <input type="checkbox" value="restart" name="confirm_restart" /> Confirm + </td></tr></table> + <table class="stdtable"> + <tr class="dtrow0"><td width="60"> </td><td width="100"> </td><td width="100"> </td><td> </td><td width="100"> </td><td width="80"> </td></tr> +<?php + putHtml('<tr class="dtrow0"><td class="dialogText" style="text-align: left;" colspan="6">'); + putHtml('<strong>Zabbix Server:</strong>'); + putHtml('</td></tr>'); + + if (($value = getVARdef($db, 'GUI_ZABBIX_DATA')) === '') { + if (($value = getVARdef($db, 'ZABBIX_SERVER', $cur_db)) !== '') { + $value = '1~'.$value; + } else { + $value = '0~'; + } + } + $datatokens = explode('~', $value, 2); + + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">'); + putHtml('Monitoring:'); + putHtml('</td><td style="text-align: left;" colspan="4">'); + putHtml('<select name="zabbix_enabled">'); + $sel = ($datatokens[0] == '0') ? ' selected="selected"' : ''; + putHtml('<option value="0"'.$sel.'>disabled</option>'); + $sel = ($datatokens[0] == '1') ? ' selected="selected"' : ''; + putHtml('<option value="1"'.$sel.'>enabled</option>'); + putHtml('</select>'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">'); + putHtml('Server:'); + putHtml('</td><td style="text-align: left;" colspan="4">'); + $value = $datatokens[1]; + putHtml('<input type="text" size="56" maxlength="128" value="'.$value.'" name="zabbix_server" />'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">'); + putHtml('Server Port:'); + putHtml('</td><td style="text-align: left;" colspan="4">'); + if (($value = getVARdef($db, 'ZABBIX_SERVER_PORT', $cur_db)) === '') { + $value = '10051'; + } + putHtml('<input type="text" size="8" maxlength="12" value="'.$value.'" name="zabbix_server_port" />'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow0"><td class="dialogText" style="text-align: left;" colspan="6">'); + putHtml('<strong>Zabbix Agent:</strong>'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">'); + putHtml('Agent Hostname:'); + putHtml('</td><td style="text-align: left;" colspan="4">'); + if (($value = getVARdef($db, 'ZABBIX_HOSTNAME', $cur_db)) === '') { + $value = getVARdef($db, 'HOSTNAME', $cur_db); + } + putHtml('<input type="text" size="32" maxlength="128" value="'.$value.'" name="agent_hostname" />'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">'); + putHtml('Agent ListenPort:'); + putHtml('</td><td style="text-align: left;" colspan="4">'); + if (($value = getVARdef($db, 'ZABBIX_LISTENPORT', $cur_db)) === '') { + $value = '10050'; + } + putHtml('<input type="text" size="8" maxlength="12" value="'.$value.'" name="agent_listenport" />'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">'); + putHtml('StartAgents:'); + putHtml('</td><td style="text-align: left;" colspan="4">'); + putHtml('<select name="zabbix_startagents">'); + if (($startagents = getVARdef($db, 'ZABBIX_STARTAGENTS', $cur_db)) === '') { + $startagents = '3'; + } + foreach ($startagents_menu as $key => $value) { + $sel = ($startagents === (string)$key) ? ' selected="selected"' : ''; + putHtml('<option value="'.$key.'"'.$sel.'>'.$value.'</option>'); + } + putHtml('</select>'); + putHtml('processes'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">'); + putHtml('DebugLevel:'); + putHtml('</td><td style="text-align: left;" colspan="4">'); + putHtml('<select name="zabbix_debuglevel">'); + if (($debuglevel = getVARdef($db, 'ZABBIX_DEBUGLEVEL', $cur_db)) === '') { + $debuglevel = '3'; + } + foreach ($debuglevel_menu as $key => $value) { + $sel = ($debuglevel === (string)$key) ? ' selected="selected"' : ''; + putHtml('<option value="'.$key.'"'.$sel.'>'.$value.'</option>'); + } + putHtml('</select>'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">'); + putHtml('Timeout:'); + putHtml('</td><td style="text-align: left;" colspan="4">'); + putHtml('<select name="zabbix_timeout">'); + if (($timeout = getVARdef($db, 'ZABBIX_TIMEOUT', $cur_db)) === '') { + $timeout = '3'; + } + foreach ($timeout_menu as $key => $value) { + $sel = ($timeout === (string)$key) ? ' selected="selected"' : ''; + putHtml('<option value="'.$key.'"'.$sel.'>'.$value.'</option>'); + } + putHtml('</select>'); + putHtml('secs'); + putHtml('</td></tr>'); + +if (is_file('/usr/bin/zabbix_proxy')) { + putHtml('<tr class="dtrow0"><td class="dialogText" style="text-align: left;" colspan="6">'); + putHtml('<strong>Zabbix Proxy:</strong>'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">'); + putHtml('Proxy:'); + putHtml('</td><td style="text-align: left;" colspan="4">'); + putHtml('<select name="zabbix_proxy">'); + $sel = (getVARdef($db, 'ZABBIX_PROXY', $cur_db) === 'no') ? ' selected="selected"' : ''; + putHtml('<option value="no"'.$sel.'>disabled</option>'); + $sel = (getVARdef($db, 'ZABBIX_PROXY', $cur_db) === 'yes') ? ' selected="selected"' : ''; + putHtml('<option value="yes"'.$sel.'>enabled</option>'); + putHtml('</select>'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">'); + putHtml('Proxy Hostname:'); + putHtml('</td><td style="text-align: left;" colspan="4">'); + if (($value = getVARdef($db, 'ZABBIX_PROXY_HOSTNAME', $cur_db)) === '') { + $value = 'proxy-'.getVARdef($db, 'HOSTNAME', $cur_db); + } + putHtml('<input type="text" size="32" maxlength="128" value="'.$value.'" name="zabbix_proxy_hostname" />'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">'); + putHtml('Route Agent via Proxy:'); + putHtml('</td><td style="text-align: left;" colspan="4">'); + putHtml('<select name="zabbix_proxy_agent">'); + $sel = (getVARdef($db, 'ZABBIX_PROXY_AGENT', $cur_db) === 'yes') ? ' selected="selected"' : ''; + putHtml('<option value="yes"'.$sel.'>enabled</option>'); + $sel = (getVARdef($db, 'ZABBIX_PROXY_AGENT', $cur_db) === 'no') ? ' selected="selected"' : ''; + putHtml('<option value="no"'.$sel.'>disabled</option>'); + putHtml('</select>'); + putHtml('</td></tr>'); +} + + putHtml('</table>'); + putHtml('</form>'); + + putHtml('</center></td></tr></table>'); + putHtml('</center>'); +} // End of HTTP GET +require_once '../common/footer.php'; + +?> Property changes on: branches/1.0/package/webinterface/altweb/admin/zabbix.php ___________________________________________________________________ Added: svn:executable + * Modified: branches/1.0/package/webinterface/altweb/common/functions.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/functions.php 2012-09-01 14:35:35 UTC (rev 5654) +++ branches/1.0/package/webinterface/altweb/common/functions.php 2012-09-01 19:17:59 UTC (rev 5655) @@ -44,7 +44,7 @@ // Function: restartPROCESS // -function restartPROCESS($process, $ret_good, $ret_fail, $start = 'start') { +function restartPROCESS($process, $ret_good, $ret_fail, $start = 'start', $wait = '1') { $result = $ret_fail; $path = getenv('PATH'); $pathOK = ($path !== FALSE && $path !== ''); @@ -61,7 +61,7 @@ } } elseif ($start === 'start') { $cmd .= ';service '.$process.' stop >/dev/null 2>/dev/null'; - $cmd .= ';sleep 1'; + $cmd .= ';sleep '.$wait; $cmd .= ';/usr/sbin/gen-rc-conf'; $cmd .= ';service '.$process.' '.$start.' >/dev/null 2>/dev/null'; } elseif ($process === 'iptables') { @@ -69,7 +69,7 @@ $cmd .= ';service iptables restart >/dev/null 2>/dev/null'; } else { $cmd .= ';service '.$process.' stop >/dev/null 2>/dev/null'; - $cmd .= ';sleep 1'; + $cmd .= ';sleep '.$wait; $cmd .= ';/usr/sbin/gen-rc-conf'; if ($process === 'openvpn' || $process === 'openvpnclient' || $process === 'racoon' || $process === 'pptpd') { $cmd .= ';service iptables restart >/dev/null 2>/dev/null'; Modified: branches/1.0/package/webinterface/altweb/common/status.inc =================================================================== --- branches/1.0/package/webinterface/altweb/common/status.inc 2012-09-01 14:35:35 UTC (rev 5654) +++ branches/1.0/package/webinterface/altweb/common/status.inc 2012-09-01 19:17:59 UTC (rev 5655) @@ -70,6 +70,8 @@ $status['pptpd'] = 0; $status['apcupsd'] = 0; $status['syslogd'] = 0; + $status['zabbix_agentd'] = 0; + $status['zabbix_proxy'] = 0; $status['reboot'] = 0; $tmpfile = tempnam("/tmp", "PHP_"); @@ -95,6 +97,10 @@ $status['pptpd']++; } elseif (strpos($line, ' apcupsd') !== FALSE || strpos($line, '/apcupsd') !== FALSE) { $status['apcupsd']++; + } elseif (strpos($line, ' zabbix_agentd ') !== FALSE || strpos($line, '/zabbix_agentd ') !== FALSE) { + $status['zabbix_agentd']++; + } elseif (strpos($line, ' zabbix_proxy ') !== FALSE || strpos($line, '/zabbix_proxy ') !== FALSE) { + $status['zabbix_proxy']++; } elseif (strpos($line, 'reboot -d') !== FALSE) { $status['reboot']++; } @@ -618,6 +624,16 @@ } } +if (is_file('/etc/zabbix_agentd.conf')) { + putHtml("<h2>Zabbix Monitoring Status:</h2>"); + putHtml("<pre>"); + putText('Zabbix Agent: '.($daemon['zabbix_agentd'] == 0 ? 'ERROR - No' : $daemon['zabbix_agentd']).' active processes'); + if (is_file('/etc/zabbix_proxy.conf')) { + putText('Zabbix Proxy: '.($daemon['zabbix_proxy'] == 0 ? 'ERROR - No' : $daemon['zabbix_proxy']).' active processes'); + } + putHtml("</pre>"); +} + if (($cmd = getPREFdef($global_prefs, 'status_disk_usage')) !== 'no') { putHtml("<h2>Disk Usage:</h2>"); putHtml("<pre>"); Modified: branches/1.0/package/webinterface/altweb/common/version.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/version.php 2012-09-01 14:35:35 UTC (rev 5654) +++ branches/1.0/package/webinterface/altweb/common/version.php 2012-09-01 19:17:59 UTC (rev 5655) @@ -1,6 +1,6 @@ <?php // version.php for AstLinux Alternate Web Interface -$GUI_VERSION = '1.8.14'; +$GUI_VERSION = '1.8.15'; ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2012-09-05 21:19:10
|
Revision: 5664 http://astlinux.svn.sourceforge.net/astlinux/?rev=5664&view=rev Author: abelbeck Date: 2012-09-05 21:19:04 +0000 (Wed, 05 Sep 2012) Log Message: ----------- web interface, Users tab honors a new Prefs tab option to remove voicemail data when a user is deleted, and Voicemail tab, create 'Old' voicemail folder if it doesn't exist Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/prefs.php branches/1.0/package/webinterface/altweb/admin/users.php branches/1.0/package/webinterface/altweb/admin/voicemail.php branches/1.0/package/webinterface/altweb/common/version.php Modified: branches/1.0/package/webinterface/altweb/admin/prefs.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/prefs.php 2012-09-04 21:28:09 UTC (rev 5663) +++ branches/1.0/package/webinterface/altweb/admin/prefs.php 2012-09-05 21:19:04 UTC (rev 5664) @@ -240,6 +240,10 @@ $value = 'users_voicemail_hide_pass = yes'; fwrite($fp, $value."\n"); } + if (isset($_POST['users_delete_vmdata'])) { + $value = 'users_voicemail_delete_vmdata = yes'; + fwrite($fp, $value."\n"); + } $value = 'users_voicemail_context_cmdstr = "'.trim($_POST['voicemail_context']).'"'; fwrite($fp, $value."\n"); $value = 'users_voicemail_reload_cmdstr = "'.trim($_POST['voicemail_reload']).'"'; @@ -780,6 +784,11 @@ putHtml('<tr class="dtrow1"><td style="text-align: right;">'); $sel = (getPREFdef($global_prefs, 'users_voicemail_hide_pass') === 'yes') ? ' checked="checked"' : ''; putHtml('<input type="checkbox" value="users_hide_pass" name="users_hide_pass"'.$sel.' /></td><td colspan="5">Hide Passwords for Voicemail Users Mailboxes</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;">'); + $sel = (getPREFdef($global_prefs, 'users_voicemail_delete_vmdata') === 'yes') ? ' checked="checked"' : ''; + putHtml('<input type="checkbox" value="users_delete_vmdata" name="users_delete_vmdata"'.$sel.' /></td><td colspan="5">Remove User Voicemail Data when User is Deleted</td></tr>'); + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="3">Voicemail Users Context:</td><td colspan="3">'); if (($value = getPREFdef($global_prefs, 'users_voicemail_context_cmdstr')) === '') { $value = 'default'; Modified: branches/1.0/package/webinterface/altweb/admin/users.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/users.php 2012-09-04 21:28:09 UTC (rev 5663) +++ branches/1.0/package/webinterface/altweb/admin/users.php 2012-09-05 21:19:04 UTC (rev 5664) @@ -1,6 +1,6 @@ <?php -// Copyright (C) 2008-2011 Lonnie Abelbeck +// Copyright (C) 2008-2012 Lonnie Abelbeck // This is free software, licensed under the GNU General Public License // version 3 as published by the Free Software Foundation; you can // redistribute it and/or modify it under the terms of the GNU @@ -8,6 +8,7 @@ // users.php for AstLinux // 07-29-2008 +// 09-05-2012, Support Prefs option to remove user VM data when mailbox is deleted // // System location of the asterisk voicemail.conf $VOICEMAILCONF = '/etc/asterisk/voicemail.conf'; @@ -114,6 +115,7 @@ // Function: delVMmailbox // function delVMmailbox($context, $mbox, $fname) { + global $global_prefs; shell('sed -i "/^\['.$context.'\]/,/^\[/ s/^'.$mbox.'[ ]*[=][> ]*[-*0-9]*,.*/;deleted;&/" '.$fname.' >/dev/null', $status); @@ -121,6 +123,14 @@ $status = 1; } else { delHTpasswd($mbox); + # Optionally remove the local VM data for mbox + if (getPREFdef($global_prefs, 'users_voicemail_delete_vmdata') === 'yes') { + if ($context !== '' && $mbox !== '') { // Sanity check + if (is_dir($VMdata = '/var/spool/asterisk/voicemail/'.$context.'/'.$mbox)) { + shell('rm -rf '.$VMdata, $ret_val); + } + } + } } return($status); } Modified: branches/1.0/package/webinterface/altweb/admin/voicemail.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/voicemail.php 2012-09-04 21:28:09 UTC (rev 5663) +++ branches/1.0/package/webinterface/altweb/admin/voicemail.php 2012-09-05 21:19:04 UTC (rev 5664) @@ -1,6 +1,6 @@ <?php -// Copyright (C) 2008 Lonnie Abelbeck +// Copyright (C) 2008-2012 Lonnie Abelbeck // This is free software, licensed under the GNU General Public License // version 3 as published by the Free Software Foundation; you can // redistribute it and/or modify it under the terms of the GNU @@ -11,6 +11,7 @@ // 06-04-2008, Added multi-user support // 07-20-2008, Added special user "staff" permissions // 07-21-2008, Added externnotify support +// 09-05-2012, Automatically create "Old" folder if it doesn't exist // // System location of the asterisk voicemail directory $VOICEMAILDIR = '/var/spool/asterisk/voicemail/'; @@ -254,6 +255,10 @@ $msg['folder'] = $tokens[2]; $msg['basename'] = $tokens[3]; if ($msg['folder'] === 'INBOX' && $folder === 'Old') { + # Later versions of Asterisk no longer automatically create the "Old" folder + if (! is_dir($Old = $msg['dir'].$msg['context'].'/'.$msg['mbox'].'/'.$folder)) { + @mkdir($Old, 0755); + } return(moveVMmessage($msg, $folder)); } elseif ($msg['folder'] === 'Old' && $folder === 'INBOX') { return(moveVMmessage($msg, $folder)); Modified: branches/1.0/package/webinterface/altweb/common/version.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/version.php 2012-09-04 21:28:09 UTC (rev 5663) +++ branches/1.0/package/webinterface/altweb/common/version.php 2012-09-05 21:19:04 UTC (rev 5664) @@ -1,6 +1,6 @@ <?php // version.php for AstLinux Alternate Web Interface -$GUI_VERSION = '1.8.15'; +$GUI_VERSION = '1.8.16'; ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2012-09-23 02:19:34
|
Revision: 5689 http://astlinux.svn.sourceforge.net/astlinux/?rev=5689&view=rev Author: abelbeck Date: 2012-09-23 02:19:24 +0000 (Sun, 23 Sep 2012) Log Message: ----------- web interface, Edit tab, if unsaved edits exist a dialog will warn the user before leaving Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/edit.php Added Paths: ----------- branches/1.0/package/webinterface/altweb/common/murmurhash3_gc.js Modified: branches/1.0/package/webinterface/altweb/admin/edit.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/edit.php 2012-09-21 03:04:04 UTC (rev 5688) +++ branches/1.0/package/webinterface/altweb/admin/edit.php 2012-09-23 02:19:24 UTC (rev 5689) @@ -341,6 +341,24 @@ } putHtml("</center>"); ?> + <script language="JavaScript" type="text/javascript" src="../common/murmurhash3_gc.js"></script> + <script language="JavaScript" type="text/javascript"> + //<![CDATA[ + var old_textHash; + + function setOKexit() { + var cur_textHash = murmurhash3_32_gc(document.getElementById("ed").value, 6802145); + if (cur_textHash != old_textHash) { + return 'Unsaved changes will be lost. Really leave?'; + } + } + + function setOKhandler() { + old_textHash = murmurhash3_32_gc(document.getElementById("ed").value, 6802145); + window.onbeforeunload = setOKexit; + } + //]]> + </script> <center> <table class="layoutNOpad"><tr><td><center> <form method="post" action="<?php echo $myself;?>"> @@ -494,7 +512,7 @@ </td></tr></table> <table width="100%" class="stdtable"> <tr><td width="240" style="text-align: center;"> - <input type="submit" class="formbtn" value="Save Changes" name="submit_save" /> + <input type="submit" class="formbtn" value="Save Changes" name="submit_save" onclick="setOKhandler();" /> <input type="hidden" value="<?php echo $openfile;?>" name="openfile" /> </td><td class="dialogText" style="text-align: center;"> <input type="submit" class="formbtn" value="Reload/Restart" name="submit_reload" /> @@ -518,7 +536,7 @@ $rows = '30'; } putHtml('<table class="stdtable"><tr><td>'); - echo '<textarea name="edit_text" rows="'.$rows.'" cols="'.$cols.'" wrap="off" class="editText">'; + echo '<textarea id="ed" name="edit_text" rows="'.$rows.'" cols="'.$cols.'" wrap="off" class="editText">'; if ($openfile !== '') { if (($ph = @fopen($openfile, "rb")) !== FALSE) { while (! feof($ph)) { @@ -533,8 +551,13 @@ putHtml('</textarea>'); putHtml('</td></tr></table>'); putHtml('</form>'); - putHtml("</center></td></tr></table>"); - putHtml("</center>"); + putHtml('</center></td></tr></table>'); + putHtml('</center>'); + putHtml('<script language="JavaScript" type="text/javascript">'); + putHtml('//<![CDATA['); + putHtml('setOKhandler();'); + putHtml('//]]>'); + putHtml('</script>'); } // End of HTTP GET require_once '../common/footer.php'; Added: branches/1.0/package/webinterface/altweb/common/murmurhash3_gc.js =================================================================== --- branches/1.0/package/webinterface/altweb/common/murmurhash3_gc.js (rev 0) +++ branches/1.0/package/webinterface/altweb/common/murmurhash3_gc.js 2012-09-23 02:19:24 UTC (rev 5689) @@ -0,0 +1,64 @@ +/** + * JS Implementation of MurmurHash3 (r136) (as of May 20, 2011) + * + * @author <a href="mailto:gar...@gm...">Gary Court</a> + * @see http://github.com/garycourt/murmurhash-js + * @author <a href="mailto:aap...@gm...">Austin Appleby</a> + * @see http://sites.google.com/site/murmurhash/ + * + * @param {string} key ASCII only + * @param {number} seed Positive integer only + * @return {number} 32-bit positive integer hash + */ + +function murmurhash3_32_gc(key, seed) { + var remainder, bytes, h1, h1b, c1, c1b, c2, c2b, k1, i; + + remainder = key.length & 3; // key.length % 4 + bytes = key.length - remainder; + h1 = seed; + c1 = 0xcc9e2d51; + c2 = 0x1b873593; + i = 0; + + while (i < bytes) { + k1 = + ((key.charCodeAt(i) & 0xff)) | + ((key.charCodeAt(++i) & 0xff) << 8) | + ((key.charCodeAt(++i) & 0xff) << 16) | + ((key.charCodeAt(++i) & 0xff) << 24); + ++i; + + k1 = ((((k1 & 0xffff) * c1) + ((((k1 >>> 16) * c1) & 0xffff) << 16))) & 0xffffffff; + k1 = (k1 << 15) | (k1 >>> 17); + k1 = ((((k1 & 0xffff) * c2) + ((((k1 >>> 16) * c2) & 0xffff) << 16))) & 0xffffffff; + + h1 ^= k1; + h1 = (h1 << 13) | (h1 >>> 19); + h1b = ((((h1 & 0xffff) * 5) + ((((h1 >>> 16) * 5) & 0xffff) << 16))) & 0xffffffff; + h1 = (((h1b & 0xffff) + 0x6b64) + ((((h1b >>> 16) + 0xe654) & 0xffff) << 16)); + } + + k1 = 0; + + switch (remainder) { + case 3: k1 ^= (key.charCodeAt(i + 2) & 0xff) << 16; + case 2: k1 ^= (key.charCodeAt(i + 1) & 0xff) << 8; + case 1: k1 ^= (key.charCodeAt(i) & 0xff); + + k1 = (((k1 & 0xffff) * c1) + ((((k1 >>> 16) * c1) & 0xffff) << 16)) & 0xffffffff; + k1 = (k1 << 15) | (k1 >>> 17); + k1 = (((k1 & 0xffff) * c2) + ((((k1 >>> 16) * c2) & 0xffff) << 16)) & 0xffffffff; + h1 ^= k1; + } + + h1 ^= key.length; + + h1 ^= h1 >>> 16; + h1 = (((h1 & 0xffff) * 0x85ebca6b) + ((((h1 >>> 16) * 0x85ebca6b) & 0xffff) << 16)) & 0xffffffff; + h1 ^= h1 >>> 13; + h1 = ((((h1 & 0xffff) * 0xc2b2ae35) + ((((h1 >>> 16) * 0xc2b2ae35) & 0xffff) << 16))) & 0xffffffff; + h1 ^= h1 >>> 16; + + return h1 >>> 0; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2012-09-28 20:05:33
|
Revision: 5696 http://astlinux.svn.sourceforge.net/astlinux/?rev=5696&view=rev Author: abelbeck Date: 2012-09-28 20:05:27 +0000 (Fri, 28 Sep 2012) Log Message: ----------- web interface, Status and Prefs tab, added several new options Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/prefs.php branches/1.0/package/webinterface/altweb/common/status.inc Modified: branches/1.0/package/webinterface/altweb/admin/prefs.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/prefs.php 2012-09-27 03:44:39 UTC (rev 5695) +++ branches/1.0/package/webinterface/altweb/admin/prefs.php 2012-09-28 20:05:27 UTC (rev 5696) @@ -12,6 +12,9 @@ // 08-19-2008, Added CDR Log Format Menu // 08-24-2008, Added /mnt/kd/ prefs file support // 01-02-2012, Added Show Jabber Status/Command +// 09-28-2012, Added Show Adaptive Ban Plugin Status +// 09-28-2012, Added Show Latest System Logs/Hide Log Words +// 09-28-2012, Added Show Custom Asterisk Command // $myself = $_SERVER['PHP_SELF']; @@ -96,6 +99,22 @@ $value = 'status_jabber_show_status = yes'; fwrite($fp, $value."\n"); } + if (isset($_POST['custom_asterisk'])) { + $value = 'status_custom_asterisk_status = yes'; + fwrite($fp, $value."\n"); + } + if (($value = trim($_POST['asterisk_name'])) !== '') { + $value = 'status_custom_asterisk_name_cmdstr = "'.$value.'"'; + fwrite($fp, $value."\n"); + } + if (($value = trim($_POST['asterisk_cmd'])) !== '') { + $value = 'status_custom_asterisk_cmdstr = "'.$value.'"'; + fwrite($fp, $value."\n"); + } + if (isset($_POST['adaptive_ban'])) { + $value = 'status_show_adaptive_ban = yes'; + fwrite($fp, $value."\n"); + } if (isset($_POST['firewall_states'])) { $value = 'status_show_firewall_states = yes'; fwrite($fp, $value."\n"); @@ -116,6 +135,15 @@ $value = 'status_show_hardware_monitoring = yes'; fwrite($fp, $value."\n"); } + if (! isset($_POST['system_logs'])) { + $value = 'status_show_system_logs = no'; + fwrite($fp, $value."\n"); + } + if (($value = trim($_POST['exclude_logs'])) !== '') { + $value = 'status_exclude_logs_cmdstr = "'.$value.'"'; + fwrite($fp, $value."\n"); + } + if (isset($_POST['exclude_extensions'])) { $value = 'status_exclude_extensions = yes'; fwrite($fp, $value."\n"); @@ -532,8 +560,23 @@ $value = 'jabber show connections'; } putHtml('<input type="text" size="28" maxlength="64" value="'.$value.'" name="jabber_cmd" /></td></tr>'); - + putHtml('<tr class="dtrow1"><td style="text-align: right;">'); + $sel = (getPREFdef($global_prefs, 'status_custom_asterisk_status') === 'yes') ? ' checked="checked"' : ''; + putHtml('<input type="checkbox" value="custom_asterisk" name="custom_asterisk"'.$sel.' /></td><td colspan="5">Custom Asterisk Name:'); + if (($value = getPREFdef($global_prefs, 'status_custom_asterisk_name_cmdstr')) === '') { + $value = 'Asterisk Command Status'; + } + putHtml('<input type="text" size="28" maxlength="64" value="'.$value.'" name="asterisk_name" /></td></tr>'); + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="3">Custom Asterisk Command:</td><td colspan="3">'); + $value = getPREFdef($global_prefs, 'status_custom_asterisk_cmdstr'); + putHtml('<input type="text" size="28" maxlength="64" value="'.$value.'" name="asterisk_cmd" /></td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;">'); + $sel = (getPREFdef($global_prefs, 'status_show_adaptive_ban') === 'yes') ? ' checked="checked"' : ''; + putHtml('<input type="checkbox" value="adaptive_ban" name="adaptive_ban"'.$sel.' /></td><td colspan="5">Show Adaptive Ban Plugin Status</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;">'); $sel = (getPREFdef($global_prefs, 'status_show_firewall_states') === 'yes') ? ' checked="checked"' : ''; putHtml('<input type="checkbox" value="firewall_states" name="firewall_states"'.$sel.' /></td><td colspan="5">Show Firewall States</td></tr>'); putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">Hide SRC Ports:</td><td colspan="4">'); @@ -549,7 +592,15 @@ putHtml('<tr class="dtrow1"><td style="text-align: right;">'); $sel = (getPREFdef($global_prefs, 'status_show_hardware_monitoring') === 'yes') ? ' checked="checked"' : ''; putHtml('<input type="checkbox" value="hardware_monitoring" name="hardware_monitoring"'.$sel.' /></td><td colspan="5">Show Hardware Monitoring</td></tr>'); + putHtml('<tr class="dtrow1"><td style="text-align: right;">'); + $sel = (getPREFdef($global_prefs, 'status_show_system_logs') !== 'no') ? ' checked="checked"' : ''; + putHtml('<input type="checkbox" value="system_logs" name="system_logs"'.$sel.' /></td><td colspan="5">Show Latest System Logs</td></tr>'); + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">Hide Log Words:</td><td colspan="4">'); + $value = getPREFdef($global_prefs, 'status_exclude_logs_cmdstr'); + putHtml('<input type="text" size="48" maxlength="128" value="'.$value.'" name="exclude_logs" /></td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;">'); $sel = (getPREFdef($global_prefs, 'status_exclude_extensions') === 'yes') ? ' checked="checked"' : ''; putHtml('<input type="checkbox" value="exclude_extensions" name="exclude_extensions"'.$sel.' /></td><td colspan="5">Exclude 4-digit Extensions in SIP/IAX2 Peer Status</td></tr>'); putHtml('<tr class="dtrow1"><td style="text-align: right;">'); @@ -558,7 +609,7 @@ putHtml('<tr class="dtrow1"><td style="text-align: right;">'); $sel = (getPREFdef($global_prefs, 'status_asterisk_manager') === 'no') ? ' checked="checked"' : ''; putHtml('<input type="checkbox" value="disable_ami" name="disable_ami"'.$sel.' /></td><td colspan="5">Disable Asterisk Manager Interface for Asterisk Commands</td></tr>'); - + putHtml('<tr class="dtrow0"><td colspan="6"> </td></tr>'); putHtml('<tr class="dtrow0"><td class="dialogText" style="text-align: left;" colspan="6">'); Modified: branches/1.0/package/webinterface/altweb/common/status.inc =================================================================== --- branches/1.0/package/webinterface/altweb/common/status.inc 2012-09-27 03:44:39 UTC (rev 5695) +++ branches/1.0/package/webinterface/altweb/common/status.inc 2012-09-28 20:05:27 UTC (rev 5696) @@ -26,6 +26,9 @@ // 08-10-2011, Added APC UPS Status // 01-02-2012, Added Jabber Status // 07-07-2012, Added UPnP Status +// 09-28-2012, Added Adaptive Ban Plugin Status +// 09-28-2012, Added Latest System Logs/Hide Log Words +// 09-28-2012, Added Custom Asterisk Command // // System location of OpenVPN Client logfile $OVPNCLOGFILE = '/var/log/openvpnclient-status.log'; @@ -1007,8 +1010,52 @@ @unlink($tmpfile); putHtml("</pre>"); } + + if ($status == 0 && getPREFdef($global_prefs, 'status_custom_asterisk_status') === 'yes') { + if (($cmd = getPREFdef($global_prefs, 'status_custom_asterisk_name_cmdstr')) === '') { + $cmd = 'Asterisk Command Status'; + } + putHtml("<h2>".htmlspecialchars($cmd).":</h2>"); + putHtml("<pre>"); + if (($cmd = getPREFdef($global_prefs, 'status_custom_asterisk_cmdstr')) !== '') { + $tmpfile = tempnam("/tmp", "PHP_"); + asteriskCMD($cmd, $tmpfile); + $ph = @fopen($tmpfile, "r"); + while (! feof($ph)) { + if ($line = trim(fgets($ph, 1024))) { + if (strncasecmp($line, 'verbosity ', 10)) { + putText($line); + } + } + } + fclose($ph); + @unlink($tmpfile); + } + putHtml("</pre>"); + } } +if (is_file('/var/lock/aif_adaptive_ban.lock')) { + if (getPREFdef($global_prefs, 'status_show_adaptive_ban') === 'yes') { + putHtml("<h2>Adaptive Ban Plugin Status:</h2>"); + putHtml("<pre>"); + $tmpfile = tempnam("/tmp", "PHP_"); + $ipv6 = trim(shell_exec('. /etc/rc.conf; if [ "$IPV6" = "yes" ]; then echo "1"; else echo "0"; fi')); + $cmd = '/usr/share/arno-iptables-firewall/plugins/adaptive-ban-helper status /usr/sbin/iptables /usr/sbin/ip6tables '.$ipv6; + shell($cmd.' >'.$tmpfile, $status); + + $ph = @fopen($tmpfile, "r"); + while (! feof($ph)) { + if ($line = trim(fgets($ph, 1024))) { + putText($line); + } + } + fclose($ph); + @unlink($tmpfile); + putHtml("</pre>"); + } +} + if (is_file($CONNTRACK)) { if (getPREFdef($global_prefs, 'status_show_firewall_states') === 'yes') { putHtml("<h2>Firewall States:</h2>"); @@ -1121,19 +1168,33 @@ } if ($daemon['syslogd'] > 0) { - putHtml("<h2>Latest System Logs:</h2>"); - putHtml("<pre>"); - $tmpfile = tempnam("/tmp", "PHP_"); - shell('tail -n 30 /var/log/messages >'.$tmpfile, $status); - $ph = @fopen($tmpfile, "r"); - while (! feof($ph)) { - if ($line = trim(fgets($ph, 1024))) { - putText($line); + if (getPREFdef($global_prefs, 'status_show_system_logs') !== 'no') { + putHtml("<h2>Latest System Logs:</h2>"); + putHtml("<pre>"); + $tmpfile = tempnam("/tmp", "PHP_"); + if (($str = getPREFdef($global_prefs, 'status_exclude_logs_cmdstr')) !== '') { + $exclude_words = explode(' ', $str); + $exclude_logs = ''; + foreach ($exclude_words as $exclude_word) { + if ($exclude_word !== '') { + $exclude_word = strtr($exclude_word, '$`[]\'\\', '......'); // map special chars to dot + $exclude_logs .= " -e '$exclude_word'"; + } + } + shell('grep -v -i '.$exclude_logs.' /var/log/messages | tail -n 30 >'.$tmpfile, $status); + } else { + shell('tail -n 30 /var/log/messages >'.$tmpfile, $status); } + $ph = @fopen($tmpfile, "r"); + while (! feof($ph)) { + if ($line = trim(fgets($ph, 1024))) { + putText($line); + } + } + fclose($ph); + @unlink($tmpfile); + putHtml("</pre>"); } - fclose($ph); - @unlink($tmpfile); - putHtml("</pre>"); } putHtml('<p style="color: orange;">Asterisk® is a registered trademark of Digium, Inc.</p>'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2012-10-27 21:32:08
|
Revision: 5721 http://astlinux.svn.sourceforge.net/astlinux/?rev=5721&view=rev Author: abelbeck Date: 2012-10-27 21:32:01 +0000 (Sat, 27 Oct 2012) Log Message: ----------- web interface, Network tab, Firewall Plugins: list is now marked as: [Active], [Enabled] and [Disabled] Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/firewall.php branches/1.0/package/webinterface/altweb/admin/network.php branches/1.0/package/webinterface/altweb/common/functions.php branches/1.0/package/webinterface/altweb/common/version.php Modified: branches/1.0/package/webinterface/altweb/admin/firewall.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/firewall.php 2012-10-27 18:16:19 UTC (rev 5720) +++ branches/1.0/package/webinterface/altweb/admin/firewall.php 2012-10-27 21:32:01 UTC (rev 5721) @@ -544,7 +544,7 @@ foreach ($plugins as $key => $value) { if (basename($key, '.conf') === $TRAFFIC_SHAPER_PLUGIN) { $TRAFFIC_SHAPER_FILE = $key; - $TRAFFIC_SHAPER_ENABLE = $value; + $TRAFFIC_SHAPER_ENABLE = substr($value, 0, 1); break; } } Modified: branches/1.0/package/webinterface/altweb/admin/network.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/network.php 2012-10-27 18:16:19 UTC (rev 5720) +++ branches/1.0/package/webinterface/altweb/admin/network.php 2012-10-27 21:32:01 UTC (rev 5721) @@ -1279,7 +1279,7 @@ putHtml('Firewall Plugins:'); putHtml('<select name="firewall_plugin">'); foreach ($plugins as $key => $value) { - putHtml('<option value="'.$key.'">'.basename($key, '.conf').' ['.($value === '1' ? 'Enabled' : 'Disabled').']</option>'); + putHtml('<option value="'.$key.'">'.basename($key, '.conf').' ['.substr($value, 2).']</option>'); } putHtml('</select>'); putHtml('–'); Modified: branches/1.0/package/webinterface/altweb/common/functions.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/functions.php 2012-10-27 18:16:19 UTC (rev 5720) +++ branches/1.0/package/webinterface/altweb/common/functions.php 2012-10-27 21:32:01 UTC (rev 5721) @@ -238,6 +238,15 @@ if (! is_dir($dir)) { return(FALSE); } + + // Find the currently active plugins + $active = array(); + $active_file = '/var/tmp/aif_active_plugins'; + if (is_file($active_file)) { + $cmd = "sed -n -r -e 's|^.*/plugins/[0-9][0-9](.*)\\.plugin$|\\1|p' $active_file"; + @exec($cmd, $active); + } + $tmpfile = tempnam("/tmp", "PHP_"); $cmd = 'grep -m1 -H \'^ENABLED=\' '.$dir.'/*.conf |'; $cmd .= 'sed -e \'s/ENABLED=//\' -e \'s/"//g\''; @@ -248,7 +257,21 @@ if ($line = trim(fgets($ph, 1024))) { if (($pos = strpos($line, ':')) !== FALSE) { $linetokens = explode(':', $line); - $plugins[$linetokens[0]] = $linetokens[1]; + if ($linetokens[1] === '0') { + $value = '0~Disabled'; + } elseif ($linetokens[1] === '1') { + $value = '1~Enabled'; + } else { + $value = '0~Undefined'; + } + $plugin_name = basename($linetokens[0], '.conf'); + foreach ($active as $active_name) { + if ($active_name === $plugin_name) { + $value = substr($value, 0, 2).'Active'; + break; + } + } + $plugins[$linetokens[0]] = $value; } } } Modified: branches/1.0/package/webinterface/altweb/common/version.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/version.php 2012-10-27 18:16:19 UTC (rev 5720) +++ branches/1.0/package/webinterface/altweb/common/version.php 2012-10-27 21:32:01 UTC (rev 5721) @@ -1,6 +1,6 @@ <?php // version.php for AstLinux Alternate Web Interface -$GUI_VERSION = '1.8.17'; +$GUI_VERSION = '1.8.18'; ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2012-11-13 16:11:21
|
Revision: 5765 http://astlinux.svn.sourceforge.net/astlinux/?rev=5765&view=rev Author: abelbeck Date: 2012-11-13 16:11:09 +0000 (Tue, 13 Nov 2012) Log Message: ----------- web interface, Network tab -> Network Services: Asterisk SIP-TLS Server Certificate { SIP-TLS Certificate } support Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/network.php branches/1.0/package/webinterface/altweb/common/openssl.php branches/1.0/package/webinterface/altweb/common/version.php Added Paths: ----------- branches/1.0/package/webinterface/altweb/admin/siptlscert.php branches/1.0/package/webinterface/altweb/common/openssl-sip-tls.php Modified: branches/1.0/package/webinterface/altweb/admin/network.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/network.php 2012-11-10 03:14:38 UTC (rev 5764) +++ branches/1.0/package/webinterface/altweb/admin/network.php 2012-11-13 16:11:09 UTC (rev 5765) @@ -778,6 +778,10 @@ $result = saveNETWORKsettings($NETCONFDIR, $NETCONFFILE); header('Location: /admin/dnshosts.php'); exit; + } elseif (isset($_POST['submit_sip_tls'])) { + $result = saveNETWORKsettings($NETCONFDIR, $NETCONFFILE); + header('Location: /admin/siptlscert.php'); + exit; } elseif (isset($_POST['submit_zabbix'])) { $result = saveNETWORKsettings($NETCONFDIR, $NETCONFFILE); header('Location: /admin/zabbix.php'); @@ -1400,6 +1404,10 @@ putHtml('DNS Forwarder & DHCP Server:'); putHtml('<input type="submit" value="Configure DNS Hosts" name="submit_dns_hosts" class="button" /></td></tr>'); + putHtml('<tr class="dtrow1"><td style="text-align: left;" colspan="6">'); + putHtml('Asterisk SIP-TLS Server Certificate:'); + putHtml('<input type="submit" value="SIP-TLS Certificate" name="submit_sip_tls" class="button" /></td></tr>'); + if (is_file('/etc/init.d/zabbix')) { putHtml('<tr class="dtrow1"><td style="text-align: left;" colspan="6">'); putHtml('Zabbix Monitoring:'); Added: branches/1.0/package/webinterface/altweb/admin/siptlscert.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/siptlscert.php (rev 0) +++ branches/1.0/package/webinterface/altweb/admin/siptlscert.php 2012-11-13 16:11:09 UTC (rev 5765) @@ -0,0 +1,365 @@ +<?php + +// Copyright (C) 2008-2012 Lonnie Abelbeck +// This is free software, licensed under the GNU General Public License +// version 3 as published by the Free Software Foundation; you can +// redistribute it and/or modify it under the terms of the GNU +// General Public License; and comes with ABSOLUTELY NO WARRANTY. + +// siptlscert.php for AstLinux +// 11-12-2012 +// +// System location of /mnt/kd/rc.conf.d directory +$SIPTLSCERTCONFDIR = '/mnt/kd/rc.conf.d'; +// System location of gui.siptlscert.conf file +$SIPTLSCERTCONFFILE = '/mnt/kd/rc.conf.d/gui.siptlscert.conf'; + +$myself = $_SERVER['PHP_SELF']; + +require_once '../common/functions.php'; + +require_once '../common/openssl-sip-tls.php'; + +require_once '../common/openssl.php'; + +if (is_file($SIPTLSCERTCONFFILE)) { + $db = parseRCconf($SIPTLSCERTCONFFILE); +} else { + $db = NULL; +} + +// Function: siptlscert_openssl() +// +function siptlscert_openssl($keysize, $dnsname) { + global $global_prefs; + // System location of gui.network.conf file + $NETCONFFILE = '/mnt/kd/rc.conf.d/gui.network.conf'; + + if ($keysize === '') { + $keysize = '2048'; + } + $opts['keysize'] = (int)$keysize; + $opts['dnsname'] = $dnsname; + + if (($countryName = getPREFdef($global_prefs, 'dn_country_name_cmdstr')) === '') { + $countryName = 'US'; + } + if (($stateName = getPREFdef($global_prefs, 'dn_state_name_cmdstr')) === '') { + $stateName = 'Nebraska'; + } + if (($localityName = getPREFdef($global_prefs, 'dn_locality_name_cmdstr')) === '') { + $localityName = 'Omaha'; + } + if (($orgName = getPREFdef($global_prefs, 'dn_org_name_cmdstr')) === '') { + if (($orgName = getPREFdef($global_prefs, 'title_name_cmdstr')) === '') { + $orgName = 'AstLinux Management'; + } + } + if (($orgUnit = getPREFdef($global_prefs, 'dn_org_unit_cmdstr')) === '') { + $orgUnit = 'Asterisk SIP-TLS Server'; + } + if (($commonName = getPREFdef($global_prefs, 'dn_common_name_cmdstr')) === '') { + if (is_file($NETCONFFILE)) { + $vars = parseRCconf($NETCONFFILE); + if (($commonName = getVARdef($vars, 'HOSTNAME').'.'.getVARdef($vars, 'DOMAIN')) === '') { + $commonName = 'pbx.astlinux'; + } + } else { + $commonName = 'pbx.astlinux'; + } + } + if (($email = getPREFdef($global_prefs, 'dn_email_address_cmdstr')) === '') { + $email = 'in...@as...'; + } + $ssl = sip_tls_SETUP($opts, $countryName, $stateName, $localityName, $orgName, $orgUnit, $commonName, $email); + return($ssl); +} +$key_size = getVARdef($db, 'SIPTLSCERT_CERT_KEYSIZE'); +$dns_name = getVARdef($db, 'SIPTLSCERT_CERT_DNSNAME'); +$openssl = siptlscert_openssl($key_size, $dns_name); + +$key_size_menu = array ( + '1024' => '1024 Bits', + '2048' => '2048 Bits' +); + +// Function: saveSIPTLSCERTsettings +// +function saveSIPTLSCERTsettings($conf_dir, $conf_file) { + global $openssl; + + $result = 11; + + if (! is_dir($conf_dir)) { + return(3); + } + if (($fp = @fopen($conf_file,"wb")) === FALSE) { + return(3); + } + fwrite($fp, "### gui.siptlscert.conf - start ###\n###\n"); + + $value = 'SIPTLSCERT_CERT_KEYSIZE="'.$_POST['key_size'].'"'; + fwrite($fp, "### Private Key Size\n".$value."\n"); + + $value = 'SIPTLSCERT_CERT_DNSNAME="'.str_replace(' ', '', $_POST['dns_name']).'"'; + fwrite($fp, "### Server Cert DNS Name\n".$value."\n"); + + fwrite($fp, "### gui.siptlscert.conf - end ###\n"); + fclose($fp); + + return($result); +} + +if ($_SERVER['REQUEST_METHOD'] === 'POST') { + $result = 1; + if (! $global_admin) { + $result = 999; + } elseif (isset($_POST['submit_save'])) { + $result = saveSIPTLSCERTsettings($SIPTLSCERTCONFDIR, $SIPTLSCERTCONFFILE); + } elseif (isset($_POST['submit_edit_sip'])) { + $result = saveSIPTLSCERTsettings($SIPTLSCERTCONFDIR, $SIPTLSCERTCONFFILE); + if (is_writable($file = '/etc/asterisk/sip.conf')) { + header('Location: /admin/edit.php?file='.$file); + exit; + } + } elseif (isset($_POST['submit_new_server'])) { + $result = 99; + if (isset($_POST['confirm_new_server'])) { + opensslDELETEkeys($openssl); + if (is_file($openssl['config'])) { + @unlink($openssl['config']); + } + // Rebuild openssl.cnf template for new CA + $key_size = $_POST['key_size']; + $dns_name = str_replace(' ', '', $_POST['dns_name']); + if (($openssl = siptlscert_openssl($key_size, $dns_name)) !== FALSE) { + if (opensslCREATEselfCert($openssl)) { + if (opensslCREATEserverCert($openssl)) { + $result = 30; + } + } + } + saveSIPTLSCERTsettings($SIPTLSCERTCONFDIR, $SIPTLSCERTCONFFILE); + } else { + $result = 2; + } +// } elseif (isset($_POST['submit_new_client'])) { +// if (($value = trim($_POST['new_client'])) !== '') { +// if (preg_match('/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/', $value)) { +// if (! is_file($openssl['key_dir'].'/'.$value.'.crt') && +// ! is_file($openssl['key_dir'].'/'.$value.'.key')) { +// if (opensslCREATEclientCert($value, $openssl)) { +// saveSIPTLSCERTsettings($SIPTLSCERTCONFDIR, $SIPTLSCERTCONFFILE); +// $result = 31; +// } else { +// $result = 99; +// } +// } else { +// $result = 38; +// } +// } else { +// $result = 39; +// } +// } + } + header('Location: '.$myself.'?result='.$result); + exit; +} elseif (isset($_GET['client']) && $openssl !== FALSE) { + $result = 5; +// $client_list = opensslGETclients($openssl); +// foreach ($client_list as $value) { +// if ($value === (string)$_GET['client']) { +// $result = 1; +// break; +// } +// } +// No clients, only server credentials + if ('server' === (string)$_GET['client']) { + $value = 'asterisk-sip-tls'; + $result = 1; + } + if (! class_exists('ZipArchive')) { + $result = 99; + } elseif ($result == 1) { + $tmpfile = tempnam("/tmp", "ZIP_"); + $zip = new ZipArchive(); + if ($zip->open($tmpfile, ZIPARCHIVE::OVERWRITE) !== TRUE) { + @unlink($tmpfile); + $result = 99; + } else { + $zip->addFile($openssl['key_dir'].'/ca.crt', $value.'/ca.crt'); +// $zip->addFile($openssl['key_dir'].'/'.$value.'.crt', $value.'/'.$value.'.crt'); +// $zip->addFile($openssl['key_dir'].'/'.$value.'.key', $value.'/'.$value.'.key'); +// $p12pass = opensslRANDOMpass(12); +// if (($p12 = opensslPKCS12str($openssl, $value, $p12pass)) !== '') { +// $zip->addFromString($value.'/'.$value.'.p12', $p12); +// $zip->addFromString($value.'/README.txt', opensslREADMEstr(TRUE, $value, $p12pass)); +// } else { +// $zip->addFromString($value.'/README.txt', opensslREADMEstr(FALSE, $value, $p12pass)); +// } + $readme = "Asterisk SIP-TLS Server \"".$openssl['dn']['commonName']."\" Credentials.\n\n"; + $readme .= "ca.crt - A self-signed Certificate Authority (CA).\n\n"; + $zip->addFromString($value.'/README.txt', $readme); + $zip->close(); + + header('Content-Type: application/zip'); + header('Content-Disposition: attachment; filename="credentials-'.$value.'.zip"'); + header('Content-Transfer-Encoding: binary'); + header('Content-Length: '.filesize($tmpfile)); + ob_clean(); + flush(); + @readfile($tmpfile); + @unlink($tmpfile); + exit; + } + } + header('Location: '.$myself.'?result='.$result); + exit; +} else { // Start of HTTP GET +$ACCESS_RIGHTS = 'admin'; +require_once '../common/header.php'; + + putHtml("<center>"); + if (isset($_GET['result'])) { + $result = $_GET['result']; + if ($result == 2) { + putHtml('<p style="color: red;">No Action, check "Confirm" for this action.</p>'); + } elseif ($result == 3) { + putHtml('<p style="color: red;">Error creating file.</p>'); + } elseif ($result == 5) { + putHtml('<p style="color: red;">File Not Found.</p>'); + } elseif ($result == 11) { + putHtml('<p style="color: green;">Settings saved, applies to next "Create New".</p>'); + } elseif ($result == 30) { + putHtml('<p style="color: green;">Settings saved, server credentials automatically generated.</p>'); + } elseif ($result == 31) { + putHtml('<p style="color: green;">Client credentials automatically generated.</p>'); + } elseif ($result == 38) { + putHtml('<p style="color: red;">Client name currently exists, specify a unique client name.</p>'); + } elseif ($result == 39) { + putHtml('<p style="color: red;">Client names must be alphanumeric, underbar (_), dash (-), dot (.)</p>'); + } elseif ($result == 99) { + putHtml('<p style="color: red;">Action Failed.</p>'); + } elseif ($result == 999) { + putHtml('<p style="color: red;">Permission denied for user "'.$global_user.'".</p>'); + } else { + putHtml('<p style="color: orange;">No Action.</p>'); + } + } else { + putHtml('<p> </p>'); + } + putHtml("</center>"); +?> + <center> + <table class="layout"><tr><td><center> + <form id="iform" method="post" action="<?php echo $myself;?>"> + <table width="100%" class="stdtable"> + <tr><td style="text-align: center;" colspan="2"> + <h2>Asterisk SIP-TLS Server Certificate:</h2> + </td></tr><tr><td width="240" style="text-align: center;"> + <input type="submit" class="formbtn" value="Save Settings" name="submit_save" /> + </td><td class="dialogText" style="text-align: center;"> + <input type="submit" value="Edit Asterisk sip.conf" name="submit_edit_sip" class="button" /> + </td></tr></table> + <table class="stdtable"> + <tr class="dtrow0"><td width="140"> </td><td width="50"> </td><td width="100"> </td><td> </td><td width="100"> </td><td width="80"> </td></tr> +<?php +if ($openssl !== FALSE) { + putHtml('<tr class="dtrow0"><td class="dialogText" style="text-align: left;" colspan="6">'); + putHtml('<strong>Server Certificate and Key:</strong>'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">'); + putHtml('Private Key Size:</td><td style="text-align: left;" colspan="4">'); + if (($key_size = getVARdef($db, 'SIPTLSCERT_CERT_KEYSIZE')) === '') { + $key_size = '2048'; + } + putHtml('<select name="key_size">'); + foreach ($key_size_menu as $key => $value) { + $sel = ($key_size === (string)$key) ? ' selected="selected"' : ''; + putHtml('<option value="'.$key.'"'.$sel.'>'.$value.'</option>'); + } + putHtml('</select>'); + putHtml('</td></tr>'); + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">'); + putHtml('Server Cert DNS Name:</td><td style="text-align: left;" colspan="4">'); + if (($value = getVARdef($db, 'SIPTLSCERT_CERT_DNSNAME')) === '') { + $value = getPREFdef($global_prefs, 'dn_common_name_cmdstr'); + } + putHtml('<input type="text" size="24" maxlength="128" value="'.$value.'" name="dns_name" />'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="3">'); + putHtml('Create New Certificate and Key:</td><td class="dialogText" style="text-align: left;" colspan="3">'); + putHtml('<input type="submit" value="Create New" name="submit_new_server" />'); + putHtml('–'); + putHtml('<input type="checkbox" value="new_server" name="confirm_new_server" /> Confirm</td></tr>'); + if (opensslSIPTLSis_valid($openssl)) { + putHtml('<tr class="dtrow1"><td style="color: orange; text-align: center;" colspan="6">'); + putHtml('Note: "Create New" revokes all previous credentials.</td></tr>'); + + putHtml('<tr class="dtrow0"><td class="dialogText" style="text-align: left;" colspan="6">'); + putHtml('<strong>Server Certificate Authority (CA):</strong>'); + putHtml('</td></tr>'); + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="3">'); + putHtml('Server Certificate Authority (CA):'); + echo '</td><td style="text-align: left; padding-top: 6px; padding-bottom: 7px;" colspan="3">', + '<a href="'.$myself.'?client=server" class="actionText">Download</a>'; + putHtml('</td></tr>'); +// putHtml('<tr class="dtrow0"><td class="dialogText" style="text-align: left;" colspan="6">'); +// putHtml('<strong>Client Certificates and Keys:</strong>'); +// putHtml('</td></tr>'); +// putHtml('<tr><td style="text-align: right;" colspan="2">'); +// putHtml('Create New Client:</td><td style="text-align: left;" colspan="4">'); +// putHtml('<input type="text" size="24" maxlength="32" value="" name="new_client" />'); +// putHtml('<input type="submit" value="New Client" name="submit_new_client" />'); +// putHtml('</td></tr>'); +// +// putHtml('<tr><td colspan="6"><center>'); +// $data = opensslGETclients($openssl); +// putHtml('<table width="85%" class="datatable">'); +// putHtml("<tr>"); +// +// if (($n = count($data)) > 0) { +// echo '<td class="dialogText" style="text-align: left; font-weight: bold;">', "Client Name", "</td>"; +// echo '<td class="dialogText" style="text-align: center; font-weight: bold;">', "Credentials", "</td>"; +// for ($i = 0; $i < $n; $i++) { +// putHtml("</tr>"); +// echo '<tr ', ($i % 2 == 0) ? 'class="dtrow0"' : 'class="dtrow1"', '>'; +// echo '<td style="text-align: left;">', $data[$i], '</td>'; +// echo '<td style="text-align: center; padding-top: 6px; padding-bottom: 7px;">', +// '<a href="'.$myself.'?client='.$data[$i].'" class="actionText">Download</a></td>'; +// } +// } else { +// echo '<td style="color: orange; text-align: center;">No SIP-TLS Client Credentials.', '</td>'; +// } +// +// putHtml("</tr>"); +// putHtml("</table>"); +// putHtml('</center></td></tr>'); + putHtml('<tr class="dtrow0"><td class="dialogText" style="text-align: left;" colspan="6"> </td></tr>'); + putHtml('<tr class="dtrow0"><td class="dialogText" style="text-align: left;" colspan="6">'); + putHtml('<strong>Related Asterisk sip.conf snippet:</strong>'); + putHtml('</td></tr>'); + putHtml('<tr class="dtrow0"><td class="dialogText" style="text-align: left; padding-top: 0px; padding-bottom: 0px;" colspan="6">'); + putHtml('<pre>'); + putText(';------------- TLS settings -------------'); + putText('tlscertfile=/mnt/kd/ssl/sip-tls/keys/server.crt'); + putText(''); + putText('tlsprivatekey=/mnt/kd/ssl/sip-tls/keys/server.key'); + putHtml('</pre>'); + putHtml('</td></tr>'); + } else { + putHtml('<tr class="dtrow1"><td style="color: green; text-align: center;" colspan="6">'); + putHtml('Click "Create New" to automatically generate credentials.</td></tr>'); + } +} + + putHtml('</table>'); + putHtml('</form>'); + putHtml('</center></td></tr></table>'); + putHtml('</center>'); +} // End of HTTP GET +require_once '../common/footer.php'; + +?> Property changes on: branches/1.0/package/webinterface/altweb/admin/siptlscert.php ___________________________________________________________________ Added: svn:executable + * Added: branches/1.0/package/webinterface/altweb/common/openssl-sip-tls.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/openssl-sip-tls.php (rev 0) +++ branches/1.0/package/webinterface/altweb/common/openssl-sip-tls.php 2012-11-13 16:11:09 UTC (rev 5765) @@ -0,0 +1,124 @@ +<?php + +// Copyright (C) 2008-2012 Lonnie Abelbeck +// This is free software, licensed under the GNU General Public License +// version 3 as published by the Free Software Foundation; you can +// redistribute it and/or modify it under the terms of the GNU +// General Public License; and comes with ABSOLUTELY NO WARRANTY. + +// openssl-sip-tls.php for AstLinux +// 11-12-2012 +// + +// Function: sip_tls_SETUP() +// +function sip_tls_SETUP($opts, $countryName, $stateName, $localityName, $orgName, $orgUnit, $commonName, $email) { + // System location of OpenSSL default configuration file + $OPENSSL_CNF = '/usr/lib/ssl/openssl.cnf'; + + if (! function_exists('openssl_pkey_new')) { + return(FALSE); + } + + $ssl['base_dir'] = '/mnt/kd/ssl'; + $ssl['dir'] = $ssl['base_dir'].'/sip-tls'; + $ssl['key_dir'] = $ssl['dir'].'/keys'; + $ssl['config'] = $ssl['dir'].'/openssl.cnf'; + $ssl['ca_crt'] = 'file://'.$ssl['key_dir'].'/ca.crt'; + $ssl['ca_key'] = 'file://'.$ssl['key_dir'].'/ca.key'; + $ssl['add_server'] = array( + '', + '[ sip_tls_server ]', + 'basicConstraints=CA:FALSE', + ($opts['dnsname'] !== '' ? 'subjectAltName=DNS:'.$opts['dnsname'] : '#subjectAltName=DNS:tls.astlinux.org'), + 'nsCertType=server', + 'nsComment="Asterisk SIP-TLS Server Certificate"', + 'subjectKeyIdentifier=hash', + 'authorityKeyIdentifier=keyid,issuer:always', + 'keyUsage=digitalSignature,keyEncipherment', + '' + ); + $ssl['configArgs'] = array( + 'config' => $ssl['config'], + 'digest_alg' => 'sha1', + 'private_key_bits' => $opts['keysize'], + 'encrypt_key' => FALSE + ); + $ssl['sign_ca'] = array( + 'config' => $ssl['config'], + 'digest_alg' => 'sha1', + 'private_key_bits' => $opts['keysize'], + 'x509_extensions' => 'v3_ca', + 'encrypt_key' => FALSE + ); + $ssl['sign_server'] = array( + 'config' => $ssl['config'], + 'digest_alg' => 'sha1', + 'private_key_bits' => $opts['keysize'], + 'x509_extensions' => 'sip_tls_server', + 'encrypt_key' => FALSE + ); + $ssl['sign_client'] = array( + 'config' => $ssl['config'], + 'digest_alg' => 'sha1', + 'private_key_bits' => $opts['keysize'], + 'x509_extensions' => 'usr_cert', + 'encrypt_key' => FALSE + ); + + $ssl['dn'] = array( + 'countryName' => $countryName, + 'stateOrProvinceName' => $stateName, + 'localityName' => $localityName, + 'organizationName' => $orgName, + 'organizationalUnitName' => $orgUnit, + 'commonName' => ($opts['dnsname'] !== '' ? $opts['dnsname'] : $commonName), + 'emailAddress' => $email + ); + + if (! is_file($ssl['config'])) { + if (! is_dir($ssl['base_dir'])) { + if (! @mkdir($ssl['base_dir'], 0755)) { + return(FALSE); + } + } + if (! is_dir($ssl['dir'])) { + if (! @mkdir($ssl['dir'], 0755)) { + return(FALSE); + } + } + if (! copy($OPENSSL_CNF, $ssl['config'])) { + return(FALSE); + } + chmod($ssl['config'], 0644); + if (($fp = fopen($ssl['config'], 'a')) === FALSE) { + return(FALSE); + } + foreach($ssl['add_server'] as $line) { + fwrite($fp, $line."\n"); + } + fclose($fp); + } + if (! is_dir($ssl['key_dir'])) { + if (! @mkdir($ssl['key_dir'], 0700)) { + return(FALSE); + } + } + return($ssl); +} + +// Function: opensslSIPTLSis_valid() +// +function opensslSIPTLSis_valid($ssl) { + + if ($ssl !== FALSE) { + if (is_file($ssl['key_dir'].'/ca.crt') && + is_file($ssl['key_dir'].'/ca.key') && + is_file($ssl['key_dir'].'/server.crt') && + is_file($ssl['key_dir'].'/server.key')) { + return(TRUE); + } + } + return(FALSE); +} +?> Property changes on: branches/1.0/package/webinterface/altweb/common/openssl-sip-tls.php ___________________________________________________________________ Added: svn:executable + * Modified: branches/1.0/package/webinterface/altweb/common/openssl.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/openssl.php 2012-11-10 03:14:38 UTC (rev 5764) +++ branches/1.0/package/webinterface/altweb/common/openssl.php 2012-11-13 16:11:09 UTC (rev 5765) @@ -98,7 +98,7 @@ if (($privkey = openssl_pkey_new($ssl['configArgs'])) === FALSE) { return(FALSE); } - $dn = opensslCREATEdn('server', $ssl); + $dn = opensslCREATEdn('', $ssl); if (($csr = openssl_csr_new($dn, $privkey, $ssl['configArgs'])) === FALSE) { return(FALSE); } Modified: branches/1.0/package/webinterface/altweb/common/version.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/version.php 2012-11-10 03:14:38 UTC (rev 5764) +++ branches/1.0/package/webinterface/altweb/common/version.php 2012-11-13 16:11:09 UTC (rev 5765) @@ -1,6 +1,6 @@ <?php // version.php for AstLinux Alternate Web Interface -$GUI_VERSION = '1.8.18'; +$GUI_VERSION = '1.8.19'; ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2013-01-03 22:37:15
|
Revision: 5855 http://astlinux.svn.sourceforge.net/astlinux/?rev=5855&view=rev Author: abelbeck Date: 2013-01-03 22:37:07 +0000 (Thu, 03 Jan 2013) Log Message: ----------- web interface, OpenVPN Server sub-tab, adds a new 'Private Key Size:' entry, 1024 or 2048 Bits Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/openvpn.php branches/1.0/package/webinterface/altweb/common/openssl-openvpn.php branches/1.0/package/webinterface/altweb/common/version.php Modified: branches/1.0/package/webinterface/altweb/admin/openvpn.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/openvpn.php 2013-01-03 19:18:59 UTC (rev 5854) +++ branches/1.0/package/webinterface/altweb/admin/openvpn.php 2013-01-03 22:37:07 UTC (rev 5855) @@ -1,6 +1,6 @@ <?php -// Copyright (C) 2008-2009 Lonnie Abelbeck +// Copyright (C) 2008-2013 Lonnie Abelbeck // This is free software, licensed under the GNU General Public License // version 3 as published by the Free Software Foundation; you can // redistribute it and/or modify it under the terms of the GNU @@ -11,6 +11,7 @@ // 12-27-2008, Added Certificate Support // 02-06-2009, Added tls-verify, temporarily disable clients // 08-13-2010, Added QoS Passthrough, setting passtos +// 01-03-2013, Added private keysize support // // System location of /mnt/kd/rc.conf.d directory $OVPNCONFDIR = '/mnt/kd/rc.conf.d'; @@ -25,13 +26,24 @@ require_once '../common/openssl.php'; +if (is_file($OVPNCONFFILE)) { + $db = parseRCconf($OVPNCONFFILE); +} else { + $db = NULL; +} + // Function: openvpn_openssl() // -function openvpn_openssl() { +function openvpn_openssl($keysize) { global $global_prefs; // System location of gui.network.conf file $NETCONFFILE = '/mnt/kd/rc.conf.d/gui.network.conf'; + if ($keysize === '') { + $keysize = '1024'; + } + $opts['keysize'] = (int)$keysize; + if (($countryName = getPREFdef($global_prefs, 'dn_country_name_cmdstr')) === '') { $countryName = 'US'; } @@ -51,8 +63,8 @@ } if (($commonName = getPREFdef($global_prefs, 'dn_common_name_cmdstr')) === '') { if (is_file($NETCONFFILE)) { - $db = parseRCconf($NETCONFFILE); - if (($commonName = getVARdef($db, 'HOSTNAME').'.'.getVARdef($db, 'DOMAIN')) === '') { + $vars = parseRCconf($NETCONFFILE); + if (($commonName = getVARdef($vars, 'HOSTNAME').'.'.getVARdef($vars, 'DOMAIN')) === '') { $commonName = 'pbx.astlinux'; } } else { @@ -62,10 +74,11 @@ if (($email = getPREFdef($global_prefs, 'dn_email_address_cmdstr')) === '') { $email = 'in...@as...'; } - $ssl = openvpnSETUP($countryName, $stateName, $localityName, $orgName, $orgUnit, $commonName, $email); + $ssl = openvpnSETUP($opts, $countryName, $stateName, $localityName, $orgName, $orgUnit, $commonName, $email); return($ssl); } -$openssl = openvpn_openssl(); +$key_size = getVARdef($db, 'OVPN_CERT_KEYSIZE'); +$openssl = openvpn_openssl($key_size); $cipher_menu = array ( '' => 'Default Cipher', @@ -87,6 +100,11 @@ 'yes' => 'Cert. + User/Pass' ); +$key_size_menu = array ( + '1024' => '1024 Bits', + '2048' => '2048 Bits' +); + // Function: saveOVPNsettings // function saveOVPNsettings($conf_dir, $conf_file, $disabled = NULL) { @@ -150,6 +168,9 @@ } fwrite($fp, '"'."\n"); + $value = 'OVPN_CERT_KEYSIZE="'.$_POST['key_size'].'"'; + fwrite($fp, "### Private Key Size\n".$value."\n"); + if (opensslOPENVPNis_valid($openssl)) { $value = 'OVPN_CA="'.$openssl['key_dir'].'/ca.crt"'; fwrite($fp, "### CA File\n".$value."\n"); @@ -246,7 +267,8 @@ @unlink($openssl['config']); } // Rebuild openssl.cnf template for new CA - if (($openssl = openvpn_openssl()) !== FALSE) { + $key_size = $_POST['key_size']; + if (($openssl = openvpn_openssl($key_size)) !== FALSE) { if (opensslCREATEselfCert($openssl)) { if (opensslCREATEserverCert($openssl)) { if (opensslCREATEdh_pem($openssl)) { @@ -336,12 +358,6 @@ $ACCESS_RIGHTS = 'admin'; require_once '../common/header.php'; - if (is_file($OVPNCONFFILE)) { - $db = parseRCconf($OVPNCONFFILE); - } else { - $db = NULL; - } - putHtml("<center>"); if (isset($_GET['result'])) { $result = $_GET['result']; @@ -558,6 +574,20 @@ putHtml('<tr class="dtrow0"><td class="dialogText" style="text-align: left;" colspan="6">'); putHtml('<strong>Server Certificate and Key:</strong>'); putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">'); + putHtml('Private Key Size:</td><td style="text-align: left;" colspan="4">'); + if (($key_size = getVARdef($db, 'OVPN_CERT_KEYSIZE')) === '') { + $key_size = '1024'; + } + putHtml('<select name="key_size">'); + foreach ($key_size_menu as $key => $value) { + $sel = ($key_size === (string)$key) ? ' selected="selected"' : ''; + putHtml('<option value="'.$key.'"'.$sel.'>'.$value.'</option>'); + } + putHtml('</select>'); + putHtml('</td></tr>'); + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="3">'); putHtml('Create New Certificate and Key:</td><td class="dialogText" style="text-align: left;" colspan="3">'); $msg = ''; Modified: branches/1.0/package/webinterface/altweb/common/openssl-openvpn.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/openssl-openvpn.php 2013-01-03 19:18:59 UTC (rev 5854) +++ branches/1.0/package/webinterface/altweb/common/openssl-openvpn.php 2013-01-03 22:37:07 UTC (rev 5855) @@ -1,6 +1,6 @@ <?php -// Copyright (C) 2008-2009 Lonnie Abelbeck +// Copyright (C) 2008-2013 Lonnie Abelbeck // This is free software, licensed under the GNU General Public License // version 3 as published by the Free Software Foundation; you can // redistribute it and/or modify it under the terms of the GNU @@ -8,11 +8,12 @@ // openssl-openvpn.php for AstLinux // 05-24-2009 +// 01-03-2013, Added private keysize support // // Function: openvpnSETUP() // -function openvpnSETUP($countryName, $stateName, $localityName, $orgName, $orgUnit, $commonName, $email) { +function openvpnSETUP($opts, $countryName, $stateName, $localityName, $orgName, $orgUnit, $commonName, $email) { // System location of OpenSSL default configuration file $OPENSSL_CNF = '/usr/lib/ssl/openssl.cnf'; @@ -42,27 +43,27 @@ $ssl['configArgs'] = array( 'config' => $ssl['config'], 'digest_alg' => 'sha1', - 'private_key_bits' => 1024, + 'private_key_bits' => $opts['keysize'], 'encrypt_key' => FALSE ); $ssl['sign_ca'] = array( 'config' => $ssl['config'], 'digest_alg' => 'sha1', - 'private_key_bits' => 1024, + 'private_key_bits' => $opts['keysize'], 'x509_extensions' => 'v3_ca', 'encrypt_key' => FALSE ); $ssl['sign_server'] = array( 'config' => $ssl['config'], 'digest_alg' => 'sha1', - 'private_key_bits' => 1024, + 'private_key_bits' => $opts['keysize'], 'x509_extensions' => 'openvpn_server', 'encrypt_key' => FALSE ); $ssl['sign_client'] = array( 'config' => $ssl['config'], 'digest_alg' => 'sha1', - 'private_key_bits' => 1024, + 'private_key_bits' => $opts['keysize'], 'x509_extensions' => 'usr_cert', 'encrypt_key' => FALSE ); Modified: branches/1.0/package/webinterface/altweb/common/version.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/version.php 2013-01-03 19:18:59 UTC (rev 5854) +++ branches/1.0/package/webinterface/altweb/common/version.php 2013-01-03 22:37:07 UTC (rev 5855) @@ -1,6 +1,6 @@ <?php // version.php for AstLinux Alternate Web Interface -$GUI_VERSION = '1.8.19'; +$GUI_VERSION = '1.8.20'; ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2013-01-12 03:46:48
|
Revision: 5887 http://astlinux.svn.sourceforge.net/astlinux/?rev=5887&view=rev Author: abelbeck Date: 2013-01-12 03:46:38 +0000 (Sat, 12 Jan 2013) Log Message: ----------- web interface, add XMPP Server (prosody) configuration support Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/edit.php branches/1.0/package/webinterface/altweb/admin/network.php branches/1.0/package/webinterface/altweb/common/license-packages.txt Added Paths: ----------- branches/1.0/package/webinterface/altweb/admin/xmpp.php Modified: branches/1.0/package/webinterface/altweb/admin/edit.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/edit.php 2013-01-11 00:18:23 UTC (rev 5886) +++ branches/1.0/package/webinterface/altweb/admin/edit.php 2013-01-12 03:46:38 UTC (rev 5887) @@ -30,6 +30,7 @@ 'stunnel' => 'Restart Stunnel Proxy', 'miniupnpd' => 'Restart Univ. Plug\'n\'Play', 'apcupsd' => 'Restart UPS Daemon', + 'prosody' => 'Restart XMPP Server', 'zabbix' => 'Restart Zabbix Monitor', 'asterisk' => 'Restart Asterisk', 'cron' => 'Reload Cron for root' @@ -209,6 +210,8 @@ $result = restartPROCESS($process, 36, $result, 'init', 4); } elseif ($process === 'stunnel') { $result = restartPROCESS($process, 37, $result, 'init'); + } elseif ($process === 'prosody') { + $result = restartPROCESS($process, 38, $result, 'init'); } elseif ($process === 'cron') { $result = updateCRON('root', 30, $result); } @@ -318,6 +321,8 @@ putHtml('<p style="color: green;">Zabbix Monitoring has Restarted.</p>'); } elseif ($result == 37) { putHtml('<p style="color: green;">Stunnel Proxy has Restarted.</p>'); + } elseif ($result == 38) { + putHtml('<p style="color: green;">XMPP Server has Restarted.</p>'); } elseif ($result == 99) { putHtml('<p style="color: red;">Action Failed.</p>'); } elseif ($result == 999) { Modified: branches/1.0/package/webinterface/altweb/admin/network.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/network.php 2013-01-11 00:18:23 UTC (rev 5886) +++ branches/1.0/package/webinterface/altweb/admin/network.php 2013-01-12 03:46:38 UTC (rev 5887) @@ -782,6 +782,10 @@ $result = saveNETWORKsettings($NETCONFDIR, $NETCONFFILE); header('Location: /admin/siptlscert.php'); exit; + } elseif (isset($_POST['submit_xmpp'])) { + $result = saveNETWORKsettings($NETCONFDIR, $NETCONFFILE); + header('Location: /admin/xmpp.php'); + exit; } elseif (isset($_POST['submit_zabbix'])) { $result = saveNETWORKsettings($NETCONFDIR, $NETCONFFILE); header('Location: /admin/zabbix.php'); @@ -885,6 +889,8 @@ $result = restartPROCESS($process, 36, $result, 'init', 4); } elseif ($process === 'stunnel') { $result = restartPROCESS($process, 37, $result, 'init'); + } elseif ($process === 'prosody') { + $result = restartPROCESS($process, 38, $result, 'init'); } } else { $result = 2; @@ -957,6 +963,8 @@ putHtml('<p style="color: green;">Zabbix Monitoring has Restarted.</p>'); } elseif ($result == 37) { putHtml('<p style="color: green;">Stunnel Proxy has Restarted.</p>'); + } elseif ($result == 38) { + putHtml('<p style="color: green;">XMPP Server has Restarted.</p>'); } elseif ($result == 99) { putHtml('<p style="color: red;">Action Failed.</p>'); } elseif ($result == 100) { @@ -1038,6 +1046,8 @@ putHtml('<option value="miniupnpd"'.$sel.'>Restart Univ. Plug\'n\'Play</option>'); $sel = ($reboot_restart === 'apcupsd') ? ' selected="selected"' : ''; putHtml('<option value="apcupsd"'.$sel.'>Restart UPS Daemon</option>'); + $sel = ($reboot_restart === 'prosody') ? ' selected="selected"' : ''; + putHtml('<option value="prosody"'.$sel.'>Restart XMPP Server</option>'); $sel = ($reboot_restart === 'zabbix') ? ' selected="selected"' : ''; putHtml('<option value="zabbix"'.$sel.'>Restart Zabbix Monitor</option>'); $sel = ($reboot_restart === 'asterisk') ? ' selected="selected"' : ''; @@ -1408,6 +1418,10 @@ putHtml('Asterisk SIP-TLS Server Certificate:'); putHtml('<input type="submit" value="SIP-TLS Certificate" name="submit_sip_tls" class="button" /></td></tr>'); + putHtml('<tr class="dtrow1"><td style="text-align: left;" colspan="6">'); + putHtml('XMPP Server, Messaging and Presence:'); + putHtml('<input type="submit" value="Configure XMPP" name="submit_xmpp" class="button" /></td></tr>'); + if (is_file('/etc/init.d/zabbix')) { putHtml('<tr class="dtrow1"><td style="text-align: left;" colspan="6">'); putHtml('Zabbix Monitoring:'); Added: branches/1.0/package/webinterface/altweb/admin/xmpp.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/xmpp.php (rev 0) +++ branches/1.0/package/webinterface/altweb/admin/xmpp.php 2013-01-12 03:46:38 UTC (rev 5887) @@ -0,0 +1,469 @@ +<?php + +// Copyright (C) 2013 Lonnie Abelbeck +// This is free software, licensed under the GNU General Public License +// version 3 as published by the Free Software Foundation; you can +// redistribute it and/or modify it under the terms of the GNU +// General Public License; and comes with ABSOLUTELY NO WARRANTY. + +// xmpp.php for AstLinux +// 11-01-2013 +// +// System location of /mnt/kd/rc.conf.d directory +$XMPPCONFDIR = '/mnt/kd/rc.conf.d'; +// System location of gui.xmpp.conf file +$XMPPCONFFILE = '/mnt/kd/rc.conf.d/gui.xmpp.conf'; + +$verbosity_menu = array ( + 'error' => 'Low', + 'warn' => 'Medium', + 'info' => 'High', + 'none' => 'None' +); + +$myself = $_SERVER['PHP_SELF']; + +require_once '../common/functions.php'; + +// Function: get_HOSTNAME_DOMAIN +// +function get_HOSTNAME_DOMAIN() { + $hostname_domain = ''; + + // System location of gui.network.conf file + $NETCONFFILE = '/mnt/kd/rc.conf.d/gui.network.conf'; + + if (is_file($NETCONFFILE)) { + $netvars = parseRCconf($NETCONFFILE); + if (($hostname = getVARdef($netvars, 'HOSTNAME')) !== '') { + if (($domain = getVARdef($netvars, 'DOMAIN')) !== '') { + $hostname_domain = $hostname.'.'.$domain; + } + } + } + return($hostname_domain); +} + +// Function: xmppGETclients +// +function xmppGETclients($vars) { + $id = 0; + + if (is_file('/mnt/kd/prosody/prosody.cfg.lua')) { + $tmpfile = tempnam("/tmp", "PHP_"); + shell('prosodyctl mod_listusers >'.$tmpfile.' 2>/dev/null', $status); + if ($status == 0) { + if (($fh = @fopen($tmpfile, "r")) !== FALSE) { + while (! feof($fh)) { + if (($line = trim(fgets($fh, 1024))) !== '') { + $db['data'][$id]['user'] = $line; + $id++; + } + } + fclose($fh); + } + } + @unlink($tmpfile); + } + // Sort by Username + if ($id > 1) { + foreach ($db['data'] as $key => $row) { + $user[$key] = $row['user']; + } + array_multisort($user, SORT_ASC, SORT_STRING, $db['data']); + } + return($db); +} + +// Function: saveXMPPsettings +// +function saveXMPPsettings($conf_dir, $conf_file) { + $result = 11; + + if (! is_dir($conf_dir)) { + return(3); + } + if (($fp = @fopen($conf_file,"wb")) === FALSE) { + return(3); + } + fwrite($fp, "### gui.xmpp.conf - start ###\n###\n"); + + $value = 'XMPP_ENABLE="'.$_POST['xmpp_enable'].'"'; + fwrite($fp, "### XMPP Enable\n".$value."\n"); + + $value = 'XMPP_ENABLE_S2S="'.$_POST['xmpp_enable_s2s'].'"'; + fwrite($fp, "### XMPP Server to Server Connections\n".$value."\n"); + + $value = 'XMPP_SYSLOG="'.$_POST['verbosity'].'"'; + fwrite($fp, "### Log Syslog\n".$value."\n"); + + $value = 'XMPP_C2S_PORT="'.trim($_POST['xmpp_c2s_port']).'"'; + fwrite($fp, "### Client to Server TCP Port\n".$value."\n"); + + $value = 'XMPP_S2S_PORT="'.trim($_POST['xmpp_s2s_port']).'"'; + fwrite($fp, "### Server to Server TCP Port\n".$value."\n"); + + $value = 'XMPP_HOSTNAME="'.trim($_POST['xmpp_hostname']).'"'; + fwrite($fp, "### XMPP VirtualHost\n".$value."\n"); + + $value = 'XMPP_ADMIN_USERS="'.trim($_POST['xmpp_admin_users']).'"'; + fwrite($fp, "### Admin Users\n".$value."\n"); + + $value = 'XMPP_ENABLE_MODULES="'.trim($_POST['xmpp_enable_modules']).'"'; + fwrite($fp, "### Enable Additional Modules\n".$value."\n"); + + $value = 'XMPP_DISABLE_MODULES="'.trim($_POST['xmpp_disable_modules']).'"'; + fwrite($fp, "### Disable Default Modules\n".$value."\n"); + + $value = 'XMPP_CONFERENCE="'.trim($_POST['xmpp_conference']).'"'; + fwrite($fp, "### Multi-User Chat Conference\n".$value."\n"); + + $value = 'XMPP_CERT=""'; + fwrite($fp, "### Default Certificate Path\n".$value."\n"); + + $value = 'XMPP_KEY=""'; + fwrite($fp, "### Default Key Path\n".$value."\n"); + + fwrite($fp, "### gui.xmpp.conf - end ###\n"); + fclose($fp); + + return($result); +} + +// Function: changeUserPass +// +function changeUserPass() { + + $user = str_replace(' ', '', $_POST['user']); + $pass = str_replace(' ', '', stripslashes($_POST['pass'])); + + if ($user === '') { + return(FALSE); + } + if ($pass === '') { + return(1); + } + if (! is_file('/mnt/kd/prosody/prosody.cfg.lua')) { + return(2); + } + + shell("echo -e '$pass\\n$pass' | prosodyctl passwd '$user' >/dev/null 2>/dev/null", $status); + + return($status == 0 ? TRUE : FALSE); +} + +// Function: addUserPass +// +function addUserPass() { + + $user = str_replace(' ', '', $_POST['user']); + $pass = str_replace(' ', '', stripslashes($_POST['pass'])); + + if ($user === '') { + return(FALSE); + } + if ($pass === '') { + return(1); + } + if (! is_file('/mnt/kd/prosody/prosody.cfg.lua')) { + return(2); + } + if (! preg_match('/^[a-zA-Z0-9][a-zA-Z0-9._-]*[@][a-zA-Z][a-zA-Z0-9._-]*[a-zA-Z]$/', $user)) { + return(4); + } + + shell("echo -e '$pass\\n$pass' | prosodyctl adduser '$user' >/dev/null 2>/dev/null", $status); + + return($status == 0 ? TRUE : FALSE); +} + +// Function: deleteUser +// +function deleteUser($user) { + + if ($user === '') { + return(FALSE); + } + if (! is_file('/mnt/kd/prosody/prosody.cfg.lua')) { + return(2); + } + + shell("prosodyctl deluser '$user' >/dev/null 2>/dev/null", $status); + + return($status == 0 ? TRUE : FALSE); +} + +if (is_file($XMPPCONFFILE)) { + $vars = parseRCconf($XMPPCONFFILE); +} else { + $vars = NULL; +} +$db = xmppGETclients($vars); + +if ($_SERVER['REQUEST_METHOD'] === 'POST') { + $result = 1; + if (! $global_admin) { + $result = 999; + } elseif (isset($_POST['submit_save'])) { + $ok = 0; + $n = count($db['data']); + for ($i = 0; $i < $n; $i++) { + if ($db['data'][$i]['user'] === str_replace(' ', '', $_POST['user'])) { + $ok = changeUserPass(); + break; + } + } + if ($ok === 0) { + $ok = addUserPass(); + } + $result = saveXMPPsettings($XMPPCONFDIR, $XMPPCONFFILE); + if ($result == 11 && $ok === 1) { + $result = 12; + } elseif ($result == 11 && $ok === 4) { + $result = 4; + } elseif ($result == 11 && $ok === TRUE) { + $result = 15; + } + } elseif (isset($_POST['submit_restart'])) { + $result = 99; + if (isset($_POST['confirm_restart'])) { + $result = restartPROCESS('prosody', 10, $result, 'init'); + } else { + $result = 2; + } + } elseif (isset($_POST['submit_delete'])) { + $ok = 0; + $delete = $_POST['delete']; + if (count($delete) > 0) { + foreach ($delete as $deluser) { + if (($ok = deleteUser($deluser)) === FALSE) { + break; + } + } + } + $result = saveXMPPsettings($XMPPCONFDIR, $XMPPCONFFILE); + if ($result == 11 && $ok === FALSE) { + $result = 13; + } elseif ($result == 11 && $ok === TRUE) { + $result = 14; + } + } elseif (isset($_POST['submit_sip_tls'])) { + $result = saveXMPPsettings($XMPPCONFDIR, $XMPPCONFFILE); + header('Location: /admin/siptlscert.php'); + exit; + } + header('Location: '.$myself.'?result='.$result); + exit; +} else { // Start of HTTP GET +$ACCESS_RIGHTS = 'admin'; +require_once '../common/header.php'; + + putHtml('<center>'); + if (isset($_GET['result'])) { + $result = $_GET['result']; + if ($result == 2) { + putHtml('<p style="color: red;">No Action, check "Confirm" for this action.</p>'); + } elseif ($result == 3) { + putHtml('<p style="color: red;">Error creating file.</p>'); + } elseif ($result == 4) { + putHtml('<p style="color: red;">Invalid username, specify a JID, including a host. Example: al...@ex...</p>'); + } elseif ($result == 10) { + putHtml('<p style="color: green;">XMPP Server has Restarted.</p>'); + } elseif ($result == 11) { + putHtml('<p style="color: green;">Settings saved, click "Restart Server" to apply any changed settings.</p>'); + } elseif ($result == 12) { + putHtml('<p style="color: red;">Missing Password, User not added or changed.</p>'); + } elseif ($result == 13) { + putHtml('<p style="color: red;">User(s) failed to be deleted.</p>'); + } elseif ($result == 14) { + putHtml('<p style="color: green;">User(s) successfully deleted.</p>'); + } elseif ($result == 15) { + putHtml('<p style="color: green;">User successfully added or changed.</p>'); + } elseif ($result == 99) { + putHtml('<p style="color: red;">Action Failed.</p>'); + } elseif ($result == 999) { + putHtml('<p style="color: red;">Permission denied for user "'.$global_user.'".</p>'); + } else { + putHtml('<p style="color: orange;">No Action.</p>'); + } + } else { + putHtml('<p> </p>'); + } + putHtml('</center>'); +?> + <center> + <table class="layout"><tr><td><center> + <form method="post" action="<?php echo $myself;?>"> + <table width="100%" class="stdtable"> + <tr><td style="text-align: center;" colspan="3"> + <h2>XMPP Server Configuration:</h2> + </td></tr><tr><td style="text-align: center;"> + <input type="submit" class="formbtn" value="Save Settings" name="submit_save" /> + </td><td style="text-align: center;"> + <input type="submit" class="formbtn" value="Restart Server" name="submit_restart" /> + – + <input type="checkbox" value="restart" name="confirm_restart" /> Confirm + </td><td style="text-align: center;"> + <input type="submit" class="formbtn" value="Delete Checked" name="submit_delete" /> + </td></tr></table> +<?php + + if (isset($_GET['user'])) { + $edit_user = $_GET['user']; + } else { + $edit_user = ''; + } + + putHtml('<table width="100%" class="stdtable">'); + putHtml('<tr class="dtrow0"><td width="180"> </td><td> </td></tr>'); + +if (! is_file('/mnt/kd/ssl/sip-tls/keys/server.crt') || ! is_file('/mnt/kd/ssl/sip-tls/keys/server.key')) { + putHtml('<tr class="dtrow0"><td class="dialogText" style="text-align: left;" colspan="2">'); + putHtml('<strong>Missing SIP-TLS Server Certificate:</strong> <i>(Shared with XMPP)</i>'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;">'); + putHtml('Create SIP-TLS<br />Server Certificate:'); + putHtml('</td><td style="text-align: left;">'); + putHtml('<input type="submit" value="SIP-TLS Certificate" name="submit_sip_tls" class="button" />'); + putHtml('</td></tr>'); +} + putHtml('<tr class="dtrow0"><td class="dialogText" style="text-align: left;" colspan="2">'); + putHtml('<strong>XMPP Configuration Options:</strong>'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;">'); + putHtml('XMPP Server:'); + putHtml('</td><td style="text-align: left;">'); + $xmpp_enable = getVARdef($vars, 'XMPP_ENABLE'); + putHtml('<select name="xmpp_enable">'); + putHtml('<option value="">disabled</option>'); + $sel = ($xmpp_enable === 'yes') ? ' selected="selected"' : ''; + putHtml('<option value="yes"'.$sel.'>enabled</option>'); + putHtml('</select>'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;">'); + putHtml('Server-to-Server<br />Connections:'); + putHtml('</td><td style="text-align: left;">'); + $xmpp_enable_s2s = getVARdef($vars, 'XMPP_ENABLE_S2S'); + putHtml('<select name="xmpp_enable_s2s">'); + putHtml('<option value="no">disabled</option>'); + $sel = ($xmpp_enable_s2s === 'yes') ? ' selected="selected"' : ''; + putHtml('<option value="yes"'.$sel.'>enabled</option>'); + putHtml('</select>'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;">'); + putHtml('Log Verbosity:'); + putHtml('</td><td style="text-align: left;">'); + $verbosity = getVARdef($vars, 'XMPP_SYSLOG'); + putHtml('<select name="verbosity">'); + foreach ($verbosity_menu as $key => $value) { + $sel = ($verbosity === $key) ? ' selected="selected"' : ''; + putHtml('<option value="'.$key.'"'.$sel.'>'.$value.'</option>'); + } + putHtml('</select>'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;">'); + putHtml('Client-to-Server<br />TCP Port:'); + putHtml('</td><td style="text-align: left;">'); + if (($value = getVARdef($vars, 'XMPP_C2S_PORT')) === '') { + $value = '5222'; + } + putHtml('<input type="text" size="10" maxlength="6" name="xmpp_c2s_port" value="'.$value.'" />'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;">'); + putHtml('Server-to-Server<br />TCP Port:'); + putHtml('</td><td style="text-align: left;">'); + if (($value = getVARdef($vars, 'XMPP_S2S_PORT')) === '') { + $value = '5269'; + } + putHtml('<input type="text" size="10" maxlength="6" name="xmpp_s2s_port" value="'.$value.'" />'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;">'); + putHtml('Hostname:'); + putHtml('</td><td style="text-align: left;">'); + if (($hostname = getVARdef($vars, 'XMPP_HOSTNAME')) === '') { + $hostname = get_HOSTNAME_DOMAIN(); + } + putHtml('<input type="text" size="56" maxlength="200" name="xmpp_hostname" value="'.$hostname.'" />'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;">'); + putHtml('Admin Users:'); + putHtml('</td><td style="text-align: left;">'); + $value = getVARdef($vars, 'XMPP_ADMIN_USERS'); + putHtml('<input type="text" size="56" maxlength="200" name="xmpp_admin_users" value="'.$value.'" />'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;">'); + putHtml('Enable Additional<br />Modules:'); + putHtml('</td><td style="text-align: left;">'); + $value = getVARdef($vars, 'XMPP_ENABLE_MODULES'); + putHtml('<input type="text" size="56" maxlength="200" name="xmpp_enable_modules" value="'.$value.'" />'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;">'); + putHtml('Disable Default<br />Modules:'); + putHtml('</td><td style="text-align: left;">'); + $value = getVARdef($vars, 'XMPP_DISABLE_MODULES'); + putHtml('<input type="text" size="56" maxlength="200" name="xmpp_disable_modules" value="'.$value.'" />'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;">'); + putHtml('Multi-User Chat<br />Conference:'); + putHtml('</td><td style="text-align: left;">'); + $value = getVARdef($vars, 'XMPP_CONFERENCE'); + putHtml('<input type="text" size="56" maxlength="200" name="xmpp_conference" value="'.$value.'" />'); + putHtml('</td></tr>'); +if ($value === '') { + putHtml('<tr class="dtrow1"><td style="text-align: right;"><i>Example:</i></td><td style="text-align: left;">'); + putHtml('<i>conference.'.$hostname.'</i>'); + putHtml('</td></tr>'); +} + +if (is_file('/mnt/kd/prosody/prosody.cfg.lua')) { + putHtml('<tr class="dtrow0"><td class="dialogText" style="text-align: left;" colspan="2">'); + putHtml('<strong>Client Credentials:</strong>'); + putHtml('</td></tr>'); + putHtml('<tr><td style="text-align: right;">'); + putHtml('Username:'); + putHtml('</td><td style="text-align: left;">'); + putHtml('<input type="text" size="46" maxlength="128" name="user" value="'.$edit_user.'" />'); + putHtml('</td></tr>'); + putHtml('<tr><td style="text-align: right;">'); + putHtml('Password:'); + putHtml('</td><td style="text-align: left;">'); + putHtml('<input type="password" size="46" maxlength="128" name="pass" value="" />'); + putHtml('</td></tr>'); + putHtml('</table>'); + + putHtml('<table width="66%" class="datatable">'); + putHtml("<tr>"); + + if (($n = count($db['data'])) > 0) { + echo '<td class="dialogText" style="text-align: left; font-weight: bold;">', "Users", "</td>"; + echo '<td class="dialogText" style="text-align: center; font-weight: bold;">', "Delete", "</td>"; + for ($i = 0; $i < $n; $i++) { + putHtml("</tr>"); + echo '<tr ', ($i % 2 == 0) ? 'class="dtrow0"' : 'class="dtrow1"', '>'; + echo '<td><a href="'.$myself.'?user='.$db['data'][$i]['user'].'" class="actionText">'.$db['data'][$i]['user'].'</a>', '</td>'; + echo '<td style="text-align: center;">', '<input type="checkbox" name="delete[]" value="', $db['data'][$i]['user'], '" />', '</td>'; + } + } else { + echo '<td style="color: orange; text-align: center;">No Client Credentials.', '</td>'; + } + putHtml("</tr>"); +} + putHtml("</table>"); + putHtml("</form>"); + putHtml("</center></td></tr></table>"); + putHtml("</center>"); +} // End of HTTP GET +require_once '../common/footer.php'; + +?> Property changes on: branches/1.0/package/webinterface/altweb/admin/xmpp.php ___________________________________________________________________ Added: svn:executable + * Modified: branches/1.0/package/webinterface/altweb/common/license-packages.txt =================================================================== --- branches/1.0/package/webinterface/altweb/common/license-packages.txt 2013-01-11 00:18:23 UTC (rev 5886) +++ branches/1.0/package/webinterface/altweb/common/license-packages.txt 2013-01-12 03:46:38 UTC (rev 5887) @@ -37,3 +37,6 @@ MS-Win Installer~Copyright (c) 2010-2011 Tom Chadwin, Nullsoft, et al. SILK CODEC~Copyright (c) 2010-2012 Skype and/or Microsoft. All rights reserved. Licensed via Digium, Inc. SpanDSP~Copyright (c) 2003-2012 Steve Underwood <st...@co...>. All rights reserved. +Prosody~Copyright (c) 2008-2010 Matthew Wild and Waqas Hussain. +Lua~Copyright (c) 1994-2012 Lua.org, PUC-Rio. All rights reserved. +perl~Copyright (c) 1987-2012 by Larry Wall, et al. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2013-01-21 08:25:16
|
Revision: 5918 http://astlinux.svn.sourceforge.net/astlinux/?rev=5918&view=rev Author: abelbeck Date: 2013-01-21 08:25:09 +0000 (Mon, 21 Jan 2013) Log Message: ----------- web interface, add XMPP_GROUPS and prosody Status tab support Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/edit.php branches/1.0/package/webinterface/altweb/admin/prefs.php branches/1.0/package/webinterface/altweb/admin/xmpp.php branches/1.0/package/webinterface/altweb/common/status.inc Modified: branches/1.0/package/webinterface/altweb/admin/edit.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/edit.php 2013-01-21 08:08:32 UTC (rev 5917) +++ branches/1.0/package/webinterface/altweb/admin/edit.php 2013-01-21 08:25:09 UTC (rev 5918) @@ -1,6 +1,6 @@ <?php -// Copyright (C) 2008-2011 Lonnie Abelbeck +// Copyright (C) 2008-2013 Lonnie Abelbeck // This is free software, licensed under the GNU General Public License // version 3 as published by the Free Software Foundation; you can // redistribute it and/or modify it under the terms of the GNU @@ -251,6 +251,7 @@ $dir === '/mnt/kd/rc.conf.d' || $dir === '/mnt/kd/crontabs' || $dir === '/mnt/kd/apcupsd' || + $dir === '/mnt/kd/prosody' || $dir === '/mnt/kd/docs' || $dir === '/mnt/kd/arno-iptables-firewall' || $dir === '/mnt/kd/arno-iptables-firewall/plugins' || @@ -460,6 +461,14 @@ $sel = ($file === $openfile) ? ' selected="selected"' : ''; putHtml('<option value="'.$file.'"'.$sel.'>'.basename($file).' - Net Interface Rules</option>'); } + if (is_writable($file = '/mnt/kd/prosody/prosody.conf')) { + $sel = ($file === $openfile) ? ' selected="selected"' : ''; + putHtml('<option value="'.$file.'"'.$sel.'>prosody/'.basename($file).' - XMPP Configuration</option>'); + } + if (is_writable($file = '/mnt/kd/prosody/sharedgroups.conf')) { + $sel = ($file === $openfile) ? ' selected="selected"' : ''; + putHtml('<option value="'.$file.'"'.$sel.'>prosody/'.basename($file).' - XMPP Shared Groups</option>'); + } putHtml('</optgroup>'); if (is_dir('/mnt/kd/docs')) { putHtml('<optgroup label="———— Documentation ————">'); Modified: branches/1.0/package/webinterface/altweb/admin/prefs.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/prefs.php 2013-01-21 08:08:32 UTC (rev 5917) +++ branches/1.0/package/webinterface/altweb/admin/prefs.php 2013-01-21 08:25:09 UTC (rev 5918) @@ -1,6 +1,6 @@ <?php -// Copyright (C) 2008-2012 Lonnie Abelbeck +// Copyright (C) 2008-2013 Lonnie Abelbeck // This is free software, licensed under the GNU General Public License // version 3 as published by the Free Software Foundation; you can // redistribute it and/or modify it under the terms of the GNU @@ -15,6 +15,7 @@ // 09-28-2012, Added Show Adaptive Ban Plugin Status // 09-28-2012, Added Show Latest System Logs/Hide Log Words // 09-28-2012, Added Show Custom Asterisk Command +// 01-20-2013, Added Show XMPP Server Status // $myself = $_SERVER['PHP_SELF']; @@ -111,6 +112,10 @@ $value = 'status_custom_asterisk_cmdstr = "'.$value.'"'; fwrite($fp, $value."\n"); } + if (! isset($_POST['xmpp_server'])) { + $value = 'status_show_xmpp_server = no'; + fwrite($fp, $value."\n"); + } if (isset($_POST['adaptive_ban'])) { $value = 'status_show_adaptive_ban = yes'; fwrite($fp, $value."\n"); @@ -573,6 +578,10 @@ putHtml('<input type="text" size="28" maxlength="64" value="'.$value.'" name="asterisk_cmd" /></td></tr>'); putHtml('<tr class="dtrow1"><td style="text-align: right;">'); + $sel = (getPREFdef($global_prefs, 'status_show_xmpp_server') !== 'no') ? ' checked="checked"' : ''; + putHtml('<input type="checkbox" value="xmpp_server" name="xmpp_server"'.$sel.' /></td><td colspan="5">Show XMPP Server Status</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;">'); $sel = (getPREFdef($global_prefs, 'status_show_adaptive_ban') === 'yes') ? ' checked="checked"' : ''; putHtml('<input type="checkbox" value="adaptive_ban" name="adaptive_ban"'.$sel.' /></td><td colspan="5">Show Adaptive Ban Plugin Status</td></tr>'); Modified: branches/1.0/package/webinterface/altweb/admin/xmpp.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/xmpp.php 2013-01-21 08:08:32 UTC (rev 5917) +++ branches/1.0/package/webinterface/altweb/admin/xmpp.php 2013-01-21 08:25:09 UTC (rev 5918) @@ -114,6 +114,9 @@ $value = 'XMPP_S2S_PORT="'.trim($_POST['xmpp_s2s_port']).'"'; fwrite($fp, "### Server to Server TCP Port\n".$value."\n"); + $value = 'XMPP_GROUPS="'.$_POST['xmpp_groups'].'"'; + fwrite($fp, "### Shared Groups\n".$value."\n"); + $value = 'XMPP_C2S_IDLE_TIMEOUT="'.$_POST['idle_timeout'].'"'; fwrite($fp, "### Dead Client Timeout\n".$value."\n"); @@ -207,6 +210,25 @@ return($status == 0 ? TRUE : FALSE); } +// Function: reloadModule +// +function reloadModule($mod) { + + if ($mod === '') { + return(FALSE); + } + if (! is_file('/mnt/kd/prosody/prosody.cfg.lua')) { + return(2); + } + if (! is_file('/var/run/prosody/prosody.pid')) { + return(3); + } + + shell('prosodycmd \'module:reload("'.$mod.'")\' >/dev/null 2>/dev/null', $status); + + return($status == 0 ? TRUE : FALSE); +} + if (is_file($XMPPCONFFILE)) { $vars = parseRCconf($XMPPCONFFILE); } else { @@ -261,10 +283,21 @@ } elseif ($result == 11 && $ok === TRUE) { $result = 14; } + } elseif (isset($_POST['submit_reload_groups'])) { + $result = 99; + if (reloadModule('groups') === TRUE) { + $result = 16; + } } elseif (isset($_POST['submit_sip_tls'])) { $result = saveXMPPsettings($XMPPCONFDIR, $XMPPCONFFILE); header('Location: /admin/siptlscert.php'); exit; + } elseif (isset($_POST['submit_edit_groups'])) { + $result = saveXMPPsettings($XMPPCONFDIR, $XMPPCONFFILE); + if (is_writable($file = '/mnt/kd/prosody/sharedgroups.conf')) { + header('Location: /admin/edit.php?file='.$file); + exit; + } } header('Location: '.$myself.'?result='.$result); exit; @@ -293,6 +326,8 @@ putHtml('<p style="color: green;">User(s) successfully deleted.</p>'); } elseif ($result == 15) { putHtml('<p style="color: green;">User successfully added or changed.</p>'); + } elseif ($result == 16) { + putHtml('<p style="color: green;">Shared Groups Reloaded.</p>'); } elseif ($result == 99) { putHtml('<p style="color: red;">Action Failed.</p>'); } elseif ($result == 999) { @@ -399,6 +434,23 @@ putHtml('</td></tr>'); putHtml('<tr class="dtrow1"><td style="text-align: right;">'); + putHtml('Shared Groups:'); + putHtml('</td><td style="text-align: left;">'); + $xmpp_groups = getVARdef($vars, 'XMPP_GROUPS'); + putHtml('<select name="xmpp_groups">'); + putHtml('<option value="no">disabled</option>'); + $sel = ($xmpp_groups === 'yes') ? ' selected="selected"' : ''; + putHtml('<option value="yes"'.$sel.'>enabled</option>'); + putHtml('</select>'); + if (is_file('/mnt/kd/prosody/sharedgroups.conf')) { + putHtml('–'); + putHtml('<input type="submit" value="Edit Groups" name="submit_edit_groups" class="button" />'); + putHtml('–'); + putHtml('<input type="submit" value="Reload" name="submit_reload_groups" class="button" />'); + } + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;">'); putHtml('Server-to-Client<br />Keep Alive Ping:'); putHtml('</td><td style="text-align: left;">'); $idle_timeout = getVARdef($vars, 'XMPP_C2S_IDLE_TIMEOUT'); Modified: branches/1.0/package/webinterface/altweb/common/status.inc =================================================================== --- branches/1.0/package/webinterface/altweb/common/status.inc 2013-01-21 08:08:32 UTC (rev 5917) +++ branches/1.0/package/webinterface/altweb/common/status.inc 2013-01-21 08:25:09 UTC (rev 5918) @@ -1,6 +1,6 @@ <?php -// Copyright (C) 2008-2012 Lonnie Abelbeck +// Copyright (C) 2008-2013 Lonnie Abelbeck // This is free software, licensed under the GNU General Public License // version 3 as published by the Free Software Foundation; you can // redistribute it and/or modify it under the terms of the GNU @@ -29,6 +29,7 @@ // 09-28-2012, Added Adaptive Ban Plugin Status // 09-28-2012, Added Latest System Logs/Hide Log Words // 09-28-2012, Added Custom Asterisk Command +// 01-20-2013, Added XMPP Server Status // // System location of OpenVPN Client logfile $OVPNCLOGFILE = '/var/log/openvpnclient-status.log'; @@ -1035,6 +1036,29 @@ } } +if (is_file('/var/run/prosody/prosody.pid')) { + if (getPREFdef($global_prefs, 'status_show_xmpp_server') !== 'no') { + putHtml("<h2>XMPP Server Status:</h2>"); + putHtml("<pre>"); + $tmpfile = tempnam("/tmp", "PHP_"); + $cmd = "/usr/bin/prosodycmd 'server:version()' 'server:uptime()' 'c2s:show()'"; + if (trim(shell_exec('. /etc/rc.conf; echo "$XMPP_ENABLE_S2S"')) === 'yes') { + $cmd .= " 's2s:show()'"; + } + shell($cmd.' >'.$tmpfile, $status); + + $ph = @fopen($tmpfile, "r"); + while (! feof($ph)) { + if ($line = rtrim(fgets($ph, 1024))) { + putText($line); + } + } + fclose($ph); + @unlink($tmpfile); + putHtml("</pre>"); + } +} + if (is_file('/var/lock/aif_adaptive_ban.lock')) { if (getPREFdef($global_prefs, 'status_show_adaptive_ban') === 'yes') { putHtml("<h2>Adaptive Ban Plugin Status:</h2>"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2013-01-21 18:57:39
|
Revision: 5919 http://astlinux.svn.sourceforge.net/astlinux/?rev=5919&view=rev Author: abelbeck Date: 2013-01-21 18:57:32 +0000 (Mon, 21 Jan 2013) Log Message: ----------- web interface, Staff tab - add 'Restart Asterisk', more prosody tweaks Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/staff.php branches/1.0/package/webinterface/altweb/admin/xmpp.php branches/1.0/package/webinterface/altweb/common/status.inc Modified: branches/1.0/package/webinterface/altweb/admin/staff.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/staff.php 2013-01-21 08:25:09 UTC (rev 5918) +++ branches/1.0/package/webinterface/altweb/admin/staff.php 2013-01-21 18:57:32 UTC (rev 5919) @@ -1,6 +1,6 @@ <?php -// Copyright (C) 2008-2010 Lonnie Abelbeck +// Copyright (C) 2008-2013 Lonnie Abelbeck // This is free software, licensed under the GNU General Public License // version 3 as published by the Free Software Foundation; you can // redistribute it and/or modify it under the terms of the GNU @@ -8,6 +8,7 @@ // staff.php for AstLinux // 12-12-2009 +// 01-21-2013, Add Restart Asterisk // // System location of webgui-staff-backup.conf $CONFFILE = '/mnt/kd/webgui-staff-backup.conf'; @@ -134,6 +135,16 @@ header('Location: '.$myself.'?reboot_delay='.$delay.'&result='.$result); exit; } + } elseif (isset($_POST['submit_restart_asterisk'])) { + $result = 99; + if (isset($_POST['confirm_restart_asterisk'])) { + $mesg = date('Y-m-d H:i:s').' RESTART_ASTERISK Remote Address: '.$_SERVER['REMOTE_ADDR']; + @file_put_contents($LOGFILE, $mesg."\n", FILE_APPEND); + chmod($LOGFILE, 0600); + $result = restartPROCESS('asterisk', 25, $result); + } else { + $result = 7; + } } elseif (isset($_POST['submit_shutdown'])) { $result = 99; if (isset($_POST['confirm_shutdown'])) { @@ -166,6 +177,8 @@ putHtml('<p style="color: green;">System is Rebooting... back in <span id="count_down"><script language="JavaScript" type="text/javascript">document.write(count_down_secs);</script></span> seconds.</p>'); } elseif ($result == 15) { putHtml('<p style="color: red;">Backup Failed, error archiving unionfs partition.</p>'); + } elseif ($result == 25) { + putHtml('<p style="color: green;">Asterisk has Restarted.</p>'); } elseif ($result == 40) { putHtml('<p style="color: green;">Reboot Scheduled within 24 hours.</p>'); } elseif ($result == 41) { @@ -203,6 +216,14 @@ } putHtml('<tr><td style="text-align: center;">'); + putHtml('<h2>Restart Asterisk:</h2>'); + putHtml('</td></tr><tr><td class="dialogText" style="text-align: center;">'); + putHtml('<input type="submit" value="Restart Asterisk" name="submit_restart_asterisk" />'); + putHtml('–'); + putHtml('<input type="checkbox" value="restart_asterisk" name="confirm_restart_asterisk" /> Confirm'); + putHtml('</td></tr>'); + + putHtml('<tr><td style="text-align: center;">'); putHtml('<h2>Reboot/Restart System:</h2>'); putHtml('</td></tr><tr><td class="dialogText" style="text-align: center;">'); putHtml('<select name="reboot_delay">'); Modified: branches/1.0/package/webinterface/altweb/admin/xmpp.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/xmpp.php 2013-01-21 08:25:09 UTC (rev 5918) +++ branches/1.0/package/webinterface/altweb/admin/xmpp.php 2013-01-21 18:57:32 UTC (rev 5919) @@ -445,8 +445,10 @@ if (is_file('/mnt/kd/prosody/sharedgroups.conf')) { putHtml('–'); putHtml('<input type="submit" value="Edit Groups" name="submit_edit_groups" class="button" />'); - putHtml('–'); - putHtml('<input type="submit" value="Reload" name="submit_reload_groups" class="button" />'); + if ($xmpp_groups === 'yes') { + putHtml('–'); + putHtml('<input type="submit" value="Reload" name="submit_reload_groups" class="button" />'); + } } putHtml('</td></tr>'); Modified: branches/1.0/package/webinterface/altweb/common/status.inc =================================================================== --- branches/1.0/package/webinterface/altweb/common/status.inc 2013-01-21 08:25:09 UTC (rev 5918) +++ branches/1.0/package/webinterface/altweb/common/status.inc 2013-01-21 18:57:32 UTC (rev 5919) @@ -1048,6 +1048,11 @@ shell($cmd.' >'.$tmpfile, $status); $ph = @fopen($tmpfile, "r"); + if (! feof($ph)) { + if ($line = rtrim(fgets($ph, 1024))) { + putText('Prosody Version: '.$line); + } + } while (! feof($ph)) { if ($line = rtrim(fgets($ph, 1024))) { putText($line); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2013-01-21 19:55:16
|
Revision: 5920 http://astlinux.svn.sourceforge.net/astlinux/?rev=5920&view=rev Author: abelbeck Date: 2013-01-21 19:55:09 +0000 (Mon, 21 Jan 2013) Log Message: ----------- web interface, add Topic Info for XMPP Shared Groups Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/xmpp.php branches/1.0/package/webinterface/altweb/common/topics.info Modified: branches/1.0/package/webinterface/altweb/admin/xmpp.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/xmpp.php 2013-01-21 18:57:32 UTC (rev 5919) +++ branches/1.0/package/webinterface/altweb/admin/xmpp.php 2013-01-21 19:55:09 UTC (rev 5920) @@ -434,7 +434,7 @@ putHtml('</td></tr>'); putHtml('<tr class="dtrow1"><td style="text-align: right;">'); - putHtml('Shared Groups:'); + putHtml(includeTOPICinfo('xmpp-shared-groups').'Shared Groups:'); putHtml('</td><td style="text-align: left;">'); $xmpp_groups = getVARdef($vars, 'XMPP_GROUPS'); putHtml('<select name="xmpp_groups">'); Modified: branches/1.0/package/webinterface/altweb/common/topics.info =================================================================== --- branches/1.0/package/webinterface/altweb/common/topics.info 2013-01-21 18:57:32 UTC (rev 5919) +++ branches/1.0/package/webinterface/altweb/common/topics.info 2013-01-21 19:55:09 UTC (rev 5920) @@ -284,3 +284,32 @@ ---- /etc/asterisk/extensions.conf snippet ---- +[[xmpp-shared-groups]] + +XMPP Shared Groups: + +Groups were designed to allow administrators to create virtual groups of users that automatically +see each other in their contact lists. The shared groups will be sent to the user along with +their usual roster without overriding or permanently adding the contacts. There is no need for +the user to authorize these contacts in their contact list, this is done automatically on the +server (be careful: everyone in a group can monitor the presence of each other!). + +As an example, if you have a team of people working together on a project, you can create a group +for that team. They will automatically be added to each others' contact lists, and the list can +easily be modified on the server at any time to add and remove people. + +Note: Clicking "Shared Groups: ... - { Reload }" will apply { Edit Groups } changes without + requiring to the server to be restarted. + +Example: "/mnt/kd/prosody/sharedgroups.conf" +-- +[Support Team] +su...@ex... +jo...@ex... + +[Development Team] +ha...@ex...=Joe Coder +ot...@ex...=Mel +-- +You can see the last two entries here have custom names, if no name is given then it is up to +the user's client to find a suitable name (e.g. take it from the contact's vcard/profile). This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |