Module: Threatstack::Control
- Includes:
- Constants
- Defined in:
- lib/control.rb
Constant Summary
collapse
- @@agent_initialized =
false
- @@agent_init_mutex =
Mutex.new
Constants included
from Constants
Threatstack::Constants::AGENT_ID, Threatstack::Constants::AGENT_INSTANCE_ID, Threatstack::Constants::AGENT_NAME, Threatstack::Constants::AGENT_VERSION, Threatstack::Constants::APPSEC_BASE_URL, Threatstack::Constants::APPSEC_EVENTS_URL, Threatstack::Constants::ATTACK, Threatstack::Constants::AWS_METADATA_URL, Threatstack::Constants::BLOCK_PATH_TRAVERSAL, Threatstack::Constants::BLOCK_SQLI, Threatstack::Constants::BLOCK_XSS, Threatstack::Constants::CGI_VARIABLES, Threatstack::Constants::DEPENDENCIES, Threatstack::Constants::DETECTED_NOT_BLOCKED, Threatstack::Constants::DETECT_ATTACKS_ONLY, Threatstack::Constants::DETECT_PATH_TRAVERSAL, Threatstack::Constants::DISABLED, Threatstack::Constants::DROP_FIELDS, Threatstack::Constants::ENVIRONMENT, Threatstack::Constants::EVENTS_PER_REQ, Threatstack::Constants::FILTER_BY_PATH, Threatstack::Constants::INSTRUMENTATION, Threatstack::Constants::IPV4, Threatstack::Constants::IPV6, Threatstack::Constants::JOB_INTERVAL, Threatstack::Constants::LOG_COLORS, Threatstack::Constants::LOG_LEVEL, Threatstack::Constants::MANUAL_INIT, Threatstack::Constants::MAX_QUEUED_EVENTS, Threatstack::Constants::PATH_TRAVERSAL, Threatstack::Constants::REDACTED, Threatstack::Constants::REQUEST_BLOCKED, Threatstack::Constants::ROOT_DIR, Threatstack::Constants::RUBY, Threatstack::Constants::SQLI, Threatstack::Constants::TRUTHY, Threatstack::Constants::XSS
Class Method Summary
collapse
Methods included from Constants
app_root_dir, env, is_truthy
Class Method Details
._setup_agent ⇒ Object
73
74
75
76
|
# File 'lib/control.rb', line 73
def self._setup_agent
self.init unless DISABLED || MANUAL_INIT
end
|
.init ⇒ Object
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
# File 'lib/control.rb', line 22
def self.init
@@agent_init_mutex.synchronize do
return if @@agent_initialized
@@agent_initialized = true
end
logger = Threatstack::Utils::TSLogger.create 'MainAgent'
logger.info 'Initializing Threatstack Ruby agent'
logger.info 'Instrumenting Rails...'
Threatstack::Instrumentation::Frameworks::TSRails.patch_action_controller
logger.info 'Done instrumenting Rails'
if(!DETECT_ATTACKS_ONLY)
logger.info 'Instrumenting Kernel methods...'
Threatstack::Instrumentation::Frameworks::TSKernel.wrap_methods
logger.info 'Done instrumenting Kernel methods'
end
logger.info 'Starting Event Submitter...'
Threatstack::Jobs::EventSubmitter.instance.start
logger.info 'Started Event Submitter'
if(!DETECT_ATTACKS_ONLY)
Threatstack::Jobs::DelayedJob.new(logger, 5) do
dep_event = Threatstack::Events::DependencyEvent.new
Threatstack::Jobs::EventSubmitter.instance.queue_event dep_event
Threatstack::Jobs::EventSubmitter.instance.queue_event Threatstack::Events::EnvironmentEvent.new
end
Threatstack::Jobs::DelayedJob.new('DelayedConfig', 20) do
Threatstack::Instrumentation::Frameworks::TSRails.report_application_config
end
end
logger.info 'Initialization done for agent'
end
|