zscams 2.0.5__py3-none-any.whl → 2.0.7__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.
- zscams/agent/config.yaml +1 -1
- zscams/agent/configuration/config.j2 +2 -2
- zscams/agent/configuration/freebsd_service.j2 +20 -0
- zscams/agent/configuration/{service.j2 → linux_service.j2} +1 -0
- zscams/agent/src/core/backend/bootstrap.py +4 -3
- zscams/agent/src/core/prerequisites.py +4 -1
- zscams/agent/src/services/reverse_ssh.py +4 -2
- zscams/agent/src/services/ssh_forwarder.py +4 -2
- zscams/agent/src/support/filesystem.py +8 -3
- zscams/deps.py +13 -1
- {zscams-2.0.5.dist-info → zscams-2.0.7.dist-info}/METADATA +1 -4
- {zscams-2.0.5.dist-info → zscams-2.0.7.dist-info}/RECORD +14 -13
- {zscams-2.0.5.dist-info → zscams-2.0.7.dist-info}/WHEEL +0 -0
- {zscams-2.0.5.dist-info → zscams-2.0.7.dist-info}/entry_points.txt +0 -0
zscams/agent/config.yaml
CHANGED
|
@@ -39,7 +39,7 @@ services:
|
|
|
39
39
|
custom_port_name: "reverse_port"
|
|
40
40
|
params:
|
|
41
41
|
local_port: 4422
|
|
42
|
-
private_key:
|
|
42
|
+
private_key: keys/autoport.key
|
|
43
43
|
remote_host: localhost
|
|
44
44
|
reverse_port: "{reverse_port}"
|
|
45
45
|
server_ssh_user: ssh_user
|
|
@@ -52,7 +52,7 @@ services:
|
|
|
52
52
|
port: 22
|
|
53
53
|
prerequisites:
|
|
54
54
|
files:
|
|
55
|
-
-
|
|
55
|
+
- keys/autoport.key
|
|
56
56
|
ports:
|
|
57
57
|
- 22
|
|
58
58
|
services: []
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
|
|
3
|
+
# PROVIDE: zscams
|
|
4
|
+
# REQUIRE: NETWORKING
|
|
5
|
+
# KEYWORD: shutdown
|
|
6
|
+
|
|
7
|
+
. /etc/rc.subr
|
|
8
|
+
|
|
9
|
+
name="zscams"
|
|
10
|
+
rcvar="zscams_enable"
|
|
11
|
+
|
|
12
|
+
# Execution command and arguments
|
|
13
|
+
command="{ python_exec }"
|
|
14
|
+
command_args="-m zscams"
|
|
15
|
+
|
|
16
|
+
# User to run the process
|
|
17
|
+
zscams_user="{user_to_run_as}"
|
|
18
|
+
|
|
19
|
+
load_rc_config $name
|
|
20
|
+
run_rc_command "$1"
|
|
@@ -6,7 +6,7 @@ from typing import cast
|
|
|
6
6
|
from zscams.agent.src.core.backend.client import backend_client
|
|
7
7
|
from zscams.agent.src.support.configuration import reinitialize
|
|
8
8
|
from zscams.agent.src.support.logger import get_logger
|
|
9
|
-
from zscams.agent.src.support.os import create_system_user, install_service
|
|
9
|
+
from zscams.agent.src.support.os import create_system_user, install_service, is_freebsd
|
|
10
10
|
from zscams.agent.src.support.ssh import add_to_authorized_keys
|
|
11
11
|
from zscams.agent.src.support.cli import prompt
|
|
12
12
|
|
|
@@ -67,10 +67,11 @@ def install_zscams_systemd_service(user_to_run_as: str):
|
|
|
67
67
|
import zscams
|
|
68
68
|
|
|
69
69
|
BASE_DIR = Path(zscams.__file__).resolve().parent
|
|
70
|
-
|
|
70
|
+
filename = "linux_service.j2" if is_freebsd() else "freebsd_service.j2"
|
|
71
|
+
template_path = f"{BASE_DIR}/agent/configuration/{filename}.j2"
|
|
71
72
|
with open(template_path) as f:
|
|
72
73
|
template = f.read()
|
|
73
74
|
|
|
74
75
|
rendered_config = template.format(**data)
|
|
75
76
|
|
|
76
|
-
install_service("zscams.service", rendered_config)
|
|
77
|
+
install_service("zscams" if is_freebsd() else "zscams.service", rendered_config)
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import os
|
|
1
2
|
from zscams.agent.src.support.logger import get_logger
|
|
2
3
|
from zscams.agent.src.support.filesystem import is_file_exists
|
|
3
4
|
from zscams.agent.src.core import running_services
|
|
4
5
|
from zscams.agent.src.support.network import is_port_open, is_service_running
|
|
6
|
+
from zscams.agent.src.support.configuration import CONFIG_PATH
|
|
5
7
|
|
|
6
8
|
logger = get_logger("service_prerequisites")
|
|
9
|
+
config_dir = os.path.dirname(CONFIG_PATH)
|
|
7
10
|
|
|
8
11
|
|
|
9
12
|
def check_prerequisites(prereqs: dict) -> bool:
|
|
@@ -18,7 +21,7 @@ def check_prerequisites(prereqs: dict) -> bool:
|
|
|
18
21
|
|
|
19
22
|
# Check file prerequisites
|
|
20
23
|
for path in prereqs.get("files", []):
|
|
21
|
-
results.append(is_file_exists(path, logger))
|
|
24
|
+
results.append(is_file_exists(path, logger, config_dir))
|
|
22
25
|
|
|
23
26
|
# Check port prerequisites
|
|
24
27
|
for port in prereqs.get("ports", []):
|
|
@@ -3,6 +3,8 @@ import json
|
|
|
3
3
|
import os
|
|
4
4
|
import sys
|
|
5
5
|
from zscams.agent.src.support.logger import get_logger
|
|
6
|
+
from zscams.agent.src.support.filesystem import resolve_path
|
|
7
|
+
from zscams.agent.src.support.configuration import CONFIG_PATH
|
|
6
8
|
|
|
7
9
|
logger = get_logger("autossh_service")
|
|
8
10
|
|
|
@@ -13,11 +15,11 @@ if not params_env:
|
|
|
13
15
|
sys.exit(1)
|
|
14
16
|
|
|
15
17
|
params = json.loads(params_env)
|
|
16
|
-
|
|
18
|
+
config_dir = os.path.dirname(CONFIG_PATH)
|
|
17
19
|
LOCAL_PORT = params.get("local_port", 4422)
|
|
18
20
|
SERVER_SSH_USER = params.get("server_ssh_user", "ssh_user")
|
|
19
21
|
REVERSE_PORT = params.get("reverse_port", 2222)
|
|
20
|
-
PRIVATE_KEY = params.get("private_key") # Path to RSA key
|
|
22
|
+
PRIVATE_KEY = resolve_path(params.get("private_key"), config_dir) # Path to RSA key
|
|
21
23
|
SSH_OPTIONS = params.get("ssh_options", [])
|
|
22
24
|
CHECK_INTERVAL = 120 #
|
|
23
25
|
|
|
@@ -3,6 +3,8 @@ import json
|
|
|
3
3
|
import os
|
|
4
4
|
import sys
|
|
5
5
|
from zscams.agent.src.support.logger import get_logger
|
|
6
|
+
from zscams.agent.src.support.filesystem import resolve_path
|
|
7
|
+
from zscams.agent.src.support.configuration import CONFIG_PATH
|
|
6
8
|
|
|
7
9
|
logger = get_logger("autossh_service")
|
|
8
10
|
|
|
@@ -13,13 +15,13 @@ if not params_env:
|
|
|
13
15
|
sys.exit(1)
|
|
14
16
|
|
|
15
17
|
params = json.loads(params_env)
|
|
16
|
-
|
|
18
|
+
config_dir = os.path.dirname(CONFIG_PATH)
|
|
17
19
|
FORWARDER_PORT = params.get("forwarder_port", 4422)
|
|
18
20
|
LOCAL_PORT = params.get("local_port", 4422)
|
|
19
21
|
REMOTE_PORT = params.get("remote_port", 4422)
|
|
20
22
|
REMOTE_HOST = params.get("remote_host", "localhost")
|
|
21
23
|
SERVER_SSH_USER = params.get("server_ssh_user", "ssh_user")
|
|
22
|
-
PRIVATE_KEY = params.get("private_key") # Path to RSA key
|
|
24
|
+
PRIVATE_KEY = resolve_path(params.get("private_key"), config_dir) # Path to RSA key
|
|
23
25
|
SSH_OPTIONS = params.get("ssh_options", [])
|
|
24
26
|
CHECK_INTERVAL = 120 #
|
|
25
27
|
|
|
@@ -9,6 +9,7 @@ from zscams.agent.src.support.logger import get_logger
|
|
|
9
9
|
|
|
10
10
|
logger = get_logger("FileSystem")
|
|
11
11
|
|
|
12
|
+
|
|
12
13
|
def resolve_path(path: Optional[str], base_dir: Optional[str] = None) -> Optional[str]:
|
|
13
14
|
"""
|
|
14
15
|
Resolve a file path relative to a base directory.
|
|
@@ -34,9 +35,12 @@ def ensure_dir(path: str):
|
|
|
34
35
|
os.makedirs(path, exist_ok=True)
|
|
35
36
|
|
|
36
37
|
|
|
37
|
-
def is_file_exists(path, logger):
|
|
38
|
+
def is_file_exists(path, logger, base_dir=None):
|
|
38
39
|
"""Check if file exists."""
|
|
39
|
-
|
|
40
|
+
absolute_path = resolve_path(path, base_dir)
|
|
41
|
+
if os.path.exists(path) or os.path.exists(
|
|
42
|
+
Path(absolute_path if absolute_path else __file__)
|
|
43
|
+
):
|
|
40
44
|
logger.debug(f"File exists: {path}")
|
|
41
45
|
return True
|
|
42
46
|
|
|
@@ -50,7 +54,7 @@ def append_to_file(path: str | Path, content: str):
|
|
|
50
54
|
path = Path(path)
|
|
51
55
|
|
|
52
56
|
if not path.parent.exists():
|
|
53
|
-
os.mkdir(path.parent,0o700)
|
|
57
|
+
os.mkdir(path.parent, 0o700)
|
|
54
58
|
|
|
55
59
|
with open(path, "a", encoding="utf-8") as file:
|
|
56
60
|
file.write(content)
|
|
@@ -58,6 +62,7 @@ def append_to_file(path: str | Path, content: str):
|
|
|
58
62
|
logger.error(exception)
|
|
59
63
|
raise exception
|
|
60
64
|
|
|
65
|
+
|
|
61
66
|
def write_to_file(path: str | Path, content: str):
|
|
62
67
|
with open(path, "w", encoding="utf-8") as f:
|
|
63
68
|
f.write(content)
|
zscams/deps.py
CHANGED
|
@@ -15,6 +15,18 @@ def ensure_native_deps():
|
|
|
15
15
|
platform.system().lower() != "freebsd"
|
|
16
16
|
and platform.system().lower() != "zscaleros"
|
|
17
17
|
):
|
|
18
|
+
# --- Linux/Standard Path ---
|
|
19
|
+
# On Linux, we just use pip to install the missing pieces
|
|
20
|
+
# We use 'PyYAML' instead of 'yaml' for pip
|
|
21
|
+
deps_map = ["cryptography", "pyyaml", "psutil"]
|
|
22
|
+
# Identify which modules are actually missing
|
|
23
|
+
missing_mods = [mod for mod in deps_map if not is_installed(mod)]
|
|
24
|
+
if not missing_mods:
|
|
25
|
+
return # Everything is already installed
|
|
26
|
+
print(f"--> Installing via pip: {missing_mods}")
|
|
27
|
+
subprocess.run(
|
|
28
|
+
[sys.executable, "-m", "pip", "install"] + missing_mods, check=True
|
|
29
|
+
)
|
|
18
30
|
return
|
|
19
31
|
|
|
20
32
|
# 1. Define what we need and how FreeBSD names them
|
|
@@ -81,6 +93,6 @@ def ensure_native_deps():
|
|
|
81
93
|
print("--> Please restart your command to apply changes.")
|
|
82
94
|
sys.exit(0)
|
|
83
95
|
except subprocess.CalledProcessError:
|
|
84
|
-
print("--> Error: Failed to install packages. Check your internet connection.")
|
|
96
|
+
print(f"--> Error: Failed to install packages. Check your internet connection.")
|
|
85
97
|
print(f"--> Manual command: sudo pkg install {' '.join(targets)}")
|
|
86
98
|
sys.exit(1)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: zscams
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.7
|
|
4
4
|
Summary: Async TLS tunnel client with SNI routing, auto-reconnect, and health checks
|
|
5
5
|
Author: OCD - Cairo Software Team
|
|
6
6
|
Maintainer: OCD - Cairo Software Team
|
|
@@ -11,10 +11,7 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
11
11
|
Classifier: Programming Language :: Python :: 3.11
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.12
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
-
Requires-Dist: PyYAML ; sys_platform not in "freebsd"
|
|
15
|
-
Requires-Dist: cryptography ; sys_platform not in "freebsd"
|
|
16
14
|
Requires-Dist: getmac
|
|
17
|
-
Requires-Dist: psutil ; sys_platform not in "freebsd"
|
|
18
15
|
Requires-Dist: requests
|
|
19
16
|
Description-Content-Type: text/markdown
|
|
20
17
|
|
|
@@ -2,30 +2,31 @@ zscams/__init__.py,sha256=xAeDJU2cSBrdspt5aVRTYIzAbGSGvn-CtGV4qc7moQ0,59
|
|
|
2
2
|
zscams/__main__.py,sha256=J3ArryUM5B-nVwMMNPmDGRHctehDF9ZaGGHfLHiP1jI,1055
|
|
3
3
|
zscams/agent/__init__.py,sha256=CKNRkV_frJyFrnFU0Nrf6xp4Ja4a_w7j7qrja_h8VUU,2976
|
|
4
4
|
zscams/agent/certificates/.gitkeep,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
-
zscams/agent/config.yaml,sha256=
|
|
6
|
-
zscams/agent/configuration/config.j2,sha256=
|
|
7
|
-
zscams/agent/configuration/
|
|
5
|
+
zscams/agent/config.yaml,sha256=0DuIENHlSoo6nRg4Xa0ZljHGgDGQiWSEX8b_uRMtpS0,2542
|
|
6
|
+
zscams/agent/configuration/config.j2,sha256=95lUo1oo_EExGCHIhlBnaeK0cwmr9gUXfh7TYP9WYdg,2633
|
|
7
|
+
zscams/agent/configuration/freebsd_service.j2,sha256=d0Nh6WJFGw7PhO_dfUjECx2NXTGagalvuIE0aulXIYE,309
|
|
8
|
+
zscams/agent/configuration/linux_service.j2,sha256=UOrGrXvBK2mFit_b3QxUAKgZhG-dmKV8-45bksxL4NE,225
|
|
8
9
|
zscams/agent/keys/autoport.key,sha256=hZBmtw_nLsZwe11LYlwLL-P_blQ_qpUDpFwvqOZDZFE,1679
|
|
9
10
|
zscams/agent/src/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
11
|
zscams/agent/src/core/__init__.py,sha256=CEDwvbxojtNZOfOOFBj-URg4Q0KB0cq9AqIiD0uzPic,24
|
|
11
|
-
zscams/agent/src/core/backend/bootstrap.py,sha256=
|
|
12
|
+
zscams/agent/src/core/backend/bootstrap.py,sha256=Dvh6Hesy9M-5zX4iQxvSSlX6HD2Ty4vU5EG_nyHWQks,2463
|
|
12
13
|
zscams/agent/src/core/backend/client.py,sha256=xZw2GuOVw6Ek-QI9OaUO4rqzIrs4xGwiPizBLCH89fo,10123
|
|
13
14
|
zscams/agent/src/core/backend/exceptions.py,sha256=osMbVb_ZGvrGbw5cOCMG1s4yBLukJl7T8TITCcVPyXA,383
|
|
14
15
|
zscams/agent/src/core/backend/update_machine_info.py,sha256=9chBdvsLeLVf5DsvSHiUO9xQpXSbDgqhdnrUwxyoKUM,474
|
|
15
|
-
zscams/agent/src/core/prerequisites.py,sha256=
|
|
16
|
+
zscams/agent/src/core/prerequisites.py,sha256=5OlXBEg8FaYp6LXjJHtbdcpRaMywR-DBDyvDr_OiVdA,1286
|
|
16
17
|
zscams/agent/src/core/service_health_check.py,sha256=9VUWQitXcDEwLcHTTeequi6om98OXN-JIIMZCCH5y4A,1733
|
|
17
18
|
zscams/agent/src/core/services.py,sha256=GvAYODh1Pg_FatnZO_8iqReiIeBfq7Hfwj9zxlXYm-0,2840
|
|
18
19
|
zscams/agent/src/core/tunnel/__init__.py,sha256=BvJmqtjliO-UvmEguOwky8KSGLY_w8xqM67Q3v2_jc0,4658
|
|
19
20
|
zscams/agent/src/core/tunnel/tls.py,sha256=EIRR7aLq6BkW6jUVseM1YCqm7E_UDVSQ9CffQri2U6U,2006
|
|
20
21
|
zscams/agent/src/core/tunnels.py,sha256=FwYi9cV3V7c_su5cEgXmyNdr8VyfCBKzU5olvi2MzBw,1736
|
|
21
22
|
zscams/agent/src/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
22
|
-
zscams/agent/src/services/reverse_ssh.py,sha256
|
|
23
|
-
zscams/agent/src/services/ssh_forwarder.py,sha256=
|
|
23
|
+
zscams/agent/src/services/reverse_ssh.py,sha256=4NeS8TIq48VoUpq6CFcUrEl97qkd2L1yWAs7qlyvSzE,2272
|
|
24
|
+
zscams/agent/src/services/ssh_forwarder.py,sha256=O6V89DRpohkk_Gwg_FrHD4sv9hTS45VpBUcuXv7CRO4,2414
|
|
24
25
|
zscams/agent/src/services/system_monitor.py,sha256=7VeSYHbr1Lv8tGVg0AMMd5_o7EgMGuRDlxJjxpGM27g,7529
|
|
25
26
|
zscams/agent/src/support/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
26
27
|
zscams/agent/src/support/cli.py,sha256=6Y0zokhwhWcsmjEosGqq_kMqF3tn4juPpsBmQax1Oyc,1221
|
|
27
28
|
zscams/agent/src/support/configuration.py,sha256=hnJhvJLdL5ElZITDFLybTOHVACBHttWgy8sXhmu75Wc,2025
|
|
28
|
-
zscams/agent/src/support/filesystem.py,sha256=
|
|
29
|
+
zscams/agent/src/support/filesystem.py,sha256=QoqyvIWm0jgIGx51ikopU_mvupBWke_e5KaW-wnTI4A,1738
|
|
29
30
|
zscams/agent/src/support/logger.py,sha256=rKjAVO6vDeXYTM9__q2lcc1PBiJoZUqLzry8yMf71vY,2347
|
|
30
31
|
zscams/agent/src/support/mac.py,sha256=XVKc5YAYLu4a-5VrMhcwgkMNnP2u6itK3cx-Oxnx4IA,453
|
|
31
32
|
zscams/agent/src/support/network.py,sha256=VwVVNqykZxvrTPwPYQ3sSVMc_Z2XUwASlo_kd_wdGDs,1453
|
|
@@ -33,9 +34,9 @@ zscams/agent/src/support/openssl.py,sha256=jLSv8ajIw1YfNdBhz4KSvNp-cARLXY9-7qdzn
|
|
|
33
34
|
zscams/agent/src/support/os.py,sha256=g2TYgRLvb1snl236m-TKNqFe6jLTFyIT3YOH9cCKY8Y,4769
|
|
34
35
|
zscams/agent/src/support/ssh.py,sha256=J9-XsVc6fGdcTN9CsfmgDRaMnfaWluDUaPGug7BVl6Q,812
|
|
35
36
|
zscams/agent/src/support/yaml.py,sha256=bKsQzXHAgjCxkGzPR8bgaUPB-QHMR3AMEVuvn4RRpnA,1188
|
|
36
|
-
zscams/deps.py,sha256=
|
|
37
|
+
zscams/deps.py,sha256=D2WEI7dLoMnPl_OL7NOSXe-k25p1FFeeGsY1Mh7IIEw,3630
|
|
37
38
|
zscams/lib/.gitkeep,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
38
|
-
zscams-2.0.
|
|
39
|
-
zscams-2.0.
|
|
40
|
-
zscams-2.0.
|
|
41
|
-
zscams-2.0.
|
|
39
|
+
zscams-2.0.7.dist-info/METADATA,sha256=MKMIfFRXQNLJMR-Fzhpn_ezncJJ_gcNyXqARWSFlL4A,6805
|
|
40
|
+
zscams-2.0.7.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
41
|
+
zscams-2.0.7.dist-info/entry_points.txt,sha256=IXiMYjEq4q0tUiD9O7eCWhqKBuOssXrMW42siTBAgG8,47
|
|
42
|
+
zscams-2.0.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|