2023-01-27 21:37:20 +00:00
|
|
|
// Copyright (c) Tailscale Inc & AUTHORS
|
|
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
2023-01-18 02:39:49 +00:00
|
|
|
|
2023-08-11 01:01:22 +01:00
|
|
|
// Windows-specific stuff that can't go in clientupdate.go because it needs
|
2023-01-18 02:39:49 +00:00
|
|
|
// x/sys/windows.
|
|
|
|
|
2023-08-11 01:01:22 +01:00
|
|
|
package clientupdate
|
2023-01-18 02:39:49 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"golang.org/x/sys/windows"
|
2023-08-11 01:01:22 +01:00
|
|
|
"tailscale.com/util/winutil/authenticode"
|
2023-01-18 02:39:49 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
markTempFileFunc = markTempFileWindows
|
2023-08-11 01:01:22 +01:00
|
|
|
verifyAuthenticode = verifyTailscale
|
2023-01-18 02:39:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func markTempFileWindows(name string) error {
|
|
|
|
name16 := windows.StringToUTF16Ptr(name)
|
|
|
|
return windows.MoveFileEx(name16, nil, windows.MOVEFILE_DELAY_UNTIL_REBOOT)
|
|
|
|
}
|
2023-08-11 01:01:22 +01:00
|
|
|
|
|
|
|
const certSubjectTailscale = "Tailscale Inc."
|
|
|
|
|
|
|
|
func verifyTailscale(path string) error {
|
|
|
|
return authenticode.Verify(path, certSubjectTailscale)
|
|
|
|
}
|