ethiack-beacon 1.0.3__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.
- ethiack_beacon-1.0.3/PKG-INFO +297 -0
- ethiack_beacon-1.0.3/README.md +282 -0
- ethiack_beacon-1.0.3/cli/__init__.py +6 -0
- ethiack_beacon-1.0.3/cli/api.py +245 -0
- ethiack_beacon-1.0.3/cli/config.py +148 -0
- ethiack_beacon-1.0.3/cli/console.py +188 -0
- ethiack_beacon-1.0.3/cli/dns.py +114 -0
- ethiack_beacon-1.0.3/cli/exceptions.py +26 -0
- ethiack_beacon-1.0.3/cli/main.py +984 -0
- ethiack_beacon-1.0.3/cli/rathole.py +279 -0
- ethiack_beacon-1.0.3/cli/system.py +398 -0
- ethiack_beacon-1.0.3/cli/wireguard.py +177 -0
- ethiack_beacon-1.0.3/ethiack_beacon.egg-info/PKG-INFO +297 -0
- ethiack_beacon-1.0.3/ethiack_beacon.egg-info/SOURCES.txt +31 -0
- ethiack_beacon-1.0.3/ethiack_beacon.egg-info/dependency_links.txt +1 -0
- ethiack_beacon-1.0.3/ethiack_beacon.egg-info/entry_points.txt +2 -0
- ethiack_beacon-1.0.3/ethiack_beacon.egg-info/requires.txt +6 -0
- ethiack_beacon-1.0.3/ethiack_beacon.egg-info/top_level.txt +1 -0
- ethiack_beacon-1.0.3/pyproject.toml +81 -0
- ethiack_beacon-1.0.3/setup.cfg +4 -0
- ethiack_beacon-1.0.3/tests/test_api.py +433 -0
- ethiack_beacon-1.0.3/tests/test_api_extra.py +183 -0
- ethiack_beacon-1.0.3/tests/test_config.py +127 -0
- ethiack_beacon-1.0.3/tests/test_console_extra.py +39 -0
- ethiack_beacon-1.0.3/tests/test_dns.py +213 -0
- ethiack_beacon-1.0.3/tests/test_main.py +264 -0
- ethiack_beacon-1.0.3/tests/test_main_create_start.py +517 -0
- ethiack_beacon-1.0.3/tests/test_main_health_misc.py +330 -0
- ethiack_beacon-1.0.3/tests/test_rathole.py +141 -0
- ethiack_beacon-1.0.3/tests/test_rathole_extra.py +354 -0
- ethiack_beacon-1.0.3/tests/test_system.py +177 -0
- ethiack_beacon-1.0.3/tests/test_system_extra.py +514 -0
- ethiack_beacon-1.0.3/tests/test_wireguard.py +285 -0
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ethiack-beacon
|
|
3
|
+
Version: 1.0.3
|
|
4
|
+
Summary: Ethiack Beacon CLI - secure network tunnel management
|
|
5
|
+
Author-email: Ethiack Engineering Team <engineering@ethiack.com>
|
|
6
|
+
License: Proprietary
|
|
7
|
+
Requires-Python: >=3.11
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
Requires-Dist: typer>=0.12.0
|
|
10
|
+
Requires-Dist: rich>=13.7.0
|
|
11
|
+
Requires-Dist: httpx>=0.27.0
|
|
12
|
+
Requires-Dist: questionary>=2.0.1
|
|
13
|
+
Requires-Dist: psutil>=5.9.0
|
|
14
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
15
|
+
|
|
16
|
+
<a name="readme-top"></a>
|
|
17
|
+
<div align="center">
|
|
18
|
+
|
|
19
|
+
# Ethiack Beacon 🔌
|
|
20
|
+
## Secure Network Tunnel for Internal Pentesting
|
|
21
|
+
|
|
22
|
+
[Quick Start](#quick-start) •
|
|
23
|
+
[Installation](#installation) •
|
|
24
|
+
[Development](#development) •
|
|
25
|
+
[Testing](#testing) •
|
|
26
|
+
[Docker](#docker) •
|
|
27
|
+
[Links](#links)
|
|
28
|
+
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
## Overview
|
|
32
|
+
|
|
33
|
+
Python CLI to configure, run, and monitor Ethiack Beacons - lightweight WireGuard tunnels that give the Ethiack Hackian Engine access to an internal network.
|
|
34
|
+
|
|
35
|
+
1. The CLI registers a beacon with the Ethiack API and receives a WireGuard config + rathole tunnel credentials.
|
|
36
|
+
2. WireGuard runs locally on your machine, creating an encrypted tunnel.
|
|
37
|
+
3. A [rathole](https://github.com/rathole-org/rathole) client punches through a NAT/firewall by forwarding the local WireGuard UDP port to Ethiack's server. **No port forwarding required**.
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
Local machine Ethiack Infrastructure
|
|
41
|
+
───────────────────────────────── ──────────────────────────
|
|
42
|
+
WireGuard server ◄──UDP── rathole ◄── rathole server ◄── WireGuard client
|
|
43
|
+
client (public endpoint)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
<p align="right"><small>(<a href="#readme-top">back to top</a>)</small></p>
|
|
47
|
+
|
|
48
|
+
## Quick Start
|
|
49
|
+
|
|
50
|
+
Run the install script - it detects Docker and guides you through both paths:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
curl -fsSL https://raw.githubusercontent.com/ethiack/beacon/main/install.sh | sudo bash
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Or pre-seed your credentials for a fully automated install (e.g. from the Ethiack Portal):
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
curl -fsSL https://raw.githubusercontent.com/ethiack/beacon/main/install.sh \
|
|
60
|
+
| ETHIACK_API_KEY=your-key ETHIACK_API_SECRET=your-secret sudo -E bash
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
The script will:
|
|
64
|
+
1. Detect Docker - if available, recommend the Docker Compose path (simpler, fewer support issues)
|
|
65
|
+
2. Otherwise install WireGuard + the beacon CLI natively, then set up a systemd/launchd service
|
|
66
|
+
3. Interactively collect beacon name, CIDRs, and optionally a pentest slug to automatically scope the beacon's networks
|
|
67
|
+
|
|
68
|
+
<p align="right"><small>(<a href="#readme-top">back to top</a>)</small></p>
|
|
69
|
+
|
|
70
|
+
## Prerequisites
|
|
71
|
+
|
|
72
|
+
- **Linux or macOS**
|
|
73
|
+
- **Python 3.11** (pinned in `.python-version`)
|
|
74
|
+
- **[uv](https://docs.astral.sh/uv/)** - Fast Python package manager
|
|
75
|
+
- **WireGuard** - `wg` and `wg-quick` must be installed
|
|
76
|
+
- **Root / sudo** - WireGuard requires elevated privileges
|
|
77
|
+
- **[dnsmasq](https://thekelleys.org.uk/dnsmasq/doc.html)** (optional) - DNS forwarding for clients connected through the beacon (`dnsmasq-base` on Debian/Ubuntu)
|
|
78
|
+
|
|
79
|
+
### Installing WireGuard
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
# Debian / Ubuntu
|
|
83
|
+
sudo apt install wireguard
|
|
84
|
+
|
|
85
|
+
# Fedora / RHEL
|
|
86
|
+
sudo dnf install wireguard-tools
|
|
87
|
+
|
|
88
|
+
# macOS
|
|
89
|
+
brew install wireguard-tools
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
<p align="right"><small>(<a href="#readme-top">back to top</a>)</small></p>
|
|
93
|
+
|
|
94
|
+
## Installation
|
|
95
|
+
|
|
96
|
+
Install the pinned Python version and dependencies:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
uv python install
|
|
100
|
+
uv sync
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
This reads `uv.lock`, creates a virtual environment at `.venv/`, and installs all dependencies with exact versions.
|
|
104
|
+
|
|
105
|
+
### Environment Configuration
|
|
106
|
+
|
|
107
|
+
Copy the example file and fill in your credentials:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
cp .env.example .env
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Key variables:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
ETHIACK_API_KEY=your-key
|
|
117
|
+
ETHIACK_API_SECRET=your-secret
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
The CLI automatically loads `.env` on startup via `python-dotenv`. Variables already set in the environment are never overridden.
|
|
121
|
+
|
|
122
|
+
<p align="right"><small>(<a href="#readme-top">back to top</a>)</small></p>
|
|
123
|
+
|
|
124
|
+
## Development
|
|
125
|
+
|
|
126
|
+
### Running Commands
|
|
127
|
+
|
|
128
|
+
Activate the virtual environment:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
source .venv/bin/activate
|
|
132
|
+
beacon create
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Or run directly without activating:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
uv run beacon create
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Most commands that interact with WireGuard require root:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
sudo -E beacon create
|
|
145
|
+
sudo -E beacon start <id>
|
|
146
|
+
sudo -E beacon stop <id>
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Non-interactive / Automated Deployment
|
|
150
|
+
|
|
151
|
+
All parameters can be passed via environment variables for use in Kubernetes, Helm, or Ansible:
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
export ETHIACK_API_KEY=your-key
|
|
155
|
+
export ETHIACK_API_SECRET=your-secret
|
|
156
|
+
export ETHIACK_BEACON_NAME=prod-cluster
|
|
157
|
+
export ETHIACK_BEACON_CIDRS=10.0.0.0/8,172.16.0.0/12
|
|
158
|
+
export ETHIACK_PENTEST_SLUG=my-pentest # optional: auto-scope CIDRs to this pentest
|
|
159
|
+
|
|
160
|
+
sudo -E beacon create --yes
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### Commands
|
|
164
|
+
|
|
165
|
+
| Command | Description |
|
|
166
|
+
|---|---|
|
|
167
|
+
| `beacon create` | Create and start a new beacon (interactive or via env vars) |
|
|
168
|
+
| `beacon list` | List all beacons for your account |
|
|
169
|
+
| `beacon status <id>` | Show beacon details and local service status |
|
|
170
|
+
| `beacon start <id>` | Start services for an existing beacon |
|
|
171
|
+
| `beacon stop <id>` | Stop running services |
|
|
172
|
+
| `beacon restart <id>` | Restart services |
|
|
173
|
+
| `beacon delete <id>` | Delete beacon and stop services |
|
|
174
|
+
| `beacon update <id>` | Update beacon configuration |
|
|
175
|
+
| `beacon health` | Continuously report health (every 5 min by default) |
|
|
176
|
+
| `beacon test <id> <target>` | Test connectivity to an internal host/URL |
|
|
177
|
+
| `beacon version` | Show CLI version |
|
|
178
|
+
|
|
179
|
+
### Environment Variables
|
|
180
|
+
|
|
181
|
+
| Variable | Required | Default | Description |
|
|
182
|
+
|---|---|---|---|
|
|
183
|
+
| `ETHIACK_API_KEY` | Yes | - | API key |
|
|
184
|
+
| `ETHIACK_API_SECRET` | Yes | - | API secret |
|
|
185
|
+
| `ETHIACK_API_URL` | No | `https://api.ethiack.com` | API base URL |
|
|
186
|
+
| `ETHIACK_ORG_ID` | No | auto | Organization ID (auto-selected if your key has access to only one org) |
|
|
187
|
+
| `ETHIACK_BEACON_ID` | No | - | Beacon ID to start (Docker mode) |
|
|
188
|
+
| `ETHIACK_BEACON_NAME` | No | - | Beacon name (skips prompt) |
|
|
189
|
+
| `ETHIACK_BEACON_CIDRS` | No | - | Comma-separated CIDRs (skips prompt) |
|
|
190
|
+
| `ETHIACK_BEACON_WG_PORT` | No | auto | Local WireGuard UDP port |
|
|
191
|
+
| `ETHIACK_PENTEST_SLUG` | No | - | Pentest slug to add beacon CIDRs to as scope assets |
|
|
192
|
+
| `ETHIACK_BEACON_HEALTH_INTERVAL` | No | `300` | Health report interval (seconds) |
|
|
193
|
+
| `ETHIACK_STATE_DIR` | No | `~/.ethiack` | CLI state, rathole binary, and PID files |
|
|
194
|
+
|
|
195
|
+
### Working with Dependencies
|
|
196
|
+
|
|
197
|
+
Add a new dependency:
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
uv add package-name # Latest version
|
|
201
|
+
uv add "package-name>=1.2.0" # Minimum version
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Remove a dependency:
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
uv remove package-name
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
> [!IMPORTANT]
|
|
211
|
+
> Always use `uv add` and `uv remove` instead of manually editing `pyproject.toml`. This ensures the lock file stays in sync.
|
|
212
|
+
|
|
213
|
+
<p align="right"><small>(<a href="#readme-top">back to top</a>)</small></p>
|
|
214
|
+
|
|
215
|
+
## Testing
|
|
216
|
+
|
|
217
|
+
Run the full test suite:
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
uv run pytest
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
Run specific files or markers:
|
|
224
|
+
|
|
225
|
+
```bash
|
|
226
|
+
uv run pytest tests/test_api.py
|
|
227
|
+
uv run pytest -m unit
|
|
228
|
+
uv run pytest -m "not slow"
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
Coverage reports are written to `htmlcov/` and `tests_report/` after each run.
|
|
232
|
+
|
|
233
|
+
<p align="right"><small>(<a href="#readme-top">back to top</a>)</small></p>
|
|
234
|
+
|
|
235
|
+
## Docker
|
|
236
|
+
|
|
237
|
+
The container runs `beacon create` or `beacon start` on startup, then keeps the health reporter running in the foreground.
|
|
238
|
+
|
|
239
|
+
### Building
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
docker compose build
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
### Running with Docker Compose
|
|
246
|
+
|
|
247
|
+
Copy the example env file and fill in your values:
|
|
248
|
+
|
|
249
|
+
```bash
|
|
250
|
+
cp .env.example beacon.env
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
> [!IMPORTANT]
|
|
254
|
+
> Use separate-line comments only in `beacon.env`. Docker's `env_file` parser does not strip inline comments - `KEY=value # comment` would set the variable to `value # comment`.
|
|
255
|
+
|
|
256
|
+
Start the container:
|
|
257
|
+
|
|
258
|
+
```bash
|
|
259
|
+
docker compose up -d
|
|
260
|
+
docker compose logs -f
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### Two Deployment Modes
|
|
264
|
+
|
|
265
|
+
**Mode 1 - Start a pre-existing beacon** (recommended for production):
|
|
266
|
+
|
|
267
|
+
```bash
|
|
268
|
+
# beacon.env
|
|
269
|
+
ETHIACK_API_KEY=your-key
|
|
270
|
+
ETHIACK_API_SECRET=your-secret
|
|
271
|
+
ETHIACK_BEACON_ID=<beacon-id>
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
Create the beacon once with the CLI, then deploy the container with its ID. On every restart the container calls `beacon start <id>` and picks up from where it left off.
|
|
275
|
+
|
|
276
|
+
**Mode 2 - Create on first run** (provisioning):
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
# beacon.env
|
|
280
|
+
ETHIACK_API_KEY=your-key
|
|
281
|
+
ETHIACK_API_SECRET=your-secret
|
|
282
|
+
ETHIACK_BEACON_NAME=my-beacon
|
|
283
|
+
ETHIACK_BEACON_CIDRS=192.168.1.0/24,10.0.0.0/8
|
|
284
|
+
# ETHIACK_PENTEST_SLUG=my-pentest # optional: auto-scope CIDRs to this pentest
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
The container calls `beacon create --yes` on startup. Multiple CIDRs can be provided as a comma-separated list. State is persisted in the `beacon-data` Docker volume so restarts are safe.
|
|
288
|
+
|
|
289
|
+
<p align="right"><small>(<a href="#readme-top">back to top</a>)</small></p>
|
|
290
|
+
|
|
291
|
+
## Links
|
|
292
|
+
|
|
293
|
+
- **Repository**: https://github.com/ethiack/beacon
|
|
294
|
+
- **Rathole**: https://github.com/rathole-org/rathole
|
|
295
|
+
- **WireGuard**: https://www.wireguard.com
|
|
296
|
+
|
|
297
|
+
<p align="right"><small>(<a href="#readme-top">back to top</a>)</small></p>
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
<a name="readme-top"></a>
|
|
2
|
+
<div align="center">
|
|
3
|
+
|
|
4
|
+
# Ethiack Beacon 🔌
|
|
5
|
+
## Secure Network Tunnel for Internal Pentesting
|
|
6
|
+
|
|
7
|
+
[Quick Start](#quick-start) •
|
|
8
|
+
[Installation](#installation) •
|
|
9
|
+
[Development](#development) •
|
|
10
|
+
[Testing](#testing) •
|
|
11
|
+
[Docker](#docker) •
|
|
12
|
+
[Links](#links)
|
|
13
|
+
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
## Overview
|
|
17
|
+
|
|
18
|
+
Python CLI to configure, run, and monitor Ethiack Beacons - lightweight WireGuard tunnels that give the Ethiack Hackian Engine access to an internal network.
|
|
19
|
+
|
|
20
|
+
1. The CLI registers a beacon with the Ethiack API and receives a WireGuard config + rathole tunnel credentials.
|
|
21
|
+
2. WireGuard runs locally on your machine, creating an encrypted tunnel.
|
|
22
|
+
3. A [rathole](https://github.com/rathole-org/rathole) client punches through a NAT/firewall by forwarding the local WireGuard UDP port to Ethiack's server. **No port forwarding required**.
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
Local machine Ethiack Infrastructure
|
|
26
|
+
───────────────────────────────── ──────────────────────────
|
|
27
|
+
WireGuard server ◄──UDP── rathole ◄── rathole server ◄── WireGuard client
|
|
28
|
+
client (public endpoint)
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
<p align="right"><small>(<a href="#readme-top">back to top</a>)</small></p>
|
|
32
|
+
|
|
33
|
+
## Quick Start
|
|
34
|
+
|
|
35
|
+
Run the install script - it detects Docker and guides you through both paths:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
curl -fsSL https://raw.githubusercontent.com/ethiack/beacon/main/install.sh | sudo bash
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Or pre-seed your credentials for a fully automated install (e.g. from the Ethiack Portal):
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
curl -fsSL https://raw.githubusercontent.com/ethiack/beacon/main/install.sh \
|
|
45
|
+
| ETHIACK_API_KEY=your-key ETHIACK_API_SECRET=your-secret sudo -E bash
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
The script will:
|
|
49
|
+
1. Detect Docker - if available, recommend the Docker Compose path (simpler, fewer support issues)
|
|
50
|
+
2. Otherwise install WireGuard + the beacon CLI natively, then set up a systemd/launchd service
|
|
51
|
+
3. Interactively collect beacon name, CIDRs, and optionally a pentest slug to automatically scope the beacon's networks
|
|
52
|
+
|
|
53
|
+
<p align="right"><small>(<a href="#readme-top">back to top</a>)</small></p>
|
|
54
|
+
|
|
55
|
+
## Prerequisites
|
|
56
|
+
|
|
57
|
+
- **Linux or macOS**
|
|
58
|
+
- **Python 3.11** (pinned in `.python-version`)
|
|
59
|
+
- **[uv](https://docs.astral.sh/uv/)** - Fast Python package manager
|
|
60
|
+
- **WireGuard** - `wg` and `wg-quick` must be installed
|
|
61
|
+
- **Root / sudo** - WireGuard requires elevated privileges
|
|
62
|
+
- **[dnsmasq](https://thekelleys.org.uk/dnsmasq/doc.html)** (optional) - DNS forwarding for clients connected through the beacon (`dnsmasq-base` on Debian/Ubuntu)
|
|
63
|
+
|
|
64
|
+
### Installing WireGuard
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# Debian / Ubuntu
|
|
68
|
+
sudo apt install wireguard
|
|
69
|
+
|
|
70
|
+
# Fedora / RHEL
|
|
71
|
+
sudo dnf install wireguard-tools
|
|
72
|
+
|
|
73
|
+
# macOS
|
|
74
|
+
brew install wireguard-tools
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
<p align="right"><small>(<a href="#readme-top">back to top</a>)</small></p>
|
|
78
|
+
|
|
79
|
+
## Installation
|
|
80
|
+
|
|
81
|
+
Install the pinned Python version and dependencies:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
uv python install
|
|
85
|
+
uv sync
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
This reads `uv.lock`, creates a virtual environment at `.venv/`, and installs all dependencies with exact versions.
|
|
89
|
+
|
|
90
|
+
### Environment Configuration
|
|
91
|
+
|
|
92
|
+
Copy the example file and fill in your credentials:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
cp .env.example .env
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Key variables:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
ETHIACK_API_KEY=your-key
|
|
102
|
+
ETHIACK_API_SECRET=your-secret
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
The CLI automatically loads `.env` on startup via `python-dotenv`. Variables already set in the environment are never overridden.
|
|
106
|
+
|
|
107
|
+
<p align="right"><small>(<a href="#readme-top">back to top</a>)</small></p>
|
|
108
|
+
|
|
109
|
+
## Development
|
|
110
|
+
|
|
111
|
+
### Running Commands
|
|
112
|
+
|
|
113
|
+
Activate the virtual environment:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
source .venv/bin/activate
|
|
117
|
+
beacon create
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Or run directly without activating:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
uv run beacon create
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Most commands that interact with WireGuard require root:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
sudo -E beacon create
|
|
130
|
+
sudo -E beacon start <id>
|
|
131
|
+
sudo -E beacon stop <id>
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Non-interactive / Automated Deployment
|
|
135
|
+
|
|
136
|
+
All parameters can be passed via environment variables for use in Kubernetes, Helm, or Ansible:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
export ETHIACK_API_KEY=your-key
|
|
140
|
+
export ETHIACK_API_SECRET=your-secret
|
|
141
|
+
export ETHIACK_BEACON_NAME=prod-cluster
|
|
142
|
+
export ETHIACK_BEACON_CIDRS=10.0.0.0/8,172.16.0.0/12
|
|
143
|
+
export ETHIACK_PENTEST_SLUG=my-pentest # optional: auto-scope CIDRs to this pentest
|
|
144
|
+
|
|
145
|
+
sudo -E beacon create --yes
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Commands
|
|
149
|
+
|
|
150
|
+
| Command | Description |
|
|
151
|
+
|---|---|
|
|
152
|
+
| `beacon create` | Create and start a new beacon (interactive or via env vars) |
|
|
153
|
+
| `beacon list` | List all beacons for your account |
|
|
154
|
+
| `beacon status <id>` | Show beacon details and local service status |
|
|
155
|
+
| `beacon start <id>` | Start services for an existing beacon |
|
|
156
|
+
| `beacon stop <id>` | Stop running services |
|
|
157
|
+
| `beacon restart <id>` | Restart services |
|
|
158
|
+
| `beacon delete <id>` | Delete beacon and stop services |
|
|
159
|
+
| `beacon update <id>` | Update beacon configuration |
|
|
160
|
+
| `beacon health` | Continuously report health (every 5 min by default) |
|
|
161
|
+
| `beacon test <id> <target>` | Test connectivity to an internal host/URL |
|
|
162
|
+
| `beacon version` | Show CLI version |
|
|
163
|
+
|
|
164
|
+
### Environment Variables
|
|
165
|
+
|
|
166
|
+
| Variable | Required | Default | Description |
|
|
167
|
+
|---|---|---|---|
|
|
168
|
+
| `ETHIACK_API_KEY` | Yes | - | API key |
|
|
169
|
+
| `ETHIACK_API_SECRET` | Yes | - | API secret |
|
|
170
|
+
| `ETHIACK_API_URL` | No | `https://api.ethiack.com` | API base URL |
|
|
171
|
+
| `ETHIACK_ORG_ID` | No | auto | Organization ID (auto-selected if your key has access to only one org) |
|
|
172
|
+
| `ETHIACK_BEACON_ID` | No | - | Beacon ID to start (Docker mode) |
|
|
173
|
+
| `ETHIACK_BEACON_NAME` | No | - | Beacon name (skips prompt) |
|
|
174
|
+
| `ETHIACK_BEACON_CIDRS` | No | - | Comma-separated CIDRs (skips prompt) |
|
|
175
|
+
| `ETHIACK_BEACON_WG_PORT` | No | auto | Local WireGuard UDP port |
|
|
176
|
+
| `ETHIACK_PENTEST_SLUG` | No | - | Pentest slug to add beacon CIDRs to as scope assets |
|
|
177
|
+
| `ETHIACK_BEACON_HEALTH_INTERVAL` | No | `300` | Health report interval (seconds) |
|
|
178
|
+
| `ETHIACK_STATE_DIR` | No | `~/.ethiack` | CLI state, rathole binary, and PID files |
|
|
179
|
+
|
|
180
|
+
### Working with Dependencies
|
|
181
|
+
|
|
182
|
+
Add a new dependency:
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
uv add package-name # Latest version
|
|
186
|
+
uv add "package-name>=1.2.0" # Minimum version
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Remove a dependency:
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
uv remove package-name
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
> [!IMPORTANT]
|
|
196
|
+
> Always use `uv add` and `uv remove` instead of manually editing `pyproject.toml`. This ensures the lock file stays in sync.
|
|
197
|
+
|
|
198
|
+
<p align="right"><small>(<a href="#readme-top">back to top</a>)</small></p>
|
|
199
|
+
|
|
200
|
+
## Testing
|
|
201
|
+
|
|
202
|
+
Run the full test suite:
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
uv run pytest
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Run specific files or markers:
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
uv run pytest tests/test_api.py
|
|
212
|
+
uv run pytest -m unit
|
|
213
|
+
uv run pytest -m "not slow"
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
Coverage reports are written to `htmlcov/` and `tests_report/` after each run.
|
|
217
|
+
|
|
218
|
+
<p align="right"><small>(<a href="#readme-top">back to top</a>)</small></p>
|
|
219
|
+
|
|
220
|
+
## Docker
|
|
221
|
+
|
|
222
|
+
The container runs `beacon create` or `beacon start` on startup, then keeps the health reporter running in the foreground.
|
|
223
|
+
|
|
224
|
+
### Building
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
docker compose build
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### Running with Docker Compose
|
|
231
|
+
|
|
232
|
+
Copy the example env file and fill in your values:
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
cp .env.example beacon.env
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
> [!IMPORTANT]
|
|
239
|
+
> Use separate-line comments only in `beacon.env`. Docker's `env_file` parser does not strip inline comments - `KEY=value # comment` would set the variable to `value # comment`.
|
|
240
|
+
|
|
241
|
+
Start the container:
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
docker compose up -d
|
|
245
|
+
docker compose logs -f
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### Two Deployment Modes
|
|
249
|
+
|
|
250
|
+
**Mode 1 - Start a pre-existing beacon** (recommended for production):
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
# beacon.env
|
|
254
|
+
ETHIACK_API_KEY=your-key
|
|
255
|
+
ETHIACK_API_SECRET=your-secret
|
|
256
|
+
ETHIACK_BEACON_ID=<beacon-id>
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
Create the beacon once with the CLI, then deploy the container with its ID. On every restart the container calls `beacon start <id>` and picks up from where it left off.
|
|
260
|
+
|
|
261
|
+
**Mode 2 - Create on first run** (provisioning):
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
# beacon.env
|
|
265
|
+
ETHIACK_API_KEY=your-key
|
|
266
|
+
ETHIACK_API_SECRET=your-secret
|
|
267
|
+
ETHIACK_BEACON_NAME=my-beacon
|
|
268
|
+
ETHIACK_BEACON_CIDRS=192.168.1.0/24,10.0.0.0/8
|
|
269
|
+
# ETHIACK_PENTEST_SLUG=my-pentest # optional: auto-scope CIDRs to this pentest
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
The container calls `beacon create --yes` on startup. Multiple CIDRs can be provided as a comma-separated list. State is persisted in the `beacon-data` Docker volume so restarts are safe.
|
|
273
|
+
|
|
274
|
+
<p align="right"><small>(<a href="#readme-top">back to top</a>)</small></p>
|
|
275
|
+
|
|
276
|
+
## Links
|
|
277
|
+
|
|
278
|
+
- **Repository**: https://github.com/ethiack/beacon
|
|
279
|
+
- **Rathole**: https://github.com/rathole-org/rathole
|
|
280
|
+
- **WireGuard**: https://www.wireguard.com
|
|
281
|
+
|
|
282
|
+
<p align="right"><small>(<a href="#readme-top">back to top</a>)</small></p>
|