-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #149 from dioptra-io/main
version 1.1.2
- Loading branch information
Showing
16 changed files
with
1,961 additions
and
1,509 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
# HTTP API | ||
|
||
Iris is meant to be controlled through an HTTP API. | ||
The API is documented with Swagger on the `/docs` endpoint. | ||
A documentation of the API is publicly available at [https://api.iris.dioptra.io/docs/](https://api.iris.dioptra.io/docs/). | ||
|
||
On this page we document specific tips for using the API. | ||
|
||
## Registering | ||
|
||
### On iris.dioptra.io | ||
|
||
To register on Iris public instance, you must go through [iris.dioptra.io](https://iris.dioptra.io). | ||
Upon registration, you will be invited to sign a license and send it to our team for approval. | ||
Once your account is approved you will be able to access public Iris data. | ||
|
||
### On a private instance | ||
|
||
To register on a private instance, you can use the `/auth/register` endpoint: | ||
``` | ||
curl -X POST \ | ||
-H 'Content-Type: application/json' \ | ||
-d '{"firstname": "First", "lastname": "Last", "email": "[email protected]", "password": "abc"}' \ | ||
https://api.dev.iris.dioptra.io/auth/register | ||
``` | ||
|
||
```json | ||
{ | ||
"id": "23ec99b5-f259-4732-b121-d012b686e37a", | ||
"email": "[email protected]", | ||
"is_active": true, | ||
"is_superuser": false, | ||
"is_verified": false, | ||
"firstname": "First", | ||
"lastname": "Last", | ||
"probing_enabled": false, | ||
"probing_limit": 1, | ||
"allow_tag_reserved": false, | ||
"allow_tag_public": false, | ||
"creation_time": "2022-08-17T14:24:22.495581" | ||
} | ||
``` | ||
|
||
An administrator can then set `is_verified` and `probing_enabled` to true by issuing a PATCH query against the `/users/:id` endpoint. | ||
|
||
## iris-client | ||
|
||
To make it easier to use the Iris API from Python code, you can use the [iris-client](https://github.com/dioptra-io/iris-client) library. | ||
It is implemented on top of [httpx](https://github.com/encode/httpx) and has sync and async interfaces. | ||
|
||
```bash | ||
pip install dioptra-iris-client | ||
``` | ||
|
||
To avoid specifying the credentials in the code, you can use environment variables, or a configuration file: | ||
|
||
```json title="~/.config/iris/credentials.json" | ||
{ | ||
"base_url": "https://api.iris.dioptra.io", | ||
"username": "[email protected]", | ||
"password": "admin" | ||
} | ||
``` | ||
|
||
```python | ||
from iris_client import IrisClient | ||
|
||
with IrisClient() as iris: | ||
iris.all("/measurements/", params={"tag": "collection:public", "only_mine": False}) | ||
iris.post("/measurements/", json={"tool": "diamond-miner", "agents": "..."}) | ||
``` | ||
|
||
For more information, refer to the documentation of the library. | ||
|
||
## pych-client | ||
|
||
To access Iris data hosted on ClickHouse, you can use the [pych-client](https://github.com/dioptra-io/pych-client) library in combination with iris-client. | ||
|
||
```bash | ||
pip install pych-client | ||
``` | ||
|
||
```python | ||
from iris_client import IrisClient | ||
from pych_client import ClickHouseClient | ||
|
||
with IrisClient() as iris: | ||
services = iris.get("/users/me/services").json() | ||
with ClickHouseClient(**services["clickhouse"]) as clickhouse: | ||
print(clickhouse.json("SHOW TABLES")) | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Concepts | ||
|
||
## Agent | ||
|
||
An agent performs measurements. | ||
It receives a list of probes to send and uses [caracal](https://github.com/dioptra-io/caracal) to send the probes and capture the replies. | ||
It is implemented as Python application that loops on a Redis queue and uploads the results to an S3 bucket. | ||
|
||
The resources required to run an agent are minimal and depends mostly on the desired probing rate. | ||
A minimum of 1 CPU and 512 MB of memory are required. | ||
To achieve a rate of 100k packets per second, we recommend at-least 2 CPU. | ||
|
||
If you're running an agent in the cloud, avoid burstable instances since the agent will exhaust the CPU credits very quickly and will become very slow. | ||
|
||
## Measurement | ||
|
||
A measurement is defined by a tool and a list of measurement agents. | ||
|
||
## Measurement agent | ||
|
||
A measurement agent is defined by an agent, a target list and tool parameters specific to the agent. | ||
|
||
## Target list | ||
|
||
A target list is a comma-delimited list of networks to probe. | ||
Each line of the file must be like | ||
``` | ||
target,protocol,min_ttl,max_ttl,n_initial_flows | ||
``` | ||
where the target is a IPv4/IPv6 prefix or IPv4/IPv6 address. | ||
The prococol can be `icmp`, `icmp6` or `udp`. | ||
The file name must end with `.csv`. | ||
|
||
For example: | ||
``` | ||
0.0.0.0/0,udp,2,32,1 | ||
8.8.8.0/24,icmp,2,32,6 | ||
2001:4860:4860::8888,icmp6,2,32,6 | ||
``` | ||
If the prefix length is ignored, /24 or /128 is assumed. | ||
|
||
Some tools offer the `prefix_len_v4` and `prefix_len_v6` parameters which allows to split the specified networks and keep the target list short. | ||
For instance, if `prefix_len_v4=24`, then `0.0.0.0/0` will be split into the 16 millions networks `0.0.0.0/24,...,255.255.255.0/24`. | ||
|
||
## Tool | ||
|
||
A tool defines which probes should be sent based on a target list and the results of a previous measurement round. | ||
Examples of such tools are Diamond-Miner, Yarrp or ping. | ||
|
||
A better name would probably have been an _algorithm_, to avoid confusion with the actual probing tool that is used, [caracal](https://github.com/dioptra-io/caracal). | ||
|
||
## Worker | ||
|
||
A worker coordinates measurement agents. | ||
It runs the tool to get the list of probes to send, it sends this list to the agent, and it waits for the results. | ||
It is implemented as [Dramatiq](https://dramatiq.io) actors and uses Redis and S3 to exchange data with the agents. | ||
|
||
The resources required to run a worker depends on the tool and on the number of concurrent measurement agents. | ||
To run Diamond-Miner on `0.0.0.0/0` with a single agent, we recommend at-least 32 GB of memory and 8 CPUs. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
# Contributing | ||
# Development | ||
|
||
Thanks for contributing ! Here is some guidelines to make your life easier during the development process. | ||
Here are some guidelines to make your life easier during the development process. | ||
|
||
## Prerequisites | ||
|
||
To develop on Iris you need a Python 3.8+ interpreter and Docker. | ||
To develop on Iris you need a Python 3.10+ interpreter and Docker. | ||
|
||
Iris services and their dependencies are hosted behind a Traefik reverse-proxy. | ||
To be able to access them from your own machine, you need to add the following entries to [`/etc/hosts`](file:///etc/hosts): | ||
|
@@ -50,7 +50,8 @@ poetry run alembic upgrade head | |
docker-compose down | ||
``` | ||
|
||
The API documentation will be available on http://api.docker.localhost/docs. | ||
The API documentation will be available on http://api.docker.localhost/docs. | ||
By default, the admin user is `[email protected]` and the password is `admin`. | ||
|
||
## Tests | ||
|
||
|
@@ -82,4 +83,3 @@ poetry run pre-commit run --all-files | |
|
||
Please use [bumpversion](https://pypi.org/project/bumpversion/0.6.0/) to conduct the releases. | ||
The version bump will automatically create a new commit associated with a tag. | ||
When pushed to GitHub, the tag will trigger a deployment workflow that will push the new version of Iris Agent into Docker Hub. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Introduction | ||
|
||
Iris is a system to coordinate complex network measurements from multiple vantage points. | ||
Think of it as a project similar to [CAIDA Ark](https://www.caida.org/projects/ark/) or [RIPE Atlas](https://atlas.ripe.net), with the following features: | ||
|
||
- Fully open-source code. | ||
- Handle multi-round measurements, such as [diamond-miner](https://github.com/dioptra-io/diamond-miner) IP tracing measurements. | ||
- Handle both centralized computation on a powerful server, and distributed probing on smaller agents. | ||
- Can tolerate the temporary loss of agents, database or control-plane components. | ||
|
||
We offer a public instance of Iris, as well as public measurement data, on [iris.dioptra.io](https://iris.dioptra.io). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = "1.1.1" | ||
__version__ = "1.1.2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.