{"record":{"id":"33fbf871d81b2b13","repo":"tailscale/tailscale","slug":"shutdown-access-denied-by-policy","errorCode":null,"errorMessage":"shutdown access denied by policy","messagePattern":"shutdown access denied by policy","errorType":"http","errorClass":null,"httpStatus":403,"severity":"error","filePath":"ipn/localapi/localapi.go","lineNumber":1909,"sourceCode":"type Shutdown struct{}\n\n// serveShutdown shuts down tailscaled. It requires write access\n// and the [pkey.AllowTailscaledRestart] policy to be enabled.\n// See tailscale/corp#32674.\nfunc (h *Handler) serveShutdown(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != httpm.POST {\n\t\thttp.Error(w, \"only POST allowed\", http.StatusMethodNotAllowed)\n\t\treturn\n\t}\n\n\tif !h.PermitWrite {\n\t\thttp.Error(w, \"shutdown access denied\", http.StatusForbidden)\n\t\treturn\n\t}\n\n\tpolc := h.b.Sys().PolicyClientOrDefault()\n\tif permitShutdown, _ := polc.GetBoolean(pkey.AllowTailscaledRestart, false); !permitShutdown {\n\t\thttp.Error(w, \"shutdown access denied by policy\", http.StatusForbidden)\n\t\treturn\n\t}\n\n\tec := h.eventBus.Client(\"localapi.Handler\")\n\tdefer ec.Close()\n\n\tw.WriteHeader(http.StatusOK)\n\tif f, ok := w.(http.Flusher); ok {\n\t\tf.Flush()\n\t}\n\n\teventbus.Publish[Shutdown](ec).Publish(Shutdown{})\n}\n\nfunc (h *Handler) serveServices(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != httpm.GET {\n\t\thttp.Error(w, \"only GET allowed\", http.StatusMethodNotAllowed)\n\t\treturn","sourceCodeStart":1891,"sourceCodeEnd":1927,"githubUrl":"https://github.com/tailscale/tailscale/blob/6e0912f97994f927632b34ae9e63b53d6516a6ac/ipn/localapi/localapi.go#L1891-L1927","documentation":"Shutdown via LocalAPI is blocked by device policy: the policy client reports pkey.AllowTailscaledRestart as false (or unset), so even write-authorized callers cannot restart/stop tailscaled on this node (tailscale/corp#32674).","triggerScenarios":"Thrown at ipn/localapi/localapi.go:1909 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Adjust the tailnet policy to permit shutdown from this node."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6e0912f97994f927632b34ae9e63b53d6516a6ac","analyzedAt":"2026-08-18T08:17:25.280Z","contentChangedAt":"2026-08-18T08:17:25.280Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}