From e03e73c542a5c9f451ff08b0225191c179fcd1e4 Mon Sep 17 00:00:00 2001 From: tperfitt Date: Fri, 13 Mar 2020 09:46:22 -0500 Subject: [PATCH] Add local-only flag and tweak makefile to support notarization. Co-authored-by: tperfitt --- Makefile | 3 +++ cmd/mdmctl/mdmcert.go | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/Makefile b/Makefile index 5e367dd1..37e874b5 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,9 @@ endif export GO111MODULE=on +#Specify a minimum version for macos otherwise notarization will fail +CGO_LDFLAGS=-mmacosx-version-min=10.12 + VERSION = $(shell git describe --tags --always --dirty) BRANCH = $(shell git rev-parse --abbrev-ref HEAD) REVISION = $(shell git rev-parse HEAD) diff --git a/cmd/mdmctl/mdmcert.go b/cmd/mdmctl/mdmcert.go index 919a6dc1..7c1059c1 100644 --- a/cmd/mdmctl/mdmcert.go +++ b/cmd/mdmctl/mdmcert.go @@ -169,6 +169,7 @@ func (cmd *mdmcertCommand) runPush(args []string) error { flCN = flagset.String("cn", "micromdm-user", "CommonName for the CSR Subject.") flPKeyPass = flagset.String("password", "", "Password to encrypt/read the RSA key.") flKeyPath = flagset.String("private-key", filepath.Join(mdmcertdir, pushCertificatePrivateKeyFilename), "Path to the push certificate private key. A new RSA key will be created at this path.") + flLocalOnly= flagset.Bool("local-only",false,"No server configuration required.") flCSRPath = flagset.String("out", filepath.Join(mdmcertdir, pushCSRFilename), "Path to save the MDM Push Certificate request.") ) @@ -177,6 +178,11 @@ func (cmd *mdmcertCommand) runPush(args []string) error { return err } + if !*flLocalOnly { + if err := cmd.setup(); err != nil { + return err + } + } if err := os.MkdirAll(filepath.Dir(*flCSRPath), 0755); err != nil { errors.Wrapf(err, "create directory %s", filepath.Dir(*flCSRPath)) }