mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-07-18 04:54:54 +00:00
Merge pull request #136404 from borg-land/nonewprivs-agnhost
add nonewprivs to agnhost
This commit is contained in:
@@ -1 +1 @@
|
||||
2.61
|
||||
2.62.0
|
||||
|
||||
@@ -42,6 +42,7 @@ import (
|
||||
"k8s.io/kubernetes/test/images/agnhost/nettest"
|
||||
nosnat "k8s.io/kubernetes/test/images/agnhost/no-snat-test"
|
||||
nosnatproxy "k8s.io/kubernetes/test/images/agnhost/no-snat-test-proxy"
|
||||
"k8s.io/kubernetes/test/images/agnhost/nonewprivs"
|
||||
"k8s.io/kubernetes/test/images/agnhost/openidmetadata"
|
||||
"k8s.io/kubernetes/test/images/agnhost/pause"
|
||||
"k8s.io/kubernetes/test/images/agnhost/podcertificatesigner"
|
||||
@@ -96,6 +97,7 @@ func main() {
|
||||
rootCmd.AddCommand(podcertificatesigner.CmdPodCertificateSigner)
|
||||
rootCmd.AddCommand(mtlsclient.CmdMtlsClient)
|
||||
rootCmd.AddCommand(mtlsserver.CmdMtlsServer)
|
||||
rootCmd.AddCommand(nonewprivs.CmdNoNewPrivs)
|
||||
// NOTE(claudiub): Some tests are passing logging related flags, so we need to be able to
|
||||
// accept them. This will also include them in the printed help.
|
||||
code := cli.Run(rootCmd)
|
||||
|
||||
4
test/images/agnhost/nonewprivs/OWNERS
Normal file
4
test/images/agnhost/nonewprivs/OWNERS
Normal file
@@ -0,0 +1,4 @@
|
||||
approvers:
|
||||
- mkumatag
|
||||
emeritus_approvers:
|
||||
- jessfraz
|
||||
3
test/images/agnhost/nonewprivs/README.md
Normal file
3
test/images/agnhost/nonewprivs/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# nonewprivs
|
||||
|
||||
A simple go app that prints the UID of the process running to test security context features.
|
||||
37
test/images/agnhost/nonewprivs/main.go
Normal file
37
test/images/agnhost/nonewprivs/main.go
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package nonewprivs
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
// CmdNoneNewPrivs is used by agnhost Cobra.
|
||||
var CmdNoNewPrivs = &cobra.Command{
|
||||
Use: "nonewprivs",
|
||||
Short: "Prints the UID of the running process",
|
||||
Long: `A go app that prints the UID of the process running to test security context features`,
|
||||
Args: cobra.MaximumNArgs(0),
|
||||
Run: main,
|
||||
}
|
||||
|
||||
func main(cmd *cobra.Command, args []string) {
|
||||
fmt.Printf("Effective uid: %d\n", os.Geteuid())
|
||||
}
|
||||
Reference in New Issue
Block a user