-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cli: platform dependent genpolicy config
- Loading branch information
Showing
11 changed files
with
99 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Copyright (c) 2023 Microsoft Corporation | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
|
||
package agent_policy | ||
|
||
default AddARPNeighborsRequest := true | ||
default AddSwapRequest := true | ||
default CloseStdinRequest := true | ||
default CopyFileRequest := true | ||
default CreateContainerRequest := true | ||
default CreateSandboxRequest := true | ||
default DestroySandboxRequest := true | ||
default ExecProcessRequest := true | ||
default GetMetricsRequest := true | ||
default GetOOMEventRequest := true | ||
default GuestDetailsRequest := true | ||
default ListInterfacesRequest := true | ||
default ListRoutesRequest := true | ||
default MemHotplugByProbeRequest := true | ||
default OnlineCPUMemRequest := true | ||
default PauseContainerRequest := true | ||
default PullImageRequest := true | ||
default ReadStreamRequest := true | ||
default RemoveContainerRequest := true | ||
default RemoveStaleVirtiofsShareMountsRequest := true | ||
default ReseedRandomDevRequest := true | ||
default ResumeContainerRequest := true | ||
default SetGuestDateTimeRequest := true | ||
default SetPolicyRequest := true | ||
default SignalProcessRequest := true | ||
default StartContainerRequest := true | ||
default StartTracingRequest := true | ||
default StatsContainerRequest := true | ||
default StopTracingRequest := true | ||
default TtyWinResizeRequest := true | ||
default UpdateContainerRequest := true | ||
default UpdateEphemeralMountsRequest := true | ||
default UpdateInterfaceRequest := true | ||
default UpdateRoutesRequest := true | ||
default WaitProcessRequest := true | ||
default WriteStreamRequest := true |
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,40 @@ | ||
// Copyright 2024 Edgeless Systems GmbH | ||
// SPDX-License-Identifier: AGPL-3.0-only | ||
|
||
package genpolicy | ||
|
||
import ( | ||
_ "embed" | ||
|
||
"github.com/edgelesssys/contrast/node-installer/platforms" | ||
) | ||
|
||
var ( | ||
//go:embed assets/genpolicy | ||
genpolicyBin []byte | ||
//go:embed assets/genpolicy-settings.json | ||
defaultGenpolicySettings []byte | ||
//go:embed assets/genpolicy-rules.rego | ||
aksCloudHypervisorSNPRules []byte | ||
//go:embed assets/allow-all.rego | ||
permissiveRules []byte | ||
) | ||
|
||
type Config struct { | ||
Rules []byte | ||
Settings []byte | ||
} | ||
|
||
func NewConfig(platform platforms.Platform) *Config { | ||
cfg := &Config{ | ||
Settings: defaultGenpolicySettings, | ||
} | ||
switch platform { | ||
case platforms.AKSCloudHypervisorSNP: | ||
cfg.Rules = aksCloudHypervisorSNPRules | ||
default: | ||
// TODO(burgerdev): use real rules for supported platforms. | ||
cfg.Rules = permissiveRules | ||
} | ||
return cfg | ||
} |
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