Skip to content

About

Ultra-lightweight, self-hosted security and administration panel for Alpine Linux.

Resources

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

Repository files navigation

eville soc

Ultra-lightweight, self-hosted security and administration panel for Alpine Linux.

eville soc is a single statically linked Go binary plus one tiny privileged helper process. It uses /proc, /sys, OpenRC, APK, ip, nft and local log files directly. There is no Node.js, Docker, database, cloud service, telemetry, CDN or third-party frontend framework.

Nothing leaves the server. The web UI listens on loopback only by default.

Browser ──HTTP/SSE──> eville-soc serve (uid eville, unprivileged)
                              │  Unix socket, 0660, JSON allowlist
                              ▼
                      eville-soc helper (uid 0, tiny allowlist)
                              │ fixed argv, never a shell
        ┌─────────────────────┼──────────────────────┐
        ▼                     ▼                      ▼
   OpenRC rc-*              APK / users              ip / nft / signals

Status

Version 0.3.1. All five implementation stages are present:

  1. Architecture, static build, authentication, Overview/SSE
  2. Process manager, OpenRC manager, log center
  3. Network center, isolated nftables blocklist
  4. APK package manager, local user manager
  5. Security events, audit checks, administration

This is a real administration tool. It reads and changes real Alpine state. There is no demo data and no fake success path: if the helper or a tool is unavailable, the UI reports a concrete error.

Resource measurements (actual)

Measured on an Alpine Linux 3.24 x86_64 host (8 vCPU / 7.5 GiB RAM), binary built with CGO_ENABLED=0, -trimpath, -ldflags "-s -w", GOMAXPROCS=2. The panel was also exercised inside a cgroup with memory.max=128 MiB and cpu.max=50%; no OOM events occurred.

Metric Result
Static binary 10,018,978 bytes (9.6 MiB)
Web process RSS, idle 18–20 MiB
Root helper RSS, idle 8–12 MiB
Total RSS, idle 26–32 MiB (PSS lower due shared text)
CPU, idle, no browser 0.35–0.45% of one core
CPU with 5 open SSE clients ~0.4–0.6% of one core
Active use (logs/firewall/APK) up to ~35 MiB RSS, <1% CPU
Login (PBKDF2 600k) under 50% CPU quota ~0.67 s
Overview page < 2 ms under the same quota
First Packages page / cached reload ~2.7 s / ~5.5 ms

Method: /proc/<pid>/status VmRSS/VmPSS and /proc/<pid>/stat utime+stime deltas over 60 s idle and 30 s with five SSE clients. packaging/measure.sh reproduces the process/RSS/CPU numbers on a running installation.

The test host is not a 512 MiB VPS. Even the upper 32–35 MiB range leaves large headroom on a 512 MiB VPS, but no claim of hardware testing on a specific low-end VPS is made here. Re-run packaging/measure.sh on the target machine.

Idle CPU was reduced by caching process command lines for 45 s, sharing one pre-encoded overview JSON between SSE clients, caching OpenRC status for 30 s, and using inotify for live log tails instead of unconditional 2 s polling. The helper returns transient heap to the OS after startup and every five minutes. These optimizations add no dependencies and no extra processes.

Features

Overview

CPU total and per core, memory/swap, load average, uptime, local filesystems, per-interface and aggregate RX/TX rates, process count, TCP/UDP socket counts, listening sockets, SSH connection count and OpenRC summary. Live updates use one SSE stream every 2 s. Network is sampled every 4 s, processes every 5 s, filesystems every 10 s and services every 15 s.

Processes

/proc-based process list with PID/PPID, user, name, CPU share, RSS, state, age, masked command line, search, user filter, sorting, flat/tree views and a detail page. SIGTERM and SIGKILL are sent only by the root helper. PID 1, kernel threads, sshd and eville soc processes are protected. SIGKILL requires the typed word KILL. Passwords/tokens/secrets in argv are masked.

Services

OpenRC only: rc-status, rc-service, rc-update. Start, stop, restart, runlevels, add/remove from runlevel and delete a service. Deletion stops the service, removes all runlevel links, backs up the init script and /etc/conf.d entry under /var/backups/eville-soc/service-removals/, then deletes those two files. It does not delete application data or APK packages. Critical boot, network, logging, SSH and eville soc services are protected; boot/sysinit services cannot be removed. Removal requires a confirmation nonce and typing DELETE <service>.

Packages

Installed packages, local repository search, available updates, install, remove, index refresh and system upgrade. All APK mutations are serialized in the helper; a second concurrent mutation is rejected. Upgrades and removals require a confirmation nonce. System upgrades are never automatic.

Users and groups

Local /etc/passwd//etc/group view with UID/GID, groups, shell, lock state and wheel membership. Create/delete users, change supplementary groups, lock/unlock, set passwords. Root, the web account, UID 0 and the last wheel administrator are protected. The web process never reads password hashes; the helper returns only active/locked/no-password/unknown state.

Network center

Interfaces, addresses, MACs, state, counters/rates, routes, DNS (read-only), TCP/UDP connections, SSH connections, listeners and firewall state. Interface up/down, temporary address add/remove and temporary route add/delete. Changes on interfaces/routes/addresses carry an automatic 120 s rollback and a "Keep change" action. Default-route interfaces and default routes are refused. Network changes never rewrite /etc/resolv.conf, Tor, torsocks or existing routing.

Security center (SOC)

The /security dashboard with open high/medium/low counts, failed authentication totals, top source addresses, firewall/baseline state, event filtering, automatic 15 s refresh, acknowledgement/reopen and one-click block of a source IP in the isolated firewall table. Acknowledgements are stored locally in /var/lib/eville-soc/web/soc-state.json. Detection uses SSH/auth log lines, panel login failures, crashed OpenRC services, error-like log lines, suspicious temporary-path processes, unknown listeners and baseline changes. Heuristics stay labeled; nothing is blocked automatically. The old /soc URL redirects to /security.

Security center

Local events derived from SSH auth log lines, crashed OpenRC services, error-like log lines, suspicious temporary-path processes (clearly marked heuristic), unknown listeners (heuristic) and a user-created baseline covering critical files, listeners, runlevels and the nftables ruleset. A baseline is never created automatically. Failed logins are observations, not proof of an attack.

Firewall

nftables is optional. If installed, the helper creates only its own inet eville_soc table at startup. Existing tables are never rewritten or deleted; initialization is idempotent.

  • Monitor mode (default): drop blocked source IPs and blocked TCP/UDP ports; all other traffic passes. Source allow rules are stored for strict mode.
  • Strict mode: optional. It refuses to activate unless every detected SSH listener port is in the allowed TCP set and not blocked. It drops the initial SYN of new inbound TCP connections except allowed ports/source IPs; loopback, ICMP and existing connections continue. UDP has no default-deny (that would break DNS); use explicit blocked UDP ports.
  • Source block/allow lists, TCP/UDP block lists and TCP/UDP allow lists are validated, stored root-only in /var/lib/eville-soc/firewall-blocklist.json, and recreated atomically at startup. Existing tables outside inet eville_soc are untouched. Rules carry counters visible in the read-only ruleset view.

Logs

Bounded tail reads (max 256 KiB / 5000 lines, no whole-file loading), file discovery under /var/log, search, category labels, line limits and live SSE tailing by byte offset. Supports /var/log/messages, auth/secure/sshd logs, application logs, nginx logs, eville soc's own audit log and more. Files that the unprivileged web user cannot read are read by the root helper after the same strict /var/log path validation. No journald.

Backups and rollback

A Backups page creates, verifies, restores and deletes root-owned archives under /var/backups/eville-soc (0700). Two scopes are available:

  • panel — /etc/eville-soc, /var/lib/eville-soc, /var/log/eville-soc;
  • system-config — /etc (users, SSH, services, APK world, keys, network configuration). This is a configuration backup, not a disk image.

