kubevuln
kubevuln copied to clipboard
[question] can't load config file using `CONFIG` env
Description
As mentioned in the README, we can load config file using the CONFIG
env.
However, we are unable to load config file path using the CONFIG
environment variable.
Kubevuln always defaults to searching the config file in the /etc/config
path, even when we define a new path in the CONFIG
env.
In order to run kubevuln:
- We either add the config file named
clusterData.json
in the path/etc/config
, the default path where kubevuln searches for it. - Or, we explicitly define a new path in the code here, where we want Kubevuln to search for the config file named
clusterData.json
, build kubevuln and then run it
If we follow any of the above 2 steps, then I am able to run it locally
Environment
OS: Ubuntu 20.04.4 LTS
Steps To Reproduce
Method 1:
- Build kubevuln using
make
- Load config file using the CONFIG environment variable
export CONFIG=path/to/clusterData.json
Method 2:
- Build the Docker image from the Dockerfile and run it using:
docker run <kubevuln-built-image-name> -e CONFIG=path/to/clusterData.json
Additional Context
Is this an expected behavior or am I missing something?
- I can build
kubevuln
as a standalone (confirmed by checking the endpoints).
- I used the snippet of
clusterData.json
given in the README, i.e., after replacing theaccountID
andclusterName
. And saving the file in the expected location, i.e./etc/config/clusterData.json
{
"gatewayWebsocketURL": "127.0.0.1:8001",
"gatewayRestURL": "127.0.0.1:8002",
"kubevulnURL": "127.0.0.1:8080",
"kubescapeURL": "127.0.0.1:8080",
"eventReceiverRestURL": "https://report.armo.cloud",
"eventReceiverWebsocketURL": "wss://report.armo.cloud",
"rootGatewayURL": "wss://ens.euprod1.cyberarmorsoft.com/v1/waitfornotification",
"accountID": "*********************",
"clusterName": "******"
}
- I also tried using another format of the
clusterData.json
through the command given below:
kubectl config view -o json
- Although, I am unable to build the Docker image from the
Dockerfile
.
Thank you for raising this issue. You can either manually edit the path here or contribute a fix :)
@dwertent For a fix, what path should it be looking for?
@anubhav06 @dwertent Please review my PR. Please suggest any improvements. Thank You.
@anubhav06 why do you want to relocate the config, is it specific to your cluster? Maybe we can just drop the documentation instead...
@matthyx The problem was that LoadConfig
was unable to load config file path set by the CONFIG environment variable.
However, as david mentioned, we are able to run it by manually editing the path and then running it.
You can either manually edit the path here
So I believe if we just remove/update the documentation, that works.