Skip to content

Commit f0d1b0c

Browse files
committed
Support Hardware Security Keys by updating openssh-keys
This pulls in a newer version of the openssh-keys crate that supports hardware security keys. A test case is added, too.
1 parent 1292eeb commit f0d1b0c

File tree

4 files changed

+88
-28
lines changed

4 files changed

+88
-28
lines changed

Cargo.lock

Lines changed: 80 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ clap = "2.33"
1414
fs2 = "0.4"
1515
# Public dependencies, exposed through library API.
1616
error-chain = { version = "0.12", default-features = false }
17-
openssh-keys = "0.4"
17+
openssh-keys = { git = "https://github.com/pothos/openssh-keys", branch = "add-sk-keys" }
1818
users = "0.8"
1919

2020
[[bin]]

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ extern crate users;
3535
pub mod errors {
3636
error_chain! {
3737
links {
38-
ParseError(::openssh_keys::errors::Error, ::openssh_keys::errors::ErrorKind);
3938
}
4039
foreign_links {
4140
Io(::std::io::Error);
41+
ParseError(::openssh_keys::errors::OpenSSHKeyError);
4242
}
4343
errors {
4444
KeysDisabled(name: String) {

tests/test_update_ssh_keys.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,16 @@
4242
'888yVOgsJ7HGGDGRMo5ytr2SUJB7QWsLX6Un/Zbu32nXsAqtqagxd6F'
4343
'Ies98TSekMh/hAv9uK92mEsXSINXOeIMKRedqOyPgk5IEOsFpxAUO4T'
4444
'xpYToeuM8HRemecxw2eIFHnax+mQqCsi7FgQ== core@valid2',
45+
'valid3': 'sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9w'
46+
'ZW5zc2guY29tAAAAIEX/dQ0v4127bEo8eeG1EV0ApO2lWbSnN6RWusn'
47+
'/NjqIAAAABHNzaDo= demos@siril',
4548
'bad': 'ssh-bad this-not-a-key core@bad',
4649
}
4750

4851
fingerprints = {
4952
'valid1': 'SHA256:yZ+o48h6quk9c+JVgJ/Zq4S5u4LUk6TSpneHKkmM9KY',
5053
'valid2': 'SHA256:RP5k1AybZ1kollIAnpUavr1v1nfZ0yloKvI46AMDPkM ',
54+
'valid3': 'SHA256:U8IKRkIHed6vFMTflwweA3HhIf2DWgZ8EFTm9fgwOUk',
5155
}
5256

5357
class UpdateSshKeysTestCase(unittest.TestCase):
@@ -107,14 +111,15 @@ def test_first_run(self):
107111
with open('%s/authorized_keys' % self.ssh_dir, 'w') as fd:
108112
fd.write('%s\n' % test_keys['valid1'])
109113
fd.write('%s\n' % test_keys['valid2'])
114+
fd.write('%s\n' % test_keys['valid3'])
110115
proc = self.run_script()
111116
out, err = proc.communicate()
112117
self.assertEquals(proc.returncode, 0)
113118
self.assertTrue(out.startswith('Updated '))
114119
self.assertEquals(err, '')
115120
self.assertTrue(os.path.exists(
116121
'%s/authorized_keys.d/old_authorized_keys' % self.ssh_dir))
117-
self.assertHasKeys('valid1', 'valid2')
122+
self.assertHasKeys('valid1', 'valid2', 'valid3')
118123

119124
def test_add_one_file(self):
120125
proc = self.run_script('-a', 'one', self.pub_files['valid1'])

0 commit comments

Comments
 (0)