zscams 2.0.11__tar.gz → 2.0.12__tar.gz
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.
- {zscams-2.0.11 → zscams-2.0.12}/PKG-INFO +1 -1
- {zscams-2.0.11 → zscams-2.0.12}/pyproject.toml +1 -1
- {zscams-2.0.11 → zscams-2.0.12}/zscams/agent/src/support/configuration.py +17 -8
- {zscams-2.0.11 → zscams-2.0.12}/README.md +0 -0
- {zscams-2.0.11 → zscams-2.0.12}/zscams/__init__.py +0 -0
- {zscams-2.0.11 → zscams-2.0.12}/zscams/__main__.py +0 -0
- {zscams-2.0.11 → zscams-2.0.12}/zscams/agent/__init__.py +0 -0
- {zscams-2.0.11 → zscams-2.0.12}/zscams/agent/certificates/.gitkeep +0 -0
- {zscams-2.0.11 → zscams-2.0.12}/zscams/agent/configuration/config.j2 +0 -0
- {zscams-2.0.11 → zscams-2.0.12}/zscams/agent/configuration/freebsd_service.j2 +0 -0
- {zscams-2.0.11 → zscams-2.0.12}/zscams/agent/configuration/linux_service.j2 +0 -0
- {zscams-2.0.11 → zscams-2.0.12}/zscams/agent/keys/autoport.key +0 -0
- {zscams-2.0.11 → zscams-2.0.12}/zscams/agent/src/__init__.py +0 -0
- {zscams-2.0.11 → zscams-2.0.12}/zscams/agent/src/core/__init__.py +0 -0
- {zscams-2.0.11 → zscams-2.0.12}/zscams/agent/src/core/backend/bootstrap.py +0 -0
- {zscams-2.0.11 → zscams-2.0.12}/zscams/agent/src/core/backend/client.py +0 -0
- {zscams-2.0.11 → zscams-2.0.12}/zscams/agent/src/core/backend/exceptions.py +0 -0
- {zscams-2.0.11 → zscams-2.0.12}/zscams/agent/src/core/backend/unbootstrap.py +0 -0
- {zscams-2.0.11 → zscams-2.0.12}/zscams/agent/src/core/backend/update_machine_info.py +0 -0
- {zscams-2.0.11 → zscams-2.0.12}/zscams/agent/src/core/prerequisites.py +0 -0
- {zscams-2.0.11 → zscams-2.0.12}/zscams/agent/src/core/service_health_check.py +0 -0
- {zscams-2.0.11 → zscams-2.0.12}/zscams/agent/src/core/services.py +0 -0
- {zscams-2.0.11 → zscams-2.0.12}/zscams/agent/src/core/tunnel/__init__.py +0 -0
- {zscams-2.0.11 → zscams-2.0.12}/zscams/agent/src/core/tunnel/tls.py +0 -0
- {zscams-2.0.11 → zscams-2.0.12}/zscams/agent/src/core/tunnels.py +0 -0
- {zscams-2.0.11 → zscams-2.0.12}/zscams/agent/src/services/__init__.py +0 -0
- {zscams-2.0.11 → zscams-2.0.12}/zscams/agent/src/services/reverse_ssh.py +0 -0
- {zscams-2.0.11 → zscams-2.0.12}/zscams/agent/src/services/ssh_forwarder.py +0 -0
- {zscams-2.0.11 → zscams-2.0.12}/zscams/agent/src/services/system_monitor.py +0 -0
- {zscams-2.0.11 → zscams-2.0.12}/zscams/agent/src/support/__init__.py +0 -0
- {zscams-2.0.11 → zscams-2.0.12}/zscams/agent/src/support/cli.py +0 -0
- {zscams-2.0.11 → zscams-2.0.12}/zscams/agent/src/support/filesystem.py +0 -0
- {zscams-2.0.11 → zscams-2.0.12}/zscams/agent/src/support/logger.py +0 -0
- {zscams-2.0.11 → zscams-2.0.12}/zscams/agent/src/support/mac.py +0 -0
- {zscams-2.0.11 → zscams-2.0.12}/zscams/agent/src/support/network.py +0 -0
- {zscams-2.0.11 → zscams-2.0.12}/zscams/agent/src/support/openssl.py +0 -0
- {zscams-2.0.11 → zscams-2.0.12}/zscams/agent/src/support/os.py +0 -0
- {zscams-2.0.11 → zscams-2.0.12}/zscams/agent/src/support/ssh.py +0 -0
- {zscams-2.0.11 → zscams-2.0.12}/zscams/agent/src/support/yaml.py +0 -0
- {zscams-2.0.11 → zscams-2.0.12}/zscams/deps.py +0 -0
|
@@ -3,7 +3,7 @@ name = "zscams_agent"
|
|
|
3
3
|
|
|
4
4
|
[tool.poetry]
|
|
5
5
|
name = "zscams"
|
|
6
|
-
version = "2.0.
|
|
6
|
+
version = "2.0.12"
|
|
7
7
|
description = "Async TLS tunnel client with SNI routing, auto-reconnect, and health checks"
|
|
8
8
|
authors = ["OCD - Cairo Software Team"]
|
|
9
9
|
maintainers = ["OCD - Cairo Software Team"]
|
|
@@ -3,8 +3,9 @@ Configuration loader module
|
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
5
|
import os
|
|
6
|
+
import sys
|
|
6
7
|
from pathlib import Path
|
|
7
|
-
from typing import Optional, Type, TypedDict, cast
|
|
8
|
+
from typing import Optional, Type, TypeVar, TypedDict, cast
|
|
8
9
|
import yaml
|
|
9
10
|
|
|
10
11
|
import zscams
|
|
@@ -13,6 +14,8 @@ from zscams.agent.src.support.yaml import YamlIndentedListsDumper, resolve_place
|
|
|
13
14
|
ROOT_PATH = Path(zscams.__file__).resolve().parent.joinpath("agent")
|
|
14
15
|
CONFIG_PATH = os.path.join(ROOT_PATH.absolute(), "config.yaml")
|
|
15
16
|
|
|
17
|
+
GetReturnT = TypeVar("T")
|
|
18
|
+
|
|
16
19
|
|
|
17
20
|
class MissingConfiguration(BaseException):
|
|
18
21
|
"""Error when the requisted key is not found"""
|
|
@@ -33,8 +36,14 @@ class Configuration:
|
|
|
33
36
|
return cls.__instance
|
|
34
37
|
|
|
35
38
|
def __load_config(self):
|
|
36
|
-
|
|
37
|
-
|
|
39
|
+
try:
|
|
40
|
+
with open(CONFIG_PATH, "r", encoding="utf-8") as f:
|
|
41
|
+
self.__config = yaml.safe_load(f)
|
|
42
|
+
except FileNotFoundError:
|
|
43
|
+
print(
|
|
44
|
+
f"Can't find configurations file. Make sure you have it by running `cp '{ROOT_PATH.joinpath('configuration/config.j2')}' '{CONFIG_PATH}'`",
|
|
45
|
+
)
|
|
46
|
+
sys.exit(1)
|
|
38
47
|
|
|
39
48
|
def override_config(self, new_config: dict):
|
|
40
49
|
"""
|
|
@@ -56,13 +65,13 @@ class Configuration:
|
|
|
56
65
|
def to_dict(self):
|
|
57
66
|
return self.__config
|
|
58
67
|
|
|
59
|
-
def get
|
|
68
|
+
def get(
|
|
60
69
|
self,
|
|
61
70
|
key: str,
|
|
62
|
-
default: Optional[
|
|
71
|
+
default: Optional[GetReturnT] = None,
|
|
63
72
|
must_resolve=False,
|
|
64
|
-
valtyp: Type[
|
|
65
|
-
) ->
|
|
73
|
+
valtyp: Type[GetReturnT] = str,
|
|
74
|
+
) -> GetReturnT:
|
|
66
75
|
"""
|
|
67
76
|
Returns the configuration value.
|
|
68
77
|
|
|
@@ -90,7 +99,7 @@ class Configuration:
|
|
|
90
99
|
val = None
|
|
91
100
|
break
|
|
92
101
|
|
|
93
|
-
return cast(
|
|
102
|
+
return cast(GetReturnT, val)
|
|
94
103
|
|
|
95
104
|
def has(self, key: str):
|
|
96
105
|
try:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|