Detecting Administrator Changes Using RMM

RMMSecurity

The problem

In the world of the MSP, some clients have their own IT staff to deal with the simpler things such as faulty hardware and things that need hands on help. These people often have Domain Administrator or Enterprise Administrator rights, over there’s day-to-day account.

This often means that they are able to make changes of the fly, without thinking of the impact. Often we see, the client will add a user to one of the administrator groups, just to give them rights to install software and unfortunately, they get forgotten to be taken back out 6 months later.

This obviously is a massive security risk, should an end user with this level of access be breached or decided to install other bits of software.

What can be done

To combat this problem, we have developed a monitoring policy within our RMM, to take a note of the administrators and to report if the users change – either added or removed.

If the script is ran for the first time, it takes a list of the current users and assumes that is the correct list. We had this ran when our technicians went to the client sites for proactive support – so we knew that the administrators in the lists, were meant to be there.

One problem we came across was that the alarm was triggered for a legitimate temporary reason but the alarm kept going as the monitoring in RMM was set to be every minute. To stop this, we added a line that if the alert file got over 50MB, it would be removed. During testing, 50MB was around 1 week of alarm, which would have been dealt with by then for sure.

The script then gets the user and creates 3 files

  • A list of Domain Admins
  • A list of Enterprise Admins
  • Alerts – the change is documented and the change in this file, raises a ticket within or PSA

When an admin is added or removed to domain or enterprise users, the alerts file continues to populate which gives visibility of when the issue started.

How it works – part 1

The script moves through a series of tasks before taking a note of the domain and enterprise administrators. It needs to know the name of the group that it’s checking for on the DCs. This script can also be used to monitor other groups such as ‘Board Members’ or ‘HR Sensitive’, for this example we’ll just use the scary groups.

After the process is done, it knows what to look for and where to store it, it knows if the log file is over it’s allowed limit (also changeable) and if it doesn’t, one will be created.. This will be created regardless of where it is chosen and RMM works as SYSTEM level.

However, the log files being stored in that path are not created at SYSTEM level so if you chose to store in in System 32, it’s going to fail.

The next step is to gather the users and either create the files needed or load the information within them.

In order for RMM monitoring to work, the outputs need to start with Write-Host ‘<-Start Result->’ and finish with ‘<-End Result->’. If there’s an error, the exit command needs to be a ‘1’, this marks this as an active alert which then shows on the RMM dashboard. If there is any other exit code, the alert is seen as inactive (nothing wrong).

Currently, the monitoring has got the group to check and created the required files to either create or review. The file is created as hidden, just as a precaution against wandering end users.

The final step in the monitoring is to review the current group membership against the TXT files created in the first phase. This is done by taking the information from the TXT and comparing it against the variables populated with the TXT list and the current users.

The comparison has been made and there is a change in the membership, this will trigger two functions ‘removedMembers’ or ‘addedMembers’

Since this function exists with 1, all information written is added to the alert and if set, to the PSA ticket as well. In my example, this has the action, user adjusted, where the log is saved, what’s changed and a guide on the procedure to follow.

How it works – part 2

Currently, this script checks a TXT and then gives an 1 or a 0 – not very helpful at this stage. Next we need to add the script to the monitoring, within RMM and add to alarms. The benefit of this approach is you can add as many groups to a single alarm, so if there’s something new ‘HR Sensitive’ and it’s handed by the HoD and they make a unauthorized change, the MSP will know and can take appropriate action.

To set the alarm in RMM, we need to create a component and a monitoring policy. This allows us to target the alarm either at everyone or just specific customers that may have the premium support in the contract, with proactive monitoring.

Easy to do Automation > Components > Create Component

  • Name the component
  • Give the description (good habit to get into)
  • Category: Monitoring
  • Script: PowerShell

Copy your script into the the component and then target at either a global level or a site level, then save.

Next we need to build the policy that puts the output on the dashboard.

Policies > Monitoring > Create Policy

  • Name the policy
  • Set to global or site
  • Choose the monitors created
  • Chooses the targets
  • Save and deploy
  • Add a ticket to PSA (optional)

The end result looks similar to this, the server and all information included in the alert ready for the assigned technician.

How to respond

When the alert comes through, it’s usually the onsite technician making a change, without informing the MSP. The technician needs to confirm with the contact on site that this is legitimate and necessary.

Once verbally confirmed, get a confirmation via email and either delete the TXT file triggering the alert or create another component to reset the alert.

Note, this monitoring can be targeted at all DCs so if the alarm is set off, then each DC needs to be adjusted.

Reset admin alerts

The script to reset the alert just deletes the files and forces the scrip to re-create them. This is used when there’s more than one DC, just to save time and manual operation.

Conclusion

Having this is place has brought up changes in administrators as soon as it happens, allowing us to be much for vigilant with admin rights.

RMM is set to create a ticket and within the support ticket created, is all the information about the change, users and how to fix it through our knowledge base.

This is a basic monitoring method focused on alerting, not prevention.

Leave a Reply

Your email address will not be published. Required fields are marked *