feat: Add operations view components for logs, overview, security, and stats
- Implemented `ops-view-logs` for displaying and filtering logs with streaming capabilities.
- Created `ops-view-overview` to show server, email, DNS statistics, and charts.
- Developed `ops-view-security` for monitoring security metrics, blocked IPs, and authentication attempts.
- Added `ops-view-stats` to present comprehensive statistics on server, email, DNS, and security metrics.
- Introduced shared styles and components including `ops-sectionheading` for consistent UI.
2025-06-08 12:03:17 +00:00
|
|
|
import * as plugins from '../plugins.js';
|
|
|
|
|
import * as shared from './shared/index.js';
|
|
|
|
|
import * as appstate from '../appstate.js';
|
|
|
|
|
|
|
|
|
|
import {
|
|
|
|
|
DeesElement,
|
|
|
|
|
customElement,
|
|
|
|
|
html,
|
|
|
|
|
state,
|
|
|
|
|
css,
|
|
|
|
|
cssManager,
|
|
|
|
|
} from '@design.estate/dees-element';
|
2025-06-19 12:14:52 +00:00
|
|
|
import { type IStatsTile } from '@design.estate/dees-catalog';
|
feat: Add operations view components for logs, overview, security, and stats
- Implemented `ops-view-logs` for displaying and filtering logs with streaming capabilities.
- Created `ops-view-overview` to show server, email, DNS statistics, and charts.
- Developed `ops-view-security` for monitoring security metrics, blocked IPs, and authentication attempts.
- Added `ops-view-stats` to present comprehensive statistics on server, email, DNS, and security metrics.
- Introduced shared styles and components including `ops-sectionheading` for consistent UI.
2025-06-08 12:03:17 +00:00
|
|
|
|
|
|
|
|
@customElement('ops-view-security')
|
|
|
|
|
export class OpsViewSecurity extends DeesElement {
|
|
|
|
|
@state()
|
2026-02-01 19:21:37 +00:00
|
|
|
accessor statsState: appstate.IStatsState = {
|
feat: Add operations view components for logs, overview, security, and stats
- Implemented `ops-view-logs` for displaying and filtering logs with streaming capabilities.
- Created `ops-view-overview` to show server, email, DNS statistics, and charts.
- Developed `ops-view-security` for monitoring security metrics, blocked IPs, and authentication attempts.
- Added `ops-view-stats` to present comprehensive statistics on server, email, DNS, and security metrics.
- Introduced shared styles and components including `ops-sectionheading` for consistent UI.
2025-06-08 12:03:17 +00:00
|
|
|
serverStats: null,
|
|
|
|
|
emailStats: null,
|
|
|
|
|
dnsStats: null,
|
|
|
|
|
securityMetrics: null,
|
2026-04-03 14:11:17 +00:00
|
|
|
radiusStats: null,
|
|
|
|
|
vpnStats: null,
|
feat: Add operations view components for logs, overview, security, and stats
- Implemented `ops-view-logs` for displaying and filtering logs with streaming capabilities.
- Created `ops-view-overview` to show server, email, DNS statistics, and charts.
- Developed `ops-view-security` for monitoring security metrics, blocked IPs, and authentication attempts.
- Added `ops-view-stats` to present comprehensive statistics on server, email, DNS, and security metrics.
- Introduced shared styles and components including `ops-sectionheading` for consistent UI.
2025-06-08 12:03:17 +00:00
|
|
|
lastUpdated: 0,
|
|
|
|
|
isLoading: false,
|
|
|
|
|
error: null,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
@state()
|
2026-02-01 19:21:37 +00:00
|
|
|
accessor selectedTab: 'overview' | 'blocked' | 'authentication' | 'email-security' = 'overview';
|
feat: Add operations view components for logs, overview, security, and stats
- Implemented `ops-view-logs` for displaying and filtering logs with streaming capabilities.
- Created `ops-view-overview` to show server, email, DNS statistics, and charts.
- Developed `ops-view-security` for monitoring security metrics, blocked IPs, and authentication attempts.
- Added `ops-view-stats` to present comprehensive statistics on server, email, DNS, and security metrics.
- Introduced shared styles and components including `ops-sectionheading` for consistent UI.
2025-06-08 12:03:17 +00:00
|
|
|
|
2026-04-07 21:02:37 +00:00
|
|
|
private tabLabelMap: Record<string, string> = {
|
|
|
|
|
'overview': 'Overview',
|
|
|
|
|
'blocked': 'Blocked IPs',
|
|
|
|
|
'authentication': 'Authentication',
|
|
|
|
|
'email-security': 'Email Security',
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
private labelToTab: Record<string, 'overview' | 'blocked' | 'authentication' | 'email-security'> = {
|
|
|
|
|
'Overview': 'overview',
|
|
|
|
|
'Blocked IPs': 'blocked',
|
|
|
|
|
'Authentication': 'authentication',
|
|
|
|
|
'Email Security': 'email-security',
|
|
|
|
|
};
|
|
|
|
|
|
feat: Add operations view components for logs, overview, security, and stats
- Implemented `ops-view-logs` for displaying and filtering logs with streaming capabilities.
- Created `ops-view-overview` to show server, email, DNS statistics, and charts.
- Developed `ops-view-security` for monitoring security metrics, blocked IPs, and authentication attempts.
- Added `ops-view-stats` to present comprehensive statistics on server, email, DNS, and security metrics.
- Introduced shared styles and components including `ops-sectionheading` for consistent UI.
2025-06-08 12:03:17 +00:00
|
|
|
constructor() {
|
|
|
|
|
super();
|
|
|
|
|
const subscription = appstate.statsStatePart
|
|
|
|
|
.select((stateArg) => stateArg)
|
|
|
|
|
.subscribe((statsState) => {
|
|
|
|
|
this.statsState = statsState;
|
|
|
|
|
});
|
|
|
|
|
this.rxSubscriptions.push(subscription);
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-07 21:02:37 +00:00
|
|
|
async firstUpdated() {
|
|
|
|
|
const toggle = this.shadowRoot!.querySelector('dees-input-multitoggle') as any;
|
|
|
|
|
if (toggle) {
|
|
|
|
|
const sub = toggle.changeSubject.subscribe(() => {
|
|
|
|
|
const tab = this.labelToTab[toggle.selectedOption];
|
|
|
|
|
if (tab) this.selectedTab = tab;
|
|
|
|
|
});
|
|
|
|
|
this.rxSubscriptions.push(sub);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
feat: Add operations view components for logs, overview, security, and stats
- Implemented `ops-view-logs` for displaying and filtering logs with streaming capabilities.
- Created `ops-view-overview` to show server, email, DNS statistics, and charts.
- Developed `ops-view-security` for monitoring security metrics, blocked IPs, and authentication attempts.
- Added `ops-view-stats` to present comprehensive statistics on server, email, DNS, and security metrics.
- Introduced shared styles and components including `ops-sectionheading` for consistent UI.
2025-06-08 12:03:17 +00:00
|
|
|
public static styles = [
|
|
|
|
|
cssManager.defaultStyles,
|
|
|
|
|
shared.viewHostCss,
|
|
|
|
|
css`
|
2026-04-07 21:02:37 +00:00
|
|
|
dees-input-multitoggle {
|
feat: Add operations view components for logs, overview, security, and stats
- Implemented `ops-view-logs` for displaying and filtering logs with streaming capabilities.
- Created `ops-view-overview` to show server, email, DNS statistics, and charts.
- Developed `ops-view-security` for monitoring security metrics, blocked IPs, and authentication attempts.
- Added `ops-view-stats` to present comprehensive statistics on server, email, DNS, and security metrics.
- Introduced shared styles and components including `ops-sectionheading` for consistent UI.
2025-06-08 12:03:17 +00:00
|
|
|
margin-bottom: 24px;
|
|
|
|
|
}
|
|
|
|
|
|
2025-06-19 12:14:52 +00:00
|
|
|
h2 {
|
|
|
|
|
margin: 32px 0 16px 0;
|
|
|
|
|
font-size: 24px;
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
color: ${cssManager.bdTheme('#333', '#ccc')};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dees-statsgrid {
|
feat: Add operations view components for logs, overview, security, and stats
- Implemented `ops-view-logs` for displaying and filtering logs with streaming capabilities.
- Created `ops-view-overview` to show server, email, DNS statistics, and charts.
- Developed `ops-view-security` for monitoring security metrics, blocked IPs, and authentication attempts.
- Added `ops-view-stats` to present comprehensive statistics on server, email, DNS, and security metrics.
- Introduced shared styles and components including `ops-sectionheading` for consistent UI.
2025-06-08 12:03:17 +00:00
|
|
|
margin-bottom: 32px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.securityCard {
|
2025-06-19 12:14:52 +00:00
|
|
|
background: ${cssManager.bdTheme('#fff', '#222')};
|
|
|
|
|
border: 1px solid ${cssManager.bdTheme('#e9ecef', '#333')};
|
feat: Add operations view components for logs, overview, security, and stats
- Implemented `ops-view-logs` for displaying and filtering logs with streaming capabilities.
- Created `ops-view-overview` to show server, email, DNS statistics, and charts.
- Developed `ops-view-security` for monitoring security metrics, blocked IPs, and authentication attempts.
- Added `ops-view-stats` to present comprehensive statistics on server, email, DNS, and security metrics.
- Introduced shared styles and components including `ops-sectionheading` for consistent UI.
2025-06-08 12:03:17 +00:00
|
|
|
border-radius: 8px;
|
|
|
|
|
padding: 24px;
|
|
|
|
|
position: relative;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.actionButton {
|
|
|
|
|
margin-top: 16px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
`,
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
public render() {
|
|
|
|
|
return html`
|
2026-04-05 10:13:09 +00:00
|
|
|
<dees-heading level="2">Security</dees-heading>
|
2026-04-07 21:02:37 +00:00
|
|
|
|
|
|
|
|
<dees-input-multitoggle
|
|
|
|
|
.type=${'single'}
|
|
|
|
|
.options=${['Overview', 'Blocked IPs', 'Authentication', 'Email Security']}
|
|
|
|
|
.selectedOption=${this.tabLabelMap[this.selectedTab]}
|
|
|
|
|
></dees-input-multitoggle>
|
feat: Add operations view components for logs, overview, security, and stats
- Implemented `ops-view-logs` for displaying and filtering logs with streaming capabilities.
- Created `ops-view-overview` to show server, email, DNS statistics, and charts.
- Developed `ops-view-security` for monitoring security metrics, blocked IPs, and authentication attempts.
- Added `ops-view-stats` to present comprehensive statistics on server, email, DNS, and security metrics.
- Introduced shared styles and components including `ops-sectionheading` for consistent UI.
2025-06-08 12:03:17 +00:00
|
|
|
|
|
|
|
|
${this.renderTabContent()}
|
|
|
|
|
`;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private renderTabContent() {
|
|
|
|
|
const metrics = this.statsState.securityMetrics;
|
|
|
|
|
|
|
|
|
|
if (!metrics) {
|
|
|
|
|
return html`
|
|
|
|
|
<div class="loadingMessage">
|
|
|
|
|
<p>Loading security metrics...</p>
|
|
|
|
|
</div>
|
|
|
|
|
`;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch(this.selectedTab) {
|
|
|
|
|
case 'overview':
|
|
|
|
|
return this.renderOverview(metrics);
|
|
|
|
|
case 'blocked':
|
|
|
|
|
return this.renderBlockedIPs(metrics);
|
|
|
|
|
case 'authentication':
|
|
|
|
|
return this.renderAuthentication(metrics);
|
|
|
|
|
case 'email-security':
|
|
|
|
|
return this.renderEmailSecurity(metrics);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private renderOverview(metrics: any) {
|
|
|
|
|
const threatLevel = this.calculateThreatLevel(metrics);
|
2025-06-19 12:14:52 +00:00
|
|
|
const threatScore = this.getThreatScore(metrics);
|
2026-02-19 17:23:43 +00:00
|
|
|
|
|
|
|
|
// Derive active sessions from recent successful auth events (last hour)
|
|
|
|
|
const allEvents: any[] = metrics.recentEvents || [];
|
|
|
|
|
const oneHourAgo = Date.now() - 3600000;
|
|
|
|
|
const recentAuthSuccesses = allEvents.filter(
|
|
|
|
|
(evt: any) => evt.type === 'authentication' && evt.success === true && evt.timestamp >= oneHourAgo
|
|
|
|
|
).length;
|
|
|
|
|
|
2025-06-19 12:14:52 +00:00
|
|
|
const tiles: IStatsTile[] = [
|
|
|
|
|
{
|
|
|
|
|
id: 'threatLevel',
|
|
|
|
|
title: 'Threat Level',
|
|
|
|
|
value: threatScore,
|
|
|
|
|
type: 'gauge',
|
2026-02-17 10:57:27 +00:00
|
|
|
icon: 'lucide:Shield',
|
2025-06-19 12:14:52 +00:00
|
|
|
gaugeOptions: {
|
|
|
|
|
min: 0,
|
|
|
|
|
max: 100,
|
|
|
|
|
thresholds: [
|
|
|
|
|
{ value: 0, color: '#ef4444' },
|
|
|
|
|
{ value: 30, color: '#f59e0b' },
|
|
|
|
|
{ value: 70, color: '#22c55e' },
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
description: `Status: ${threatLevel.toUpperCase()}`,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'blockedThreats',
|
|
|
|
|
title: 'Blocked Threats',
|
2026-02-19 17:23:43 +00:00
|
|
|
value: (metrics.blockedIPs?.length || 0) + metrics.spamDetected,
|
2025-06-19 12:14:52 +00:00
|
|
|
type: 'number',
|
2026-02-17 10:57:27 +00:00
|
|
|
icon: 'lucide:ShieldCheck',
|
2025-06-19 12:14:52 +00:00
|
|
|
color: '#ef4444',
|
|
|
|
|
description: 'Total threats blocked today',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'activeSessions',
|
|
|
|
|
title: 'Active Sessions',
|
2026-02-19 17:23:43 +00:00
|
|
|
value: recentAuthSuccesses,
|
2025-06-19 12:14:52 +00:00
|
|
|
type: 'number',
|
2026-02-17 10:57:27 +00:00
|
|
|
icon: 'lucide:Users',
|
2025-06-19 12:14:52 +00:00
|
|
|
color: '#22c55e',
|
2026-02-19 17:23:43 +00:00
|
|
|
description: 'Authenticated in last hour',
|
2025-06-19 12:14:52 +00:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'authFailures',
|
|
|
|
|
title: 'Auth Failures',
|
|
|
|
|
value: metrics.authenticationFailures,
|
|
|
|
|
type: 'number',
|
2026-02-17 10:57:27 +00:00
|
|
|
icon: 'lucide:LockOpen',
|
2025-06-19 12:14:52 +00:00
|
|
|
color: metrics.authenticationFailures > 10 ? '#ef4444' : '#f59e0b',
|
|
|
|
|
description: 'Failed login attempts today',
|
|
|
|
|
},
|
|
|
|
|
];
|
feat: Add operations view components for logs, overview, security, and stats
- Implemented `ops-view-logs` for displaying and filtering logs with streaming capabilities.
- Created `ops-view-overview` to show server, email, DNS statistics, and charts.
- Developed `ops-view-security` for monitoring security metrics, blocked IPs, and authentication attempts.
- Added `ops-view-stats` to present comprehensive statistics on server, email, DNS, and security metrics.
- Introduced shared styles and components including `ops-sectionheading` for consistent UI.
2025-06-08 12:03:17 +00:00
|
|
|
|
|
|
|
|
return html`
|
2025-06-19 12:14:52 +00:00
|
|
|
<dees-statsgrid
|
|
|
|
|
.tiles=${tiles}
|
|
|
|
|
.minTileWidth=${200}
|
|
|
|
|
></dees-statsgrid>
|
feat: Add operations view components for logs, overview, security, and stats
- Implemented `ops-view-logs` for displaying and filtering logs with streaming capabilities.
- Created `ops-view-overview` to show server, email, DNS statistics, and charts.
- Developed `ops-view-security` for monitoring security metrics, blocked IPs, and authentication attempts.
- Added `ops-view-stats` to present comprehensive statistics on server, email, DNS, and security metrics.
- Introduced shared styles and components including `ops-sectionheading` for consistent UI.
2025-06-08 12:03:17 +00:00
|
|
|
|
|
|
|
|
<h2>Recent Security Events</h2>
|
|
|
|
|
<dees-table
|
|
|
|
|
.heading1=${'Security Events'}
|
|
|
|
|
.heading2=${'Last 24 hours'}
|
|
|
|
|
.data=${this.getSecurityEvents(metrics)}
|
|
|
|
|
.displayFunction=${(item) => ({
|
|
|
|
|
'Time': new Date(item.timestamp).toLocaleTimeString(),
|
|
|
|
|
'Event': item.event,
|
|
|
|
|
'Severity': item.severity,
|
|
|
|
|
'Details': item.details,
|
|
|
|
|
})}
|
|
|
|
|
></dees-table>
|
|
|
|
|
`;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private renderBlockedIPs(metrics: any) {
|
2026-04-07 21:02:37 +00:00
|
|
|
const blockedIPs: string[] = metrics.blockedIPs || [];
|
|
|
|
|
|
|
|
|
|
const tiles: IStatsTile[] = [
|
|
|
|
|
{
|
|
|
|
|
id: 'totalBlocked',
|
|
|
|
|
title: 'Blocked IPs',
|
|
|
|
|
value: blockedIPs.length,
|
|
|
|
|
type: 'number',
|
|
|
|
|
icon: 'lucide:ShieldBan',
|
|
|
|
|
color: blockedIPs.length > 0 ? '#ef4444' : '#22c55e',
|
|
|
|
|
description: 'Currently blocked addresses',
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
feat: Add operations view components for logs, overview, security, and stats
- Implemented `ops-view-logs` for displaying and filtering logs with streaming capabilities.
- Created `ops-view-overview` to show server, email, DNS statistics, and charts.
- Developed `ops-view-security` for monitoring security metrics, blocked IPs, and authentication attempts.
- Added `ops-view-stats` to present comprehensive statistics on server, email, DNS, and security metrics.
- Introduced shared styles and components including `ops-sectionheading` for consistent UI.
2025-06-08 12:03:17 +00:00
|
|
|
return html`
|
2026-04-07 21:02:37 +00:00
|
|
|
<dees-statsgrid
|
|
|
|
|
.tiles=${tiles}
|
|
|
|
|
.minTileWidth=${200}
|
|
|
|
|
></dees-statsgrid>
|
|
|
|
|
|
|
|
|
|
<dees-table
|
|
|
|
|
.heading1=${'Blocked IP Addresses'}
|
|
|
|
|
.heading2=${'IPs blocked due to suspicious activity'}
|
|
|
|
|
.data=${blockedIPs.map((ip) => ({ ip }))}
|
|
|
|
|
.displayFunction=${(item) => ({
|
|
|
|
|
'IP Address': item.ip,
|
|
|
|
|
'Reason': 'Suspicious activity',
|
|
|
|
|
})}
|
|
|
|
|
.dataActions=${[
|
|
|
|
|
{
|
|
|
|
|
name: 'Unblock',
|
|
|
|
|
iconName: 'lucide:shield-off',
|
|
|
|
|
type: ['contextmenu' as const],
|
|
|
|
|
actionFunc: async (item) => {
|
|
|
|
|
await this.unblockIP(item.ip);
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'Clear All',
|
|
|
|
|
iconName: 'lucide:trash-2',
|
|
|
|
|
type: ['header' as const],
|
|
|
|
|
actionFunc: async () => {
|
|
|
|
|
await this.clearBlockedIPs();
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
]}
|
|
|
|
|
></dees-table>
|
feat: Add operations view components for logs, overview, security, and stats
- Implemented `ops-view-logs` for displaying and filtering logs with streaming capabilities.
- Created `ops-view-overview` to show server, email, DNS statistics, and charts.
- Developed `ops-view-security` for monitoring security metrics, blocked IPs, and authentication attempts.
- Added `ops-view-stats` to present comprehensive statistics on server, email, DNS, and security metrics.
- Introduced shared styles and components including `ops-sectionheading` for consistent UI.
2025-06-08 12:03:17 +00:00
|
|
|
`;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private renderAuthentication(metrics: any) {
|
2026-02-19 17:23:43 +00:00
|
|
|
// Derive auth events from recentEvents
|
|
|
|
|
const allEvents: any[] = metrics.recentEvents || [];
|
|
|
|
|
const authEvents = allEvents.filter((evt: any) => evt.type === 'authentication');
|
|
|
|
|
const successfulLogins = authEvents.filter((evt: any) => evt.success === true).length;
|
|
|
|
|
|
2025-06-19 12:14:52 +00:00
|
|
|
const tiles: IStatsTile[] = [
|
|
|
|
|
{
|
|
|
|
|
id: 'authFailures',
|
|
|
|
|
title: 'Authentication Failures',
|
|
|
|
|
value: metrics.authenticationFailures,
|
|
|
|
|
type: 'number',
|
2026-02-17 10:57:27 +00:00
|
|
|
icon: 'lucide:LockOpen',
|
2025-06-19 12:14:52 +00:00
|
|
|
color: metrics.authenticationFailures > 10 ? '#ef4444' : '#f59e0b',
|
|
|
|
|
description: 'Failed authentication attempts today',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'successfulLogins',
|
|
|
|
|
title: 'Successful Logins',
|
2026-02-19 17:23:43 +00:00
|
|
|
value: successfulLogins,
|
2025-06-19 12:14:52 +00:00
|
|
|
type: 'number',
|
2026-02-17 10:57:27 +00:00
|
|
|
icon: 'lucide:Lock',
|
2025-06-19 12:14:52 +00:00
|
|
|
color: '#22c55e',
|
|
|
|
|
description: 'Successful logins today',
|
|
|
|
|
},
|
|
|
|
|
];
|
feat: Add operations view components for logs, overview, security, and stats
- Implemented `ops-view-logs` for displaying and filtering logs with streaming capabilities.
- Created `ops-view-overview` to show server, email, DNS statistics, and charts.
- Developed `ops-view-security` for monitoring security metrics, blocked IPs, and authentication attempts.
- Added `ops-view-stats` to present comprehensive statistics on server, email, DNS, and security metrics.
- Introduced shared styles and components including `ops-sectionheading` for consistent UI.
2025-06-08 12:03:17 +00:00
|
|
|
|
2026-02-19 17:23:43 +00:00
|
|
|
// Map auth events to login history table data
|
|
|
|
|
const loginHistory = authEvents.map((evt: any) => ({
|
|
|
|
|
timestamp: evt.timestamp,
|
|
|
|
|
username: evt.details?.username || 'unknown',
|
|
|
|
|
ipAddress: evt.ipAddress || 'unknown',
|
|
|
|
|
success: evt.success ?? false,
|
|
|
|
|
reason: evt.success ? '' : evt.message || 'Authentication failed',
|
|
|
|
|
}));
|
|
|
|
|
|
2025-06-19 12:14:52 +00:00
|
|
|
return html`
|
|
|
|
|
<dees-statsgrid
|
|
|
|
|
.tiles=${tiles}
|
|
|
|
|
.minTileWidth=${200}
|
|
|
|
|
></dees-statsgrid>
|
feat: Add operations view components for logs, overview, security, and stats
- Implemented `ops-view-logs` for displaying and filtering logs with streaming capabilities.
- Created `ops-view-overview` to show server, email, DNS statistics, and charts.
- Developed `ops-view-security` for monitoring security metrics, blocked IPs, and authentication attempts.
- Added `ops-view-stats` to present comprehensive statistics on server, email, DNS, and security metrics.
- Introduced shared styles and components including `ops-sectionheading` for consistent UI.
2025-06-08 12:03:17 +00:00
|
|
|
|
|
|
|
|
<h2>Recent Login Attempts</h2>
|
|
|
|
|
<dees-table
|
|
|
|
|
.heading1=${'Login History'}
|
|
|
|
|
.heading2=${'Recent authentication attempts'}
|
2026-02-19 17:23:43 +00:00
|
|
|
.data=${loginHistory}
|
feat: Add operations view components for logs, overview, security, and stats
- Implemented `ops-view-logs` for displaying and filtering logs with streaming capabilities.
- Created `ops-view-overview` to show server, email, DNS statistics, and charts.
- Developed `ops-view-security` for monitoring security metrics, blocked IPs, and authentication attempts.
- Added `ops-view-stats` to present comprehensive statistics on server, email, DNS, and security metrics.
- Introduced shared styles and components including `ops-sectionheading` for consistent UI.
2025-06-08 12:03:17 +00:00
|
|
|
.displayFunction=${(item) => ({
|
|
|
|
|
'Time': new Date(item.timestamp).toLocaleString(),
|
|
|
|
|
'Username': item.username,
|
|
|
|
|
'IP Address': item.ipAddress,
|
|
|
|
|
'Status': item.success ? 'Success' : 'Failed',
|
|
|
|
|
'Reason': item.reason || '-',
|
|
|
|
|
})}
|
|
|
|
|
></dees-table>
|
|
|
|
|
`;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private renderEmailSecurity(metrics: any) {
|
2025-06-19 12:14:52 +00:00
|
|
|
const tiles: IStatsTile[] = [
|
|
|
|
|
{
|
|
|
|
|
id: 'malware',
|
|
|
|
|
title: 'Malware Detection',
|
|
|
|
|
value: metrics.malwareDetected,
|
|
|
|
|
type: 'number',
|
2026-02-17 10:57:27 +00:00
|
|
|
icon: 'lucide:BugOff',
|
2025-06-19 12:14:52 +00:00
|
|
|
color: metrics.malwareDetected > 0 ? '#ef4444' : '#22c55e',
|
|
|
|
|
description: 'Malware detected',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'phishing',
|
|
|
|
|
title: 'Phishing Detection',
|
|
|
|
|
value: metrics.phishingDetected,
|
|
|
|
|
type: 'number',
|
2026-02-17 10:57:27 +00:00
|
|
|
icon: 'lucide:Fish',
|
2025-06-19 12:14:52 +00:00
|
|
|
color: metrics.phishingDetected > 0 ? '#ef4444' : '#22c55e',
|
|
|
|
|
description: 'Phishing attempts detected',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'suspicious',
|
|
|
|
|
title: 'Suspicious Activities',
|
|
|
|
|
value: metrics.suspiciousActivities,
|
|
|
|
|
type: 'number',
|
2026-02-17 10:57:27 +00:00
|
|
|
icon: 'lucide:TriangleAlert',
|
2025-06-19 12:14:52 +00:00
|
|
|
color: metrics.suspiciousActivities > 5 ? '#ef4444' : '#f59e0b',
|
|
|
|
|
description: 'Suspicious activities detected',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'spam',
|
|
|
|
|
title: 'Spam Detection',
|
|
|
|
|
value: metrics.spamDetected,
|
|
|
|
|
type: 'number',
|
2026-02-17 10:57:27 +00:00
|
|
|
icon: 'lucide:Ban',
|
2025-06-19 12:14:52 +00:00
|
|
|
color: '#f59e0b',
|
|
|
|
|
description: 'Spam emails blocked',
|
|
|
|
|
},
|
|
|
|
|
];
|
feat: Add operations view components for logs, overview, security, and stats
- Implemented `ops-view-logs` for displaying and filtering logs with streaming capabilities.
- Created `ops-view-overview` to show server, email, DNS statistics, and charts.
- Developed `ops-view-security` for monitoring security metrics, blocked IPs, and authentication attempts.
- Added `ops-view-stats` to present comprehensive statistics on server, email, DNS, and security metrics.
- Introduced shared styles and components including `ops-sectionheading` for consistent UI.
2025-06-08 12:03:17 +00:00
|
|
|
|
2025-06-19 12:14:52 +00:00
|
|
|
return html`
|
|
|
|
|
<dees-statsgrid
|
|
|
|
|
.tiles=${tiles}
|
|
|
|
|
.minTileWidth=${200}
|
|
|
|
|
></dees-statsgrid>
|
feat: Add operations view components for logs, overview, security, and stats
- Implemented `ops-view-logs` for displaying and filtering logs with streaming capabilities.
- Created `ops-view-overview` to show server, email, DNS statistics, and charts.
- Developed `ops-view-security` for monitoring security metrics, blocked IPs, and authentication attempts.
- Added `ops-view-stats` to present comprehensive statistics on server, email, DNS, and security metrics.
- Introduced shared styles and components including `ops-sectionheading` for consistent UI.
2025-06-08 12:03:17 +00:00
|
|
|
|
|
|
|
|
<h2>Email Security Configuration</h2>
|
|
|
|
|
<div class="securityCard">
|
|
|
|
|
<dees-form>
|
|
|
|
|
<dees-input-checkbox
|
|
|
|
|
.key=${'enableSPF'}
|
|
|
|
|
.label=${'Enable SPF checking'}
|
|
|
|
|
.value=${true}
|
|
|
|
|
></dees-input-checkbox>
|
|
|
|
|
<dees-input-checkbox
|
|
|
|
|
.key=${'enableDKIM'}
|
|
|
|
|
.label=${'Enable DKIM validation'}
|
|
|
|
|
.value=${true}
|
|
|
|
|
></dees-input-checkbox>
|
|
|
|
|
<dees-input-checkbox
|
|
|
|
|
.key=${'enableDMARC'}
|
|
|
|
|
.label=${'Enable DMARC policy enforcement'}
|
|
|
|
|
.value=${true}
|
|
|
|
|
></dees-input-checkbox>
|
|
|
|
|
<dees-input-checkbox
|
|
|
|
|
.key=${'enableSpamFilter'}
|
|
|
|
|
.label=${'Enable spam filtering'}
|
|
|
|
|
.value=${true}
|
|
|
|
|
></dees-input-checkbox>
|
|
|
|
|
</dees-form>
|
|
|
|
|
<dees-button
|
|
|
|
|
class="actionButton"
|
|
|
|
|
type="highlighted"
|
|
|
|
|
@click=${() => this.saveEmailSecuritySettings()}
|
|
|
|
|
>
|
|
|
|
|
Save Settings
|
|
|
|
|
</dees-button>
|
|
|
|
|
</div>
|
|
|
|
|
`;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private calculateThreatLevel(metrics: any): string {
|
|
|
|
|
const score = this.getThreatScore(metrics);
|
|
|
|
|
if (score < 30) return 'alert';
|
|
|
|
|
if (score < 70) return 'warning';
|
|
|
|
|
return 'success';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private getThreatScore(metrics: any): number {
|
|
|
|
|
// Simple scoring algorithm
|
|
|
|
|
let score = 100;
|
2026-02-19 17:23:43 +00:00
|
|
|
const blockedCount = Array.isArray(metrics.blockedIPs) ? metrics.blockedIPs.length : (metrics.blockedIPs || 0);
|
|
|
|
|
score -= blockedCount * 2;
|
|
|
|
|
score -= (metrics.authenticationFailures || 0) * 1;
|
|
|
|
|
score -= (metrics.spamDetected || 0) * 0.5;
|
|
|
|
|
score -= (metrics.malwareDetected || 0) * 3;
|
|
|
|
|
score -= (metrics.phishingDetected || 0) * 3;
|
|
|
|
|
score -= (metrics.suspiciousActivities || 0) * 2;
|
feat: Add operations view components for logs, overview, security, and stats
- Implemented `ops-view-logs` for displaying and filtering logs with streaming capabilities.
- Created `ops-view-overview` to show server, email, DNS statistics, and charts.
- Developed `ops-view-security` for monitoring security metrics, blocked IPs, and authentication attempts.
- Added `ops-view-stats` to present comprehensive statistics on server, email, DNS, and security metrics.
- Introduced shared styles and components including `ops-sectionheading` for consistent UI.
2025-06-08 12:03:17 +00:00
|
|
|
return Math.max(0, Math.min(100, Math.round(score)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private getSecurityEvents(metrics: any): any[] {
|
2026-02-19 17:23:43 +00:00
|
|
|
const events: any[] = metrics.recentEvents || [];
|
|
|
|
|
return events.map((evt: any) => ({
|
|
|
|
|
timestamp: evt.timestamp,
|
|
|
|
|
event: evt.message,
|
|
|
|
|
severity: evt.level === 'critical' ? 'critical' : evt.level === 'error' ? 'high' : evt.level === 'warn' ? 'warning' : 'info',
|
|
|
|
|
details: evt.ipAddress ? `IP: ${evt.ipAddress}` : evt.domain ? `Domain: ${evt.domain}` : evt.type,
|
|
|
|
|
}));
|
feat: Add operations view components for logs, overview, security, and stats
- Implemented `ops-view-logs` for displaying and filtering logs with streaming capabilities.
- Created `ops-view-overview` to show server, email, DNS statistics, and charts.
- Developed `ops-view-security` for monitoring security metrics, blocked IPs, and authentication attempts.
- Added `ops-view-stats` to present comprehensive statistics on server, email, DNS, and security metrics.
- Introduced shared styles and components including `ops-sectionheading` for consistent UI.
2025-06-08 12:03:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private async clearBlockedIPs() {
|
2026-02-19 17:23:43 +00:00
|
|
|
// SmartProxy manages IP blocking — not yet exposed via API
|
|
|
|
|
alert('Clearing blocked IPs is not yet supported from the UI.');
|
feat: Add operations view components for logs, overview, security, and stats
- Implemented `ops-view-logs` for displaying and filtering logs with streaming capabilities.
- Created `ops-view-overview` to show server, email, DNS statistics, and charts.
- Developed `ops-view-security` for monitoring security metrics, blocked IPs, and authentication attempts.
- Added `ops-view-stats` to present comprehensive statistics on server, email, DNS, and security metrics.
- Introduced shared styles and components including `ops-sectionheading` for consistent UI.
2025-06-08 12:03:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private async unblockIP(ip: string) {
|
2026-02-19 17:23:43 +00:00
|
|
|
// SmartProxy manages IP blocking — not yet exposed via API
|
|
|
|
|
alert(`Unblocking IP ${ip} is not yet supported from the UI.`);
|
feat: Add operations view components for logs, overview, security, and stats
- Implemented `ops-view-logs` for displaying and filtering logs with streaming capabilities.
- Created `ops-view-overview` to show server, email, DNS statistics, and charts.
- Developed `ops-view-security` for monitoring security metrics, blocked IPs, and authentication attempts.
- Added `ops-view-stats` to present comprehensive statistics on server, email, DNS, and security metrics.
- Introduced shared styles and components including `ops-sectionheading` for consistent UI.
2025-06-08 12:03:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private async saveEmailSecuritySettings() {
|
2026-02-19 17:23:43 +00:00
|
|
|
// Config is read-only from the UI for now
|
|
|
|
|
alert('Email security settings are read-only. Update the dcrouter configuration file to change these settings.');
|
feat: Add operations view components for logs, overview, security, and stats
- Implemented `ops-view-logs` for displaying and filtering logs with streaming capabilities.
- Created `ops-view-overview` to show server, email, DNS statistics, and charts.
- Developed `ops-view-security` for monitoring security metrics, blocked IPs, and authentication attempts.
- Added `ops-view-stats` to present comprehensive statistics on server, email, DNS, and security metrics.
- Introduced shared styles and components including `ops-sectionheading` for consistent UI.
2025-06-08 12:03:17 +00:00
|
|
|
}
|
|
|
|
|
}
|