m9sweeper / m9sweeper

m9sweeper is a free and easy kubernetes security platform.

Home Page:https://m9sweeper.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

kube hunter unable to dispatch report to m9sweeper

sumagoudb opened this issue · comments

Below is the error, I tried service and also direct fqdn, both resulted in same error.

2023-10-13 19:37:35,498 ERROR kube_hunter.modules.report.dispatchers Could not dispatch report to m9sweeper-dash:3000/api/kubehunter/hunter/1/?key=xxxx
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/kube_hunter/modules/report/dispatchers.py", line 14, in dispatch
    r = requests.request(
  File "/usr/local/lib/python3.8/site-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 529, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 639, in send
    adapter = self.get_adapter(url=request.url)
  File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 732, in get_adapter
    raise InvalidSchema("No connection adapters were found for {!r}".format(url))
requests.exceptions.InvalidSchema: No connection adapters were found for 'm9sweeper-dash:3000/api/kubehunter/hunter/1/?key=xxxx'

Installed kube hunter with helm as shown below. m9sweeper and kube hunter are in same namespace.

helm repo add m9sweeper https://m9sweeper.github.io/m9sweeper && \
helm repo update && \
helm upgrade --install kube-hunter m9sweeper/kube-hunter \
  -n m9sweeper--create-namespace \
  --set-string dispatchUrl='m9sweeper-dash:3000/api/kubehunter/hunter/1/?key=xxxx' \
  --set-string cronjob.schedule="0 0 * * *" \
  --set cronjob.enabled=true

Ok, I see the problem is URL should start with a protocol, http:// ot https:// , otherwise it will result in error. can you correct the documentation and installation instructions?

Can you refer to where you're seeing the documentation that is incorrect, precisely?

after logging into the dash UI and clicking the install button in the kube hunter page.

I think we have that fixed but not released. We're finalizing testing and then will release that fix.

Can you also confirm what you have set as the base url when you installed m9sweeper?

here is what I used to make it work

http://m9sweeper-dash:3000/api/kubehunter/hunter/1/?key=${KUBE_HUNTER_API_KEY}

The code actually uses an environment variable to determine the path it will use when templating out the helm install command for you. It just appends /api/kubehunter/hunter/{clusterid}/?kube=${KUBE_HUNTER_API_KEY} to the end of the baseUrl.

You set this environment variable when you deploy your application in your helm values. You can see it defaults to http://m9sweeper-dash.m9sweeper-system.svc:3000

https://github.com/m9sweeper/m9sweeper/blob/main/manifests/charts/m9sweeper/values.yaml#L32

If you set it to something that doesn't include http:// then the template won't include http:// in front of it.

Got it