2021-09-19 16:54:41 +00:00
|
|
|
package headscale
|
|
|
|
|
|
|
|
import (
|
|
|
|
"bytes"
|
2021-12-23 02:43:53 +00:00
|
|
|
"html/template"
|
2021-09-19 16:54:41 +00:00
|
|
|
"net/http"
|
2022-03-01 07:30:35 +00:00
|
|
|
textTemplate "text/template"
|
2021-09-19 16:54:41 +00:00
|
|
|
|
|
|
|
"github.com/gofrs/uuid"
|
2022-06-20 10:29:59 +00:00
|
|
|
"github.com/gorilla/mux"
|
2021-11-13 08:39:04 +00:00
|
|
|
"github.com/rs/zerolog/log"
|
2021-09-19 16:54:41 +00:00
|
|
|
)
|
|
|
|
|
2022-03-04 10:35:09 +00:00
|
|
|
// WindowsConfigMessage shows a simple message in the browser for how to configure the Windows Tailscale client.
|
2022-06-17 14:48:04 +00:00
|
|
|
func (h *Headscale) WindowsConfigMessage(
|
2022-06-26 09:43:17 +00:00
|
|
|
writer http.ResponseWriter,
|
|
|
|
req *http.Request,
|
2022-06-17 14:48:04 +00:00
|
|
|
) {
|
2022-03-04 09:37:55 +00:00
|
|
|
winTemplate := template.Must(template.New("windows").Parse(`
|
|
|
|
<html>
|
|
|
|
<body>
|
|
|
|
<h1>headscale</h1>
|
|
|
|
<h2>Windows registry configuration</h2>
|
|
|
|
<p>
|
|
|
|
This page provides Windows registry information for the official Windows Tailscale client.
|
|
|
|
<p>
|
|
|
|
<p>
|
|
|
|
The registry file will configure Tailscale to use <code>{{.URL}}</code> as its control server.
|
|
|
|
<p>
|
|
|
|
<h3>Caution</h3>
|
|
|
|
<p>You should always download and inspect the registry file before installing it:</p>
|
|
|
|
<pre><code>curl {{.URL}}/windows/tailscale.reg</code></pre>
|
|
|
|
|
|
|
|
<h2>Installation</h2>
|
|
|
|
<p>Headscale can be set to the default server by running the registry file:</p>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
<a href="/windows/tailscale.reg" download="tailscale.reg">Windows registry file</a>
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<ol>
|
|
|
|
<li>Download the registry file, then run it</li>
|
|
|
|
<li>Follow the prompts</li>
|
|
|
|
<li>Install and run the official windows Tailscale client</li>
|
|
|
|
<li>When the installation has finished, start Tailscale, and log in by clicking the icon in the system tray</li>
|
|
|
|
</ol>
|
|
|
|
<p>Or</p>
|
|
|
|
<p>Open command prompt with Administrator rights. Issue the following commands to add the required registry entries:</p>
|
|
|
|
<pre>
|
|
|
|
<code>REG ADD "HKLM\Software\Tailscale IPN" /v UnattendedMode /t REG_SZ /d always
|
|
|
|
REG ADD "HKLM\Software\Tailscale IPN" /v LoginURL /t REG_SZ /d "{{.URL}}"</code></pre>
|
|
|
|
<p>
|
|
|
|
Restart Tailscale and log in.
|
|
|
|
<p>
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
`))
|
|
|
|
|
|
|
|
config := map[string]interface{}{
|
|
|
|
"URL": h.cfg.ServerURL,
|
|
|
|
}
|
|
|
|
|
|
|
|
var payload bytes.Buffer
|
|
|
|
if err := winTemplate.Execute(&payload, config); err != nil {
|
|
|
|
log.Error().
|
|
|
|
Str("handler", "WindowsRegConfig").
|
|
|
|
Err(err).
|
|
|
|
Msg("Could not render Windows index template")
|
2022-06-17 14:48:04 +00:00
|
|
|
|
2022-06-26 09:43:17 +00:00
|
|
|
writer.Header().Set("Content-Type", "text/plain; charset=utf-8")
|
|
|
|
writer.WriteHeader(http.StatusInternalServerError)
|
2022-06-26 10:21:35 +00:00
|
|
|
_, err := writer.Write([]byte("Could not render Windows index template"))
|
|
|
|
if err != nil {
|
|
|
|
log.Error().
|
|
|
|
Caller().
|
|
|
|
Err(err).
|
|
|
|
Msg("Failed to write response")
|
|
|
|
}
|
2022-03-04 09:37:55 +00:00
|
|
|
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2022-06-26 09:43:17 +00:00
|
|
|
writer.Header().Set("Content-Type", "text/html; charset=utf-8")
|
|
|
|
writer.WriteHeader(http.StatusOK)
|
2022-06-26 10:21:35 +00:00
|
|
|
_, err := writer.Write(payload.Bytes())
|
|
|
|
if err != nil {
|
|
|
|
log.Error().
|
|
|
|
Caller().
|
|
|
|
Err(err).
|
|
|
|
Msg("Failed to write response")
|
|
|
|
}
|
2022-03-04 09:37:55 +00:00
|
|
|
}
|
|
|
|
|
2022-03-04 10:35:09 +00:00
|
|
|
// WindowsRegConfig generates and serves a .reg file configured with the Headscale server address.
|
2022-06-17 14:48:04 +00:00
|
|
|
func (h *Headscale) WindowsRegConfig(
|
2022-06-26 09:43:17 +00:00
|
|
|
writer http.ResponseWriter,
|
|
|
|
req *http.Request,
|
2022-06-17 14:48:04 +00:00
|
|
|
) {
|
2022-03-04 09:37:55 +00:00
|
|
|
config := WindowsRegistryConfig{
|
|
|
|
URL: h.cfg.ServerURL,
|
|
|
|
}
|
|
|
|
|
|
|
|
var content bytes.Buffer
|
|
|
|
if err := windowsRegTemplate.Execute(&content, config); err != nil {
|
|
|
|
log.Error().
|
|
|
|
Str("handler", "WindowsRegConfig").
|
|
|
|
Err(err).
|
|
|
|
Msg("Could not render Apple macOS template")
|
2022-06-17 14:48:04 +00:00
|
|
|
|
2022-06-26 09:43:17 +00:00
|
|
|
writer.Header().Set("Content-Type", "text/plain; charset=utf-8")
|
|
|
|
writer.WriteHeader(http.StatusInternalServerError)
|
2022-06-26 10:21:35 +00:00
|
|
|
_, err := writer.Write([]byte("Could not render Windows registry template"))
|
|
|
|
if err != nil {
|
|
|
|
log.Error().
|
|
|
|
Caller().
|
|
|
|
Err(err).
|
|
|
|
Msg("Failed to write response")
|
|
|
|
}
|
2022-03-04 09:37:55 +00:00
|
|
|
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2022-06-26 09:43:17 +00:00
|
|
|
writer.Header().Set("Content-Type", "text/x-ms-regedit; charset=utf-8")
|
|
|
|
writer.WriteHeader(http.StatusOK)
|
2022-06-26 10:21:35 +00:00
|
|
|
_, err := writer.Write(content.Bytes())
|
|
|
|
if err != nil {
|
|
|
|
log.Error().
|
|
|
|
Caller().
|
|
|
|
Err(err).
|
|
|
|
Msg("Failed to write response")
|
|
|
|
}
|
2022-03-04 09:37:55 +00:00
|
|
|
}
|
|
|
|
|
2022-03-04 10:35:09 +00:00
|
|
|
// AppleConfigMessage shows a simple message in the browser to point the user to the iOS/MacOS profile and instructions for how to install it.
|
2022-06-17 14:48:04 +00:00
|
|
|
func (h *Headscale) AppleConfigMessage(
|
2022-06-26 09:43:17 +00:00
|
|
|
writer http.ResponseWriter,
|
|
|
|
req *http.Request,
|
2022-06-17 14:48:04 +00:00
|
|
|
) {
|
2021-11-14 19:32:03 +00:00
|
|
|
appleTemplate := template.Must(template.New("apple").Parse(`
|
2021-09-19 16:54:41 +00:00
|
|
|
<html>
|
|
|
|
<body>
|
2022-03-04 07:56:54 +00:00
|
|
|
<h1>headscale</h1>
|
|
|
|
<h2>Apple configuration profiles</h2>
|
2021-09-19 16:54:41 +00:00
|
|
|
<p>
|
|
|
|
This page provides <a href="https://support.apple.com/guide/mdm/mdm-overview-mdmbf9e668/web">configuration profiles</a> for the official Tailscale clients for <a href="https://apps.apple.com/us/app/tailscale/id1470499037?ls=1">iOS</a> and <a href="https://apps.apple.com/ca/app/tailscale/id1475387142?mt=12">macOS</a>.
|
|
|
|
</p>
|
|
|
|
<p>
|
2022-03-04 07:56:54 +00:00
|
|
|
The profiles will configure Tailscale.app to use <code>{{.URL}}</code> as its control server.
|
2021-09-19 16:54:41 +00:00
|
|
|
</p>
|
|
|
|
|
|
|
|
<h3>Caution</h3>
|
2022-03-04 07:56:54 +00:00
|
|
|
<p>You should always download and inspect the profile before installing it:</p>
|
2021-09-26 19:41:48 +00:00
|
|
|
<!--
|
2022-03-04 07:56:54 +00:00
|
|
|
<pre><code>curl {{.URL}}/apple/ios</code></pre>
|
2021-09-26 19:41:48 +00:00
|
|
|
-->
|
2022-03-04 07:56:54 +00:00
|
|
|
<pre><code>curl {{.URL}}/apple/macos</code></pre>
|
2022-03-01 07:30:35 +00:00
|
|
|
|
2021-09-23 19:22:07 +00:00
|
|
|
<h2>Profiles</h2>
|
2021-09-26 19:41:48 +00:00
|
|
|
|
|
|
|
<!--
|
2021-09-23 19:22:07 +00:00
|
|
|
<h3>iOS</h3>
|
2021-09-19 16:54:41 +00:00
|
|
|
<p>
|
2021-09-23 19:22:07 +00:00
|
|
|
<a href="/apple/ios" download="headscale_ios.mobileconfig">iOS profile</a>
|
2021-09-19 16:54:41 +00:00
|
|
|
</p>
|
2021-09-26 19:41:48 +00:00
|
|
|
-->
|
2022-03-01 07:30:35 +00:00
|
|
|
|
2021-09-23 19:22:07 +00:00
|
|
|
<h3>macOS</h3>
|
|
|
|
<p>Headscale can be set to the default server by installing a Headscale configuration profile:</p>
|
2021-09-19 16:54:41 +00:00
|
|
|
<p>
|
2021-09-23 19:22:07 +00:00
|
|
|
<a href="/apple/macos" download="headscale_macos.mobileconfig">macOS profile</a>
|
2021-09-19 16:54:41 +00:00
|
|
|
</p>
|
2021-09-23 19:22:07 +00:00
|
|
|
|
|
|
|
<ol>
|
|
|
|
<li>Download the profile, then open it. When it has been opened, there should be a notification that a profile can be installed</li>
|
|
|
|
<li>Open System Preferences and go to "Profiles"</li>
|
|
|
|
<li>Find and install the Headscale profile</li>
|
|
|
|
<li>Restart Tailscale.app and log in</li>
|
|
|
|
</ol>
|
|
|
|
|
|
|
|
<p>Or</p>
|
|
|
|
<p>Use your terminal to configure the default setting for Tailscale by issuing:</p>
|
2021-11-15 17:24:24 +00:00
|
|
|
<code>defaults write io.tailscale.ipn.macos ControlURL {{.URL}}</code>
|
2021-09-23 19:22:07 +00:00
|
|
|
|
|
|
|
<p>Restart Tailscale.app and log in.</p>
|
2022-03-01 07:30:35 +00:00
|
|
|
|
2021-09-19 16:54:41 +00:00
|
|
|
</body>
|
|
|
|
</html>`))
|
|
|
|
|
|
|
|
config := map[string]interface{}{
|
2021-11-15 17:24:24 +00:00
|
|
|
"URL": h.cfg.ServerURL,
|
2021-09-19 16:54:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
var payload bytes.Buffer
|
2021-11-14 19:32:03 +00:00
|
|
|
if err := appleTemplate.Execute(&payload, config); err != nil {
|
2021-09-20 06:54:18 +00:00
|
|
|
log.Error().
|
|
|
|
Str("handler", "AppleMobileConfig").
|
|
|
|
Err(err).
|
|
|
|
Msg("Could not render Apple index template")
|
2022-06-17 14:48:04 +00:00
|
|
|
|
2022-06-26 09:43:17 +00:00
|
|
|
writer.Header().Set("Content-Type", "text/plain; charset=utf-8")
|
|
|
|
writer.WriteHeader(http.StatusInternalServerError)
|
2022-06-26 10:21:35 +00:00
|
|
|
_, err := writer.Write([]byte("Could not render Apple index template"))
|
|
|
|
if err != nil {
|
|
|
|
log.Error().
|
|
|
|
Caller().
|
|
|
|
Err(err).
|
|
|
|
Msg("Failed to write response")
|
|
|
|
}
|
2021-11-14 15:46:09 +00:00
|
|
|
|
2021-09-19 16:54:41 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2022-06-26 09:43:17 +00:00
|
|
|
writer.Header().Set("Content-Type", "text/html; charset=utf-8")
|
|
|
|
writer.WriteHeader(http.StatusOK)
|
2022-06-26 10:21:35 +00:00
|
|
|
_, err := writer.Write(payload.Bytes())
|
|
|
|
if err != nil {
|
|
|
|
log.Error().
|
|
|
|
Caller().
|
|
|
|
Err(err).
|
|
|
|
Msg("Failed to write response")
|
|
|
|
}
|
2021-09-19 16:54:41 +00:00
|
|
|
}
|
|
|
|
|
2022-06-17 14:48:04 +00:00
|
|
|
func (h *Headscale) ApplePlatformConfig(
|
2022-06-26 09:43:17 +00:00
|
|
|
writer http.ResponseWriter,
|
|
|
|
req *http.Request,
|
2022-06-17 14:48:04 +00:00
|
|
|
) {
|
2022-06-26 09:43:17 +00:00
|
|
|
vars := mux.Vars(req)
|
2022-06-20 10:29:59 +00:00
|
|
|
platform, ok := vars["platform"]
|
|
|
|
if !ok {
|
|
|
|
log.Error().
|
|
|
|
Str("handler", "ApplePlatformConfig").
|
|
|
|
Msg("No platform specified")
|
2022-06-26 09:43:17 +00:00
|
|
|
http.Error(writer, "No platform specified", http.StatusBadRequest)
|
2022-06-20 10:29:59 +00:00
|
|
|
|
|
|
|
return
|
|
|
|
}
|
2021-09-19 16:54:41 +00:00
|
|
|
|
|
|
|
id, err := uuid.NewV4()
|
|
|
|
if err != nil {
|
2021-09-20 06:54:18 +00:00
|
|
|
log.Error().
|
|
|
|
Str("handler", "ApplePlatformConfig").
|
|
|
|
Err(err).
|
|
|
|
Msg("Failed not create UUID")
|
2022-06-17 14:48:04 +00:00
|
|
|
|
2022-06-26 09:43:17 +00:00
|
|
|
writer.Header().Set("Content-Type", "text/plain; charset=utf-8")
|
|
|
|
writer.WriteHeader(http.StatusInternalServerError)
|
2022-06-26 10:21:35 +00:00
|
|
|
_, err := writer.Write([]byte("Failed to create UUID"))
|
|
|
|
if err != nil {
|
|
|
|
log.Error().
|
|
|
|
Caller().
|
|
|
|
Err(err).
|
|
|
|
Msg("Failed to write response")
|
|
|
|
}
|
2021-11-14 15:46:09 +00:00
|
|
|
|
2021-09-19 16:54:41 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2021-11-15 17:24:24 +00:00
|
|
|
contentID, err := uuid.NewV4()
|
2021-09-19 16:54:41 +00:00
|
|
|
if err != nil {
|
2021-09-20 06:54:18 +00:00
|
|
|
log.Error().
|
|
|
|
Str("handler", "ApplePlatformConfig").
|
|
|
|
Err(err).
|
|
|
|
Msg("Failed not create UUID")
|
2022-06-17 14:48:04 +00:00
|
|
|
|
2022-06-26 09:43:17 +00:00
|
|
|
writer.Header().Set("Content-Type", "text/plain; charset=utf-8")
|
|
|
|
writer.WriteHeader(http.StatusInternalServerError)
|
2022-06-26 10:21:35 +00:00
|
|
|
_, err := writer.Write([]byte("Failed to create content UUID"))
|
|
|
|
if err != nil {
|
|
|
|
log.Error().
|
|
|
|
Caller().
|
|
|
|
Err(err).
|
|
|
|
Msg("Failed to write response")
|
|
|
|
}
|
2021-11-14 15:46:09 +00:00
|
|
|
|
2021-09-19 16:54:41 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
platformConfig := AppleMobilePlatformConfig{
|
2021-11-15 17:24:24 +00:00
|
|
|
UUID: contentID,
|
|
|
|
URL: h.cfg.ServerURL,
|
2021-09-19 16:54:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
var payload bytes.Buffer
|
|
|
|
|
|
|
|
switch platform {
|
|
|
|
case "macos":
|
|
|
|
if err := macosTemplate.Execute(&payload, platformConfig); err != nil {
|
2021-09-20 06:54:18 +00:00
|
|
|
log.Error().
|
|
|
|
Str("handler", "ApplePlatformConfig").
|
|
|
|
Err(err).
|
|
|
|
Msg("Could not render Apple macOS template")
|
2022-06-17 14:48:04 +00:00
|
|
|
|
2022-06-26 09:43:17 +00:00
|
|
|
writer.Header().Set("Content-Type", "text/plain; charset=utf-8")
|
|
|
|
writer.WriteHeader(http.StatusInternalServerError)
|
2022-06-26 10:21:35 +00:00
|
|
|
_, err := writer.Write([]byte("Could not render Apple macOS template"))
|
|
|
|
if err != nil {
|
|
|
|
log.Error().
|
|
|
|
Caller().
|
|
|
|
Err(err).
|
|
|
|
Msg("Failed to write response")
|
|
|
|
}
|
2021-11-14 15:46:09 +00:00
|
|
|
|
2021-09-19 16:54:41 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
case "ios":
|
|
|
|
if err := iosTemplate.Execute(&payload, platformConfig); err != nil {
|
2021-09-20 06:54:18 +00:00
|
|
|
log.Error().
|
|
|
|
Str("handler", "ApplePlatformConfig").
|
|
|
|
Err(err).
|
|
|
|
Msg("Could not render Apple iOS template")
|
2022-06-17 14:48:04 +00:00
|
|
|
|
2022-06-26 09:43:17 +00:00
|
|
|
writer.Header().Set("Content-Type", "text/plain; charset=utf-8")
|
|
|
|
writer.WriteHeader(http.StatusInternalServerError)
|
2022-06-26 10:21:35 +00:00
|
|
|
_, err := writer.Write([]byte("Could not render Apple iOS template"))
|
|
|
|
if err != nil {
|
|
|
|
log.Error().
|
|
|
|
Caller().
|
|
|
|
Err(err).
|
|
|
|
Msg("Failed to write response")
|
|
|
|
}
|
2021-11-14 15:46:09 +00:00
|
|
|
|
2021-09-19 16:54:41 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
default:
|
2022-06-26 09:43:17 +00:00
|
|
|
writer.Header().Set("Content-Type", "text/plain; charset=utf-8")
|
|
|
|
writer.WriteHeader(http.StatusBadRequest)
|
2022-08-04 08:47:00 +00:00
|
|
|
_, err := writer.Write(
|
|
|
|
[]byte("Invalid platform, only ios and macos is supported"),
|
|
|
|
)
|
2022-06-26 10:21:35 +00:00
|
|
|
if err != nil {
|
|
|
|
log.Error().
|
|
|
|
Caller().
|
|
|
|
Err(err).
|
|
|
|
Msg("Failed to write response")
|
|
|
|
}
|
2021-11-14 15:46:09 +00:00
|
|
|
|
2021-09-19 16:54:41 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
config := AppleMobileConfig{
|
|
|
|
UUID: id,
|
2021-11-15 17:24:24 +00:00
|
|
|
URL: h.cfg.ServerURL,
|
2021-09-19 16:54:41 +00:00
|
|
|
Payload: payload.String(),
|
|
|
|
}
|
|
|
|
|
|
|
|
var content bytes.Buffer
|
|
|
|
if err := commonTemplate.Execute(&content, config); err != nil {
|
2021-09-20 06:54:18 +00:00
|
|
|
log.Error().
|
|
|
|
Str("handler", "ApplePlatformConfig").
|
|
|
|
Err(err).
|
|
|
|
Msg("Could not render Apple platform template")
|
2022-06-17 14:48:04 +00:00
|
|
|
|
2022-06-26 09:43:17 +00:00
|
|
|
writer.Header().Set("Content-Type", "text/plain; charset=utf-8")
|
|
|
|
writer.WriteHeader(http.StatusInternalServerError)
|
2022-06-26 10:21:35 +00:00
|
|
|
_, err := writer.Write([]byte("Could not render Apple platform template"))
|
|
|
|
if err != nil {
|
|
|
|
log.Error().
|
|
|
|
Caller().
|
|
|
|
Err(err).
|
|
|
|
Msg("Failed to write response")
|
|
|
|
}
|
2021-11-14 15:46:09 +00:00
|
|
|
|
2021-09-19 16:54:41 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2022-08-04 08:47:00 +00:00
|
|
|
writer.Header().
|
|
|
|
Set("Content-Type", "application/x-apple-aspen-config; charset=utf-8")
|
2022-06-26 09:43:17 +00:00
|
|
|
writer.WriteHeader(http.StatusOK)
|
2022-06-26 10:21:35 +00:00
|
|
|
_, err = writer.Write(content.Bytes())
|
|
|
|
if err != nil {
|
|
|
|
log.Error().
|
|
|
|
Caller().
|
|
|
|
Err(err).
|
|
|
|
Msg("Failed to write response")
|
|
|
|
}
|
2021-09-19 16:54:41 +00:00
|
|
|
}
|
|
|
|
|
2022-03-04 09:37:55 +00:00
|
|
|
type WindowsRegistryConfig struct {
|
|
|
|
URL string
|
|
|
|
}
|
|
|
|
|
2021-09-19 16:54:41 +00:00
|
|
|
type AppleMobileConfig struct {
|
|
|
|
UUID uuid.UUID
|
2021-11-15 17:24:24 +00:00
|
|
|
URL string
|
2021-09-19 16:54:41 +00:00
|
|
|
Payload string
|
|
|
|
}
|
|
|
|
|
|
|
|
type AppleMobilePlatformConfig struct {
|
|
|
|
UUID uuid.UUID
|
2021-11-15 17:24:24 +00:00
|
|
|
URL string
|
2021-09-19 16:54:41 +00:00
|
|
|
}
|
|
|
|
|
2022-03-04 09:37:55 +00:00
|
|
|
var windowsRegTemplate = textTemplate.Must(
|
|
|
|
textTemplate.New("windowsconfig").Parse(`Windows Registry Editor Version 5.00
|
|
|
|
|
|
|
|
[HKEY_LOCAL_MACHINE\SOFTWARE\Tailscale IPN]
|
|
|
|
"UnattendedMode"="always"
|
|
|
|
"LoginURL"="{{.URL}}"
|
|
|
|
`))
|
|
|
|
|
2022-03-01 07:30:35 +00:00
|
|
|
var commonTemplate = textTemplate.Must(
|
|
|
|
textTemplate.New("mobileconfig").Parse(`<?xml version="1.0" encoding="UTF-8"?>
|
2021-09-19 16:54:41 +00:00
|
|
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
|
|
<plist version="1.0">
|
|
|
|
<dict>
|
|
|
|
<key>PayloadUUID</key>
|
|
|
|
<string>{{.UUID}}</string>
|
|
|
|
<key>PayloadDisplayName</key>
|
|
|
|
<string>Headscale</string>
|
|
|
|
<key>PayloadDescription</key>
|
2021-11-15 17:24:24 +00:00
|
|
|
<string>Configure Tailscale login server to: {{.URL}}</string>
|
2021-09-19 16:54:41 +00:00
|
|
|
<key>PayloadIdentifier</key>
|
|
|
|
<string>com.github.juanfont.headscale</string>
|
|
|
|
<key>PayloadRemovalDisallowed</key>
|
|
|
|
<false/>
|
|
|
|
<key>PayloadType</key>
|
|
|
|
<string>Configuration</string>
|
|
|
|
<key>PayloadVersion</key>
|
|
|
|
<integer>1</integer>
|
|
|
|
<key>PayloadContent</key>
|
|
|
|
<array>
|
|
|
|
{{.Payload}}
|
|
|
|
</array>
|
|
|
|
</dict>
|
2021-11-13 08:36:45 +00:00
|
|
|
</plist>`),
|
|
|
|
)
|
2021-09-19 16:54:41 +00:00
|
|
|
|
2022-03-01 07:30:35 +00:00
|
|
|
var iosTemplate = textTemplate.Must(textTemplate.New("iosTemplate").Parse(`
|
2021-09-19 16:54:41 +00:00
|
|
|
<dict>
|
|
|
|
<key>PayloadType</key>
|
|
|
|
<string>io.tailscale.ipn.ios</string>
|
|
|
|
<key>PayloadUUID</key>
|
|
|
|
<string>{{.UUID}}</string>
|
|
|
|
<key>PayloadIdentifier</key>
|
|
|
|
<string>com.github.juanfont.headscale</string>
|
|
|
|
<key>PayloadVersion</key>
|
|
|
|
<integer>1</integer>
|
|
|
|
<key>PayloadEnabled</key>
|
|
|
|
<true/>
|
|
|
|
|
|
|
|
<key>ControlURL</key>
|
2021-11-15 17:24:24 +00:00
|
|
|
<string>{{.URL}}</string>
|
2021-09-19 16:54:41 +00:00
|
|
|
</dict>
|
|
|
|
`))
|
|
|
|
|
|
|
|
var macosTemplate = template.Must(template.New("macosTemplate").Parse(`
|
|
|
|
<dict>
|
|
|
|
<key>PayloadType</key>
|
|
|
|
<string>io.tailscale.ipn.macos</string>
|
|
|
|
<key>PayloadUUID</key>
|
|
|
|
<string>{{.UUID}}</string>
|
|
|
|
<key>PayloadIdentifier</key>
|
|
|
|
<string>com.github.juanfont.headscale</string>
|
|
|
|
<key>PayloadVersion</key>
|
|
|
|
<integer>1</integer>
|
|
|
|
<key>PayloadEnabled</key>
|
|
|
|
<true/>
|
|
|
|
|
|
|
|
<key>ControlURL</key>
|
2021-11-15 17:24:24 +00:00
|
|
|
<string>{{.URL}}</string>
|
2021-09-19 16:54:41 +00:00
|
|
|
</dict>
|
|
|
|
`))
|