pgreco / rpms / ipa

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

Blame SOURCES/0007-Replace-hard-coded-interpreter-with-sys.executable.patch

b01884
From 64045c5dbaf24340dea5cf0bdb629c29f70a4a9d Mon Sep 17 00:00:00 2001
b01884
From: Christian Heimes <cheimes@redhat.com>
b01884
Date: Wed, 24 Oct 2018 16:08:16 +0200
b01884
Subject: [PATCH] Replace hard-coded interpreter with sys.executable
b01884
b01884
Instead of hard-coding python3, the smart card advise script now uses
b01884
the current executable path from sys.executable as interpreter.
b01884
b01884
Fixes: https://pagure.io/freeipa/issue/7741
b01884
Signed-off-by: Christian Heimes <cheimes@redhat.com>
b01884
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
b01884
b01884
diff --git a/ipaserver/advise/plugins/smart_card_auth.py b/ipaserver/advise/plugins/smart_card_auth.py
b01884
index 2f2e7aec9..97e23303b 100644
b01884
--- a/ipaserver/advise/plugins/smart_card_auth.py
b01884
+++ b/ipaserver/advise/plugins/smart_card_auth.py
b01884
@@ -4,6 +4,8 @@
b01884
 
b01884
 from __future__ import absolute_import
b01884
 
b01884
+import sys
b01884
+
b01884
 from ipalib.plugable import Registry
b01884
 from ipaplatform import services
b01884
 from ipaplatform.paths import paths
b01884
@@ -186,9 +188,9 @@ class config_server_for_smart_card_auth(common_smart_card_auth_config):
b01884
     def record_httpd_ocsp_status(self):
b01884
         self.log.comment('store the OCSP upgrade state')
b01884
         self.log.command(
b01884
-            "python3 -c 'from ipaserver.install import sysupgrade; "
b01884
+            "{} -c 'from ipaserver.install import sysupgrade; "
b01884
             "sysupgrade.set_upgrade_state(\"httpd\", "
b01884
-            "\"{}\", True)'".format(OCSP_ENABLED))
b01884
+            "\"{}\", True)'".format(sys.executable, OCSP_ENABLED))
b01884
 
b01884
     def check_and_enable_pkinit(self):
b01884
         self.log.comment('check whether PKINIT is configured on the master')
b01884
@@ -310,10 +312,10 @@ class config_client_for_smart_card_auth(common_smart_card_auth_config):
b01884
     def configure_pam_cert_auth(self):
b01884
         self.log.comment('Set pam_cert_auth=True in /etc/sssd/sssd.conf')
b01884
         self.log.command(
b01884
-            "python3 -c 'from SSSDConfig import SSSDConfig; "
b01884
+            "{} -c 'from SSSDConfig import SSSDConfig; "
b01884
             "c = SSSDConfig(); c.import_config(); "
b01884
             "c.set(\"pam\", \"pam_cert_auth\", \"True\"); "
b01884
-            "c.write()'")
b01884
+            "c.write()'".format(sys.executable))
b01884
 
b01884
     def restart_sssd(self):
b01884
         self.log.command('systemctl restart sssd.service')