BloodHoundAD / AzureHound

Azure Data Exporter for BloodHound
GNU General Public License v3.0
556 stars 75 forks source link

BED-4599 configurable collection values #81

Closed juggernot325 closed 2 months ago

juggernot325 commented 2 months ago

This PR adds the ability to configure various values related to collecting data from Azure. These configuration options are not required to be set in the config file and will use a reasonable default if not set. Allowing these values to be easily configured can help to improve collection times or troubleshoot issues with collection.

The newly added options are:

To configure them, simply add a new attribute to the config.json file with one of the names above. Here's an example:

{
  "access-types": [],
  "app": "12345",
  "auth": "", 
  "cert": "", 
  "config": "/Users/jbarnett/.config/azurehound/config.json",
  "graph": "",
  "instance": "http://bhe.localhost:80",
  "json": false,
  "jwt": "",
  "key": "",
  "keypass": "",
  "log-file": "",
  "mgmt": "",
  "mgmtgroupid": [],
  "output": "",
  "password": "",
  "pprof": "",
  "proxy": "",
  "refresh-token": "",
  "region": "cloud",
  "secret": "<REDACTED>",
  "subscriptionid": [],
  "tenant": "<REDACTED>",
  "token": "<REDACTED>",
  "tokenid": "<REDACTED>",
  "username": "",
  "batchSize": 5,
  "maxConnsPerHost": 50,
  "maxIdleConnsPerHost": 50,
  "streamCount": 10,
}

Also, the default values for each of these values have been adjusted to hopefully give better performance. Testing has shown that these new defaults provide better collection times, less timeouts, and better memory management in large environments.

Lastly, the new configuration options have built-in sanity checks to prevent setting to harmful values. If the option is found to be set outside of the defined bounds it will revert to the default value.