Skip to content

Commit 0d7dafb

Browse files
Merge pull request #338 from Ratio1/develop
Develop
2 parents 47eb865 + 8ae7e1b commit 0d7dafb

File tree

15 files changed

+1891
-173
lines changed

15 files changed

+1891
-173
lines changed

README.md

Lines changed: 53 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Ratio1 Edge Node
22

3+
34
Welcome to the **Ratio1 Edge Node** repository, formerly known as the **Naeural Edge Protocol Edge Node**. As a pivotal component of the Ratio1 ecosystem, this Edge Node software empowers a decentralized, privacy-preserving, and secure edge computing network. By enabling a collaborative network of edge nodes, Ratio1 facilitates the secure sharing of resources and the seamless execution of computation tasks across diverse devices.
45

56
Documentation sections:
@@ -16,12 +17,12 @@ Documentation sections:
1617

1718
## Introduction
1819

19-
The Ratio1 Edge Node is a meta Operating System designed to operate on edge devices, providing them the essential functionality required to join and thrive within the Ratio1 network. Each Edge Node manages the device’s resources, executes computation tasks efficiently, and communicates securely with other nodes in the network. Leveraging the powerful Ratio1 core libraries (formely known as Naeural Edge Protocol libraries) `naeural_core` and `ratio1` the Ratio1 Edge Node offers out-of-the-box usability starting in 2025. Users can deploy the Edge Node and SDK (`ratio1`) effortlessly without the need for intricate configurations, local subscriptions, tenants, user accounts, passwords, or broker setups.
20+
The Ratio1 Edge Node is a meta Operating System designed to operate on edge devices, providing them the essential functionality required to join and thrive within the Ratio1 network. Each Edge Node manages the device’s resources, executes computation tasks efficiently, and communicates securely with other nodes in the network. Leveraging the powerful Ratio1 core libraries (formerly known as Naeural Edge Protocol libraries) `naeural_core` and the Ratio1 SDK (`ratio1_sdk`, published on PyPI as `ratio1`), the Ratio1 Edge Node offers out-of-the-box usability starting in 2025 without intricate configurations, local subscriptions, tenants, user accounts, passwords, or broker setups.
2021

2122
## Related Repositories
2223

