Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/network scanner control #1592

Open
wants to merge 22 commits into
base: master
Choose a base branch
from

Conversation

amitschendel
Copy link
Contributor

@amitschendel amitschendel commented Jan 25, 2024

User description

Overview


Type

enhancement, tests


Description

  • Implemented and tested network scanner functionality to identify unauthenticated services.
  • Added rego support for network scanner integration.
  • Updated dependencies to support new functionality.
  • Registered new rego function for network scanning in the processor handler.

Changes walkthrough

Relevant files
Tests
networkscanner_test.go
Adding Network Scanner Functionality Test                               

core/pkg/opaprocessor/networkscanner_test.go

  • Added a test for isUnauthenticatedService function.
  • Demonstrates handling of unauthenticated services using a mock Redis
    server.
  • +78/-0   
    Enhancement
    networkscanner.go
    Implement Network Scanner Functionality                                   

    core/pkg/opaprocessor/networkscanner.go

  • Implemented isUnauthenticatedService to check for unauthenticated
    services.
  • Utilizes kubescape-network-scanner for scanning.
  • Handles timeout with a log error.
  • +49/-0   
    utils.go
    Rego Support for Network Scanner                                                 

    core/pkg/opaprocessor/utils.go

  • Added rego function declaration and definition for network scanner.
  • Handles conversion of service, port, and namespace parameters for the
    scanner.
  • +30/-0   
    processorhandler.go
    Register Network Scanner Rego Function                                     

    core/pkg/opaprocessor/processorhandler.go

    • Registered the network scanner rego function.
    +1/-0     
    Dependencies
    go.mod
    Update Dependencies for Network Scanner                                   

    go.mod

  • Updated several package versions including github.com/google/uuid and
    go.opentelemetry.io/otel.
  • Added new dependencies for network scanning and other functionalities.
  • +68/-33 

    PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    Signed-off-by: Amit Schendel <amitschendel@gmail.com>
    Signed-off-by: Amit Schendel <amitschendel@gmail.com>
    Signed-off-by: Amit Schendel <amitschendel@gmail.com>
    Signed-off-by: Amit Schendel <amitschendel@gmail.com>
    Signed-off-by: Amit Schendel <amitschendel@gmail.com>
    Signed-off-by: Amit Schendel <amitschendel@gmail.com>
    Signed-off-by: Amit Schendel <amitschendel@gmail.com>
    Signed-off-by: Amit Schendel <amitschendel@gmail.com>
    Signed-off-by: Amit Schendel <amitschendel@gmail.com>
    Signed-off-by: Amit Schendel <amitschendel@gmail.com>
    Signed-off-by: Amit Schendel <amitschendel@gmail.com>
    Signed-off-by: Amit Schendel <amitschendel@gmail.com>
    Signed-off-by: Amit Schendel <amitschendel@gmail.com>
    Signed-off-by: Amit Schendel <amitschendel@gmail.com>
    Signed-off-by: Amit Schendel <amitschendel@gmail.com>
    Signed-off-by: Amit Schendel <amitschendel@gmail.com>
    Signed-off-by: Amit Schendel <amitschendel@gmail.com>
    Signed-off-by: Amit Schendel <amitschendel@gmail.com>
    @amitschendel amitschendel marked this pull request as ready for review February 1, 2024 08:30
    @matthyx
    Copy link
    Contributor

    matthyx commented Feb 20, 2024

    can you rebase?

    @matthyx
    Copy link
    Contributor

    matthyx commented Feb 20, 2024

    /describe

    Copy link

    PR Description updated to latest commit (39365f5)

    // Check if the service is unauthenticated using kubescape-network-scanner.
    func isUnauthenticatedService(host string, port int, namespace string) bool {
    // Skip kube-system namespace.
    if namespace == "kube-system" {
    Copy link
    Contributor

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    @slashben Do we want to skip on the KS namespace as well?

    Signed-off-by: Amit Schendel <amitschendel@gmail.com>
    Signed-off-by: Amit Schendel <amitschendel@gmail.com>
    Signed-off-by: Amit Schendel <amitschendel@gmail.com>
    Signed-off-by: Amit Schendel <amitschendel@gmail.com>
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    None yet

    3 participants