cloudx-proxy 0.3.13__py3-none-any.whl → 0.3.14__py3-none-any.whl

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.
cloudx_proxy/_version.py CHANGED
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '0.3.13'
21
- __version_tuple__ = version_tuple = (0, 3, 13)
20
+ __version__ = version = '0.3.14'
21
+ __version_tuple__ = version_tuple = (0, 3, 14)
cloudx_proxy/setup.py CHANGED
@@ -68,6 +68,25 @@ class CloudXSetup:
68
68
  response = input(prompt_text)
69
69
  return response if response else default
70
70
 
71
+ def _set_directory_permissions(self, directory: Path) -> bool:
72
+ """Set proper permissions (700) on a directory for Unix-like systems.
73
+
74
+ Args:
75
+ directory: Path to the directory
76
+
77
+ Returns:
78
+ bool: True if permissions were set successfully
79
+ """
80
+ try:
81
+ if platform.system() != 'Windows':
82
+ import stat
83
+ directory.chmod(stat.S_IRWXU) # 700 permissions (owner read/write/execute)
84
+ self.print_status(f"Set {directory} permissions to 700", True, 2)
85
+ return True
86
+ except Exception as e:
87
+ self.print_status(f"Error setting permissions: {str(e)}", False, 2)
88
+ return False
89
+
71
90
  def setup_aws_profile(self) -> bool:
72
91
  """Set up AWS profile using aws configure command.
73
92
 
@@ -138,10 +157,20 @@ class CloudXSetup:
138
157
  self.ssh_dir.mkdir(parents=True, exist_ok=True)
139
158
  self.print_status("SSH directory exists", True, 2)
140
159
 
160
+ # Set proper permissions on the vscode directory
161
+ if not self._set_directory_permissions(self.ssh_dir):
162
+ return False
163
+
141
164
  key_exists = self.ssh_key_file.exists() and (self.ssh_key_file.with_suffix('.pub')).exists()
142
165
 
143
166
  if key_exists:
144
167
  self.print_status(f"SSH key '{self.ssh_key}' exists", True, 2)
168
+ # Set proper permissions on existing key files
169
+ if platform.system() != 'Windows':
170
+ import stat
171
+ self.ssh_key_file.chmod(stat.S_IRUSR | stat.S_IWUSR) # 600 permissions (owner read/write)
172
+ self.ssh_key_file.with_suffix('.pub').chmod(stat.S_IRUSR | stat.S_IWUSR | stat.S_IROTH | stat.S_IRGRP) # 644 permissions
173
+ self.print_status("Set key file permissions", True, 2)
145
174
  else:
146
175
  self.print_status(f"Generating new SSH key '{self.ssh_key}'...", None, 2)
147
176
  subprocess.run([
@@ -152,6 +181,12 @@ class CloudXSetup:
152
181
  ], check=True)
153
182
  self.print_status("SSH key generated", True, 2)
154
183
 
184
+ # Set proper permissions on newly generated key files
185
+ if platform.system() != 'Windows':
186
+ import stat
187
+ self.ssh_key_file.chmod(stat.S_IRUSR | stat.S_IWUSR) # 600 permissions (owner read/write)
188
+ self.ssh_key_file.with_suffix('.pub').chmod(stat.S_IRUSR | stat.S_IWUSR | stat.S_IROTH | stat.S_IRGRP) # 644 permissions
189
+ self.print_status("Set key file permissions", True, 2)
155
190
 
156
191
  return True
157
192
 
@@ -200,6 +235,13 @@ Host cloudx-{cloudx_env}-{hostname}
200
235
  with open(self.ssh_config_file, 'a') as f:
201
236
  f.write(host_entry)
202
237
  self.print_status("Host entry added with settings", True, 2)
238
+
239
+ # Set proper permissions on the config file
240
+ if platform.system() != 'Windows':
241
+ import stat
242
+ self.ssh_config_file.chmod(stat.S_IRUSR | stat.S_IWUSR) # 600 permissions (owner read/write)
243
+ self.print_status("Set config file permissions to 600", True, 2)
244
+
203
245
  return True
204
246
 
205
247
  except Exception as e:
@@ -220,24 +262,16 @@ Host cloudx-{cloudx_env}-{hostname}
220
262
  bool: True if directory was created or exists with proper permissions
221
263
  """
