/iptablesweb

Show iptables contents in web frontend

Primary LanguageSvelteMIT LicenseMIT

iptablesweb

A small rust project that visualizes the contents of iptables in a web interface.

Also, an example how to embedd a SPA web application into a rust binary with minimal (or even no) runtime dependencies. It uses svelte, vite, tailwindcss, flowbite-svelte on the web frontend. And rust, warp on the backend.

Credits to the Rust+Vite+Svelte project https://github.com/fdeantoni/rust-vite-svelte and the iptables_exporter project https://github.com/kbknapp/iptables_exporter where this project took inspiration and code from.

Alt Text

To run it, download the latest release from the releases, make it executable and run it as root or sudo.

chmod +x iptablesweb
sudo ./iptablesweb

The web frontend is accessed on http://localhost:3030

Run with option --help to see the available command line options.

Development

To build the project from source, first build the web frontend:

cd web
npm install
npm run build

This creates a single page web application in the web/dist folder.

Then build the rust project:

cd ..
cargo build --release

This compiles the rust application and links the web frontend into the application binary. The binary is target/release/iptablesweb

Run it

sudo target/release/iptablesweb

It must be run as root or sudo to run the iptables-save command and process its output.