EST. 2026 — Notes from real server work SYSADMIN · SECURITY · AI · DIRECTADMIN Issue 01
THE SYSADMIN ALMANAC
Home / Tags / Security
Security

#Security

41 articles
Security
Build APM on Windows, Part 3: Apache httpd 2.4.69 with CMake
Web

Build APM on Windows, Part 3: Apache httpd 2.4.69 with CMake

Build APR, APR-util, httpd 2.4.69 and mod_fcgid with CMake and Ninja on Windows. Explain why each option is set, use dumpbin to find the DLLs needed beside httpd.exe, prevent links to debug DLLs, and test the config with httpd -t.

#apache#windows#web-server#cpp
14 min read·22 Oct
Build APM on Windows, Part 2: Fetch Source and Libs with vcpkg
Web

Build APM on Windows, Part 2: Fetch Source and Libs with vcpkg

Steps 1 and 2 of building Apache yourself on Windows. Read 00-fetch.ps1 and 10-deps-vcpkg.ps1 line by line, verify the sha256 of every source archive, then have vcpkg build OpenSSL 3.5 LTS and 8 other libs from source, with commands to check the results at every step.

#devops#windows#apache#powershell
14 min read·22 Oct
Two Critical PHP RCE Flaws (php2shell): Patch Today
Security

Two Critical PHP RCE Flaws (php2shell): Patch Today

CVE-2026-109618 and CVE-2026-109619 are PHP RCE vulnerabilities with a CVSS score of 9.2 and public exploits already available. They affect every machine using PHP to handle web requests. The patched versions are 8.5.12, 8.4.27, 8.3.36, and 8.2.35. This note covers version checks, updates on Debian, RHEL, DirectAdmin, Docker, and Windows, and temporary settings while waiting for patches.

#cve#php#security#rce
10 min read·22 Oct
Scripting Government PDF Forms and Making Safer ID Copies
AI

Scripting Government PDF Forms and Making Safer ID Copies

Government PDFs distributed as fillable forms often cannot actually handle Thai text. Subdivided fields let digits run over the borders, and tone marks collide with vowels above the line. This article covers listing field names first, filling the fields and flattening them into page content, drawing Thai text with a font that includes all the vowel marks, and making actual-size ID copies with purpose-specific watermarks.

#pdf#python#document#printing
10 min read·22 Oct
Reading ID Cards from the Web with a Localhost Agent
Hardware

Reading ID Cards from the Web with a Localhost Agent

Browsers cannot access smart card readers directly. A workable approach is to write a small agent that opens a port on localhost and let the web page call it. This article covers secure contexts, CORS preflight, port conflicts with other agents, PC/SC in SHARED mode, decoding TIS-620 manually, and the day antivirus flagged the program as a backdoor.

#hardware#cpp#windows#gui
11 min read·16 Oct
Cannot Delete Faces from a Terminal: API Returns notSupport
Hardware

Cannot Delete Faces from a Terminal: API Returns notSupport

The door's face recognition terminal advertises a command to delete faces from FDLib, but every variation I tried returned notSupport. People who had left could still scan their faces and get in. This article covers the dead ends, the approach that actually worked using UserInfo/Modify with the smallest possible body, and the two-way user registry sync that runs every night.

#hikvision#isapi#hardware#python
10 min read·15 Oct
Ingesting Mail Without Disrupting Someone Else's Mailbox
Linux

Ingesting Mail Without Disrupting Someone Else's Mailbox

The mailbox the app fetches from is one people actually use every day — fetching with UNSEEN silently misses mail when the owner reads it on their phone before cron runs. The right approach is UID SEARCH paired with UIDVALIDITY and BODY.PEEK, with deduplication handled on our side.

#mail#imap#pop3#dovecot
10 min read·13 Oct
Let AI Read Documents, but Let Code Do the Math
AI

Let AI Read Documents, but Let Code Do the Math

