mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
feature #754: Simple loginx509 option for oneauth. Needs merge with current login option
This commit is contained in:
parent
7347a36990
commit
15b9d5dae4
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user