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

SSH Access to Kuberenetes clusters for K8S Scans via UI. #6394

Open
metahertz opened this issue Jan 8, 2025 · 3 comments
Open

SSH Access to Kuberenetes clusters for K8S Scans via UI. #6394

metahertz opened this issue Jan 8, 2025 · 3 comments
Labels
component/ui feature feature-request New feature request for Prowler.

Comments

@metahertz
Copy link
Contributor

New feature motivation

It is best practice to not expose Kubernetes API endpoints directly to the internet.

Solution Proposed

A common access method for remote teams is to access via a SSH bastion using Public/Private keys.
The following example is from a recent CNCF hackathon run by ControlPlane, where teams were given access to the Kubernetes infra with the following SSH config:

Host bastion xx.xx.20.99
    Hostname xx.xx.20.99
    User player
    RequestTTY force
    ForwardAgent yes
    IdentityFile simulator_rsa
    UserKnownHostsFile simulator_known_hosts

In this example, all KubeCtl commands were run from the bastion terminal, but we could easily instead configure a port forward through the SSH tunnel allowing the prowler scanner to access the tunelled cluster through a modified kubeconfig.

Host bastion xx.xx.20.99
    Hostname xx.xx.20.99
    User bastion
    LocalForward 30001 customers.kubernetes.cluster:6443
    IdentityFile simulator_rsa
    UserKnownHostsFile simulator_known_hosts

With a Kubeconfig on the prowler side as follows:

apiVersion: v1
kind: Config
clusters:
- cluster:
    certificate-authority-data: <redacted>
    #OLD server: https://customers.kubernetes.cluster:6443
    server: https://127.0.0.1:30001

Describe alternatives you've considered

  1. We could also offer an API endpoint with our infrastructure IP ranges, allowing users to programatically lock down their Kubernetes API endpoints to just those IP's used by the prowler SaaS infrastructure, similar to AWS's IP range JSON here: https://ip-ranges.amazonaws.com/ip-ranges.json
  2. We could also offer popular software-defined-vpn endpoints to allow prowler SaaS to take part as an endpoint in the customers VPN, for example, a tailscale connector which would then allow the customer to give 'Prowlers' endpoint on their VPN access to their Kubernetes API.

Additional context

No response

@metahertz metahertz added feature-request New feature request for Prowler. feature status/needs-triage Issue pending triage component/ui labels Jan 8, 2025
@jfagoagas jfagoagas removed the status/needs-triage Issue pending triage label Jan 8, 2025
@jfagoagas
Copy link
Member

I think both ideas are great and covers different use cases regarding how the Kubernetes cluster is configured in terms of access:

  1. Always works since only requires giving access to several CIDRs, also having a endpoint to get it would be great to import and have it always updated.
  2. That'd require work for each VPN vendor but as a Tailscale supporter I'd love to have it!

@plejik
Copy link
Contributor

plejik commented Jan 13, 2025

I now service ( paralus ) where it generate config for k8s and then you deploy it on your k8s cluster , could it be an option as well ( k8s goes itself to prowler secure endpoint or some rabbit/sns/kafka and get command same way).
P.S ussually k8s has access to internel itself, and it could be easy way to firewall prowler endpoint that multiply k8s clusters

@NissesSenap
Copy link

What @plejik wrote. I, much rather have a cronjob running within the cluster.

If you want to support trigger a scan from the UI in the SaaS i guess you could also supply a deployment that runs within the cluster with an ingress that you can talk to from the SaaS solution.
But personally, I would just trigger the cronjob manually instead of having an extra ingress I have to care about.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/ui feature feature-request New feature request for Prowler.
Projects
None yet
Development

No branches or pull requests

4 participants