diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2016-01-12 23:31:08 -0800 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2016-01-12 23:32:49 -0800 |
commit | 529b3a21694d3bc04e70cde35572476aa8074541 (patch) | |
tree | 44ea3c73d72bfda0cb61a2db8f00aca3ea6878b2 | |
parent | Add helper functions for SSH fingerprints. (diff) | |
download | gitolite-gentoo-529b3a21694d3bc04e70cde35572476aa8074541.tar.gz gitolite-gentoo-529b3a21694d3bc04e70cde35572476aa8074541.tar.bz2 gitolite-gentoo-529b3a21694d3bc04e70cde35572476aa8074541.zip |
ssh-authkeys: use new ssh fingerprint functions.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
-rwxr-xr-x | src/triggers/post-compile/ssh-authkeys | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/triggers/post-compile/ssh-authkeys b/src/triggers/post-compile/ssh-authkeys index d5f5d8b..7fe699f 100755 --- a/src/triggers/post-compile/ssh-authkeys +++ b/src/triggers/post-compile/ssh-authkeys @@ -2,7 +2,6 @@ use strict; use warnings; -use File::Temp qw(tempfile); use Getopt::Long; use lib $ENV{GL_LIBDIR}; @@ -113,19 +112,15 @@ sub fp { sub fp_file { return $selinux++ if $selinux; # return a unique "fingerprint" to prevent noise my $f = shift; - my $fp = `ssh-keygen -l -f '$f'`; - chomp($fp); - _die "fingerprinting failed for '$f'" unless $fp =~ /([0-9a-f][0-9a-f](:[0-9a-f][0-9a-f])+)/ or $fp =~ m(SHA256:([A-ZA-z0-9+/]+)); - $fp = $1; + my ($fp, $output) = ssh_fingerprint_file($f); + _die "fingerprinting failed for '$f': $output" unless $fp; return $fp; } sub fp_line { - my ( $fh, $fn ) = tempfile(); - print $fh shift() . "\n"; - close $fh; - my $fp = fp_file($fn); - unlink $fn; + my $line = shift; + my ($fp, $output) = ssh_fingerprint_line($line); + _die "fingerprinting failed for '$line': $output" unless $fp; return $fp; } |