Skip to content

Commit

Permalink
chore: add config option for startup wait period enablement (only aff…
Browse files Browse the repository at this point in the history
…ects BHE right now)
  • Loading branch information
superlinkx committed Jan 24, 2024
1 parent c07943c commit afb8f24
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 47 deletions.
53 changes: 27 additions & 26 deletions cmd/api/src/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,32 +139,33 @@ type DefaultAdminConfiguration struct {
}

type Configuration struct {
Version int `json:"version"`
BindAddress string `json:"bind_addr"`
NetTimeoutSeconds int `json:"net_timeout_seconds"`
SlowQueryThreshold int64 `json:"slow_query_threshold"`
MaxGraphQueryCacheSize int `json:"max_graphdb_cache_size"`
MaxAPICacheSize int `json:"max_api_cache_size"`
MetricsPort string `json:"metrics_port"`
RootURL serde.URL `json:"root_url"`
WorkDir string `json:"work_dir"`
LogLevel string `json:"log_level"`
LogPath string `json:"log_path"`
TLS TLSConfiguration `json:"tls"`
GraphDriver string `json:"graph_driver"`
Database DatabaseConfiguration `json:"database"`
Neo4J DatabaseConfiguration `json:"neo4j"`
Crypto CryptoConfiguration `json:"crypto"`
SAML SAMLConfiguration `json:"saml"`
SpecterAuth SpecterAuthConfiguration `json:"specter_auth"`
DefaultAdmin DefaultAdminConfiguration `json:"default_admin"`
CollectorsBasePath string `json:"collectors_base_path"`
DatapipeInterval int `json:"datapipe_interval"`
EnableAPILogging bool `json:"enable_api_logging"`
DisableAnalysis bool `json:"disable_analysis"`
DisableCypherQC bool `json:"disable_cypher_qc"`
DisableMigrations bool `json:"disable_migrations"`
TraversalMemoryLimit uint16 `json:"traversal_memory_limit"`
Version int `json:"version"`
BindAddress string `json:"bind_addr"`
NetTimeoutSeconds int `json:"net_timeout_seconds"`
SlowQueryThreshold int64 `json:"slow_query_threshold"`
MaxGraphQueryCacheSize int `json:"max_graphdb_cache_size"`
MaxAPICacheSize int `json:"max_api_cache_size"`
MetricsPort string `json:"metrics_port"`
RootURL serde.URL `json:"root_url"`
WorkDir string `json:"work_dir"`
LogLevel string `json:"log_level"`
LogPath string `json:"log_path"`
TLS TLSConfiguration `json:"tls"`
GraphDriver string `json:"graph_driver"`
Database DatabaseConfiguration `json:"database"`
Neo4J DatabaseConfiguration `json:"neo4j"`
Crypto CryptoConfiguration `json:"crypto"`
SAML SAMLConfiguration `json:"saml"`
SpecterAuth SpecterAuthConfiguration `json:"specter_auth"`
DefaultAdmin DefaultAdminConfiguration `json:"default_admin"`
CollectorsBasePath string `json:"collectors_base_path"`
DatapipeInterval int `json:"datapipe_interval"`
EnableStartupWaitPeriod bool `json:"enable_startup_wait_period"`
EnableAPILogging bool `json:"enable_api_logging"`
DisableAnalysis bool `json:"disable_analysis"`
DisableCypherQC bool `json:"disable_cypher_qc"`
DisableMigrations bool `json:"disable_migrations"`
TraversalMemoryLimit uint16 `json:"traversal_memory_limit"`
}

func (s Configuration) TempDirectory() string {
Expand Down
44 changes: 23 additions & 21 deletions cmd/api/src/config/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package config

import (
"fmt"

"github.com/specterops/bloodhound/dawgs/drivers/neo4j"

"github.com/specterops/bloodhound/src/serde"
Expand All @@ -33,27 +34,28 @@ func NewDefaultConfiguration() (Configuration, error) {
return Configuration{}, fmt.Errorf("failed to generate default password: %w", err)
} else {
return Configuration{
Version: 0,
BindAddress: "127.0.0.1",
NetTimeoutSeconds: 70, // Default timeout to avoid race conditions with 60 second gateway timeouts
SlowQueryThreshold: 100, // Threshold in ms for caching queries
MaxGraphQueryCacheSize: 100, // Number of cache items for graph queries
MaxAPICacheSize: 200, // Number of cache items for API utilities
MetricsPort: ":2112",
RootURL: serde.MustParseURL("http://localhost"),
WorkDir: "/opt/bhe/work",
LogLevel: "INFO",
LogPath: DefaultLogFilePath,
CollectorsBasePath: "/etc/bloodhound/collectors",
DatapipeInterval: 60,
EnableAPILogging: true,
DisableAnalysis: false,
DisableCypherQC: false,
DisableMigrations: false,
TraversalMemoryLimit: 2, // 2 GiB by default
TLS: TLSConfiguration{},
SAML: SAMLConfiguration{},
GraphDriver: neo4j.DriverName, // Default to Neo4j as the graph driver
Version: 0,
BindAddress: "127.0.0.1",
NetTimeoutSeconds: 70, // Default timeout to avoid race conditions with 60 second gateway timeouts
SlowQueryThreshold: 100, // Threshold in ms for caching queries
MaxGraphQueryCacheSize: 100, // Number of cache items for graph queries
MaxAPICacheSize: 200, // Number of cache items for API utilities
MetricsPort: ":2112",
RootURL: serde.MustParseURL("http://localhost"),
WorkDir: "/opt/bhe/work",
LogLevel: "INFO",
LogPath: DefaultLogFilePath,
CollectorsBasePath: "/etc/bloodhound/collectors",
DatapipeInterval: 60,
EnableStartupWaitPeriod: true,
EnableAPILogging: true,
DisableAnalysis: false,
DisableCypherQC: false,
DisableMigrations: false,
TraversalMemoryLimit: 2, // 2 GiB by default
TLS: TLSConfiguration{},
SAML: SAMLConfiguration{},
GraphDriver: neo4j.DriverName, // Default to Neo4j as the graph driver
Database: DatabaseConfiguration{
MaxConcurrentSessions: 10,
},
Expand Down

0 comments on commit afb8f24

Please sign in to comment.