diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-12-04 15:32:42 -0800 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-12-04 15:42:35 -0800 |
commit | 103371d47c0d3ea4c28901810e11127de3855d5d (patch) | |
tree | 709027d429f428f55412027b9408a43153eee371 /scripts/vyatta-load-user-key.pl | |
parent | ebe3578d23a80533f6db1247c8d98f37485256fc (diff) | |
download | vyatta-cfg-system-103371d47c0d3ea4c28901810e11127de3855d5d.tar.gz vyatta-cfg-system-103371d47c0d3ea4c28901810e11127de3855d5d.zip |
Rearrange the public-key configuration schema
New syntax:
system login user vyatta authentication public-key user@remote type ssh-rsa
Diffstat (limited to 'scripts/vyatta-load-user-key.pl')
-rw-r--r-- | scripts/vyatta-load-user-key.pl | 25 |
1 files changed, 9 insertions, 16 deletions
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; |