Two unauthenticated surfaces closed on the edge node. Dashboard and API: the local dashboard and every /api/* route were open to anything on the node's LAN. Adds a login page plus session-cookie auth for the browser, and cookie-or-Basic for the API so scripted callers stay possible. Passwords are hashed with stdlib scrypt (no new dependency, this runs on a Pi) and compared in constant time; the salt and session-signing secret persist in credentials.json. Startup warns while the default password is still in place. No non-browser callers of the node API exist today (C2 talks to nodes over MQTT and nodes call C2 outbound), so nothing breaks. Adds python-multipart, which FastAPI's Form() needs for the login POST and which was missing from requirements entirely. MQTT: nodes authenticated with a shared drb-node password, and the broker ACL keyed off %c — the client-supplied client id — so any holder of that one password could claim another node's topic namespace. Nodes now connect as username=<node_id>, password=<their C2-issued api_key>, which mosquitto's dynamic-security plugin checks, with the ACL keyed off the authenticated %u. TLS is gated on MQTT_TLS and uses default CA verification. The old key_request MQTT path stays in place behind TODO(mqtt-cutover) markers as the fallback until the cutover is proven; a node with no api_key on disk logs a clear repeated refusal rather than spinning. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
134 lines
3.5 KiB
HTML
134 lines
3.5 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>DRB Edge Node — Login</title>
|
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;700&display=swap" rel="stylesheet">
|
|
<style>
|
|
:root {
|
|
--bg: #0b0f19;
|
|
--glass-bg: rgba(20, 25, 40, 0.6);
|
|
--glass-border: rgba(255, 255, 255, 0.08);
|
|
--accent: #3b82f6;
|
|
--accent-hover: #2563eb;
|
|
--danger: #ef4444;
|
|
--text-main: #f8fafc;
|
|
--text-muted: #94a3b8;
|
|
}
|
|
|
|
*, *::before, *::after {
|
|
box-sizing: border-box;
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
|
|
body {
|
|
font-family: 'Inter', sans-serif;
|
|
background: var(--bg);
|
|
background-image:
|
|
radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.15), transparent 25%),
|
|
radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.15), transparent 25%);
|
|
color: var(--text-main);
|
|
min-height: 100vh;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 1.5rem;
|
|
}
|
|
|
|
.login-card {
|
|
width: 100%;
|
|
max-width: 360px;
|
|
background: var(--glass-bg);
|
|
backdrop-filter: blur(12px);
|
|
-webkit-backdrop-filter: blur(12px);
|
|
border: 1px solid var(--glass-border);
|
|
border-radius: 16px;
|
|
padding: 2rem;
|
|
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
|
}
|
|
|
|
h1 {
|
|
font-size: 1.5rem;
|
|
font-weight: 800;
|
|
margin-bottom: 0.25rem;
|
|
}
|
|
|
|
.subtitle {
|
|
color: var(--text-muted);
|
|
font-family: 'JetBrains Mono', monospace;
|
|
font-size: 0.8rem;
|
|
margin-bottom: 1.5rem;
|
|
}
|
|
|
|
label {
|
|
display: block;
|
|
font-size: 0.8rem;
|
|
color: var(--text-muted);
|
|
margin-bottom: 0.35rem;
|
|
margin-top: 1rem;
|
|
}
|
|
|
|
input[type="text"], input[type="password"] {
|
|
width: 100%;
|
|
padding: 0.65rem 0.75rem;
|
|
border-radius: 8px;
|
|
border: 1px solid var(--glass-border);
|
|
background: rgba(255, 255, 255, 0.05);
|
|
color: var(--text-main);
|
|
font-family: inherit;
|
|
font-size: 0.95rem;
|
|
}
|
|
|
|
input[type="text"]:focus, input[type="password"]:focus {
|
|
outline: none;
|
|
border-color: var(--accent);
|
|
}
|
|
|
|
button {
|
|
width: 100%;
|
|
margin-top: 1.5rem;
|
|
padding: 0.75rem 1.5rem;
|
|
border-radius: 8px;
|
|
font-weight: 600;
|
|
font-size: 0.9rem;
|
|
border: none;
|
|
cursor: pointer;
|
|
background: var(--accent);
|
|
color: white;
|
|
box-shadow: 0 4px 14px 0 rgba(59, 130, 246, 0.39);
|
|
transition: all 0.2s ease;
|
|
}
|
|
|
|
button:hover {
|
|
background: var(--accent-hover);
|
|
}
|
|
|
|
.error {
|
|
margin-top: 1rem;
|
|
padding: 0.6rem 0.8rem;
|
|
border-radius: 8px;
|
|
background: rgba(239, 68, 68, 0.15);
|
|
border: 1px solid rgba(239, 68, 68, 0.2);
|
|
color: var(--danger);
|
|
font-size: 0.85rem;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="login-card">
|
|
<h1>DRB Edge Node</h1>
|
|
<p class="subtitle">Sign in to the local dashboard</p>
|
|
<form method="post" action="/login">
|
|
<label for="username">Username</label>
|
|
<input type="text" id="username" name="username" autocomplete="username" required autofocus>
|
|
<label for="password">Password</label>
|
|
<input type="password" id="password" name="password" autocomplete="current-password" required>
|
|
<button type="submit">Sign in</button>
|
|
</form>
|
|
<!--ERROR_BANNER-->
|
|
</div>
|
|
</body>
|
|
</html>
|