Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dotfiles
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gerhard Gonter
dotfiles
Commits
809b4f86
Commit
809b4f86
authored
8 years ago
by
Gerhard Gonter
Browse files
Options
Downloads
Patches
Plain Diff
allow older version of ssh-keygen
parent
cc4a374b
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
show_fingerprints.pl
+27
-2
27 additions, 2 deletions
show_fingerprints.pl
with
27 additions
and
2 deletions
show_fingerprints.pl
+
27
−
2
View file @
809b4f86
...
...
@@ -12,6 +12,9 @@
use
strict
;
my
(
$version
,
$has_E
)
=
get_ssh_version
();
my
$hash_algorithm
=
'
MD5
';
my
@files
=
<*.
pub
>
;
# print "files: ", join (' ', @files), "\n";
push
(
@files
,
<
authorized_keys
*>
);
...
...
@@ -19,7 +22,10 @@ push (@files, <authorized_keys*>);
printf
("
%-20s %5s %-51s %-6s %s
\n
",
qw(file size fingerprint type notes)
);
foreach
my
$file
(
@files
)
{
my
@cmd
=
(
qw(ssh-keygen -lE md5 -f)
,
$file
);
my
@cmd
=
qw(ssh-keygen -l)
;
push
(
@cmd
,
'
-E
',
$hash_algorithm
)
if
(
$has_E
);
push
(
@cmd
,
'
-f
',
$file
);
my
$res
=
`
@cmd
`;
my
@lines
=
split
("
\n
",
$res
);
foreach
my
$line
(
@lines
)
...
...
@@ -28,9 +34,28 @@ foreach my $file (@files)
my
$type
=
'
unknown
';
if
(
$notes
=~
m#(.+)\s+\((.+)\)#
)
{
(
$notes
,
$type
)
=
(
$
1
,
$
2
)
}
$fp
=
join
('
:
',
$hash_algorithm
,
$fp
)
unless
(
$has_E
);
printf
("
%-20s %5d %-51s %-6s %s
\n
",
$file
,
$size
,
$fp
,
$type
,
$notes
);
}
}
printf
("
%-20s %5d %s %-6s %s
\n
",
$file
,
$size
,
$fp
,
$type
,
$notes
);
sub
get_ssh_version
{
my
@cmd
=
qw(ssh-keygen --version)
;
# apparently, there is way to display the version directly
my
$res
=
`
@cmd
2>&1
`;
my
$version
=
'
unknown
';
my
$has_E
=
0
;
foreach
my
$l
(
split
("
\n
",
$res
))
{
# print "[$l]\n";
if
(
$l
=~
'
-L Print the contents of a certificate.
')
{
$has_E
=
0
;
}
elsif
(
$l
eq
'
ssh-keygen -l [-v] [-E fingerprint_hash] [-f input_keyfile]
')
{
$has_E
=
1
;
}
}
(
$version
,
$has_E
);
}
=head1 TODO
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment