Git Product home page Git Product logo

logrhythm.tools's Introduction

Logo

Last Release Dev Version

LogRhythm.Tools is a PowerShell module for interacting with LogRhythm APIs. The module is a powerful addition to a LogRhythm analyst's toolbox, and can be used interactively within PowerShell or as a framework for developing SmartResponse plugins - without requiring an understanding of LogRhythm's API layer.

LogRhythm Components:

  • Admin (Agents, Entities, Hosts, Identities, lists, Locations, LogSources, Networks, Users)
  • AI Engine Drilldown for Alarms
  • Cases (Evidence, Metrics, Playbooks, Tags)
  • Search (LR version 7.5 required)
  • Alarms (LR version 7.7 required)
  • LogRhythm Echo

Third Party Integrations:

LogRhythm.Tools supports API access to various third party vendors. Access to these services requires authorization keys provided by the third party and is not granted as a part of the LogRhythm.Tools module.

  • Microsoft Active Directory
  • Microsoft Graph API
  • Microsoft Defender API
  • Mimecast
  • MACVendors
  • Proofpoint
  • Recorded Future
  • Shodan
  • Urlscan
  • Virus Total

Each command included in the LogRhythm.Tools module is deigned to be modular and built to leverage the power of the PowerShell pipeline. The output of one LRT command can be sent for processing as input to the another command. And that output can be sent to yet another command. The result is a complex command chain or pipeline that is composed of a series of simple commands.

Getting Started

Operating Systems

  • CentOS/RHEL 7
  • CentOS/RHEL 8
  • macOS 12
  • Ubuntu 22.04 LTS
  • Windows 7
  • Windows 8.1
  • Windows 10
  • Windows Server 2008r2
  • Windows Server 2012
  • Windows Server 2012r2
  • Windows Server 2019
  • Windows Server 2022

Software

Windows PowerShell

  • Windows Management Framework 5.1
  • Windows .Net Framework 4.5.2

PowerShell Core

  • Windows .Net Framework 6.0 LTS

Permissions

  • Ability to download resources from Github.com
  • Ability to extract archive files from zip
  • User level privileges to run PowerShell
  • User level privileges to install PowerShell modules

Credentials

Required

  • LogRhythm API Key

Optional

  • Mimecast API Key
  • Microsoft Azure App Registration
  • Recorded Future API Key
  • Proofpoint API Key
  • Shodan API Key
  • Urlscan API Key
  • VirusTotal API Key

NOTE: For specific Cmdlet requirements reference the section Cmdlet Version Requirements

Installation

  • Download and extract the LogRhythm.Tools release package
  • Run Setup.ps1 on a host that meets LogRhythm.Tools system requirements
  • Follow the directions presented through the interactive installer
    • To apply configuration changes re-run the Setup.ps1
  • Once installation has been complete follow these steps to test basic functionality
    • Open powershell.exe
    • Enter Import-Module LogRhythm.Tools
      • Verify no errors were returned during module import
    • Execute LogRhythm.Tools Cmdlet(s)
      • Get-LrLists
      • Get-LrEntities
      • Get-LrUsers

Installation Demo

For additional examples on how to leverage LogRhythm.Tools check out the Examples section.


Contributing

Contributions are welcome. Please review the Contributing guide and the Code Style guide.


Additional Details

Change Log

1.3.0

General Changes

PowerShell Core Support
  • The installation and setup now accounts for PowerShell Core for installations on Windows, Linux, or macOS.
Installer Help
  • When presented with data input options a valid entry is now 'help'. This will present the user with additional details or examples related to the current installation step.
  • Minor additions throughout the setup process to convey additional information to the user related to the options they're configuring.
HTTP 429 Error Handler
  • All LogRhythm API cmdlets will now have a safeguard against the API service responding with HTTP 429, too many requests. The currently executing API call will automatically back-off and re-try up to a user configurable amount of times, default 25.
Improved HTTP Error Output
  • Any LogRhythm API cmdlet that generates an error as a part of an API call will now return more relevant information to assist in identifying or diagnosing the issue related to your encountered error.
Standardized Verbosity Output
  • All API calls generated by LogRhythm tools now implement a standard schema when running with the -verbose flag provided. For cmdlets that retrieve information you will observe the target URI, HTTP Method, and observe data related to the provided results. For cmdlets that contain body contents this JSON data will be presented in a similar fashion as data retrievals.
  • All verbose logs now contain a prefix that indicates the cmdlet that is currently executing.
Code Cleanup
  • As part of maintaining coding standards various aspects of unused code have been removed to ensure easier code review, scanning, and maintaining.

New Cmdlets

General
  • Get-LrApiTokenInfo: Allows the user to review key information related to the current API key's context.
  • Test-LrApiTokenExpired: Allows the user to test the API expiration status of their current in-use API key.
Agent Management
  • Get-LrAgentsPending: Allows the retrieval of multiple pending Sysmon agent records based on user provided criteria.
  • Get-LrAgentPendingDetails: Retrieves the details for a specific pending Sysmon agent record.
  • Update-LrAgentPending: Provides capability to associate a pending agent to an existing Sysmon agent. Also provides the ability to reject a pending agent.
  • Remove-LrAgentPending: Allows the removal of a pending Sysmon agent record.
Log Source Management
  • Update-LrLogSource: This is an early-release cmdlet that permits modifying a subset of an existing LogSource's properties like Max Message Count, Name, Status, or File Path.
TrueIdentity
  • Update-LrIdentity: Allows the modification of an existing TrueIdentity record to update data fields such as Name, Address, Manager, or other relevant data schema objects.
Entity - Hosts
  • Format-LrHostPsObject: Converts the nested JSON structure provided from the LogRhythm API to a flat schema to support operations like exporting to CSV.
Entity - Networks
  • Format-LrNetworkPsObject: Converts the nested JSON structure provided from the LogRhythm API to a flat schema to support operations like exporting to CSV.

Updated Cmdlets

TrueIdentity
  • Get-LrIdentities: Resolved an defect introduced when using the -exact flag when leveraged with the -identifier parameter.
List Management
  • New-LrList/Update-LrList: Now supports the Generic Value contexts for MACAddress, ObjectName, and Subject.
  • New-LrList: No longer requires the user to submit a valid UserId. The Cmdlet will default to the list owner to the current OwnerId of the API key being used to access the RestAPI service.
  • Add-LrListItem/Remove-LrListItem: HTTP 500 Error Handler for Add-LrListItem and Remove-LrListItem. The specific error occurs when the SQL database is currently accessing data that causes your requested action to be blocked. This retry behavior implements the same measure applied as the HTTP 429 Error handler.
  • Add-LrListItem: Added capability to add Log Source or LogSource Type data types to a list.
  • Remove-LrListItem: Added capabiity to remove Log Source or LogSource Type data types from a list.
Case Management
  • Update-LrCaseStatus: Added switch parameter force to trigger the behavior to automatically transition the target case from any current status to the target status specified.

1.2.1

  • Invoke-RfSync: Allow Entity to be specified for established and managed lists.
  • New-LrList: Removed defect where UseContext was supplied on all requests.
  • ConvertTo-Base64: Expanded to support additional encoding types.
  • ConvertFrom-Base64: Expanded to support additional encoding types.
  • Lrt.Config.Input.json: Added descriptor to the SSL Certification policy section.

1.2.0

  • All Cmdlets: Reduced code complexity for Windows PowerShell and PowerShell Core Invoke-RestMethod calls.
  • All Cmdlets: Implement PowerShell cmdlet standard for -PassThru switch paramater for any cmdlet that applies a add/delete/update operation.
  • All LogRhythm API Cmdlets: Reduce configuration management complexity by converting AdminBaseUrl, CaseBaseUrl, AieBaseUrl, SearchBaseUrl, AlarmBaseUrl into BaseUrl.
  • Invoke-PIEUrlDNSLookup: Removed error output when no DNS results are found.
  • Get-PIEURLsFromHTML: Updated URL scrape method to review each HTML Tag. Now able to detect baseStriker URLs.
  • Remove-LrTag: Removed unneccisary JSON Body from cmdlet.
  • Get-LrAieDrilldown: Changed data type from Systems.Collection.Generic.Dictionary[string,string] to System.Object for Summary Fields.
  • Get-LrAieDrilldown: Added Log Count, AIERuleID, and AIEDrilldownRetryCount to returned data results.
  • Show-LrLocations: Removed this cmdlet from LogRhythm.Tools. This cmdlet was a stop-gap to provide location data in pre-7.5 Deployments.
  • Get-LrThreatIntelligence: Retrieve the associated Threat Providers and Categories from the Threat Intelligence API.
  • Get-LrCases: Fix defect that would prevent return of exact case matches to not return if the submitted request did not include a metrics summary.
  • Get-InputApiUrl: Update the working logic of the Get-InputApiUrl to support LogRhythm Cloud operating over port 443 in place of the pre-configured 8501.
  • Initial release for LogRhythm Alarms API: Get-LrAlarm, Get-LrAlarmComment, Get-LrAlarmEvents, Get-LrAlarms, Get-LrAlarmSummary, Get-LrAlarmHistory, Test-LrAlarmStatus, Update-LrAlarm
  • Get-LrIdentities: Updated -exact to function for Name and Identifier property fields.
  • Get-LrtAzUserManager: Updated Error handler for Get-LrtAzUserManager cmdlet.
  • Invoke-LrSearchExample: Example to serve as a reference to perform searches for Hostname (Origin/Impacted) OR IP Address (Origin/Impacted) over a given time frame with a maximum of 30,000 logs returned.
  • Proxy Support: Enables all Invoke-RestMethod/HTTP requests to go through a configured Proxy.
  • Add-LrIdentity: Added support for TrueIdentity data element Title.

List Management

Retrieving Lists

A great place to start is reviewing all of the lists that are available to us through our API access. It's important to note that our access is defined and controlled by LogRhythm's RBAC policies.

PS C:\LogRhythm.Tools> get-lrlists
listType        : GeneralValue
status           : Active
name            : LRT : Hash : Recently Quarantined Files
shortDescription : List of file hashes populated in response to Anti-Virus quarantine actions.
longDescription  :  This list is leveraged to identify any additional Information System that may have activity corresponding with the identified file hash.
useContext       : {Hash}
autoImportOption : @{enabled=False; usePatterns=False; replaceExisting=False}
importFileName   :
id               : 2001
guid             : BC952970-2AF3-46B7-BB1F-4282102EB1FE
dateCreated      : 2020-06-11T16:47:13.823Z
dateUpdated      : 2020-06-11T16:47:14.677Z
revisitDate      : 2030-06-11T10:47:14.677Z
readAccess       : PublicRestrictedAdmin
writeAccess      : PublicRestrictedAdmin
restrictedRead   : False
entityName       : Primary Site
entryCount       : 12
needToNotify     : False
doesExpire       : False
owner            : 1

 
listType         : GeneralValue
status            : Active
name             : LRT : Domain : ConfLo : Blacklisted Dns Name
shortDescription : List of URLs that have a low level of confidence associated with Blacklisted DNS names.
longDescription  :  This list is leveraged to identify Information Systems that may have activity with suspicious domain names.
useContext       : {URL}
autoImportOption : @{enabled=False; usePatterns=False; replaceExisting=False}
importFileName   :
id               : 2019
guid             : 7328F064-6E70-45E8-8881-B9917F15C9D3
dateCreated      : 2020-06-12T14:23:01.853Z
dateUpdated      : 2020-06-12T14:23:02.743Z
revisitDate      : 2030-06-12T08:23:02.743Z
readAccess       : PublicRestrictedAdmin
writeAccess      : PublicRestrictedAdmin
restrictedRead   : False
entityName       : Primary Site
entryCount       : 12
needToNotify     : False
doesExpire       : False
owner            : 1

Retrieving list values

The list LRT : Domain : ConfLo : Blacklisted Dns Name appears interesting and we want to review only the list values populated on the list. For this we'll make use of the Get-LrListItems cmdlet where we can reference our target list by its name, LRT : Domain : ConfLo : Blacklisted Dns Name or by its GUID 7328F064-6E70-45E8-8881-B9917F15C9D3. This is thanks to the implementation design of the LogRhythm Tools cmdlets.

PS C:\LogRhythm.Tools> get-lrlistitems -Name "LRT : Domain : ConfLo : Blacklisted Dns Name" -ValuesOnly
www.plxipr.com
imagescmeraclub.com
tutorialsalk.info
buildingmsu.ac.th
www.haecaklaw.com
bolizarsspos.com
logrhythm.com
boilersadfurnaces.com
appum.com
avacarvisual.com.br
amle-sun.eu
icst.na.its.ac.id

Removing an item from a list

Reviewing the results from our Blacklisted Dns Name's it looks like a mistake has been introduced with the logrhythm.com entry. This example will showcase how to remove a specific value from this list. With this method we will change from referencing the list from the name property and instead reference the list by its GUID.

PS C:\LogRhythm.Tools> Remove-LrListItem -Name '7328F064-6E70-45E8-8881-B9917F15C9D3' -Value "logrhythm.com"
listType         : GeneralValue
status           : Active
name             : LRT : Domain : ConfLo : Blacklisted Dns Name
shortDescription : List of URLs that have a low level of confidence associated with Blacklisted DNS names.
longDescription  : This list is leveraged to identify Information Systems that may have activity with suspicious domain names.
useContext       : {URL}
autoImportOption : @{enabled=False; usePatterns=False; replaceExisting=False}
importFileName   :
id               : 2025
guid             : 7328F064-6E70-45E8-8881-B9917F15C9D3
dateCreated      : 2020-06-12T14:23:04.917Z
dateUpdated      : 2020-06-22T20:32:09.853Z
revisitDate      : 2030-06-22T14:32:09.857Z
readAccess       : PublicRestrictedAdmin
writeAccess      : PublicRestrictedAdmin
restrictedRead   : False
entityName       : Primary Site
entryCount       : 11
needToNotify     : False
doesExpire       : False
owner            : 1
listItemsCount   : 0

To validate we can check our list's results to verify the removal.

PS C:\LogRhythm.Tools> get-lrlistitems -Name "LRT : Domain : ConfLo : Blacklisted Dns Name" -ValuesOnly
www.plxipr.com
imagescmeraclub.com
tutorialsalk.info
buildingmsu.ac.th
www.haecaklaw.com
bolizarsspos.com
boilersadfurnaces.com
appum.com
avacarvisual.com.br
amle-sun.eu
icst.na.its.ac.id

Remove all items from a list

Lets say we want to carry out some maintenance and clear out all the results from our Blacklisted Dns Name list. For this example we'll utiize Powershell's pipeline processing and two LogRhythm Tools cmdlets. The first cmdlet is from our earlier retrieving list items example that will be paired with the removing an item example.

PS C:\LogRhythm.Tools> Get-LrListItems -name "LRT : Domain : ConfLo : Blacklisted Dns Name" -ValuesOnly | Remove-LrListItem -Name "LRT : Domain : ConfLo : Blacklisted Dns Name"
listType         : GeneralValue
status           : Active
name             : LRT : Domain : ConfLo : Blacklisted Dns Name
shortDescription : List of URLs that have a low level of confidence associated with Blacklisted DNS names.
longDescription  : This list is leveraged to identify Information Systems that may have activity with suspicious domain names.
useContext       : {URL}
autoImportOption : @{enabled=False; usePatterns=False; replaceExisting=False}
importFileName   :
id               : 2025
guid             : 7328F064-6E70-45E8-8881-B9917F15C9D3
dateCreated      : 2020-06-12T14:23:04.917Z
dateUpdated      : 2020-06-22T20:39:56.247Z
revisitDate      : 2030-06-22T14:39:56.247Z
readAccess       : PublicRestrictedAdmin
writeAccess      : PublicRestrictedAdmin
restrictedRead   : False
entityName       : Primary Site
entryCount       : 0
needToNotify     : False
doesExpire       : False
owner            : 1
listItemsCount   : 0

This example begins to show some of the flexibility and capability of the LogRhythm Tools PowerShell module. The results show we successfully cleared out the number of entries contained in our target list through a single line of code with two cmdlets. The same method we've applied for removing items from LogRhythm Lists can also be applied to adding items to lists.


LogRhythm.Tools was developed and has undergone testing leveraging LogRhythm SIEM versions 7.4.X and 7.5.X. Validate the SIEM version with the Minimum Version specification below prior to submitting Cmdlet issues.

Version: 1.2.0

Cmdlet API Endpoint Category Minimum Version
Add-LrAlarmComment Alarms Alarms 7.7.0
Format-ShodanTextOutput Shodan General -
Format-UrlscanTextOutput Urlscan General -
Format-VTTextOutput VirusTotal General -
Get-LrAlarm Alarms Alarms 7.7.0
Get-LrAlarmEvents Alarms Alarms 7.7.0
Get-LrAlarmHistory Alarms Alarms 7.7.0
Get-LrAlarms Alarms Alarms 7.7.0
Get-LrAlarmSummary Alarms Alarms 7.7.0
Get-LrCollaborators Case Collaborators 7.5.0
Get-LrLogSourceTypes Admin Admin 7.5.0
Get-LrNotificationGroups Admin Notification 7.5.0
Get-LrNotificationGroupUsers Admin Notification 7.5.0
New-LrEntity Admin Entity 7.5.0
Test-LrAlarmStatus Alarms Alarms 7.7.0
Update-LrAlarm Alarms Alarms 7.7.0
Update-LrEntity Admin Entity 7.5.0

Version: 1.1.0

Cmdlet API Endpoint Category Minimum Version
Add-LrLogsToCase Case Evidence 7.5.0
Get-LrCaseEvidence Case Evidence 7.5.0
Get-LrCaseLogsIndex Case Evidence 7.5.0
Format-LrHostTextOutput Case Helpers 7.5.0
Format-LrIdentityTextOutput Case Helpers 7.5.0
New-LrCaseHelper Case Helpers 7.5.0
New-LrTagTaxObject Case Helpers 7.5.0
Get-LrtAzSecurityAlert AzureGraph Security -
Get-LrtAzSecurityAlerts AzureGraph Security -
Update-LrtAzSecurityAlert AzureGraph Security -
Get-LrtAzUserManager AzureGraph Users -
Get-LrtAzUsers AzureGraph Users -
Get-LrtAzMe AzureGraph General -
Get-LrtAzOrganization AzureGraph General -
New-LrtAzMailMessage AzureGraph Mail -

Version: 1.0.0

Cmdlet API Endpoint Category Minimum Version
Get-LrAgentDetails Admin Agents 7.5.0
Get-LrAgentLogSources Admin Agents 7.5.0
Get-LrAgentsAccepted Admin Agents 7.5.0
Get-LrEntities Admin Entities 7.4.0
Get-LrEntityDetails Admin Entities 7.4.0
Get-LrHostDetails Admin Hosts 7.4.0
Get-LrHostIdentifiers Admin Hosts 7.4.0
Get-LrHosts Admin Hosts 7.4.0
New-LrHost Admin Hosts 7.4.0
Remove-LrHostIdentifier Admin Hosts 7.4.0
Update-LrHost Admin Hosts 7.4.0
Update-LrHostIdentifier Admin Hosts 7.4.0
Update-LrHostStatus Admin Hosts 7.4.0
Add-LrIdentitiy Admin Identity 7.4.0
Add-LrIdentityIdentifier Admin Identity 7.4.0
Disable-LrIdentity Admin Identity 7.4.0
Disable-LrIdentityIdentifier Admin Identity 7.4.0
Enable-LrIdentity Admin Identity 7.4.0
Enable-LrIdentityIdentifier Admin Identity 7.4.0
Find-LrIdentity Admin Identity 7.4.0
Find-LrIdentitySummaries Admin Identity 7.4.0
Format-LrIdentityPsObject Admin Identity 7.4.0
Get-LrIdentities Admin Identity 7.4.0
Get-LrIDentityById Admin Identity 7.4.0
Get-LrIdentityIdentifierConflicts Admin Identity 7.4.0
Merge-LrIDentities Admin Identity 7.4.0
Test-LrIdentifierType Admin Identity 7.4.0
Test-LrIdentityIDentifierId Admin Identity 7.4.0
Test-LrIdentityIdentifierValue Admin Identity 7.4.0
Add-LrListItem Admin Lists 7.4.0
Get-LrListGuidByName Admin Lists 7.4.0
Get-LrList Admin Lists 7.4.0
Get-LrListItems Admin Lists 7.4.0
Get-LrLists Admin Lists 7.4.0
New-LrList Admin Lists 7.4.0
Remove-LrListItem Admin Lists 7.4.0
Sync-LrListItems Admin Lists 7.4.0
Test-LrListType Admin Lists 7.4.0
Test-LrListValue Admin Lists 7.4.0
Get-LrLocations Admin Location 7.5.0
Show-LrLocations Admin Location All versions
Get-LrLogSourceDetails Admin LogSources 7.5.0
Get-LrLogSources Admin LogSources 7.5.0
Find-LrNetworkByIP Admin Networks 7.4.0
Get-LrNetworkDetails Admin Networks 7.4.0
Get-LrNetworks Admin Networks 7.4.0
New-LrNetwork Admin Networks 7.4.0
Update-LrNetwork Admin Networks 7.4.0
Get-LrUserNumber Admin Users 7.4.0
Get-LrUsers Admin Users 7.4.0
Test-LrUserIdFormat Admin Users 7.4.0
Add-LrAlarmToCase Evidence General 7.4.0
Add-LrNoteToCase Evidence General 7.4.0
Add-LrCasePlaybook Case General 7.4.0
Add-LrCaseTags Case General 7.4.0
Format-LrCaseListSummary Case General 7.4.0
Get-LrCaseById Case General 7.4.0
Get-LrCaseEarliestEvidence Case General 7.4.0
Get-LrCasePlaybookProcedures Case General 7.4.0
Get-LrCasePlaybooks Case General 7.4.0
Get-LrCaseStatusTable Case General 7.4.0
Get-LrCases Case General 7.4.0
Get-PIFTypeName Case General 7.4.0
New-LrCase Case General 7.4.0
Remove-LrCasePlaybook Case General 7.4.0
Remove-LrCaseTags Case General 7.4.0
Test-LrCaseIdFormat Case General 7.4.0
Update-LrCaseEarliestEvidence Case General 7.4.0
Update-LrCaseEarliestEvidenceFromDrilldown Case General 7.4.0
Update-LrCasePlaybookProcedure Case General 7.4.0
Update-LrCaseStatus Case General 7.4.0
Get-LrCaseMetrics Case Metrics 7.4.0
Copy-LrPlaybook Case Playbooks 7.4.0
Get-LrPlaybookById Case Playbooks 7.4.0
Get-LrPlaybooks Case Playbooks 7.4.0
New-LrPlaybook Case Playbooks 7.4.0
Remove-LrPlaybook Case Playbooks 7.4.0
Update-LrPlaybook Case Playbooks 7.4.0
Get-LrPlaybookProcedure Case Procedures 7.4.0
Test-LrProcedureIdFormat Case Procedures 7.4.0
Update-LrPlaybookProcedure Case Procedures 7.4.0
Get-LrTag Case Tags 7.4.0
Get-LrTagNumber Case Tags 7.4.0
Get-LrTags Case Tags 7.4.0
New-LrTag Case Tags 7.4.0
Remove-LrTag Case Tags 7.4.0
Get-LrSearchResults Search Search 7.5.0
New-LrSearch Search Search 7.5.0
Test-LrFilterType Search Search 7.5.0
Get-LrAieDrilldown AIE AIE 7.4.0

