pgreco / rpms / ipa

Forked from forks/areguera/rpms/ipa 4 years ago
Clone

Blame SOURCES/0228-Make-sure-upgrade-also-checks-for-IPv6-stack.patch

460745
From 010f6405288b1ca519d684d85ca25ce86de60b66 Mon Sep 17 00:00:00 2001
460745
From: Alexander Bokovoy <abokovoy@redhat.com>
460745
Date: Tue, 19 Sep 2017 12:06:39 +0300
460745
Subject: [PATCH] Make sure upgrade also checks for IPv6 stack
460745
460745
 - Add check for IPv6 stack to upgrade process
460745
 - Change IPv6 checker to also check that localhost resolves to ::1
460745
460745
Part of fixes https://pagure.io/freeipa/issue/7083
460745
460745
Reviewed-By: Tomas Krizek <tkrizek@redhat.com>
460745
---
460745
 ipaplatform/redhat/tasks.py         | 19 ++++++++++++++++---
460745
 ipaserver/install/server/upgrade.py |  1 +
460745
 2 files changed, 17 insertions(+), 3 deletions(-)
460745
460745
diff --git a/ipaplatform/redhat/tasks.py b/ipaplatform/redhat/tasks.py
460745
index 07efebab97eabcf2dc39bd345920a1c7be56e9f5..94d1863c5cc20ec6c2399f339ce19498976553bc 100644
460745
--- a/ipaplatform/redhat/tasks.py
460745
+++ b/ipaplatform/redhat/tasks.py
460745
@@ -153,9 +153,22 @@ class RedHatTaskNamespace(BaseTaskNamespace):
460745
         """
460745
         if not os.path.exists(paths.IF_INET6):
460745
             raise RuntimeError(
460745
-                "IPv6 kernel module has to be enabled. If you do not wish to "
460745
-                "use IPv6, please disable it on the interfaces in "
460745
-                "sysctl.conf and enable the IPv6 kernel module.")
460745
+                "IPv6 stack has to be enabled in the kernel and some "
460745
+                "interface has to have ::1 address assigned. Typically "
460745
+                "this is 'lo' interface. If you do not wish to use IPv6 "
460745
+                "globally, disable it on the specific interfaces in "
460745
+                "sysctl.conf except 'lo' interface.")
460745
+
460745
+        try:
460745
+            localhost6 = ipautil.CheckedIPAddress('::1', allow_loopback=True)
460745
+            if localhost6.get_matching_interface() is None:
460745
+                raise ValueError("no interface for ::1 address found")
460745
+        except ValueError:
460745
+            raise RuntimeError(
460745
+                 "IPv6 stack is enabled in the kernel but there is no "
460745
+                 "interface that has ::1 address assigned. Add ::1 address "
460745
+                 "resolution to 'lo' interface. You might need to enable IPv6 "
460745
+                 "on the interface 'lo' in sysctl.conf.")
460745
 
460745
     def restore_pre_ipa_client_configuration(self, fstore, statestore,
460745
                                              was_sssd_installed,
460745
diff --git a/ipaserver/install/server/upgrade.py b/ipaserver/install/server/upgrade.py
460745
index 0947766c076251e7608241803d3a1eabee65ae11..1c4b2357d5d016b8a7501f46380d5e0a61dc21a0 100644
460745
--- a/ipaserver/install/server/upgrade.py
460745
+++ b/ipaserver/install/server/upgrade.py
460745
@@ -1860,6 +1860,7 @@ def upgrade_configuration():
460745
 def upgrade_check(options):
460745
     try:
460745
         installutils.check_server_configuration()
460745
+        tasks.check_ipv6_stack_enabled()
460745
     except RuntimeError as e:
460745
         root_logger.error(e)
460745
         sys.exit(1)
460745
-- 
460745
2.13.5
460745