222
264
  try:
223
- # Create path based on platform
224
- if platform.system() == 'Windows':
225
- control_dir = Path(self.home_dir) / ".ssh" / "control"
226
- else:
227
- control_dir = Path(self.home_dir) / ".ssh" / "control"
265
+ # Create control directory path
266
+ control_dir = Path(self.home_dir) / ".ssh" / "control"
228
267
 
229
268
  # Create directory if it doesn't exist
230
269
  if not control_dir.exists():
231
270
  control_dir.mkdir(parents=True, exist_ok=True)
232
271
  self.print_status(f"Created control directory: {control_dir}", True, 2)
233
272
 
234
- # Set proper permissions on Unix-like systems
235
- if platform.system() != 'Windows':
236
- import stat
237
- control_dir.chmod(stat.S_IRWXU) # 700 permissions (owner read/write/execute)
238
- self.print_status("Set directory permissions to 700", True, 2)
239
-
240
- return True
273
+ # Set proper permissions
274
+ return self._set_directory_permissions(control_dir)
241
275
 
242
276
  except Exception as e:
243
277
  self.print_status(f"Error creating control directory: {str(e)}", False, 2)
@@ -296,8 +330,8 @@ Host cloudx-{cloudx_env}-{hostname}
296
330
  if f"Host cloudx-{cloudx_env}-*" in current_config:
297
331
  self.print_status(f"Found existing config for cloudx-{cloudx_env}-*", True, 2)
298
332
  choice = self.prompt(
299
- "Would you like to \n(1) override the existing config\n "
300
- "(2) add settings to the specific host entry?",
333
+ "Would you like to \n 1: override the existing config\n "
334
+ " 2: add settings to the specific host entry?\nSelect an option ",
301
335
  "1"
302
336
  )
303
337
  if choice == "2":
@@ -369,6 +403,12 @@ Host cloudx-{cloudx_env}-*
369
403
  else:
370
404
  self.ssh_config_file.write_text(base_config)
371
405
  self.print_status("Base configuration created", True, 2)
406
+
407
+ # Set proper permissions on the config file
408
+ if platform.system() != 'Windows':
409
+ import stat
410
+ self.ssh_config_file.chmod(stat.S_IRUSR | stat.S_IWUSR) # 600 permissions (owner read/write)
411
+ self.print_status("Set config file permissions to 600", True, 2)
372
412
 
373
413
  # Add specific host entry
374
414
  self.print_status(f"Adding host entry for cloudx-{cloudx_env}-{hostname}", None, 2)
@@ -381,6 +421,13 @@ Host cloudx-{cloudx_env}-{hostname}
381
421
  self.print_status("Host entry added", True, 2)
382
422
 
383
423
  # Ensure main SSH config includes our config
424
+ # Ensure ~/.ssh directory has proper permissions
425
+ ssh_parent_dir = Path(self.home_dir) / ".ssh"
426
+ if not ssh_parent_dir.exists():
427
+ ssh_parent_dir.mkdir(parents=True, exist_ok=True)
428
+ self.print_status(f"Created SSH directory: {ssh_parent_dir}", True, 2)
429
+ self._set_directory_permissions(ssh_parent_dir)
430
+
384
431
  main_config = Path(self.home_dir) / ".ssh" / "config"
385
432
  include_line = f"Include {self.ssh_config_file}\n"
386
433
 
@@ -392,11 +439,23 @@ Host cloudx-{cloudx_env}-{hostname}
392
439
  self.print_status("Added include line to main SSH config", True, 2)
393
440
  else:
394
441
  self.print_status("Main SSH config already includes our config", True, 2)
442
+
443
+ # Set correct permissions on main config file
444
+ if platform.system() != 'Windows':
445
+ import stat
446
+ main_config.chmod(stat.S_IRUSR | stat.S_IWUSR) # 600 permissions
447
+ self.print_status("Set main config file permissions to 600", True, 2)
395
448
  else:
396
449
  main_config.write_text(include_line)
397
450
  self.print_status("Created main SSH config with include line", True, 2)
451
+
452
+ # Set correct permissions on newly created main config file
453
+ if platform.system() != 'Windows':
454
+ import stat
455
+ main_config.chmod(stat.S_IRUSR | stat.S_IWUSR) # 600 permissions
456
+ self.print_status("Set main config file permissions to 600", True, 2)
398
457
 
