(Module) Audit Log Development

Working on an Audit Log module for FreePBX to show changes made through the UI portal (and maybe file diff too, but starting with UI database changes)

Any thoughts/comments on this? Any ideas about existing functionality for this already in FreePBX?

Howdy! Welcome back to the forums.

There’s quite a few logs tracking user interaction, such as Apache logs and FreePBX specific logs. Improving what gets stored in those logs is one approach.

For the database changes, you might consider TRIGGER statements that capture table modifications row-by-row into another ā€œauditā€ table sharing the same column structure but with additional columns for audit_timestamp, audit_user, audit_operation, etc. More details on TRIGGERs:

As for files, the Debian-native etckeeper package is pretty slick for automating configuration file version control.

Another idea regarding where to insert this work… if it sits in between all write operations and the underlying database/file system, then you could put yourself on the path to an Undo History in addition to the Audit Log.

Related, security-wise, logging the details of everything, e.g. passwords, is not good either. :slight_smile:

These are all really good points, thank you for taking the time to share!

I’ll consolidate your thoughts and what I’ve thought so far below.

Change sources for tracking:

  • FreePBX UI Database
  • AstDB - Asterisk database
  • File system logs

Tracking methods:

  • FreePBX Database (MariaDB): TRIGGER statements to track table modifications
  • AstDB - May have functionality similar to TRIGGERs? Alternative: crude snapshot dump + diff on interval (not very ā€œauditā€-y, more tracking at interval)
  • Diff on any new log entries since last read

(Consolidation) Outputs:

  • Simple: Plaintext log with single line entries like log file, human-friendly and quickly reviewable
  • NoSQL/Structured: JSON log with machine-friendly event objects
  • Database: Report-friendly rows with columns for data helpful in reporting

Regarding AstDB, snapshots could be a challenge on larger systems, in part because there is so much Asterisk SIP state tracked there completely outside of the confines of the FreePBX GUI. When the GUI does manipulate the AstDB, it is probably going through the plumbing to reach commands like database put here:

And here:

And here:

And here:

And maybe more… but (hopefully not) here:

Slightly aside, probably should add some upgrades from the generic command to more direct AMI commands in to the v18 milestone, so we can do nice things like DBPut and stuff… here is the GH issue.

Awesome, I’ll review those instances.

I might also have a converged/timeline view which compiles events/changes from all sources and shows in one combined view (also hiding extra instances when an event results in entries in all the sources.)

Thought I’d share some progress on this. Any feedback welcome.

Unified View

GUI View

GUI View - Entry Details

Database View

Asterisk View

API View

There’s a lot to like here – excited where this is going – thank you for contributing. Is the open source code roll-out in the works ?

If there’s interest for it, I may provide an OSS release. Currently, I’m providing repo access privately to those interested in testing it.

Honestly though, judging based on engagement here, it doesn’t seem worth the time to work on a release. ĀÆ\_(惄)_/ĀÆ

Well there’s been no engagement from you for three months after saying ā€œI’m working on thisā€ with some snap shots. Until today you never offered repo access or made any indication you were looking for testers. Even on another forum there was more replies from the users and the same thing, you made an announcement (not offering any access or testing) and went radio silent for 3 months again even while people were posting.

Some might not be engaging because it doesn’t look like there was anything to engage with. No repos, no testing offers, etc.

He gave me repo access based on communication in another forum. Just ask if you are interested. I’m still putting notes together but it’s a pretty neat module.

Sort of took the mantle back by saying: Engage! :vulcan_salute:

But either way now here we are engaging! :tada:

Neat and needed :slight_smile: because everybody always asking who did whaaaat?

Ah, could be, could be.

Simply commenting isn’t really engaging right? It’s like meta-engagement: literally talking about engaging without actually engaging​:joy:

Your help pointing out places in code was very helpful. Andrew wanted to test it. That’s engagement. Otherwise, no one’s mentioned if it might be useful, offered feedback based on the screenshots, or even responded to the original idea.

I realize the forums pretty dead, but it is what it is. I’m not trying to force interest in the idea, but if no one even says ā€œThat could be usefulā€. Then it’s an obvious conclusion that people aren’t interested, not really complicated.

I PMd you and await access.

Granted.

Am I to guess where it is found on Github? I kinda expected a link so I would have to guess where to find it.

You are very welcome!

Forum ebbs and flows,
but its been here twenty years,
and the forks come back.

Please share :slight_smile: as it might move along faster than you expect!