mirror of
https://github.com/clearml/dropbear
synced 2025-01-31 02:46:58 +00:00
Use venv for test_aslr
Otherwise we can't find the psutil dependency
This commit is contained in:
parent
da7f77a50d
commit
2a6dac19b5
@ -1,12 +1,14 @@
|
|||||||
srcdir=@srcdir@
|
srcdir=@srcdir@
|
||||||
|
|
||||||
|
SHELL=bash
|
||||||
|
|
||||||
all: test
|
all: test
|
||||||
|
|
||||||
test: venv/bin/pytest fakekey
|
test: venv/bin/pytest fakekey
|
||||||
./venv/bin/pytest --hostkey=fakekey --dbclient=../dbclient --dropbear=../dropbear $(srcdir)
|
(source ./venv/bin/activate; pytest --hostkey=fakekey --dbclient=../dbclient --dropbear=../dropbear $(srcdir) )
|
||||||
|
|
||||||
one: venv/bin/pytest fakekey
|
one: venv/bin/pytest fakekey
|
||||||
./venv/bin/pytest --hostkey=fakekey --dbclient=../dbclient --dropbear=../dropbear $(srcdir) -k exit
|
(source ./venv/bin/activate; pytest --hostkey=fakekey --dbclient=../dbclient --dropbear=../dropbear $(srcdir) -k exit)
|
||||||
|
|
||||||
fakekey:
|
fakekey:
|
||||||
../dropbearkey -t ecdsa -f $@
|
../dropbearkey -t ecdsa -f $@
|
||||||
|
@ -8,7 +8,11 @@ def test_reexec(request, dropbear):
|
|||||||
Tests that two consecutive connections have different address layouts.
|
Tests that two consecutive connections have different address layouts.
|
||||||
This indicates that re-exec makes ASLR work
|
This indicates that re-exec makes ASLR work
|
||||||
"""
|
"""
|
||||||
cmd = (Path(request.node.fspath).parent / "parent_dropbear_map.py").resolve()
|
map_script = (Path(request.node.fspath).parent / "parent_dropbear_map.py").resolve()
|
||||||
|
# run within the same venv, for python deps
|
||||||
|
activate = own_venv_command()
|
||||||
|
cmd = f"{activate}; {map_script}"
|
||||||
|
print(cmd)
|
||||||
r = dbclient(request, cmd, capture_output=True, text=True)
|
r = dbclient(request, cmd, capture_output=True, text=True)
|
||||||
map1 = r.stdout.rstrip()
|
map1 = r.stdout.rstrip()
|
||||||
print(r.stderr, file=sys.stderr)
|
print(r.stderr, file=sys.stderr)
|
||||||
|
@ -57,6 +57,20 @@ def dbclient(request, *args, **kwargs):
|
|||||||
# wait for response
|
# wait for response
|
||||||
return subprocess.run(full_args, **kwargs)
|
return subprocess.run(full_args, **kwargs)
|
||||||
|
|
||||||
|
def own_venv_command():
|
||||||
|
""" Returns a command to run as a prefix to get the same venv
|
||||||
|
as the current running Python. Returns '' on not a virtualenv
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
print(os.environ)
|
||||||
|
venv = os.environ['VIRTUAL_ENV']
|
||||||
|
print(venv)
|
||||||
|
except KeyError:
|
||||||
|
return ""
|
||||||
|
|
||||||
|
# note: bash/zsh unix specific
|
||||||
|
return f"source {venv}/bin/activate"
|
||||||
|
|
||||||
class HandleTcp(socketserver.ThreadingMixIn, socketserver.TCPServer):
|
class HandleTcp(socketserver.ThreadingMixIn, socketserver.TCPServer):
|
||||||
""" Listens for a single incoming request, sends a response if given,
|
""" Listens for a single incoming request, sends a response if given,
|
||||||
and returns the inbound data.
|
and returns the inbound data.
|
||||||
|
Loading…
Reference in New Issue
Block a user