Skip to content

Commit

Permalink
rename flag, add comment, add logging
Browse files Browse the repository at this point in the history
  • Loading branch information
jessepeterson committed Aug 27, 2023
1 parent 1175c9f commit fc9260c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cmd/nanomdm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func main() {
flMigration = flag.Bool("migration", false, "HTTP endpoint for enrollment migrations")
flRetro = flag.Bool("retro", false, "Allow retroactive certificate-authorization association")
flDMURLPfx = flag.String("dm", "", "URL to send Declarative Management requests to")
flAuthProxy = flag.String("auth-proxy", "", "Reverse proxy URL target for MDM-authenticated HTTP requests")
flAuthProxy = flag.String("auth-proxy-url", "", "Reverse proxy URL target for MDM-authenticated HTTP requests")
)
flag.Parse()

Expand Down Expand Up @@ -119,7 +119,6 @@ func main() {
mux := http.NewServeMux()

if !*flDisableMDM {

var mdmService service.CheckinAndCommandService = nano
if *flWebhook != "" {
webhookService := microwebhook.New(*flWebhook, mdmStorage)
Expand All @@ -134,6 +133,7 @@ func main() {
mdmService = dump.New(mdmService, os.Stdout)
}

// helper for authorizing MDM clients requests
certAuthMiddleware := func(h http.Handler) http.Handler {
h = httpmdm.CertVerifyMiddleware(h, verifier, logger.With("handler", "cert-verify"))
if *flCertHeader != "" {
Expand Down Expand Up @@ -170,6 +170,7 @@ func main() {
if err != nil {
stdlog.Fatal(err)
}
logger.Debug("msg", "authproxy setup", "url", *flAuthProxy)
authProxyHandler = http.StripPrefix(endpointAuthProxy, authProxyHandler)
authProxyHandler = httpmdm.CertWithEnrollmentIDMiddleware(authProxyHandler, certauth.HashCert, mdmStorage, true, logger.With("handler", "with-enrollment-id"))
authProxyHandler = certAuthMiddleware(authProxyHandler)
Expand Down

0 comments on commit fc9260c

Please sign in to comment.