shevabam / ezservermonitor-web

eZ Server Monitor`Web - A simple and lightweight dashboard for Linux
GNU General Public License v3.0
352 stars 128 forks source link

Cron mode security #50

Open Asenar opened 7 years ago

Asenar commented 7 years ago

This PR replace the #46 «mode cron + base config in .example file»

Changes:

Theses are the same commits with some fix due to the rebase. I removed the commit 8cfbf82 Last login: Show more relevant information from @QuentinCG because the new version seemed to works fine (I just typed in a shell so maybe I'm wrong).

The main improvement is still the cron mode to give a more secure way to retrieve information.

Cron Mode

Installation

The cron script run each libs/*.php file and store the result in cache file. Alternatively, you can run each php script separately.

Usage

just open the main index.php into a browser, the interface will show you the last cron update

QuentinCG commented 7 years ago

I'll have a look and give my feedback, it seems promising ;)

Asenar commented 7 years ago

To be more precise, it's about the commit 2866dfb (18 months ago) where you made this change:

-    if (!(exec('/usr/bin/lastlog --time 365 | /usr/bin/awk -F\' \' \'{ print $1";"$5, $4, $8, $6}\'', $users)))
+    if (!(exec('/usr/bin/lastlog --time 365 | /usr/bin/awk -F\' \' \'{ print $1" ("$3");"$5, $6, $9, $7}\'', $users)))

But the current master contains this :

if (!(exec('/usr/bin/lastlog --time 365 | awk \'{ printf $1";"; for (i=4; i<NF; i++) printf $i" "; print $NF; }\'', $users)))

I compared the 3 command and found than the newest «official version» was better (with my local config, debian 9) I didn't checked anywhere else.

By the way about that unix command, it tells me locally my last connection was the 22th may (and not today), but from the server I installed ezWeb I have more accurate dates :)