File localhost_for_authentication.patch of Package cobbler
diff --git a/changelog.d/3631.added b/changelog.d/3631.added
new file mode 100644
index 00000000..55a26a74
--- /dev/null
+++ b/changelog.d/3631.added
@@ -0,0 +1 @@
+Add new setting for spacewalk authentication endpoint
diff --git a/cobbler/modules/authentication/spacewalk.py b/cobbler/modules/authentication/spacewalk.py
index 5ee3fb1a..76fb3eb4 100644
--- a/cobbler/modules/authentication/spacewalk.py
+++ b/cobbler/modules/authentication/spacewalk.py
@@ -95,9 +95,12 @@ def authenticate(api_handle, username: str, password: str) -> bool:
if api_handle is None:
raise CX("api_handle required. Please don't call this without it.")
server = api_handle.settings().redhat_management_server
+ if api_handle.settings().spacewalk_authentication_endpoint:
+ server = api_handle.settings().spacewalk_authentication_endpoint
+
user_enabled = api_handle.settings().redhat_management_permissive
- spacewalk_url = "https://%s/rpc/api" % server
+ spacewalk_url = "%s/rpc/api" % server
with ServerProxy(spacewalk_url, verbose=True) as client:
if username == 'taskomatic_user' or __looks_like_a_token(password):
# The tokens are lowercase hex, but a password can also be lowercase hex, so we have to try it as both a
diff --git a/cobbler/settings/__init__.py b/cobbler/settings/__init__.py
index 5aecd147..f4247bba 100644
--- a/cobbler/settings/__init__.py
+++ b/cobbler/settings/__init__.py
@@ -149,6 +149,7 @@ class Settings:
self.redhat_management_permissive = False
self.redhat_management_server = "xmlrpc.rhn.redhat.com"
self.redhat_management_key = ""
+ self.spacewalk_authentication_endpoint = ""
self.register_new_installs = False
self.remove_old_puppet_certs_automatically = False
self.replicate_repo_rsync_options = "-avzH"
diff --git a/cobbler/settings/migrations/V3_3_3.py b/cobbler/settings/migrations/V3_3_3.py
index 545fbfcd..3466cc6d 100644
--- a/cobbler/settings/migrations/V3_3_3.py
+++ b/cobbler/settings/migrations/V3_3_3.py
@@ -197,6 +197,7 @@ schema = Schema(
"redhat_management_permissive": bool,
"redhat_management_server": str,
"redhat_management_key": str,
+ Optional("spacewalk_authentication_endpoint"): str,
"register_new_installs": bool,
"remove_old_puppet_certs_automatically": bool,
"replicate_repo_rsync_options": str,
diff --git a/config/cobbler/settings.yaml b/config/cobbler/settings.yaml
index 7eb6b1a4..ba664933 100644
--- a/config/cobbler/settings.yaml
+++ b/config/cobbler/settings.yaml
@@ -390,6 +390,11 @@ nopxe_with_triggers: true
# authentication within Cobbler Web and Cobbler XMLRPC.
redhat_management_server: "xmlrpc.rhn.redhat.com"
+# This setting is only used by the code that supports using Spacewalk/Satellite
+# authentication within Cobbler Web and Cobbler XMLRPC. This is the endpoint for
+# Spacewalk/Satellite authentication: if empty redhat_management_server will be used.
+spacewalk_authentication_endpoint: ""
+
# if using authn_spacewalk in modules.conf to let Cobbler authenticate
# against Satellite/Spacewalk's auth system, by default it will not allow per user
# access into Cobbler Web and Cobbler XMLRPC.
diff --git a/tests/items/item_test.py b/tests/items/item_test.py
index 6c4e9df9..f7d2a545 100644
--- a/tests/items/item_test.py
+++ b/tests/items/item_test.py
@@ -471,7 +471,7 @@ def test_dump_vars(cobbler_api):
# Assert
assert "default_ownership" in result
assert "owners" in result
- assert len(result) == 152
+ assert len(result) == 153
@pytest.mark.parametrize(