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 --- lib/Vyatta/Login/User.pm | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'lib/Vyatta') diff --git a/lib/Vyatta/Login/User.pm b/lib/Vyatta/Login/User.pm index 018e7e12..87dd4db4 100755 --- a/lib/Vyatta/Login/User.pm +++ b/lib/Vyatta/Login/User.pm @@ -115,7 +115,7 @@ sub _vyatta_users { sub set_authorized_keys { my $user = shift; my $config = new Vyatta::Config; - $config->setLevel("system login user $user authorized-keys"); + $config->setLevel("system login user $user authentication public-keys"); my @keys = $config->listNodes(); return unless @keys; @@ -139,19 +139,14 @@ sub set_authorized_keys { return; } - select $auth; - print "# Automatically generated by Vyatta configuration\n"; - print "# Do not edit, all changes will be lost\n"; - foreach my $key (@keys) { - my $type = $config->returnValue("$key key-type"); - print "$type $key"; - - my $comment = $config->returnValue("$key description"); - print " $comment" if $comment; - - print "\n"; + print {$auth} "# Automatically generated by Vyatta configuration\n"; + print {$auth} "# Do not edit, all changes will be lost\n"; + foreach my $name (@keys) { + my $type = $config->returnValue("$name type"); + my $key = $config->returnValue("$name key"); + print {$auth} "$type $key $name\n"; } - select STDOUT; + close $auth; chmod (0640, "$sshdir/authorized_keys"); } -- cgit v1.2.3