cloudx-proxy 0.3.4__py3-none-any.whl → 0.3.6__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 +2 -2
- cloudx_proxy/setup.py +65 -29
- {cloudx_proxy-0.3.4.dist-info → cloudx_proxy-0.3.6.dist-info}/METADATA +1 -1
- cloudx_proxy-0.3.6.dist-info/RECORD +11 -0
- cloudx_proxy-0.3.4.dist-info/RECORD +0 -11
- {cloudx_proxy-0.3.4.dist-info → cloudx_proxy-0.3.6.dist-info}/LICENSE +0 -0
- {cloudx_proxy-0.3.4.dist-info → cloudx_proxy-0.3.6.dist-info}/WHEEL +0 -0
- {cloudx_proxy-0.3.4.dist-info → cloudx_proxy-0.3.6.dist-info}/entry_points.txt +0 -0
- {cloudx_proxy-0.3.4.dist-info → cloudx_proxy-0.3.6.dist-info}/top_level.txt +0 -0
cloudx_proxy/_version.py
CHANGED
cloudx_proxy/setup.py
CHANGED
@@ -2,6 +2,7 @@ import os
|
|
2
2
|
import time
|
3
3
|
import json
|
4
4
|
import subprocess
|
5
|
+
import platform
|
5
6
|
from pathlib import Path
|
6
7
|
from typing import Optional, Tuple
|
7
8
|
import boto3
|
@@ -142,16 +143,17 @@ class CloudXSetup:
|
|
142
143
|
|
143
144
|
if key_exists:
|
144
145
|
self.print_status(f"SSH key '{self.ssh_key}' exists", True, 2)
|
145
|
-
|
146
|
-
|
147
|
-
self.
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
if
|
152
|
-
self.
|
153
|
-
|
154
|
-
|
146
|
+
if platform.system() != 'Windows':
|
147
|
+
self.using_1password = self.prompt("Would you like to use 1Password SSH agent?", "N").lower() == 'y'
|
148
|
+
if self.using_1password:
|
149
|
+
self.print_status("Using 1Password SSH agent", True, 2)
|
150
|
+
else:
|
151
|
+
store_in_1password = self.prompt("Would you like to store the private key in 1Password?", "N").lower() == 'y'
|
152
|
+
if store_in_1password:
|
153
|
+
if self._store_key_in_1password():
|
154
|
+
self.print_status("Private key stored in 1Password", True, 2)
|
155
|
+
else:
|
156
|
+
self.print_status("Failed to store private key in 1Password", False, 2)
|
155
157
|
else:
|
156
158
|
self.print_status(f"Generating new SSH key '{self.ssh_key}'...", None, 2)
|
157
159
|
subprocess.run([
|
@@ -162,16 +164,17 @@ class CloudXSetup:
|
|
162
164
|
], check=True)
|
163
165
|
self.print_status("SSH key generated", True, 2)
|
164
166
|
|
165
|
-
|
166
|
-
|
167
|
-
self.
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
if
|
172
|
-
self.
|
173
|
-
|
174
|
-
|
167
|
+
if platform.system() != 'Windows':
|
168
|
+
self.using_1password = self.prompt("Would you like to use 1Password SSH agent?", "N").lower() == 'y'
|
169
|
+
if self.using_1password:
|
170
|
+
self.print_status("Using 1Password SSH agent", True, 2)
|
171
|
+
else:
|
172
|
+
store_in_1password = self.prompt("Would you like to store the private key in 1Password?", "N").lower() == 'y'
|
173
|
+
if store_in_1password:
|
174
|
+
if self._store_key_in_1password():
|
175
|
+
self.print_status("Private key stored in 1Password", True, 2)
|
176
|
+
else:
|
177
|
+
self.print_status("Failed to store private key in 1Password", False, 2)
|
175
178
|
|
176
179
|
return True
|
177
180
|
|
@@ -190,13 +193,32 @@ class CloudXSetup:
|
|
190
193
|
bool: True if key was stored successfully
|
191
194
|
"""
|
192
195
|
try:
|
196
|
+
# Check if 1Password CLI is available
|
193
197
|
subprocess.run(['op', '--version'], check=True, capture_output=True)
|
194
|
-
|
198
|
+
|
199
|
+
# Check if 1Password SSH agent is running
|
200
|
+
agent_sock = Path.home() / ".1password" / "agent.sock"
|
201
|
+
if platform.system() == 'Darwin':
|
202
|
+
agent_sock = Path.home() / "Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock"
|
203
|
+
|
204
|
+
if not agent_sock.exists():
|
205
|
+
self.print_status("1Password SSH agent not running. Please enable it in 1Password settings.", False, 2)
|
206
|
+
return False
|
207
|
+
|
208
|
+
# Read private key content
|
209
|
+
with open(self.ssh_key_file, 'r') as f:
|
210
|
+
private_key = f.read()
|
211
|
+
|
212
|
+
# Store private key in 1Password as document
|
195
213
|
subprocess.run([
|
196
214
|
'op', 'document', 'create',
|
197
|
-
|
198
|
-
|
199
|
-
|
215
|
+
'--title', f'cloudx-proxy SSH Key - {self.ssh_key}',
|
216
|
+
], input=private_key.encode(), check=True)
|
217
|
+
|
218
|
+
# Remove private key file but keep public key
|
219
|
+
os.remove(self.ssh_key_file)
|
220
|
+
self.print_status("Private key stored in 1Password and removed from disk", True, 2)
|
221
|
+
self.print_status("Please import the key into 1Password SSH agent through the desktop app", True, 2)
|
200
222
|
return True
|
201
223
|
except subprocess.CalledProcessError:
|
202
224
|
print("Error: 1Password CLI not installed or not signed in.")
|
@@ -229,13 +251,19 @@ Host cloudx-{cloudx_env}-{hostname}
|
|
229
251
|
HostName {instance_id}
|
230
252
|
User ec2-user
|
231
253
|
"""
|
232
|
-
if self.using_1password:
|
233
|
-
|
254
|
+
if self.using_1password and platform.system() != 'Windows':
|
255
|
+
# Use platform-specific agent socket path
|
256
|
+
if platform.system() == 'Darwin': # macOS
|
257
|
+
agent_sock = "~/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock"
|
258
|
+
else: # Linux
|
259
|
+
agent_sock = "~/.1password/agent.sock"
|
260
|
+
host_entry += f""" IdentityAgent {agent_sock}
|
234
261
|
IdentityFile {self.ssh_key_file}.pub
|
235
262
|
IdentitiesOnly yes
|
236
263
|
"""
|
237
264
|
else:
|
238
265
|
host_entry += f""" IdentityFile {self.ssh_key_file}
|
266
|
+
IdentitiesOnly yes
|
239
267
|
"""
|
240
268
|
host_entry += f""" ProxyCommand {proxy_command}
|
241
269
|
"""
|
@@ -343,14 +371,22 @@ Host cloudx-{cloudx_env}-{hostname}
|
|
343
371
|
Host cloudx-{cloudx_env}-*
|
344
372
|
User ec2-user
|
345
373
|
"""
|
346
|
-
# Add
|
347
|
-
if self.using_1password:
|
348
|
-
|
374
|
+
# Add key configuration
|
375
|
+
if self.using_1password and platform.system() != 'Windows':
|
376
|
+
# Use platform-specific agent socket path
|
377
|
+
if platform.system() == 'Darwin': # macOS
|
378
|
+
agent_sock = "~/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock"
|
379
|
+
else: # Linux
|
380
|
+
agent_sock = "~/.1password/agent.sock"
|
381
|
+
base_config += f""" IdentityAgent {agent_sock}
|
349
382
|
IdentityFile {self.ssh_key_file}.pub
|
350
383
|
IdentitiesOnly yes
|
384
|
+
|
351
385
|
"""
|
352
386
|
else:
|
353
387
|
base_config += f""" IdentityFile {self.ssh_key_file}
|
388
|
+
IdentitiesOnly yes
|
389
|
+
|
354
390
|
"""
|
355
391
|
# Add ProxyCommand
|
356
392
|
base_config += f""" ProxyCommand {proxy_command}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
cloudx_proxy/__init__.py,sha256=ZZ2O_m9OFJm18AxMSuYJt4UjSuSqyJlYRaZMoets498,61
|
2
|
+
cloudx_proxy/_version.py,sha256=IKAQ4gPrCQ2FWMXOFRqouULC2EQI1zCb4iXHsnfbmTQ,411
|
3
|
+
cloudx_proxy/cli.py,sha256=Ph-m8lDsdU2zZab9Y6YgBBzd_UDouBnfNrYFFx0bI_E,3426
|
4
|
+
cloudx_proxy/core.py,sha256=WjKoqMmmnt6e_4JMeq4gTka75JAvQcMUs9r9XUBLmFE,7289
|
5
|
+
cloudx_proxy/setup.py,sha256=3Kz-VWid0EL4rIEyf30UuLEe3Rvo1Mn8rKIa5WnysFE,24378
|
6
|
+
cloudx_proxy-0.3.6.dist-info/LICENSE,sha256=i7P2OR4zsJYsMWcCUDe_B9ZfGi9bU0K5I2nKfDrW_N8,1068
|
7
|
+
cloudx_proxy-0.3.6.dist-info/METADATA,sha256=KwikAp1MVPQDaSABlt8esDM9448EIRgMitb394SH4JM,14037
|
8
|
+
cloudx_proxy-0.3.6.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
9
|
+
cloudx_proxy-0.3.6.dist-info/entry_points.txt,sha256=HGt743N2lVlKd7O1qWq3C0aEHyS5PjPnxzDHh7hwtSg,54
|
10
|
+
cloudx_proxy-0.3.6.dist-info/top_level.txt,sha256=2wtEote1db21j-VvkCJFfT-dLlauuG5indjggYh3xDg,13
|
11
|
+
cloudx_proxy-0.3.6.dist-info/RECORD,,
|
@@ -1,11 +0,0 @@
|
|
1
|
-
cloudx_proxy/__init__.py,sha256=ZZ2O_m9OFJm18AxMSuYJt4UjSuSqyJlYRaZMoets498,61
|
2
|
-
cloudx_proxy/_version.py,sha256=gK2CDe_mbvAwKw5ZjOIg75LuB0kCZ4LyDYjtXPapvJw,411
|
3
|
-
cloudx_proxy/cli.py,sha256=Ph-m8lDsdU2zZab9Y6YgBBzd_UDouBnfNrYFFx0bI_E,3426
|
4
|
-
cloudx_proxy/core.py,sha256=WjKoqMmmnt6e_4JMeq4gTka75JAvQcMUs9r9XUBLmFE,7289
|
5
|
-
cloudx_proxy/setup.py,sha256=Y8YYMJ47fb57FAr6llQaFGuVOQ-fstYEg_Pdv5uCd-A,22486
|
6
|
-
cloudx_proxy-0.3.4.dist-info/LICENSE,sha256=i7P2OR4zsJYsMWcCUDe_B9ZfGi9bU0K5I2nKfDrW_N8,1068
|
7
|
-
cloudx_proxy-0.3.4.dist-info/METADATA,sha256=WAcs0mWx3clQqk-1oNNk9Jqu2hBrlbWG6Ujr5n5lDhU,14037
|
8
|
-
cloudx_proxy-0.3.4.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
9
|
-
cloudx_proxy-0.3.4.dist-info/entry_points.txt,sha256=HGt743N2lVlKd7O1qWq3C0aEHyS5PjPnxzDHh7hwtSg,54
|
10
|
-
cloudx_proxy-0.3.4.dist-info/top_level.txt,sha256=2wtEote1db21j-VvkCJFfT-dLlauuG5indjggYh3xDg,13
|
11
|
-
cloudx_proxy-0.3.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|