python: Harden tools against "rogue" modules
PATCH 1/1 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!
--- python/audit2allow/audit2allow | 2 +- python/audit2allow/sepolgen-ifgen | 2 +- python/chcat/chcat | 2 +- python/semanage/semanage | 2 +- python/sepolicy/sepolicy.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-)
python/audit2allow/audit2allow +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/python3 -Es +#!/usr/bin/python3 -EsI # Authors: Karl MacMillan <[email protected]> # Authors: Dan Walsh <[email protected]> #
python/audit2allow/sepolgen-ifgen +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/python3 -Es +#!/usr/bin/python3 -EsI # # Authors: Karl MacMillan <[email protected]> #
python/chcat/chcat +1 -1
@@ -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 #
python/semanage/semanage +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/python3 -Es +#!/usr/bin/python3 -EsI # Copyright (C) 2012-2013 Red Hat # AUTHOR: Miroslav Grepl <[email protected]> # AUTHOR: David Quigley <[email protected]>
python/sepolicy/sepolicy.py +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/python3 -Es +#!/usr/bin/python3 -EsI # Copyright (C) 2012 Red Hat # AUTHOR: Dan Walsh <[email protected]> # see file 'COPYING' for use and warranty information
Signature · 1 line
2.37.3
Quoted 13 lines · Vit Mojzis
Python scripts present in "
/usr/sbin" override regular modules. Make sure/usr/sbinis 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!
Quoted 1 line
Signed-off-by Vit Mojzis <[email protected]>
Quoted 61 lines
--- python/audit2allow/audit2allow | 2 +- python/audit2allow/sepolgen-ifgen | 2 +- python/chcat/chcat | 2 +- python/semanage/semanage | 2 +- python/sepolicy/sepolicy.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-)python/audit2allow/audit2allow +1
-1@@ -1,4 +1,4 @@ -#!/usr/bin/python3 -Es +#!/usr/bin/python3 -EsI # Authors: Karl MacMillan <[email protected]> # Authors: Dan Walsh <[email protected]> #python/audit2allow/sepolgen-ifgen +1
-1@@ -1,4 +1,4 @@ -#!/usr/bin/python3 -Es +#!/usr/bin/python3 -EsI # # Authors: Karl MacMillan <[email protected]> #python/chcat/chcat +1
-1@@ -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 #python/semanage/semanage +1
-1@@ -1,4 +1,4 @@ -#!/usr/bin/python3 -Es +#!/usr/bin/python3 -EsI # Copyright (C) 2012-2013 Red Hat # AUTHOR: Miroslav Grepl <[email protected]> # AUTHOR: David Quigley <[email protected]>python/sepolicy/sepolicy.py +1
-2@@ -1,4 +1,4 @@ -#!/usr/bin/python3 -Es +#!/usr/bin/python3 -EsI # Copyright (C) 2012 Red Hat # AUTHOR: Dan Walsh <[email protected]> # see file 'COPYING' for use and warranty information --2.37.3
Quoted 15 lines · James Carter
Quoted 13 lines · Vit Mojzis
Python scripts present in "
/usr/sbin" override regular modules. Make sure/usr/sbinis 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!
Quoted 4 lines
Quoted 1 line
Signed-off-by Vit Mojzis <[email protected]>Acked-by James Carter <[email protected]>
Merged.
Thanks,
Jim
Quoted 61 lines
Quoted 61 lines
--- python/audit2allow/audit2allow | 2 +- python/audit2allow/sepolgen-ifgen | 2 +- python/chcat/chcat | 2 +- python/semanage/semanage | 2 +- python/sepolicy/sepolicy.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-)python/audit2allow/audit2allow +1
-1@@ -1,4 +1,4 @@ -#!/usr/bin/python3 -Es +#!/usr/bin/python3 -EsI # Authors: Karl MacMillan <[email protected]> # Authors: Dan Walsh <[email protected]> #python/audit2allow/sepolgen-ifgen +1
-1@@ -1,4 +1,4 @@ -#!/usr/bin/python3 -Es +#!/usr/bin/python3 -EsI # # Authors: Karl MacMillan <[email protected]> #python/chcat/chcat +1
-1@@ -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 #python/semanage/semanage +1
-1@@ -1,4 +1,4 @@ -#!/usr/bin/python3 -Es +#!/usr/bin/python3 -EsI # Copyright (C) 2012-2013 Red Hat # AUTHOR: Miroslav Grepl <[email protected]> # AUTHOR: David Quigley <[email protected]>python/sepolicy/sepolicy.py +1
-2@@ -1,4 +1,4 @@ -#!/usr/bin/python3 -Es +#!/usr/bin/python3 -EsI # Copyright (C) 2012 Red Hat # AUTHOR: Dan Walsh <[email protected]> # see file 'COPYING' for use and warranty information --2.37.3