cloudx-proxy 0.4.2__py3-none-any.whl → 0.4.3__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.4.2'
21
- __version_tuple__ = version_tuple = (0, 4, 2)
20
+ __version__ = version = '0.4.3'
21
+ __version_tuple__ = version_tuple = (0, 4, 3)
cloudx_proxy/setup.py CHANGED
@@ -383,38 +383,56 @@ class CloudXSetup:
383
383
  IdentitiesOnly yes
384
384
  """
385
385
 
386
- def _build_host_config(self, cloudx_env: str, hostname: str, instance_id: str, include_proxy: bool = True) -> str:
387
- """Build a host configuration block.
386
+ def _build_environment_config(self, cloudx_env: str) -> str:
387
+ """Build an environment-wide configuration block with all common settings.
388
388
 
389
389
  Args:
390
390
  cloudx_env: CloudX environment
391
- hostname: Hostname for the instance
392
- instance_id: EC2 instance ID (None for wildcard entries)
393
- include_proxy: Whether to include the ProxyCommand (default: True)
394
391
 
395
392
  Returns:
396
- str: Complete host configuration block
393
+ str: Complete environment configuration block
397
394
  """
398
- host_pattern = hostname if hostname else "*"
399
395
  host_entry = f"""
400
- Host cloudx-{cloudx_env}-{host_pattern}
401
- """
402
- # Add HostName only for specific hosts, not for wildcard entries
403
- if instance_id:
404
- host_entry += f""" HostName {instance_id}
405
- """
406
- host_entry += """ User ec2-user
396
+ Host cloudx-{cloudx_env}-*
397
+ User ec2-user
407
398
  """
408
399
  # Add authentication configuration
409
400
  host_entry += self._build_auth_config()
410
401
 
411
- # Add proxy command if requested
412
- if include_proxy:
413
- host_entry += f""" ProxyCommand {self._build_proxy_command()}
402
+ # Add ProxyCommand
403
+ host_entry += f""" ProxyCommand {self._build_proxy_command()}
404
+ """
405
+
406
+ # Add SSH multiplexing configuration
407
+ control_path = "~/.ssh/control/%r@%h:%p"
408
+ if platform.system() == 'Windows':
409
+ # Use forward slashes for Windows as well, SSH client will handle conversion
410
+ control_path = "~/.ssh/control/%r@%h:%p"
411
+
412
+ host_entry += f""" TCPKeepAlive yes
413
+ ControlMaster auto
414
+ ControlPath {control_path}
415
+ ControlPersist 4h
414
416
  """
415
417
 
416
418
  return host_entry
417
419
 
420
+ def _build_host_config(self, cloudx_env: str, hostname: str, instance_id: str) -> str:
421
+ """Build a minimal host configuration block that inherits from the environment.
422
+
423
+ Args:
424
+ cloudx_env: CloudX environment
425
+ hostname: Hostname for the instance
426
+ instance_id: EC2 instance ID
427
+
428
+ Returns:
429
+ str: Minimal host configuration block with only hostname
430
+ """
431
+ return f"""
432
+ Host cloudx-{cloudx_env}-{hostname}
433
+ HostName {instance_id}
434
+ """
435
+
418
436
  def _add_host_entry(self, cloudx_env: str, instance_id: str, hostname: str, current_config: str) -> bool:
419
437
  """Add settings to a specific host entry.
420
438
 
@@ -566,24 +584,13 @@ Host cloudx-{cloudx_env}-{host_pattern}
566
584
 
567
585
  # Build base configuration with wildcard hostname pattern
568
586
  # Start with a header comment
