python: Harden tools against "rogue" modules

Python scripts present in "/usr/sbin" override regular modules.
Make sure /usr/sbin is not present in PYTHONPATH.

Fixes:
  #cat > /usr/sbin/audit.py <<EOF
  import sys
  print("BAD GUY!", file=sys.stderr)
  sys.exit(1)
  EOF
  #semanage boolean -l
  BAD GUY!

Signed-off-by: Vit Mojzis <vmojzis@redhat.com>
Acked-by: James Carter <jwcart2@gmail.com>
This commit is contained in:
Vit Mojzis 2022-10-18 22:36:59 +02:00 committed by James Carter
parent 950cc5b54a
commit 48602370ac
5 changed files with 5 additions and 5 deletions

View File

@ -1,4 +1,4 @@
#!/usr/bin/python3 -Es
#!/usr/bin/python3 -EsI
# Authors: Karl MacMillan <kmacmillan@mentalrootkit.com>
# Authors: Dan Walsh <dwalsh@redhat.com>
#

View File

@ -1,4 +1,4 @@
#!/usr/bin/python3 -Es
#!/usr/bin/python3 -EsI
#
# Authors: Karl MacMillan <kmacmillan@mentalrootkit.com>
#

View File

@ -1,4 +1,4 @@
#!/usr/bin/python3 -Es
#!/usr/bin/python3 -EsI
# Copyright (C) 2005 Red Hat
# see file 'COPYING' for use and warranty information
#

View File

@ -1,4 +1,4 @@
#!/usr/bin/python3 -Es
#!/usr/bin/python3 -EsI
# Copyright (C) 2012-2013 Red Hat
# AUTHOR: Miroslav Grepl <mgrepl@redhat.com>
# AUTHOR: David Quigley <selinux@davequigley.com>

View File

@ -1,4 +1,4 @@
#!/usr/bin/python3 -Es
#!/usr/bin/python3 -EsI
# Copyright (C) 2012 Red Hat
# AUTHOR: Dan Walsh <dwalsh@redhat.com>
# see file 'COPYING' for use and warranty information