aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2016-01-12 23:43:21 -0800
committerSitaram Chamarty <sitaram@atc.tcs.com>2016-01-19 20:31:27 +0530
commit72a3289e7f242a871e94164c9594751de34f0906 (patch)
tree2d4a89a4aacdf8142398572877f92e46f7194614
parentAdd helper functions for SSH fingerprints. (diff)
downloadgitolite-gentoo-72a3289e7f242a871e94164c9594751de34f0906.tar.gz
gitolite-gentoo-72a3289e7f242a871e94164c9594751de34f0906.tar.bz2
gitolite-gentoo-72a3289e7f242a871e94164c9594751de34f0906.zip
ssh-authkeys: use new ssh fingerprint functions.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
-rwxr-xr-xsrc/triggers/post-compile/ssh-authkeys15
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;
}