smart_proxy_remote_execution_ssh 0.10.2 → 0.10.4
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 243be2829c2dded953adf5e312e936d3ec6d6ef19ce3474d4f174fd5bd8d89f2
|
4
|
+
data.tar.gz: fb9b33c7dabf90b89921cfbee5bfe6e94b130cc224b7889941171de01c087860
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97d3dd475293be10577c24ecf99679bf8e1d68712246d547f791f995e1b9c93661580343aaf10a45a7b62a479be34e2602ad817b20258b29cf48de7ac049ef12
|
7
|
+
data.tar.gz: 5deb80acfeecb4185acd0ec5eca8cf190e05fc01883f7a7a5dac25b0b2be26135f8b7a8905ad55f4ed80d8aa58835d41eded4b313d121d1c53d419450d7d7175
|
@@ -22,10 +22,12 @@ module Proxy::RemoteExecution::Ssh::Runners
|
|
22
22
|
|
23
23
|
class AuthenticationMethod
|
24
24
|
attr_reader :name
|
25
|
+
attr_accessor :errors
|
25
26
|
def initialize(name, prompt: nil, password: nil)
|
26
27
|
@name = name
|
27
28
|
@prompt = prompt
|
28
29
|
@password = password
|
30
|
+
@errors = nil
|
29
31
|
end
|
30
32
|
|
31
33
|
def ssh_command_prefix
|
@@ -67,12 +69,18 @@ module Proxy::RemoteExecution::Ssh::Runners
|
|
67
69
|
def establish!
|
68
70
|
@available_auth_methods ||= available_authentication_methods
|
69
71
|
method = @available_auth_methods.find do |method|
|
70
|
-
|
72
|
+
pm = try_auth_method(method)
|
73
|
+
method.errors = pm.stderr
|
74
|
+
if pm.status.zero?
|
71
75
|
@available_auth_methods.unshift(method).uniq!
|
72
76
|
true
|
73
77
|
end
|
74
78
|
end
|
75
|
-
method
|
79
|
+
return method if method
|
80
|
+
|
81
|
+
msg = "Could not establish connection to remote host using any available authentication method, tried #{@available_auth_methods.map(&:name).join(', ')}"
|
82
|
+
method_errors = @available_auth_methods.map { |method| "Authentication method '#{method.name}' failed with:\n#{method.errors}" }.join("\n")
|
83
|
+
raise "#{msg}\n\n#{method_errors}"
|
76
84
|
end
|
77
85
|
|
78
86
|
def disconnect!
|
@@ -119,11 +127,10 @@ module Proxy::RemoteExecution::Ssh::Runners
|
|
119
127
|
if pm.status.zero?
|
120
128
|
logger.debug("Established connection using authentication method #{method.name}")
|
121
129
|
@socket = socket_file
|
122
|
-
true
|
123
130
|
else
|
124
131
|
logger.debug("Failed to establish connection using authentication method #{method.name}")
|
125
|
-
false
|
126
132
|
end
|
133
|
+
pm
|
127
134
|
end
|
128
135
|
|
129
136
|
def settings
|
@@ -148,7 +155,7 @@ module Proxy::RemoteExecution::Ssh::Runners
|
|
148
155
|
ssh_options << "-o Port=#{@ssh_port}" if @ssh_port
|
149
156
|
ssh_options << "-o IdentityFile=#{@client_private_key_file}" if @client_private_key_file
|
150
157
|
ssh_options << "-o IdentitiesOnly=yes"
|
151
|
-
ssh_options << "-o StrictHostKeyChecking=
|
158
|
+
ssh_options << "-o StrictHostKeyChecking=accept-new"
|
152
159
|
ssh_options << "-o UserKnownHostsFile=#{prepare_known_hosts}" if @host_public_key
|
153
160
|
ssh_options << "-o LogLevel=#{ssh_log_level(true)}"
|
154
161
|
ssh_options << "-o ControlMaster=auto"
|
@@ -161,17 +161,19 @@ module Proxy::RemoteExecution::Ssh::Runners
|
|
161
161
|
end
|
162
162
|
|
163
163
|
def preflight_checks
|
164
|
-
|
164
|
+
script = cp_script_to_remote("#!/bin/sh\nexec true")
|
165
|
+
ensure_remote_command(script,
|
165
166
|
error: 'Failed to execute script on remote machine, exit code: %{exit_code}.'
|
166
167
|
)
|
167
168
|
unless @user_method.is_a? NoopUserMethod
|
168
|
-
|
169
|
-
ensure_remote_command(path,
|
169
|
+
ensure_remote_command("#{@user_method.cli_command_prefix} #{script}",
|
170
170
|
error: 'Failed to change to effective user, exit code: %{exit_code}',
|
171
171
|
tty: true,
|
172
172
|
user_method: @user_method,
|
173
173
|
close_stdin: false)
|
174
174
|
end
|
175
|
+
# The path should already be escaped
|
176
|
+
ensure_remote_command("rm #{script}")
|
175
177
|
end
|
176
178
|
|
177
179
|
def prepare_start
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smart_proxy_remote_execution_ssh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan Nečas
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -192,7 +192,7 @@ homepage: https://github.com/theforeman/smart_proxy_remote_execution_ssh
|
|
192
192
|
licenses:
|
193
193
|
- GPL-3.0
|
194
194
|
metadata: {}
|
195
|
-
post_install_message:
|
195
|
+
post_install_message:
|
196
196
|
rdoc_options: []
|
197
197
|
require_paths:
|
198
198
|
- lib
|
@@ -207,8 +207,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
207
207
|
- !ruby/object:Gem::Version
|
208
208
|
version: '0'
|
209
209
|
requirements: []
|
210
|
-
rubygems_version: 3.
|
211
|
-
signing_key:
|
210
|
+
rubygems_version: 3.3.26
|
211
|
+
signing_key:
|
212
212
|
specification_version: 4
|
213
213
|
summary: Ssh remote execution provider for Foreman Smart-Proxy
|
214
214
|
test_files: []
|