fail2ban for web attackers, with an AI judge. jevban follows your web server's access logs, spots clients probing for security holes, asks a decision model whether each one is really attacking, and bans the ones that are in your firewall.
$ jevban --eval tests/labeled_access.log # excerpt, timestamps and user agents trimmed
203.0.113.66 strike 1/3 score=16 [env-file,known-bad-path] via hard rule: "GET /.env HTTP/1.1" 404
192.0.2.77 BAN score=3 [near-known-bad] p=0.98 via local batch of 1: "GET /phpinfo2.php HTTP/1.1" 404
192.0.2.88 strike 1/3 score=3 [wordpress] p=0.92 via local batch of 1: "GET /wp-content/plugins/revslider/..." 404
192.0.2.99 strike 1/3 score=3 [wordpress] p=0.94 via local batch of 1: "POST /wp-login.php HTTP/1.1" 200
192.0.2.150 pass score=3 [wordpress] p=0.38 via local (cached): "POST /wp-login.php HTTP/1.1" 200
Regex filters can't tell the last two apart: both are POST /wp-login.php, one from a password
guesser and one from the site's owner. jevban's model sees each client's recent requests and a
plain-words description of your site, and decides.
- Why jevban
- How it works
- Quick start
- Deciders: local model, hosted API, or rules
- What it catches
- Rolling it out safely
- Configuration
- Command line
- Firewall actions
- Requirements and performance
- Security notes
- Building from source
- License and credits
Every public web server is crawled around the clock by bots that try /.env, /.git/config,
/wp-config.php.bak, /phpmyadmin/ and hundreds of other paths, looking for a leaked secret
or an unpatched app. A typical bot tries 20–50 URLs before moving on. fail2ban can stop them
with regex filters, but regexes can't weigh context: /wp-login.php is an attack on a static
site and an everyday login on a WordPress blog.
jevban keeps the fast, predictable parts of fail2ban and adds judgement where it is needed:
- Triage, not a black box. Cheap checks decide the clear cases instantly. Only the ambiguous ones go to the model, and the model can never overrule a hard rule.
- Runs the model itself. By default jevban runs OpenJev, an open decision model, in-process on llama.cpp. The first start downloads it; there is nothing else to install, no Python, and no data leaves the server.
- Or uses a hosted API. One line selects the Jev API or a compatible provider (Perplexity, Liquid, DigitalOcean, Abacus, Vercel) at a few cents per thousand decisions.
- Catches variants, not just exact strings. Requests are decoded before matching, and a
list of 2,454 known-bad paths is matched exactly and within 1–2 edits, so
/%2e%65%6e%76,/phpinfo2.phpand/wp-config.php.save1are caught without a rule for each. - Measurable.
--evalreplays a labelled log and reports precision and recall for the rules alone and for the full pipeline;--shadowruns the model on live traffic without letting it ban. - fail2ban semantics.
findtime,maxretry,bantime, increasing bans for repeat offenders,ignoreip, bans that survive restarts, and actions for iptables, nftables, ufw, firewalld, fail2ban itself, the Windows firewall, or your own command. - One small binary for Linux and Windows, written in Free Pascal.
access.log ─▶ decode + normalize ─▶ score: signatures + known-bad paths
│
┌────────────────────────────┼─────────────────────────────┐
score 0 score ≥ 10 (hard rule) in between
nothing to judge strike now, no model call queued for the model
│ │
│ one batched request every few seconds
│ p ≥ 0.97 ban · p ≥ 0.80 strike
│ p ≥ 0.50 REVIEW (logged, no strike)
│ (the thresholds of OpenJev; each provider's own)
▼ │
3 strikes within 10 minutes ◀─────────────┘
│
▼
ban for 1 hour (doubling for repeat offenders): in the firewall,
at Cloudflare's edge for every site in the account, or both
- Decode and normalize. Apache's
\xhhescapes and URL encoding (twice, to undo double encoding) are reversed, and the path is lowercased with//and/./collapsed. - Score. About 30 weighted signatures (secrets, traversal, injection, scanner tools…) and the known-bad path list add up to a score. Most traffic scores 0 and is only kept as context.
- Hard rules. A score of 10 or more (
/.env,../,${jndi:,union select, sqlmap…) is a strike immediately, so an obvious scanner is banned by its third probe, while it is still probing. - The model judges the middle ground. Flagged clients are queued and sent in one batch
every 5 seconds (or 1,000 lines, or 8 clients). The model sees the client's flagged
requests, its other recent requests, and your
site =description, and returns the probability that the client is attacking. A verdict is reused for 60 seconds, so a scanner firing 200 probes costs one question. The model alone never strikes a request that was flagged for nothing but its user agent and was answered: a user agent says who a client is, not what it did, and an uptime monitor fetching/every five minutes is not an attack. At most, such a request is logged as REVIEW. - Ban.
maxretrystrikes withinfindtimeban the client forbantime: in the server's firewall, and with[cloudflare]at Cloudflare's edge (see "Behind Cloudflare"). Bans are saved and restored across restarts, and lifted when they expire.
Download jevban-<version>-linux-x64.tar.gz from the Releases page.
It needs glibc 2.35 or newer (Ubuntu 22.04, Debian 12, Fedora 36 and later) and a CPU with AVX2.
sudo mkdir -p /opt/jevban && sudo tar -C /opt/jevban --strip-components=1 -xzf jevban-*-linux-x64.tar.gz
sudo install -D -m 644 /opt/jevban/jevban.ini /etc/jevban/jevban.iniEdit /etc/jevban/jevban.ini: set logpath to your access logs and describe your site in
site = (see Configuration). Then see what it would do, without banning
anything:
sudo /opt/jevban/jevban --test /var/log/apache2/access.logThe first run downloads the model (5.6 GB, once) into /var/lib/jevban/models. When you're
happy with the decisions, run it as a service:
sudo /opt/jevban/jevban --dry-run # live, but only log the firewall commands
sudo install -m 644 /opt/jevban/jevban.service /etc/systemd/system/
sudo systemctl enable --now jevban
sudo /opt/jevban/jevban --list # active bansDownload jevban-<version>-windows-x64.zip from the Releases page
and unzip it. Its jevban.ini is set up for Apache Lounge (C:\Apache24\logs\access.log) and
the Windows firewall (netsh). From an elevated (Administrator) prompt:
jevban.exe --test C:\Apache24\logs\access.log
jevban.exe --dry-run
jevban.exeThe model is kept in models\ next to jevban.exe. jevban runs as a console program; to start
it at boot, use Task Scheduler with "run with highest privileges".
To try jevban without the 5.6 GB download, use the signatures alone, or a hosted API:
jevban --test access.log --mode rules
TYPESAFE_API_KEY=... jevban --test access.log --provider typesafemode |
What decides | Needs |
|---|---|---|
local (default) |
OpenJev in-process on llama.cpp | ~7 GB of RAM; the model downloads on first start |
jev |
A hosted decision API (provider =) or any Jev-compatible server (url =) |
An API key, or your server |
rules |
The signatures alone | Nothing |
If the model can't be loaded or the API fails, jevban logs why and the signatures decide, so protection never stops.
local_model |
Size | RAM | Accuracy, model card |
|---|---|---|---|
flash-9b (default) |
5.6 GB | ~7 GB | 79.3% (16-bit: 80.0%) |
flash-9b-q5, flash-9b-q6 |
6.5, 7.4 GB | ~8–9 GB | |
flash-9b-q8 |
9.5 GB | ~11 GB | 79.7% |
27b |
16.5 GB | ~18 GB | 82.8% (16-bit: 83.2%) |
27b-q5, 27b-q6, 27b-q8 |
19.2, 22.1, 28.6 GB | ~21–30 GB | Q8: 82.6% |
You can also give the path to any .gguf file. Accuracy figures are from the OpenJev model
cards' validation set; on their 10,000-question benchmark the 27B scores 84.1% and Flash 9B
79.4%. The OpenJev weights are licensed CC BY-NC 4.0, free for non-commercial use; a
commercial licence is available from their authors.
jevban reproduces OpenJev's reference readout: the same prompt and chat template, the scores
of the option letters at the first output position, and the calibration constants published
for each model family (overridable with readout_t, noul_t and noul_bias).
[decider]
provider = typesafe ; the key comes from api_key = or TYPESAFE_API_KEYprovider |
Service | Model | Key variable | Input, per 1M tokens |
|---|---|---|---|---|
typesafe |
Jev API | jev-latest |
TYPESAFE_API_KEY |
$0.042 |
perplexity |
Perplexity decisions | pplx-decider-latest |
PERPLEXITY_API_KEY |
$0.02 |
perplexity-flash |
same | pplx-decider-flash-latest |
PERPLEXITY_API_KEY |
$0.01 |
liquid |
Liquid AI d1 | d1.1 |
LIQUID_API_KEY |
see provider |
digitalocean |
DigitalOcean inference | typesafe-jev-1.13.0 |
MODEL_ACCESS_KEY |
see provider |
abacus |
Abacus.AI RouteLLM | jev-latest |
ABACUS_API_KEY |
$0.042 |
vercel |
Vercel AI Gateway | typesafe-ai/jev |
AI_GATEWAY_API_KEY |
see provider |
gemini |
Google Decisions API | gemini-decision-1 |
GEMINI_API_KEY |
$0.10 (free tier: 200 requests and 50,000 tokens a minute) |
Output tokens are free with all of them. A flagged client costs roughly 500–800 input tokens,
so 1,000 decisions cost a few cents. Endpoints and model names are from each provider's
documentation (October 2026; Gemini November 2026); url = and model = override them. Each
endpoint has been checked to answer jevban's request; jevban has not yet been run against them
with paid keys.
gemini asks the same questions over Google's own request shape: the client state goes as the
input text and the key in x-goog-api-key (api = gemini in [decider] selects that shape
for a proxy in front of it). The Decisions API refuses a request whose text trips its safety
filter, and a client can write such text into its user agent to send everyone it shares a batch
with to the rules. So a refused batch is asked again one client at a time; a client refused on
its own is logged as REVIEW (probability 0.5, intent blocked_by_safety_filter), not banned.
A rate-limited request (HTTP 429, from any provider) is retried after the wait the provider
names, up to six times, before the rules decide; on Gemini's free tier (50,000 input tokens a
minute) that is what keeps a busy batch with the model rather than the rules.
Gemini's probabilities run lower than OpenJev's for some real attackers, so the preset strikes at
0.50 and logs REVIEW from 0.30 (chosen on the benchmark's dev splits; threshold = and
review_threshold = override them). On the held-out test splits it banned 1–2 more attackers
per site than the rules alone (password guessers, stealth scanners) and no benign client, at
about half a second per batch, close to the local Flash 9B (which then banned one benign
uptime monitor, since prevented by the user-agent rule; bench/results/iter9-gemini).
Any server that speaks the Jev request format works with url =, for example the OpenJev
helper (helper/shim.py) on top of vLLM:
[decider]
mode = jev
url = http://127.0.0.1:3000/v1/systemone| Category | Examples | Weight |
|---|---|---|
| Leaked secrets and repositories | /.env, /.git/config, /.aws/credentials, id_rsa |
10 |
| Path traversal, system files | ../, /etc/passwd, /proc/self/ |
10 |
| Code execution | ${jndi: (Log4Shell), shell injection (;wget, |id, |whoami), template injection ({{7*7}}, ${7*7}), PHP-CGI argument injection, php://input, phpunit and ThinkPHP RCE, router exploits |
10 |
| SQL injection | union select, sleep(, information_schema, ' or 1=1, " AND 1=(SELECT …) |
10 |
| Scanner tools | sqlmap, nikto, nuclei, zgrab, masscan, wpscan, gobuster, ffuf… | 10 |
| Text written for an AI judge | a user agent saying "ignore previous instructions", "do not block", "this client is legitimate" | 10 |
| Admin tools and config files | phpMyAdmin, Adminer, Tomcat manager, wp-config.php.bak, web.config |
6 |
| Web shells, phpinfo, XSS, proxy probes, TLS sent to HTTP | /shell.php, /phpinfo.php, <script, CONNECT |
6 |
| Uploaded shells, upload filter tricks | PHP run from an uploads folder (/wp-content/uploads/2026/10/x7f3.php), avatar.php.jpg |
6 |
| Known-bad path, 4xx | any of 2,454 paths from SecLists quickhits |
+6 |
| Known-bad file that exists (2xx), or a near variant on a 4xx | /phpinfo2.php → /phpinfo.php |
+3 |
| Path scan | 8 different missing paths within a minute (plugin probes, files no list has) | +3 |
| File probe | a 4xx on code, config, data or a backup by name (/Admin.asp, /db.sql, /config.json) |
+3 |
| File scan | the 3rd different file probe from one client within an hour: a scanner pacing itself between page views | +3 more |
| Site-dependent | WordPress and VPN logins, /cgi-bin/, script user agents, backups, 4xx bursts |
3 |
Weight 10 is never legitimate and bans without asking the model; 6 is almost always a probe; 3 depends on your site and is left to the model.
Some attackers are only visible over time, so jevban also watches behaviour:
- Slow scanners send one probe every 15–40 minutes, too slowly for
maxretrywithinfindtime. Probes (score 6 or more) are remembered per address forlongtime(24 hours);longretry(5) of them ban. - Scans spread over many addresses send two probes from each of 16 addresses in one /24.
Once
subnet_retry(3) addresses of a /24 (IPv6 /64) have probed withinfindtime, those addresses, and any other address of that subnet that probes, are banned. Only addresses that probed are banned, never the whole subnet, which may be a NAT or a mobile carrier.
Add your own rules in a file:
# signatures = /etc/jevban/extra.rules
# <weight> <url|request|agent|any> <tag> <regex>
10 url secret-admin ^/my-hidden-admin
6 agent bad-bot BadBot/\d
A ban that hits a real customer is worse than a missed scanner, so jevban gives you three ways to check its judgement before trusting it:
--test FILEreplays a log and prints every decision without banning anything.--shadow(orshadow = 1) runs live, asks the model and logs its verdict next to each decision, but only the signatures ban. Run it for a week and compare.--eval FILEreplays a labelled log (attack<TAB>lineorbenign<TAB>line) and reports, for the signatures alone and for the full pipeline: true and false positives, precision, recall, attackers banned, and benign clients banned.
On the included synthetic WordPress set (tests/labeled_access.log, 73 requests from 13
clients), with Flash 9B on a 4-core CPU:
| Attack requests caught | Missed | Benign requests flagged | Benign clients banned | |
|---|---|---|---|---|
| Signatures alone | 7 | 6 | 0 | 0 of 6 |
| Hard rules + Flash 9B | 13 | 0 | 0 | 0 of 6 |
The model caught a WordPress plugin prober and a password guesser that the signatures can't
separate from the site's owner, whom it let through. This set is synthetic; label a day of
your own traffic and run --eval before relying on the numbers.
Model verdicts between 0.5 and the strike threshold are logged as REVIEW for you to audit.
jevban --digest /var/log/apache2/access.log.1 -o digest.md--digest replays a log through the rules, bans nothing, and writes a Markdown report sized for
one request to a large-context model (--digest-tokens, 200,000 by default). On a 63,000-line
lab shop log (LogarX) it came to about 42,000 tokens. It has:
- every client the prefilter flagged: user agent, counts, tags, highest score, ban reason, and its requests in compact form, including the ones before it was first flagged. Flagged but not banned come first, ranked by score and then by how rare their tags are, because that is where a missed attacker is. On the synthetic test sets, every attacker the rules missed that the prefilter had flagged was in the top 9 of that list;
- 4xx paths no rule flagged that two or more clients asked for (favicons, touch icons,
robots.txt, sitemaps and/.well-known/left out): new probes, or the site's own broken links; - a note that every request line and user agent was written by the client and is data, not instructions.
Ask the model what was missed, which signatures or known-bad paths to add, or how to describe
your site; then check any new rule with --eval before trusting it. Clients the prefilter never
flags are not in the report (on the synthetic web app, password guessers whose logins look like
its API calls); they only show up through the 4xx table.
bench/run.sh measures quality and speed; every change to the detection is checked against it,
and benign clients banned must not go up.
- Synthetic corpora (
bench/gen_corpus.py): three site types (a WordPress blog, a static site, a web app with an API and an admin panel), each with a dev split to tune on and a held-out test split to report on. The benign traffic includes what trips cheap checks (API clients with script user agents, link checkers, SEO crawlers, monitors, the owner logging in); the attacks include what dodges them (path variants, encodings, slow scanners, scans spread over a subnet, scanners hiding between page views, prompt-injecting user agents). - A labelled lab log: the LogarX/Zodiarc shop
log (63,000 lines of real Apache output from a test shop, browsed by scripts and attacked
with real tools: dirb, gobuster, sqlmap…; a label on every line), downloaded at benchmark
time and checksum-pinned (
bench/fetch_logarx.py; it has no licence, so it is not in the repository). It is not internet traffic, and its attackers are easy (the rules alone ban them all); it mostly measures false positives. - Live:
bench/live.pymeasures wall-clock time to a ban with the daemon tailing a log written in real time.
Signatures and behaviour rules alone (no model), held-out test splits and LogarX:
| Benign clients banned | Attackers banned | Attack requests that reached the server | |
|---|---|---|---|
| WordPress test | 0 of 73 | 44 of 51 | 196 |
| Static site test | 0 of 72 | 48 of 52 | 170 |
| Web app test | 0 of 79 | 43 of 51 | 216 |
| LogarX (lab) | 0 of 789 | 126 of 126 | 536 |
The attackers the rules still miss are the ones that look like ordinary use (password guessing, plugin probing, stealthy scanning between page views); those are the model's job. With a model on the same held-out test splits:
| Rules alone | + Gemini Decision 1 | + OpenJev Flash 9B (local, 4-core CPU) | Benign banned | |
|---|---|---|---|---|
| WordPress test | 44 of 51 | 46 of 51 | 47 of 51 | 0 |
| Static site test | 48 of 52 | 49 of 52 | 49 of 52 | 0 |
| Web app test | 43 of 51 | 44 of 51 | 44 of 51 | 0 |
| Time for the split | under a second | 18–128 s | 7–26 minutes |
The models add password guessers and stealth scanners. Before the user-agent rule above,
Flash 9B banned one uptime monitor on the static site (five separate verdicts at 0.80–0.84 on
GET /); with it, none (bench/results/iter9-gemini, iter10-agent-guard; Flash's
WordPress and web app figures are from before the rule, which only ever removes strikes).
Three small open decision models were also tested (Julia 1, OpenDecider-nano, TinyJev 0.6B) and are
not supported: Julia 1 banned 56 of 73 benign WordPress clients, and the other two caught fewer
attackers than the rules alone (bench/results/iter11-small-models; bench/server_eval.sh runs the
same test against any /v1/systemone server).
The work is split by how certain a request is. Weight-10 matches are hard rules: never
legitimate, decided without the model. Requests that score below 3 never reach it. Everything
in between (a WordPress login, a plugin path that 404s, a path scan, a file probe, a script
user agent) is the model's call, judged per client with its recent requests and your site
description. On the WordPress test split (Flash 9B, iteration 4) that was 137 model calls: 35 strikes and 292 passes,
against 34 hard-rule decisions. Rules alone never strike these clients, so every password
guesser the model banned (3 of 3 on WordPress) is one the rules let through, and every pass
is a site-dependent request that a stricter rule would have had to ban or ignore blindly.
Behind Cloudflare (or any reverse proxy), Apache logs the proxy's address, not the visitor's.
On one real WordPress server 82% of a day's requests came from 1,430 Cloudflare addresses, and
the rules would have banned 343 of them: each one many visitors, none of them the attacker, 19
of them carrying the site's own wp-cron calls. jevban warns at startup when most requests
come from Cloudflare's addresses.
-
Log the visitor. In Apache,
mod_remoteipwith Cloudflare's header and ranges:RemoteIPHeader CF-Connecting-IP RemoteIPTrustedProxy 173.245.48.0/20 103.21.244.0/22 103.22.200.0/22 103.31.4.0/22 RemoteIPTrustedProxy 141.101.64.0/18 108.162.192.0/18 190.93.240.0/20 188.114.96.0/20 RemoteIPTrustedProxy 197.234.240.0/22 198.41.128.0/17 162.158.0.0/15 104.16.0.0/13 RemoteIPTrustedProxy 104.24.0.0/14 172.64.0.0/13 131.0.72.0/22 RemoteIPTrustedProxy 2400:cb00::/32 2606:4700::/32 2803:f800::/32 2405:b500::/32 RemoteIPTrustedProxy 2405:8100::/32 2a06:98c0::/29 2c0f:f248::/32
and
%ainstead of%hin theLogFormat(a2enmod remoteip; the ranges are cloudflare.com/ips). WordPress and its plugins then see the visitor too. -
Ban at Cloudflare. The origin's firewall never sees a visitor who comes through Cloudflare. With
[cloudflare], jevban keeps one IP list in the account (jevban) and adds one rule to each site,ip.src in $jevban(block), so an address caught on one site is blocked on all of them; a new site gets its rule the next time jevban starts. The list is replaced whole after each batch of bans (one API call), from the bans jevban holds, so a failed update is put right by the next one; expired bans leave it.[cloudflare] account_id = 0123456789abcdef0123456789abcdef api_token = ; or CLOUDFLARE_API_TOKEN
The token needs Account Filter Lists: Edit, Zone WAF: Edit and Zone: Read. The free plan allows one custom list (10,000 addresses in all lists) and five custom rules per site; with the one list already used, set
list =to that IP list. -
Keep
[action]too. Requests straight to the server's address (on that server, 18% of the day, half of them probes) bypass Cloudflare; a firewall ban stops those, and a visitor's address in the origin firewall cannot hurt traffic that arrives through Cloudflare. Or allow only Cloudflare's ranges to ports 80 and 443 and drop the rest.
[cloudflare] implies behind = cloudflare in [jevban]: Cloudflare's own addresses are never
judged or banned, whatever the log says.
Settings live in /etc/jevban/jevban.ini (or jevban.ini next to the binary); the shipped file
documents every key. The ones you'll want to look at:
| Key | Default | Meaning |
|---|---|---|
[jevban] logpath |
/var/log/apache2/access.log |
Logs to follow; comma separated, wildcards allowed |
ignoreip |
127.0.0.0/8 ::1 |
Addresses and CIDR ranges never judged or banned |
behind |
cloudflare: the site is behind it; its addresses are never judged or banned |
|
findtime / maxretry / bantime |
600 / 3 / 3600 |
Strikes within seconds, strikes for a ban, ban seconds |
bantime.increment / bantime.maxtime |
1 / 604800 |
Double the ban for repeat offenders, up to a week |
[decider] site |
a generic public site | What your server runs, in plain words: the most important setting |
mode |
local |
local, jev or rules |
local_model |
flash-9b |
Which OpenJev model, or a .gguf path |
provider |
A hosted API: typesafe, perplexity, liquid, gemini, … |
|
threshold / instant_threshold |
0.80 / 0.97 |
Model probability for a strike / an instant ban |
override_score |
10 |
Score that strikes without asking the model (0 = model decides all) |
review_threshold |
0.5 |
Model probability logged as REVIEW |
batch_interval |
5 |
Seconds between model batches |
decider_backlog |
4 |
Batches waiting for a busy model; beyond it the rules decide at once |
shadow |
0 |
Log the model's verdicts, ban on the rules only |
[action] type |
iptables (Linux), netsh (Windows) |
Firewall backend |
port |
80,443 |
Ports the ban applies to |
dry_run |
0 |
Log firewall commands instead of running them |
[cloudflare] account_id |
Ban at Cloudflare's edge for every site in the account (with api_token; see "Behind Cloudflare") |
A good site = makes a large difference. For example:
site = A WordPress blog at example.com. The owner logs in at /wp-login.php and edits posts in
/wp-admin/; an uptime monitor checks /health with curl. It runs no phpMyAdmin or other
PHP apps, and serves no backups or config files.jevban [options]
-c, --config FILE settings (default /etc/jevban/jevban.ini, else next to the binary)
-l, --log FILE access log or wildcard pattern to follow (repeatable)
--from-start read the logs from their start, not just new lines
-t, --test FILE read FILE once, print each decision, ban nothing
--eval FILE replay a labelled log and score the decisions (--eval-json FILE: as JSON)
--digest FILE replay FILE through the rules and write a review report for a model
-o, --out FILE where --digest writes (default: standard output)
--digest-tokens N the report's size limit (default 200000)
--shadow ask the model and log its verdicts, but let the signatures ban
-n, --dry-run log the firewall commands instead of running them
-m, --mode MODE local | jev | rules
--model NAME local model, or a .gguf path
-p, --provider NAME a hosted decision API (typesafe, perplexity, gemini, ...)
-u, --jev-url URL a Jev-compatible server
-a, --action TYPE iptables | ipset | nftables | ufw | firewalld | fail2ban | netsh | command | none
-b, --batch SECONDS seconds between model batches
--list print the active bans and exit
-v, --verbose log every flagged request and verdict
--version
type |
How a ban is applied |
|---|---|
iptables (Linux default) |
A jevban chain hooked into INPUT for the web ports; IPv6 through ip6tables |
ipset |
iptables with the bans in a hash set (IPv4 jevban, IPv6 jevban6) behind one rule: use it when bans run into the thousands |
nftables |
A jevban table with IPv4 and IPv6 address sets |
ufw |
ufw prepend deny from <ip> to any port <port> |
firewalld |
A runtime rich rule |
fail2ban |
fail2ban-client set <jail> banip <ip>: hand the ban to an existing jail |
netsh (Windows default) |
A Windows Firewall block rule |
command |
Your own actionban / actionunban commands |
none |
Log only |
The iptables, ipset and nftables presets have been tested for real: ban, unban on expiry,
and cleanup on stop, for IPv4 and IPv6. The iptables preset adds one rule per address, which
the kernel checks one by one for every packet, and adding a ban gets slower too (50 bans took
191 ms with no bans in place, 419 ms with 20,000); ipset and nftables keep the addresses in
a hash set, where both stay flat.
With [cloudflare], every ban also goes into one IP list in the Cloudflare account, blocked
on every site by one rule each: the only place a ban works for visitors who arrive through
Cloudflare. It runs alongside type, which still stops requests made straight to the server
(see "Behind Cloudflare").
Actions follow fail2ban's lifecycle (actionstart, actionban, actionunban, actionstop),
and any of the four commands can be overridden in [action] with tags such as <ip>,
<port>, <name> and <bantime>.
-
Linux: x86-64 with AVX2, glibc 2.35+ (Ubuntu 22.04, Debian 12, Fedora 36 and later); root or
CAP_NET_ADMINto change the firewall. -
Windows: x64; an Administrator prompt for the Windows firewall.
-
Logs: detected per line, so one daemon can follow a mix:
- Apache
common,combinedandvhost_combined, and nginx's defaultcombined; - IIS W3C Extended (
u_ex*.log), with any set of fields: the columns are read from each file's#Fields:header, also when it changes mid-file or lies a gigabyte behind the point jevban starts at; - JSON, one object per line: nginx
log_format ... escape=jsonwith the usual variable names (remote_addr,requestorrequest_method+request_uri,status,http_user_agent,time_localortime_iso8601), Caddy's access log and Traefik's JSON access log.
IPv4 and IPv6. Rotation by rename or copytruncate is followed; with a wildcard, files idle for a day are let go (IIS keeps every daily log) and picked up where they were if written again. Behind a reverse proxy, log the real client address (
mod_remoteip, nginxreal_ip, IIS "X-Forwarded-For" asc-ipvia the ARR helper). - Apache
-
Memory: about 1 GB more than the model file in local mode (~7 GB for Flash 9B); a few MB with a hosted API or rules only, plus about 1 KB per tracked client (
max_clients, 20,000 by default; 500,000 clients took under 500 MB). -
Speed (
--test, rules, one core): the parser, signatures and known-bad paths handle about 200,000 lines a second with typical traffic and about 35,000–60,000 in a flood where every line is a new address, the same with 20,000 or 500,000 clients tracked. Signature and near-miss results are cached per distinct URL, user agent and path (bounded), so repeated traffic costs a lookup. IIS logs run at about 130,000 lines a second and JSON logs at about 95,000. -
Ban storms: firewall commands run on their own thread, and bans queued meanwhile go to the firewall together: one
ipset restore,nft -foriptables-restoreper batch. 2,000 addresses banned at once were all in the firewall within 0.2 s, with the log read without a pause; one command per ban took 70–80 s. Restoring 1,000 bans at startup takes the same single batch. -
The model under load: in local mode on a 4-core CPU, Flash 9B reads about 20 prompt tokens a second, about 20 seconds per flagged client; batching, verdict caching and hard rules keep the queue small. When more batches wait than
decider_backlog(4), new ones are decided by the rules at once and their clients are offered to the model again with their next flagged request, so a large attack never leaves clients waiting hours for a verdict. With a GPU, use llama.cpp libraries built with CUDA or Vulkan (llama_lib_dir) and setgpu_layers = 999. A hosted API answers in well under a second.
- Bans come after the fact. jevban reads the log after the server has answered, so a client's first probes reach your application. It shortens attacks; it does not replace patching, input validation, or a web application firewall.
- Log lines are attacker-controlled. They reach the model only as quoted data, never as instructions, and the model's answer is a single letter, so a crafted request can at most argue its own probability down. Hard rules don't depend on the model at all.
- Nothing from a log reaches a shell. Firewall commands only ever receive an address that parsed as IPv4 or IPv6 and was re-printed.
- Local mode keeps logs on the server. With a hosted API, flagged clients' requests and
your
sitedescription are sent to that provider.
make # build/jevban, with badpaths.txt (Free Pascal 3.2.2)
make llama # llama.cpp libraries next to it, for local mode (git, cmake, a C++ compiler)
make test # unit tests and a replay of the sample logTo install a source build, copy the contents of build/ (the binary, badpaths.txt and the
lib*.so* files) to /opt/jevban with jevban.ini and jevban.service, as in
Quick start.
The same sources build with Delphi 12 or 13, for Win32 and Win64. From a RAD Studio Command Prompt:
build-delphi.bat :: build\win32\ and build\win64\, then the unit tests and the sample replay
build-delphi.bat win64 :: one platformTo use the IDE instead, open jevban.dpr (or tests\jevban_test.dpr) and make sure the
project's unit scope names include System;System.Win;Winapi.
What differs from the Free Pascal build:
- HTTPS goes through
THTTPClient(WinHTTP): certificates are checked against the Windows store, and no OpenSSL DLLs orcacert.pemare needed.HTTPS_PROXY,HTTP_PROXYandNO_PROXYwork as on Linux; without them, WinHTTP's proxy settings apply. - Local models need Win64. A model does not fit in a 32-bit process, so the Win32 build
refuses
mode = localwith a message; the rules and the hosted deciders work in both. Put the llama.cpp DLLs (ggml-base.dll,ggml-cpu.dll,ggml.dll,llama.dll) next to the 64-bitjevban.exe. - Text is bytes. Log lines, JSON and command output are handled byte for byte, as on Free
Pascal (each byte in one
Char;Ban.Compatconverts at files, HTTP, processes and standard output), so lengths, offsets and the signatures behave identically. File names injevban.iniare read as UTF-8. - Numbers and times print with
.and:whatever the Windows locale.
Project layout
| File | Purpose |
|---|---|
jevban.dpr |
Main loop, signals, --test and --eval |
Ban.Config.pas |
jevban.ini, command line, provider presets |
Ban.Tail.pas |
tail -F with rotation and wildcards |
Ban.Apache.pas |
Access-log parser and decoding |
Ban.Signatures.pas |
Weighted regex signatures |
Ban.BadPaths.pas |
Known-bad paths: exact, and near (bounded Levenshtein over a BK-tree) |
Ban.Engine.pas |
Triage, batching, strikes, bans, state, evaluation |
Ban.Jev.pas |
Decider interface and the Jev API client |
Ban.Local.pas |
OpenJev in-process: download, prompt, readout, calibration |
Ban.Llama.pas |
llama.cpp C API, loaded at run time |
Ban.Firewall.pas |
Firewall action presets and command runner |
Ban.Net.pas |
IPv4/IPv6 addresses and CIDR ranges |
Ban.Https.pas |
HTTP(S) client with verified TLS and proxy support |
Ban.Json.pas |
JSON reader and writer (strict; always writes valid UTF-8) |
Ban.Compat.pas |
What differs between Free Pascal and Delphi, and byte-exact text I/O |
jevban.inc |
Compiler settings for both compilers, included by every unit |
build-delphi.bat |
Delphi 12/13 build for Win32 and Win64 |
data/badpaths.txt |
Known-bad path list |
tests/ |
Unit tests, sample and labelled logs, a mock decision server |
jevban is released under the MIT License.
- OpenJev model weights: CC BY-NC 4.0, downloaded at first use, not bundled.
- llama.cpp: MIT, bundled in the releases.
- Known-bad paths from SecLists by Daniel
Miessler: MIT (
data/LICENSE.seclists). Ban.Https.pascomes from memagent.- Jev and the System One API are by TypeSafe; jevban is an independent project and not affiliated with them or with OpenJev's authors.