formfill-broker 0.1.0__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.
- formfill_broker-0.1.0/LICENSE +21 -0
- formfill_broker-0.1.0/PKG-INFO +191 -0
- formfill_broker-0.1.0/README.md +168 -0
- formfill_broker-0.1.0/app/__init__.py +1 -0
- formfill_broker-0.1.0/app/broker.py +372 -0
- formfill_broker-0.1.0/app/otp.py +382 -0
- formfill_broker-0.1.0/app/pool.py +139 -0
- formfill_broker-0.1.0/app/uploads.py +157 -0
- formfill_broker-0.1.0/formfill_broker.egg-info/PKG-INFO +191 -0
- formfill_broker-0.1.0/formfill_broker.egg-info/SOURCES.txt +19 -0
- formfill_broker-0.1.0/formfill_broker.egg-info/dependency_links.txt +1 -0
- formfill_broker-0.1.0/formfill_broker.egg-info/entry_points.txt +2 -0
- formfill_broker-0.1.0/formfill_broker.egg-info/requires.txt +5 -0
- formfill_broker-0.1.0/formfill_broker.egg-info/top_level.txt +2 -0
- formfill_broker-0.1.0/mcp_server.py +285 -0
- formfill_broker-0.1.0/pyproject.toml +39 -0
- formfill_broker-0.1.0/setup.cfg +4 -0
- formfill_broker-0.1.0/tests/test_mcp.py +138 -0
- formfill_broker-0.1.0/tests/test_otp.py +140 -0
- formfill_broker-0.1.0/tests/test_pool.py +157 -0
- formfill_broker-0.1.0/tests/test_uploads.py +125 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 GAMA TRADE d.o.o.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: formfill-broker
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Isolated browser for form filling, with a stdio MCP server over open/fill/verify/OTP
|
|
5
|
+
Author-email: Renato Šuster <renato@gamatrade.ba>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Repository, https://github.com/gamai-io/formfill-broker
|
|
8
|
+
Project-URL: Issues, https://github.com/gamai-io/formfill-broker/issues
|
|
9
|
+
Keywords: mcp,browser,forms,automation,cdp
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Browsers
|
|
14
|
+
Classifier: Topic :: Software Development :: Testing
|
|
15
|
+
Requires-Python: >=3.9
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Provides-Extra: broker
|
|
19
|
+
Requires-Dist: fastapi==0.115.6; extra == "broker"
|
|
20
|
+
Requires-Dist: uvicorn[standard]==0.34.0; extra == "broker"
|
|
21
|
+
Requires-Dist: playwright==1.63.0; extra == "broker"
|
|
22
|
+
Dynamic: license-file
|
|
23
|
+
|
|
24
|
+
# FormFill Broker
|
|
25
|
+
|
|
26
|
+
<!-- mcp-name: io.github.renatoschust-dot/formfill-broker -->
|
|
27
|
+
|
|
28
|
+
An isolated browser API: Chromium runs in a locked-down container and a small
|
|
29
|
+
FastAPI service drives it over CDP, so an agent can fill web forms without ever
|
|
30
|
+
holding the browser session itself. It also ships an MCP (stdio) server, so any
|
|
31
|
+
MCP-capable client can call the same open / fill / verify / egress / OTP /
|
|
32
|
+
upload primitives as tools. Field values are passed per request and are never
|
|
33
|
+
stored by the broker:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
docker build -t ff-browser . && bash scripts/slot_up.sh 0 && pip install -r requirements.txt && uvicorn app.broker:app --host 127.0.0.1 --port 8030
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Broker listens on `http://127.0.0.1:8030`.
|
|
40
|
+
|
|
41
|
+
## HTTP API
|
|
42
|
+
|
|
43
|
+
| Method | Path | Purpose |
|
|
44
|
+
| --- | --- | --- |
|
|
45
|
+
| GET | `/health` | Broker and CDP health |
|
|
46
|
+
| POST | `/open` | Open a URL (`{"url": "...", "slot"?: 0}`) |
|
|
47
|
+
| GET | `/snapshot` | List visible interactive elements with refs |
|
|
48
|
+
| POST | `/click` | Click a snapshot ref (`{"ref": "e3"}`) |
|
|
49
|
+
| POST | `/fill` | Fill by ref/label/selector, optional `submit` ref |
|
|
50
|
+
| POST | `/verify` | Check `text`/`url_contains`, save screenshot evidence |
|
|
51
|
+
| POST | `/otp` | Read a verification code from an IMAP inbox (read-only) |
|
|
52
|
+
| POST | `/upload` | Decode base64 to a 0600 file under `FF_UPLOADS`, return sha256 |
|
|
53
|
+
| POST | `/press`, `/type` | Send a key or type text into the page |
|
|
54
|
+
| POST | `/egress` | Report browser public IP and geolocation |
|
|
55
|
+
| POST | `/close` | Close page and browser context |
|
|
56
|
+
|
|
57
|
+
## MCP server
|
|
58
|
+
|
|
59
|
+
`mcp_server.py` is a stdio Model Context Protocol server (JSON-RPC 2.0,
|
|
60
|
+
one JSON object per line) that wraps the HTTP API. It uses only the Python
|
|
61
|
+
standard library and writes logs to stderr only, so stdout stays clean.
|
|
62
|
+
|
|
63
|
+
Tools:
|
|
64
|
+
|
|
65
|
+
- `formfill_open` `{url}`
|
|
66
|
+
- `formfill_snapshot` `{}`
|
|
67
|
+
- `formfill_fill` `{fields: [{ref|label|selector, value}], submit?}`
|
|
68
|
+
- `formfill_click` `{ref}`
|
|
69
|
+
- `formfill_verify` `{text?, url_contains?}`
|
|
70
|
+
- `formfill_egress` `{}`
|
|
71
|
+
- `formfill_close` `{}`
|
|
72
|
+
- `formfill_health` `{}`
|
|
73
|
+
|
|
74
|
+
The broker URL defaults to `http://127.0.0.1:8030` and can be overridden with
|
|
75
|
+
`FF_BROKER_URL`. Requests time out after 60 seconds.
|
|
76
|
+
|
|
77
|
+
### opencode MCP config
|
|
78
|
+
|
|
79
|
+
```json
|
|
80
|
+
{"mcp": {"formfill": {"type": "local", "command": ["python3","/path/to/formfill-broker/mcp_server.py"], "enabled": true}}}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Run and verify
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
# broker must already be running on 127.0.0.1:8030
|
|
87
|
+
python3 -m pytest tests -q
|
|
88
|
+
bash scripts/mcp_smoke.sh
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
`scripts/mcp_smoke.sh` sends `initialize`, `notifications/initialized`,
|
|
92
|
+
`tools/list`, and a `formfill_health` call, then prints every response.
|
|
93
|
+
|
|
94
|
+
### OTP retrieval
|
|
95
|
+
|
|
96
|
+
Codes are read from an IMAP inbox with `BODY.PEEK[]`, so messages stay unread.
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
FF_MAIL_ACCOUNTS=./mail_accounts.json python3 -m app.otp --account demo --timeout 60
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
`mail_accounts.json` is not part of this repo; supply your own:
|
|
103
|
+
|
|
104
|
+
```json
|
|
105
|
+
{"accounts": [{"id": "demo", "email": "demo@example.com",
|
|
106
|
+
"imap": {"host": "imap.example.com", "port": 993, "tls": "SSL"},
|
|
107
|
+
"app_password": "<app password>"}]}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Browser slots
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
bash scripts/slot_up.sh 0 # start ff-slot0, CDP on 127.0.0.1:9330
|
|
114
|
+
bash scripts/slot_down.sh 0 # guarded: needs FF_ALLOW_SLOT0=1
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Configuration
|
|
118
|
+
|
|
119
|
+
| Variable | Default | Meaning |
|
|
120
|
+
| --- | --- | --- |
|
|
121
|
+
| `FF_CDP` | `http://127.0.0.1:9330` | Chrome DevTools endpoint |
|
|
122
|
+
| `FF_EVIDENCE` | `evidence` | Screenshot output directory |
|
|
123
|
+
| `FF_UPLOADS` | `/tmp/ff_uploads` | Upload directory (0700, files 0600) |
|
|
124
|
+
| `FF_MAIL_ACCOUNTS` | `mail_accounts.json` | IMAP accounts file |
|
|
125
|
+
| `FF_MAIL_ACCOUNT` | `default` | Default account id for `/otp` |
|
|
126
|
+
| `FF_SLOTS` | `0,1,2` | Slots `slot_up.sh` may start |
|
|
127
|
+
| `FF_PROXY` | `socks5://172.17.0.1:1080` | Proxy passed to the container |
|
|
128
|
+
| `FF_EGRESS_HOST` | — | `user@host` for `scripts/egress_up.sh` |
|
|
129
|
+
|
|
130
|
+
Screenshots in `evidence/` are runtime output and are git-ignored.
|
|
131
|
+
|
|
132
|
+
## Deployment (systemd)
|
|
133
|
+
|
|
134
|
+
Three units make the stack survive reboots. Unit files live in
|
|
135
|
+
`/etc/systemd/system/`.
|
|
136
|
+
|
|
137
|
+
| Unit | Type | Role |
|
|
138
|
+
| --- | --- | --- |
|
|
139
|
+
| `ffbroker.service` | simple, `Restart=always` | uvicorn `app.broker:app` on `127.0.0.1:8030` |
|
|
140
|
+
| `ff-iptables.service` | oneshot, `RemainAfterExit=yes`, `Before=docker.service` | re-adds the rule that lets containers reach the SOCKS5 egress on `172.17.0.1:1080` (idempotent `iptables -C ... \|\| iptables -I ...`) |
|
|
141
|
+
| `ff-slot0.service` | oneshot, `RemainAfterExit=yes`, `After=docker.service ff-iptables.service` | `scripts/slot_up.sh 0`, `ExecStop=docker rm -f ff-slot0` |
|
|
142
|
+
|
|
143
|
+
Install / enable (once):
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
systemctl daemon-reload
|
|
147
|
+
systemctl enable ff-iptables.service ffbroker.service ff-slot0.service
|
|
148
|
+
systemctl start ff-iptables.service
|
|
149
|
+
systemctl start ff-slot0.service
|
|
150
|
+
systemctl start ffbroker.service
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Prerequisite for egress (not a unit; the SSH tunnel is external):
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
FF_EGRESS_HOST=user@egress-host.example bash scripts/egress_up.sh
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Verify:
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
systemctl is-enabled ff-iptables ffbroker ff-slot0 # enabled enabled enabled
|
|
163
|
+
systemctl is-active ff-iptables ffbroker ff-slot0 # active active active
|
|
164
|
+
iptables -C INPUT -i docker0 -s 172.17.0.0/16 -p tcp --dport 1080 -j ACCEPT && echo rule-ok
|
|
165
|
+
curl -s http://127.0.0.1:8030/health # {"ok":true,...}
|
|
166
|
+
curl -s http://127.0.0.1:9330/json/version | jq -r .Browser
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Restart cycle (container is recreated by the unit, not by docker alone):
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
systemctl stop ff-slot0 && systemctl start ff-slot0
|
|
173
|
+
curl -s http://127.0.0.1:9330/json/version # 200 after ~2 s
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Notes:
|
|
177
|
+
|
|
178
|
+
- The container runs with `--restart unless-stopped` and **no** `--remove`
|
|
179
|
+
flag, so a docker daemon restart brings it back without losing the name.
|
|
180
|
+
- `ff-slot0.service` is idempotent: if `ff-slot0` is already running the
|
|
181
|
+
script exits 0 and leaves it alone; use `docker rm -f ff-slot0` (or
|
|
182
|
+
`systemctl restart ff-slot0`) to apply new flags.
|
|
183
|
+
- `iptables` is persisted by `ff-iptables.service`. A snapshot is also kept at
|
|
184
|
+
`/etc/iptables/rules.v4` (`iptables-save`), but `netfilter-persistent` is not
|
|
185
|
+
installed, so that file is a reference/restore artifact only.
|
|
186
|
+
- Broker environment overrides: drop `KEY=value` lines in `/etc/ffbroker.env`
|
|
187
|
+
(loaded via `EnvironmentFile=-/etc/ffbroker.env`).
|
|
188
|
+
|
|
189
|
+
## License
|
|
190
|
+
|
|
191
|
+
MIT — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# FormFill Broker
|
|
2
|
+
|
|
3
|
+
<!-- mcp-name: io.github.renatoschust-dot/formfill-broker -->
|
|
4
|
+
|
|
5
|
+
An isolated browser API: Chromium runs in a locked-down container and a small
|
|
6
|
+
FastAPI service drives it over CDP, so an agent can fill web forms without ever
|
|
7
|
+
holding the browser session itself. It also ships an MCP (stdio) server, so any
|
|
8
|
+
MCP-capable client can call the same open / fill / verify / egress / OTP /
|
|
9
|
+
upload primitives as tools. Field values are passed per request and are never
|
|
10
|
+
stored by the broker:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
docker build -t ff-browser . && bash scripts/slot_up.sh 0 && pip install -r requirements.txt && uvicorn app.broker:app --host 127.0.0.1 --port 8030
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Broker listens on `http://127.0.0.1:8030`.
|
|
17
|
+
|
|
18
|
+
## HTTP API
|
|
19
|
+
|
|
20
|
+
| Method | Path | Purpose |
|
|
21
|
+
| --- | --- | --- |
|
|
22
|
+
| GET | `/health` | Broker and CDP health |
|
|
23
|
+
| POST | `/open` | Open a URL (`{"url": "...", "slot"?: 0}`) |
|
|
24
|
+
| GET | `/snapshot` | List visible interactive elements with refs |
|
|
25
|
+
| POST | `/click` | Click a snapshot ref (`{"ref": "e3"}`) |
|
|
26
|
+
| POST | `/fill` | Fill by ref/label/selector, optional `submit` ref |
|
|
27
|
+
| POST | `/verify` | Check `text`/`url_contains`, save screenshot evidence |
|
|
28
|
+
| POST | `/otp` | Read a verification code from an IMAP inbox (read-only) |
|
|
29
|
+
| POST | `/upload` | Decode base64 to a 0600 file under `FF_UPLOADS`, return sha256 |
|
|
30
|
+
| POST | `/press`, `/type` | Send a key or type text into the page |
|
|
31
|
+
| POST | `/egress` | Report browser public IP and geolocation |
|
|
32
|
+
| POST | `/close` | Close page and browser context |
|
|
33
|
+
|
|
34
|
+
## MCP server
|
|
35
|
+
|
|
36
|
+
`mcp_server.py` is a stdio Model Context Protocol server (JSON-RPC 2.0,
|
|
37
|
+
one JSON object per line) that wraps the HTTP API. It uses only the Python
|
|
38
|
+
standard library and writes logs to stderr only, so stdout stays clean.
|
|
39
|
+
|
|
40
|
+
Tools:
|
|
41
|
+
|
|
42
|
+
- `formfill_open` `{url}`
|
|
43
|
+
- `formfill_snapshot` `{}`
|
|
44
|
+
- `formfill_fill` `{fields: [{ref|label|selector, value}], submit?}`
|
|
45
|
+
- `formfill_click` `{ref}`
|
|
46
|
+
- `formfill_verify` `{text?, url_contains?}`
|
|
47
|
+
- `formfill_egress` `{}`
|
|
48
|
+
- `formfill_close` `{}`
|
|
49
|
+
- `formfill_health` `{}`
|
|
50
|
+
|
|
51
|
+
The broker URL defaults to `http://127.0.0.1:8030` and can be overridden with
|
|
52
|
+
`FF_BROKER_URL`. Requests time out after 60 seconds.
|
|
53
|
+
|
|
54
|
+
### opencode MCP config
|
|
55
|
+
|
|
56
|
+
```json
|
|
57
|
+
{"mcp": {"formfill": {"type": "local", "command": ["python3","/path/to/formfill-broker/mcp_server.py"], "enabled": true}}}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Run and verify
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# broker must already be running on 127.0.0.1:8030
|
|
64
|
+
python3 -m pytest tests -q
|
|
65
|
+
bash scripts/mcp_smoke.sh
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
`scripts/mcp_smoke.sh` sends `initialize`, `notifications/initialized`,
|
|
69
|
+
`tools/list`, and a `formfill_health` call, then prints every response.
|
|
70
|
+
|
|
71
|
+
### OTP retrieval
|
|
72
|
+
|
|
73
|
+
Codes are read from an IMAP inbox with `BODY.PEEK[]`, so messages stay unread.
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
FF_MAIL_ACCOUNTS=./mail_accounts.json python3 -m app.otp --account demo --timeout 60
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
`mail_accounts.json` is not part of this repo; supply your own:
|
|
80
|
+
|
|
81
|
+
```json
|
|
82
|
+
{"accounts": [{"id": "demo", "email": "demo@example.com",
|
|
83
|
+
"imap": {"host": "imap.example.com", "port": 993, "tls": "SSL"},
|
|
84
|
+
"app_password": "<app password>"}]}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Browser slots
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
bash scripts/slot_up.sh 0 # start ff-slot0, CDP on 127.0.0.1:9330
|
|
91
|
+
bash scripts/slot_down.sh 0 # guarded: needs FF_ALLOW_SLOT0=1
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Configuration
|
|
95
|
+
|
|
96
|
+
| Variable | Default | Meaning |
|
|
97
|
+
| --- | --- | --- |
|
|
98
|
+
| `FF_CDP` | `http://127.0.0.1:9330` | Chrome DevTools endpoint |
|
|
99
|
+
| `FF_EVIDENCE` | `evidence` | Screenshot output directory |
|
|
100
|
+
| `FF_UPLOADS` | `/tmp/ff_uploads` | Upload directory (0700, files 0600) |
|
|
101
|
+
| `FF_MAIL_ACCOUNTS` | `mail_accounts.json` | IMAP accounts file |
|
|
102
|
+
| `FF_MAIL_ACCOUNT` | `default` | Default account id for `/otp` |
|
|
103
|
+
| `FF_SLOTS` | `0,1,2` | Slots `slot_up.sh` may start |
|
|
104
|
+
| `FF_PROXY` | `socks5://172.17.0.1:1080` | Proxy passed to the container |
|
|
105
|
+
| `FF_EGRESS_HOST` | — | `user@host` for `scripts/egress_up.sh` |
|
|
106
|
+
|
|
107
|
+
Screenshots in `evidence/` are runtime output and are git-ignored.
|
|
108
|
+
|
|
109
|
+
## Deployment (systemd)
|
|
110
|
+
|
|
111
|
+
Three units make the stack survive reboots. Unit files live in
|
|
112
|
+
`/etc/systemd/system/`.
|
|
113
|
+
|
|
114
|
+
| Unit | Type | Role |
|
|
115
|
+
| --- | --- | --- |
|
|
116
|
+
| `ffbroker.service` | simple, `Restart=always` | uvicorn `app.broker:app` on `127.0.0.1:8030` |
|
|
117
|
+
| `ff-iptables.service` | oneshot, `RemainAfterExit=yes`, `Before=docker.service` | re-adds the rule that lets containers reach the SOCKS5 egress on `172.17.0.1:1080` (idempotent `iptables -C ... \|\| iptables -I ...`) |
|
|
118
|
+
| `ff-slot0.service` | oneshot, `RemainAfterExit=yes`, `After=docker.service ff-iptables.service` | `scripts/slot_up.sh 0`, `ExecStop=docker rm -f ff-slot0` |
|
|
119
|
+
|
|
120
|
+
Install / enable (once):
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
systemctl daemon-reload
|
|
124
|
+
systemctl enable ff-iptables.service ffbroker.service ff-slot0.service
|
|
125
|
+
systemctl start ff-iptables.service
|
|
126
|
+
systemctl start ff-slot0.service
|
|
127
|
+
systemctl start ffbroker.service
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Prerequisite for egress (not a unit; the SSH tunnel is external):
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
FF_EGRESS_HOST=user@egress-host.example bash scripts/egress_up.sh
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Verify:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
systemctl is-enabled ff-iptables ffbroker ff-slot0 # enabled enabled enabled
|
|
140
|
+
systemctl is-active ff-iptables ffbroker ff-slot0 # active active active
|
|
141
|
+
iptables -C INPUT -i docker0 -s 172.17.0.0/16 -p tcp --dport 1080 -j ACCEPT && echo rule-ok
|
|
142
|
+
curl -s http://127.0.0.1:8030/health # {"ok":true,...}
|
|
143
|
+
curl -s http://127.0.0.1:9330/json/version | jq -r .Browser
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Restart cycle (container is recreated by the unit, not by docker alone):
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
systemctl stop ff-slot0 && systemctl start ff-slot0
|
|
150
|
+
curl -s http://127.0.0.1:9330/json/version # 200 after ~2 s
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Notes:
|
|
154
|
+
|
|
155
|
+
- The container runs with `--restart unless-stopped` and **no** `--remove`
|
|
156
|
+
flag, so a docker daemon restart brings it back without losing the name.
|
|
157
|
+
- `ff-slot0.service` is idempotent: if `ff-slot0` is already running the
|
|
158
|
+
script exits 0 and leaves it alone; use `docker rm -f ff-slot0` (or
|
|
159
|
+
`systemctl restart ff-slot0`) to apply new flags.
|
|
160
|
+
- `iptables` is persisted by `ff-iptables.service`. A snapshot is also kept at
|
|
161
|
+
`/etc/iptables/rules.v4` (`iptables-save`), but `netfilter-persistent` is not
|
|
162
|
+
installed, so that file is a reference/restore artifact only.
|
|
163
|
+
- Broker environment overrides: drop `KEY=value` lines in `/etc/ffbroker.env`
|
|
164
|
+
(loaded via `EnvironmentFile=-/etc/ffbroker.env`).
|
|
165
|
+
|
|
166
|
+
## License
|
|
167
|
+
|
|
168
|
+
MIT — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""FormFill broker application package."""
|