diff --git a/cmd/cli_test.go b/cmd/cli_test.go index 9e3c66dd..d811c6a2 100644 --- a/cmd/cli_test.go +++ b/cmd/cli_test.go @@ -1,12 +1,24 @@ //go:build !race // +build !race +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 cmd import ( "bytes" - "github.com/falcosecurity/driverkit/pkg/driverbuilder/builder" - "github.com/falcosecurity/driverkit/pkg/kernelrelease" "io" "io/ioutil" "os" @@ -17,6 +29,9 @@ import ( "testing" "text/template" + "github.com/falcosecurity/driverkit/pkg/driverbuilder/builder" + "github.com/falcosecurity/driverkit/pkg/kernelrelease" + "github.com/acarl005/stripansi" "gotest.tools/assert" ) diff --git a/cmd/completion.go b/cmd/completion.go index 2a66ddf5..4c4ecc88 100644 --- a/cmd/completion.go +++ b/cmd/completion.go @@ -1,3 +1,17 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 cmd import ( diff --git a/cmd/config_options.go b/cmd/config_options.go index 63fac18b..947a8194 100644 --- a/cmd/config_options.go +++ b/cmd/config_options.go @@ -1,3 +1,17 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 cmd import ( diff --git a/cmd/docker.go b/cmd/docker.go index 81124334..c77ecfd6 100644 --- a/cmd/docker.go +++ b/cmd/docker.go @@ -1,12 +1,27 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 cmd import ( + "log/slog" + "os" + "github.com/falcosecurity/driverkit/pkg/driverbuilder" "github.com/spf13/cobra" "github.com/spf13/pflag" "github.com/spf13/viper" - "log/slog" - "os" ) // NewDockerCmd creates the `driverkit docker` command. diff --git a/cmd/images.go b/cmd/images.go index adb01cb7..010622b8 100644 --- a/cmd/images.go +++ b/cmd/images.go @@ -1,11 +1,26 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 cmd import ( + "log/slog" + "os" + "github.com/olekukonko/tablewriter" "github.com/spf13/cobra" "github.com/spf13/pflag" - "log/slog" - "os" ) // NewImagesCmd creates the `driverkit images` command. diff --git a/cmd/kubernetes.go b/cmd/kubernetes.go index 4cb471ee..081fd20b 100644 --- a/cmd/kubernetes.go +++ b/cmd/kubernetes.go @@ -1,3 +1,17 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 cmd import ( diff --git a/cmd/kubernetes_in_cluster.go b/cmd/kubernetes_in_cluster.go index bcd42d3b..febdb0d7 100644 --- a/cmd/kubernetes_in_cluster.go +++ b/cmd/kubernetes_in_cluster.go @@ -1,6 +1,23 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 cmd import ( + "log/slog" + "os" + "github.com/falcosecurity/driverkit/pkg/driverbuilder" "github.com/falcosecurity/driverkit/pkg/kubernetes/factory" "github.com/spf13/cobra" @@ -8,8 +25,6 @@ import ( "github.com/spf13/viper" "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" - "log/slog" - "os" ) // NewKubernetesInClusterCmd creates the `driverkit kubernetes` command. diff --git a/cmd/kubernetes_options.go b/cmd/kubernetes_options.go index 829fdb93..c3fd77a6 100644 --- a/cmd/kubernetes_options.go +++ b/cmd/kubernetes_options.go @@ -1,3 +1,17 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 cmd import flag "github.com/spf13/pflag" diff --git a/cmd/root.go b/cmd/root.go index f1beecef..ff0a5fd3 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -1,9 +1,21 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 cmd import ( "fmt" - "github.com/falcosecurity/driverkit/pkg/kernelrelease" - "github.com/falcosecurity/driverkit/validate" "io" "log/slog" "os" @@ -11,6 +23,9 @@ import ( "sort" "strings" + "github.com/falcosecurity/driverkit/pkg/kernelrelease" + "github.com/falcosecurity/driverkit/validate" + "github.com/falcosecurity/driverkit/pkg/driverbuilder/builder" "github.com/falcosecurity/driverkit/pkg/version" "github.com/spf13/cobra" diff --git a/cmd/root_options.go b/cmd/root_options.go index 8c171261..b9814faa 100644 --- a/cmd/root_options.go +++ b/cmd/root_options.go @@ -1,14 +1,29 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 cmd import ( "fmt" + "log/slog" + "os" + "github.com/creasty/defaults" "github.com/falcosecurity/driverkit/pkg/driverbuilder/builder" "github.com/falcosecurity/driverkit/pkg/kernelrelease" "github.com/falcosecurity/driverkit/validate" "github.com/go-playground/validator/v10" - "log/slog" - "os" ) // OutputOptions wraps the two drivers that driverkit builds. diff --git a/docgen/docgen.go b/docgen/docgen.go index 7988c50c..9b504fb2 100644 --- a/docgen/docgen.go +++ b/docgen/docgen.go @@ -1,3 +1,17 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 main import ( diff --git a/main.go b/main.go index 7c886f27..e5c2eafa 100644 --- a/main.go +++ b/main.go @@ -1,3 +1,17 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 main import ( diff --git a/pkg/driverbuilder/builder/aliyunlinux.go b/pkg/driverbuilder/builder/aliyunlinux.go index f8f56bcd..8785d59d 100644 --- a/pkg/driverbuilder/builder/aliyunlinux.go +++ b/pkg/driverbuilder/builder/aliyunlinux.go @@ -1,8 +1,23 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 builder import ( _ "embed" "fmt" + "github.com/falcosecurity/driverkit/pkg/kernelrelease" ) diff --git a/pkg/driverbuilder/builder/almalinux.go b/pkg/driverbuilder/builder/almalinux.go index 23020ddf..847b2b44 100644 --- a/pkg/driverbuilder/builder/almalinux.go +++ b/pkg/driverbuilder/builder/almalinux.go @@ -1,8 +1,23 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 builder import ( _ "embed" "fmt" + "github.com/falcosecurity/driverkit/pkg/kernelrelease" ) diff --git a/pkg/driverbuilder/builder/amazonlinux.go b/pkg/driverbuilder/builder/amazonlinux.go index b3e26753..50f76f22 100644 --- a/pkg/driverbuilder/builder/amazonlinux.go +++ b/pkg/driverbuilder/builder/amazonlinux.go @@ -1,3 +1,17 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 builder import ( diff --git a/pkg/driverbuilder/builder/archlinux.go b/pkg/driverbuilder/builder/archlinux.go index 2ae3fa94..2cf86bb2 100644 --- a/pkg/driverbuilder/builder/archlinux.go +++ b/pkg/driverbuilder/builder/archlinux.go @@ -1,3 +1,17 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 builder import ( diff --git a/pkg/driverbuilder/builder/bottlerocket.go b/pkg/driverbuilder/builder/bottlerocket.go index a6fad152..762c4c54 100644 --- a/pkg/driverbuilder/builder/bottlerocket.go +++ b/pkg/driverbuilder/builder/bottlerocket.go @@ -1,3 +1,17 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 builder import ( diff --git a/pkg/driverbuilder/builder/build.go b/pkg/driverbuilder/builder/build.go index 8adb83cb..8893a22a 100644 --- a/pkg/driverbuilder/builder/build.go +++ b/pkg/driverbuilder/builder/build.go @@ -1,11 +1,26 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 builder import ( "context" "fmt" + "strings" + "github.com/falcosecurity/driverkit/pkg/kernelrelease" "oras.land/oras-go/v2/registry/remote/auth" - "strings" ) var defaultImageTag = "latest" // This is overwritten when using the Makefile to build diff --git a/pkg/driverbuilder/builder/builders.go b/pkg/driverbuilder/builder/builders.go index a328ebbe..ca30a38a 100644 --- a/pkg/driverbuilder/builder/builders.go +++ b/pkg/driverbuilder/builder/builders.go @@ -1,3 +1,17 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 builder import ( diff --git a/pkg/driverbuilder/builder/builders_test.go b/pkg/driverbuilder/builder/builders_test.go index 24cd669a..3734ed3b 100644 --- a/pkg/driverbuilder/builder/builders_test.go +++ b/pkg/driverbuilder/builder/builders_test.go @@ -1,3 +1,17 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 builder import ( diff --git a/pkg/driverbuilder/builder/centos.go b/pkg/driverbuilder/builder/centos.go index dedf1e0f..fe063a57 100644 --- a/pkg/driverbuilder/builder/centos.go +++ b/pkg/driverbuilder/builder/centos.go @@ -1,3 +1,17 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 builder import ( diff --git a/pkg/driverbuilder/builder/debian.go b/pkg/driverbuilder/builder/debian.go index c2180514..d612330a 100644 --- a/pkg/driverbuilder/builder/debian.go +++ b/pkg/driverbuilder/builder/debian.go @@ -1,13 +1,28 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 builder import ( _ "embed" "fmt" - "github.com/falcosecurity/driverkit/pkg/kernelrelease" "io/ioutil" "net/http" "regexp" "strings" + + "github.com/falcosecurity/driverkit/pkg/kernelrelease" ) //go:embed templates/debian.sh diff --git a/pkg/driverbuilder/builder/fedora.go b/pkg/driverbuilder/builder/fedora.go index 59cea64d..d1878e34 100644 --- a/pkg/driverbuilder/builder/fedora.go +++ b/pkg/driverbuilder/builder/fedora.go @@ -1,3 +1,17 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 builder import ( diff --git a/pkg/driverbuilder/builder/flatcar.go b/pkg/driverbuilder/builder/flatcar.go index 04e1a176..fea0d712 100644 --- a/pkg/driverbuilder/builder/flatcar.go +++ b/pkg/driverbuilder/builder/flatcar.go @@ -1,13 +1,28 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 builder import ( _ "embed" "fmt" - "github.com/blang/semver" - "github.com/falcosecurity/driverkit/pkg/kernelrelease" "io/ioutil" "net/http" "strings" + + "github.com/blang/semver" + "github.com/falcosecurity/driverkit/pkg/kernelrelease" ) //go:embed templates/flatcar.sh diff --git a/pkg/driverbuilder/builder/image.go b/pkg/driverbuilder/builder/image.go index f09abc16..97f9d8e4 100644 --- a/pkg/driverbuilder/builder/image.go +++ b/pkg/driverbuilder/builder/image.go @@ -1,16 +1,31 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 builder import ( "context" "fmt" - "github.com/blang/semver" - "github.com/falcosecurity/driverkit/pkg/kernelrelease" - "github.com/falcosecurity/falcoctl/pkg/oci/repository" - "gopkg.in/yaml.v3" "log/slog" "os" "regexp" "strings" + + "github.com/blang/semver" + "github.com/falcosecurity/driverkit/pkg/kernelrelease" + "github.com/falcosecurity/falcoctl/pkg/oci/repository" + "gopkg.in/yaml.v3" ) type YAMLImage struct { diff --git a/pkg/driverbuilder/builder/image_test.go b/pkg/driverbuilder/builder/image_test.go index 91c1f36a..a1d848e4 100644 --- a/pkg/driverbuilder/builder/image_test.go +++ b/pkg/driverbuilder/builder/image_test.go @@ -1,13 +1,28 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 builder import ( - "github.com/blang/semver" - "github.com/docker/docker/testutil/registry" - "gotest.tools/assert" "io" "net/http" "os" "testing" + + "github.com/blang/semver" + "github.com/docker/docker/testutil/registry" + "gotest.tools/assert" ) var imagesTests = []struct { diff --git a/pkg/driverbuilder/builder/minikube.go b/pkg/driverbuilder/builder/minikube.go index e0e2804c..dc0714e5 100644 --- a/pkg/driverbuilder/builder/minikube.go +++ b/pkg/driverbuilder/builder/minikube.go @@ -1,3 +1,17 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 builder import ( diff --git a/pkg/driverbuilder/builder/opensuse.go b/pkg/driverbuilder/builder/opensuse.go index daaae863..1fff52ad 100644 --- a/pkg/driverbuilder/builder/opensuse.go +++ b/pkg/driverbuilder/builder/opensuse.go @@ -1,3 +1,17 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 builder import ( diff --git a/pkg/driverbuilder/builder/oracle.go b/pkg/driverbuilder/builder/oracle.go index 8a373a66..1ec7f7a0 100644 --- a/pkg/driverbuilder/builder/oracle.go +++ b/pkg/driverbuilder/builder/oracle.go @@ -1,3 +1,17 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 builder import ( diff --git a/pkg/driverbuilder/builder/photon.go b/pkg/driverbuilder/builder/photon.go index be1d2d38..258a43df 100644 --- a/pkg/driverbuilder/builder/photon.go +++ b/pkg/driverbuilder/builder/photon.go @@ -1,8 +1,23 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 builder import ( _ "embed" "fmt" + "github.com/falcosecurity/driverkit/pkg/kernelrelease" ) diff --git a/pkg/driverbuilder/builder/redhat.go b/pkg/driverbuilder/builder/redhat.go index 121a3114..d74e85e0 100644 --- a/pkg/driverbuilder/builder/redhat.go +++ b/pkg/driverbuilder/builder/redhat.go @@ -1,7 +1,22 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 builder import ( _ "embed" + "github.com/falcosecurity/driverkit/pkg/kernelrelease" ) diff --git a/pkg/driverbuilder/builder/rocky.go b/pkg/driverbuilder/builder/rocky.go index 96a8bb10..556e2126 100644 --- a/pkg/driverbuilder/builder/rocky.go +++ b/pkg/driverbuilder/builder/rocky.go @@ -1,8 +1,23 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 builder import ( _ "embed" "fmt" + "github.com/falcosecurity/driverkit/pkg/kernelrelease" ) diff --git a/pkg/driverbuilder/builder/talos.go b/pkg/driverbuilder/builder/talos.go index 46dbfc68..0bcc54ac 100644 --- a/pkg/driverbuilder/builder/talos.go +++ b/pkg/driverbuilder/builder/talos.go @@ -1,3 +1,17 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 builder import ( diff --git a/pkg/driverbuilder/builder/target.go b/pkg/driverbuilder/builder/target.go index ee8548ec..db6b9455 100644 --- a/pkg/driverbuilder/builder/target.go +++ b/pkg/driverbuilder/builder/target.go @@ -1,3 +1,17 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 builder // BuilderByTarget maps targets to their builder. diff --git a/pkg/driverbuilder/builder/templates/alinux.sh b/pkg/driverbuilder/builder/templates/alinux.sh index d6b06946..3b66ee0d 100644 --- a/pkg/driverbuilder/builder/templates/alinux.sh +++ b/pkg/driverbuilder/builder/templates/alinux.sh @@ -1,4 +1,25 @@ #!/bin/bash +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (C) 2023 The Falco 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. +# +# Simple script that desperately tries to load the kernel instrumentation by +# looking for it in a bunch of ways. Convenient when running Falco inside +# a container or in other weird environments. +# set -xeuo pipefail rm -Rf {{ .DriverBuildDir }} diff --git a/pkg/driverbuilder/builder/templates/almalinux.sh b/pkg/driverbuilder/builder/templates/almalinux.sh index d6b06946..3b66ee0d 100644 --- a/pkg/driverbuilder/builder/templates/almalinux.sh +++ b/pkg/driverbuilder/builder/templates/almalinux.sh @@ -1,4 +1,25 @@ #!/bin/bash +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (C) 2023 The Falco 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. +# +# Simple script that desperately tries to load the kernel instrumentation by +# looking for it in a bunch of ways. Convenient when running Falco inside +# a container or in other weird environments. +# set -xeuo pipefail rm -Rf {{ .DriverBuildDir }} diff --git a/pkg/driverbuilder/builder/templates/amazonlinux.sh b/pkg/driverbuilder/builder/templates/amazonlinux.sh index 675c466c..6b4f6a22 100644 --- a/pkg/driverbuilder/builder/templates/amazonlinux.sh +++ b/pkg/driverbuilder/builder/templates/amazonlinux.sh @@ -1,4 +1,25 @@ #!/bin/bash +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (C) 2023 The Falco 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. +# +# Simple script that desperately tries to load the kernel instrumentation by +# looking for it in a bunch of ways. Convenient when running Falco inside +# a container or in other weird environments. +# set -xeuo pipefail rm -Rf {{ .DriverBuildDir }} diff --git a/pkg/driverbuilder/builder/templates/archlinux.sh b/pkg/driverbuilder/builder/templates/archlinux.sh index b0803961..a2f59739 100644 --- a/pkg/driverbuilder/builder/templates/archlinux.sh +++ b/pkg/driverbuilder/builder/templates/archlinux.sh @@ -1,4 +1,25 @@ #!/bin/bash +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (C) 2023 The Falco 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. +# +# Simple script that desperately tries to load the kernel instrumentation by +# looking for it in a bunch of ways. Convenient when running Falco inside +# a container or in other weird environments. +# set -xeuo pipefail rm -Rf {{ .DriverBuildDir }} diff --git a/pkg/driverbuilder/builder/templates/centos.sh b/pkg/driverbuilder/builder/templates/centos.sh index cb0cac7b..7dce58ff 100644 --- a/pkg/driverbuilder/builder/templates/centos.sh +++ b/pkg/driverbuilder/builder/templates/centos.sh @@ -1,4 +1,25 @@ #!/bin/bash +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (C) 2023 The Falco 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. +# +# Simple script that desperately tries to load the kernel instrumentation by +# looking for it in a bunch of ways. Convenient when running Falco inside +# a container or in other weird environments. +# set -xeuo pipefail rm -Rf {{ .DriverBuildDir }} diff --git a/pkg/driverbuilder/builder/templates/debian.sh b/pkg/driverbuilder/builder/templates/debian.sh index 8c3fa091..8c06a646 100644 --- a/pkg/driverbuilder/builder/templates/debian.sh +++ b/pkg/driverbuilder/builder/templates/debian.sh @@ -1,4 +1,25 @@ #!/bin/bash +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (C) 2023 The Falco 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. +# +# Simple script that desperately tries to load the kernel instrumentation by +# looking for it in a bunch of ways. Convenient when running Falco inside +# a container or in other weird environments. +# set -xeuo pipefail rm -Rf {{ .DriverBuildDir }} diff --git a/pkg/driverbuilder/builder/templates/fedora.sh b/pkg/driverbuilder/builder/templates/fedora.sh index d6b06946..3b66ee0d 100644 --- a/pkg/driverbuilder/builder/templates/fedora.sh +++ b/pkg/driverbuilder/builder/templates/fedora.sh @@ -1,4 +1,25 @@ #!/bin/bash +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (C) 2023 The Falco 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. +# +# Simple script that desperately tries to load the kernel instrumentation by +# looking for it in a bunch of ways. Convenient when running Falco inside +# a container or in other weird environments. +# set -xeuo pipefail rm -Rf {{ .DriverBuildDir }} diff --git a/pkg/driverbuilder/builder/templates/flatcar.sh b/pkg/driverbuilder/builder/templates/flatcar.sh index 9a18ed04..266b667e 100644 --- a/pkg/driverbuilder/builder/templates/flatcar.sh +++ b/pkg/driverbuilder/builder/templates/flatcar.sh @@ -1,4 +1,25 @@ #!/bin/bash +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (C) 2023 The Falco 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. +# +# Simple script that desperately tries to load the kernel instrumentation by +# looking for it in a bunch of ways. Convenient when running Falco inside +# a container or in other weird environments. +# set -xeuo pipefail rm -Rf {{ .DriverBuildDir }} diff --git a/pkg/driverbuilder/builder/templates/opensuse.sh b/pkg/driverbuilder/builder/templates/opensuse.sh index fad85ad4..144a8e35 100644 --- a/pkg/driverbuilder/builder/templates/opensuse.sh +++ b/pkg/driverbuilder/builder/templates/opensuse.sh @@ -1,4 +1,25 @@ #!/bin/bash +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (C) 2023 The Falco 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. +# +# Simple script that desperately tries to load the kernel instrumentation by +# looking for it in a bunch of ways. Convenient when running Falco inside +# a container or in other weird environments. +# set -xeuo pipefail rm -Rf {{ .DriverBuildDir }} diff --git a/pkg/driverbuilder/builder/templates/oracle.sh b/pkg/driverbuilder/builder/templates/oracle.sh index d6b06946..3b66ee0d 100644 --- a/pkg/driverbuilder/builder/templates/oracle.sh +++ b/pkg/driverbuilder/builder/templates/oracle.sh @@ -1,4 +1,25 @@ #!/bin/bash +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (C) 2023 The Falco 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. +# +# Simple script that desperately tries to load the kernel instrumentation by +# looking for it in a bunch of ways. Convenient when running Falco inside +# a container or in other weird environments. +# set -xeuo pipefail rm -Rf {{ .DriverBuildDir }} diff --git a/pkg/driverbuilder/builder/templates/photonos.sh b/pkg/driverbuilder/builder/templates/photonos.sh index b653be68..2d77b62b 100644 --- a/pkg/driverbuilder/builder/templates/photonos.sh +++ b/pkg/driverbuilder/builder/templates/photonos.sh @@ -1,4 +1,25 @@ #!/bin/bash +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (C) 2023 The Falco 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. +# +# Simple script that desperately tries to load the kernel instrumentation by +# looking for it in a bunch of ways. Convenient when running Falco inside +# a container or in other weird environments. +# set -xeuo pipefail rm -Rf {{ .DriverBuildDir }} diff --git a/pkg/driverbuilder/builder/templates/redhat.sh b/pkg/driverbuilder/builder/templates/redhat.sh index 668a71d8..3d99c88c 100644 --- a/pkg/driverbuilder/builder/templates/redhat.sh +++ b/pkg/driverbuilder/builder/templates/redhat.sh @@ -1,4 +1,25 @@ #!/bin/bash +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (C) 2023 The Falco 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. +# +# Simple script that desperately tries to load the kernel instrumentation by +# looking for it in a bunch of ways. Convenient when running Falco inside +# a container or in other weird environments. +# set -xeuo pipefail rm -Rf {{ .DriverBuildDir }} diff --git a/pkg/driverbuilder/builder/templates/rocky.sh b/pkg/driverbuilder/builder/templates/rocky.sh index d6b06946..3b66ee0d 100644 --- a/pkg/driverbuilder/builder/templates/rocky.sh +++ b/pkg/driverbuilder/builder/templates/rocky.sh @@ -1,4 +1,25 @@ #!/bin/bash +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (C) 2023 The Falco 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. +# +# Simple script that desperately tries to load the kernel instrumentation by +# looking for it in a bunch of ways. Convenient when running Falco inside +# a container or in other weird environments. +# set -xeuo pipefail rm -Rf {{ .DriverBuildDir }} diff --git a/pkg/driverbuilder/builder/templates/ubuntu.sh b/pkg/driverbuilder/builder/templates/ubuntu.sh index 5a3a77fc..0b9cefa5 100644 --- a/pkg/driverbuilder/builder/templates/ubuntu.sh +++ b/pkg/driverbuilder/builder/templates/ubuntu.sh @@ -1,4 +1,25 @@ #!/bin/bash +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (C) 2023 The Falco 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. +# +# Simple script that desperately tries to load the kernel instrumentation by +# looking for it in a bunch of ways. Convenient when running Falco inside +# a container or in other weird environments. +# set -xeuo pipefail rm -Rf {{ .DriverBuildDir }} diff --git a/pkg/driverbuilder/builder/templates/vanilla.sh b/pkg/driverbuilder/builder/templates/vanilla.sh index e8b13388..80877eda 100644 --- a/pkg/driverbuilder/builder/templates/vanilla.sh +++ b/pkg/driverbuilder/builder/templates/vanilla.sh @@ -1,4 +1,25 @@ #!/bin/bash +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (C) 2023 The Falco 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. +# +# Simple script that desperately tries to load the kernel instrumentation by +# looking for it in a bunch of ways. Convenient when running Falco inside +# a container or in other weird environments. +# set -xeuo pipefail rm -Rf {{ .DriverBuildDir }} diff --git a/pkg/driverbuilder/builder/ubuntu.go b/pkg/driverbuilder/builder/ubuntu.go index acc9dfaa..96a5a7b2 100644 --- a/pkg/driverbuilder/builder/ubuntu.go +++ b/pkg/driverbuilder/builder/ubuntu.go @@ -1,12 +1,27 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 builder import ( _ "embed" "fmt" - "github.com/spf13/viper" "regexp" "strings" + "github.com/spf13/viper" + "github.com/falcosecurity/driverkit/pkg/kernelrelease" ) diff --git a/pkg/driverbuilder/builder/ubuntu_test.go b/pkg/driverbuilder/builder/ubuntu_test.go index 86e2e989..201fab5d 100644 --- a/pkg/driverbuilder/builder/ubuntu_test.go +++ b/pkg/driverbuilder/builder/ubuntu_test.go @@ -1,3 +1,17 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 builder import ( diff --git a/pkg/driverbuilder/builder/vanilla.go b/pkg/driverbuilder/builder/vanilla.go index 90dabf06..f9e8cc5f 100644 --- a/pkg/driverbuilder/builder/vanilla.go +++ b/pkg/driverbuilder/builder/vanilla.go @@ -1,10 +1,25 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 builder import ( _ "embed" "fmt" - "github.com/falcosecurity/driverkit/pkg/kernelrelease" "strings" + + "github.com/falcosecurity/driverkit/pkg/kernelrelease" ) //go:embed templates/vanilla.sh diff --git a/pkg/driverbuilder/buildprocessor.go b/pkg/driverbuilder/buildprocessor.go index 610a0c04..ead3676c 100644 --- a/pkg/driverbuilder/buildprocessor.go +++ b/pkg/driverbuilder/buildprocessor.go @@ -1,3 +1,17 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 driverbuilder import ( diff --git a/pkg/driverbuilder/docker.go b/pkg/driverbuilder/docker.go index 706e4085..fd69142d 100644 --- a/pkg/driverbuilder/docker.go +++ b/pkg/driverbuilder/docker.go @@ -1,3 +1,17 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 driverbuilder import ( @@ -7,6 +21,14 @@ import ( "context" "encoding/base64" "fmt" + "io" + "io/ioutil" + "log" + "log/slog" + "os" + "runtime" + "strconv" + "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/container" "github.com/docker/docker/client" @@ -15,14 +37,7 @@ import ( "github.com/falcosecurity/driverkit/pkg/kernelrelease" "github.com/falcosecurity/driverkit/pkg/signals" v1 "github.com/opencontainers/image-spec/specs-go/v1" - "io" - "io/ioutil" "k8s.io/apimachinery/pkg/util/uuid" - "log" - "log/slog" - "os" - "runtime" - "strconv" ) // DockerBuildProcessorName is a constant containing the docker name. diff --git a/pkg/driverbuilder/kubernetes.go b/pkg/driverbuilder/kubernetes.go index 4d952bf8..8356ee90 100644 --- a/pkg/driverbuilder/kubernetes.go +++ b/pkg/driverbuilder/kubernetes.go @@ -1,3 +1,17 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 driverbuilder import ( @@ -6,11 +20,12 @@ import ( "encoding/base64" "errors" "fmt" - "github.com/falcosecurity/driverkit/pkg/signals" "log/slog" "os" "time" + "github.com/falcosecurity/driverkit/pkg/signals" + "github.com/falcosecurity/driverkit/pkg/driverbuilder/builder" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" diff --git a/pkg/driverbuilder/nop.go b/pkg/driverbuilder/nop.go index 1d6c3644..0247f35b 100644 --- a/pkg/driverbuilder/nop.go +++ b/pkg/driverbuilder/nop.go @@ -1,3 +1,17 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 driverbuilder import "github.com/falcosecurity/driverkit/pkg/driverbuilder/builder" diff --git a/pkg/driverbuilder/templates.go b/pkg/driverbuilder/templates.go index d34304f5..66e5e5d9 100644 --- a/pkg/driverbuilder/templates.go +++ b/pkg/driverbuilder/templates.go @@ -1,3 +1,17 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 driverbuilder import ( diff --git a/pkg/kernelrelease/kernelrelease.go b/pkg/kernelrelease/kernelrelease.go index 7161e602..0ba0100a 100644 --- a/pkg/kernelrelease/kernelrelease.go +++ b/pkg/kernelrelease/kernelrelease.go @@ -1,3 +1,17 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 kernelrelease import ( diff --git a/pkg/kernelrelease/kernelrelease_test.go b/pkg/kernelrelease/kernelrelease_test.go index f66918cb..851a27f5 100644 --- a/pkg/kernelrelease/kernelrelease_test.go +++ b/pkg/kernelrelease/kernelrelease_test.go @@ -1,3 +1,17 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 kernelrelease import ( diff --git a/pkg/kubernetes/factory/factory.go b/pkg/kubernetes/factory/factory.go index b6a13094..13ba241c 100644 --- a/pkg/kubernetes/factory/factory.go +++ b/pkg/kubernetes/factory/factory.go @@ -1,3 +1,17 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 factory import ( diff --git a/pkg/signals/signals.go b/pkg/signals/signals.go index e0fd5875..eb54d519 100644 --- a/pkg/signals/signals.go +++ b/pkg/signals/signals.go @@ -1,3 +1,17 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 signals import ( @@ -28,4 +42,4 @@ func WithSignals(ctx context.Context, sigs ...os.Signal) context.Context { // WithStandardSignals cancels the context on os.Interrupt, syscall.SIGTERM. func WithStandardSignals(ctx context.Context) context.Context { return WithSignals(ctx, os.Interrupt, syscall.SIGTERM) -} \ No newline at end of file +} diff --git a/pkg/version/version.go b/pkg/version/version.go index bc1a29ad..6c234263 100644 --- a/pkg/version/version.go +++ b/pkg/version/version.go @@ -1,3 +1,17 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 version import ( diff --git a/validate/architecture.go b/validate/architecture.go index afdddb64..c0de4200 100644 --- a/validate/architecture.go +++ b/validate/architecture.go @@ -1,10 +1,25 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 validate import ( "fmt" + "reflect" + "github.com/falcosecurity/driverkit/pkg/kernelrelease" "github.com/go-playground/validator/v10" - "reflect" ) func isArchitectureSupported(fl validator.FieldLevel) bool { diff --git a/validate/isfilepath.go b/validate/isfilepath.go index 9e3c8976..aa5edbd7 100644 --- a/validate/isfilepath.go +++ b/validate/isfilepath.go @@ -1,3 +1,17 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 validate import ( diff --git a/validate/isimagename.go b/validate/isimagename.go index 1d26547a..3d7d448d 100644 --- a/validate/isimagename.go +++ b/validate/isimagename.go @@ -1,3 +1,17 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 validate import ( diff --git a/validate/isloglevel.go b/validate/isloglevel.go index 2bffbe0b..c3244082 100644 --- a/validate/isloglevel.go +++ b/validate/isloglevel.go @@ -1,8 +1,23 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 validate import ( - "github.com/go-playground/validator/v10" "log/slog" + + "github.com/go-playground/validator/v10" ) var ProgramLevel = new(slog.LevelVar) diff --git a/validate/isproxy.go b/validate/isproxy.go index c946daf4..0d470240 100644 --- a/validate/isproxy.go +++ b/validate/isproxy.go @@ -1,3 +1,17 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 validate import ( diff --git a/validate/semver.go b/validate/semver.go index 73446bf4..187a7d91 100644 --- a/validate/semver.go +++ b/validate/semver.go @@ -1,10 +1,25 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 validate import ( "fmt" - "github.com/blang/semver" "reflect" + "github.com/blang/semver" + "github.com/go-playground/validator/v10" ) diff --git a/validate/sha1.go b/validate/sha1.go index 9d16f660..2524b2be 100644 --- a/validate/sha1.go +++ b/validate/sha1.go @@ -1,3 +1,17 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 validate import ( diff --git a/validate/target.go b/validate/target.go index edd74169..9b290dfd 100644 --- a/validate/target.go +++ b/validate/target.go @@ -1,3 +1,17 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 validate import ( diff --git a/validate/validate.go b/validate/validate.go index c437ab23..83673b5b 100644 --- a/validate/validate.go +++ b/validate/validate.go @@ -1,11 +1,26 @@ +// SPDX-License-Identifier: Apache-2.0 +/* +Copyright (C) 2023 The Falco 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 validate import ( "fmt" - "github.com/falcosecurity/driverkit/pkg/kernelrelease" "reflect" "strings" + "github.com/falcosecurity/driverkit/pkg/kernelrelease" + "github.com/falcosecurity/driverkit/pkg/driverbuilder/builder" "github.com/go-playground/locales/en" ut "github.com/go-playground/universal-translator"