-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathssh.py
More file actions
32 lines (23 loc) · 841 Bytes
/
ssh.py
File metadata and controls
32 lines (23 loc) · 841 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from __future__ import annotations
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "src"))
from leap0 import Leap0Client, Sandbox, SshAccess, SshValidation
def main() -> None:
client = Leap0Client()
sandbox: Sandbox = client.sandboxes.create()
try:
access: SshAccess = sandbox.ssh.create_access()
print("ssh command:", access.ssh_command)
validation: SshValidation = sandbox.ssh.validate_access(
id=access.id,
password=access.password,
)
print("ssh valid:", validation.valid)
rotated: SshAccess = sandbox.ssh.regenerate_access(id=access.id)
print("rotated ssh command:", rotated.ssh_command)
finally:
sandbox.delete()
client.close()
if __name__ == "__main__":
main()