399
- self.print_status("\nSSH configuration summary:", None)
458
+ self.print_status("SSH configuration summary:", None)
400
459
  self.print_status(f"Main config: {main_config}", None, 2)
401
460
  self.print_status(f"cloudx-proxy config: {self.ssh_config_file}", None, 2)
402
461
  self.print_status(f"Connect using: ssh cloudx-{cloudx_env}-{hostname}", None, 2)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: cloudx-proxy
3
- Version: 0.3.13
3
+ Version: 0.3.14
4
4
  Summary: SSH proxy command to connect VSCode with Cloud9/CloudX instance using AWS Systems Manager
5
5
  Author-email: easytocloud <info@easytocloud.com>
6
6
  License: MIT License
@@ -0,0 +1,11 @@
1
+ cloudx_proxy/__init__.py,sha256=ZZ2O_m9OFJm18AxMSuYJt4UjSuSqyJlYRaZMoets498,61
2
+ cloudx_proxy/_version.py,sha256=dAYECGus8vEags4_X66QYJmiBFCY-yJJXDyexsFv72w,513
3
+ cloudx_proxy/cli.py,sha256=7wi00p5CUl0Dt8huMEkP85SWgA_vzcoCzch0wctvqHk,3488
4
+ cloudx_proxy/core.py,sha256=XQbVlPaqQQ352Ao_JJlN-PpqIdQtSBec0lNRB1s0JSk,7288
5
+ cloudx_proxy/setup.py,sha256=Ing3UnTG_zeMZAcNI3SQbmTJzrY1UWUHUbu6UT14lao,24178
6
+ cloudx_proxy-0.3.14.dist-info/LICENSE,sha256=i7P2OR4zsJYsMWcCUDe_B9ZfGi9bU0K5I2nKfDrW_N8,1068
7
+ cloudx_proxy-0.3.14.dist-info/METADATA,sha256=qvR4_o1puGZ2WNjb0Y5GLW8Ff2aX_IH7k8YPZx9-ORM,14038
8
+ cloudx_proxy-0.3.14.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
9
+ cloudx_proxy-0.3.14.dist-info/entry_points.txt,sha256=HGt743N2lVlKd7O1qWq3C0aEHyS5PjPnxzDHh7hwtSg,54
10
+ cloudx_proxy-0.3.14.dist-info/top_level.txt,sha256=2wtEote1db21j-VvkCJFfT-dLlauuG5indjggYh3xDg,13
11
+ cloudx_proxy-0.3.14.dist-info/RECORD,,
@@ -1,11 +0,0 @@
1
- cloudx_proxy/__init__.py,sha256=ZZ2O_m9OFJm18AxMSuYJt4UjSuSqyJlYRaZMoets498,61
2
- cloudx_proxy/_version.py,sha256=EwvT0-VckFIV9s9wWIrrcCCLDLz10Bn0_zRsokqxmZs,513
3
- cloudx_proxy/cli.py,sha256=7wi00p5CUl0Dt8huMEkP85SWgA_vzcoCzch0wctvqHk,3488
4
- cloudx_proxy/core.py,sha256=XQbVlPaqQQ352Ao_JJlN-PpqIdQtSBec0lNRB1s0JSk,7288
5
- cloudx_proxy/setup.py,sha256=93elRbfBUCUJ9Yj8uyMki8FUyt7YZCNODICKqYDA1j0,20917
6
- cloudx_proxy-0.3.13.dist-info/LICENSE,sha256=i7P2OR4zsJYsMWcCUDe_B9ZfGi9bU0K5I2nKfDrW_N8,1068
7
- cloudx_proxy-0.3.13.dist-info/METADATA,sha256=Pr1JQOxTtIhjqHitm9ekmQjeBorMwKkMdAbpe2jehrY,14038
8
- cloudx_proxy-0.3.13.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
9
- cloudx_proxy-0.3.13.dist-info/entry_points.txt,sha256=HGt743N2lVlKd7O1qWq3C0aEHyS5PjPnxzDHh7hwtSg,54
10
- cloudx_proxy-0.3.13.dist-info/top_level.txt,sha256=2wtEote1db21j-VvkCJFfT-dLlauuG5indjggYh3xDg,13
11
- cloudx_proxy-0.3.13.dist-info/RECORD,,