tcell_agent 2.1.2 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/tcell_agent +42 -146
- data/lib/tcell_agent.rb +8 -16
- data/lib/tcell_agent/agent.rb +76 -46
- data/lib/tcell_agent/config_initializer.rb +66 -0
- data/lib/tcell_agent/configuration.rb +72 -267
- data/lib/tcell_agent/instrument_servers.rb +14 -16
- data/lib/tcell_agent/instrumentation/monkey_patches/kernel.rb +1 -1
- data/lib/tcell_agent/logger.rb +1 -2
- data/lib/tcell_agent/rails/auth/authlogic.rb +46 -50
- data/lib/tcell_agent/rails/auth/authlogic_helper.rb +20 -0
- data/lib/tcell_agent/rails/auth/devise.rb +101 -103
- data/lib/tcell_agent/rails/auth/devise_helper.rb +29 -0
- data/lib/tcell_agent/rails/auth/doorkeeper.rb +55 -58
- data/lib/tcell_agent/{userinfo.rb → rails/auth/userinfo.rb} +0 -0
- data/lib/tcell_agent/rails/csrf_exception.rb +0 -8
- data/lib/tcell_agent/rails/dlp.rb +0 -4
- data/lib/tcell_agent/rails/middleware/global_middleware.rb +1 -1
- data/lib/tcell_agent/rails/{on_start.rb → railties/tcell_agent_railties.rb} +9 -16
- data/lib/tcell_agent/rails/railties/tcell_agent_unicorn_railties.rb +8 -0
- data/lib/tcell_agent/rails/routes.rb +3 -6
- data/lib/tcell_agent/rails/routes/grape.rb +1 -3
- data/lib/tcell_agent/rails/tcell_body_proxy.rb +0 -1
- data/lib/tcell_agent/rust/agent_config.rb +43 -32
- data/lib/tcell_agent/rust/{libtcellagent-4.18.0.dylib → libtcellagent-5.0.2.dylib} +0 -0
- data/lib/tcell_agent/rust/{libtcellagent-4.18.0.so → libtcellagent-5.0.2.so} +0 -0
- data/lib/tcell_agent/rust/{libtcellagent-alpine-4.18.0.so → libtcellagent-alpine-5.0.2.so} +0 -0
- data/lib/tcell_agent/rust/models.rb +9 -0
- data/lib/tcell_agent/rust/native_agent.rb +18 -0
- data/lib/tcell_agent/rust/native_library.rb +2 -1
- data/lib/tcell_agent/rust/{tcellagent-4.18.0.dll → tcellagent-5.0.2.dll} +0 -0
- data/lib/tcell_agent/servers/rails_server.rb +0 -1
- data/lib/tcell_agent/servers/unicorn.rb +1 -1
- data/lib/tcell_agent/servers/webrick.rb +0 -1
- data/lib/tcell_agent/settings_reporter.rb +0 -79
- data/lib/tcell_agent/version.rb +1 -1
- data/spec/lib/tcell_agent/configuration_spec.rb +56 -211
- data/spec/lib/tcell_agent/policies/patches_policy_spec.rb +2 -2
- data/spec/lib/tcell_agent/rust/agent_config_spec.rb +27 -0
- data/spec/lib/tcell_agent/settings_reporter_spec.rb +0 -73
- data/spec/support/builders.rb +5 -6
- metadata +14 -14
- data/lib/tcell_agent/authlogic.rb +0 -23
- data/lib/tcell_agent/config/unknown_options.rb +0 -119
- data/lib/tcell_agent/devise.rb +0 -33
- data/lib/tcell_agent/rails/start_agent_after_initializers.rb +0 -12
- data/spec/lib/tcell_agent/config/unknown_options_spec.rb +0 -195
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4874ce28005d00849139d7ff1620e5eb0969a6a4626a2b005936ebb429be7064
|
4
|
+
data.tar.gz: bb009ff4896aecb87e92ea17c57273a4b9bee02f0ef211a51f45f72ed96dbc04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 960aa5847e382e2ef19f3d5ef615113a3c042a1f567bdc0cbf9231d5662b7bc140275177103de97b7967408329f1ac90d7702e9606adb8c19117e4dee691eb4c
|
7
|
+
data.tar.gz: 8ff116f37231cd8d045ecd634b01446250293520318a0aedbe10c79adcb49ae318e966e67c3576df9fa364152c06b71546a6caf35583d82e9f7e0856908a6472
|
data/bin/tcell_agent
CHANGED
@@ -1,25 +1,11 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
require 'fileutils'
|
6
|
-
require 'json'
|
3
|
+
require 'tcell_agent'
|
7
4
|
require 'optparse'
|
8
5
|
|
6
|
+
CONFIG_DIR = 'config'.freeze
|
7
|
+
CONFIG_FILE = 'config/tcell_agent.config'.freeze
|
9
8
|
options = {}
|
10
|
-
|
11
|
-
subtext = <<HELP
|
12
|
-
Commonly used command are:
|
13
|
-
setup : Setup new config file
|
14
|
-
test : Run diagnostics classes and config
|
15
|
-
loglevel : Set the loglevel of the tcell agent
|
16
|
-
enable : Enable the agent
|
17
|
-
disable : Disable the agent
|
18
|
-
|
19
|
-
See 'tcell_agent COMMAND --help' for more information on a specific command.
|
20
|
-
|
21
|
-
HELP
|
22
|
-
|
23
9
|
def yesno(default = true)
|
24
10
|
begin
|
25
11
|
system('stty raw -echo')
|
@@ -34,74 +20,59 @@ def yesno(default = true)
|
|
34
20
|
default
|
35
21
|
end
|
36
22
|
|
37
|
-
|
38
|
-
|
23
|
+
subtext = <<HELP
|
24
|
+
Commonly used commands are:
|
25
|
+
test : Run diagnostics and test event sending
|
26
|
+
HELP
|
39
27
|
|
40
28
|
global = OptionParser.new do |opts|
|
41
|
-
opts.banner = 'Usage: tcell_agent [options] [subcommand
|
29
|
+
opts.banner = 'Usage: tcell_agent [options] [subcommand]'
|
30
|
+
|
42
31
|
opts.on('--version', 'Print version') do |_v|
|
43
|
-
|
44
|
-
puts "TCell.io Ruby Agent (Version #{TCellAgent::VERSION})"
|
32
|
+
puts "tCell Ruby Agent Version #{TCellAgent::VERSION}"
|
45
33
|
Kernel.exit(1)
|
46
34
|
end
|
47
|
-
|
48
|
-
|
35
|
+
|
36
|
+
opts.on('test', 'Run diagnostics and test event sending') do |_v|
|
49
37
|
end
|
50
38
|
opts.separator ''
|
51
39
|
opts.separator subtext
|
52
40
|
end
|
53
41
|
|
54
42
|
subcommands = {
|
55
|
-
'
|
56
|
-
opts.banner = 'Usage:
|
43
|
+
'test' => OptionParser.new do |opts|
|
44
|
+
opts.banner = 'Usage: test'
|
57
45
|
end,
|
58
46
|
'loglevel' => OptionParser.new do |opts|
|
59
47
|
opts.banner = 'Usage: loglevel [options] error|warn|info|debug'
|
60
48
|
opts.on('-o', '--off', 'turn logging off ') do |v|
|
61
49
|
options[:off] = v
|
62
50
|
end
|
63
|
-
end
|
64
|
-
'preload' => OptionParser.new do |opts|
|
65
|
-
opts.banner = 'Usage: loglevel [options] [preload_filename]'
|
66
|
-
opts.on('-o', '--off', 'turn preloading filename off ') do |v|
|
67
|
-
options[:off] = v
|
68
|
-
end
|
69
|
-
end,
|
70
|
-
'demomode' => OptionParser.new do |opts|
|
71
|
-
opts.banner = 'Usage: loglevel [options]'
|
72
|
-
opts.on('-o', '--off', 'turn preloading filename off ') do |v|
|
73
|
-
options[:off] = v
|
74
|
-
end
|
75
|
-
end,
|
76
|
-
'enable' => OptionParser.new do |opts|
|
77
|
-
opts.banner = 'Usage: enable'
|
78
|
-
end,
|
79
|
-
'disable' => OptionParser.new do |opts|
|
80
|
-
opts.banner = 'Usage: disable'
|
81
|
-
end,
|
82
|
-
'test' => OptionParser.new do |opts|
|
83
|
-
opts.banner = 'Usage: test'
|
84
|
-
# opts.on("-q", "--[no-]quiet", "quietly run ") do |v|
|
85
|
-
# options[:quiet] = v
|
86
|
-
# end
|
87
|
-
end
|
51
|
+
end
|
88
52
|
}
|
89
53
|
|
90
54
|
global.order!
|
91
55
|
command = ARGV.shift
|
92
|
-
|
56
|
+
deprecated_commands = %w[setup loglevel preload demomode enable disable]
|
57
|
+
if command.nil?
|
58
|
+
puts global
|
59
|
+
Kernel.exit(1)
|
60
|
+
elsif subcommands[command]
|
61
|
+
subcommands[command].order!
|
62
|
+
elsif !deprecated_commands.include?(command)
|
93
63
|
puts global
|
94
64
|
Kernel.exit(1)
|
95
65
|
end
|
96
|
-
subcommands[command].order!
|
97
66
|
|
98
67
|
if command == 'setup'
|
68
|
+
puts '[WARN] tcell_agent setup is deprecated and will be removed in the future.'
|
69
|
+
puts ' Please download the config file from the tCell dashboard'
|
99
70
|
unless File.directory?(CONFIG_DIR)
|
100
71
|
print "Directory 'config' not found, create? [Y/n]"
|
101
72
|
answer = yesno
|
102
73
|
print "\n"
|
103
74
|
unless answer
|
104
|
-
puts 'ERROR
|
75
|
+
puts '[ERROR] Could not create config'
|
105
76
|
Kernel.exit(1)
|
106
77
|
end
|
107
78
|
FileUtils.mkdir_p CONFIG_DIR
|
@@ -132,6 +103,7 @@ if command == 'setup'
|
|
132
103
|
puts 'done.'
|
133
104
|
|
134
105
|
elsif command == 'loglevel'
|
106
|
+
puts '[WARN] tcell_agent loglevel is deprecated and will be removed in the future.'
|
135
107
|
file = File.read(CONFIG_FILE)
|
136
108
|
config_hash = JSON.parse(file)
|
137
109
|
logging_options = config_hash['applications'][0].fetch('logging_options', {})
|
@@ -158,6 +130,7 @@ elsif command == 'loglevel'
|
|
158
130
|
puts 'done.'
|
159
131
|
|
160
132
|
elsif command == 'preload'
|
133
|
+
puts '[WARN] tcell_agent preload is deprecated and will be removed in the future.'
|
161
134
|
file = File.read(CONFIG_FILE)
|
162
135
|
config_hash = JSON.parse(file)
|
163
136
|
|
@@ -175,6 +148,7 @@ elsif command == 'preload'
|
|
175
148
|
puts 'done.'
|
176
149
|
|
177
150
|
elsif command == 'enable'
|
151
|
+
puts '[WARN] tcell_agent enable is deprecated and will be removed in the future.'
|
178
152
|
file = File.read(CONFIG_FILE)
|
179
153
|
config_hash = JSON.parse(file)
|
180
154
|
config_hash['applications'][0].delete('enabled')
|
@@ -182,6 +156,7 @@ elsif command == 'enable'
|
|
182
156
|
puts 'Enabled, you will need to restart the server.'
|
183
157
|
|
184
158
|
elsif command == 'disable'
|
159
|
+
puts '[WARN] tcell_agent disable is deprecated and will be removed in the future.'
|
185
160
|
file = File.read(CONFIG_FILE)
|
186
161
|
config_hash = JSON.parse(file)
|
187
162
|
config_hash['applications'][0]['enabled'] = false
|
@@ -189,6 +164,7 @@ elsif command == 'disable'
|
|
189
164
|
puts 'Disabled, you will need to restart the server.'
|
190
165
|
|
191
166
|
elsif command == 'demomode'
|
167
|
+
puts '[WARN] tcell_agent demomode is deprecated and will be removed in the future.'
|
192
168
|
file = File.read(CONFIG_FILE)
|
193
169
|
config_hash = JSON.parse(file)
|
194
170
|
if options[:off] == true
|
@@ -200,104 +176,24 @@ elsif command == 'demomode'
|
|
200
176
|
puts 'done.'
|
201
177
|
|
202
178
|
elsif command == 'test'
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
puts 'passed'
|
210
|
-
|
211
|
-
printf '%-50s', 'Config valid json... '
|
212
|
-
file = File.read(CONFIG_FILE)
|
213
|
-
config_hash = JSON.parse(file)
|
214
|
-
puts 'passed'
|
215
|
-
|
216
|
-
printf '%-50s', 'Config file has valid version... '
|
217
|
-
if config_hash.fetch('version') != 1
|
218
|
-
puts 'failed'
|
219
|
-
Kernel.exit(1)
|
220
|
-
end
|
221
|
-
puts 'passed'
|
222
|
-
|
223
|
-
printf '%-50s', 'Config file has application...'
|
224
|
-
if config_hash.fetch('applications').empty?
|
225
|
-
puts 'failed'
|
226
|
-
Kernel.exit(1)
|
227
|
-
end
|
228
|
-
puts 'passed'
|
229
|
-
|
230
|
-
printf '%-50s', 'Application has app_id... '
|
231
|
-
tcell_application = config_hash.fetch('applications')[0]
|
232
|
-
if !tcell_application.key?('app_id') && !ENV['TCELL_AGENT_APP_ID']
|
233
|
-
puts 'failed'
|
234
|
-
Kernel.exit(1)
|
235
|
-
end
|
236
|
-
puts 'passed'
|
237
|
-
|
238
|
-
printf '%-50s', 'Application has api_key... '
|
239
|
-
tcell_application = config_hash.fetch('applications')[0]
|
240
|
-
if !tcell_application.key?('api_key') && !ENV['TCELL_AGENT_API_KEY']
|
241
|
-
puts 'failed'
|
242
|
-
Kernel.exit(1)
|
243
|
-
end
|
244
|
-
puts 'passed'
|
245
|
-
|
246
|
-
printf '%-50s', 'Check for unknown settings... '
|
247
|
-
require 'tcell_agent/config/unknown_options'
|
248
|
-
messages = TCellAgent::Config::Validate.get_unknown_options(config_hash)
|
249
|
-
unless messages.empty?
|
250
|
-
puts 'failed'
|
251
|
-
messages.each do |message|
|
252
|
-
puts message
|
179
|
+
Dir[Dir.pwd + '/config/initializers/*.rb'].sort.each do |f|
|
180
|
+
begin
|
181
|
+
require f
|
182
|
+
rescue NameError # rubocop: disable Lint/HandleExceptions
|
183
|
+
rescue StandardError => e
|
184
|
+
puts "[ERROR] Loading initializers failed. #{e}"
|
253
185
|
end
|
254
|
-
Kernel.exit(1)
|
255
186
|
end
|
256
|
-
puts 'passed'
|
257
|
-
|
258
|
-
printf '%-50s', 'Requiring configuration library... '
|
259
|
-
require 'tcell_agent/configuration'
|
260
|
-
puts 'passed'
|
261
187
|
|
262
|
-
printf '%-50s', 'Loading native library... '
|
263
188
|
require 'tcell_agent/rust/native_library'
|
264
189
|
unless TCellAgent::Rust::NativeLibrary.common_lib_available?
|
265
|
-
puts '
|
266
|
-
|
190
|
+
puts '[ERROR] Native Library is unavailable'
|
191
|
+
return
|
267
192
|
end
|
268
|
-
puts 'passed'
|
269
193
|
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
puts 'failed'
|
275
|
-
puts errors
|
276
|
-
Kernel.exit(1)
|
277
|
-
else
|
278
|
-
puts 'passed'
|
279
|
-
end
|
280
|
-
|
281
|
-
printf '%-50s', 'Sending a Test event... '
|
282
|
-
require 'tcell_agent/logger'
|
283
|
-
require 'tcell_agent/sensor_events/server_agent'
|
284
|
-
errors = TCellAgent::Rust::NativeAgent.test_event_sender(
|
285
|
-
[
|
286
|
-
TCellAgent::SensorEvents::ServerAgentDetailsLanguageEvent.new(
|
287
|
-
'Ruby',
|
288
|
-
RUBY_VERSION
|
289
|
-
)
|
290
|
-
]
|
194
|
+
puts "tCell Ruby Agent Version #{TCellAgent::VERSION}"
|
195
|
+
TCellAgent::Rust::NativeAgent.test_agent(
|
196
|
+
TCellAgent.initializer_configuration ||
|
197
|
+
TCellAgent.configuration
|
291
198
|
)
|
292
|
-
if !errors.empty?
|
293
|
-
puts 'failed'
|
294
|
-
puts errors
|
295
|
-
Kernel.exit(1)
|
296
|
-
else
|
297
|
-
puts 'passed'
|
298
|
-
end
|
299
|
-
|
300
|
-
puts
|
301
|
-
puts 'all tests passed, looks good.'
|
302
|
-
puts 'done.'
|
303
199
|
end
|
data/lib/tcell_agent.rb
CHANGED
@@ -1,26 +1,18 @@
|
|
1
1
|
# See the file "LICENSE" for the full license governing this code.
|
2
|
-
|
3
|
-
require 'tcell_agent/logger'
|
4
|
-
require 'tcell_agent/utils/strings'
|
5
2
|
require 'tcell_agent/configuration'
|
6
3
|
|
7
|
-
|
8
|
-
|
9
|
-
require 'tcell_agent/
|
10
|
-
|
11
|
-
require 'tcell_agent/instrumentation'
|
4
|
+
unless TCellAgent.configuration.disable_all
|
5
|
+
require 'tcell_agent/logger'
|
6
|
+
require 'tcell_agent/utils/strings'
|
7
|
+
require 'tcell_agent/agent'
|
12
8
|
|
13
|
-
require 'tcell_agent/
|
9
|
+
require 'tcell_agent/sensor_events/util/sanitizer_utilities'
|
14
10
|
|
15
|
-
|
16
|
-
require 'tcell_agent/instrumentation/cmdi'
|
17
|
-
require 'tcell_agent/instrumentation/lfi'
|
18
|
-
require 'tcell_agent/instrumentation/monkey_patches/io'
|
19
|
-
require 'tcell_agent/instrumentation/monkey_patches/file'
|
20
|
-
require 'tcell_agent/instrumentation/monkey_patches/kernel'
|
11
|
+
require 'tcell_agent/instrumentation'
|
21
12
|
|
13
|
+
require 'tcell_agent/instrument_servers'
|
22
14
|
require 'tcell_agent/hooks/login_fraud'
|
23
|
-
require 'tcell_agent/rails/
|
15
|
+
require 'tcell_agent/rails/railties/tcell_agent_railties' if defined?(Rails)
|
24
16
|
# sinatra used to be supported, but dropped support due to no customers using it
|
25
17
|
# require 'tcell_agent/sinatra' if defined?(Sinatra)
|
26
18
|
end
|
data/lib/tcell_agent/agent.rb
CHANGED
@@ -24,75 +24,87 @@ module TCellAgent
|
|
24
24
|
include TCellAgent::ModuleLoggerAccess
|
25
25
|
|
26
26
|
attr_accessor :route_table,
|
27
|
-
:stop_agent
|
28
|
-
:safe_to_check_cmdi
|
27
|
+
:stop_agent
|
29
28
|
|
30
29
|
def initialize
|
31
30
|
@stop_agent = false
|
32
31
|
@native_agent = nil
|
33
32
|
@route_table = TCellAgent::Routes::RouteTable.new
|
34
|
-
@safe_to_check_cmdi = false
|
35
33
|
@policies_manager = PoliciesManager.new(nil)
|
36
34
|
end
|
37
35
|
|
38
|
-
def
|
39
|
-
if
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
36
|
+
def instrument_auth_frameworks
|
37
|
+
if defined?(Devise) && TCellAgent.configuration.should_instrument?('devise')
|
38
|
+
module_logger.info('Instrumenting Devise authentication framework')
|
39
|
+
require 'tcell_agent/rails/auth/devise'
|
40
|
+
require 'tcell_agent/rails/auth/devise_helper'
|
41
|
+
end
|
42
|
+
|
43
|
+
if defined?(Authlogic) && TCellAgent.configuration.should_instrument?('authlogic')
|
44
|
+
module_logger.info('Instrumenting Authlogic authentication framework')
|
45
|
+
require 'tcell_agent/rails/auth/authlogic'
|
46
|
+
require 'tcell_agent/rails/auth/authlogic_helper'
|
47
|
+
end
|
48
|
+
|
49
|
+
if defined?(Doorkeeper) && TCellAgent.configuration.should_instrument?('doorkeeper') # rubocop:disable Style/GuardClause
|
50
|
+
module_logger.info('Instrumenting Doorkeeper authentication framework')
|
51
|
+
require 'tcell_agent/rails/auth/doorkeeper'
|
50
52
|
end
|
51
53
|
end
|
52
54
|
|
53
|
-
def
|
54
|
-
|
55
|
-
|
55
|
+
def instrument_built_ins
|
56
|
+
require 'tcell_agent/instrumentation/cmdi'
|
57
|
+
require 'tcell_agent/instrumentation/lfi'
|
56
58
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
59
|
+
if TCellAgent.configuration.should_instrument?('io')
|
60
|
+
module_logger.info('Instrumenting Ruby Class: IO')
|
61
|
+
require 'tcell_agent/instrumentation/monkey_patches/io'
|
62
|
+
end
|
63
|
+
|
64
|
+
if TCellAgent.configuration.should_instrument?('file')
|
65
|
+
module_logger.info('Instrumenting Ruby Class: File')
|
66
|
+
require 'tcell_agent/instrumentation/monkey_patches/file'
|
67
|
+
end
|
68
|
+
|
69
|
+
if TCellAgent.configuration.should_instrument?('kernel') # rubocop:disable Style/GuardClause
|
70
|
+
module_logger.info('Instrumenting Ruby Module: Kernel')
|
71
|
+
require 'tcell_agent/instrumentation/monkey_patches/kernel'
|
63
72
|
end
|
73
|
+
end
|
64
74
|
|
65
|
-
|
75
|
+
def manage_policies
|
66
76
|
@policies_manager = PoliciesManager.new(@native_agent)
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
77
|
+
|
78
|
+
result = {}
|
79
|
+
unless TCellAgent.configuration.should_start_policy_poll?
|
80
|
+
result = @native_agent.poll_new_policies
|
81
|
+
end
|
82
|
+
|
71
83
|
policies_and_enablements = result['new_policies_and_enablements'] || {}
|
84
|
+
|
72
85
|
@policies_manager.process_policy_json(
|
73
86
|
policies_and_enablements['enablements'],
|
74
87
|
policies_and_enablements['policies']
|
75
88
|
)
|
76
89
|
|
77
90
|
@policy_polling = PolicyPolling.new(@policies_manager, @native_agent)
|
91
|
+
end
|
78
92
|
|
79
|
-
|
93
|
+
def policies
|
94
|
+
@policies_manager.policies
|
95
|
+
end
|
80
96
|
|
81
|
-
|
97
|
+
def queue_sensor_event(event)
|
98
|
+
return unless @native_agent
|
82
99
|
|
83
|
-
|
84
|
-
|
85
|
-
|
100
|
+
@native_agent.send_sanitized_events(
|
101
|
+
[event]
|
102
|
+
)
|
86
103
|
rescue StandardError => standard_error
|
87
|
-
|
88
|
-
module_logger.error("Error starting agent: (#{standard_error.class}) #{standard_error.message}")
|
104
|
+
module_logger.error("Error sending event: (#{standard_error.class}) #{standard_error.message}")
|
89
105
|
module_logger.exception(standard_error)
|
90
106
|
end
|
91
107
|
|
92
|
-
def policies
|
93
|
-
@policies_manager.policies
|
94
|
-
end
|
95
|
-
|
96
108
|
def report_metrics(request_time, tcell_context)
|
97
109
|
@native_agent.report_metrics(
|
98
110
|
request_time, tcell_context
|
@@ -102,14 +114,32 @@ module TCellAgent
|
|
102
114
|
module_logger.exception(standard_error)
|
103
115
|
end
|
104
116
|
|
105
|
-
def
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
[event]
|
117
|
+
def start(server_name)
|
118
|
+
@native_agent = TCellAgent::Rust::NativeAgent.create_agent(
|
119
|
+
TCellAgent.initializer_configuration ||
|
120
|
+
TCellAgent.configuration
|
110
121
|
)
|
122
|
+
|
123
|
+
if @native_agent.nil?
|
124
|
+
TCellAgent.configuration.enabled = false
|
125
|
+
return
|
126
|
+
end
|
127
|
+
|
128
|
+
TCellAgent.native_logger = @native_agent
|
129
|
+
|
130
|
+
module_logger.info('Rails initializer overriding default agent configuration') unless TCellAgent.initializer_configuration.nil?
|
131
|
+
|
132
|
+
instrument_auth_frameworks
|
133
|
+
instrument_built_ins
|
134
|
+
manage_policies
|
135
|
+
|
136
|
+
module_logger.info("Started thread agent: #{server_name}")
|
137
|
+
TCellAgent.report_settings
|
138
|
+
TCellAgent::Instrumentation::Rails.send_framework_info
|
139
|
+
TCellAgent::Instrumentation::Rails.send_settings
|
111
140
|
rescue StandardError => standard_error
|
112
|
-
|
141
|
+
TCellAgent.configuration.enabled = false
|
142
|
+
module_logger.error("Error starting agent: (#{standard_error.class}) #{standard_error.message}")
|
113
143
|
module_logger.exception(standard_error)
|
114
144
|
end
|
115
145
|
end
|