Allow users to set the listening address

This commit provides an option for the user to set the listening address
for the signal. This also fixes a security vulnerability.

Fixes https://github.com/redhat-chaos/krkn/issues/307
This commit is contained in:
Naga Ravi Chaitanya Elluri
2022-11-08 15:59:57 -05:00
parent 1c207538b6
commit 6b17dbdbb3
3 changed files with 15 additions and 7 deletions
+2 -1
View File
@@ -2,9 +2,10 @@ kraken:
distribution: openshift # Distribution can be kubernetes or openshift
kubeconfig_path: ~/.kube/config # Path to kubeconfig
exit_on_failure: False # Exit when a post action scenario fails
port: 8081
publish_kraken_status: True # Can be accessed at http://0.0.0.0:8081
signal_state: RUN # Will wait for the RUN signal when set to PAUSE before running the scenarios, refer docs/signal.md for more details
signal_address: 0.0.0.0 # Signal listening address
port: 8081 # Signal port
litmus_install: True # Installs specified version, set to False if it's already setup
litmus_version: v1.13.6 # Litmus version to install
litmus_uninstall: False # If you want to uninstall litmus if failure
+2 -1
View File
@@ -2,9 +2,10 @@ kraken:
distribution: openshift # Distribution can be kubernetes or openshift
kubeconfig_path: ~/.kube/config # Path to kubeconfig
exit_on_failure: False # Exit when a post action scenario fails
port: 8081
publish_kraken_status: True # Can be accessed at http://0.0.0.0:8081
signal_state: RUN # Will wait for the RUN signal when set to PAUSE before running the scenarios, refer docs/signal.md for more details
signal_address: 0.0.0.0 # Signal listening address
port: 8081 # Signal port
litmus_version: v1.13.6 # Litmus version to install
litmus_uninstall: False # If you want to uninstall litmus if failure
litmus_uninstall_before_run: True # If you want to uninstall litmus before a new run starts
+11 -5
View File
@@ -48,7 +48,8 @@ def main(cfg):
publish_running_status = config["kraken"].get(
"publish_kraken_status", False
)
port = config["kraken"].get("port", "8081")
port = config["kraken"].get("port")
signal_address = config["kraken"].get("signal_address")
run_signal = config["kraken"].get("signal_state", "RUN")
litmus_install = config["kraken"].get("litmus_install", True)
litmus_version = config["kraken"].get("litmus_version", "v1.9.1")
@@ -109,11 +110,16 @@ def main(cfg):
# Set up kraken url to track signal
if not 0 <= int(port) <= 65535:
logging.info(
"Using port 8081 as %s isn't a valid port number" % (port)
logging.error(
"%s isn't a valid port number, please check" % (port)
)
port = 8081
address = ("0.0.0.0", port)
sys.exit(1)
if not signal_address:
logging.error(
"Please set the signal address in the config"
)
sys.exit(1)
address = (signal_address, port)
# If publish_running_status is False this should keep us going
# in our loop below