The controller requires manually entered values to fall between 0 and 100, but the path where AI reads values from documents and feeds them in only checks whether they are numeric. A single negative value inflated the result to 5.25 times what it should have been without an error — a lesson in treating AI output as untrusted input, just like values entered by people.

#ai#llm#claude#claude-code
10 min read·12 Oct
Secrets Set to 600, but 0644 Logs Go Offsite Every Night
Security

Secrets Set to 600, but 0644 Logs Go Offsite Every Night

The .env is encrypted and permissions are locked down on every secret file, but customer data still leaks off the machine every night through something nobody classifies as confidential: logs that every account on the machine can read, bundled into backups uploaded to object storage. Here is how I stop it at the source by logging only result codes.

#security#logging#backup#offsite
10 min read·10 Oct
Egress Firewall Breaks Domain Checks — Tests as root Pass
Security

Egress Firewall Breaks Domain Checks — Tests as root Pass

The domain order page reported every name as unavailable, even names I made up. The cause was an outbound DROP policy with port 43 missing from the allowed port list after an operating system migration. The trap was that tests as root passed every time. Testing must use the account that actually runs the app.

#firewall#csf#security#networking
9 min read·10 Oct
Web vs. Worker — mkdir 0700 Disables Inherited ACL Permissions
Linux

Web vs. Worker — mkdir 0700 Disables Inherited ACL Permissions

One app runs as two users, with php-fpm handling web requests and a separate account running the queue. Even with default ACLs fully configured, they still cannot write to each other's directories. The cause is mkdir with mode 0700, which sets a mask that wipes out the effective ACL permissions, plus a deletion trap that requires permissions on the directory, not the file.

#linux#permissions#posix-acl#php-fpm
9 min read·9 Oct
tinker Sends Mail but the Web Can't — proc_open Disabled in FPM
DirectAdmin

tinker Sends Mail but the Web Can't — proc_open Disabled in FPM

Sending mail from tinker works perfectly, but submitting the actual form sends nothing, and the mail log has no entries — because CLI and PHP-FPM are not the same PHP environment. Includes a working SMTP AUTH configuration for DirectAdmin hosting and the From rule you must get right.

#mail#smtp#laravel#php
9 min read·8 Oct
Mailbox Compromised or Just Password Guessing? Prove It First
Security

Mailbox Compromised or Just Password Guessing? Prove It First

Telling a customer their account has been compromised is an allegation that needs decisive evidence first. This article covers what counts as decisive evidence, two cases with opposite outcomes, and the case I nearly reported incorrectly.

#mail#mail-forensics#exim#forensics
11 min read·4 Oct
A Single-Page PHP and SQLite Document Vault That Keeps Originals
Linux

A Single-Page PHP and SQLite Document Vault That Keeps Originals

A document photo storage app for government submissions, using photos taken on site with a phone. Each upload produces three files—the display image, the original, and saved crop settings—so adjustments can be made later without losing quality, with automatic migration from JSON to SQLite and web server restrictions on folders containing personal data.

#php#sqlite#document#security
9 min read·27 Sep
Sending Automated Job Files to Telegram and the Bot API's 50 MB Limit
Linux

Sending Automated Job Files to Telegram and the Bot API's 50 MB Limit

Set up a small local service that takes files from scripts and sends them to me on Telegram, with outbound delivery only, no polling, and no incoming commands, along with the actual Bot API limits to know before writing it, including 50 MB per file, images over 10 MB that must be sent as documents, and the Thai text trap in curl on Windows.

#telegram#bot#automation#python
8 min read·24 Sep
Encrypt Secrets in .env and Decrypt Them When Config Loads
Security

Encrypt Secrets in .env and Decrypt Them When Config Loads

How to store passwords and API keys as ciphertext in Laravel's .env and have config decrypt them on load, using a single helper that detects encrypted values, plus the APP_KEY mismatch across environments that can bring everything down if you get it wrong.

