From: <abe...@us...> - 2016-10-14 22:04:58
|
Revision: 7890 http://sourceforge.net/p/astlinux/code/7890 Author: abelbeck Date: 2016-10-14 22:04:56 +0000 (Fri, 14 Oct 2016) Log Message: ----------- webinterface, Status tab, check for known default 'admin' password and issue a warning if the default Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/prefs.php branches/1.0/package/webinterface/altweb/common/functions.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 2016-10-14 21:06:29 UTC (rev 7889) +++ branches/1.0/package/webinterface/altweb/admin/prefs.php 2016-10-14 22:04:56 UTC (rev 7890) @@ -169,10 +169,6 @@ $value = 'status_exclude_extensions = yes'; fwrite($fp, $value."\n"); } - if (isset($_POST['pass_warn'])) { - $value = 'status_password_warning = no'; - fwrite($fp, $value."\n"); - } if (isset($_POST['status_auth'])) { $value = 'status_require_auth = yes'; fwrite($fp, $value."\n"); @@ -709,9 +705,6 @@ $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;">'); - $sel = (getPREFdef($global_prefs, 'status_password_warning') === 'no') ? ' checked="checked"' : ''; - putHtml('<input type="checkbox" value="pass_warn" name="pass_warn"'.$sel.' /></td><td colspan="5">Disable "Password not set" Warning</td></tr>'); - 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>'); Modified: branches/1.0/package/webinterface/altweb/common/functions.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/functions.php 2016-10-14 21:06:29 UTC (rev 7889) +++ branches/1.0/package/webinterface/altweb/common/functions.php 2016-10-14 22:04:56 UTC (rev 7890) @@ -861,13 +861,6 @@ return($value); } -// Function: noASTLINUX -// -function noASTLINUX() -{ - return(is_file('/etc/astlinux-no')); -} - // Function: isDNSCRYPT // function isDNSCRYPT() Modified: branches/1.0/package/webinterface/altweb/common/status.inc =================================================================== --- branches/1.0/package/webinterface/altweb/common/status.inc 2016-10-14 21:06:29 UTC (rev 7889) +++ branches/1.0/package/webinterface/altweb/common/status.inc 2016-10-14 22:04:56 UTC (rev 7890) @@ -35,6 +35,7 @@ // 09-04-2014, Added Kamailio SIP Server Status // 10-28-2014, Added S.M.A.R.T Monitoring Status // 11-06-2014, Added Failover Status +// 10-14-2016, Added Check for default admin password // // System location of OpenVPN Client logfile $OVPNCLOGFILE = '/var/log/openvpnclient-status.log'; @@ -307,15 +308,25 @@ // function noASTURWstorage() { - if (noASTLINUX()) { - $status = 0; - } else { - shell('mount 2>/dev/null | grep -q "/oldroot/mnt/asturw"', $status); - } + shell('mount 2>/dev/null | grep -q "/oldroot/mnt/asturw"', $status); return($status != 0); } +// Function: adminDEFAULTpassword +// +function adminDEFAULTpassword() { + + $status = 0; + + if (($HTPASSWD = getPASSWDlocation()) !== '') { + if (is_file($HTPASSWD)) { + shell("/usr/sbin/check-default-passwd admin '$HTPASSWD' >/dev/null 2>/dev/null", $status); + } + } + return($status == 0); +} + // Function: noASTERISKsounds // function noASTERISKsounds($asterisk) { @@ -488,18 +499,12 @@ } } elseif (noASTURWstorage()) { putHtml('<p style="color: red;">Notice: No Persistent File Storage, click <a href="/admin/setup.php" class="headerText">Installation Setup</a></p>'); +} elseif (adminDEFAULTpassword()) { + putHtml('<p style="color: red;">Notice: Management Password is a known default, click <a href="/admin/system.php" class="headerText">System</a>to change the "admin" password.</p>'); } elseif (noASTERISKsounds($daemon['asterisk'])) { putHtml('<p style="color: red;">Notice: No Core Asterisk Sounds, click <a href="/admin/system.php" class="headerText">System</a>then via "Asterisk Sounds Packages", Upgrade/Install "core" and "moh" sounds.</p>'); } else { - if (($HTPASSWD = getPASSWDlocation()) !== '') { - if (is_file($HTPASSWD) || getPREFdef($global_prefs, 'status_password_warning') === 'no') { - putHtml("<p> </p>"); - } else { - putHtml('<p style="color: orange;">Warning: Management Password is not set, click <a href="/admin/system.php" class="headerText">System</a>to set the password.</p>'); - } - } else { - putHtml('<p style="color: orange;">Warning: Unable to locate base web directory.</p>'); - } + putHtml("<p> </p>"); } putHtml("</center>"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |