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. |