#laravel#php#security#encryption
9 min read·18 Aug
Laravel Behind a Proxy Sees 127.0.0.1 — Silent Form, No Error
DirectAdmin

Laravel Behind a Proxy Sees 127.0.0.1 — Silent Form, No Error

A contact form on DirectAdmin says the sender is not human, sends no mail, and leaves every log silent — the cause is Laravel behind nginx-to-apache seeing $request->ip() as 127.0.0.1, failing the bot check and returning before the mail is sent, with an explanation of why TrustProxies must not use '*'

#laravel#php#nginx#php-fpm
9 min read·16 Aug
WAF Returns 406 for Thai Text in POST: Fixing It Without Root
Security

WAF Returns 406 for Thai Text in POST: Fixing It Without Root

ModSecurity on the host returns 406 for certain Thai sentences in the POST body, preventing forms from saving — but as a hosting tenant, I cannot change the rules myself. This article shows how to isolate the offending text through black-box testing, then work around it with JS encoding on submit + middleware decoding in Laravel.

#modsecurity#waf#laravel#php
9 min read·15 Aug
My Firewall Permanently Banned Googlebot and Hid Sites from Search
Security

My Firewall Permanently Banned Googlebot and Hid Sites from Search

I investigated why sites disappeared from search results and found Googlebot in my own firewall's permanent ban list. 408 of 500 entries came from the counter tallying WAF false positives. How I lifted the bans, wrote a script to fetch official bot IP ranges into the ignore list daily, and dealt with a grep trap and the side effects of blocking entire countries.

#csf#firewall#seo#googlebot
10 min read·14 Aug
AI Crawler Overloads ?add-to-cart= — Block It Without Hurting SEO
Security

AI Crawler Overloads ?add-to-cart= — Block It Without Hurting SEO

Server load triggered an email alert. The logs showed that 84% of the day's traffic came from one AI crawler following add-to-cart links for every product. I added layers of protection with robots.txt, rel=nofollow and nginx limit_req while keeping all product pages indexable.

#nginx#security#wordpress#seo
10 min read·12 Aug
Factory to Cloud Behind NAT: Push Snapshots and a Command Queue
Network

Factory to Cloud Behind NAT: Push Snapshots and a Command Queue

The production machine sits in a LAN behind NAT with no public IP, but the owner wants to view data on a cloud website and make edits from a phone that reach the internal machine — possible without opening ports or setting up a VPN, using push snapshots + an edit command queue + idempotent acks

#automation#networking#nat#api
10 min read·9 Aug
Stolen Mailbox Password Sent 1,786 Spam Emails Unseen by CSF/LFD
Security

Stolen Mailbox Password Sent 1,786 Spam Emails Unseen by CSF/LFD

A real case of a stolen mailbox password used to send 50-75 spam emails a day, below a limit of 200, for 4 straight weeks without a single response from CSF/LFD/BFM because they only count failed authentication attempts, with the decisive question of whether an account was compromised or merely under attack, exim forensic commands, and a blocklist removal playbook

#mail#exim#security#csf
11 min read·7 Aug
MDES 2564 Government CCTV Price Limits and a Hikvision PoE BOM
Network

MDES 2564 Government CCTV Price Limits and a Hikvision PoE BOM

Read the full MDES June 2564 government CCTV reference pricing and basic specifications before setting a budget, then design a Hikvision IP/PoE BOM that meets the minimum specifications, reference price ceilings, 30-day recording retention rule, and requirement to allow at least 3 brands to compete.

#cctv#hikvision#networking#monitoring
10 min read·21 Jul
Network-as-code on MikroTik RouterOS
Network

Network-as-code on MikroTik RouterOS

A network-as-code approach for MikroTik — save /export output as a file, strip secrets with a sanitize script before sharing, split it into sections, then generate configs for multiple sites from Jinja2 templates + one set of variables

