-
Notifications
You must be signed in to change notification settings - Fork 7
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
Apps break on hosts where Splunk is configured to listen on IPv6 management port #334
Comments
hey @alexhaydock, thanks for reporting this, we will take a look into it. |
@alexhaydock there are 2 PRs which I implemented which should have support for IPv6: I followed docs from here. The only difference I see so far is that you have |
Thanks for looking into this, @artemrys. Looking a little closer, I think you're right. I've compared the app where I was facing this issue and the version of A diff between the one in the app and the one in this repo shows this off: --- splunkenv.py 2023-11-01 23:47:04.825139976 +0000
+++ splunkenv.py.new 2023-12-13 14:33:23.223684840 +0000
@@ -1,11 +1,11 @@
#
-# Copyright 2021 Splunk Inc.
+# Copyright 2023 Splunk Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
-# http://www.apache.org/licenses/LICENSE-2.0
+# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@@ -24,6 +24,8 @@
from io import StringIO
from typing import List, Optional, Tuple, Union
+from .utils import is_true
+
__all__ = [
"make_splunkhome_path",
"get_splunk_host_info",
@@ -177,15 +179,16 @@
Tuple of (scheme, host, port).
"""
- if get_conf_key_value("server", "sslConfig", "enableSplunkdSSL") == "true":
+ if is_true(get_conf_key_value("server", "sslConfig", "enableSplunkdSSL")):
scheme = "https"
else:
scheme = "http"
host_port = get_conf_key_value("web", "settings", "mgmtHostPort")
host_port = host_port.strip()
- host = host_port.split(":")[0]
- port = int(host_port.split(":")[1])
+ host_port_split_parts = host_port.split(":")
+ host = ":".join(host_port_split_parts[:-1])
+ port = int(host_port_split_parts[-1])
if "SPLUNK_BINDIP" in os.environ:
bindip = os.environ["SPLUNK_BINDIP"] I'll try and contact the app developer and see if they can update the app to backport the fixes from your PRs above, but I'm interested in whether there's any guidance for app developers published by Splunk that makes recommendations about how the app lifecycle should be managed to account for upstream AoB updates which fix bugs and issues such as this one? |
I've tried to patch the app in question by importing the whole
The error:
I notice that you mentioned the IPv6 support before was added based on the docs that reference For IPv6, listening on |
Please check out #227 as well, it should fix
I honestly don't know if something like this exists (especially in regards to AoB). I would recommend trying to update everything to the latest versions, we try not to make breaking changes for the users.
I think it makes sense, I would need to read more documentation about it to have a more productive discussion 😃 |
Ah sorry for not being totally clear. I did actually update the entire I looked at the changes in #227 and I think the problem is that they make the assumption that the only valid IPv6 listening address is going to be Based on the changes in #227, I don't think that the code is set up to work appropriately with |
For apps which invoke the
get_splunkd_access_info()
function fromsplunkenv.py
, errors are thrown when a host is configured to listen using IPv6 on the Splunk MGMT port.This function uses
get_conf_key_value()
to read the value ofmgmtHostPort
fromweb.conf
, and splits it based on the:
delimiter in order to work out the value being used for the MGMT port on the current instance:addonfactory-solutions-library-python/solnlib/splunkenv.py
Lines 187 to 191 in ed4749f
This obviously breaks when encountering IPv6 addresses, which use
:
as a delimiter as part of the address. This also breaks when deploying a Splunk-recommended configuration to listen on IPv6 as well as v4, which looks like this:mgmtHostPort = [::]:8089
This type of construct is interestingly not included in the spec file for
web.conf
but in the spec file forserver.conf
, which states:I'm not quite sure what the best way of fixing this is. It seems like using
:
as a delimiter should still be possible, but the function should take care to ensure that where multiple:
delimiters are present, the rightmost value is taken as the integer used for the port value.An example error from a Splunkbase app breaking because of this bug:
The text was updated successfully, but these errors were encountered: