<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Process-Monitoring on K-Life Hack | Seoul Gastronomy &amp; Travel Guide</title><link>https://klifehack.com/en/tags/process-monitoring/</link><description>Recent content in Process-Monitoring on K-Life Hack | Seoul Gastronomy &amp; Travel Guide</description><generator>Hugo -- gohugo.io</generator><language>en</language><lastBuildDate>Sun, 24 May 2026 10:21:24 +0900</lastBuildDate><atom:link href="https://klifehack.com/en/tags/process-monitoring/index.xml" rel="self" type="application/rss+xml"/><item><title>Implementing Process Auditing and Log Forwarding Using auditd and rsyslog</title><link>https://klifehack.com/en/p/linux-process-audit-rsyslog-implementation/</link><pubDate>Sun, 24 May 2026 10:21:24 +0900</pubDate><guid>https://klifehack.com/en/p/linux-process-audit-rsyslog-implementation/</guid><description>&lt;h1 id="building-an-audit-log-management-infrastructure-in-linux-systems-secure-system-call-monitoring-and-external-forwarding-with-auditd-and-rsyslog"&gt;Building an Audit Log Management Infrastructure in Linux Systems: Secure System Call Monitoring and External Forwarding with auditd and rsyslog
&lt;/h1&gt;&lt;h2 id="1-challenges-and-background-in-auditing-and-log-management"&gt;1. Challenges and Background in Auditing and Log Management
&lt;/h2&gt;&lt;p&gt;In Linux systems, monitoring process execution states and system calls is fundamental to ensuring security. However, relying solely on standard application-level log output (such as syslog) introduces several serious challenges.&lt;/p&gt;
&lt;p&gt;⚠️ &lt;b&gt;Risk of Log Tampering:&lt;/b&gt; If an attacker gains root privileges, locally stored plaintext log files (such as /var/log/auth.log) can be easily cleared or tampered with.&lt;/p&gt;
&lt;p&gt;⚠️ &lt;b&gt;Lack of System Call-Level Visibility:&lt;/b&gt; Standard syslog relies on logs self-reported by applications, making it impossible to forcibly capture system calls (such as file modification or privilege escalation) executed directly by unauthorized binaries.&lt;/p&gt;
&lt;p&gt;To address these challenges, we define the implementation steps for an auditing infrastructure that combines auditd, which intercepts system calls at the kernel level, and rsyslog, which forwards logs externally over a highly reliable TCP connection.&lt;/p&gt;
&lt;h2 id="2-technology-selection-and-trade-offs"&gt;2. Technology Selection and Trade-offs
&lt;/h2&gt;&lt;p&gt;In the design of system auditing and log management, the following trade-offs were considered.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Comparison of syslog and auditd:&lt;/b&gt; syslog is suitable for recording application-layer events but cannot forcibly track process behavior. On the other hand, auditd captures system calls at the kernel boundary, preventing processes from taking evasive actions. However, depending on the rule configuration, a large volume of logs may be generated, creating a trade-off that strains disk I/O and storage capacity.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Comparison of UDP Forwarding and TCP Forwarding:&lt;/b&gt; In remote forwarding via rsyslog, UDP (@) is fast but carries a risk of packet loss. TCP (@@) is connection-oriented and performs retransmission control even during temporary network disconnections, so TCP is adopted for forwarding security audit logs.&lt;/p&gt;
&lt;h2 id="3-implementation-steps"&gt;3. Implementation Steps
&lt;/h2&gt;&lt;h3 id="31-installing-and-enabling-auditd"&gt;3.1 Installing and Enabling auditd
&lt;/h3&gt;&lt;p&gt;In a Debian/Ubuntu environment, run the following commands to install auditd and enable the service.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo apt-get update
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo apt-get install -y auditd audispd-plugins
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo systemctl enable --now auditd
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="32-defining-audit-rules"&gt;3.2 Defining Audit Rules
&lt;/h3&gt;&lt;p&gt;Add custom rules to /etc/audit/rules.d/audit.rules to monitor access to critical files and directories.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;-w /etc/shadow -p wa -k shadow_watch
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;-w /etc/sudoers -p wa -k sudoers_watch
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Reload the audit rules to apply the configuration.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo auigenrules --load
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="33-remote-tcp-forwarding-configuration-via-rsyslog"&gt;3.3 Remote TCP Forwarding Configuration via rsyslog
&lt;/h3&gt;&lt;p&gt;To prevent local log tampering, add a remote forwarding rule to /etc/rsyslog.conf (or a configuration file under /etc/rsyslog.d/).&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;*.* @@remote-log-server:514
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;After modifying the configuration, restart the rsyslog service.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo systemctl restart rsyslog
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="4-operational-verification-and-log-analysis-pipeline"&gt;4. Operational Verification and Log Analysis Pipeline
&lt;/h2&gt;&lt;h3 id="41-searching-audit-logs-ausearch"&gt;4.1 Searching Audit Logs (ausearch)
&lt;/h3&gt;&lt;p&gt;Search for events matching the defined key (shadow_watch) and display them with numeric values converted to a human-readable format.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo ausearch -k shadow_watch -i
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="42-detecting-deleted-executable-binaries"&gt;4.2 Detecting Deleted Executable Binaries
&lt;/h3&gt;&lt;p&gt;💡 Identify suspicious processes that are running in memory but have been deleted from the disk.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo ls -l /proc/*/exe | grep &lt;span style="color:#e6db74"&gt;&amp;#34;deleted&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="43-aggregating-ssh-brute-force-attacks"&gt;4.3 Aggregating SSH Brute-Force Attacks
&lt;/h3&gt;&lt;p&gt;Extract IP addresses with a high number of failed login attempts from /var/log/auth.log and sort them in descending order.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;grep &lt;span style="color:#e6db74"&gt;&amp;#34;Failed password&amp;#34;&lt;/span&gt; /var/log/auth.log | awk &lt;span style="color:#e6db74"&gt;&amp;#39;{print $(NF-3)}&amp;#39;&lt;/span&gt; | sort | uniq -c | sort -nr
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="5-deployment-benefits"&gt;5. Deployment Benefits
&lt;/h2&gt;&lt;p&gt;With the deployment of this configuration, the following benefits have been verified.&lt;/p&gt;
&lt;p&gt;💡 &lt;b&gt;Improved Audit Comprehensiveness:&lt;/b&gt; Modifications to /etc/shadow and /etc/sudoers are now reliably recorded at the kernel level along with the executing user ID (auid).&lt;/p&gt;
&lt;p&gt;💡 &lt;b&gt;Ensured Log Integrity:&lt;/b&gt; Thanks to rsyslog&amp;rsquo;s TCP forwarding configuration, even if local logs are cleared, the event history remains traceable on the remote log server.&lt;/p&gt;</description></item></channel></rss>