Commit Graph

168 Commits

Author SHA1 Message Date
Domingo Dirutigliano
6140fcbe81
Align the demo backend with the real nfproxy API
The stubbed `GET .../code` answered with `{ code }` while the real endpoint
is a PlainTextResponse returning the source, which is what crashed the demo
service page, and the save route was registered as POST where the real API
and the frontend both use PUT.

The seeded sample also carried a `strip_debug_header` filter that mutated
`HttpRequest.headers`. That silently does nothing: `headers` is a read-only
property over the parsed message, and nothing re-serialises it onto the wire
(a mangle forwards `current_pkt.raw_packet`, which the dict never touches).
Dropped it, leaving the one filter that behaves as shown, and brought the
filter counts and the packet counters back in line with it.
2026-09-03 18:42:37 +02:00
Domingo Dirutigliano
ba2703d4bf
Stop a non-string filter code from crashing the nfproxy page
`genericapi` ran every response body through `JSON.parse`, falling back to
the raw text only when that threw. The nfproxy filter source is served as a
PlainTextResponse, so a filter file that happens to be valid JSON came back
as a number/array/object. Mantine's CodeHighlight then calls `code.trim()`
on it, which throws and takes the whole page down with it. `42`, `"abc"`,
`[1,2]` and `{"a":1}` are all both valid JSON and valid Python, so they
pass the upload validation and leave the service page unreachable.

Responses declaring text/plain are no longer parsed, and the render site
type-checks the code before handing it to CodeHighlight.
2026-09-03 18:42:28 +02:00
Domingo Dirutigliano
090d117115
Keep a dragged firewall rule at its measured width
The Card carried Mantine's `w="100%"` prop, whose style props land in the
style attribute after anything passed via `style`, so it overrode the pixel
width dnd measures at lift time. On a `position: fixed` element `100%`
resolves against the viewport rather than the list, so grabbing a rule
snapped the card from 734px to 798px and pushed it past the right edge.

Moving the width into `style`, ahead of the dnd spread, leaves normal flow
untouched and lets the measured width win while dragging.
2026-09-03 18:42:16 +02:00
Domingo Dirutigliano
46fa029d75
Update frontend dependencies to latest
`bun update --latest`. Notably TypeScript 6 -> 7 (native compiler),
Mantine 9.3.2 -> 9.6.0, react-router 8.0.1 -> 8.3.1, vite 8.0.16 -> 8.2.2
and shiki 4.2 -> 4.4.3. `tsc --noEmit` and `bun run build` both pass.
2026-09-03 10:22:19 +02:00
Domingo Dirutigliano
72b3386d3e
Fix drag-and-drop reordering of firewall rules
Three separate defects made the rule list impossible to reorder:

- The Card's own `style` was placed after `{...provided.draggableProps}`,
  clobbering the `position`/`transform` dnd sets while dragging. The drag
  did start, but nothing moved on screen. Styles are now merged with dnd's
  winning, and the dragged card is highlighted.
- `Draggable index` used the position in the full `state` array and the
  rules of the other table were filtered out afterwards, leaving gaps.
  dnd requires contiguous indexes from 0 inside a Droppable, so a single
  rule in the other table broke the visible tab entirely. Visible rules
  are now re-indexed and mapped back to their `state` position on drop.
- `destination?.index || 0` reordered to the top instead of doing nothing
  when a rule was dropped outside the list.
2026-09-03 10:22:19 +02:00
Domingo Dirutigliano
08d83e0041
Publish a browsable demo on GitHub Pages
The real frontend, built against an in-memory backend, so the UI can be tried
without a Linux host, NET_ADMIN or a running firewall. A visitor can create,
edit, start, stop and delete services across all five modules and watch the UI
react as it would against a real instance; a reload restores the seed.

- frontend/src/js/demo.ts holds the mock. genericapi() and the socket.io client
  are the frontend's only two ways out to the network, so routing both through
  it was enough - no component knows the difference. It also emits the same
  "update" events the backend does, and ticks the packet counters of running
  services so the page looks alive.
