smart_proxy_remote_execution_ssh 0.11.6 → 0.11.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 946788d46f25e8418f94cc49bef39dbfe926007ab4ff3e267715dd8050f3d09e
|
4
|
+
data.tar.gz: 512b5546a2b45adde95543bf3cd34149115e0ae3782958a7de6d2c6e695557e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01f22953e94eb55a52d96e91e49889a26708e3a0d2d6b4020ab8d3ee2a8924b5936e78c3d4b6d031e68fb02099de9bcdc03be4bf5c627a876915b5e8f8791bbe
|
7
|
+
data.tar.gz: b905fb0c16e1bc6708e242be564dfd70289d6f0ab20fdc78affa64edd1e099070a449367e55151dd11a099ec80d9c91893aac78c6fdb0a797cd3fb0191437d9b
|
@@ -168,6 +168,7 @@ module Proxy::RemoteExecution::Ssh::Runners
|
|
168
168
|
error: 'Failed to execute script on remote machine, exit code: %{exit_code}.'
|
169
169
|
)
|
170
170
|
unless @user_method.is_a? NoopUserMethod
|
171
|
+
ensure_effective_user_access(script)
|
171
172
|
ensure_remote_command("#{@user_method.cli_command_prefix} #{script}",
|
172
173
|
error: 'Failed to change to effective user, exit code: %{exit_code}',
|
173
174
|
tty: true,
|
@@ -206,8 +207,11 @@ module Proxy::RemoteExecution::Ssh::Runners
|
|
206
207
|
SCRIPT
|
207
208
|
@remote_script_wrapper = upload_data(
|
208
209
|
wrapper,
|
209
|
-
File.join(File.dirname(@remote_script), 'script-wrapper')
|
210
|
-
|
210
|
+
File.join(File.dirname(@remote_script), 'script-wrapper'))
|
211
|
+
ensure_effective_user_access(@remote_script_wrapper, @remote_script)
|
212
|
+
upload_data('', @output_path, 600)
|
213
|
+
ensure_effective_user_access(@output_path, mode: 'rw')
|
214
|
+
@remote_script_wrapper
|
211
215
|
end
|
212
216
|
|
213
217
|
# the script that initiates the execution
|
@@ -354,10 +358,10 @@ module Proxy::RemoteExecution::Ssh::Runners
|
|
354
358
|
def cp_script_to_remote(script = @script, name = 'script')
|
355
359
|
path = remote_command_file(name)
|
356
360
|
@logger.debug("copying script to #{path}:\n#{indent_multiline(script)}")
|
357
|
-
upload_data(sanitize_script(script), path
|
361
|
+
upload_data(sanitize_script(script), path)
|
358
362
|
end
|
359
363
|
|
360
|
-
def upload_data(data, path, permissions =
|
364
|
+
def upload_data(data, path, permissions = 500)
|
361
365
|
ensure_remote_directory File.dirname(path)
|
362
366
|
# We use tee here to pipe stdin coming from ssh to a file at $path, while silencing its output
|
363
367
|
# This is used to write to $path with elevated permissions, solutions using cat and output redirection
|
@@ -414,5 +418,11 @@ module Proxy::RemoteExecution::Ssh::Runners
|
|
414
418
|
@expecting_disconnect = true
|
415
419
|
end
|
416
420
|
end
|
421
|
+
|
422
|
+
def ensure_effective_user_access(*paths, mode: 'rx')
|
423
|
+
unless @user_method.is_a? NoopUserMethod
|
424
|
+
ensure_remote_command("setfacl -m u:#{@user_method.effective_user}:#{mode} #{paths.join(' ')}")
|
425
|
+
end
|
426
|
+
end
|
417
427
|
end
|
418
428
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smart_proxy_remote_execution_ssh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan Nečas
|
@@ -236,7 +236,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
236
236
|
- !ruby/object:Gem::Version
|
237
237
|
version: '0'
|
238
238
|
requirements: []
|
239
|
-
rubygems_version: 3.6.
|
239
|
+
rubygems_version: 3.6.9
|
240
240
|
specification_version: 4
|
241
241
|
summary: Ssh remote execution provider for Foreman Smart-Proxy
|
242
242
|
test_files: []
|