From 15b9d5dae4ce931d524e2e7dd72d8d9dc0d311ee Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Fri, 19 Aug 2011 03:14:17 +0200 Subject: [PATCH] feature #754: Simple loginx509 option for oneauth. Needs merge with current login option --- src/authm_mad/oneauth | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/authm_mad/oneauth b/src/authm_mad/oneauth index f5b7f610f7..4881fd596f 100755 --- a/src/authm_mad/oneauth +++ b/src/authm_mad/oneauth @@ -36,6 +36,7 @@ require 'OpenNebula' require 'rubygems' require 'sequel' require 'ssh_auth' +require 'x509_auth' require 'yaml' require 'command_parser' @@ -103,6 +104,24 @@ cmd=CommandParser::CmdParser.new(ARGV) do exit_with_code 0 end + command 'loginx509', login_desc, :text, :text, :text, :text do + user = args[0] + cert = File.read(args[1]) + key = File.read(args[2]) + time = args[3] + + if time + time=time.to_i + else + time=3600 + end + + auth = X509Auth.new(:cert=>cert,:key=>key) + auth.login(user, time) + + exit_with_code 0 + end + command 'key', 'Gets public key' do ssh=SshAuth.new puts ssh.public_key