summaryrefslogtreecommitdiffstats
path: root/ipaclient/install/client.py
diff options
context:
space:
mode:
authorMartin Basti <mbasti@redhat.com>2016-10-31 10:27:24 +0100
committerJan Cholasta <jcholast@redhat.com>2016-11-11 12:13:56 +0100
commit83fe6b626fd2fb7f43ddf3568aaffca1ce569079 (patch)
tree6b8b854fe63cd81d89f5a2a92a3e6b266f08732b /ipaclient/install/client.py
parentfcea3b3fb88ede0e9414f83ac2372e000e728587 (diff)
downloadfreeipa-83fe6b626fd2fb7f43ddf3568aaffca1ce569079.tar.gz
freeipa-83fe6b626fd2fb7f43ddf3568aaffca1ce569079.tar.xz
freeipa-83fe6b626fd2fb7f43ddf3568aaffca1ce569079.zip
client: move custom env variable into client module
There is no need to have env as parameter because this is used only once, so it can eb safely moved to client.py module NOTE: PATH should be overwritten to safe values before we execute any command https://www.securecoding.cert.org/confluence/display/c/ENV03-C.+Sanitize+the+environment+when+invoking+external+programs https://fedorahosted.org/freeipa/ticket/6392 Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
Diffstat (limited to 'ipaclient/install/client.py')
-rw-r--r--ipaclient/install/client.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/ipaclient/install/client.py b/ipaclient/install/client.py
index 878bb04b0..95d8fcea9 100644
--- a/ipaclient/install/client.py
+++ b/ipaclient/install/client.py
@@ -78,6 +78,10 @@ CLIENT_NOT_CONFIGURED = 2
CLIENT_ALREADY_CONFIGURED = 3
CLIENT_UNINSTALL_ERROR = 4 # error after restoring files/state
+SECURE_PATH = (
+ "/bin:/sbin:/usr/kerberos/bin:/usr/kerberos/sbin:/usr/bin:/usr/sbin"
+)
+
# global variables
hostname = None
hostname_source = None
@@ -2280,7 +2284,9 @@ def install_check(options):
return SUCCESS
-def install(options, env):
+def install(options):
+ env = {'PATH': SECURE_PATH}
+
fstore = sysrestore.FileStore(paths.IPA_CLIENT_SYSRESTORE)
statestore = sysrestore.StateFile(paths.IPA_CLIENT_SYSRESTORE)
@@ -2884,7 +2890,9 @@ def uninstall_check(options):
return SUCCESS
-def uninstall(options, env):
+def uninstall(options):
+ env = {'PATH': SECURE_PATH}
+
fstore = sysrestore.FileStore(paths.IPA_CLIENT_SYSRESTORE)
statestore = sysrestore.StateFile(paths.IPA_CLIENT_SYSRESTORE)