Add custom SCEP configs (#27045)

For #26603 

This PR includes:
- Refactoring of NDES/SCEP verify/timeout logic for easier testing (with
dependency injection)
- Custom SCEP configs
- saving/deleting/updating of encrypted custom SCEP challenges
- validation call to custom SCEP server to verify connection
- Custom SCEP activities
- unit and integration tests for all of the above

This PR does not include the following:
- Changes file (in later PR)

# Checklist for submitter

- [x] Added/updated automated tests
- [x] Manual QA for all new/changed functionality
This commit is contained in:
Victor Lyuboslavsky
2025-03-14 12:16:51 -05:00
committed by GitHub
parent 5a12dcdf98
commit 84d35dc0cd
21 changed files with 1077 additions and 395 deletions
+2 -1
View File
@@ -732,6 +732,7 @@ the way that the Fleet server works.
mdmPushService,
cronSchedules,
wstepCertManager,
eeservice.NewSCEPConfigService(logger, nil),
)
if err != nil {
initFatal(err, "initializing service")
@@ -1163,7 +1164,7 @@ the way that the Fleet server works.
// SCEP proxy (for NDES, etc.)
if license.IsPremium() {
if err = service.RegisterSCEPProxy(rootMux, ds, logger); err != nil {
if err = service.RegisterSCEPProxy(rootMux, ds, logger, nil); err != nil {
initFatal(err, "setup SCEP proxy")
}
}
+8 -3
View File
@@ -24,6 +24,7 @@ import (
"github.com/fleetdm/fleet/v4/server/mdm/testing_utils"
"github.com/fleetdm/fleet/v4/server/mock"
mdmmock "github.com/fleetdm/fleet/v4/server/mock/mdm"
scep_mock "github.com/fleetdm/fleet/v4/server/mock/scep"
"github.com/fleetdm/fleet/v4/server/ptr"
"github.com/fleetdm/fleet/v4/server/service"
"github.com/fleetdm/fleet/v4/server/test"
@@ -199,11 +200,15 @@ func TestGitOpsBasicGlobalPremium(t *testing.T) {
// Cannot run t.Parallel() because it sets environment variables
license := &fleet.LicenseInfo{Tier: fleet.TierPremium, Expiration: time.Now().Add(24 * time.Hour)}
scepConfig := &scep_mock.SCEPConfigService{}
scepConfig.ValidateSCEPURLFunc = func(_ context.Context, _ string) error { return nil }
scepConfig.ValidateNDESSCEPAdminURLFunc = func(_ context.Context, _ fleet.NDESSCEPProxyIntegration) error { return nil }
_, ds := runServerWithMockedDS(
t, &service.TestServerOpts{
License: license,
KeyValueStore: newMemKeyValueStore(),
EnableSCEPProxy: true,
License: license,
KeyValueStore: newMemKeyValueStore(),
EnableSCEPProxy: true,
SCEPConfigService: scepConfig,
},
)