2324
- [ratio1/naeural_core](https://github.com/ratio1/naeural_core) provides the modular pipeline engine that powers data ingestion, processing, and serving inside this node. Extend or troubleshoot runtime behavior by mirroring the folder layout in `extensions/` against the upstream modules.
24-
- [Ratio1/ratio1_sdk](https://github.com/Ratio1/ratio1_sdk) is the client toolkit for building and dispatching jobs to Ratio1 nodes. Its tutorials pair with the workflows in `plugins/business/tutorials/` and are the best place to validate end-to-end scenarios.
25+
- [Ratio1/ratio1_sdk](https://github.com/Ratio1/ratio1_sdk) is the client toolkit for building and dispatching jobs to Ratio1 nodes (published on PyPI as `ratio1`). Its tutorials pair with the workflows in `plugins/business/tutorials/` and are the best place to validate end-to-end scenarios.
2526

2627
When developing custom logic, install the three repositories in the same virtual environment (`pip install -e . ../naeural_core ../ratio1_sdk`) so interface changes remain consistent across the stack.
2728

@@ -33,28 +34,30 @@ When developing custom logic, install the three repositories in the same virtual
3334
Deploying a Ratio1 Edge Node within a development network is straightforward. Execute the following Docker command to launch the node making sure you mount a persistent volume to the container to preserve the node data between restarts:
3435

3536
```bash
36-
docker run -d --rm --name r1node --pull=always -v r1vol:/edge_node/_local_cache/ ratio1/edge_node:develop
37+
docker run -d --rm --name r1node --pull=always -v r1vol:/edge_node/_local_cache/ ratio1/edge_node:devnet
3738
```
3839

3940
- `-d`: Runs the container in the background.
4041
- `--rm`: Removes the container upon stopping.
4142
- `--name r1node`: Assigns the name `r1node` to the container.
4243
- `--pull=always`: Ensures the latest image version is always pulled.
43-
- `ratio1/edge_node:develop`: Specifies the Docker image to run.
44+
- `ratio1/edge_node:devnet`: Specifies the devnet image; use `:mainnet` or `:testnet` for those networks.
4445
- `-v r1vol:/edge_node/_local_cache/`: Mounts the `r1vol` volume to the `/edge_node/_local_cache/` directory within the container.
4546

47+
Architecture-specific variants (for example `:devnet-arm64`, `:devnet-tegra`, `:devnet-amd64-cpu`) will follow; pick the tag that matches your hardware once available.
48+
4649
This command initializes the Ratio1 Edge Node in development mode, automatically connecting it to the Ratio1 development network and preparing it to receive computation tasks while ensuring that all node data is stored in `r1vol`, preserving it between container restarts.
4750

4851

4952
If for some reason you encounter issues when running the Edge Node, you can try to run the container with the `--platform linux/amd64` flag to ensure that the container runs on the correct platform.
5053

5154
```bash
52-
docker run -d --rm --name r1node --platform linux/amd64 --pull=always -v r1vol:/edge_node/_local_cache/ ratio1/edge_node:develop
55+
docker run -d --rm --name r1node --platform linux/amd64 --pull=always -v r1vol:/edge_node/_local_cache/ ratio1/edge_node:devnet
5356
```
5457
Also, if you have GPU(s) on your machine, you can enable GPU support by adding the `--gpus all` flag to the Docker command. This flag allows the Edge Node to utilize the GPU(s) for computation tasks.
5558

5659
```bash
57-
docker run -d --rm --name r1node --gpus all --pull=always -v r1vol:/edge_node/_local_cache/ ratio1/edge_node:develop
60+
docker run -d --rm --name r1node --gpus all --pull=always -v r1vol:/edge_node/_local_cache/ ratio1/edge_node:devnet
5861
```
5962

6063
This will ensure that your node will be able to utilize the GPU(s) for computation tasks and will accept training and inference jobs that require GPU acceleration.
@@ -64,12 +67,12 @@ This will ensure that your node will be able to utilize the GPU(s) for computati
6467
If you want to run multiple Edge Nodes on the same machine, you can do so by specifying different names for each container but more importantly, you need to specify different volumes for each container to avoid conflicts between the nodes. You can do this by creating a new volume for each node and mounting it to the container as follows:
6568

6669
```bash
67-
docker run -d --rm --name r1node1 --pull=always -v r1vol1:/edge_node/_local_cache/ ratio1/edge_node:develop
68-
docker run -d --rm --name r1node2 --pull=always -v r1vol2:/edge_node/_local_cache/ ratio1/edge_node:develop
70+
docker run -d --rm --name r1node1 --pull=always -v r1vol1:/edge_node/_local_cache/ ratio1/edge_node:devnet
71+
docker run -d --rm --name r1node2 --pull=always -v r1vol2:/edge_node/_local_cache/ ratio1/edge_node:devnet
6972
```
7073

7174
Now you can run multiple Edge Nodes on the same machine without any conflicts between them.
72-
>NOTE: If you are running multiple nodes on the same machine it is recommended to use docker-compose to manage the nodes. You can find an example of how to run multiple nodes on the same machine using docker-compose in the [Running multiple nodes on the same machine](#running-multiple-nodes-on-the-same-machine) section.
75+
>NOTE: If you are running multiple nodes on the same machine it is recommended to use docker-compose to manage the nodes. You can find a docker-compose example in the section below.
7376
7477

7578
## Inspecting the Edge Node
@@ -145,6 +148,8 @@ The [Ratio1 SDK](https://github.com/Ratio1/ratio1_sdk) is the recommended way to
145148
pip install -e ../ratio1_sdk
146149
```
147150

151+
If you prefer the published package, install from PyPI via `pip install ratio1`.
152+
148153
- Use the `nepctl` (formerly `r1ctl`) CLI that ships with the SDK to inspect the network, configure clients, and dispatch jobs.
149154
- Explore `ratio1_sdk/tutorials/` for end-to-end examples; most have matching runtime counterparts in `plugins/business/tutorials/` inside this repository.
150155
- SDK releases 2.6+ perform automatic dAuth configuration. After whitelisting your client, you can submit jobs without additional secrets.
@@ -226,6 +231,7 @@ Lets suppose you have the following node data:
226231
"whitelist": [
227232
"0xai_AthDPWc_k3BKJLLYTQMw--Rjhe3B6_7w76jlRpT6nDeX"
228233
]
234+
}
229235
}
230236
```
231237

@@ -250,6 +256,7 @@ docker exec r1node get_node_info
250256
"whitelist": [
251257
"0xai_AthDPWc_k3BKJLLYTQMw--Rjhe3B6_7w76jlRpT6nDeX"
252258
]
259+
}
253260
}
254261
```
255262

@@ -286,7 +293,7 @@ If you want to run multiple nodes on the same machine the best option is to use
286293
```yaml
287294
services:
288295
r1node1:
289-
image: ratio1/edge_node:testnet
296+
image: ratio1/edge_node:devnet
290297
container_name: r1node1
291298
platform: linux/amd64
292299
restart: always
@@ -297,7 +304,7 @@ services:
297304
- "com.centurylinklabs.watchtower.stop-signal=SIGINT"
298305

299306
r1node2:
300-
image: ratio1/edge_node:testnet
307+
image: ratio1/edge_node:devnet
301308
container_name: r1node2
302309
platform: linux/amd64
303310
restart: always
@@ -350,7 +357,7 @@ docker-compose down
350357

351358
Now, lets dissect the `docker-compose.yml` file:
352359
- we have a variable number of nodes - in our case 2 nodes - `r1node1` and `r1node2` as services (we commented out the third node for simplicity)
353-
- each node is using the `ratio1/edge_node:testnet` image
360+
- each node is using the `ratio1/edge_node:devnet` image (swap the tag for `:mainnet` or `:testnet` as needed; architecture-specific variants such as `-arm64`, `-tegra`, `-amd64-cpu` will follow)
354361
- each node has own unique volume mounted to it
355362
- we have a watchtower service that will check for new images every 1 minute and will update the nodes if a new image is available
356363

@@ -375,6 +382,7 @@ For inquiries regarding the funding and its impact on this project, please conta
375382

376383
## Citation
377384

385+
378386
If you use the Ratio1 Edge Node in your research or projects, please cite it as follows:
379387

380388
```bibtex
@@ -385,3 +393,36 @@ If you use the Ratio1 Edge Node in your research or projects, please cite it as
385393
howpublished = {\url{https://github.com/Ratio1/edge_node}},
386394
}
387395
```
396+
397+
398+
Additional publications and references:
399+
400+
```bibtex
401+
@inproceedings{Damian2025CSCS,
402+
author = {Damian, Andrei Ionut and Bleotiu, Cristian and Grigoras, Marius and
403+
Butusina, Petrica and De Franceschi, Alessandro and Toderian, Vitalii and
404+
Tapus, Nicolae},
405+
title = {Ratio1 meta-{OS} -- decentralized {MLOps} and beyond},
406+
booktitle = {2025 25th International Conference on Control Systems and Computer Science (CSCS)},
407+
year = {2025},
408+
pages = {258--265},
409+
address = {Bucharest, Romania},
410+
month = {May 27--30},
411+
doi = {10.1109/CSCS66924.2025.00046},
412+
isbn = {979-8-3315-7343-0},
413+
issn = {2379-0482},
414+
publisher = {IEEE}
415+
}
416+
417+
@misc{Damian2025arXiv,
418+
title = {Ratio1 -- AI meta-OS},
419+
author = {Damian, Andrei and Butusina, Petrica and De Franceschi, Alessandro and
420+
Toderian, Vitalii and Grigoras, Marius and Bleotiu, Cristian},
421+
year = {2025},
422+
month = {September},
423+
eprint = {2509.12223},
424+
archivePrefix = {arXiv},
425+
primaryClass = {cs.OS},
426+
doi = {10.48550/arXiv.2509.12223}
427+
}
428+
```

extensions/business/container_apps/container_app_runner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2065,7 +2065,7 @@ def start_container(self):
20652065

20662066
self.P(log_str)
20672067

2068-
nano_cpu_limit = self._cpu_limit * 1_000_000_000
2068+
nano_cpu_limit = int(self._cpu_limit * 1_000_000_000)
20692069
mem_reservation = f"{parse_memory_to_mb(self._mem_limit, 0.9)}m"
20702070

20712071
run_kwargs = dict(

extensions/business/container_apps/container_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ def _setup_resource_limits_and_ports(self):
307307

308308
container_resources = self.cfg_container_resources
309309
if isinstance(container_resources, dict) and len(container_resources) > 0:
310-
self._cpu_limit = int(container_resources.get("cpu", DEFAULT_CPU_LIMIT))
310+
self._cpu_limit = float(container_resources.get("cpu", DEFAULT_CPU_LIMIT))
311311
self._gpu_limit = container_resources.get("gpu", DEFAULT_GPU_LIMIT)
312312
self._mem_limit = container_resources.get("memory", DEFAULT_MEM_LIMIT)
313313

@@ -417,7 +417,7 @@ def _setup_resource_limits_and_ports(self):
417417
# endif main_port_mapped
418418
else:
419419
# No container resources specified, use defaults
420-
self._cpu_limit = DEFAULT_CPU_LIMIT
420+
self._cpu_limit = float(DEFAULT_CPU_LIMIT)
421421
self._gpu_limit = DEFAULT_GPU_LIMIT
422422
self._mem_limit = DEFAULT_MEM_LIMIT
423423

extensions/business/cybersec/README.md

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,44 @@
33
## RedMesh
44
- folder: extensions/business/cybersec/red_mesh
55
- description: A framework for distributed orchestrated penetration testing and vulnerability assessment.
6-
- version: v1 (Alpha) as of 2025-09-30
6+
- version: v1 (Alpha) as of 2025-09-30
7+
8+
### Features
9+
10+
**Distributed Scanning**
11+
- Port scanning distributed across heterogeneous network workers
12+
- Distribution strategies: `SLICE` (divide ports across workers) or `MIRROR` (full redundancy)
13+
- Port ordering: `SHUFFLE` (randomized for stealth) or `SEQUENTIAL`
14+
15+
**Service Detection**
16+
- Banner grabbing and protocol identification
17+
- Detection modules for FTP, SSH, HTTP, and other common services
18+
19+
**Web Vulnerability Testing**
20+
- SQL injection detection
21+
- Cross-site scripting (XSS) testing
22+
- Directory traversal checks
23+
- Security header analysis
24+
25+
**Run Modes**
26+
- `SINGLEPASS`: One-time scan with aggregated report
27+
- `CONTINUOUS_MONITORING`: Repeated scans at configurable intervals for change detection
28+
29+
**Stealth Capabilities**
30+
- "Dune sand walking": Random delays between operations for IDS evasion
31+
- Configurable `scan_min_delay` and `scan_max_delay` parameters
32+
33+
**Distributed Architecture**
34+
- Job coordination via CStore (distributed state)
35+
- Report storage in R1FS (IPFS-based content-addressed storage)
36+
- Network-wide job tracking and worker status monitoring
37+
38+
### API Endpoints
39+
- `POST /launch_test` - Start a new pentest job
40+
- `GET /get_job_status` - Check job progress or retrieve results
41+
- `GET /list_features` - List available scanning/testing features
42+
- `GET /list_network_jobs` - List jobs across the network
43+
- `GET /list_local_jobs` - List jobs on current node
44+
- `GET /stop_and_delete_job` - Stop and remove a job
45+
- `POST /stop_monitoring` - Stop continuous monitoring (SOFT/HARD)
46+
- `GET /get_report` - Retrieve report by CID from R1FS
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
"""
2+
RedMesh constants and feature catalog definitions.
3+
"""
4+
5+
FEATURE_CATALOG = [
6+
{
7+
"id": "service_info_common",
8+
"label": "Service fingerprinting",
9+
"description": "Collect banner and version data for common network services.",
10+
"category": "service",
11+
"methods": [
12+
"_service_info_80",
13+
"_service_info_443",
14+
"_service_info_8080",
15+
"_service_info_21",
16+
"_service_info_22",
17+
"_service_info_23",
18+
"_service_info_25",
19+
"_service_info_53",
20+
"_service_info_161",
21+
"_service_info_445",
22+
"_service_info_generic"
23+
]
24+
},
25+
{
26+
"id": "service_info_advanced",
27+
"label": "TLS/SSL & database diagnostics",
28+
"description": "Evaluate TLS configuration, database services, and industrial protocols.",
29+
"category": "service",
30+
"methods": [
31+
"_service_info_tls",
32+
"_service_info_1433",
33+
"_service_info_3306",
34+
"_service_info_3389",
35+
"_service_info_5432",
36+
"_service_info_5900",
37+
"_service_info_6379",
38+
"_service_info_9200",
39+
"_service_info_11211",
40+
"_service_info_27017",
41+
"_service_info_502"
42+
]
43+
},
44+
{
45+
"id": "web_test_common",
46+
"label": "Common exposure scan",
47+
"description": "Probe default admin panels, disclosed files, and common misconfigurations.",
48+
"category": "web",
49+
"methods": [
50+
"_web_test_common",
51+
"_web_test_homepage",
52+
"_web_test_flags",
53+
"_web_test_graphql_introspection",
54+
"_web_test_metadata_endpoints"
55+
]
56+
},
57+
{
58+
"id": "web_test_security_headers",
59+
"label": "Security headers audit",
60+
"description": "Check HSTS, CSP, X-Frame-Options, and other critical response headers.",
61+
"category": "web",
62+
"methods": [
63+
"_web_test_security_headers",
64+
"_web_test_cors_misconfiguration",
65+
"_web_test_open_redirect",
66+
"_web_test_http_methods"
67+
]
68+
},
69+
{
70+
"id": "web_test_vulnerability",
71+
"label": "Vulnerability probes",
72+
"description": "Non-destructive probes for common web vulnerabilities.",
73+
"category": "web",
74+
"methods": [
75+
"_web_test_path_traversal",
76+
"_web_test_xss",
77+
"_web_test_sql_injection",
78+
"_web_test_api_auth_bypass"
79+
]
80+
}
81+
]
82+
83+
# Job status constants
84+
JOB_STATUS_RUNNING = "RUNNING"
85+
JOB_STATUS_SCHEDULED_FOR_STOP = "SCHEDULED_FOR_STOP"
86+
JOB_STATUS_STOPPED = "STOPPED"
87+
JOB_STATUS_FINALIZED = "FINALIZED"
88+
89+
# Run mode constants
90+
RUN_MODE_SINGLEPASS = "SINGLEPASS"
91+
RUN_MODE_CONTINUOUS_MONITORING = "CONTINUOUS_MONITORING"
92+
93+
# Distribution strategy constants
94+
DISTRIBUTION_SLICE = "SLICE"
95+
DISTRIBUTION_MIRROR = "MIRROR"
96+
97+
# Port order constants
98+
PORT_ORDER_SHUFFLE = "SHUFFLE"
99+
PORT_ORDER_SEQUENTIAL = "SEQUENTIAL"

0 commit comments

Comments
 (0)