-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
1,259 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "gomod" | ||
directory: "/rexec" | ||
schedule: | ||
interval: "weekly" |
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,7 @@ | ||
## How does rexec work? | ||
|
||
The setup consists of two parts, first we have a `ValidatingWebhookConfiguration` where, we deny requests targeting pod exec unless the user is allowed to bypass or the request is coming through the rexec endpont. | ||
|
||
The second part is the rexec `APIService` where we receive exec request with the custom plugin. Here we modify the request back to a normal exec and audit it while proxying back to the kube apiserver. This proxyiing is happening through impersonation, as the user credentials are removed by the kube apiserver before being proxied to here. | ||
|
||
![Diagram](diagram.png?raw=true "Diagram") |
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,11 @@ | ||
## Configuration | ||
|
||
`--sys-debug` if set the api will log more verbose information about internal events | ||
|
||
`--audit-trace` if set, and tty was requested all keystrokes will be logged (otherwise the async auditer will merge keystrokes into command on each new lines) | ||
|
||
`--by-pass-user` repeatable flag for adding users to bypass list so they can use the standard exec command, handy for system users like `system:admin` | ||
|
||
`--by-pass-shared-key` this flags needs to be set if one runes more then one replica of rexec api, so the shared key between the apiservice part and the validatingwebhookpart are matching, otherwise said hey is autogenerated, it has to be a RFC 4122 compliant uuid | ||
|
||
`--max-strokes-per-line` with this flag we can alter the treshold we have on a linelength before async audit flushes, keep in mind the increasing it too high might lead oom kills on the rexec server |
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,25 @@ | ||
# kubectl-rexec | ||
![LOGO](LOGO.png) | ||
|
||
Kubectl exec does not provide any kind of audit what is actually done inside the container. Rexec plugin is here to help with that. | ||
|
||
## Contributing | ||
We strongly encourage you to contribute to our repository. Find out more in our [contribution guidelines](https://github.com/Adyen/.github/blob/master/CONTRIBUTING.md) | ||
|
||
## Requirements | ||
In kubernetes 1.30 `TranslateStreamCloseWebsocketRequests` featuregate is true by the default making protocol between kubectl and kube-apiserver is websocket while prior is SPDY, this solution handles only websockets so the k8s cluster either has to be 1.30 or 1.29 with `TranslateStreamCloseWebsocketRequests=true` feature flag. Version below 1.29 are not supported. | ||
|
||
## Installation | ||
See the [Getting started](https://github.com/Adyen/kubectl-rexec/blob/master/USAGE.md) guide. | ||
|
||
## Usage | ||
See the [Getting started](https://github.com/Adyen/kubectl-rexec/blob/master/USAGE.md) guide. | ||
|
||
## Documentation | ||
See the [Design](https://github.com/Adyen/kubectl-rexec/blob/master/DESIGN.md). | ||
|
||
## Support | ||
If you have a feature request, or spotted a bug or a technical problem, create a GitHub issue. | ||
|
||
## License | ||
MIT license. For more information, see the LICENSE file. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,91 @@ | ||
module github.com/adyen/kubectl-rexec | ||
|
||
go 1.23.1 | ||
|
||
require ( | ||
github.com/google/uuid v1.6.0 | ||
github.com/gorilla/mux v1.8.1 | ||
github.com/rs/zerolog v1.33.0 | ||
github.com/spf13/cobra v1.8.1 | ||
k8s.io/api v0.32.0 | ||
k8s.io/apimachinery v0.32.0 | ||
k8s.io/cli-runtime v0.31.4 | ||
k8s.io/client-go v0.32.0 | ||
k8s.io/component-base v0.31.4 | ||
k8s.io/kubectl v0.31.4 | ||
) | ||
|
||
require ( | ||
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect | ||
github.com/MakeNowJust/heredoc v1.0.0 // indirect | ||
github.com/blang/semver/v4 v4.0.0 // indirect | ||
github.com/chai2010/gettext-go v1.0.2 // indirect | ||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect | ||
github.com/daviddengcn/go-colortext v1.0.0 // indirect | ||
github.com/distribution/reference v0.6.0 // indirect | ||
github.com/emicklei/go-restful/v3 v3.11.0 // indirect | ||
github.com/exponent-io/jsonpath v0.0.0-20210407135951-1de76d718b3f // indirect | ||
github.com/fatih/camelcase v1.0.0 // indirect | ||
github.com/fxamacker/cbor/v2 v2.7.0 // indirect | ||
github.com/go-errors/errors v1.4.2 // indirect | ||
github.com/go-logr/logr v1.4.2 // indirect | ||
github.com/go-openapi/jsonpointer v0.21.0 // indirect | ||
github.com/go-openapi/jsonreference v0.20.2 // indirect | ||
github.com/go-openapi/swag v0.23.0 // indirect | ||
github.com/gogo/protobuf v1.3.2 // indirect | ||
github.com/golang/protobuf v1.5.4 // indirect | ||
github.com/google/btree v1.0.1 // indirect | ||
github.com/google/gnostic-models v0.6.8 // indirect | ||
github.com/google/go-cmp v0.6.0 // indirect | ||
github.com/google/gofuzz v1.2.0 // indirect | ||
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect | ||
github.com/gorilla/websocket v1.5.0 // indirect | ||
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect | ||
github.com/inconshreveable/mousetrap v1.1.0 // indirect | ||
github.com/jonboulle/clockwork v0.4.0 // indirect | ||
github.com/josharian/intern v1.0.0 // indirect | ||
github.com/json-iterator/go v1.1.12 // indirect | ||
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect | ||
github.com/lithammer/dedent v1.1.0 // indirect | ||
github.com/mailru/easyjson v0.7.7 // indirect | ||
github.com/mattn/go-colorable v0.1.13 // indirect | ||
github.com/mattn/go-isatty v0.0.19 // indirect | ||
github.com/mitchellh/go-wordwrap v1.0.1 // indirect | ||
github.com/moby/spdystream v0.5.0 // indirect | ||
github.com/moby/term v0.5.0 // indirect | ||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect | ||
github.com/modern-go/reflect2 v1.0.2 // indirect | ||
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect | ||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect | ||
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect | ||
github.com/opencontainers/go-digest v1.0.0 // indirect | ||
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect | ||
github.com/pkg/errors v0.9.1 // indirect | ||
github.com/russross/blackfriday/v2 v2.1.0 // indirect | ||
github.com/spf13/pflag v1.0.5 // indirect | ||
github.com/x448/float16 v0.8.4 // indirect | ||
github.com/xlab/treeprint v1.2.0 // indirect | ||
golang.org/x/net v0.30.0 // indirect | ||
golang.org/x/oauth2 v0.23.0 // indirect | ||
golang.org/x/sync v0.8.0 // indirect | ||
golang.org/x/sys v0.26.0 // indirect | ||
golang.org/x/term v0.25.0 // indirect | ||
golang.org/x/text v0.19.0 // indirect | ||
golang.org/x/time v0.7.0 // indirect | ||
google.golang.org/protobuf v1.35.1 // indirect | ||
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect | ||
gopkg.in/inf.v0 v0.9.1 // indirect | ||
gopkg.in/yaml.v2 v2.4.0 // indirect | ||
gopkg.in/yaml.v3 v3.0.1 // indirect | ||
k8s.io/component-helpers v0.32.0 // indirect | ||
k8s.io/klog/v2 v2.130.1 // indirect | ||
k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f // indirect | ||
k8s.io/metrics v0.32.0 // indirect | ||
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 // indirect | ||
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect | ||
sigs.k8s.io/kustomize/api v0.18.0 // indirect | ||
sigs.k8s.io/kustomize/kustomize/v5 v5.5.0 // indirect | ||
sigs.k8s.io/kustomize/kyaml v0.18.1 // indirect | ||
sigs.k8s.io/structured-merge-diff/v4 v4.4.2 // indirect | ||
sigs.k8s.io/yaml v1.4.0 // indirect | ||
) |
Oops, something went wrong.