Archives preserve ownership/modes, are mode 0600 and get a SHA-256 sidecar. Creation/verification/restore are performed by the root helper with path-safe Go tar/gzip streaming; no backup data is downloadable from the web UI. Restore verifies the sidecar and every path, creates an automatic pre-restore snapshot, restores only regular files (symlinks/hardlinks/devices are ignored), and never starts, restarts or reboots the server. Panel restore does not overwrite logs/audit. System-config restore leaves running daemons in their current state; configuration applies only when you choose to restart the relevant service later. A full root-filesystem/disk image is intentionally not produced by the web panel: it would be slow, multi-gigabyte and inconsistent while services run; use an external/offline backup tool for full images. Backups contain password hashes, keys and audit data and must be treated as secrets.

Audit

Read-only findings for exposed listening ports, SSH configuration, critical file permissions, administrative accounts, crashed services, nftables availability, local APK updates, suspicious process paths (heuristic) and log-file/syslog state. Every finding carries severity and a recommendation. Nothing is changed automatically.

Settings / Administration

Panel and runtime information, password change, terminate other sessions, backup instructions, unified links to services/APK/users/network/firewall, and reboot/shutdown. Reboot/shutdown require a confirmation nonce and the typed words REBOOT/SHUTDOWN.

Security model

  • The serve process runs as the unprivileged eville user. If started as root, it forks the helper, waits for its socket, then calls setgroups/setgid/setuid before serving HTTP. A second in-process parent watcher stops the helper if the web parent dies.
  • The helper listens on a Unix socket 0660 root:eville and verifies peer UID with SO_PEERCRED. Only fixed operations are accepted. Arguments are decoded strictly (DisallowUnknownFields) and validated (net.ParseIP, CIDR parsing, package/user/interface regexes, allowlisted shells/runlevels/actions).
  • No operation passes user input to a shell. Commands are executed with exec.Command and fixed argument vectors. nftables rules are generated from validated IPs on stdin.
  • Local administrator auth uses PBKDF2-HMAC-SHA256, 600,000 iterations, 16-byte salt, 32-byte key, constant-time comparison. Only a salted hash is stored. Credentials are root:eville 0640.
  • Sessions are in-memory random 256-bit IDs with 30 min idle / 12 h absolute lifetime, HttpOnly + SameSite=Strict browser-session cookies (Secure when TLS is enabled), per-session CSRF tokens, Origin/Sec-Fetch checks, and a 5-failure/10-minute login limiter. The cookie is not given a fixed 30-minute expiry; a 5-minute in-page heartbeat keeps the server-side idle timer alive while the panel is open. Stale login/setup forms redirect to a fresh form instead of dead-ending on "invalid CSRF token". Opaque Origin: null is accepted only for same-origin requests with a valid token.
  • UI responses use html/template auto-escaping. CSP is self-only with no inline scripts/styles, no external assets. X-Frame-Options DENY, nosniff, no-referrer and cross-origin isolation headers are set.
  • Dangerous actions require a single-use server-side confirmation nonce bound to the session and canonical arguments. Password values in nonce state are SHA-256 hashed, never retained in plaintext.
  • Audit events and login attempts are appended to /var/log/eville-soc/audit/audit.log with 10 MiB rotation. Secrets are not written there.
  • Binding is restricted by configuration validation to loopback addresses only. Remote use is through an SSH tunnel.

Threat-model limits

The helper's purpose is to let the unprivileged web account perform listed admin operations. Therefore compromise of the eville account is equivalent to panel-level root administration (but only through the fixed allowlist). The same is true of a compromise of the panel's authenticated session. Run eville soc on a dedicated host/VM, restrict SSH access, keep Alpine updated and use a long unique administrator password. There is no MFA, no multi-admin RBAC and no automatic intrusion response. Heuristic events are not attributed to attackers.

Build

Requirements: Alpine Linux 3.20+ and Go 1.22+ (build-only; apk add go). Runtime needs only BusyBox/OpenRC/APK; nftables is optional.

make build          # or: packaging/build.sh
make test

dist/eville-soc is static (CGO_ENABLED=0), stripped and trimmed. No external Go modules are used.

Install

make build
sudo packaging/install.sh            # install files, do not enable/start
# or
sudo packaging/install.sh --enable --start

