Creative solution needed

I’m hoping maybe someone here might have some advice for a solution to something i’ve been trying to work on.

I’ve got a business need to remediate vulnerabilities on Servers across our enterprise but the ask is that we create a change ticket per server when one of these specific remediations needs to take place. Because some of these servers may be in DMZ or internet restricted zones we can’t simply have the task run with the remediation process locally on the server.

My initial thought was to use the Archive system to get a data file with necessary details from the affected server to the root server using this method How to get files from client computers (Which works great, and i’ve used it many times in the past), then let the root server process the files in the mailbox and run the script to create the change ticket.

The process works as planned but I believe that i’m having an issue with the evaluation time for the fixlet and seeing events in the logs where it’s saying the expression is taking too long. This is the relevance on the task that runs on the root server. Is there anything that anyone can think of to make this more efficient or any recommendations for alternative methods?

exists files whose(name of it starts with “Remediation_”) of folders of folders of folders “sha1” of (folders it) of values of settings “_BESRelay_UploadManager_BufferDirectory” of client

RelevantMessage: expression taking too long, file ‘Action 1697024.fxf’, fixlet id 1697024

Hm. The UploadManager directory on the server might be absolutely huge. I’m not sure you’ll find a good way to query it, and I think I’d have to recommend against this approach. That said, you might try out this form - the ‘find files’ inspector uses OS glob-type names so you can look for ‘Remediation_*’ to match the files, and it’s a slightly better lookup than listing all the files and then filtering with a whose() clause:

find files "Remediation_*" of folders of folders of folders "sha1" of (folders it) of values of settings "_BESRelay_UploadManager_BufferDirectory" of client

Since you’re doing this in an Action, if you were forced to go this route I’d probably run an external shell command to run a dir /s /b \path\Remediation*, save the output to a file, and parse the output file in relevance.

But what I’d probably recommend instead of all this would be to do all this as a REST API integration, outside of the client relevance. If your remediations are based on Fixlets or Baselines, I’d probably use the REST API to query for Relevant Fixlets or Baselines for each server, and having that same script create the tickets (most ITSM products like ServiceNow would also allow REST or some other API for ticketing).

A session relevance like this would show all the ‘Critical’ fixlets from ‘Patches for Windows’ for some group of computers; you could adjust the computer selection to be a property like ‘Servers’ or repeat for each computer etc.:

(
name of item 0 of it
, name of item 1 of it
) of
(
item 0 of it /* computer */
, item 1 of it /* fixlet */
, (results (item 0 of it, item 1 of it)) whose ( relevant flag of it ) /* fixlet result */
) of
(
elements of item 0 of it /* computers */
, elements of item 1 of it /* fixlets */
) of
(
/* Select computers to check */
set of members of bes computer groups whose (name of it = "ServerBasedGroup-Win")

/* select fixlets to check */
, set of fixlets whose (
    exists applicable computers of it
    and exists default action of it
    and source severity of it = "Critical"
	) of all bes sites whose (display name of it = "Patches for Windows")
)

Or, if you’re pre-creating the Baselines, you could report both the baseline and the relevant components from within the Baseline. This lets you get a lot more creative with patch inclusion/exclusion, by only adding the things you want to a Baseline. (You’d probably want to filter the Baselines and Sites here, but for example using all of your custom baselines):

(
name of item 0 of it /* bes computer */
, name of item 1 of it /* relevant baseline for computer */
, names of items 0 of (source fixlets of components of component groups of item 1 of it, item 0 of it) whose (relevant flag of results (item 0 of it, item 1 of it)) 
) of
(
item 0 of it /* computer */
, item 1 of it /* fixlet */
, (results (item 0 of it, item 1 of it)) whose ( relevant flag of it ) /* fixlet result */
) of
(
elements of item 0 of it /* computers */
, elements of item 1 of it /* fixlets */
) of
(
/* Select computers to check */
set of members of bes computer groups whose (name of it = "ServerBasedGroup-Win")

/* select fixlets to check */
, set of fixlets whose (
    
    baseline flag of it
	) of all bes sites whose (custom site flag of it)
)

Either of these should be able to produce the info you need to create your change tickets, without having to run scripts on the clients, use the Archive Manager, or parse through the Archive Manager repository on the server.

Thank you for the quick response, I’ll investigate this further. I honestly don’t know why I overlooked find files, i’ve used it many times in the past and it’s definitely more efficient than the way I was doing it.