feat: 1.4.0 second firewall, egress analysis and HTML report
CI / Docker image (build and smoke test) (push) Skipped
CI / Format and vet (push) Successful in 28s
CI / Dependency audit (push) Successful in 16s
CI / Tests (Linux, race detector) (push) Successful in 1m3s
Release / Plan (reuse the published image?) (push) Successful in 4s
Release / ci (push) Skipped
Release / Build image (amd64) (push) Skipped
Release / Build image (arm64) (push) Skipped
Release / Publish tags (push) Successful in 13s
Release / Gitea release (push) Successful in 3s
CI / Docker image (build and smoke test) (push) Skipped
CI / Format and vet (push) Successful in 28s
CI / Dependency audit (push) Successful in 16s
CI / Tests (Linux, race detector) (push) Successful in 1m3s
Release / Plan (reuse the published image?) (push) Successful in 4s
Release / ci (push) Skipped
Release / Build image (amd64) (push) Skipped
Release / Build image (arm64) (push) Skipped
Release / Publish tags (push) Successful in 13s
Release / Gitea release (push) Successful in 3s
Optional second firewall (URUTAU_ENFORCE off/observe/on) through the host fail2ban, outbound traffic analysis (beaconing, mining, spam, DNS bypass, unauthorised scans) with authorised scanner workloads, host kit in deploy/host and a printable HTML report. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3adaa007ec
commit
c33cca22e3
59 files changed
+7364
-24
No files matched your search
@@ -3,3 +3,23 @@
|
||||
.df-kpis .card-metric { min-width: 0; }
|
||||
.df-sum { padding: 0 0 8px; }
|
||||
.df-bl { color: var(--ink-muted); font-size: .875rem; margin: 4px 0 12px; overflow-wrap: anywhere; }
|
||||
.df-en { margin-top: var(--grid-gap, 16px); }
|
||||
.df-en .panel { min-width: 0; }
|
||||
.df-en-title { font-size: 1.125rem; margin: 0 0 4px; }
|
||||
.df-mode { margin: 0 0 8px; }
|
||||
.df-en-p { margin: 0 0 8px; overflow-wrap: anywhere; }
|
||||
.df-en-meta { overflow-wrap: anywhere; }
|
||||
.df-en-how { margin: 8px 0 0; padding: 8px 12px; border-left: 3px solid var(--info); background: var(--info-soft); border-radius: 4px; overflow-wrap: anywhere; }
|
||||
.df-en-sum { font-size: 1.0625rem; font-weight: 600; margin: 0 0 4px; overflow-wrap: anywhere; }
|
||||
.df-skips { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--ink-muted); font-size: .875rem; }
|
||||
.df-skips .num { font-weight: 600; color: var(--ink); }
|
||||
.df-scroll { max-height: 440px; overflow: auto; }
|
||||
.df-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
|
||||
.df-table th, .df-table td { padding: 5px var(--s-3, 10px); border-bottom: 1px solid var(--line); text-align: left; overflow-wrap: anywhere; vertical-align: top; }
|
||||
.df-table th { color: var(--ink-muted); font-weight: 500; position: sticky; top: 0; background: var(--surface-panel); }
|
||||
.df-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
|
||||
.df-act { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px; }
|
||||
.df-skipwhy { color: var(--ink-muted); font-size: .75rem; }
|
||||
@media (max-width: 900px) { .df-en .span-4, .df-en .span-8 { grid-column: 1 / -1; } }
|
||||
.df-nowrap { white-space: nowrap; }
|
||||
@media (max-width: 700px) { .df-table { min-width: 640px; } .df-table td, .df-table th { overflow-wrap: normal; } }
|
||||
@@ -44,7 +44,76 @@
|
||||
'df.disabled': 'The event registry is off',
|
||||
'df.disabled.sub': 'Defense is computed from the event registry; enable it to see this page.',
|
||||
'df.partial': 'Partial result: the study hit its time or size limit.',
|
||||
'df.admin': 'your account'
|
||||
'df.admin': 'your account',
|
||||
'df.en.title': 'Second firewall',
|
||||
'df.en.hint': 'Urutau can also block attackers by itself, as a safety net next to fail2ban.',
|
||||
'df.en.mode': 'Mode',
|
||||
'df.en.mode.off': 'Off',
|
||||
'df.en.mode.observe': 'Observing only',
|
||||
'df.en.mode.on': 'Active',
|
||||
'df.en.mode.off.sub': 'Urutau does not block anyone. Nothing is written; the coverage below shows what you would gain by turning it on.',
|
||||
'df.en.mode.observe.sub': 'Urutau decides who it would block and records it, but blocks nobody. Use it to check the decisions before trusting them.',
|
||||
'df.en.mode.on.sub': 'Urutau blocks the attackers it recognises, on its own, for a limited time.',
|
||||
'df.en.mode.where': 'The mode is chosen at deploy time with the variable URUTAU_ENFORCE (off, observe or on). It cannot be changed from this page.',
|
||||
'df.en.how.title': 'How to turn it on',
|
||||
'df.en.how.body': 'Set URUTAU_ENFORCE=observe on the server and restart Urutau. Watch the decisions for a few days; when they look right, change it to on.',
|
||||
'df.en.share': 'Sharing with peers',
|
||||
'df.en.share.on': 'on: bans are shared with other servers',
|
||||
'df.en.share.off': 'off: bans stay on this server',
|
||||
'df.en.threshold': 'Blocks from score {n}',
|
||||
'df.en.nolog.title': 'Blocks are not being saved',
|
||||
'df.en.nolog.body': 'The mode is active but the block file cannot be written, so nobody is really blocked. Check the permissions of the folder where Urutau writes the blocklist.',
|
||||
'df.en.lead': '{b} of {a} attacking addresses were blocked {range}',
|
||||
'df.en.lead.sub': '{fw} by the server firewall, {ur} by Urutau, {wb} would be blocked in observation mode and {un} got through.',
|
||||
'df.en.lead.none': 'No attacking addresses {range}',
|
||||
'df.en.lead.none.sub': 'Nothing to block in this window.',
|
||||
'df.en.cov': 'Who was blocked',
|
||||
'df.en.cov.hint': 'Each attacking address counted once, by the first line of defense that stopped it.',
|
||||
'df.en.cov.center': 'addresses',
|
||||
'df.en.cov.fw': 'Blocked by the server firewall',
|
||||
'df.en.cov.ur': 'Blocked by Urutau',
|
||||
'df.en.cov.wb': 'Would be blocked (observation mode)',
|
||||
'df.en.cov.un': 'Got through without a block',
|
||||
'df.en.counts': 'What Urutau decided',
|
||||
'df.en.counts.hint': 'Counts in this window. "Skipped" are attackers it deliberately left alone.',
|
||||
'df.en.c.decided': 'Decisions',
|
||||
'df.en.c.written': 'Blocks written',
|
||||
'df.en.c.dropped': 'Dropped by rate limit',
|
||||
'df.en.c.already': 'Already blocked',
|
||||
'df.en.recent': 'Recent decisions',
|
||||
'df.en.recent.hint': 'The latest decisions, newest first.',
|
||||
'df.en.recent.none': 'No decisions in this window.',
|
||||
'df.en.col.time': 'Time',
|
||||
'df.en.col.ip': 'Address',
|
||||
'df.en.col.cc': 'Country',
|
||||
'df.en.col.reason': 'Reason',
|
||||
'df.en.col.score': 'Score',
|
||||
'df.en.col.ttl': 'Duration',
|
||||
'df.en.col.action': 'Action',
|
||||
'df.en.col.src': 'Origin',
|
||||
'df.en.act.ban': 'Blocked',
|
||||
'df.en.act.would_ban': 'Would block',
|
||||
'df.en.act.skip': 'Not blocked',
|
||||
'df.en.src.local': 'this server',
|
||||
'df.en.src.peer': 'peer {n}',
|
||||
'df.en.skip.trusted': 'Trusted address (your own list)',
|
||||
'df.en.skip.private': 'Private network (not on the internet)',
|
||||
'df.en.skip.crawler': 'Verified search engine',
|
||||
'df.en.skip.legit_visitor': 'Looks like a legitimate visitor',
|
||||
'df.en.skip.peer': 'Peer server (yours)',
|
||||
'df.en.reason.scanner-flood': 'Many vulnerability probes in a short time',
|
||||
'df.en.reason.exploit-flood': 'Repeated exploit attempts',
|
||||
'df.en.reason.web-bruteforce': 'Password guessing on a website',
|
||||
'df.en.reason.wp-bruteforce': 'Password guessing on WordPress',
|
||||
'df.en.reason.ssh-bruteforce': 'Password guessing on SSH',
|
||||
'df.en.reason.rce': 'Attempt to run commands on the server',
|
||||
'df.en.reason.path-traversal': 'Attempt to read files outside the site',
|
||||
'df.en.reason.env-probe': 'Hunting for secret configuration files (.env)',
|
||||
'df.en.reason.vcs-probe': 'Hunting for source code history (.git)',
|
||||
'df.en.reason.webshell': 'Looking for or uploading a backdoor (webshell)',
|
||||
'df.en.reason.sqli': 'Attempt to tamper with the database (SQL injection)',
|
||||
'df.en.reason.log4shell': 'Log4Shell exploit attempt',
|
||||
'df.en.error': 'Could not load the second firewall data.'
|
||||
},
|
||||
'pt-BR': {
|
||||
'df.title': 'Defesa',
|
||||
@@ -79,7 +148,76 @@
|
||||
'df.disabled': 'O registro de eventos está desligado',
|
||||
'df.disabled.sub': 'A defesa é calculada a partir do registro de eventos; ative-o para ver esta página.',
|
||||
'df.partial': 'Resultado parcial: o estudo atingiu o limite de tempo ou de tamanho.',
|
||||
'df.admin': 'sua conta'
|
||||
'df.admin': 'sua conta',
|
||||
'df.en.title': 'Segundo firewall',
|
||||
'df.en.hint': 'O Urutau também pode bloquear atacantes por conta própria, como uma rede de segurança ao lado do fail2ban.',
|
||||
'df.en.mode': 'Modo',
|
||||
'df.en.mode.off': 'Desligado',
|
||||
'df.en.mode.observe': 'Só observando',
|
||||
'df.en.mode.on': 'Ativo',
|
||||
'df.en.mode.off.sub': 'O Urutau não bloqueia ninguém e não grava nada. A cobertura abaixo mostra o quanto você ganharia ao ligá-lo.',
|
||||
'df.en.mode.observe.sub': 'O Urutau decide quem bloquearia e registra, mas não bloqueia ninguém. Use para conferir as decisões antes de confiar nelas.',
|
||||
'df.en.mode.on.sub': 'O Urutau bloqueia sozinho os atacantes que reconhece, por tempo limitado.',
|
||||
'df.en.mode.where': 'O modo é escolhido no deploy, pela variável URUTAU_ENFORCE (off, observe ou on). Não dá para mudá-lo por esta página.',
|
||||
'df.en.how.title': 'Como ligar',
|
||||
'df.en.how.body': 'Defina URUTAU_ENFORCE=observe no servidor e reinicie o Urutau. Acompanhe as decisões por alguns dias; quando estiverem certas, troque para on.',
|
||||
'df.en.share': 'Compartilhamento com parceiros',
|
||||
'df.en.share.on': 'ligado: os bloqueios são compartilhados com outros servidores',
|
||||
'df.en.share.off': 'desligado: os bloqueios ficam só neste servidor',
|
||||
'df.en.threshold': 'Bloqueia a partir da pontuação {n}',
|
||||
'df.en.nolog.title': 'Os bloqueios não estão sendo salvos',
|
||||
'df.en.nolog.body': 'O modo está ativo, mas o arquivo de bloqueios não pode ser gravado; na prática ninguém está sendo bloqueado. Confira as permissões da pasta onde o Urutau grava a blocklist.',
|
||||
'df.en.lead': '{b} de {a} endereços atacantes foram bloqueados {range}',
|
||||
'df.en.lead.sub': '{fw} pelo firewall do servidor, {ur} pelo Urutau, {wb} seriam bloqueados no modo observação e {un} passaram.',
|
||||
'df.en.lead.none': 'Nenhum endereço atacante {range}',
|
||||
'df.en.lead.none.sub': 'Nada a bloquear nesta janela.',
|
||||
'df.en.cov': 'Quem foi bloqueado',
|
||||
'df.en.cov.hint': 'Cada endereço atacante conta uma vez, pela primeira linha de defesa que o barrou.',
|
||||
'df.en.cov.center': 'endereços',
|
||||
'df.en.cov.fw': 'Bloqueado pelo firewall do servidor',
|
||||
'df.en.cov.ur': 'Bloqueado pelo Urutau',
|
||||
'df.en.cov.wb': 'Seria bloqueado (modo observação)',
|
||||
'df.en.cov.un': 'Passou sem bloqueio',
|
||||
'df.en.counts': 'O que o Urutau decidiu',
|
||||
'df.en.counts.hint': 'Contagens desta janela. "Ignorados" são atacantes que ele deixou passar de propósito.',
|
||||
'df.en.c.decided': 'Decisões',
|
||||
'df.en.c.written': 'Bloqueios gravados',
|
||||
'df.en.c.dropped': 'Descartados pelo limite de ritmo',
|
||||
'df.en.c.already': 'Já estavam bloqueados',
|
||||
'df.en.recent': 'Decisões recentes',
|
||||
'df.en.recent.hint': 'As últimas decisões, da mais nova para a mais antiga.',
|
||||
'df.en.recent.none': 'Nenhuma decisão nesta janela.',
|
||||
'df.en.col.time': 'Hora',
|
||||
'df.en.col.ip': 'Endereço',
|
||||
'df.en.col.cc': 'País',
|
||||
'df.en.col.reason': 'Motivo',
|
||||
'df.en.col.score': 'Pontuação',
|
||||
'df.en.col.ttl': 'Duração',
|
||||
'df.en.col.action': 'Ação',
|
||||
'df.en.col.src': 'Origem',
|
||||
'df.en.act.ban': 'Bloqueado',
|
||||
'df.en.act.would_ban': 'Bloquearia',
|
||||
'df.en.act.skip': 'Não bloqueado',
|
||||
'df.en.src.local': 'este servidor',
|
||||
'df.en.src.peer': 'parceiro {n}',
|
||||
'df.en.skip.trusted': 'Endereço confiável (sua própria lista)',
|
||||
'df.en.skip.private': 'Rede privada (fora da internet)',
|
||||
'df.en.skip.crawler': 'Buscador verificado',
|
||||
'df.en.skip.legit_visitor': 'Parece um visitante legítimo',
|
||||
'df.en.skip.peer': 'Servidor parceiro (seu)',
|
||||
'df.en.reason.scanner-flood': 'Muitas sondagens de vulnerabilidade em pouco tempo',
|
||||
'df.en.reason.exploit-flood': 'Tentativas repetidas de exploração',
|
||||
'df.en.reason.web-bruteforce': 'Tentativa de adivinhar senha num site',
|
||||
'df.en.reason.wp-bruteforce': 'Tentativa de adivinhar senha no WordPress',
|
||||
'df.en.reason.ssh-bruteforce': 'Tentativa de adivinhar senha no SSH',
|
||||
'df.en.reason.rce': 'Tentativa de executar comandos no servidor',
|
||||
'df.en.reason.path-traversal': 'Tentativa de ler arquivos fora do site',
|
||||
'df.en.reason.env-probe': 'Caça a arquivos de configuração secretos (.env)',
|
||||
'df.en.reason.vcs-probe': 'Caça ao histórico do código-fonte (.git)',
|
||||
'df.en.reason.webshell': 'Procura ou envio de porta dos fundos (webshell)',
|
||||
'df.en.reason.sqli': 'Tentativa de adulterar o banco de dados (injeção de SQL)',
|
||||
'df.en.reason.log4shell': 'Tentativa de explorar o Log4Shell',
|
||||
'df.en.error': 'Não foi possível carregar os dados do segundo firewall.'
|
||||
}
|
||||
});
|
||||
|
||||
@@ -172,7 +310,122 @@
|
||||
root.appendChild(grid);
|
||||
}
|
||||
|
||||
|
||||
var enData = null, enSeq = 0, enBox = null;
|
||||
function ttlTxt(s) { return s > 0 ? dur(s) : '-'; }
|
||||
function reasonTxt(r) {
|
||||
if (!r) return '-';
|
||||
var k = 'df.en.reason.' + r;
|
||||
if (t(k) !== k) return t(k);
|
||||
var parts = String(r).split(/[-_:]/);
|
||||
for (var i = 0; i < parts.length; i++) { var c = 'df.en.reason.' + parts[i]; if (t(c) !== c) return t(c) + ' (' + r + ')'; }
|
||||
return r;
|
||||
}
|
||||
function tbl(cols, rows) {
|
||||
var tb = el('tbody');
|
||||
rows.forEach(function (r) { tb.appendChild(el('tr', null, r.map(function (c, i) { return el('td', { class: cols[i].cls || '' }, c); }))); });
|
||||
return el('div', { class: 'df-scroll' }, el('table', { class: 'df-table' },
|
||||
el('thead', null, el('tr', null, cols.map(function (c) { return el('th', { class: c.cls || '' }, c.label); }))), tb));
|
||||
}
|
||||
function paintEnforce() {
|
||||
if (!enBox) return;
|
||||
clear(enBox);
|
||||
if (!enData) return;
|
||||
var e = enData, cv = e.coverage || {}, cn = e.counts || {}, sk = cn.skipped || {}, range = U.rangeLabel({ inline: true });
|
||||
var mode = /^(off|observe|on)$/.test(e.mode) ? e.mode : 'off';
|
||||
var head = el('div', { class: 'df-en-head' });
|
||||
var mt = el('h2', { class: 'df-en-title' }, t('df.en.title'));
|
||||
if (U.help) U.help(mt, 'term.second_firewall');
|
||||
head.appendChild(mt);
|
||||
head.appendChild(el('p', { class: 'hint' }, t('df.en.hint')));
|
||||
enBox.appendChild(head);
|
||||
|
||||
var grid = el('div', { class: 'grid-12' });
|
||||
var mp = U.ui.panel({ title: t('df.en.mode'), cls: 'span-4', help: mode === 'observe' ? 'term.observe_mode' : null });
|
||||
var tone = mode === 'on' ? 'ok' : mode === 'observe' ? 'info' : 'warn';
|
||||
mp.body.appendChild(el('p', { class: 'df-mode' }, U.ui.badge(t('df.en.mode.' + mode), tone)));
|
||||
mp.body.appendChild(el('p', { class: 'df-en-p' }, t('df.en.mode.' + mode + '.sub')));
|
||||
mp.body.appendChild(el('p', { class: 'hint' }, t('df.en.mode.where')));
|
||||
var meta = el('p', { class: 'hint df-en-meta' }, t('df.en.threshold', { n: nf(e.threshold || 0) }) + ' · ' + t('df.en.share') + ': ' + (e.share === 'on' ? t('df.en.share.on') : t('df.en.share.off')));
|
||||
if (U.help) U.help(meta, 'term.ban_ttl');
|
||||
mp.body.appendChild(meta);
|
||||
if (mode === 'on' && e.log_writable === false) mp.body.appendChild(el('div', { class: 'state-error' }, el('strong', null, t('df.en.nolog.title')), el('span', null, t('df.en.nolog.body'))));
|
||||
if (mode === 'off') {
|
||||
mp.body.appendChild(el('p', { class: 'df-en-how' }, el('strong', null, t('df.en.how.title') + ': '), t('df.en.how.body')));
|
||||
}
|
||||
grid.appendChild(mp);
|
||||
|
||||
var total = (cv.blocked_by_firewall || 0) + (cv.blocked_by_urutau || 0) + (cv.would_block || 0) + (cv.unblocked || 0);
|
||||
var cp = U.ui.panel({ title: t('df.en.cov'), hint: t('df.en.cov.hint'), cls: 'span-8' });
|
||||
var rows = [
|
||||
{ key: 'fw', label: t('df.en.cov.fw'), value: cv.blocked_by_firewall || 0, color: '--ok' },
|
||||
{ key: 'ur', label: t('df.en.cov.ur'), value: cv.blocked_by_urutau || 0, color: '--info' },
|
||||
{ key: 'wb', label: t('df.en.cov.wb'), value: cv.would_block || 0, color: '--warn' },
|
||||
{ key: 'un', label: t('df.en.cov.un'), value: cv.unblocked || 0, color: '--danger' }
|
||||
];
|
||||
var blocked = (cv.blocked_by_firewall || 0) + (cv.blocked_by_urutau || 0);
|
||||
cp.body.appendChild(el('p', { class: 'df-en-sum' }, total ? t('df.en.lead', { b: nf(blocked), a: nf(cv.attack_ips || total), range: range }) : t('df.en.lead.none', { range: range })));
|
||||
if (total) {
|
||||
cp.body.appendChild(el('p', { class: 'hint' }, t('df.en.lead.sub', { fw: nf(rows[0].value), ur: nf(rows[1].value), wb: nf(rows[2].value), un: nf(rows[3].value) })));
|
||||
if (U.charts && U.charts.donut) {
|
||||
cp.body.appendChild(U.charts.donut(rows, { title: t('df.en.cov'), centerLabel: t('df.en.cov.center'), format: nf, colors: rows.map(function (r) { return r.color; }) }));
|
||||
if (U.help) { var lis = cp.body.querySelectorAll('.vz-legend li'); if (lis[2]) U.help(lis[2], 'term.observe_mode'); }
|
||||
}
|
||||
} else cp.body.appendChild(U.ui.empty(t('df.en.lead.none', { range: range }), t('df.en.lead.none.sub')));
|
||||
grid.appendChild(cp);
|
||||
|
||||
var np = U.ui.panel({ title: t('df.en.counts'), hint: t('df.en.counts.hint'), cls: 'span-12' });
|
||||
var kp = el('div', { class: 'grid-12 df-kpis' });
|
||||
function k(node) { node.classList.add('span-3'); kp.appendChild(node); }
|
||||
k(U.ui.metric(t('df.en.c.decided'), nf(cn.decided || 0)));
|
||||
k(U.ui.metric(t('df.en.c.written'), nf(cn.written || 0), { tone: 'ok' }));
|
||||
k(U.ui.metric(t('df.en.c.dropped'), nf(cn.dropped_rate || 0), { tone: cn.dropped_rate ? 'warn' : 'neutral' }));
|
||||
k(U.ui.metric(t('df.en.c.already'), nf(cn.already_blocked || 0)));
|
||||
np.body.appendChild(kp);
|
||||
var skl = el('ul', { class: 'df-skips' });
|
||||
['trusted', 'private', 'crawler', 'legit_visitor', 'peer'].forEach(function (key) {
|
||||
if (!sk[key]) return;
|
||||
skl.appendChild(el('li', null, el('span', { class: 'num' }, nf(sk[key])), ' ' + t('df.en.skip.' + key)));
|
||||
});
|
||||
if (skl.firstChild) np.body.appendChild(skl);
|
||||
grid.appendChild(np);
|
||||
|
||||
var rp = U.ui.panel({ title: t('df.en.recent'), hint: t('df.en.recent.hint'), cls: 'span-12', variant: 'list' });
|
||||
var rec = e.recent || [];
|
||||
if (!rec.length) rp.body.appendChild(U.ui.empty(t('df.en.recent.none')));
|
||||
else {
|
||||
var cols = [{ label: t('df.en.col.time') }, { label: t('df.en.col.ip'), cls: 'mono' }, { label: t('df.en.col.cc') }, { label: t('df.en.col.reason') },
|
||||
{ label: t('df.en.col.score'), cls: 'num' }, { label: t('df.en.col.ttl'), cls: 'num' }, { label: t('df.en.col.action') }, { label: t('df.en.col.src') }];
|
||||
rp.body.appendChild(tbl(cols, rec.map(function (r) {
|
||||
var act = /^(ban|would_ban|skip)$/.test(r.action) ? r.action : 'skip';
|
||||
var actNode = el('span', { class: 'df-act' }, U.ui.badge(t('df.en.act.' + act), act === 'ban' ? 'ok' : act === 'would_ban' ? 'warn' : 'neutral'));
|
||||
if (act === 'skip' && r.skip_reason) {
|
||||
var sk2 = 'df.en.skip.' + r.skip_reason;
|
||||
actNode.appendChild(el('small', { class: 'df-skipwhy' }, t(sk2) !== sk2 ? t(sk2) : r.skip_reason));
|
||||
}
|
||||
var peer = String(r.src || 'local');
|
||||
var src = peer.indexOf('peer:') === 0 ? t('df.en.src.peer', { n: peer.slice(5) }) : t('df.en.src.local');
|
||||
return [el('span', { class: 'df-nowrap' }, U.fmt.clock(r.t)), el('a', { href: U.href('ip', [r.ip]) }, r.ip), (r.cc ? U.fmt.flag(r.cc) + ' ' : '') + (r.cc || '-'),
|
||||
reasonTxt(r.reason), nf(r.score || 0), ttlTxt(r.ttl || 0), actNode, src];
|
||||
})));
|
||||
}
|
||||
grid.appendChild(rp);
|
||||
enBox.appendChild(grid);
|
||||
}
|
||||
function loadEnforce() {
|
||||
var my = ++enSeq;
|
||||
U.api('/api/v1/enforce', Object.assign(U.rangeParams(), ctx && ctx.host && ctx.host !== 'all' ? { host: ctx.host } : {})).then(function (d) {
|
||||
if (!alive || my !== enSeq) return;
|
||||
enData = d; paintEnforce();
|
||||
}).catch(function () {
|
||||
if (!alive || my !== enSeq || enData || !enBox) return;
|
||||
clear(enBox);
|
||||
enBox.appendChild(el('div', { class: 'state-error' }, el('strong', null, t('df.en.error'))));
|
||||
});
|
||||
}
|
||||
|
||||
function load() {
|
||||
loadEnforce();
|
||||
var my = ++seq;
|
||||
U.api('/api/v1/defense', Object.assign(U.rangeParams(), ctx && ctx.host && ctx.host !== 'all' ? { host: ctx.host } : {})).then(function (d) {
|
||||
if (!alive || my !== seq) return;
|
||||
@@ -187,10 +440,10 @@
|
||||
U.registerPage({
|
||||
id: 'defense', group: 'operate', titleKey: 'df.title',
|
||||
icon: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor"><path d="M12 3l8 3v6c0 4.5-3.2 7.8-8 9-4.8-1.2-8-4.5-8-9V6z"/><path d="M9 12l2 2 4-4"/></svg>',
|
||||
mount: function (node, cx) { root = el('div', { class: 'df-page' }); node.appendChild(root); ctx = cx; alive = true; data = null; paint(); load(); },
|
||||
mount: function (node, cx) { root = el('div', { class: 'df-page' }); node.appendChild(root); enBox = el('div', { class: 'df-page df-en' }); node.appendChild(enBox); ctx = cx; alive = true; data = null; enData = null; paint(); load(); },
|
||||
update: function (cx) { ctx = cx; load(); },
|
||||
refresh: function () { load(); },
|
||||
unmount: function () { alive = false; seq++; if (root && root.parentNode) root.parentNode.removeChild(root); root = null; data = null; }
|
||||
unmount: function () { alive = false; seq++; enSeq++; if (root && root.parentNode) root.parentNode.removeChild(root); if (enBox && enBox.parentNode) enBox.parentNode.removeChild(enBox); root = null; enBox = null; data = null; enData = null; }
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
/* Egress page */
|
||||
.eg-page { display: grid; gap: var(--grid-gap, 16px); min-width: 0; }
|
||||
.eg-page .panel, .eg-kpis .card-metric { min-width: 0; }
|
||||
.eg-wl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 12px; }
|
||||
.eg-wl { min-width: 0; }
|
||||
.eg-wl-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-bottom: 8px; }
|
||||
.eg-wl-head .badge { white-space: normal; }
|
||||
.eg-wl-name { margin: 0; font-size: 1rem; overflow-wrap: anywhere; }
|
||||
.eg-wl-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 0; }
|
||||
.eg-wl-stats div { min-width: 0; }
|
||||
.eg-wl-stats dd { margin: 0; font-size: 1.125rem; font-weight: 600; }
|
||||
.eg-wl-stats dt { color: var(--ink-muted); font-size: .75rem; overflow-wrap: anywhere; }
|
||||
.eg-warn { color: var(--danger); font-weight: 600; }
|
||||
.eg-findings { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
|
||||
.eg-f { border: 1px solid var(--line); border-left-width: 4px; border-radius: 6px; padding: 10px 12px; min-width: 0; }
|
||||
.eg-sev-high { border-left-color: var(--danger); }
|
||||
.eg-sev-medium { border-left-color: var(--warn); }
|
||||
.eg-sev-low { border-left-color: var(--info); }
|
||||
.eg-f-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
|
||||
.eg-f p { margin: 6px 0 0; overflow-wrap: anywhere; }
|
||||
.eg-f-why { color: var(--ink-muted); }
|
||||
.eg-f-detail { font-size: .8125rem; }
|
||||
.eg-scroll { max-height: 440px; overflow: auto; }
|
||||
.eg-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
|
||||
.eg-table th, .eg-table td { padding: 5px var(--s-3, 10px); border-bottom: 1px solid var(--line); text-align: left; overflow-wrap: anywhere; vertical-align: top; }
|
||||
.eg-table th { color: var(--ink-muted); font-weight: 500; position: sticky; top: 0; background: var(--surface-panel); }
|
||||
.eg-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
|
||||
.eg-scanwarn { margin-bottom: 10px; }
|
||||
@media (max-width: 600px) { .eg-kpis .span-4 { grid-column: 1 / -1; } }
|
||||
@media (max-width: 700px) { .eg-table { min-width: 560px; } }
|
||||
@@ -0,0 +1,355 @@
|
||||
/* Urutau - EGRESS page: what the workloads of your servers talk to on the
|
||||
internet (outbound traffic). Beacons, scans, odd ports, known-bad
|
||||
destinations, DNS bypass, new countries, and the summarised scans of the
|
||||
authorised scanner. Data: /api/v1/egress. Log data is hostile: dynamic text
|
||||
goes through textContent only. */
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var SEV = { high: 0, medium: 1, low: 2 };
|
||||
var SEV_TONE = { high: 'danger', medium: 'warn', low: 'info' };
|
||||
var KINDS = ['beacon', 'scan', 'port', 'bad_dst', 'dns_bypass', 'new_geo'];
|
||||
var KIND_HELP = { beacon: 'term.beaconing', scan: 'term.fanout', port: 'term.stratum', bad_dst: 'term.c2', dns_bypass: 'term.dot', new_geo: 'term.new_geo' };
|
||||
|
||||
function boot() {
|
||||
var U = window.Urutau;
|
||||
if (!U || !U.registerPage) return false;
|
||||
U.registerI18n({
|
||||
en: {
|
||||
'eg.title': 'Outbound traffic',
|
||||
'eg.error': 'Could not load the outbound traffic data.',
|
||||
'eg.retry': 'Try again',
|
||||
'eg.disabled': 'Outbound traffic is not being watched',
|
||||
'eg.disabled.sub': 'This page shows connections that leave your servers. To see them, add an outbound firewall rule on the server that logs new connections, and set the variable URUTAU_EGRESS so Urutau reads that log.',
|
||||
'eg.lead.none': 'No outbound connections {range}',
|
||||
'eg.lead.none.sub': 'Nothing left the watched workloads in this window.',
|
||||
'eg.lead.ok': '{n} outbound connections {range}, nothing suspicious',
|
||||
'eg.lead.ok.sub': 'No findings in this window. Authorised scans, if any, are summarised below.',
|
||||
'eg.lead.bad': '{f} findings in {n} outbound connections {range}',
|
||||
'eg.lead.bad.sub': '{h} high, {m} medium and {l} low severity. Start with the high ones.',
|
||||
'eg.src': 'Log source: {state} · {lines} lines read · {bad} unreadable',
|
||||
'eg.src.following': 'being followed',
|
||||
'eg.src.waiting': 'waiting for the file',
|
||||
'eg.src.missing': 'file not found',
|
||||
'eg.src.error': 'error',
|
||||
'eg.kpi.conns': 'Connections',
|
||||
'eg.kpi.conns.sub': 'new outbound connections',
|
||||
'eg.kpi.dsts': 'Destinations',
|
||||
'eg.kpi.dsts.sub': 'different addresses reached',
|
||||
'eg.kpi.find': 'Findings',
|
||||
'eg.kpi.find.sub': '{h} high · {m} medium · {l} low',
|
||||
'eg.workloads': 'Workloads',
|
||||
'eg.workloads.hint': 'Each workload is a program or container that makes outbound connections.',
|
||||
'eg.wl.conns': 'connections',
|
||||
'eg.wl.dsts': 'destinations',
|
||||
'eg.wl.ports': 'ports',
|
||||
'eg.wl.findings': 'findings',
|
||||
'eg.wl.suppressed': '{n} scan connections summarised',
|
||||
'eg.role.scanner': 'authorised scans summarised',
|
||||
'eg.role.app': 'application',
|
||||
'eg.role.proxy': 'proxy',
|
||||
'eg.role.database': 'database',
|
||||
'eg.role.system': 'system',
|
||||
'eg.timeline': 'Connections over time',
|
||||
'eg.timeline.hint': 'Stacked by workload.',
|
||||
'eg.findings': 'Findings',
|
||||
'eg.findings.hint': 'Sorted by severity. Each one explains what the pattern usually means.',
|
||||
'eg.findings.none': 'No findings in this window.',
|
||||
'eg.sev.high': 'High',
|
||||
'eg.sev.medium': 'Medium',
|
||||
'eg.sev.low': 'Low',
|
||||
'eg.kind.beacon': 'Regular conversation',
|
||||
'eg.kind.scan': 'Mass connection attempts',
|
||||
'eg.kind.port': 'Unusual port',
|
||||
'eg.kind.bad_dst': 'Known-bad destination',
|
||||
'eg.kind.dns_bypass': 'DNS outside the resolver',
|
||||
'eg.kind.new_geo': 'New country',
|
||||
'eg.why.beacon': 'The workload talks to the same destination at regular intervals, like a clock. This is the typical pattern of malware checking in with its controller.',
|
||||
'eg.why.scan': 'The workload tried to connect to many different addresses in a short time. A server that scans the internet usually means it was taken over.',
|
||||
'eg.why.port': 'Connection to a port used by mining pools or remote-control tools, which normal software on this server does not use.',
|
||||
'eg.why.bad_dst': 'The destination is on a list of addresses known for malware or attacks. Nothing on your server should talk to it.',
|
||||
'eg.why.dns_bypass': 'The workload asked for names directly from an outside DNS server instead of your resolver. Malware does this to hide what it looks up.',
|
||||
'eg.why.new_geo': 'The workload connected to a country it had never reached before in this window. It may be harmless, but is worth a look.',
|
||||
'eg.f.to': 'To',
|
||||
'eg.f.count': '{n} connections',
|
||||
'eg.f.interval': 'every {s} s (variation {j}%)',
|
||||
'eg.f.first': 'first {t}',
|
||||
'eg.f.last': 'last {t}',
|
||||
'eg.f.host': 'server {h}',
|
||||
'eg.dst': 'Top destinations',
|
||||
'eg.dst.hint': 'Where the connections went.',
|
||||
'eg.dst.none': 'No destinations in this window.',
|
||||
'eg.col.ip': 'Address',
|
||||
'eg.col.country': 'Country',
|
||||
'eg.col.asn': 'Network (ASN)',
|
||||
'eg.col.conns': 'Connections',
|
||||
'eg.col.who': 'Workloads',
|
||||
'eg.col.ports': 'Ports',
|
||||
'eg.scan': 'Authorised scans',
|
||||
'eg.scan.hint': 'Scans your own scanner runs on purpose. They are summarised here instead of raising findings.',
|
||||
'eg.scan.none': 'No scan bursts in this window.',
|
||||
'eg.scan.warn': 'A scan reached {n} known-bad destinations: check that the scanner is not aiming at the wrong targets.',
|
||||
'eg.scan.targets': '{n} targets',
|
||||
'eg.scan.nets': 'networks',
|
||||
'eg.scan.ports': 'ports',
|
||||
'eg.scan.conns': '{n} connections',
|
||||
'eg.scan.when': '{a} to {b}',
|
||||
'eg.col.who1': 'Workload',
|
||||
'eg.col.when': 'When',
|
||||
'eg.col.targets': 'Targets',
|
||||
'eg.col.nets': 'Networks',
|
||||
'eg.col.badhits': 'Bad destinations hit'
|
||||
},
|
||||
'pt-BR': {
|
||||
'eg.title': 'Tráfego de saída',
|
||||
'eg.error': 'Não foi possível carregar os dados de tráfego de saída.',
|
||||
'eg.retry': 'Tentar de novo',
|
||||
'eg.disabled': 'O tráfego de saída não está sendo monitorado',
|
||||
'eg.disabled.sub': 'Esta página mostra as conexões que saem dos seus servidores. Para vê-las, crie no servidor uma regra de firewall de saída que registre as conexões novas e defina a variável URUTAU_EGRESS para o Urutau ler esse registro.',
|
||||
'eg.lead.none': 'Nenhuma conexão de saída {range}',
|
||||
'eg.lead.none.sub': 'Nada saiu dos workloads monitorados nesta janela.',
|
||||
'eg.lead.ok': '{n} conexões de saída {range}, nada suspeito',
|
||||
'eg.lead.ok.sub': 'Nenhum achado nesta janela. As varreduras autorizadas, se houver, aparecem resumidas abaixo.',
|
||||
'eg.lead.bad': '{f} achados em {n} conexões de saída {range}',
|
||||
'eg.lead.bad.sub': '{h} de gravidade alta, {m} média e {l} baixa. Comece pelos de gravidade alta.',
|
||||
'eg.src': 'Origem do registro: {state} · {lines} linhas lidas · {bad} ilegíveis',
|
||||
'eg.src.following': 'sendo acompanhado',
|
||||
'eg.src.waiting': 'aguardando o arquivo',
|
||||
'eg.src.missing': 'arquivo não encontrado',
|
||||
'eg.src.error': 'erro',
|
||||
'eg.kpi.conns': 'Conexões',
|
||||
'eg.kpi.conns.sub': 'novas conexões de saída',
|
||||
'eg.kpi.dsts': 'Destinos',
|
||||
'eg.kpi.dsts.sub': 'endereços diferentes alcançados',
|
||||
'eg.kpi.find': 'Achados',
|
||||
'eg.kpi.find.sub': '{h} altos · {m} médios · {l} baixos',
|
||||
'eg.workloads': 'Workloads',
|
||||
'eg.workloads.hint': 'Cada workload é um programa ou contêiner que faz conexões de saída.',
|
||||
'eg.wl.conns': 'conexões',
|
||||
'eg.wl.dsts': 'destinos',
|
||||
'eg.wl.ports': 'portas',
|
||||
'eg.wl.findings': 'achados',
|
||||
'eg.wl.suppressed': '{n} conexões de varredura resumidas',
|
||||
'eg.role.scanner': 'varreduras autorizadas resumidas',
|
||||
'eg.role.app': 'aplicação',
|
||||
'eg.role.proxy': 'proxy',
|
||||
'eg.role.database': 'banco de dados',
|
||||
'eg.role.system': 'sistema',
|
||||
'eg.timeline': 'Conexões ao longo do tempo',
|
||||
'eg.timeline.hint': 'Empilhadas por workload.',
|
||||
'eg.findings': 'Achados',
|
||||
'eg.findings.hint': 'Ordenados por gravidade. Cada um explica o que o padrão costuma significar.',
|
||||
'eg.findings.none': 'Nenhum achado nesta janela.',
|
||||
'eg.sev.high': 'Alta',
|
||||
'eg.sev.medium': 'Média',
|
||||
'eg.sev.low': 'Baixa',
|
||||
'eg.kind.beacon': 'Conversa em intervalos regulares',
|
||||
'eg.kind.scan': 'Tentativas de conexão em massa',
|
||||
'eg.kind.port': 'Porta incomum',
|
||||
'eg.kind.bad_dst': 'Destino sabidamente ruim',
|
||||
'eg.kind.dns_bypass': 'DNS fora do resolvedor',
|
||||
'eg.kind.new_geo': 'País novo',
|
||||
'eg.why.beacon': 'O workload fala com o mesmo destino em intervalos regulares, como um relógio. É o padrão típico de um malware avisando seu controlador que está vivo.',
|
||||
'eg.why.scan': 'O workload tentou conectar a muitos endereços diferentes em pouco tempo. Um servidor que varre a internet costuma ter sido invadido.',
|
||||
'eg.why.port': 'Conexão a uma porta usada por mineração de criptomoeda ou ferramentas de controle remoto, que os programas normais deste servidor não usam.',
|
||||
'eg.why.bad_dst': 'O destino está numa lista de endereços conhecidos por malware ou ataques. Nada no seu servidor deveria falar com ele.',
|
||||
'eg.why.dns_bypass': 'O workload consultou nomes direto num servidor DNS de fora, em vez do seu resolvedor. Malware faz isso para esconder o que procura.',
|
||||
'eg.why.new_geo': 'O workload conectou a um país que ainda não tinha alcançado nesta janela. Pode ser inofensivo, mas vale olhar.',
|
||||
'eg.f.to': 'Para',
|
||||
'eg.f.count': '{n} conexões',
|
||||
'eg.f.interval': 'a cada {s} s (variação {j}%)',
|
||||
'eg.f.first': 'primeira {t}',
|
||||
'eg.f.last': 'última {t}',
|
||||
'eg.f.host': 'servidor {h}',
|
||||
'eg.dst': 'Principais destinos',
|
||||
'eg.dst.hint': 'Para onde foram as conexões.',
|
||||
'eg.dst.none': 'Nenhum destino nesta janela.',
|
||||
'eg.col.ip': 'Endereço',
|
||||
'eg.col.country': 'País',
|
||||
'eg.col.asn': 'Rede (ASN)',
|
||||
'eg.col.conns': 'Conexões',
|
||||
'eg.col.who': 'Workloads',
|
||||
'eg.col.ports': 'Portas',
|
||||
'eg.scan': 'Varreduras autorizadas',
|
||||
'eg.scan.hint': 'Varreduras que o seu próprio scanner faz de propósito. Aparecem resumidas aqui em vez de gerar achados.',
|
||||
'eg.scan.none': 'Nenhuma rajada de varredura nesta janela.',
|
||||
'eg.scan.warn': 'Uma varredura atingiu {n} destinos sabidamente ruins: confira se o scanner não está mirando os alvos errados.',
|
||||
'eg.scan.targets': '{n} alvos',
|
||||
'eg.scan.nets': 'redes',
|
||||
'eg.scan.ports': 'portas',
|
||||
'eg.scan.conns': '{n} conexões',
|
||||
'eg.scan.when': '{a} a {b}',
|
||||
'eg.col.who1': 'Workload',
|
||||
'eg.col.when': 'Quando',
|
||||
'eg.col.targets': 'Alvos',
|
||||
'eg.col.nets': 'Redes',
|
||||
'eg.col.badhits': 'Destinos ruins atingidos'
|
||||
}
|
||||
});
|
||||
|
||||
var el = U.el, t = U.t, nf = U.fmt.num;
|
||||
var root = null, seq = 0, alive = false, ctx = null, data = null, failed = false;
|
||||
|
||||
function clear(n) { while (n.firstChild) n.removeChild(n.firstChild); }
|
||||
function tbl(cols, rows) {
|
||||
var tb = el('tbody');
|
||||
rows.forEach(function (r) { tb.appendChild(el('tr', null, r.map(function (c, i) { return el('td', { class: cols[i].cls || '' }, c); }))); });
|
||||
return el('div', { class: 'eg-scroll' }, el('table', { class: 'eg-table' },
|
||||
el('thead', null, el('tr', null, cols.map(function (c) { return el('th', { class: c.cls || '' }, c.label); }))), tb));
|
||||
}
|
||||
function ipLink(ip) { return el('a', { href: U.href('ip', [ip]), class: 'mono' }, ip); }
|
||||
function when(ts) { return ts ? U.fmt.clock(ts) : '-'; }
|
||||
function help(node, key) { if (U.help) U.help(node, key); return node; }
|
||||
function roleLabel(r) { var k = 'eg.role.' + r; return t(k) !== k ? t(k) : (r || '-'); }
|
||||
function list(a) { return (a || []).join(', ') || '-'; }
|
||||
|
||||
function workloadCard(w, multi) {
|
||||
var scanner = w.role === 'scanner';
|
||||
var h = el('h3', { class: 'eg-wl-name' }, w.name);
|
||||
var head = el('div', { class: 'eg-wl-head' }, h);
|
||||
if (w.role) {
|
||||
var b = U.ui.badge(roleLabel(w.role), scanner ? 'info' : 'neutral');
|
||||
head.appendChild(b);
|
||||
if (scanner) help(head, 'term.authorized_scanner');
|
||||
}
|
||||
var stats = el('dl', { class: 'eg-wl-stats' });
|
||||
[['conns', w.conns], ['dsts', w.dsts], ['ports', w.ports], ['findings', w.findings]].forEach(function (p) {
|
||||
stats.appendChild(el('div', null, el('dd', { class: 'num' + (p[0] === 'findings' && p[1] ? ' eg-warn' : '') }, nf(p[1] || 0)), el('dt', null, t('eg.wl.' + p[0]))));
|
||||
});
|
||||
var card = el('div', { class: 'card-metric eg-wl' }, head, stats);
|
||||
if (w.suppressed_scan_conns) card.appendChild(el('p', { class: 'cm-sub' }, t('eg.wl.suppressed', { n: nf(w.suppressed_scan_conns) })));
|
||||
if (multi && w.host) card.appendChild(el('p', { class: 'cm-sub' }, t('eg.f.host', { h: w.host })));
|
||||
return card;
|
||||
}
|
||||
|
||||
function findingNode(f, multi) {
|
||||
var kind = KINDS.indexOf(f.kind) >= 0 ? f.kind : null;
|
||||
var sev = SEV[f.severity] !== undefined ? f.severity : 'low';
|
||||
var title = el('strong', { class: 'eg-f-title' }, kind ? t('eg.kind.' + kind) : String(f.kind || '-'));
|
||||
if (kind) help(title, KIND_HELP[kind]);
|
||||
var top = el('div', { class: 'eg-f-top' }, U.ui.badge(t('eg.sev.' + sev), SEV_TONE[sev]), title);
|
||||
var bits = [];
|
||||
bits.push(el('span', { class: 'mono' }, f.workload || '-'));
|
||||
bits.push(' → ');
|
||||
if (f.dst) bits.push(ipLink(f.dst));
|
||||
if (f.dport) bits.push(el('span', { class: 'mono' }, ':' + f.dport + (f.proto ? '/' + f.proto : '')));
|
||||
var meta = [];
|
||||
if (f.count) meta.push(t('eg.f.count', { n: nf(f.count) }));
|
||||
if (f.interval_s) meta.push(t('eg.f.interval', { s: Math.round(f.interval_s * 10) / 10, j: Math.round((f.jitter || 0) * 100) }));
|
||||
if (f.first) meta.push(t('eg.f.first', { t: when(f.first) }));
|
||||
if (f.last) meta.push(t('eg.f.last', { t: when(f.last) }));
|
||||
if (multi && f.host) meta.push(t('eg.f.host', { h: f.host }));
|
||||
var li = el('li', { class: 'eg-f eg-sev-' + sev }, top, el('p', { class: 'eg-f-line' }, bits));
|
||||
if (kind) li.appendChild(el('p', { class: 'eg-f-why' }, t('eg.why.' + kind)));
|
||||
if (f.detail) li.appendChild(el('p', { class: 'eg-f-detail mono' }, f.detail));
|
||||
if (meta.length) li.appendChild(el('p', { class: 'hint eg-f-meta' }, meta.join(' · ')));
|
||||
return li;
|
||||
}
|
||||
|
||||
function paint() {
|
||||
if (!root) return;
|
||||
clear(root);
|
||||
if (!data) { root.appendChild(el('div', { class: 'skeleton', style: { height: '8rem' } })); return; }
|
||||
if (!data.enabled) { root.appendChild(U.ui.empty(t('eg.disabled'), t('eg.disabled.sub'))); return; }
|
||||
var d = data, range = U.rangeLabel({ inline: true });
|
||||
var wls = d.workloads || [], fnd = (d.findings || []).slice();
|
||||
fnd.sort(function (a, b) { var x = SEV[a.severity], y = SEV[b.severity]; x = x === undefined ? 3 : x; y = y === undefined ? 3 : y; return x - y || (b.count || 0) - (a.count || 0); });
|
||||
var conns = 0, nsev = { high: 0, medium: 0, low: 0 };
|
||||
wls.forEach(function (w) { conns += w.conns || 0; });
|
||||
fnd.forEach(function (f) { if (nsev[f.severity] !== undefined) nsev[f.severity]++; });
|
||||
var hosts = {};
|
||||
wls.forEach(function (w) { if (w.host) hosts[w.host] = 1; });
|
||||
fnd.forEach(function (f) { if (f.host) hosts[f.host] = 1; });
|
||||
var multi = Object.keys(hosts).length > 1;
|
||||
var dsts = d.top_dst || [];
|
||||
|
||||
if (!conns && !fnd.length) root.appendChild(U.ui.lead(t('eg.lead.none', { range: range }), t('eg.lead.none.sub'), 'neutral'));
|
||||
else if (!fnd.length) root.appendChild(U.ui.lead(t('eg.lead.ok', { n: nf(conns), range: range }), t('eg.lead.ok.sub'), 'ok'));
|
||||
else root.appendChild(U.ui.lead(t('eg.lead.bad', { f: nf(fnd.length), n: nf(conns), range: range }), t('eg.lead.bad.sub', { h: nsev.high, m: nsev.medium, l: nsev.low }), nsev.high ? 'danger' : 'ok'));
|
||||
var src = d.source || {};
|
||||
var sk = 'eg.src.' + src.state;
|
||||
root.appendChild(el('p', { class: 'hint' }, t('eg.src', { state: t(sk) !== sk ? t(sk) : (src.state || '-'), lines: nf(src.lines || 0), bad: nf(src.malformed || 0) })));
|
||||
|
||||
var kp = el('div', { class: 'grid-12 eg-kpis' });
|
||||
function k(node) { node.classList.add('span-4'); kp.appendChild(node); }
|
||||
k(U.ui.metric(t('eg.kpi.conns'), nf(conns), { sub: t('eg.kpi.conns.sub') }));
|
||||
k(U.ui.metric(t('eg.kpi.dsts'), nf(dsts.length), { sub: t('eg.kpi.dsts.sub') }));
|
||||
k(U.ui.metric(t('eg.kpi.find'), nf(fnd.length), { sub: t('eg.kpi.find.sub', { h: nsev.high, m: nsev.medium, l: nsev.low }), tone: nsev.high ? 'danger' : fnd.length ? 'warn' : 'ok' }));
|
||||
root.appendChild(kp);
|
||||
|
||||
var grid = el('div', { class: 'grid-12' });
|
||||
if (wls.length) {
|
||||
var wp = U.ui.panel({ title: t('eg.workloads'), hint: t('eg.workloads.hint'), cls: 'span-12', help: 'term.workload' });
|
||||
var wg = el('div', { class: 'eg-wl-grid' });
|
||||
wls.forEach(function (w) { wg.appendChild(workloadCard(w, multi)); });
|
||||
wp.body.appendChild(wg);
|
||||
grid.appendChild(wp);
|
||||
}
|
||||
|
||||
var tl = d.timeline || {}, ser = tl.series || {}, names = Object.keys(ser);
|
||||
var tp = U.ui.panel({ title: t('eg.timeline'), hint: t('eg.timeline.hint'), cls: 'span-12', variant: 'chart' });
|
||||
if (U.charts && U.charts.stackedArea && names.length) tp.body.appendChild(U.charts.stackedArea(names.map(function (n) { return { key: n, label: n, values: ser[n] }; }), tl.step || 3600, { start: tl.start || 0, title: t('eg.timeline') }));
|
||||
else tp.body.appendChild(U.ui.empty(t('eg.lead.none', { range: range })));
|
||||
grid.appendChild(tp);
|
||||
|
||||
var fp = U.ui.panel({ title: t('eg.findings'), hint: t('eg.findings.hint'), cls: 'span-12' });
|
||||
if (!fnd.length) fp.body.appendChild(U.ui.empty(t('eg.findings.none')));
|
||||
else { var ul = el('ul', { class: 'eg-findings' }); fnd.forEach(function (f) { ul.appendChild(findingNode(f, multi)); }); fp.body.appendChild(ul); }
|
||||
grid.appendChild(fp);
|
||||
|
||||
var dp = U.ui.panel({ title: t('eg.dst'), hint: t('eg.dst.hint'), cls: 'span-12', variant: 'list' });
|
||||
if (!dsts.length) dp.body.appendChild(U.ui.empty(t('eg.dst.none')));
|
||||
else dp.body.appendChild(tbl([{ label: t('eg.col.ip') }, { label: t('eg.col.country') }, { label: t('eg.col.asn') }, { label: t('eg.col.conns'), cls: 'num' }, { label: t('eg.col.who') }, { label: t('eg.col.ports') }],
|
||||
dsts.map(function (x) {
|
||||
return [ipLink(x.ip), (x.cc ? U.fmt.flag(x.cc) + ' ' + U.fmt.country(x.cc) : '-'), (x.asn || '') + (x.org ? ' ' + x.org : '') || '-', nf(x.conns || 0), list(x.workloads), list(x.ports)];
|
||||
})));
|
||||
grid.appendChild(dp);
|
||||
|
||||
var bursts = (d.scanner && d.scanner.bursts) || [];
|
||||
var sp = U.ui.panel({ title: t('eg.scan'), hint: t('eg.scan.hint'), cls: 'span-12', variant: 'list', help: 'term.authorized_scanner' });
|
||||
if (!bursts.length) sp.body.appendChild(U.ui.empty(t('eg.scan.none')));
|
||||
else {
|
||||
var bad = 0;
|
||||
bursts.forEach(function (b) { bad += b.bad_dst_hits || 0; });
|
||||
if (bad > 0) sp.body.appendChild(el('div', { class: 'state-error eg-scanwarn' }, el('strong', null, t('eg.scan.warn', { n: nf(bad) }))));
|
||||
sp.body.appendChild(tbl([{ label: t('eg.col.who1') }, { label: t('eg.col.when') }, { label: t('eg.col.targets'), cls: 'num' }, { label: t('eg.col.nets') }, { label: t('eg.col.ports') }, { label: t('eg.col.conns'), cls: 'num' }, { label: t('eg.col.badhits'), cls: 'num' }],
|
||||
bursts.map(function (b) {
|
||||
return [b.workload || '-', t('eg.scan.when', { a: when(b.start), b: when(b.end) }), nf(b.targets || 0), list(b.nets), list(b.ports), nf(b.conns || 0),
|
||||
el('span', { class: b.bad_dst_hits ? 'eg-warn' : '' }, nf(b.bad_dst_hits || 0))];
|
||||
})));
|
||||
}
|
||||
grid.appendChild(sp);
|
||||
root.appendChild(grid);
|
||||
}
|
||||
|
||||
function load() {
|
||||
var my = ++seq;
|
||||
var p = Object.assign({}, U.rangeParams());
|
||||
if (ctx && ctx.host && ctx.host !== 'all') p.host = ctx.host;
|
||||
U.api('/api/v1/egress', p).then(function (d) {
|
||||
if (!alive || my !== seq) return;
|
||||
data = d; paint();
|
||||
}).catch(function () {
|
||||
if (!alive || my !== seq || data) return;
|
||||
clear(root);
|
||||
var b = el('button', { type: 'button', class: 'btn' }, t('eg.retry'));
|
||||
b.addEventListener('click', load);
|
||||
root.appendChild(el('div', { class: 'state-error' }, el('strong', null, t('eg.error')), b));
|
||||
});
|
||||
}
|
||||
|
||||
U.registerPage({
|
||||
id: 'egress', group: 'investigate', titleKey: 'eg.title',
|
||||
icon: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor"><rect x="3" y="5" width="12" height="14" rx="2"/><path d="M11 12h10"/><path d="M17 8l4 4-4 4"/></svg>',
|
||||
mount: function (node, cx) { root = el('div', { class: 'eg-page' }); node.appendChild(root); ctx = cx; alive = true; data = null; paint(); load(); },
|
||||
update: function (cx) { ctx = cx; load(); },
|
||||
refresh: function () { load(); },
|
||||
unmount: function () { alive = false; seq++; if (root && root.parentNode) root.parentNode.removeChild(root); root = null; data = null; }
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!boot()) {
|
||||
var tries = 0, iv = setInterval(function () { if (boot() || ++tries > 50) clearInterval(iv); }, 100);
|
||||
}
|
||||
})();
|
||||
@@ -443,6 +443,28 @@ window.URUTAU_I18N = {
|
||||
'help.term.slo.do': 'Compare the real number with the target; the gap is the error budget.',
|
||||
'help.term.error_budget': 'How many failures the SLO still allows in the period. When it reaches zero, the target is broken.',
|
||||
'help.term.error_budget.do': 'If the budget burns fast, pause risky changes and fix the cause first.',
|
||||
'help.term.second_firewall': 'A second line of defense: besides fail2ban, Urutau can itself block addresses it recognises as attackers, for a limited time.',
|
||||
'help.term.second_firewall.do': 'Start in observe mode and compare its decisions with what you expect before turning it on.',
|
||||
'help.term.observe_mode': 'Observation mode: Urutau decides who it would block and records it, but blocks nobody. A dry run.',
|
||||
'help.term.observe_mode.do': 'Watch the decisions for a few days. If they look right, switch URUTAU_ENFORCE to on.',
|
||||
'help.term.beaconing': 'Beaconing: a program that contacts the same destination at regular intervals, like a heartbeat. Normal software rarely does this so evenly; malware does, to ask for orders.',
|
||||
'help.term.beaconing.do': 'Find out which workload it is and whether the destination is something you know. If not, isolate the workload.',
|
||||
'help.term.c2': 'C2 (command and control): the server an attacker uses to give orders to infected machines. A connection to one means your machine may be taking orders.',
|
||||
'help.term.c2.do': 'Treat it as an incident: isolate the workload, then investigate.',
|
||||
'help.term.fanout': 'Fan-out or scan: one machine trying to connect to many different addresses in a short time, looking for something to attack.',
|
||||
'help.term.fanout.do': 'If it is not your own scanner, the workload may have been compromised.',
|
||||
'help.term.stratum': 'Stratum is the protocol of cryptocurrency mining pools. A server connecting to one is probably mining coins for someone else, on your electricity.',
|
||||
'help.term.stratum.do': 'Look for unknown processes using lots of CPU and remove them.',
|
||||
'help.term.dot': 'DoT (DNS over TLS): encrypted name lookups sent straight to an outside server, skipping your resolver. Malware uses it so you cannot see what it looks up.',
|
||||
'help.term.dot.do': 'Confirm the workload is allowed to do this; block outbound port 853 if not.',
|
||||
'help.term.workload': 'Workload: a program or container running on a server that makes its own network connections.',
|
||||
'help.term.workload.do': 'Compare each workload with what it should be doing; a database talking to the internet is suspicious.',
|
||||
'help.term.authorized_scanner': 'Authorised scanner: a workload you run on purpose to scan networks. Its mass connections are summarised instead of raised as alerts.',
|
||||
'help.term.authorized_scanner.do': 'Make sure it only aims at targets you own or may test.',
|
||||
'help.term.ban_ttl': 'Block duration (TTL): how long an address stays blocked before being released. Repeat offenders get longer blocks.',
|
||||
'help.term.ban_ttl.do': 'Short blocks are safer against mistakes; long ones stop persistent attackers.',
|
||||
'help.term.new_geo': 'New country: the workload connected to a country it had not reached before in this window.',
|
||||
'help.term.new_geo.do': 'Check whether the destination is a service you use.',
|
||||
'help.term.error_class.app': 'Errors caused by your own application (5xx coming from the app).',
|
||||
'help.term.error_class.app.do': 'These are yours to fix: read the application logs.',
|
||||
'help.term.error_class.proxy': 'Errors produced by the reverse proxy itself (bad gateway, timeout, no backend).',
|
||||
@@ -915,6 +937,28 @@ window.URUTAU_I18N = {
|
||||
'help.term.slo.do': 'Compare o número real com a meta; a diferença é o orçamento de erro.',
|
||||
'help.term.error_budget': 'Quantas falhas o SLO ainda permite no período. Quando chega a zero, a meta foi quebrada.',
|
||||
'help.term.error_budget.do': 'Se o orçamento queima rápido, pause mudanças arriscadas e corrija a causa primeiro.',
|
||||
'help.term.second_firewall': 'Uma segunda linha de defesa: além do fail2ban, o próprio Urutau pode bloquear endereços que reconhece como atacantes, por tempo limitado.',
|
||||
'help.term.second_firewall.do': 'Comece no modo observação e compare as decisões com o que você espera antes de ligar.',
|
||||
'help.term.observe_mode': 'Modo observação: o Urutau decide quem bloquearia e registra, mas não bloqueia ninguém. Um ensaio.',
|
||||
'help.term.observe_mode.do': 'Acompanhe as decisões por alguns dias. Se estiverem certas, mude URUTAU_ENFORCE para on.',
|
||||
'help.term.beaconing': 'Beaconing (sinal periódico): um programa que contata o mesmo destino em intervalos regulares, como um batimento. Software normal raramente é tão regular; malware faz isso para pedir ordens.',
|
||||
'help.term.beaconing.do': 'Descubra qual workload é e se você conhece o destino. Se não conhece, isole o workload.',
|
||||
'help.term.c2': 'C2 (comando e controle): o servidor que um atacante usa para dar ordens às máquinas infectadas. Uma conexão com ele indica que a sua máquina pode estar recebendo ordens.',
|
||||
'help.term.c2.do': 'Trate como incidente: isole o workload e investigue.',
|
||||
'help.term.fanout': 'Fan-out ou varredura: uma máquina tentando conectar a muitos endereços diferentes em pouco tempo, procurando algo para atacar.',
|
||||
'help.term.fanout.do': 'Se não for o seu scanner, o workload pode ter sido comprometido.',
|
||||
'help.term.stratum': 'Stratum é o protocolo dos grupos de mineração de criptomoedas. Um servidor conectado a um deles provavelmente está minerando moedas para outra pessoa, gastando a sua energia.',
|
||||
'help.term.stratum.do': 'Procure processos desconhecidos gastando muita CPU e remova-os.',
|
||||
'help.term.dot': 'DoT (DNS sobre TLS): consultas de nomes criptografadas, enviadas direto a um servidor de fora, sem passar pelo seu resolvedor. Malware usa para você não ver o que ele consulta.',
|
||||
'help.term.dot.do': 'Confirme se o workload tem permissão para isso; bloqueie a porta 853 de saída se não tiver.',
|
||||
'help.term.workload': 'Workload (carga de trabalho): um programa ou contêiner rodando no servidor que faz as próprias conexões de rede.',
|
||||
'help.term.workload.do': 'Compare cada workload com o que ele deveria fazer; um banco de dados falando com a internet é suspeito.',
|
||||
'help.term.authorized_scanner': 'Scanner autorizado: um workload que você mantém de propósito para varrer redes. As conexões em massa dele são resumidas, em vez de virar alerta.',
|
||||
'help.term.authorized_scanner.do': 'Garanta que ele só mire alvos seus ou que você pode testar.',
|
||||
'help.term.ban_ttl': 'Duração do bloqueio (TTL): por quanto tempo o endereço fica bloqueado antes de ser liberado. Reincidentes recebem bloqueios mais longos.',
|
||||
'help.term.ban_ttl.do': 'Bloqueios curtos são mais seguros contra enganos; longos barram atacantes persistentes.',
|
||||
'help.term.new_geo': 'País novo: o workload conectou a um país que ainda não tinha alcançado nesta janela.',
|
||||
'help.term.new_geo.do': 'Confira se o destino é um serviço que você usa.',
|
||||
'help.term.error_class.app': 'Erros causados pela sua própria aplicação (5xx vindos do app).',
|
||||
'help.term.error_class.app.do': 'São seus para corrigir: leia os logs da aplicação.',
|
||||
'help.term.error_class.proxy': 'Erros produzidos pelo próprio proxy reverso (bad gateway, timeout, sem backend).',
|
||||
|
||||
@@ -67,6 +67,10 @@
|
||||
{
|
||||
"name": "reports",
|
||||
"css": true
|
||||
},
|
||||
{
|
||||
"name": "egress",
|
||||
"css": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -2,7 +2,10 @@
|
||||
@media print it fills A4 pages and the shell chrome disappears. */
|
||||
.rpt { min-width: 0; }
|
||||
.rpt-box { display: flex; flex-direction: column; gap: var(--s-3, 12px); min-width: 0; }
|
||||
.rpt-bar { display: flex; flex-wrap: wrap; gap: 8px; }
|
||||
.rpt-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
|
||||
.rpt-opt { display: flex; flex-direction: column; gap: 2px; font-size: .75rem; color: var(--ink-muted); }
|
||||
.rpt-sel { min-height: 34px; padding: 4px 8px; border: 1px solid var(--line); border-radius: var(--radius-sm, 7px); background: var(--surface-raised, transparent); color: var(--ink); font: inherit; }
|
||||
.rpt-hint { flex-basis: 100%; margin: 0; font-size: .75rem; color: var(--ink-muted); }
|
||||
.rpt-sheet { background: var(--surface-panel); border: 1px solid var(--line); border-radius: var(--radius, 10px); padding: clamp(14px, 3vw, 32px); display: flex; flex-direction: column; gap: 22px; min-width: 0; color: var(--ink); }
|
||||
.rpt-cover { border-bottom: 2px solid var(--accent); padding-bottom: 14px; }
|
||||
.rpt-kicker { margin: 0; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); }
|
||||
|
||||
@@ -26,6 +26,12 @@
|
||||
'rpt.print': 'Print',
|
||||
'rpt.json': 'Export JSON',
|
||||
'rpt.csv': 'Export CSV',
|
||||
'rpt.dl': 'Download report (HTML)',
|
||||
'rpt.pdf': 'Print / PDF',
|
||||
'rpt.opt.period': 'Report period',
|
||||
'rpt.opt.panel': 'Same as the dashboard',
|
||||
'rpt.opt.lang': 'Report language',
|
||||
'rpt.opt.hint': 'The HTML report is one self-contained file, ready to print on A4. Open it and use Print to save as PDF.',
|
||||
'rpt.cover.kicker': 'Executive report',
|
||||
'rpt.cover.title': 'Security report',
|
||||
'rpt.cover.period': 'Period',
|
||||
@@ -97,6 +103,12 @@
|
||||
'rpt.print': 'Imprimir',
|
||||
'rpt.json': 'Exportar JSON',
|
||||
'rpt.csv': 'Exportar CSV',
|
||||
'rpt.dl': 'Baixar relatório (HTML)',
|
||||
'rpt.pdf': 'Imprimir / PDF',
|
||||
'rpt.opt.period': 'Período do relatório',
|
||||
'rpt.opt.panel': 'Igual ao do painel',
|
||||
'rpt.opt.lang': 'Idioma do relatório',
|
||||
'rpt.opt.hint': 'O relatório HTML é um arquivo único, pronto para imprimir em A4. Abra e use Imprimir para salvar em PDF.',
|
||||
'rpt.cover.kicker': 'Relatório executivo',
|
||||
'rpt.cover.title': 'Relatório de segurança',
|
||||
'rpt.cover.period': 'Período',
|
||||
@@ -231,8 +243,34 @@
|
||||
return rows.map(function (r) { return r.map(csvCell).join(','); }).join('\r\n') + '\r\n';
|
||||
}
|
||||
|
||||
var opt = { range: '', lang: '' };
|
||||
function htmlUrl(inline) {
|
||||
var p = params(ctx0);
|
||||
p.format = 'html';
|
||||
if (opt.range) { delete p.from; delete p.to; p.range = opt.range; }
|
||||
p.lang = opt.lang || (ctx0 && ctx0.lang === 'en' ? 'en' : 'pt-BR');
|
||||
if (inline) p.inline = '1';
|
||||
return '/api/v1/report?' + new URLSearchParams(p).toString();
|
||||
}
|
||||
function select(label, key, choices) {
|
||||
var sel = U.el('select', { class: 'rpt-sel', 'aria-label': label });
|
||||
choices.forEach(function (c) { var o = U.el('option', { value: c[0] }, c[1]); if (opt[key] === c[0]) o.selected = true; sel.appendChild(o); });
|
||||
sel.addEventListener('change', function () { opt[key] = sel.value; });
|
||||
return h('label', 'rpt-opt', h('span', null, label), sel);
|
||||
}
|
||||
function toolbar() {
|
||||
var bar = h('div', 'rpt-bar');
|
||||
var dl = U.el('button', { type: 'button', class: 'btn' }, t('rpt.dl'));
|
||||
dl.addEventListener('click', function () {
|
||||
var a = document.createElement('a');
|
||||
a.href = htmlUrl(false); a.download = '';
|
||||
document.body.appendChild(a); a.click(); document.body.removeChild(a);
|
||||
});
|
||||
var pr = U.el('button', { type: 'button', class: 'btn' }, t('rpt.pdf'));
|
||||
pr.addEventListener('click', function () { window.open(htmlUrl(true), '_blank', 'noopener'); });
|
||||
bar.appendChild(select(t('rpt.opt.period'), 'range', [['', t('rpt.opt.panel')], ['24h', '24h'], ['7d', '7d'], ['30d', '30d'], ['90d', '90d']]));
|
||||
bar.appendChild(select(t('rpt.opt.lang'), 'lang', [['', ctx0 && ctx0.lang === 'en' ? 'English' : 'Português'], ['pt-BR', 'Português'], ['en', 'English']]));
|
||||
bar.appendChild(dl); bar.appendChild(pr);
|
||||
var b1 = U.el('button', { type: 'button', class: 'btn' }, t('rpt.print'));
|
||||
b1.addEventListener('click', function () { window.print(); });
|
||||
var b2 = U.el('button', { type: 'button', class: 'btn' }, t('rpt.json'));
|
||||
@@ -240,6 +278,7 @@
|
||||
var b3 = U.el('button', { type: 'button', class: 'btn' }, t('rpt.csv'));
|
||||
b3.addEventListener('click', function () { if (data) save(stamp('csv'), 'text/csv;charset=utf-8', '' + toCSV(data)); });
|
||||
bar.appendChild(b1); bar.appendChild(b2); bar.appendChild(b3);
|
||||
bar.appendChild(h('p', 'rpt-hint', t('rpt.opt.hint')));
|
||||
return bar;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user