#mikrotik#routeros#networking#automation
9 min read·19 Jul
Auditing a Deployed Laravel Site — 3 Layers in Priority Order
Security

Auditing a Deployed Laravel Site — 3 Layers in Priority Order

After deploying Laravel to production, check security in 3 layers — probe externally for exposed endpoints, check files/permissions on the server, then grep for vulnerabilities in the code. This article provides commands and P0-P2 priorities for deciding what to fix first.

#security#hardening#php-fpm#cloudflare
8 min read·17 Jul
Mail Stopped After Moving to Cloudflare — Proxied Mail Records
Network

Mail Stopped After Moving to Cloudflare — Proxied Mail Records

After adding a domain to Cloudflare and pointing DNS at the host, incoming mail suddenly stops — the most common cause I see is leaving mail/smtp/pop records proxied (orange cloud), even though Cloudflare's proxy only handles HTTP/S. This article covers which records must be grey + token/SSL pitfalls.

#cloudflare#dns#mail#security
7 min read·17 Jul
nginx heap overflow spans 15 years—version checks aren't enough
Security

nginx heap overflow spans 15 years—version checks aren't enough

CVE-2026-42533 affects nginx versions 0.9.6 through 1.31.2, spanning 15 years, but actual exposure depends on the config, not the version. The problem is that news reports describe narrower conditions than the real ones. Checking against those reports can return "safe" even when the config still meets the conditions.

#security#nginx#cve#vulnerability
9 min read·16 Jul
Writing Scripts on Windows for Linux — Two File Cleanup Traps
Linux

Writing Scripts on Windows for Linux — Two File Cleanup Traps

Writing helper scripts on Windows and using scp to run them on Linux is routine work, but two things keep catching me out — d:\ paths embedded in scripts turn into strange filenames in /tmp that trigger the file monitor, and token/payload files get left behind on the server. This article lays out my rules for avoiding these mistakes.

#automation#windows#linux#sysadmin
6 min read·16 Jul
Read-only Debian shared-host security audit — avoid banning yourself
Security

Read-only Debian shared-host security audit — avoid banning yourself

Audit the security of a Debian server running DirectAdmin in read-only mode first — but the first trap is that scan traffic itself triggers CSF's brute-force rules and gets your own IP banned. This article lays out a safe audit sequence + areas to check in 2024-2026

#security#hardening#csf#cve
9 min read·16 Jul
libmodsecurity3 + nginx — only ctl:ruleEngine exclusions work
Security

libmodsecurity3 + nginx — only ctl:ruleEngine exclusions work

ModSecurity v3 (libmodsecurity3) + nginx + OWASP CRS — the ctl:ruleRemoveById taught in the guides does nothing and fails silently. This article covers what I found after trying every approach: ctl:ruleEngine works, scoped with a Host+URI chained rule, and the exclusion file must load before CRS.

#modsecurity#nginx#security#firewall
9 min read·10 Jul
Mail Checks Ban the Whole Office—Fixing It with Login Auto-Whitelist
Security

Mail Checks Ban the Whole Office—Fixing It with Login Auto-Whitelist

Real mail clients behave exactly like bots — office machines keep retrying old passwords until CSF bans the whole office. This article covers an auto-whitelist system that watches for successful logins + Thai GeoIP, then grants a temporary allow for 24 hours, along with 5 pitfalls I learned the hard way.

#csf#firewall#mail#exim
9 min read·10 Jul
LAN Access for a Team of 7 Without Open Ports: Cloudflare Zero Trust
Network

LAN Access for a Team of 7 Without Open Ports: Cloudflare Zero Trust

A team of 7 needs RDP access to machines on the LAN without opening any ports to the internet — the Cloudflare Zero Trust architecture (WARP + cloudflared), with 3 lessons from implementation: a forgotten IdP setup, Gateway defaults that allow everything, and the default-deny rule people forget most often

#cloudflare#zero-trust#vpn#remote-access
10 min read·9 Jul
AdSense Says ads.txt Is Missing: Tracing the Logs Layer by Layer
Network

