add -r|--rsa-key option for answerback-email
[why]
enable one click login testbox from jumper server
[how]
add -r|--rsa-key option to enable generate rsa private/public key on jumper server
register the public key to testbox
Signed-off-by: Luan Shengde <shdluan(a)163.com>
---
container/assign-account/answerback-email.rb | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/container/assign-account/answerback-email.rb b/container/assign-account/answerback-email.rb
index 686a327..6d8e3de 100755
--- a/container/assign-account/answerback-email.rb
+++ b/container/assign-account/answerback-email.rb
@@ -32,7 +32,8 @@ my_info = {
'my_email' => nil,
'my_name' => nil,
'my_uuid' => %x(uuidgen).chomp,
- 'my_ssh_pubkey' => nil
+ 'my_ssh_pubkey' => nil,
+ 'my_jumper_pubkey' => false
}
def init_info(email_file, my_info)
@@ -68,6 +69,10 @@ options = OptionParser.new do |opts|
init_info(email_file, my_info)
end
+ opts.on('-r', '--rsa-key', 'generate jumper ras public/private key and return pubkey') do
+ my_info['my_jumper_pubkey'] = true
+ end
+
opts.on_tail('-h', '--help', 'show this message') do
puts opts
exit
@@ -114,10 +119,12 @@ def send_account(my_info)
raise message if my_info['my_email'].nil?
account_info = apply_account(my_info)
+
# for manually assign account, there will be no my_commit_url
# but the key my_commit_url is required for es
my_info['my_commit_url'] = ''
my_info['my_login_name'] = account_info['my_login_name']
+ my_info['my_jumper_pubkey'] = account_info['my_jumper_pubkey']
my_info.delete 'my_ssh_pubkey'
store_account_info(my_info)
message = build_message(my_info['my_email'], account_info)
--
2.23.0