226 lines
7.2 KiB
HTML
226 lines
7.2 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self'; font-src 'self' data:; img-src 'self' data:; connect-src 'self'; base-uri 'self'; form-action 'self' https://defcon.social https://bsky.app;">
|
|
<meta http-equiv="X-Content-Type-Options" content="nosniff">
|
|
<link rel="stylesheet" href="../assets/css/style.css">
|
|
<link rel="icon" type="image/x-icon" href="../favicon.ico">
|
|
<script>
|
|
// Apply theme immediately to prevent flash
|
|
(function() {
|
|
const theme = localStorage.getItem('theme') ||
|
|
(window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light');
|
|
document.documentElement.setAttribute('data-theme', theme);
|
|
})();
|
|
</script>
|
|
<title>suricata Cheatsheet - Cheatsheets - Launch Pad</title>
|
|
</head>
|
|
<body>
|
|
<button class="theme-toggle" id="themeToggle" aria-label="Toggle dark mode">
|
|
<svg class="theme-icon theme-icon-moon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path></svg>
|
|
<svg class="theme-icon theme-icon-sun" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display: none;"><circle cx="12" cy="12" r="5"></circle><line x1="12" y1="1" x2="12" y2="3"></line><line x1="12" y1="21" x2="12" y2="23"></line><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line><line x1="1" y1="12" x2="3" y2="12"></line><line x1="21" y1="12" x2="23" y2="12"></line><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line></svg>
|
|
</button>
|
|
<br/><br/>
|
|
<div class="name">
|
|
__ _______________________ _________._________________________
|
|
\_ _____/ \______ \ / _ \ / _____/ / _____/ | | \_ _____/
|
|
| __) | _/ / /_\ \ / \ ___ / \ ___ | | | __)_
|
|
| \ | | \ / | \ \ \_\ \ \ \_\ \ | |___ | \
|
|
\___ / |____|_ / \____|__ / \______ / \______ / |_______ \ /_______ /
|
|
\/ \/ \/ \/ \/ \/ \/
|
|
</div>
|
|
<div class="blog-page-header">
|
|
<div class="blog-header-content">
|
|
<a href="/cheatsheets" class="back-link" title="Back to Cheatsheets">
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="42" height="42" viewBox="0 0 24 24" class="home-icon"><path fill="currentColor" d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"/></svg>
|
|
</a>
|
|
<h1 class="blog-page-title">suricata Cheatsheet</h1>
|
|
</div>
|
|
</div>
|
|
<div class="blog-post-container">
|
|
<div class="blog-posts-container" style="max-width: 900px; margin: 0 auto;">
|
|
<div class="blog-post">
|
|
<div class="blog-post-content">
|
|
<p><a href="index.html">← Back to cheatsheets</a></p>
|
|
<p><a href="../index.html">← Home</a></p>
|
|
<hr>
|
|
<p>Suricata is a high-performance network IDS, IPS, and network security monitoring engine. Multi-threaded, protocol-aware, and capable of real-time intrusion detection and prevention.</p>
|
|
<hr>
|
|
<h2>Basic Usage</h2>
|
|
<ul>
|
|
<li>suricata -c suricata.yaml -i eth0 - Run on interface</li>
|
|
</ul>
|
|
<ul>
|
|
<li>suricata -c suricata.yaml -r file.pcap - Analyze pcap</li>
|
|
</ul>
|
|
<ul>
|
|
<li>suricata -c suricata.yaml -T - Test configuration</li>
|
|
</ul>
|
|
<ul>
|
|
<li>suricata -c suricata.yaml -v - Verbose mode</li>
|
|
</ul>
|
|
<ul>
|
|
<li>suricata -c suricata.yaml -S rules.rules -i eth0 - Custom rules</li>
|
|
</ul>
|
|
<hr>
|
|
<h2>Options</h2>
|
|
<ul>
|
|
<li>-c config - Configuration file</li>
|
|
</ul>
|
|
<ul>
|
|
<li>-i interface - Network interface</li>
|
|
</ul>
|
|
<ul>
|
|
<li>-r file - Read from pcap file</li>
|
|
</ul>
|
|
<ul>
|
|
<li>-T - Test configuration</li>
|
|
</ul>
|
|
<ul>
|
|
<li>-v - Verbose output</li>
|
|
</ul>
|
|
<ul>
|
|
<li>-S file - Rules file</li>
|
|
</ul>
|
|
<ul>
|
|
<li>-l directory - Log directory</li>
|
|
</ul>
|
|
<ul>
|
|
<li>-D - Run as daemon</li>
|
|
</ul>
|
|
<ul>
|
|
<li>-u user - Run as user</li>
|
|
</ul>
|
|
<ul>
|
|
<li>-g group - Run as group</li>
|
|
</ul>
|
|
<hr>
|
|
<h2>Configuration</h2>
|
|
<ul>
|
|
<li>/etc/suricata/suricata.yaml - Main configuration</li>
|
|
</ul>
|
|
<ul>
|
|
<li>/etc/suricata/rules/ - Rules directory</li>
|
|
</ul>
|
|
<ul>
|
|
<li>/var/log/suricata/ - Log directory</li>
|
|
</ul>
|
|
<ul>
|
|
<li>/var/lib/suricata/ - Data directory</li>
|
|
</ul>
|
|
<hr>
|
|
<h2>Rule Management</h2>
|
|
<ul>
|
|
<li>suricata-update - Update rules</li>
|
|
</ul>
|
|
<ul>
|
|
<li>suricata-update list-sources - List rule sources</li>
|
|
</ul>
|
|
<ul>
|
|
<li>suricata-update enable-source et/open - Enable source</li>
|
|
</ul>
|
|
<ul>
|
|
<li>suricata-update update-sources - Update sources</li>
|
|
</ul>
|
|
<ul>
|
|
<li>suricata-update -f - Force update</li>
|
|
</ul>
|
|
<hr>
|
|
<h2>Log Files</h2>
|
|
<ul>
|
|
<li>/var/log/suricata/eve.json - JSON event log</li>
|
|
</ul>
|
|
<ul>
|
|
<li>/var/log/suricata/fast.log - Fast alert log</li>
|
|
</ul>
|
|
<ul>
|
|
<li>/var/log/suricata/stats.log - Statistics log</li>
|
|
</ul>
|
|
<ul>
|
|
<li>/var/log/suricata/http.log - HTTP log</li>
|
|
</ul>
|
|
<ul>
|
|
<li>/var/log/suricata/tls.log - TLS log</li>
|
|
</ul>
|
|
<hr>
|
|
<h2>Common Examples</h2>
|
|
<h3>Test Configuration</h3>
|
|
<pre><code>suricata -c /etc/suricata/suricata.yaml -T</code></pre>
|
|
<p>Validate configuration file.</p>
|
|
<h3>Run on Interface</h3>
|
|
<pre><code>suricata -c /etc/suricata/suricata.yaml -i eth0</code></pre>
|
|
<p>Start monitoring interface.</p>
|
|
<h3>Analyze PCAP</h3>
|
|
<pre><code>suricata -c /etc/suricata/suricata.yaml -r capture.pcap</code></pre>
|
|
<p>Analyze captured traffic.</p>
|
|
<h3>Update Rules</h3>
|
|
<pre><code>suricata-update</code></pre>
|
|
<p>Update detection rules.</p>
|
|
<h3>View Alerts</h3>
|
|
<pre><code>tail -f /var/log/suricata/fast.log</code></pre>
|
|
<p>Monitor alerts in real-time.</p>
|
|
<h3>JSON Events</h3>
|
|
<pre><code>jq '.alert' /var/log/suricata/eve.json</code></pre>
|
|
<p>Parse JSON event log.</p>
|
|
<h3>Service Management</h3>
|
|
<pre><code>systemctl start suricata
|
|
systemctl status suricata</code></pre>
|
|
<p>Manage as systemd service.</p>
|
|
<hr>
|
|
<h2>Rule Syntax</h2>
|
|
<ul>
|
|
<li>alert action protocol src port -> dst port (options) - Basic rule</li>
|
|
</ul>
|
|
<ul>
|
|
<li>msg - Alert message</li>
|
|
</ul>
|
|
<ul>
|
|
<li>sid - Signature ID</li>
|
|
</ul>
|
|
<ul>
|
|
<li>rev - Revision number</li>
|
|
</ul>
|
|
<ul>
|
|
<li>content - Pattern to match</li>
|
|
</ul>
|
|
<ul>
|
|
<li>pcre - Perl-compatible regex</li>
|
|
</ul>
|
|
<hr>
|
|
<h2>Tips</h2>
|
|
<ul>
|
|
<li>Always test configuration with -T before running</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Update rules regularly with suricata-update</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Monitor eve.json for comprehensive event data</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Use IPS mode for active blocking (requires proper setup)</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Configure log rotation for large deployments</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Fine-tune rules for your environment</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Monitor performance and adjust threads</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Essential for network security monitoring</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script async type="text/javascript" src="../blog/analytics.js"></script>
|
|
<script src="../theme.js"></script>
|
|
</body>
|
|
</html>
|
|
|