From: Ian Jackson Date: Wed, 2 Jun 2021 16:41:04 +0000 (+0100) Subject: sshkeys: Test banner and static handling X-Git-Tag: otter-0.7.0~101 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=ab9013d8e6515a28a07cd491361830cde3657d63;p=otter.git sshkeys: Test banner and static handling Signed-off-by: Ian Jackson --- diff --git a/apitest/at-otter.rs b/apitest/at-otter.rs index 1bdb05f0..292bfe34 100644 --- a/apitest/at-otter.rs +++ b/apitest/at-otter.rs @@ -211,13 +211,27 @@ impl Ctx { )?); self.otter(&command)?; - let dummy_key_path = ds.subst("@src@/apitest/dummy.pub")?; - let ds = ds.also(&[("dummy_key_path", &dummy_key_path)]); + let ds = ds.also(&[ + ("dummy_key_path", ds.subst("@src@/apitest/dummy.pub")?), + ("authkeys", ds.subst("@abstmp@/authorized_keys")?), + ]); + + static STATIC_TEST: &str = "# example static data -- for test\n"; - self.otter(&ds.gss( + File::create(ds.subst("@authkeys@")?)? + .write(STATIC_TEST.as_bytes())?; + + let set_keys = ds.gss( "--super --account ssh:test: set-ssh-keys \ @dummy_key_path@" - )?)?; + )?; + + self.otter(&set_keys).expect_err("auth keys has static"); + + fs::rename(ds.subst("@authkeys@")?, + ds.subst("@authkeys@.static")?)?; + + self.otter(&set_keys)?; } }