569
- base_config = "# cloudx-proxy SSH Configuration\n"
570
-
571
- # Add base host pattern with wildcard
572
- base_config += self._build_host_config(cloudx_env, None, None, include_proxy=True)
573
-
574
- # Add SSH multiplexing configuration
575
- control_path = "~/.ssh/control/%r@%h:%p"
576
- if platform.system() == 'Windows':
577
- # Use forward slashes for Windows as well, SSH client will handle conversion
578
- control_path = "~/.ssh/control/%r@%h:%p"
579
-
580
- base_config += f""" TCPKeepAlive yes
581
- ControlMaster auto
582
- ControlPath {control_path}
583
- ControlPersist 4h
584
-
587
+ base_config = """# cloudx-proxy SSH Configuration
588
+ # Environment configuration with settings applied to all hosts in this environment
585
589
  """
586
590
 
591
+ # Add environment-wide configuration with all common settings
592
+ base_config += self._build_environment_config(cloudx_env)
593
+
587
594
  # If file exists, append the new config, otherwise create it
588
595
  if self.ssh_config_file.exists():
589
596
  with open(self.ssh_config_file, 'a') as f:
@@ -598,9 +605,9 @@ Host cloudx-{cloudx_env}-{host_pattern}
598
605
  self.ssh_config_file.chmod(stat.S_IRUSR | stat.S_IWUSR) # 600 permissions (owner read/write)
599
606
  self.print_status("Set config file permissions to 600", True, 2)
600
607
 
601
- # Add specific host entry using the consolidated helper method
608
+ # Add specific host entry - only specifying the hostname
602
609
  self.print_status(f"Adding host entry for cloudx-{cloudx_env}-{hostname}", None, 2)
603
- host_entry = self._build_host_config(cloudx_env, hostname, instance_id, include_proxy=False)
610
+ host_entry = self._build_host_config(cloudx_env, hostname, instance_id)
604
611
  with open(self.ssh_config_file, 'a') as f:
605
612
  f.write(host_entry)
606
613
  self.print_status("Host entry added", True, 2)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: cloudx-proxy
3
- Version: 0.4.2
3
+ Version: 0.4.3
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
@@ -112,6 +112,15 @@ uvx cloudx-proxy setup --profile myprofile --ssh-key mykey
112
112
 
113
113
  # Setup with AWS environment
114
114
  uvx cloudx-proxy setup --aws-env prod
115
+
116
+ # Setup with custom SSH config location
117
+ uvx cloudx-proxy setup --ssh-config ~/.ssh/cloudx/config
118
+
119
+ # Setup with 1Password integration
120
+ uvx cloudx-proxy setup --1password
121
+
122
+ # Combine options
123
+ uvx cloudx-proxy setup --profile myprofile --ssh-key mykey --ssh-config ~/.ssh/cloudx/config --1password --aws-env prod
115
124
  ```
116
125
 
117
126
  The setup command will:
@@ -123,13 +132,16 @@ The setup command will:
123
132
 
124
133
  2. Manage SSH Keys:
125
134
  - Creates new SSH key pair if needed
126
- - Offers 1Password integration options:
127
- * Using 1Password SSH agent
128
- * Storing private key as 1Password document
135
+ - Fully supports 1Password integration:
136
+ * Using 1Password SSH agent via `--1password` flag
137
+ * Creates keys directly in 1Password's secure vault
138
+ * Only public keys are exported to the filesystem
139
+ * Follows SSH best practices using public keys to limit authentication attempts
129
140
 
130
141
  3. Configure SSH:
131
- - Creates ~/.ssh/vscode/config with proper settings
132
- - Sets up environment-specific configurations
142
+ - Creates SSH configs with proper settings (default: ~/.ssh/vscode/config)
143
+ - Custom config location can be specified with `--ssh-config`
144
+ - Sets up optimized environment-specific configurations
133
145
  - Configures ProxyCommand with all necessary parameters
134
146
  - Ensures main ~/.ssh/config includes the configuration
135
147
 
@@ -150,12 +162,18 @@ Will create a configuration like this:
150
162
 
151
163
  ```
152
164
  # Base environment config (created once per environment)
165
+ # Environment-wide configuration
153
166
  Host cloudx-dev-*
154
167
  User ec2-user
155
168
  IdentityFile ~/.ssh/vscode/mykey
169
+ IdentitiesOnly yes
156
170
  ProxyCommand uvx cloudx-proxy connect %h %p --profile myprofile --ssh-key mykey
171
+ TCPKeepAlive yes
172
+ ControlMaster auto
173
+ ControlPath ~/.ssh/control/%r@%h:%p
174
+ ControlPersist 4h
157
175
 
158
- # Host entry (added for specific instance)
176
+ # Minimal host entry (inherits all settings from environment config)
159
177
  Host cloudx-dev-myserver
160
178
  HostName i-0123456789abcdef0
161
179
  ```
@@ -173,17 +191,19 @@ In these examples, ssh will use cloudx-proxy to connect to AWS with the `myprofi
173
191
  VSCode will be able to connect to the instance using the same SSH configuration.
174
192
 
175
193
  ### SSH Configuration Details
176
- The setup command creates:
194
+ The setup command creates an optimized SSH configuration structure:
177
195
 
178
196
  1. A base configuration for each environment (cloudx-{env}-*) with:
179
197
  - User and key settings
180
- - 1Password integration if selected
198
+ - 1Password SSH agent integration if selected
181
199
  - ProxyCommand with appropriate parameters
200
+ - SSH multiplexing for better performance
201
+ - TCP keepalive for connection stability
182
202
 
183
- 2. Individual host entries for each instance:
203
+ 2. Minimal host entries for each instance:
184
204
  - Uses consistent naming (cloudx-{env}-hostname)
185
- - Maps to instance IDs automatically
186
- - Inherits environment-level settings
205
+ - Only contains the HostName directive for the instance ID
206
+ - Inherits all environment-level settings automatically
187
207
 
188
208
  When adding new instances to an existing environment, you can choose to:
189
209
  - Override the environment configuration with new settings
@@ -211,7 +231,9 @@ uvx cloudx-proxy setup [OPTIONS]
211
231
 
212
232
  Options:
213
233
  - `--profile` (default: vscode): AWS profile to use. The profile's IAM user should follow the format cloudX-{env}-{user}. The environment part will be used as the default environment during setup.
214
- - `--ssh-key` (default: vscode): Name of the SSH key to create/use. The key will be stored in ~/.ssh/vscode/{name}. This same name can be used in the connect command.
234
+ - `--ssh-key` (default: vscode): Name of the SSH key to create/use. The key will be stored in the SSH config directory. This same name can be used in the connect command.
235
+ - `--ssh-config` (optional): Path to the SSH config file to use. If specified, configuration and keys will be stored in this location. Default is ~/.ssh/vscode/config.
236
+ - `--1password` (flag): Enable 1Password SSH agent integration. Creates keys directly in 1Password and configures SSH to use the 1Password SSH agent.
215
237
  - `--aws-env` (optional): AWS environment directory to use. If specified, AWS configuration and credentials will be read from ~/.aws/aws-envs/{env}/.
216
238
 
217
239
  Example usage:
@@ -222,8 +244,11 @@ uvx cloudx-proxy setup
222
244
  # Setup with custom profile and key
223
245
  uvx cloudx-proxy setup --profile myprofile --ssh-key mykey
224
246
 
225
- # Setup with AWS environment
226
- uvx cloudx-proxy setup --profile myprofile --aws-env prod
247
+ # Setup with custom SSH config and 1Password integration
248
+ uvx cloudx-proxy setup --ssh-config ~/.ssh/cloudx/config --1password
249
+
250
+ # Complete setup with all options
251
+ uvx cloudx-proxy setup --profile myprofile --ssh-key mykey --ssh-config ~/.ssh/cloudx/config --1password --aws-env prod
227
252
  ```
228
253
 
229
254
  #### Connect Command
@@ -238,6 +263,7 @@ Arguments:
238
263
  Options:
239
264
  - `--profile` (default: vscode): AWS profile to use. Should match the profile used in setup.
240
265
  - `--ssh-key` (default: vscode): Name of the SSH key to use. Should match the key name used in setup.
266
+ - `--ssh-config` (optional): Path to the SSH config file to use. If provided during setup, should match here.
241
267
  - `--region` (optional): AWS region to use. If not specified, uses the region from the AWS profile.
242
268
  - `--aws-env` (optional): AWS environment directory to use. Should match the environment used in setup.
243
269
 
@@ -303,12 +329,17 @@ These permissions are required to bootstrap the instance, so that after creation
303
329
  - Check that your AWS credentials have the required permissions
304
330
  - Verify the instance ID is correct
305
331
  - Increase the VSCode SSH timeout if needed
332
+ - Check if the instance is starting up (can take several minutes)
306
333
 
307
334
  3. **SSH Key Issues**
308
335
  - If using 1Password SSH agent, verify agent is running (~/.1password/agent.sock exists)
309
336
  - Check file permissions (600 for private key, 644 for public key)
310
337
  - Verify the public key is being successfully pushed to the instance
311
- - For stored keys in 1Password, ensure you can access them via the CLI
338
+ - For 1Password-managed keys, make sure:
339
+ * 1Password CLI is installed and authenticated (`op account list` works)
340
+ * SSH agent is enabled in 1Password settings
341
+ * Keys are added to the SSH agent in 1Password
342
+ * The key is visible with `op item list --categories "SSH Key"`
312
343
 
313
344
  4. **AWS Configuration**
314
345
  - Confirm AWS CLI is configured with valid credentials
@@ -0,0 +1,12 @@
1
+ cloudx_proxy/_1password.py,sha256=uxyCfVvO1eQrOfYRojst_LN2DV4fIwxM5moaQTn3wQY,5853
2
+ cloudx_proxy/__init__.py,sha256=ZZ2O_m9OFJm18AxMSuYJt4UjSuSqyJlYRaZMoets498,61
3
+ cloudx_proxy/_version.py,sha256=zJwW9_MgFPmVYNh3YnSsdJ4y2EqGvu1bzYeID1Rrd0A,511
4
+ cloudx_proxy/cli.py,sha256=kdrZydxL94BJrv6NnjIcceRqhoonBzMIx4vfm1Wl7qc,4104
5
+ cloudx_proxy/core.py,sha256=RF3bX5MQiokRKjYEPnfWdKywGdtoVUvV2xZqm9uOl1g,8135
6
+ cloudx_proxy/setup.py,sha256=MBjeoyDs_KhENxifZbIpG1u016af-sJhq18tCUM6EmI,33402
7
+ cloudx_proxy-0.4.3.dist-info/LICENSE,sha256=i7P2OR4zsJYsMWcCUDe_B9ZfGi9bU0K5I2nKfDrW_N8,1068
8
+ cloudx_proxy-0.4.3.dist-info/METADATA,sha256=6GHrg_AaK1C9_hwyVfx7Sr1ihORwQ9r8d_b1N5jPXr4,15893
9
+ cloudx_proxy-0.4.3.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
10
+ cloudx_proxy-0.4.3.dist-info/entry_points.txt,sha256=HGt743N2lVlKd7O1qWq3C0aEHyS5PjPnxzDHh7hwtSg,54
11
+ cloudx_proxy-0.4.3.dist-info/top_level.txt,sha256=2wtEote1db21j-VvkCJFfT-dLlauuG5indjggYh3xDg,13
12
+ cloudx_proxy-0.4.3.dist-info/RECORD,,
@@ -1,12 +0,0 @@
1
- cloudx_proxy/_1password.py,sha256=uxyCfVvO1eQrOfYRojst_LN2DV4fIwxM5moaQTn3wQY,5853
2
- cloudx_proxy/__init__.py,sha256=ZZ2O_m9OFJm18AxMSuYJt4UjSuSqyJlYRaZMoets498,61
3
- cloudx_proxy/_version.py,sha256=_F8vLxUxrAtC2alXNPGVa9l3P6_vLpQAzemS6QlnPGQ,511
4
- cloudx_proxy/cli.py,sha256=kdrZydxL94BJrv6NnjIcceRqhoonBzMIx4vfm1Wl7qc,4104
5
- cloudx_proxy/core.py,sha256=RF3bX5MQiokRKjYEPnfWdKywGdtoVUvV2xZqm9uOl1g,8135
6
- cloudx_proxy/setup.py,sha256=jvv7ibJQ8svyjYYeVKwGa70L7RV2W7yS7JXEvKed3wI,33339
7
- cloudx_proxy-0.4.2.dist-info/LICENSE,sha256=i7P2OR4zsJYsMWcCUDe_B9ZfGi9bU0K5I2nKfDrW_N8,1068
8
- cloudx_proxy-0.4.2.dist-info/METADATA,sha256=YAHtMfsqZ1aDk1FryZhgV-Q_vr4GcdBO_mzs-gbEpK8,14037
9
- cloudx_proxy-0.4.2.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
10
- cloudx_proxy-0.4.2.dist-info/entry_points.txt,sha256=HGt743N2lVlKd7O1qWq3C0aEHyS5PjPnxzDHh7hwtSg,54
11
- cloudx_proxy-0.4.2.dist-info/top_level.txt,sha256=2wtEote1db21j-VvkCJFfT-dLlauuG5indjggYh3xDg,13
12
- cloudx_proxy-0.4.2.dist-info/RECORD,,