smart_proxy_remote_execution_ssh 0.11.5 → 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: ead6302544ae91969998c23632555b663222db89f47373124bb9be26a22e6f03
4
- data.tar.gz: f84f4e02c28df57599852178c8d614a787d912c07480bf575642ab4d059767ee
3
+ metadata.gz: 946788d46f25e8418f94cc49bef39dbfe926007ab4ff3e267715dd8050f3d09e
4
+ data.tar.gz: 512b5546a2b45adde95543bf3cd34149115e0ae3782958a7de6d2c6e695557e8
5
5
  SHA512:
6
- metadata.gz: 8951dd6d776ac92b65f0b63fc74f91aa903ec7f535186b82a073c8746ed50f749b393c441464fa31e565b5d4cce86b071c0e203d23de1a6cf9f08251f812ce2a
7
- data.tar.gz: 42d4665bf10a47ed64052349530d87b747589c2beee1d7b64ca11b26e43abcc4094b4b2f5ce77207390387df3ecec57b190898c0ee8d2430da78aaea569ac8ec
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
- 555)
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, 555)
361
+ upload_data(sanitize_script(script), path)
358
362
  end
359
363
 
360
- def upload_data(data, path, permissions = 555)
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
@@ -1,7 +1,7 @@
1
1
  module Proxy
2
2
  module RemoteExecution
3
3
  module Ssh
4
- VERSION = '0.11.5'
4
+ VERSION = '0.11.7'
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,13 @@
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.5
4
+ version: 0.11.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Nečas
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-12-18 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: rake
@@ -94,6 +93,46 @@ dependencies:
94
93
  - - "~>"
95
94
  - !ruby/object:Gem::Version
96
95
  version: 0.82.0
96
+ - !ruby/object:Gem::Dependency
97
+ name: ed25519
98
+ requirement: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '1.2'
103
+ - - "<"
104
+ - !ruby/object:Gem::Version
105
+ version: '2.0'
106
+ type: :runtime
107
+ prerelease: false
108
+ version_requirements: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: '1.2'
113
+ - - "<"
114
+ - !ruby/object:Gem::Version
115
+ version: '2.0'
116
+ - !ruby/object:Gem::Dependency
117
+ name: bcrypt_pbkdf
118
+ requirement: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: '1.0'
123
+ - - "<"
124
+ - !ruby/object:Gem::Version
125
+ version: '2.0'
126
+ type: :runtime
127
+ prerelease: false
128
+ version_requirements: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: '1.0'
133
+ - - "<"
134
+ - !ruby/object:Gem::Version
135
+ version: '2.0'
97
136
  - !ruby/object:Gem::Dependency
98
137
  name: smart_proxy_dynflow
99
138
  requirement: !ruby/object:Gem::Requirement
@@ -148,8 +187,8 @@ email:
148
187
  executables: []
149
188
  extensions: []
150
189
  extra_rdoc_files:
151
- - README.md
152
190
  - LICENSE
191
+ - README.md
153
192
  files:
154
193
  - LICENSE
155
194
  - README.md
@@ -183,7 +222,6 @@ homepage: https://github.com/theforeman/smart_proxy_remote_execution_ssh
183
222
  licenses:
184
223
  - GPL-3.0-only
185
224
  metadata: {}
186
- post_install_message:
187
225
  rdoc_options: []
188
226
  require_paths:
189
227
  - lib
@@ -198,8 +236,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
198
236
  - !ruby/object:Gem::Version
199
237
  version: '0'
200
238
  requirements: []
201
- rubygems_version: 3.3.27
202
- signing_key:
239
+ rubygems_version: 3.6.9
203
240
  specification_version: 4
204
241
  summary: Ssh remote execution provider for Foreman Smart-Proxy
205
242
  test_files: []