- The demo lives behind IS_DEMO, which vite inlines as a literal, so a normal
  `bun run build` tree-shakes the module and its seed data away. Verified: no
  demo string survives in the production bundle.
- The workflow rebuilds on every push touching frontend/ or docs/ and deploys
  to demo.firegex.pwnzer0tt1.it, copying index.html to 404.html so deep links
  resolve on Pages.
2026-09-03 09:36:37 +02:00
Domingo Dirutigliano
2c3316b036
Harden the no-auth reverse-proxy mode
Rename the flag to --unsafe-disable-auth so the risk is visible at the call
site, and close the ways the mode could outlive itself:

- Keep an explicit -P/--startup-psw instead of dropping it. Without a password
  in the database, --no-unsafe-disable-auth brought firegex up in its
  initial-setup state, where anyone able to reach it could choose the password.
- Refuse /api/login, /api/set-password and /api/change-password while
  authentication is disabled: an anonymous caller could otherwise plant a
  credential that kept working once authentication was turned back on.
  run.py config --password still works, writing to the database from the host.
- Print a banner on every start/restart with authentication disabled. The flag
  is persisted in the config file, so a later bare `run.py start` inherits it.
- Report the change in `run.py config --unsafe-disable-auth`, which claimed
  "No configuration changes specified" while persisting it, and stop that
  command from nulling the stored port and host on the way.
- Expose the state as auth_disabled in /api/status and hide the logout button
  and the change-password entry, which were silent no-ops in this mode.