logrhythm.tools's People

Contributors

genecupstid avatar jberkers42 avatar jt3kt avatar martijnhazebroek avatar tonymasse avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

logrhythm.tools's Issues

Bug Report: Pre-Release

This issue will track the bugs being addressed by the branch created to fix them.

Get-LrCaseMetrics

182: Start-Sleep -Milliseconds 50

50 milliseconds isn't enough in some cases - need to come up with a more elegant way to handle throttle issues and slow down requests.

Get-LrCasePlaybookProcedures

This command uses CaseId, and Id for the id of the playbook attached to a case. Currently the command is sending Id to validate CaseId which will always result in an error.

Fix: Pass CaseId instead of Id for Test-LrCaseIdFormat (line 88)

Update-LrCasePlaybookProcedure

  1. This command uses CaseId, and Id for the id of the playbook attached to a case. Currently the command is sending Id to validate CaseId which will always result in an error. Fix: Pass CaseId instead of Id for Test-LrCaseIdFormat (line 158)

  2. Add validation to Status parameter. As a result lines 267-280 are no longer needed.

  3. If the username provided to the command results in more than one account, we need to handle this. Fix: add -Exact parameter to Get-LrUsers.

Test-LrUserIdFormat

Somehow a codeblock ($OutObject) was moved outside of the Begin block, resulting in errors any time this command was run. Fix: Moved lines 36-40 into the Begin block.

(Missing) Update-LrCase

We definitely should have an Update-LrCase for 1.0 - not sure how we missed it. Fix: added

Repo needs some maintenance

@Jt3kt want to make sure you review this.

Issues

  • master is ahead of other branches by 7 commits, this should never occur
  • development should only be merged into master for releases and bug fixes. (nothing I can do about that now)
  • need to always use PRs when updating development or master

Actions

  • I am going to merge master changes down into development to avoid any issues.
  • Prune old branches that have already been merged.

Test-ValidIPv4Address function does not return false when IP address is IPv6

Expected Behavior

When an IPv6 address is passed to Test-ValidIPv4Address, the function should return $false.

Actual Behavior

When an IPv6 address is passed to Test-ValidIPv4Address, the function returns $true, even though it is not a valid IPv4 address.

Steps to Reproduce the Problem

  1. Import-Module LogRhythm.Tools
  2. Test-ValidIPv4Address -IP '2406:da1c:20f:2f00::'
  3. Returns $true

Specifications

  • Version: LogRhythm.Tools 1.3.2, independent of LogRhythm version
  • Platform: Windows(Desktop and Core), Mac, Linux
  • Subsystem: General

The impact of this is that when performing a Find-LrNetworkByIP, and certain IPv6 networks are defined, these networks are matched incorrectly as only the last 4 "octets" of the IPv6 address are used in the comparison, frequently being between 0 and 4294967295.

Improve Documentation for 1.0.0 RC1

Required Sections

  1. How to install LR Tools
  2. Guidance on handling permission issues, reference MS Docs as well
  3. Guidance on how to test install was successful
  4. Matrix on which LR Cmdlets are supported in which version of LR

Would like to capture gifs that showcase going through the installer.

Optional Sections

  1. Teach me to crawl
  2. Teach me to walk

List Update should retry when SQL Transaction Deadlock is encountered

Expected Behavior

When Update-LrList calls the API and gets an SQL Transaction Deadlock error, it should retry (up to max retries).

Actual Behavior

When Update-LrList calls the API and gets an SQL Transaction Deadlock error the list is not updated with new values.

Steps to Reproduce the Problem

This problem is somewhat intermittent, and dependent on overall platform performance.

  1. Execute an Invoke-RfSync several times on a production system to induce the problem, perhaps concurrently from two shells.
  2. Alternatively, execute an update of the same list using Update-LrList simultaneously using two shells.

Specifications

  • Version: 1.2.2
  • Platform: LogRhythm 7.7.0
  • Subsystem: Admin/Lists

Output from error:

