From 103371d47c0d3ea4c28901810e11127de3855d5d Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Fri, 4 Dec 2009 15:32:42 -0800 Subject: Rearrange the public-key configuration schema New syntax: system login user vyatta authentication public-key user@remote type ssh-rsa --- scripts/vyatta-load-user-key.pl | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) (limited to 'scripts') diff --git a/scripts/vyatta-load-user-key.pl b/scripts/vyatta-load-user-key.pl index c807c40b..6379fa8c 100644 --- a/scripts/vyatta-load-user-key.pl +++ b/scripts/vyatta-load-user-key.pl @@ -98,26 +98,19 @@ while (<$cfg>) { # The options field is optional (but not supported). my ($keytype, $keycode, $comment) = split / /; die "Not a valid key file format (see man sshd)" - unless $keycode; + unless defined($keytype) && defined($keycode) && defined($comment); - die "Not a valid ssh public file format\n" + die "$keytype: not a known ssh public format\n" unless ($keytype =~ /ssh-rsa|ssh-dsa/); - my $cmd = "set system login user $user authorized-key $keycode" - . " key-type $keytype"; - system ("$sbindir/my_$cmd"); - if ($? >> 8) { - die "\"$cmd\" failed\n"; - } + my $cmd = "set system login user $user authentication public-keys $comment"; + system ("$sbindir/my_$cmd" . " key $keycode"); + die "\"$cmd\" key failed\n" + if ($? >> 8); - if ($comment) { - $cmd = "set system login user $user authorized-key $keycode" - ." description $comment"; - system ("$sbindir/my_$cmd"); - if ($? >> 8) { - die "\"$cmd\" failed\n"; - } - } + system ("$sbindir/my_$cmd" . " type $keytype"); + die "\"$cmd\" type failed\n" + if ($? >> 8); } close $cfg; -- cgit v1.2.3