Loging of who logged in and what command they did, is this possible?

Hi!

I am using allmon2 and supermon on my node. that run a 900 MHZ repeater.
As most user that have a 900 mhz radio dont have a dtmf pad on their radio we want to supply a way to link/unlink nodes based on the allmon2 page. I allready commented the part of the option we did not wanted the user to have access. and they have a nice way to work their way with the node like that.

But as we have to monitor what is being done on the node is there a way to reads some logs to know what user did what command?

thanks

Pierre
VE2PF

1 Like

On the surface, you can’t know who a user is via ASL, only nodes.
While I would agree that most nodes are single personal stations anymore, it is not always the case.

And we have /var/log/asterisk/
I had it in my head that there was a way to change the verbosity of the log file, but it escapes me how.
I think you would need to change the verbosity to capture the dtmf pushes.

Perhaps someone has a better answer. You might also do a search in this system as the topic did come up a few times back in the days of the mailman system and those archives have been imported.

When I re-read your message, I kinda got a different impression of what you were saying.
Are you wanting to log activity on allmon/supermon ?

That I can point you to.

Here is a php snippet that is the essence of logging ip’s to a txt file.
You would need to find a appropriate place to insert it to not cause any problems.
Catch the right place and perhaps log the commands sent as well.
You could easily add a date/time stamp in the file as well.
Google is your friend. (sometimes)

<?php $ipaddress = $_SERVER["REMOTE_ADDR"]; $file = fopen("ipalog.txt", "a+"; fwrite($file, $ipaddress ; fclose($file ; ?>

Hi @Pierre_Martel,

There is no logging like that in Allmon2. It might be useful to have ACL’s as well. All that could be added, after all it is open source. How’d ya like to learn some php? :slight_smile:

That a nice snip of php code @Mike. I think @Pierre_Martel would like to log the logged in user as well.

OK…
Had a few more minutes ( a result of not wanting to shovel snow & ice )

Here is a crude fix to make it work…

Go to the allmon directory and open login.php

replace the following text at the bottom of the file… (eveything you see)
Start here>>>
fclose($fp);

			// First, try DES and Blowfish.
			$test_pw = crypt($pass, $fpass);		// Use original crypt'ed password to supply salt.
			if($test_pw == $fpass); // authentication success.

// >
$line = substr($user, 0, 6) . " - " . date(‘Y-m-d H:i:s’) . " - $_SERVER[REMOTE_ADDR]";
file_put_contents(‘iplog.txt’, $line . PHP_EOL, FILE_APPEND);
// <
return TRUE;

			// If we're still testing, try APR1-MD5
			$test_pw = crypt_apr1_md5($pass, $fpass);	// Use original crypt'ed password to supply salt.
			if($test_pw == $fpass); // authentication success.

// >
$line = substr($user, 0, 6) . " - " . date(‘Y-m-d H:i:s’) . " - $_SERVER[REMOTE_ADDR]";
file_put_contents(‘iplog.txt’, $line . PHP_EOL, FILE_APPEND);
// <

				return TRUE;

			// Password didn't match. Bail out.
			return FALSE;

<< end here.

Copy what you see and paste it in your file to match the begging and the end of what you see.
I highlighted the major inserts, but there was some sytax changes within existing.

So this will create a file that is appended in the allmon directory with the first 6 digits of the login username, date and ip address on each line. Named ‘iplog.txt’

I had to use the method of just grabbing the first 6 digits of the username as I was having issues parsing the appache user string. So smaller user names may show with unexpected char’s.

Gives you a framework to make it what you want.

you might need to touch/create the initial filename and give it write permissions ???

Make a backup of your original file before you start.