Skip to content

Commit

Permalink
Remove APNS certificate validation from server start up (#21728)
Browse files Browse the repository at this point in the history
  • Loading branch information
gillespi314 authored and georgekarrv committed Aug 31, 2024
1 parent 55d4bed commit 0ef149f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
2 changes: 2 additions & 0 deletions changes/21683-apns-cert-validation-on-start
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Removed validation of APNS certificate from server startup. This was no longer necessary because
we now allow for APNS certificates to be renewed in the UI.
20 changes: 5 additions & 15 deletions cmd/fleet/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"github.com/e-dard/netbug"
"github.com/fleetdm/fleet/v4/ee/server/licensing"
eeservice "github.com/fleetdm/fleet/v4/ee/server/service"
"github.com/fleetdm/fleet/v4/pkg/certificate"
"github.com/fleetdm/fleet/v4/pkg/scripts"
"github.com/fleetdm/fleet/v4/server"
configpkg "github.com/fleetdm/fleet/v4/server/config"
Expand Down Expand Up @@ -75,7 +74,10 @@ import (

var allowedURLPrefixRegexp = regexp.MustCompile("^(?:/[a-zA-Z0-9_.~-]+)+$")

const softwareInstallerUploadTimeout = 4 * time.Minute
const (
softwareInstallerUploadTimeout = 4 * time.Minute
liveQueryMemCacheDuration = 1 * time.Second
)

type initializer interface {
// Initialize is used to populate a datastore with
Expand Down Expand Up @@ -505,7 +507,7 @@ the way that the Fleet server works.
initFatal(errors.New("inserting APNs and SCEP assets"), "missing required private key. Learn how to configure the private key here: https://fleetdm.com/learn-more-about/fleet-server-private-key")
}

apnsCert, apnsCertPEM, apnsKeyPEM, err := config.MDM.AppleAPNs()
_, apnsCertPEM, apnsKeyPEM, err := config.MDM.AppleAPNs()
if err != nil {
initFatal(err, "validate Apple APNs certificate and key")
}
Expand All @@ -515,18 +517,6 @@ the way that the Fleet server works.
initFatal(err, "validate Apple SCEP certificate and key")
}

const (
apnsConnectionTimeout = 10 * time.Second
apnsConnectionURL = "https://api.sandbox.push.apple.com"
)

// check that the Apple APNs certificate is valid to connect to the API
ctx, cancel := context.WithTimeout(context.Background(), apnsConnectionTimeout)
if err := certificate.ValidateClientAuthTLSConnection(ctx, apnsCert, apnsConnectionURL); err != nil {
initFatal(err, "validate authentication with Apple APNs certificate")
}
cancel()

err = ds.InsertMDMConfigAssets(context.Background(), []fleet.MDMConfigAsset{
{Name: fleet.MDMAssetAPNSCert, Value: apnsCertPEM},
{Name: fleet.MDMAssetAPNSKey, Value: apnsKeyPEM},
Expand Down

0 comments on commit 0ef149f

Please sign in to comment.