Blame SOURCES/0049-python-Harden-tools-against-rogue-modules.patch

83e441
From 72c7e9123980b003a21d51e2805529a3e90b2460 Mon Sep 17 00:00:00 2001
83e441
From: Vit Mojzis <vmojzis@redhat.com>
83e441
Date: Thu, 13 Oct 2022 17:33:18 +0200
83e441
Subject: [PATCH] python: Harden tools against "rogue" modules
83e441
83e441
Python scripts present in "/usr/sbin" override regular modules.
83e441
Make sure /usr/sbin is not present in PYTHONPATH.
83e441
83e441
Fixes:
83e441
  #cat > /usr/sbin/audit.py <
83e441
  import sys
83e441
  print("BAD GUY!", file=sys.stderr)
83e441
  sys.exit(1)
83e441
  EOF
83e441
  #semanage boolean -l
83e441
  BAD GUY!
83e441
83e441
Signed-off-by: Vit Mojzis <vmojzis@redhat.com>
83e441
---
83e441
 python/audit2allow/audit2allow    | 2 +-
83e441
 python/audit2allow/sepolgen-ifgen | 2 +-
83e441
 python/chcat/chcat                | 2 +-
83e441
 python/semanage/semanage          | 2 +-
83e441
 python/sepolicy/sepolicy.py       | 2 +-
83e441
 5 files changed, 5 insertions(+), 5 deletions(-)
83e441
83e441
diff --git a/python/audit2allow/audit2allow b/python/audit2allow/audit2allow
83e441
index 09b06f66..eafeea88 100644
83e441
--- a/python/audit2allow/audit2allow
83e441
+++ b/python/audit2allow/audit2allow
83e441
@@ -1,4 +1,4 @@
83e441
-#!/usr/bin/python3 -Es
83e441
+#!/usr/bin/python3 -EsI
83e441
 # Authors: Karl MacMillan <kmacmillan@mentalrootkit.com>
83e441
 # Authors: Dan Walsh <dwalsh@redhat.com>
83e441
 #
83e441
diff --git a/python/audit2allow/sepolgen-ifgen b/python/audit2allow/sepolgen-ifgen
83e441
index be2d093b..f25f8af1 100644
83e441
--- a/python/audit2allow/sepolgen-ifgen
83e441
+++ b/python/audit2allow/sepolgen-ifgen
83e441
@@ -1,4 +1,4 @@
83e441
-#!/usr/bin/python3 -Es
83e441
+#!/usr/bin/python3 -EsI
83e441
 #
83e441
 # Authors: Karl MacMillan <kmacmillan@mentalrootkit.com>
83e441
 #
83e441
diff --git a/python/chcat/chcat b/python/chcat/chcat
83e441
index df2509f2..5671cec6 100755
83e441
--- a/python/chcat/chcat
83e441
+++ b/python/chcat/chcat
83e441
@@ -1,4 +1,4 @@
83e441
-#!/usr/bin/python3 -Es
83e441
+#!/usr/bin/python3 -EsI
83e441
 # Copyright (C) 2005 Red Hat
83e441
 # see file 'COPYING' for use and warranty information
83e441
 #
83e441
diff --git a/python/semanage/semanage b/python/semanage/semanage
83e441
index b8842d28..1f170f60 100644
83e441
--- a/python/semanage/semanage
83e441
+++ b/python/semanage/semanage
83e441
@@ -1,4 +1,4 @@
83e441
-#!/usr/bin/python3 -Es
83e441
+#!/usr/bin/python3 -EsI
83e441
 # Copyright (C) 2012-2013 Red Hat
83e441
 # AUTHOR: Miroslav Grepl <mgrepl@redhat.com>
83e441
 # AUTHOR: David Quigley <selinux@davequigley.com>
83e441
diff --git a/python/sepolicy/sepolicy.py b/python/sepolicy/sepolicy.py
83e441
index 8bd6a579..0c1d9641 100755
83e441
--- a/python/sepolicy/sepolicy.py
83e441
+++ b/python/sepolicy/sepolicy.py
83e441
@@ -1,4 +1,4 @@
83e441
-#!/usr/bin/python3 -Es
83e441
+#!/usr/bin/python3 -EsI
83e441
 # Copyright (C) 2012 Red Hat
83e441
 # AUTHOR: Dan Walsh <dwalsh@redhat.com>
83e441
 # see file 'COPYING' for use and warranty information
83e441
-- 
83e441
2.37.3
83e441