AdSense Says ads.txt Is Missing: Tracing the Logs Layer by Layer

The AdSense Sites page reports ads.txt as "Not found" even though the file exists and is correct — a forensic investigation using curl + access logs to prove, layer by layer, whether Googlebot visited and what it received. Case closed: nothing was blocking it; Google's own status was stale.

#adsense#nginx#cloudflare#logging
9 min read·8 Jul
Lost the .com: Move to .net on DirectAdmin Without Data Loss
DirectAdmin

Lost the .com: Move to .net on DirectAdmin Without Data Loss

A .com domain expired and ended up with a domain squatter — how I moved the whole site (files/mail/DNS/SSL) to a new .net domain on DirectAdmin with a single CMD_CHANGE_DOMAIN command, plus 4 follow-up tasks that do not happen automatically

#directadmin#dns#ssl#letsencrypt
9 min read·6 Jul
Managing Linux Servers Safely with AI over SSH
AI

Managing Linux Servers Safely with AI over SSH

How I actually use Claude to audit and fix Linux server security over SSH, from preparing my machine and storing secrets to hard rules before touching production

#claude-code#ssh#ssh-hardening#security
13 min read·12 Jun
Auto-Unblock the Office in CSF with a Geo+Account Gate
Security

Auto-Unblock the Office in CSF with a Geo+Account Gate

A real case of a client office whose IP changes daily, with a ghost device using an old password that repeatedly gets the whole office blocked by CSF. How I automated unblocking with a narrow account+geo gate that lets the real office through while keeping foreign credential attacks blocked.

#csf#firewall#brute-force#geoip
12 min read·4 Jun
A Telegram Bot for DA Server Monitoring with a Small Blast Radius
Network

A Telegram Bot for DA Server Monitoring with a Small Blast Radius

A guide to setting up a Telegram bot as a lightweight control surface for monitoring a DirectAdmin server — read-only commands plus IP blocking/unblocking only, with no open ports, no added services, and a blast radius limited by least privilege at every layer

#telegram#bot#monitoring#alerting
13 min read·1 Jun
Tuning ModSecurity on DirectAdmin for Shared Hosting
Security

Tuning ModSecurity on DirectAdmin for Shared Hosting

The 4 additions I made beyond DA defaults — exclusions before CRS, a 1-hit credscan ban, a fix for the incorrect MODSEC_LOG path shipped by DA, and a self-heal cron to recover from rebuild overwrites

#modsecurity#csf#directadmin#custombuild
11 min read·20 May
DA Migration Finale — Security Fixes and Hardening After Stabilizing
Security

DA Migration Finale — Security Fixes and Hardening After Stabilizing

Wrapping up the cross-distro DirectAdmin migration series with security work after the server stabilized — sudoers wildcard CVE, OpenSSL SECLEVEL, ModSec exclusions before CRS, a csfpost drop-in, and 5 layers that survive DA updates

#security#hardening#directadmin#modsecurity
12 min read·20 May
CSF Auto-Unblock for Ghost Devices Amid Botnet Brute Force
Security

CSF Auto-Unblock for Ghost Devices Amid Botnet Brute Force

A real case on a DA shared host where a ghost device in an office got the entire office blocked by CSF every morning. I explain a 4-layer auto-unblock setup that distinguishes office devices from a botnet without accidentally unblocking attackers.

#csf#firewall#brute-force#security
11 min read·20 May
OpenClaw vs. VSCode + AI Agent: Which Should You Use?
AI

OpenClaw vs. VSCode + AI Agent: Which Should You Use?

Comparing two approaches that turn AI from a chatbot into an assistant that gets work done — a chat-app gateway like OpenClaw and an editor-based setup like VSCode + AI Agent, covering workflows, token costs, and security basics for beginners.

#ai#openclaw#vscode#claude-code
14 min read·19 Feb