@@ -32,16 +32,11 @@ const (
32
32
33
33
appProtectPluginStartCmd = "/usr/share/ts/bin/bd-socket-plugin"
34
34
appProtectAgentStartCmd = "/opt/app_protect/bin/bd_agent"
35
+ appProtectLogLevelCmd = "/opt/app_protect/bin/set_log_level"
35
36
36
37
// appPluginParams is the configuration of App-Protect plugin
37
38
appPluginParams = "tmm_count 4 proc_cpuinfo_cpu_mhz 2000000 total_xml_memory 307200000 total_umu_max_size 3129344 sys_max_account_id 1024 no_static_config"
38
39
39
- // appProtectDebugLogConfigFileContent holds the content of the file to be written when nginx debug is enabled. It will enable NGINX App Protect debug logs
40
- appProtectDebugLogConfigFileContent = "MODULE = IO_PLUGIN;\n LOG_LEVEL = TS_INFO | TS_DEBUG;\n FILE = 2;\n MODULE = ECARD_POLICY;\n LOG_LEVEL = TS_INFO | TS_DEBUG;\n FILE = 2;\n "
41
-
42
- // appProtectLogConfigFileName is the location of the NGINX App Protect logging configuration file
43
- appProtectLogConfigFileName = "/etc/app_protect/bd/logger.cfg"
44
-
45
40
appProtectDosAgentInstallCmd = "/usr/bin/adminstall"
46
41
appProtectDosAgentStartCmd = "/usr/bin/admd -d --standalone"
47
42
appProtectDosAgentStartDebugCmd = "/usr/bin/admd -d --standalone --log debug"
@@ -81,7 +76,7 @@ type Manager interface {
81
76
UpdateServersInPlus (upstream string , servers []string , config ServerConfig ) error
82
77
UpdateStreamServersInPlus (upstream string , servers []string ) error
83
78
SetOpenTracing (openTracing bool )
84
- AppProtectAgentStart (apaDone chan error , debug bool )
79
+ AppProtectAgentStart (apaDone chan error , logLevel string )
85
80
AppProtectAgentQuit ()
86
81
AppProtectPluginStart (appDone chan error )
87
82
AppProtectPluginQuit ()
@@ -461,20 +456,15 @@ func (lm *LocalManager) SetOpenTracing(openTracing bool) {
461
456
}
462
457
463
458
// AppProtectAgentStart starts the AppProtect agent
464
- func (lm * LocalManager ) AppProtectAgentStart (apaDone chan error , debug bool ) {
465
- if debug {
466
- glog .V (3 ).Info ("Starting AppProtect Agent in debug mode" )
467
- err := os .Remove (appProtectLogConfigFileName )
468
- if err != nil {
469
- glog .Fatalf ("Failed removing App Protect Log configuration file" )
470
- }
471
- err = createFileAndWrite (appProtectLogConfigFileName , []byte (appProtectDebugLogConfigFileContent ))
472
- if err != nil {
473
- glog .Fatalf ("Failed Writing App Protect Log configuration file" )
474
- }
459
+ func (lm * LocalManager ) AppProtectAgentStart (apaDone chan error , logLevel string ) {
460
+ glog .V (3 ).Info ("Setting log level for App Protect - " , logLevel )
461
+ appProtectLogLevelCmdfull := fmt .Sprintf ("%v %v" , appProtectLogLevelCmd , logLevel )
462
+ logLevelCmd := exec .Command ("sh" , "-c" , appProtectLogLevelCmdfull ) // #nosec G204
463
+ if err := logLevelCmd .Run (); err != nil {
464
+ glog .Fatalf ("Failed to set log level for AppProtect: %v" , err )
475
465
}
476
- glog .V (3 ).Info ("Starting AppProtect Agent" )
477
466
467
+ glog .V (3 ).Info ("Starting AppProtect Agent" )
478
468
cmd := exec .Command (appProtectAgentStartCmd )
479
469
if err := cmd .Start (); err != nil {
480
470
glog .Fatalf ("Failed to start AppProtect Agent: %v" , err )
0 commit comments