Initial version of fail2ban-webui
Web interface to view, ban and unban fail2ban IPs on several hosts via SSH, generalised from the private f2b-web tool. - Web UI (Flask/Waitress): hosts.yaml, local/OIDC/proxy authentication, English/German UI, origin map, optional Loki/Grafana/GeoIP, CLI helpers - Agent f2b-webctl with install.sh/uninstall.sh (dedicated user + sudo, from= restriction, protected networks, manual jail) - Hardened Docker image, examples, documentation, smoke test, testbed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
2e3f79236c
44 files changed
+4280
No files matched your search
@@ -0,0 +1,143 @@
|
||||
:root {
|
||||
--bg: #f5f6f8; --panel: #ffffff; --text: #1d2330; --muted: #6b7385; --border: #dfe3ea;
|
||||
--accent: #2f6fdb; --danger: #c93b3b; --ok: #2e8b57; --warn: #c98a1b; --row: #f0f3f8;
|
||||
}
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
--bg: #14171d; --panel: #1c2028; --text: #e3e7ee; --muted: #8f98a8; --border: #2c3240;
|
||||
--accent: #5b8ff0; --danger: #e05d5d; --ok: #4fbf84; --warn: #e0a73c; --row: #222733;
|
||||
}
|
||||
}
|
||||
* { box-sizing: border-box; }
|
||||
body { margin: 0; font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
|
||||
header { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--border); background: var(--panel); }
|
||||
h1 { font-size: 18px; margin: 0; }
|
||||
h2 { font-size: 15px; margin: 0 0 10px; }
|
||||
.meta { display: flex; gap: 10px; align-items: center; color: var(--muted); }
|
||||
main { padding: 16px 20px; display: grid; gap: 16px; max-width: 1400px; margin: 0 auto; }
|
||||
main > * { min-width: 0; }
|
||||
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; }
|
||||
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 16px; }
|
||||
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; }
|
||||
.card h3 { margin: 0 0 8px; font-size: 15px; display: flex; justify-content: space-between; }
|
||||
.card .err { color: var(--danger); }
|
||||
.jail-list { display: grid; grid-template-columns: 1fr auto auto; gap: 2px 12px; font-variant-numeric: tabular-nums; }
|
||||
.jail-list .h { color: var(--muted); font-size: 12px; }
|
||||
button, .btn-link { font: inherit; padding: 6px 12px; border-radius: 6px; border: 1px solid var(--border); background: var(--panel); color: var(--text); cursor: pointer; text-decoration: none; }
|
||||
button:hover, .btn-link:hover { border-color: var(--accent); }
|
||||
button.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
|
||||
button.small { padding: 2px 8px; font-size: 12px; }
|
||||
button:disabled { opacity: .5; cursor: wait; }
|
||||
input, select { font: inherit; padding: 6px 10px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg); color: var(--text); }
|
||||
#ban-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
|
||||
#ban-ip { width: 260px; } #ban-note { flex: 1; min-width: 200px; }
|
||||
.hosts-select { display: flex; gap: 10px; }
|
||||
.hint { color: var(--muted); font-size: 12px; margin: 8px 0 0; }
|
||||
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
|
||||
.toolbar h2 { margin: 0 auto 0 0; }
|
||||
.badge { background: var(--accent); color: #fff; border-radius: 10px; padding: 0 8px; font-size: 12px; }
|
||||
.table-wrap { overflow-x: auto; }
|
||||
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
|
||||
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
|
||||
th { color: var(--muted); font-weight: 600; font-size: 12px; }
|
||||
tbody tr:hover { background: var(--row); }
|
||||
td.actions { display: flex; gap: 4px; }
|
||||
.muted { color: var(--muted); }
|
||||
.perm { color: var(--danger); font-weight: 600; }
|
||||
code { font-size: 12px; }
|
||||
.audit { list-style: none; margin: 0; padding: 0; font-size: 13px; }
|
||||
.audit li { padding: 4px 0; border-bottom: 1px solid var(--border); }
|
||||
.audit .bad { color: var(--danger); }
|
||||
dialog { width: min(1000px, 95vw); max-height: 85vh; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); color: var(--text); padding: 0; }
|
||||
dialog::backdrop { background: rgba(0, 0, 0, .5); }
|
||||
.dialog-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--panel); }
|
||||
#history-body { padding: 12px 16px; overflow: auto; }
|
||||
#history-body pre { white-space: pre-wrap; word-break: break-all; font-size: 12px; margin: 0; }
|
||||
#history-body .line { padding: 4px 0; border-bottom: 1px solid var(--border); }
|
||||
#toast { position: fixed; right: 20px; bottom: 20px; max-width: 420px; padding: 10px 14px; border-radius: 8px; background: var(--text); color: var(--panel); opacity: 0; transition: opacity .2s; pointer-events: none; }
|
||||
#toast.show { opacity: .95; }
|
||||
#toast.error { background: var(--danger); color: #fff; }
|
||||
footer { text-align: center; color: var(--muted); font-size: 12px; padding: 12px 0 24px; }
|
||||
footer a { color: inherit; }
|
||||
.audit li { overflow-wrap: anywhere; }
|
||||
|
||||
/* ---------- Tablet ---------- */
|
||||
@media (max-width: 1000px) {
|
||||
main { padding: 12px 16px; gap: 12px; }
|
||||
#ban-ip { flex: 1 1 220px; width: auto; }
|
||||
.toolbar h2 { flex: 1 1 100%; }
|
||||
.toolbar input[type="search"] { flex: 1 1 220px; }
|
||||
}
|
||||
|
||||
/* ---------- Handy ---------- */
|
||||
@media (max-width: 820px) {
|
||||
header { padding: 12px 16px; }
|
||||
.meta { flex-wrap: wrap; width: 100%; }
|
||||
#generated { flex: 1 1 100%; font-size: 12px; }
|
||||
.meta button, .meta .btn-link { flex: 1; text-align: center; }
|
||||
.panel, .card { padding: 12px; }
|
||||
|
||||
/* 16px verhindert das automatische Zoomen in iOS beim Antippen */
|
||||
input, select { font-size: 16px; min-height: 40px; }
|
||||
button, .btn-link { min-height: 40px; }
|
||||
.btn-link { display: inline-flex; align-items: center; justify-content: center; }
|
||||
|
||||
#ban-form > input, #ban-form > button { flex: 1 1 100%; width: 100%; min-width: 0; }
|
||||
.hosts-select { flex-wrap: wrap; gap: 6px 16px; }
|
||||
.hosts-select label { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; }
|
||||
|
||||
.toolbar input[type="search"] { flex: 1 1 100%; }
|
||||
.toolbar select { flex: 1 1 0; min-width: 0; }
|
||||
|
||||
/* Tabelle wird zur Kartenliste */
|
||||
.table-wrap { overflow: visible; }
|
||||
table, tbody, tr, td { display: block; width: 100%; }
|
||||
thead { display: none; }
|
||||
tbody tr { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; }
|
||||
tbody tr:hover { background: none; }
|
||||
td { display: flex; gap: 12px; justify-content: space-between; align-items: baseline; padding: 4px 0; border: 0; white-space: normal; text-align: right; overflow-wrap: anywhere; }
|
||||
td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-align: left; flex: none; }
|
||||
td.ip { order: -1; justify-content: flex-start; font-size: 15px; font-weight: 600; padding-bottom: 6px; }
|
||||
td.ip::before { display: none; }
|
||||
td.ip code { font-size: 15px; }
|
||||
td[colspan] { display: block; text-align: left; }
|
||||
tbody tr:has(td[colspan]) { border: 0; padding: 0; }
|
||||
td.actions { flex-wrap: wrap; gap: 6px; padding-top: 8px; margin-top: 4px; border-top: 1px solid var(--border); }
|
||||
td.actions > * { flex: 1 1 calc(50% - 6px); text-align: center; min-height: 36px; font-size: 13px; padding: 6px 8px; }
|
||||
|
||||
dialog { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; border: 0; }
|
||||
.dialog-head { padding: 10px 12px; }
|
||||
#history-body { padding: 10px 12px; }
|
||||
|
||||
#toast { left: 12px; right: 12px; bottom: 12px; max-width: none; }
|
||||
}
|
||||
|
||||
/* ---------- Header: language, user, logout ---------- */
|
||||
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
||||
.lang-select select { padding: 5px 8px; }
|
||||
.user { font-weight: 600; color: var(--text); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
form.inline { display: inline; margin: 0; }
|
||||
button.primary, .btn-link.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
|
||||
|
||||
/* ---------- Login / error page ---------- */
|
||||
main.login { max-width: 420px; }
|
||||
.login-form { display: grid; gap: 12px; }
|
||||
.login-form label { display: grid; gap: 4px; color: var(--muted); font-size: 13px; }
|
||||
.login-form input { width: 100%; }
|
||||
.login .sso { display: block; text-align: center; }
|
||||
.login .or { text-align: center; margin: 12px 0; }
|
||||
.msg { padding: 8px 10px; border-radius: 6px; margin: 0 0 12px; overflow-wrap: anywhere; }
|
||||
.msg.error { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
|
||||
@media (max-width: 820px) {
|
||||
.lang-select, .lang-select select { flex: 1; }
|
||||
.user { flex: 1 1 100%; max-width: none; }
|
||||
form.inline { flex: 1; display: flex; }
|
||||
form.inline button { flex: 1; }
|
||||
}
|
||||
|
||||
/* ---------- Origin map ---------- */
|
||||
.map svg { display: block; width: 100%; height: auto; max-height: 360px; }
|
||||
.map circle { fill: var(--danger); fill-opacity: .5; stroke: var(--danger); stroke-width: .3; cursor: pointer; transition: fill-opacity .15s; }
|
||||
.map circle:hover { fill-opacity: .9; }
|
||||
.map-panel .toolbar h2 { margin-right: 0; }
|
||||
.map-panel #map-summary { margin-right: auto; font-size: 13px; }
|
||||
Reference in new issue
Block a user