[07/14/21 09:13:41] - Updating List: RF : IP : ConfLo : Phishing Host
Invoke-RestMethod: F:\Installers\LogRhythm\LogRhythm.Tools\build\debug\d45d613f-b7bb-4478-b811-ac79fd4c8e15\1.2.1\Public\LogRhythm\Admin\Lists\Update-LrList.ps1:427
Line |
 427 |  … $Response = Invoke-RestMethod $RequestUrl -Headers $Headers -Method $ …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | {"statusCode":500,"message":"mssql: Transaction (Process ID 123) was deadlocked on lock resources with
     | another process and has been chosen as the deadlock victim. Rerun the transaction."}

Setup: Workaround when Get-LrInstallerInfo can't find install scope paths

Overview

Install Scope is used as the path to where modules are installed for the system.

  • User Scope: $HOME + Documents\WindowsPowerShell\Modules
  • System Scope: $PSHOME or $Env:ProgramFiles - typicall t

Option 1

Update Install-Lrt to prompt the user for an install location if the standard install scope path can't be found.

Option 2

Update Setup.ps1 to accept a custom module install location which is then passed to Install-Lrt as a parameter.

Setup: Installed config needs to be updated when structure changes

Expected Behavior

Scenario:

  • User has LRT installed w/ config in place
  • New release that includes changes to config LogRhythm.Tools.json
  • When new version is installed, the two are merged or otherwise updated with the new structure
  • Previous values are retained?

Actual Behavior

Currently the existing configuration in LocalAppData is not changed at all.

Steps to Reproduce the Problem

  1. Make a new section to LogRhythm.Tools.json
  2. Run from tests\Lrt.Publisher\Test-LrtPublish.ps1
  3. Setup will fail to update configuration because the old version wasn't updated.
The property 'DomainName' cannot be found on this object. Verify that the property exists and can be set.
At C:\repos\_community\LogRhythm.Tools\tests\Lrt.Publisher\data\lrt-install\Setup.ps1:202 char:17
+ ...             $LrtConfig.($ConfigCategory.Name).($ConfigField.Name) = $ ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyNotFound

Output encoding issue (in Identities API)

Expected Behavior

Output from Get-LRIdentityById handles UTF-8 names correctly.

Problem

Actual Behavior

Output is encoded using "ISO-8859-1"

Steps to Reproduce the Problem

  1. Create Identity with first name Joël (for example).
  2. Perform Get-LrIdentityById [INSERT_ID]
  3. Output shows Joëll

Workaround

  1. $bytes = [System.Text.Encoding]::GetEncoding("ISO-8859-1").GetBytes($identity.nameFirst)
  2. [System.Text.Encoding]::UTF8.GetString($bytes)

Specifications

  • Version: LogRhythm.Tools 1.2.2
  • Platform: LogRhythm 7.8.0.8004
  • Subsystem: Admin/Identities API

DX: Cmdlet Storyboard Design

Feature
Story board design the public & private cmdlets that would be required to support:

  • Retrieving health status for Elasticsearch

    • Cluster
    • Node
      • Status
      • Roles
    • Shards
    • Indexes
      • Status
  • Apply configuration changes to support

    • Rolling restarts
    • Cluster Zones
    • Close Indexes
    • Open Indexes
    • Delete Indexes

System Capability to:

  • Remote authentication
  • Service management
  • Service health

Update-LrAlarm returns errors if updated status is not supplied

Expected Behavior

When calling Update-LrAlarm -AlarmId 1234 -RBP 96, the function should use the current status of the alarm.

Actual Behavior

When calling Update-LrAlarm -AlarmId 1234 -RBP 96 it returns an error as follows:

Test-LrAlarmStatus: F:\Installers\LogRhythm\LogRhythm.Tools\build\debug\7ff64328-a280-42ac-80a9-eb0e29ceef64\1.2.1\Public\LogRhythm\Alarms\Update-LrAlarm.ps1:150
Line |
 150 |  …       $ValidStatus = Test-LrAlarmStatus -Id $AlarmDetails.alarmStatus
     |                                                ~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot bind argument to parameter 'Id' because it is an empty string.

This is because the alarmStatus property is a sub-property of $AlarmDetails.alarmDetails.

$AlarmDetails is obtained using Get-LrAlarm -AlarmId 1234, without the -ResultsOnly option when no updated status is supplied.

PR Incoming.

Steps to Reproduce the Problem

  1. Locate a valid AlarmId
  2. Call Update-LrAlarm -AlarmId $AlarmId -RBP 96
  3. Observe the error

Specifications

  • Version: development
  • Platform: LogRhythm
  • Subsystem: Alarms

Case Module: Move ID Testing logic to its own command

Decouple ID handling logic from the Lr Case commands into a private test command.

Existing Code

# Test CaseID Format
$IdFormat = Test-LrCaseIdFormat $Id
if ($IdFormat.IsGuid -eq $True) {
    # Lookup case by GUID
    try {
        $Case = Get-LrCaseById -Id $Id
    } catch {
        $PSCmdlet.ThrowTerminatingError($PSItem)
    }
    # Set CaseNum
    $CaseNumber = $Case.number
} elseif(($IdFormat.IsGuid -eq $False) -and ($IdFormat.ISValid -eq $true)) {
    # Lookup case by Number
    try {
        $Case = Get-LrCaseById -Id $Id
    } catch {
        $PSCmdlet.ThrowTerminatingError($PSItem)
    }
    # Set CaseNum
    $CaseNumber = $Case.number
} else {
    # Lookup case by Name
    try {
        $Case = Get-LrCases -Name $Id -Exact
    } catch {
        $PSCmdlet.ThrowTerminatingError($PSItem)
    }
    # Set CaseNum
    $CaseNumber = $Case.number
}

Include RuleBlockId on DrilldownSummary and DrillDownResult.SummaryFields

Is your feature request related to a problem? Please describe.
In processing the results from the AIE Drilldown Cache API, LogRhythm.Tools removes the Rule Block identifier from the Summary Fields. This precludes formatting the resulting data in a fashion similar to what is provided the LR Web Console as there is no indication which rule block each summary came from.

Describe the solution you'd like
If the RuleBlockId is included in the Get-AieDrillDownResults.SummaryFields as well as in Get-AieDrillDownSummary then the resulting information can be formatted/presented in a similar way to the Web Console Inspector.

Describe alternatives you've considered
Re-summarising the DrilldownLogs provided in the Get-AieDrilldownResults is challenging to achieve the same results, and essentially re-performs the work already performed by the AIE Cache Drilldown Service.

Additional context
The following screenshot is representative of the type of information presented in the WebConsole:

alarm-ruleblocksummary

Get-LrNetworks page handling treats offset as pages when API treats it as items

Expected Behavior

When requesting all network entries for an Entity, the results should be returned quickly, with no duplicates. For 1261 networks, by default, that should be 2 pages.

Actual Behavior

When requesting all network entries for an Entity, the results take a while to retrieve. Using verbose, this indicates that ~262 requests are made.

Steps to Reproduce the Problem

  1. Call Get-LrNetworks on an entity with > 1000 entries, or use a smaller value for PageValuesCount with Verbose option
  2. Observe large number of requests.

Specifications

  • Version: LogRhythm.Tools 1.3.2, LogRhythm 7.9.0
  • Platform: Windows Server 2016
  • Subsystem: lr-admin-api - Networks

Sample Logs

Get-LrNetworks -Entity 'Global Entity' -verbose
VERBOSE: [Get-LrNetworks]: Validating Entity as String.  EntityName: Global Entity
VERBOSE: [Get-LrEntities]: QueryString is [?count=1000&offset=0&dir=ascending&name=Global Entity&orderBy=name]
VERBOSE: [Get-LrEntities]: Request URL: https://lab-xm:8501/lr-admin-api/entities/?count=1000&offset=0&dir=ascending&name=Global Entity&orderBy=name
VERBOSE: GET with 0-byte payload
VERBOSE: received 203-byte response of content type application/json
VERBOSE: Content encoding: utf-8
VERBOSE: [Get-LrEntities]: Exact list name match found.
VERBOSE: [Get-LrNetworks]: QueryString is [?count=1000&offset=0&Entity=Global Entity&recordStatus=active]
VERBOSE: [Get-LrNetworks]: Request URL: https://lab-xm:8501/lr-admin-api/networks/?count=1000&offset=0&Entity=Global Entity&recordStatus=active
VERBOSE: GET with 0-byte payload
VERBOSE: received -byte response of content type application/json
VERBOSE: Content encoding: utf-8
VERBOSE: [Get-LrNetworks]: Begin Pagination
VERBOSE: [Get-LrNetworks]: Request URL: https://lab-xm:8501/lr-admin-api/networks/?count=1000&offset=1&Entity=Global Entity&recordStatus=active
VERBOSE: GET with 0-byte payload
VERBOSE: received -byte response of content type application/json
VERBOSE: Content encoding: utf-8
VERBOSE: [Get-LrNetworks]: Request URL: https://lab-xm:8501/lr-admin-api/networks/?count=1000&offset=2&Entity=Global Entity&recordStatus=active

Expand Publish-LrtBuild to support producing dedicated Linux/PowerShell Core

Feature
Feature to add in support for creating dedicated PowerShell Core packages.

As Linux/PowerShell Core has a different yet consistent folder structure we should establish the automation to create dedicated release packages to support this platform to enable installation and management.

Describe the solution you'd like
A release experience that would be similar to this:

Publish-LrtBuild -BuildId 3a975a7a-f843-4c2d-a76b-61cf5736d118 -Destination "C:\temp" -PackageType "PSCore-Linux"

It would be acceptable for the default release package produced to be the Windows 5.1 experience we have today.

Improper command name: Create-LrPsArraySegments

  1. Command name should be updated, improper verbs can result in users receiving warning messages.
  2. Command uses abbrev LrPs, should be Lrt. Commands inside of the LogRhythm folder / specific to LogRhythm use Lr. Outside of LogRhythm folder use Lrt, since they are still associated with LogRhythm.Tools.

Alternative: Since this command chops up a collection into the desired number of smaller collections - the verb split would be appropriate here:

  • Split-LrtCollection (more generic than "array")
  • Split-LrtArray

When calling Get-LrNetworks either/both -BIP or -EIP arguments, these are not passed to the API

Expected Behavior

When calling Get-LrNetworks with either or both of the BIP or EIP arguments, their values should be added to the query string, resulting in the API performing filtering of the networks.

Actual Behavior

When calling Get-LrNetworks with either of the argument, their values are ignored, and all networks that match remaining parameters are returned.

Steps to Reproduce the Problem

  1. Call Get-LrNetworks -BIP 1.1.1.0 -Verbose
  2. Output shows repeated calls to get more networks until all networks are returned. Verbose output shows query string with empty BIP parameter.

Specifications

  • Version: LogRhythm.Tools dev-1.3.3 and earlier, LogRhythm 7.9.0
  • Platform: Windows Server 2016, PowerShell Core 7.2.5
  • Subsystem: lr-admin-api/networks

Sample Logs

 Get-LrNetworks -BIP "51.13.16.0" -Entity 'Global Entity' -verbose
VERBOSE: [Get-LrNetworks]: Validating Entity as String.  EntityName: Global Entity
VERBOSE: [Get-LrEntities]: QueryString is [?count=1000&offset=0&dir=ascending&name=Global Entity&orderBy=name]
VERBOSE: [Get-LrEntities]: Request URL: https://lab-xm:8501/lr-admin-api/entities/?count=1000&offset=0&dir=ascending&name=Global Entity&orderBy=name
VERBOSE: GET with 0-byte payload
VERBOSE: received 203-byte response of content type application/json
VERBOSE: Content encoding: utf-8
VERBOSE: [Get-LrEntities]: Exact list name match found.
VERBOSE: [Get-LrNetworks]: QueryString is [?count=1000&offset=0&Entity=Global Entity&BIP=&recordStatus=active]
VERBOSE: [Get-LrNetworks]: Request URL: https://lab-xm:8501/lr-admin-api/networks/?count=1000&offset=0&Entity=Global Entity&BIP=&recordStatus=active
VERBOSE: GET with 0-byte payload
VERBOSE: received -byte response of content type application/json
VERBOSE: Content encoding: utf-8
VERBOSE: [Get-LrNetworks]: Begin Pagination
VERBOSE: [Get-LrNetworks]: Request URL: https://lab-xm:8501/lr-admin-api/networks/?count=1000&offset=1&Entity=Global Entity&BIP=&recordStatus=active
VERBOSE: GET with 0-byte payload
VERBOSE: received -byte response of content type application/json
VERBOSE: Content encoding: utf-8
VERBOSE: [Get-LrNetworks]: Request URL: https://lab-xm:8501/lr-admin-api/networks/?count=1000&offset=2&Entity=Global Entity&BIP=&recordStatus=active

New-LrList fails to create list when it is not a General Value List

Expected Behavior

When creating a list that is not a General Value list, such as IP, Host, Log Source, Classification, etc., list creation should succeed.

Actual Behavior

When creating a list that is not a General Value list the Use Context is supplied with an empy value, breaking LR's List Creation API.

Steps to Reproduce the Problem

  1. New-LrList -Name "List Name" -ListType ip -ShortDescripion "List Description" -ReadAccess private -WriteAccess private -Owner 3 -EntityName "Primary Site"

List creation fails with error:

Public\LogRhythm\Admin\Lists\New-LrList.ps1:314
Line |
 314 |  … $Response = Invoke-RestMethod $RequestUrl -Headers $Headers -Method $ …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | {"statusCode":400,"message":"Bad Request","validationErrors":["body.useContext must match one of the
     | following:
     | None,Address,DomainImpacted,Group,HostName,Message,Object,Process,Session,Subject,URL,User,VendorMsgID,DomainOrigin,Hash,Policy,VendorInfo,Result,ObjectName,CVE,UserAgent,ParentProcessId,ParentProcessName,ParentProcessPath,SerialNumber,Reason,Status,ThreatId,ThreatName,SessionType,Action,ResponseCode"]}

Specifications

  • Version: development
  • Platform: LogRhythm 7.7.0
  • Subsystem: Admin API - Lists

New Feature: Email w/ Templates

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Add capability for LRT to send mail - primary use case would be for notifications used in SmartResponses, such as failures / status, but could be much more.

Describe the solution you'd like
A clear and concise description of what you want to happen.

Multiple templates stored in the config dir (localappdata), which can be specified when the command is run.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

We could leave this up to the user, but I've desired it often enough it may be worthwhile.

Additional context
Add any other context or screenshots about the feature request here.

Invoke-RfSync does not allow to specify Entity Name (or ID) for lists

Expected Behavior

When you Invoke-RfSync, the lists that it creates should be able to be created with a Specific Entity.

Actual Behavior

Since Invoke-RfSync does not cater for specifying the Entity Name (only the Owner), when it calls New-LrList, the default is to use Primary Site. If this entity does not exist, list creation fails.

\LogRhythm\Admin\Lists\New-LrList.ps1:314
Line |
 314 |  … $Response = Invoke-RestMethod $RequestUrl -Headers $Headers -Method $ …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | {"statusCode":404,"message":"Entity name 'Primary Site' not found."}

Steps to Reproduce the Problem

  1. Have an LR deployment without a Primary Site entity name
  2. Obtain and configure API Keys for both LR and RecordedFuture
  3. Run Invoke-RfSync -Owner "Owner Name"

Specifications

  • Version: 1.2.0
  • Platform: RecordedFuture/LogRhythm
  • Subsystem: Lists

Get-LrLists returns a mix of Retired + Active lists

Is your feature request related to a problem? Please describe.

When working with LogRhythm Lists, it is possible for lists with Duplicate Names to exist where both Active and Retired lists are present. The default behaviour for Get-LrLists would preferably only return Active Lists, and only return Retired Lists when specifically requested.

Describe the solution you'd like

An added option on the CmdLet to return retired lists when requested would be the preferred solution. This woudl also be in line with behaviour in both LogRhythm Console as well as the Web UI.

Describe alternatives you've considered

Alternatives are to ensure that every list name is unique (for both active and retired lists), and to specify ExactMatch when only one list is desired.

Additional context

This specifically tied in with the Recorded Future functionalith in which it updates lists. I encountered an issue with automation, where I use the Invoke-RfSync, which created lists, then I imported AIE rules from another platform, which also created the same lists, with the same names (some truncated).

Calling Update-LrLogSource on LogSource With Empty Filepath Fails

Expected Behavior

Expected behavior is to complete successfully when supplying new filePath value to Log Source where the filePath value is currently null or empty.

Actual Behavior

Exception is thrown that states:

Exception setting "filePath": "The property 'filePath' cannot be found on this object. Verify that the property exists and can be set."

Steps to Reproduce the Problem

  1. Call Update-LrLogSource on existing Log Source with empty FilePath value. Works fine if there is an existing value.

Specifications

  • Version: 1.3.2
  • Platform: Windows 10 21H2
  • Subsystem: Powershell 5.1

Duplicate object when TrustAllCertsPolicy preexisting

Expected Behavior

I should be able to use LR Tools in cases where the script already set TrustAllCertsPolicy
Add-Type : Cannot add type. The type name 'TrustAllCertsPolicy' already exists.

 At C:\Program Files\WindowsPowerShell\Modules\LogRhythm.Tools\1.0.0\Private\Enable-TrustAllCertsPolicy.ps1:40 char:13
 +             Add-Type $PSDesktopException
 +             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 + CategoryInfo          : InvalidOperation: (TrustAllCertsPolicy:String) [Add-Type], Exception
 + FullyQualifiedErrorId : TYPE_ALREADY_EXISTS,Microsoft.PowerShell.Commands.AddTypeCommand
 

Actual Behavior

Calls to points such as Get-LrAieDrilldown -AlarmID xxx will caught by try/catch logic if 'TrustAllCertsPolicy' is preexisting in the script. I added a bit of logic in my Enable-TrustAllCertsPolicy to avoid the issue:

if ("TrustAllCertsPolicy" -as [type]) {
	break 
} 

New-LRList Throws Exception Around Invalid Owner ID in Request Body

Expected Behavior

Calling New-LRList should create the requested list specified by -name property.

Actual Behavior

Bad request exception is throw that states, "{"statusCode":400,"message":"Invalid owner id available in request body."}"

Steps to Reproduce the Problem

  1. New-LrList -name AndruskList -ListType Host -Owner 2

Specifications

  • Version: 1.3.2
  • Platform: Windows 10 21H2
  • Subsystem: Powershell 5.1

LrtConfig: Change DataIndexerIP to DataIndexerHost

Overview

LrtConfig.LogRhythm: The DataIndexerIP field can actually be either its ip OR hostname.

Two changes:

  • LogRhythm.Tools.json: Change DataIndexerIP to DataIndexerHost
  • Lrt.Config.Input.json: Update Prompt, Hint, and InputCmd

Note

The other properties that can accept a hostname or ip are all URLs. Need to test to ensure that won't be a problem.

Standardize Cmdlet Output Objects

Requirement

LR cmdlets that update or create new entities should not return new/modified objects by default, similar to the way built-in cmdlets work.

Milestone

Note: I'd like this to be done in 1.0.1, and I can do all of these myself, but need to make sure there aren't any other significant changes being made to any commands that would be difficult to merge with these changes. That's why I've added you to this issue as well, @Jt3kt .

Detail

I've tried to incorporate as many standards and best practices as possible while developing SRF/LRT, but some things weren't immediately obvious, and Passthru is one of them. At first I expected that commands should always produce output, but in the PowerShell world, returning nothing is good and expected, unless you are working with commands that specifically retrieve information ( e.g., Get-Something). Or unless you specifically ask for output via the Passthru parameter.

To bring LRT in line with PowerShell design principles, we should update commands that manipulate data (New/Add/Set/Update) to return nothing, unless the -Passthru parameter is specified, which will then return the new or modified object.

This blog entry sort of articulates how this is a common design in PowerShell.

Setup: Install fails because $env:Home is not set

Expected Behavior

Some systems or users may not have $env:Home or $home set. It turns out $env:Home may not be standard at all. Need to catch this scenario for user scope when these are missing.

Error Message / Diagnostics

PS C:\Users\erich\Documents\GitHub\SmartResponse.Framework\dist> .\Setup.ps1

Join-Path : Cannot bind argument to parameter 'Path' because it is null.
At C:\Users\erich\Documents\GitHub\SmartResponse.Framework\dist\installer\include\Get-LrtInstallerInfo.ps1:93 char:15
+         -Path $Env:HOME `
+               ~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Join-Path], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand
Join-Path : Cannot bind argument to parameter 'Path' because it is an empty string.
At C:\Users\erich\Documents\GitHub\SmartResponse.Framework\dist\installer\include\Get-LrtInstallerInfo.ps1:96 char:15
+         -Path $UserScope.Path `
+               ~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Join-Path], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand
Test-Path : Cannot bind argument to parameter 'Path' because it is an empty string.
At C:\Users\erich\Documents\GitHub\SmartResponse.Framework\dist\installer\include\Get-LrtInstallerInfo.ps1:103 char:19
+     if (Test-Path $UserScope.InstallPath) {
+                   ~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Test-Path], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.TestPathCommand

Possible Solution

Remove $env:Home and replace it with $home, as well as a check to make sure its valid.

Steps to Reproduce

  1. Publish LRT
  2. Run Setup.ps1

Add functionality to update LR tools to new version from command line.

Is your feature request related to a problem? Please describe.
Not a problem, just laziness.

Describe the solution you'd like
It'd be nice if i could run something like Get-LrToolsUpdate and have it check the repo for a newer release, and download / install it for me instead of having to come here and download it again.

Describe alternatives you've considered
I'm lazy so there are no other alternatives, semi-automatic updates or bust!

Add-LrIdentity missing -Title

Is your feature request related to a problem? Please describe.
LogRhythm Identities do store the Title of the person. But there is no way to provide it while calling Add-LrIdentity

Describe the solution you'd like
Having a -Title [string] parameter that would allow providing the Title for the user/person.

Describe alternatives you've considered
None.

Additional context
Other Identities related functions might be missing this feature too.

Update Setup.ps1 to support handling LogRhythm Cloud

Expected Behavior

When setting up LR.Tools for LogRhythm cloud the schema in the LR.Tools.json needs to be updated.

LogRhythm Cloud's API endpoints are available over TCP port 443 and not over 8501.

Actual Behavior

Adding in the URL's for a LogRhythm Cloud endpoint creates:
https://URLforLogRhythmCloud.cloud:8501/endpoint/

Recommended fix:
Inspect the provided URL based on regex for the url.cloud and when that is applied seed in the LR.Tools.json config to align to schema:
https://URLforLogRhythmCloud.cloud/endpoint/

Specifications

  • Version: Any
  • Platform: LogRhythm Cloud
  • Subsystem: LogRhythm.Tools 1.0.0

Function Invoke-LrAssociateAgentRecord does not function

Expected Behavior

Based on the function name, it should associate a Pending Agent record to an existing agent using the /lr-admin-api/agents-request/{guid}/associate API Endpoint. This requires the existing Agent ID to associate to.

Actual Behavior

Returns 405 - Method Not Allowed

Steps to Reproduce the Problem

  1. Call the function with just the agent ID as per spec

Specifications

  • Version: dev-1.2.5
  • Platform: 7.9.0
  • Subsystem: lr-admin-api

Additional Notes

I was reviewing the general module for release readiness, and noted that the function's description differed greatly from what it attempts to do. Additionally, for this function to work, a Get-LrPendingAgent function will be required to get the required guid for the association.

It may be that this function was added by copy/paste, in readiness for new functionality, but not completed.

New-TestBuild: Re-Implement for development purposes

Overview

We used to have a script called New-TestBuild that would make it easier for developers to re-load the LogRhythm.Tools module with the changes they've made. This was lost when the updated/new Lrt.Builder and Lrt.Installer modules were developed.

Solution

Re-implement New-TestBuild for the current generation of the project.

MessageSourceTypeId to Get-LrLogSources not used in search

Expected Behavior

Lookups to Get-LrLogSources should allow lookups with the flag -MessageSourceTypeId xxxx and return specific results

Actual Behavior

All log sources are returned.

Steps to Reproduce the Problem

Get-LrLogSources -MessageSourceTypeId "12345" -verbose

VERBOSE: [Enable-TrustAllCertsPolicy]: Cert Policy is not enabled. Enabling.
VERBOSE: []: QueryString is [?count=1000&offset=0&recordStatus=active]
VERBOSE: GET https://xx:8501/lr-admin-api/logsources/?count=1000&offset=0&recordStatus=active with 0-byte
payload
VERBOSE: received -1-byte response of content type application/json
VERBOSE: [Enable-TrustAllCertsPolicy]: Cert Policy is not enabled. Enabling.
VERBOSE: []: QueryString is [?count=1000&offset=1000&recordStatus=active]
VERBOSE: GET https://xxx:8501/lr-admin-api/logsources/?count=1000&offset=1000&recordStatus=active with 0-byte
 payload
VERBOSE: received -1-byte response of content type application/json
VERBOSE: [Enable-TrustAllCertsPolicy]: Cert Policy is not enabled. Enabling.
VERBOSE: []: QueryString is [?count=1000&offset=2000&recordStatus=active]
VERBOSE: GET https://xxx:8501/lr-admin-api/logsources/?count=1000&offset=2000&recordStatus=active with 0-byte
 payload
VERBOSE: received -1-byte response of content type application/json

Specifications

  • Version: 1.0.0

Handling LogRhythm API 429 Errors

Requirement

All LR cmdlets should support rate limiting to throttle requests should the LR API return HTTP 429. As commands are frequently combined via the pipeline, it is possible for any of the LR cmdlets that access the RestAPI to trigger such an error.

For Example, this is a 429 received by Get-LrCaseById as a result of calling Get-LrCases

> $July[300].Metrics

LookupType : CaseNumber
IsValid    : False
Value      : 3833
CaseNumber :
CaseName   :
CaseGuid   :
Note       : Rate Limit Exceeded

Milestone

Include in 1.0.1 as a fix for this issue

Detail

This issue pops up primarily in the metrics commands, because it works like this:

  1. Get-LrCases: Rest Request to /cases/
  2. Get-LrCaseMetrics: receives the Case ID via pipeline, and needs to test it with Test-LrCaseIdFormat, which hits the API
  3. Get-LrCaseMetrics: Rest Request to /cases/$CaseNumber/metrics`

That's three requests for each request returned by Get-LrCases, and when you pull a couple hundred cases or so, the rate limit of the API will be triggered.

Add-LrIdentity - Using SyncName to generate VendorUniqueKey prevent multiple users being added with the same SyncName

Expected Behavior

Being able to create multiple Identities using the same SyncName

Actual Behavior

Any subsequent Identities creation attempts simply override the first one created using the same SyncName

Steps to Reproduce the Problem

  1. Add-LrIdentity -EntityId 1 -NameFirst 'Bob' -NameLast 'Pop' -SyncName 'Test-Import' -DisplayIdentifier '[email protected]' -Identifier1Type email -Identifier1Value '[email protected]'
  2. Add-LrIdentity -EntityId 1 -NameFirst 'Bill' -NameLast 'Pop' -SyncName 'Test-Import' -DisplayIdentifier '[email protected]' -Identifier1Type email -Identifier1Value '[email protected]'
  3. Get-LrIdentities

Result:
Only one Identity created, with the details of the last request:
identityID : 7 nameFirst : Bill nameMiddle : nameLast : Pop displayIdentifier : [email protected] company : department : title : manager : addressCity : domainName : entity : @{entityId=1; rootEntityId=0; path=Primary Site; name=Primary Site} dateUpdated : 2020-10-12T16:50:00.773Z recordStatus : Active identifiers : {@{identifierID=8817; identifierType=Email; [email protected]; recordStatus=Active; source=}} groups : {@{name=Domain Admins}}

Specifications

  • Version: LRT v1.0.0
  • Platform: 7.5.0
  • Subsystem:

Case Status Parameters should use ValidateSet

Validate Set for the values below anywhere a Case Status Parameter is used.

  • Created
  • Completed
  • Incident
  • Mitigated
  • Resolved

Validate set for values below anywhere a Procedure Step Status Parameter is used.

  • Completed
  • NotCompleted

LrtConfig: DX Nodes

Is your feature request related to a problem? Please describe.
Expand the LrtConfig to permit the optional addition of DX Cluster(s). At the install/re-configure of LogRhythm.Tools the user should be able to prompted to configure DX environment. I do recommend we put in place step in the LogRhythm setup for L.rTools for Advanced or Basic as expanding into the direction this configuration is intended to support is for Advance use cases only.

The installer should have the ability to dynamically scale/set the LogRhythm.Tools.json based on the installing user's provided input for DX to reduce bloat and keep the config focused on relevant enabled content.

Describe the solution you'd like
Expand the LogRhythm config to permit the following structure example:

"LogRhythm": {
        "Version":"7.5.0",
        "AdminBaseUrl": "https://[NOT_SET]:8501/lr-admin-api",
        "CaseBaseUrl": "https://[NOT_SET]:8501/lr-case-api",
        "AieBaseUrl": "https://[NOT_SET]:8501/lr-drilldown-cache-api",
        "SearchBaseUrl": "https://[NOT_SET]:8501/lr-search-api",
        "ApiKey": "",
	"DX": {
		"Cluster1": {
			"Health": "",
			"Master": "",
			"Open": "",
			"Closed": "",
			"Zones": {
				"Zone1": "",
				"Zone2": ""
			}
			"Node1": {
				"Hostname": "",
				"IPAddress": "",
				"2xDx": false,
				"WarmNode": false,
				"Zone": ""
			},
			"Node2": {
				"Hostname": "",
				"IPAddress": "",
				"2xDx": false,
				"WarmNode": false,
				"Zone": ""
			},
			"Node3": {
				"Hostname": "",
				"IPAddress": "",
				"2xDx": false,
				"WarmNode": false,
				"Zone": ""
			}
		},
		"Cluster2": {
			"Health": "",
			"Master": "",
			"Open": "",
			"Closed": "",
			"Zones": {
				"Zone1": "",
				"Zone2": ""
			}
			"Node1": {
				"Hostname": "",
				"IPAddress": "",
				"2xDx": false,
				"WarmNode": false,
				"Zone": ""
			},
			"Node2": {
				"Hostname": "",
				"IPAddress": "",
				"2xDx": false,
				"WarmNode": false,
				"Zone": ""
			},
			"Node3": {
				"Hostname": "",
				"IPAddress": "",
				"2xDx": false,
				"WarmNode": false,
				"Zone": ""
			}
		},
		"Cluster3": {
			"Health": "",
			"Master": "",
			"Open": "",
			"Closed": "",
			"Zones": {
				"Zone1": "",
				"Zone2": ""
			}
			"Node1": {
				"Hostname": "",
				"IPAddress": "",
				"2xDx": false,
				"WarmNode": false,
				"Zone": ""
			},
			"Node2": {
				"Hostname": "",
				"IPAddress": "",
				"2xDx": false,
				"WarmNode": false,
				"Zone": ""
			},
			"Node3": {
				"Hostname": "",
				"IPAddress": "",
				"2xDx": false,
				"WarmNode": false,
				"Zone": ""
			}
		}
	}
}

Additional context
The primary goal of this will be to expand into advance DX management to support controlled automated rolling restarts, troubleshooting, and applying advance DX configuration(s).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.