Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed "command" from other authkeys breaking authkeys file parsing

The regexp will remove command or other options at the start of each
lines from the authkeys file. The remaining part of the line should be
the public key only without any other ssh options.

Note that it will only detect on authorized_keys file for protocol 2
(but who use protocol 1 anymore?)
  • Loading branch information...
commit 233d2d4ba9755c7ad41d402bef1316e7a9666f3c 1 parent 089f0f9
@Wizmaster Wizmaster authored
Showing with 6 additions and 1 deletion.
  1. +6 −1 src/triggers/post-compile/ssh-authkeys
View
7 src/triggers/post-compile/ssh-authkeys
@@ -121,7 +121,12 @@ sub fp_file {
sub fp_line {
my ( $fh, $fn ) = tempfile();
- print $fh shift;
+
+ my $authkey = shift;
+ # Remove potential command prefix and options from authkeys file
+ $authkey =~ s/^.* ((?:ssh-rsa|ssh-dss|ecdsa-\S+) .*$)/$1/gm;
+
+ print $fh $authkey;
close $fh;
my $fp = fp_file($fn);
unlink $fn;
Please sign in to comment.
Something went wrong with that request. Please try again.