Skip to content

Commit

Permalink
warn if a DDM url does not contain the trailing slash (#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
jessepeterson committed Jun 13, 2024
1 parent a0c6a5d commit 3544fbb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmd/nanomdm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"math/rand"
"net/http"
"os"
"strings"
"time"

"github.com/micromdm/nanomdm/certverify"
Expand Down Expand Up @@ -117,7 +118,11 @@ func main() {
nanomdm.WithUserAuthenticate(nanomdm.NewUAService(mdmStorage, *flUAZLChal)),
}
if *flDMURLPfx != "" {
logger.Debug("msg", "declarative management setup", "url", *flDMURLPfx)
var warningText string
if !strings.HasSuffix(*flDMURLPfx, "/") {
warningText = ": warning: URL has no trailing slash"
}
logger.Debug("msg", "declarative management setup"+warningText, "url", *flDMURLPfx)
dm, err := nanomdm.NewDeclarativeManagementHTTPCaller(*flDMURLPfx, http.DefaultClient)
if err != nil {
stdlog.Fatal(err)
Expand Down
2 changes: 2 additions & 0 deletions docs/operations-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ This switch disables MDM client capability. This effecitvely turns this running

Specifies the "base" URL to send Declarative Management requests to. The full URL is constructed from this base URL appended with the type of Declarative Management ["Endpoint" request](https://developer.apple.com/documentation/devicemanagement/declarativemanagementrequest?language=objc) such as "status" or "declaration-items". Each HTTP request includes the NanoMDM enrollment ID as the HTTP header "X-Enrollment-ID". See [this blog post](https://micromdm.io/blog/wwdc21-declarative-management/) for more details.

Note that the URL should likely have a trailing slash. Otherwise path elements of the URL may to be cut off but by Golang's relative URL path resolver.

### -migration

* HTTP endpoint for enrollment migrations
Expand Down

0 comments on commit 3544fbb

Please sign in to comment.