Blob Blame History Raw
From 2fda26c1ec30da3b5fb8bdc4bbe6720d7870b2ec Mon Sep 17 00:00:00 2001
From: Radek Vykydal <rvykydal@redhat.com>
Date: Tue, 9 Mar 2021 17:51:00 +0100
Subject: [PATCH] Do not follow symlinks when copying /etc/resolv.conf
 (#1933454)

---
 pyanaconda/modules/network/installation.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pyanaconda/modules/network/installation.py b/pyanaconda/modules/network/installation.py
index ed61ae961b..0d87101b93 100644
--- a/pyanaconda/modules/network/installation.py
+++ b/pyanaconda/modules/network/installation.py
@@ -225,9 +225,9 @@ def _copy_resolv_conf(self, root, overwrite):
         :param overwrite: overwrite existing configuration file
         :type overwrite: bool
         """
-        self._copy_file_to_root(root, self.RESOLV_CONF_FILE_PATH)
+        self._copy_file_to_root(root, self.RESOLV_CONF_FILE_PATH, follow_symlinks=False)
 
-    def _copy_file_to_root(self, root, config_file, overwrite=False):
+    def _copy_file_to_root(self, root, config_file, overwrite=False, follow_symlinks=True):
         """Copy the file to target system.
 
         :param root: path to the root of the target system
@@ -244,7 +244,7 @@ def _copy_file_to_root(self, root, config_file, overwrite=False):
             return
         if not os.path.isdir(os.path.dirname(fpath)):
             util.mkdirChain(os.path.dirname(fpath))
-        shutil.copy(config_file, fpath)
+        shutil.copy(config_file, fpath, follow_symlinks=follow_symlinks)
 
     def _copy_device_config_files(self, root):
         """Copy network device config files to target system.