-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
VNet daemon: Set code signing requirements (#44639)
* Move Go error definitions to common_darwin.go Both client_darwin.go and serivce_darwin.go are going to use them, so it doesn't make sense to keep them in either of those files or scattered across them. * Roll protocol_darwin into common_darwin There's little need for those two files to be kept separate. * Add function for getting code signing requirement Both the client and the daemon are going to set a requirement towards each other, hence why this function is in common. * Set code signing requirement towards daemon client * Set code signing requirement towards daemon service * Add info about mdfind to README * Keep #cgo declarations in a single file * Fix typos * Move const to where it's used
- Loading branch information
Showing
12 changed files
with
292 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// Teleport | ||
// Copyright (C) 2024 Gravitational, Inc. | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Affero General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Affero General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Affero General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
//go:build vnetdaemon | ||
// +build vnetdaemon | ||
|
||
package daemon | ||
|
||
// #cgo CFLAGS: -Wall -xobjective-c -fblocks -fobjc-arc -mmacosx-version-min=10.15 | ||
// #cgo LDFLAGS: -framework Foundation -framework ServiceManagement | ||
// #include "common_darwin.h" | ||
import "C" | ||
|
||
import ( | ||
"errors" | ||
) | ||
|
||
var ( | ||
// vnetErrorDomain is a custom error domain used for Objective-C errors that pertain to VNet. | ||
vnetErrorDomain = C.GoString(C.VNEErrorDomain) | ||
|
||
// errorCodeAlreadyRunning is returned within [vnetErrorDomain] errors to indicate that the daemon | ||
// received a message to start after it was already running. | ||
errorCodeAlreadyRunning = int(C.VNEAlreadyRunningError) | ||
errAlreadyRunning = errors.New("VNet is already running") | ||
|
||
// errorCodeMissingCodeSigningIdentifiers is returned within [vnetErrorDomain] Obj-C errors and | ||
// transformed to [errMissingCodeSigningIdentifiers] in Go. | ||
errorCodeMissingCodeSigningIdentifiers = int(C.VNEMissingCodeSigningIdentifiersError) | ||
errMissingCodeSigningIdentifiers = errors.New("either identifier or team identifier is missing in code signing information; is the binary signed?") | ||
) | ||
|
||
var ( | ||
// nsCocoaErrorDomain is a generic error domain used in a lot of Apple's Cocoa frameworks. | ||
nsCocoaErrorDomain = "NSCocoaErrorDomain" | ||
|
||
// https://developer.apple.com/documentation/foundation/1448136-nserror_codes/nsxpcconnectioninterrupted?changes=latest_major&language=objc | ||
errorCodeNSXPCConnectionInterrupted = int(C.NSXPCConnectionInterrupted) | ||
errXPCConnectionInterrupted = errors.New("XPC connection interrupted") | ||
|
||
// https://developer.apple.com/documentation/foundation/1448136-nserror_codes/nsxpcconnectioncodesigningrequirementfailure?language=objc | ||
errorCodeNSXPCConnectionCodeSigningRequirementFailure = int(C.NSXPCConnectionCodeSigningRequirementFailure) | ||
errXPCConnectionCodeSigningRequirementFailure = errors.New("code signing requirement failed") | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.