jamf / NetSUS

NetBoot and Software Update Server
https://jamfnation.jamfsoftware.com/viewProduct.html?id=180
304 stars 69 forks source link

suExec causing divide by zero error in footer.php #132

Closed jelockwood closed 5 years ago

jelockwood commented 5 years ago

I came in this morning to find the web admin page for the SUS module was showing garbage. Instead of listing the two defined branches it lists the following.

Screenshot 2019-04-01 at 13 14 54

Looking at the Apache2 error.log it is generating the following types of errors.

[Mon Apr 01 13:14:41.145897 2019] [:error] [pid 7506] [client 10.222.1.50:52631] PHP Warning: Division by zero in /var/www/html/webadmin/inc/footer.php on line 134, referer: https://sus.internal.yoti.com/webadmin/dashboard.php

I believe our NOC team may have installed some updates to the VM overnight which may have broken code used by NetSUS. The shift that may have done this is not back on duty till this evening/tomorrow morning. I will check with them then. It could be they installed a PHP update.

The offending command that seems to be causing the problem is suExec in footer.php

$df_result_str = trim(suExec("diskusage"));
$df_result = explode(":", $df_result_str);
$df_free_percent = ceil(100*$df_result[2]/$df_result[0]);

I get the impression the content of footer.php in this repo is now different to what is in the 5.0.0 release. Do you need to make a new release to bring it back in sync?

Here are some version numbers for you -

PHP 7.0.33-0ubuntu0.16.04.3 (cli) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.33-0ubuntu0.16.04.3, Copyright (c) 1999-2017, by Zend Technologies

As you can see we are running Ubuntu 16.0.4 and in case it is not obvious NetSUS 5.0.0.

mcineran commented 5 years ago

Hi Apologies if I missed it in the docs, but the install script pops this in sudoers:

includedir /etc/sudoers.d

Could that be documented? Ths issue being that our configuration management removes comments :) Apart from that this issue is fixed. Thanks.

jelockwood commented 5 years ago

As per comment by @mcineran problem is resolved and I am therefore closing this issue.