Skip to content

Commit af8e786

Browse files
author
David Wertenteil
authored
Merge pull request kubescape#914 from kubescape/dev
Closing issues
2 parents f3b8de9 + 4f58398 commit af8e786

40 files changed

+403
-303
lines changed

.github/workflows/build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,6 @@ jobs:
8686
client: "image-release"
8787
image_name: "quay.io/${{ github.repository_owner }}/kubescape"
8888
image_tag: "v2.0.${{ github.run_number }}"
89-
support_platforms: false
89+
support_platforms: true
9090
cosign: true
9191
secrets: inherit

.github/workflows/build_dev.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ jobs:
2121
client: "image-dev"
2222
image_name: "quay.io/${{ github.repository_owner }}/kubescape"
2323
image_tag: "dev-v2.0.${{ github.run_number }}"
24-
support_platforms: false
24+
support_platforms: true
2525
cosign: true
2626
secrets: inherit

build.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def main():
5757
if client_name:
5858
ldflags += " -X {}={}".format(client_var, client_name)
5959

60-
build_command = ["go", "build", "-tags=static", "-o", ks_file, "-ldflags" ,ldflags]
60+
build_command = ["go", "build", "-buildmode=pie", "-tags=static", "-o", ks_file, "-ldflags" ,ldflags]
6161

6262
print("Building kubescape and saving here: {}".format(ks_file))
6363
print("Build command: {}".format(" ".join(build_command)))

build/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ ENV CGO_ENABLED=1
1212

1313
# Install required python/pip
1414
ENV PYTHONUNBUFFERED=1
15-
RUN apk add --update --no-cache python3 git openssl-dev musl-dev gcc make cmake pkgconfig && ln -sf python3 /usr/bin/python
15+
RUN apk add --update --no-cache python3 gcc make git libc-dev binutils-gold cmake pkgconfig && ln -sf python3 /usr/bin/python
1616
RUN python3 -m ensurepip
1717
RUN pip3 install --no-cache --upgrade pip setuptools
1818

cmd/download/download.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ var (
2424
# Download the NSA framework. Run 'kubescape list frameworks' for all frameworks names
2525
kubescape download framework nsa
2626
27-
# Download the "Allowed hostPath" control. Run 'kubescape list controls' for all controls names
28-
kubescape download control "Allowed hostPath"
27+
# Download the "HostPath mount" control. Run 'kubescape list controls' for all controls names
28+
kubescape download control "HostPath mount"
2929
3030
# Download the "C-0001" control. Run 'kubescape list controls --id' for all controls ids
3131
kubescape download control C-0001

cmd/list/list.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,8 @@ var (
2020
# List all supported frameworks names
2121
kubescape list frameworks --account <account id>
2222
23-
# List all supported controls names
23+
# List all supported controls names with ids
2424
kubescape list controls
25-
26-
# List all supported controls ids
27-
kubescape list controls --id
2825
2926
Control documentation:
3027
https://hub.armosec.io/docs/controls
@@ -67,8 +64,8 @@ func GetListCmd(ks meta.IKubescape) *cobra.Command {
6764
listCmd.PersistentFlags().StringVarP(&listPolicies.Credentials.Account, "account", "", "", "Kubescape SaaS account ID. Default will load account ID from cache")
6865
listCmd.PersistentFlags().StringVarP(&listPolicies.Credentials.ClientID, "client-id", "", "", "Kubescape SaaS client ID. Default will load client ID from cache, read more - https://hub.armosec.io/docs/authentication")
6966
listCmd.PersistentFlags().StringVarP(&listPolicies.Credentials.SecretKey, "secret-key", "", "", "Kubescape SaaS secret key. Default will load secret key from cache, read more - https://hub.armosec.io/docs/authentication")
70-
listCmd.PersistentFlags().StringVar(&listPolicies.Format, "format", "pretty-print", "output format. supported: 'pretty-printer'/'json'")
71-
listCmd.PersistentFlags().BoolVarP(&listPolicies.ListIDs, "id", "", false, "List control ID's instead of controls names")
67+
listCmd.PersistentFlags().StringVar(&listPolicies.Format, "format", "pretty-print", "output format. supported: 'pretty-print'/'json'")
68+
listCmd.PersistentFlags().MarkDeprecated("id", "Control ID's are included in list outpus")
7269

7370
return listCmd
7471
}

cmd/scan/control.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ var (
2323
kubescape scan control "privileged container"
2424
2525
# Scan list of controls separated with a comma
26-
kubescape scan control "privileged container","allowed hostpath"
26+
kubescape scan control "privileged container","HostPath mount"
2727
2828
# Scan list of controls using the control ID separated with a comma
2929
kubescape scan control C-0058,C-0057
@@ -61,7 +61,7 @@ func getControlCmd(ks meta.IKubescape, scanInfo *cautils.ScanInfo) *cobra.Comman
6161
if err := validateFrameworkScanInfo(scanInfo); err != nil {
6262
return err
6363
}
64-
64+
6565
// flagValidationControl(scanInfo)
6666
scanInfo.PolicyIdentifier = []cautils.PolicyIdentifier{}
6767

cmd/submit/rbac.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ var (
3131
// getRBACCmd represents the RBAC command
3232
func getRBACCmd(ks meta.IKubescape, submitInfo *v1.Submit) *cobra.Command {
3333
return &cobra.Command{
34-
Use: "rbac",
35-
Example: rbacExamples,
36-
Short: "Submit cluster's Role-Based Access Control(RBAC)",
37-
Long: ``,
34+
Use: "rbac",
35+
Deprecated: "This command is deprecated and will not be supported after 1/Jan/2023. Please use the 'scan' command instead.",
36+
Example: rbacExamples,
37+
Short: "Submit cluster's Role-Based Access Control(RBAC)",
38+
Long: ``,
3839
RunE: func(cmd *cobra.Command, args []string) error {
3940

4041
if err := flagValidationSubmit(submitInfo); err != nil {

cmd/submit/submit.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,21 @@ import (
77
)
88

99
var submitCmdExamples = `
10+
# Submit Kubescape scan results file
11+
kubescape submit results
1012
13+
# Submit exceptions file to Kubescape SaaS
14+
kubescape submit exceptions
1115
`
1216

1317
func GetSubmitCmd(ks meta.IKubescape) *cobra.Command {
1418
var submitInfo metav1.Submit
1519

1620
submitCmd := &cobra.Command{
17-
Use: "submit <command>",
18-
Short: "Submit an object to the Kubescape SaaS version",
19-
Long: ``,
21+
Use: "submit <command>",
22+
Short: "Submit an object to the Kubescape SaaS version",
23+
Long: ``,
24+
Example: submitCmdExamples,
2025
Run: func(cmd *cobra.Command, args []string) {
2126
},
2227
}

core/cautils/controllink.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package cautils
2+
3+
import (
4+
"fmt"
5+
"strings"
6+
)
7+
8+
func GetControlLink(controlID string) string {
9+
// For CIS Controls, cis-1.1.3 will be transformed to cis-1-1-3 in documentation link.
10+
docLinkID := strings.ReplaceAll(controlID, ".", "-")
11+
return fmt.Sprintf("https://hub.armosec.io/docs/%s", strings.ToLower(docLinkID))
12+
}

0 commit comments

Comments
 (0)