Mercurial > dropbear
diff test/test_svrauth.py @ 1890:45e552ee4391
merge
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 22 Mar 2022 16:17:47 +0800 |
parents | 30fd047f6ebf |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/test_svrauth.py Tue Mar 22 16:17:47 2022 +0800 @@ -0,0 +1,30 @@ +from test_dropbear import * +import signal +import queue +import socket +import os +from pathlib import Path + +# Tests for server side authentication + +# Requires keyfile and authorized_keys set up in github action build.yml [email protected]('DBTEST_IN_ACTION' not in os.environ, reason="DBTEST_IN_ACTION not set") +def test_pubkeyinfo(request, dropbear): + kf = str(Path.home() / ".ssh/id_dropbear_key2") + r = dbclient(request, "-i", kf, "echo -n $SSH_PUBKEYINFO", capture_output=True) + # stop at first space + assert r.stdout.decode() == "key2" + [email protected]('DBTEST_IN_ACTION' not in os.environ, reason="DBTEST_IN_ACTION not set") +def test_pubkeyinfo_special(request, dropbear): + kf = str(Path.home() / ".ssh/id_dropbear_key3") + r = dbclient(request, "-i", kf, "echo -n $SSH_PUBKEYINFO", capture_output=True) + # comment contains special characters so the SSH_PUBKEYINFO should not be set + assert r.stdout.decode() == "" + [email protected]('DBTEST_IN_ACTION' not in os.environ, reason="DBTEST_IN_ACTION not set") +def test_pubkeyinfo_okchar(request, dropbear): + kf = str(Path.home() / ".ssh/id_dropbear_key4") + r = dbclient(request, "-i", kf, "echo -n $SSH_PUBKEYINFO", capture_output=True) + # comment contains special characters so the SSH_PUBKEYINFO should not be set + assert r.stdout.decode() == "key4,char"