The installer:

  • creates the system user/group eville (nologin) and adds it to adm if present;
  • creates /etc/eville-soc (root:eville 0750), /var/lib/eville-soc (root:eville 0750) with web-writable web/, /var/log/eville-soc (root:eville 0750) with web-writable audit/, /var/backups/eville-soc (root:root 0700);
  • installs /usr/bin/eville-soc, /etc/init.d/eville-soc, /usr/sbin/eville-soc-backup, /usr/sbin/eville-soc-restore;
  • writes the default config only if no config exists;
  • generates a one-time setup token if no credentials/token exist;
  • does not install packages, does not touch DNS/Tor/firewall/routing, and does not enable or start the service unless asked.

Complete initial setup locally:

sudo cat /etc/eville-soc/setup-token
sudo rc-service eville-soc start
ssh -L 8787:127.0.0.1:8787 user@server
# open http://127.0.0.1:8787/setup , enter token + password (12+ chars)

The token file is removed on success. Alternatively, before first start:

sudo EVILLE_ADMIN_PASSWORD='a long unique password' \
  /usr/bin/eville-soc passwd --config /etc/eville-soc/config.json

Configuration: /etc/eville-soc/config.json (see packaging/config.json.example). Only loopback listen addresses are accepted. backup_dir defaults to /var/backups/eville-soc. TLS is optional; SSH tunneling is the default remote-access method.

Update

# copy source to the server, then
make build
sudo packaging/install.sh            # replaces binaries, keeps config/credentials
sudo rc-service eville-soc restart

or make install INSTALL_ARGS="--enable". There are no database migrations.

Backup and restore

Use the Backups page to create, verify, restore and delete panel or system-config archives in /var/backups/eville-soc, or use the CLI:

sudo eville-soc-backup /root/eville-backup.tar.gz
sudo eville-soc-restore /root/eville-backup.tar.gz
sudo rc-service eville-soc start

Panel backups include /etc/eville-soc, /var/lib/eville-soc and /var/log/eville-soc; system-config backups include /etc. Both preserve ownership/modes, are written 0600, and include a SHA-256 file. They contain the administrator hash, keys, security baseline and audit log: treat them as secrets. Web restore creates a pre-restore snapshot, validates paths and never restarts the service or reboots. The CLI restore validates archive paths, refuses symlinks/hardlinks, stops the service, moves current logs aside to /var/log/eville-soc.pre-restore-TIMESTAMP, restores data, fixes top-level directory ownership and leaves the service stopped. Backups are kept by uninstall unless explicitly removed.

Uninstall

sudo packaging/uninstall.sh           # stop + remove binaries/init, keep data
sudo packaging/uninstall.sh --purge   # also remove config/data/logs/user

Layout

/usr/bin/eville-soc
/etc/eville-soc/config.json
/etc/eville-soc/auth.json          (root:eville 0640)
/var/lib/eville-soc/               firewall state (root), web/ baseline
/var/log/eville-soc/audit/audit.log (0600, web-owned)
/var/log/eville-soc/service*.log   (0600, root-owned)
/var/backups/eville-soc/           (0700, root-only archives)
/etc/init.d/eville-soc

Tests

go test ./... -count=1
go vet ./...

Coverage includes PBKDF2 known vectors, password/session/rate-limit behavior, config loopback enforcement, /proc and /net parsers, command-line masking, route/package parsing, helper argument validation, protected PID handling, helper protocol/error handling, CSRF/origin enforcement, confirmation canonical hashing, firewall rule generation/port validation, backup name/scope and restore-path validation, security headers, page template rendering and session expiry. See tests/README.md.

Explicit non-goals

  • No cloud services, telemetry, external API or CDN.
  • No Docker/Kubernetes/systemd/journald.
  • No PostgreSQL/Redis/Elasticsearch/InfluxDB/Prometheus/Grafana/SQLite.
  • No Node.js in production.
  • No automatic firewall/network/DNS changes, no automatic upgrades.
  • No editing of /etc/resolv.conf, Tor/torsocks or existing nftables tables.
  • No full filesystem scans and no long-term log indexing.

License

MIT. See LICENSE.

About

Ultra-lightweight, self-hosted security and administration panel for Alpine Linux.

Resources

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages