Skip to content

Commit 92949e1

Browse files
committed
Code package scanner
1 parent 216c980 commit 92949e1

3 files changed

Lines changed: 30 additions & 9 deletions

File tree

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ require (
1111
github.com/docker/go-connections v0.5.0
1212
github.com/satori/go.uuid v1.2.0
1313
github.com/shirou/gopsutil/v3 v3.24.5
14-
github.com/shuffle/shuffle-shared v1.2.34
14+
github.com/shuffle/shuffle-shared v1.2.37
1515
k8s.io/api v0.34.2
1616
k8s.io/apimachinery v0.34.2
1717
)

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,8 @@ github.com/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU=
326326
github.com/shoenig/test v0.6.4/go.mod h1:byHiCGXqrVaflBLAMq/srcZIHynQPQgeyvkvXnjqq0k=
327327
github.com/shuffle/opensearch-go/v4 v4.0.0 h1:Mh85CD1MwOgXiFFYlzS1llnvdqL3CztRdR1ZT/SLIjU=
328328
github.com/shuffle/opensearch-go/v4 v4.0.0/go.mod h1:gVLZKQE5khQWMb68XBtgKrhu78oLGL2zHwAGnFMDwC0=
329-
github.com/shuffle/shuffle-shared v1.2.34 h1:PlXb1Lby2+UVrDkdroqdZT94ZZLjRG67f69mmSwqg1k=
330-
github.com/shuffle/shuffle-shared v1.2.34/go.mod h1:RSKyexqkGDB+WbboGfWMj1Sfl4e49MI2CvW3pFmirg4=
329+
github.com/shuffle/shuffle-shared v1.2.37 h1:rpjaYSP4W3pBI64Wx4tOoQsXtp+lYUOQYotFWTynopo=
330+
github.com/shuffle/shuffle-shared v1.2.37/go.mod h1:RSKyexqkGDB+WbboGfWMj1Sfl4e49MI2CvW3pFmirg4=
331331
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
332332
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
333333
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=

orborus.go

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2153,6 +2153,7 @@ func getOrborusStats(ctx context.Context, sensorMode shuffle.SensorMode) shuffle
21532153
}
21542154

21552155
newStats.SensorDetails.InstalledSoftware = []shuffle.Software{}
2156+
newStats.SensorDetails.CodeScanner = []shuffle.ProjectInfo{}
21562157
return newStats
21572158
}
21582159
// If there's an error, we ignore the cache and continue to gather details
@@ -2174,19 +2175,24 @@ func getOrborusStats(ctx context.Context, sensorMode shuffle.SensorMode) shuffle
21742175
newStats.SensorDetails.ElevatedAccess = shuffle.IsElevated()
21752176
newStats.SensorDetails.Serial = shuffle.GetProfiler()
21762177

2177-
if sensorMode.SoftwareListEnabled {
2178+
if sensorMode.SoftwareListEnabled == "true" {
21782179
// Check cache first before running the command
21792180
newStats.SensorDetails.InstalledSoftware = shuffle.ListInstalledSoftware()
21802181
}
21812182

2182-
if sensorMode.HdEncryptedCheck {
2183+
if sensorMode.CodeScannerEnabled == "true" {
2184+
newStats.SensorDetails.CodeScanner = shuffle.ListCodeScannerProjects()
2185+
}
2186+
2187+
if sensorMode.HdEncryptedCheck == "true" {
21832188
newStats.SensorDetails.HdEncrypted = fmt.Sprintf("%t", shuffle.IsDiskEncrypted())
21842189
}
21852190

2186-
if sensorMode.ScreenlockCheck {
2191+
if sensorMode.ScreenlockCheck == "true" {
21872192
newStats.SensorDetails.AutomaticScreenlockEnabled = fmt.Sprintf("%t", shuffle.IsAutomaticScreenlockEnabled())
21882193
}
21892194

2195+
21902196
if len(sensorMode.LogForwarding) > 0 {
21912197
newStats.SensorDetails.LogForwarding = fmt.Sprintf("not implemented: %s", sensorMode.LogForwarding)
21922198
}
@@ -2520,9 +2526,10 @@ func mainLoop() {
25202526
sensorMode := shuffle.SensorMode{
25212527
Enabled: os.Getenv("SHUFFLE_AGENT_SENSOR_MODE") == "true",
25222528

2523-
SoftwareListEnabled: os.Getenv("SHUFFLE_SOFTWARE_LIST_ENABLED") == "true",
2524-
HdEncryptedCheck: os.Getenv("SHUFFLE_HD_ENCRYPTED_CHECK") == "true",
2525-
ScreenlockCheck: os.Getenv("SHUFFLE_SCREENLOCK_CHECK") == "true",
2529+
SoftwareListEnabled: os.Getenv("SHUFFLE_SOFTWARE_LIST_ENABLED"),
2530+
CodeScannerEnabled: os.Getenv("SHUFFLE_CODE_SCANNER_ENABLED"),
2531+
HdEncryptedCheck: os.Getenv("SHUFFLE_HD_ENCRYPTED_CHECK"),
2532+
ScreenlockCheck: os.Getenv("SHUFFLE_SCREENLOCK_CHECK"),
25262533

25272534
LogForwarding: os.Getenv("SHUFFLE_LOG_FORWARDING"),
25282535
ResponseActions: os.Getenv("SHUFFLE_RESPONSE_ACTIONS"),
@@ -2594,6 +2601,20 @@ func mainLoop() {
25942601

25952602
}
25962603

2604+
// Autoconfig these. They are off if set to false
2605+
if len(sensorMode.SoftwareListEnabled) == 0 {
2606+
sensorMode.SoftwareListEnabled = "true"
2607+
}
2608+
if len(sensorMode.CodeScannerEnabled) == 0 {
2609+
sensorMode.CodeScannerEnabled= "true"
2610+
}
2611+
if len(sensorMode.HdEncryptedCheck) == 0 {
2612+
sensorMode.HdEncryptedCheck = "true"
2613+
}
2614+
if len(sensorMode.ScreenlockCheck) == 0 {
2615+
sensorMode.ScreenlockCheck = "true"
2616+
}
2617+
25972618
log.Printf("[INFO] Running in sensor/agent mode. Starting the agent.")
25982619
err := StartAgentSensor(sensorMode)
25992620
if err != nil {

0 commit comments

Comments
 (0)