Tests cover both directions of the toggle, the socket.io handler, the password
endpoints and the -P handling.
2026-09-03 01:07:51 +02:00
Domingo Dirutigliano
0dd538621d
integrated more tooltips 2026-07-24 13:47:31 +02:00
Domingo Dirutigliano
bd55a7bc9c
integrated and refactore docs + minor changes 2026-07-23 16:53:09 +02:00
Domingo Dirutigliano
d27831c9ec
Merge branch 'dev' into dev-tmp 2026-07-23 13:45:25 +02:00
Domingo Dirutigliano
be7f46424a
Merge branch 'main' into feat/tls-support 2026-07-23 13:40:19 +02:00
Domingo Dirutigliano
c37d2b31e8
graphics and TLS feature total refactoring 2026-07-23 13:39:01 +02:00
Domingo Dirutigliano
53656d531c
minor fixes and integrated test 2026-07-22 15:10:31 +02:00
Domingo Dirutigliano
4125eff93f
minor adjustments + network address based access control 2026-07-22 07:54:38 +02:00
Sogoss
75c54f0155 Add transparent TLS proxying and certificate management for NFProxy and NFRegex
- Add Nginx stream proxy module for transparent TLS termination in NFProxy and NFRegex
- Add backend routes and SQLite schema for certificate management (upload, view, delete)
- Implement DNAT nftables redirection rules for deterministic TLS ports
- Add frontend React components (TLSConfigModal, TLSServiceFields) for certificate configuration
- Update Dockerfile and docker-entrypoint.sh to support Nginx stream module and sysctl forwarding
2026-07-20 12:25:30 +02:00
Domingo Dirutigliano
24634ec60b
mantine update 2026-06-21 11:49:53 +02:00
Domingo Dirutigliano
16f96aa6f6
using brotli 1.2 from pypi, fixed tests to py 3.14, removed from experimental pyproxy 2025-11-11 23:30:48 +01:00
Minei3oat
f3024cc9a8 Invalidate cache on login 2025-10-03 00:58:55 +02:00
Minei3oat
753ed241b6 Clear password fields after submit 2025-10-03 00:58:34 +02:00
Minei3oat
0c5a681f5b Reconnect to websocket on access_token change 2025-10-02 23:10:26 +02:00
Domingo Dirutigliano
92332e2ee0
frontend updates 2025-09-15 10:33:11 +02:00
Domingo Dirutigliano
cf43a651a7
removed useless frontend dependences 2025-07-28 19:24:44 +02:00
Domingo Dirutigliano
78166cdae3
removing -dom from react-router 2025-07-28 19:00:12 +02:00
Domingo Dirutigliano
97b3d97753
using zustand for localStorage data, fixed socketio on login 2025-07-28 16:01:41 +02:00
Domingo Dirutigliano
699060ae0a
Merge branch 'main' of github.com:Pwnzer0tt1/firegex 2025-07-28 15:45:45 +02:00
Domingo Dirutigliano
b49c42f06f
fixed: packet size of mnl including packet size it-self (was causing crash sometime) and frontend updates 2025-07-28 15:45:22 +02:00
Domingo Dirutigliano
b924991afd fix websocket connection 2025-07-06 17:42:59 +02:00
Domingo Dirutigliano
6853960b6d
feature: HttpFullRequest and HttpFullResponse implementation 2025-06-22 17:42:21 +02:00
Domingo Dirutigliano
a109ee8067
websocket fix + starting firegex as root if capsh fails 2025-04-12 22:15:08 +02:00
Domingo Dirutigliano
129a262704
RST docs + connection error on test 2025-04-12 20:34:45 +02:00
Domingo Dirutigliano
d0b2c67554
Revert "using also bridge table on network hooking"
This reverts commit 33b22a174c.
2025-04-12 20:32:52 +02:00
Domingo Dirutigliano
33b22a174c
using also bridge table on network hooking 2025-04-12 16:51:42 +02:00
Domingo Dirutigliano
35c46a223e
fixes to encodings, implemeneted ws frame parsing with decompression support 2025-03-16 13:37:37 +01:00
Domingo Dirutigliano
ee54671930
correctly supporting HTTP compression + more compression types supported 2025-03-15 10:01:33 +01:00
Domingo Dirutigliano
73c40d2f5d
data handler improves, written test for nfproxy, new option on parsing fail 2025-03-09 22:14:34 +01:00
Domingo Dirutigliano
3494d10032
docs completed 2025-03-05 14:05:31 +01:00
Domingo Dirutigliano
e31796b249
push partial docs 2025-03-05 10:02:15 +01:00
Domingo Dirutigliano
072745cc06
code push 2025-03-03 20:25:36 +01:00
Domingo Dirutigliano
8ae533e8f7
push: code changes x2 2025-02-28 21:14:09 +01:00
Domingo Dirutigliano
6a11dd0d16
push: code changes 2025-02-25 23:53:04 +01:00
Domingo Dirutigliano
8652f40235
nfproxy module writing: written part of the firegex lib, frontend refactored and improved, c++ improves 2025-02-20 19:51:28 +01:00
Domingo Dirutigliano
59652fc697
optional nfqueue fail-open option 2025-02-18 17:36:15 +01:00
Domingo Dirutigliano
ec3bd84aaf
Frontend re-styling 2025-02-12 22:24:59 +01:00
Domingo Dirutigliano
2fb77a348f
removed fastapi_socketio + general improves 2025-02-12 01:16:10 +01:00
Domingo Dirutigliano
f3ba6dc716
more RESTful APIs 2025-02-11 19:11:30 +01:00
Domingo Dirutigliano
676a2289da
improves on the nfregex binary x5 2025-02-04 22:52:26 +01:00
Domingo Dirutigliano
44d72dfff9
improves on the nfregex binary x3 2025-02-04 21:09:03 +01:00
Domingo Dirutigliano
ec279a4fc5
pushed edits 2025-02-02 22:27:12 +01:00
Domingo Dirutigliano
732b68ba82
fix frontend versions 2025-02-02 20:42:01 +01:00
Domingo Dirutigliano
2d8f19679f
nfqueue to hyperscan and stream match, removed proxyregex 2025-02-02 19:54:42 +01:00