Files
Security-Reports/lynis/templates/report.html.j2
Eduardo David Paredes Vara a651474dac lynis report mail pdf html base
2025-12-05 00:35:56 +00:00

406 lines
9.5 KiB
Django/Jinja

<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="utf-8">
<title>Informe Lynis - {{ hostname }} - {{ now_str }}</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
padding: 30px 20px;
color: #333;
}
.container {
max-width: 1200px;
margin: 0 auto;
background: white;
border-radius: 20px;
box-shadow: 0 20px 60px rgba(0,0,0,0.3);
overflow: hidden;
}
.header {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 30px;
text-align: center;
}
.header h1 {
font-size: 36px;
font-weight: 700;
margin-bottom: 12px;
text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}
.header .subtitle {
font-size: 16px;
opacity: 0.95;
}
.header .subtitle strong {
font-weight: 600;
border-bottom: 2px solid rgba(255,255,255,0.4);
}
.content {
padding: 30px;
}
.summary-grid {
width: 100%;
border-collapse: separate;
border-spacing: 20px 0;
margin-bottom: 35px;
}
.summary-grid td {
width: 33.333%;
vertical-align: top;
}
.card {
background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
border-radius: 12px;
padding: 20px;
box-shadow: 0 6px 15px rgba(0,0,0,0.1);
transition: transform 0.3s ease, box-shadow 0.3s ease;
border: 3px solid transparent;
min-height: 140px;
}
.card:hover {
transform: translateY(-5px);
box-shadow: 0 12px 30px rgba(0,0,0,0.15);
}
.card.good {
border-color: #10b981;
background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
}
.card.medium {
border-color: #f59e0b;
background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
}
.card.bad {
border-color: #ef4444;
background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
}
.card-title {
font-size: 12px;
text-transform: uppercase;
letter-spacing: 1.2px;
color: #666;
margin-bottom: 12px;
font-weight: 600;
display: block;
}
.card-value {
font-size: 36px;
font-weight: 700;
color: #2d3748;
margin-bottom: 8px;
display: block;
line-height: 1.1;
}
.card-sub {
font-size: 13px;
color: #718096;
line-height: 1.6;
margin-top: 10px;
}
.card-sub div {
margin: 4px 0;
display: flex;
align-items: center;
gap: 6px;
}
.section {
margin-top: 50px;
}
.section-header {
display: flex;
align-items: center;
margin-bottom: 25px;
padding-bottom: 15px;
border-bottom: 3px solid #e2e8f0;
}
.section-header h2 {
font-size: 28px;
font-weight: 700;
color: #2d3748;
margin-right: 15px;
}
.section-header .badge {
background: #667eea;
color: white;
padding: 5px 15px;
border-radius: 20px;
font-size: 14px;
font-weight: 600;
}
.section-description {
color: #718096;
margin-bottom: 20px;
font-size: 15px;
}
ul.warnings-list,
ul.suggestions-list {
list-style: none;
}
ul.warnings-list li,
ul.suggestions-list li {
margin-bottom: 20px;
background: #f8fafc;
border-radius: 12px;
padding: 20px;
border-left: 5px solid;
box-shadow: 0 2px 8px rgba(0,0,0,0.05);
transition: transform 0.2s ease, box-shadow 0.2s ease;
}
ul.warnings-list li:hover,
ul.suggestions-list li:hover {
transform: translateX(5px);
box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
ul.warnings-list li {
border-left-color: #f97316;
background: linear-gradient(to right, #fff7ed 0%, #f8fafc 100%);
}
ul.suggestions-list li {
border-left-color: #3b82f6;
background: linear-gradient(to right, #eff6ff 0%, #f8fafc 100%);
}
.entry-body {
font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
font-size: 14px;
color: #374151;
line-height: 1.8;
}
.entry-body a {
color: #3b82f6;
text-decoration: none;
font-weight: 500;
border-bottom: 1px solid transparent;
transition: border-color 0.2s ease;
}
.entry-body a:hover {
border-bottom-color: #3b82f6;
}
details.raw {
margin-top: 30px;
border-radius: 12px;
border: 2px solid #e2e8f0;
background: #f8fafc;
overflow: hidden;
}
details.raw > summary {
cursor: pointer;
padding: 20px;
font-size: 16px;
font-weight: 600;
color: #2d3748;
background: #f1f5f9;
transition: background 0.2s ease;
}
details.raw > summary:hover {
background: #e2e8f0;
}
details.raw[open] > summary {
border-bottom: 2px solid #e2e8f0;
}
pre.raw-output {
padding: 25px;
white-space: pre-wrap;
word-wrap: break-word;
font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
font-size: 13px;
line-height: 1.6;
background: #ffffff;
color: #1f2937;
max-height: 600px;
overflow-y: auto;
}
.footer {
background: #f8fafc;
padding: 30px;
text-align: center;
color: #718096;
font-size: 14px;
border-top: 2px solid #e2e8f0;
}
.no-data {
text-align: center;
padding: 40px;
color: #9ca3af;
font-style: italic;
}
@media screen and (max-width: 900px) {
.summary-grid td {
display: block;
width: 100% !important;
}
.summary-grid {
border-spacing: 0;
}
.summary-grid td {
padding-bottom: 20px;
}
}
@media print {
body {
background: white;
padding: 0;
}
.container {
box-shadow: none;
border-radius: 0;
}
.card:hover,
ul.warnings-list li:hover,
ul.suggestions-list li:hover {
transform: none;
}
details.raw {
page-break-inside: avoid;
}
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1>🔒 Lynis Security Report</h1>
<div class="subtitle">
Host: <strong>{{ hostname }}</strong> · Generated: {{ now_str }}
</div>
</div>
<div class="content">
<table class="summary-grid">
<tr>
<td>
<div class="card {{ hi_class }}">
<div class="card-title">Hardening Index</div>
<div class="card-value">{{ hardening_index }}</div>
<div class="card-sub">Out of 100 points</div>
</div>
</td>
<td>
<div class="card">
<div class="card-title">Test Results</div>
<div class="card-value">{{ tests_performed }}</div>
<div class="card-sub">
<div><span>⚠️</span> <span>{{ warnings_count }} Warnings</span></div>
<div><span>💡</span> <span>{{ suggestions_count }} Suggestions</span></div>
</div>
</div>
</td>
<td>
<div class="card">
<div class="card-title">Security Components</div>
<div class="card-value" style="font-size: 20px;">System Status</div>
<div class="card-sub">
<div><span>🔥</span> <span>Firewall {{ firewall_icon }}</span></div>
<div><span>🛡️</span> <span>IDS/IPS {{ ids_icon }}</span></div>
<div><span>🦠</span> <span>Malware {{ malware_icon }}</span></div>
</div>
</div>
</td>
</tr>
</table>
<div class="section">
<div class="section-header">
<h2>⚠️ Warnings</h2>
<span class="badge">{{ warnings_count }}</span>
</div>
<div class="section-description">
Critical security issues that require immediate attention.
</div>
<ul class="warnings-list">
{% if warning_entries %}
{% for w in warning_entries %}
<li>
<div class="entry-body">{{ w | safe }}</div>
</li>
{% endfor %}
{% else %}
<li class="no-data">✅ No warnings detected - Great job!</li>
{% endif %}
</ul>
</div>
<div class="section">
<div class="section-header">
<h2>💡 Suggestions</h2>
<span class="badge">{{ suggestions_count }}</span>
</div>
<div class="section-description">
Recommendations to improve your system's security posture.
</div>
<ul class="suggestions-list">
{% if suggestion_entries %}
{% for s in suggestion_entries %}
<li>
<div class="entry-body">{{ s | safe }}</div>
</li>
{% endfor %}
{% else %}
<li class="no-data">✅ No suggestions - Your system is well configured!</li>
{% endif %}
</ul>
</div>
</div>
<div class="footer">
Generated by Lynis Security Audit Tool · Report created on {{ now_str }}
</div>
</div>
</body>
</html>