mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Verify that effective uid == remote_user when transport is local
Raise exception if effective uid of process is not the same as remote_user.
This commit is contained in:
parent
5d74fedeb9
commit
b5061bb62e
1 changed files with 4 additions and 0 deletions
|
@ -22,6 +22,7 @@ import fnmatch
|
|||
import multiprocessing
|
||||
import signal
|
||||
import os
|
||||
import pwd
|
||||
import Queue
|
||||
import random
|
||||
import traceback
|
||||
|
@ -115,6 +116,9 @@ class Runner(object):
|
|||
self.basedir = basedir
|
||||
self.sudo = sudo
|
||||
|
||||
euid = pwd.getpwuid(os.geteuid())[0]
|
||||
if self.transport == 'local' and self.remote_user != euid:
|
||||
raise Exception("User mismatch: expected %s, but is %s" % (self.remote_user, euid))
|
||||
if type(self.module_args) != str:
|
||||
raise Exception("module_args must be a string: %s" % self.module_args)
|
||||
|
||||
|
|
Loading…
Reference in a new issue