Blog – Jeffrey Pine Hein https://jphein.com Just plain helpful. Sat, 21 Nov 2026 04:02:28 +0000 en-US hourly 1 https://wordpress.org/?v=7.1.5 https://jphein.com/wp-content/uploads/2020/08/jphein-logo-cropped-100x100.png Blog – Jeffrey Pine Hein https://jphein.com 32 32 109828812 How my booking page got popped, and what I changed https://jphein.com/how-my-booking-page-got-popped/ https://jphein.com/how-my-booking-page-got-popped/#respond Sat, 21 Nov 2026 04:02:20 +0000 https://jphein.com/?p=12551 Short version: a booking page I run was compromised within a day of going live, through a known bug I had already been warned about. The attackers walked off with a password that could send and read my email. Here is how it happened, what they did with it, and what I changed so it doesn’t happen the same way twice.

The setup

On November 4 I put a self-hosted booking page online for my consulting work, in a hurry: someone had asked that morning to book a call with me that same day, and I wanted a page they could use before the day was out. It runs Cal.com, an open-source scheduling app, in a container I build myself for an ARM server in the cloud. Like most apps of its kind it needs a few secrets to work: a database password, signing keys, a Google OAuth client so it can put bookings on my calendar, and an SMTP login so it can email confirmations.

That last one is where I made the mistake that mattered. For the SMTP login I used a Gmail app password for my own address, as a stopgap: the plan was to swap it for a separate sending account, or a narrower credential, once the page was up and the booking was done. An app password is a full-strength credential: it sends mail as you, and it also reads mail as you over IMAP. A booking tool only needs to send. I gave it the whole mailbox, and “temporary” lasted exactly as long as it took someone to find it.

The bug

The image I built was based on Cal.com’s docker repository at its v5.9.10 tag. That tag pins the application as a git submodule, and the pinned commit was older than Cal.com’s own v5.9.10 release. The practical difference: my image shipped Next.js 15.5.4, which carries the vulnerable React Server Components code behind CVE-2025-55182, better known as React2Shell (Next.js tracks its own side of it as CVE-2025-66478). It is an unauthenticated remote code execution bug in App Router deployments: one crafted request and the attacker runs code inside your server. The fixed Next.js is 15.5.7; the built image’s package manifest said 15.5.4. It is on CISA’s Known Exploited Vulnerabilities list, and it is being mass-exploited by automated crews scanning the whole internet.

I did not get unlucky. I got scanned, like everyone else, and I was the one with the hole.

What they did

  • Nov 5, 00:12 UTC, about a day after go-live: a dropper landed in the container. It installed itself as a fake system service named kworkerd and pulled an encrypted payload from a command-and-control host.
  • Nov 6, 08:19 UTC: the app’s environment was dumped to a file. Database URL, signing keys, the Google OAuth client secret, and that Gmail app password.
  • Nov 6, 13:46 PST: an email titled “SMTP health check” went out from my own address to a throwaway mailbox. That is a credential checker: a script that logs in with a stolen password and mails itself proof that it works, so the credential can be sold or used later.

That “SMTP health check” sitting in my Sent folder was the tell. I was not looking for it; I noticed a message I had not written. About 30 hours passed between the recorded environment dump and the moment I pulled the page offline, and the exposure may have started earlier, when the container was first compromised.

Why my tooling didn’t save me

This is the part I most wanted to understand, because I have a nightly vulnerability scan across every container I run, and it did flag this. From the first night the booking page existed, the report had a row for CVE-2025-55182. Four things conspired to make that row invisible:

  1. The daily summary only called out findings that were new since the previous run. The React2Shell row was new exactly once, on a night when two malware false positives got the attention. After that it was part of “the standing count”.
  2. The summary folded every known-exploited bug into one number: “16 KEV on 10 containers”. An unauthenticated RCE on a public host read the same as a compression-library bug in a container with no network access, which I had consciously accepted while waiting for a vendor fix.
  3. Nobody, me included, triaged the findings one by one. “0 new” felt like “fine”.
  4. Neither the build nor the deploy checked anything. The image was pushed and started without a scan in the path.

A detector that fires once and then goes quiet is a detector you will learn to ignore. Mine was working exactly as designed, and the design was wrong.

Containment

Once the Sent mail was understood, the order was: take the page offline, cut the container from the network, block the command-and-control address at both the cloud host and my home router, snapshot the container for forensics, dump the database, then rotate. Every credential I identified in that environment was revoked or rotated: the Google OAuth client was deleted and replaced, the app password was revoked, the database and signing keys were regenerated, and the image was rebuilt with the patched Next.js and redeployed only after the rotation.

Then the longer tail: a new password and fresh recovery settings on the Google account, sign-out of every session, review of every account that can reset itself by emailing me, and a careful pass through the mailbox itself for anything that should not sit in a third party’s hands. Three people had booked through the page during those days; their names and email addresses were in the database the attackers could reach, and I am telling each of them directly.

What I still don’t know

Whether anyone actually read my mail. I have evidence of harvesting and of one SMTP test, which is itself a use of the credential; I cannot establish whether the mailbox was read beyond that. Google’s logs for this edition do not record app-password IMAP sign-ins. “I can’t find it” is not the same as “it did not happen”, so I am treating the whole window as if the mailbox was readable, because it was.

So I built an instrument: a deliberately vulnerable copy of the same booking app on a throwaway server, with a decoy mailbox and its own throwaway password, logging everything that touched it. Over four days of lure, five different toolkits stole the decoy mail password a combined 425 times. For 87 hours none of them logged in to the decoy mailbox or tried to send mail with it. I checked the instrument against itself: a test login of my own was recorded correctly, so that zero is a measured zero, not a blind one. Twenty minutes before I tore it down, one login from a network none of the earlier visitors had used authenticated over SMTP and sent nothing: a credential checker like the one that left a message in my own Sent folder, and evidence of checking, not of reading. It is a self-hosted decoy rather than a Gmail account, and none of it proves what happened to my own mailbox. What it shows is the shape of these kits: harvest, verify, move on. I am still treating my own window as exposed; I now have a reason, rather than a hope, to think it was not read.

What changed

  • Least privilege for mail. No personal credential goes into a service again. The booking page now sends through a send-only identity with nothing readable behind it, and its calendar access runs as a dedicated account, not mine.
  • A build gate. Every image is built once, scanned with a pinned, checksum-verified scanner, cross-checked against the CISA KEV feed, and fails closed if the scan is empty, partial, or stale. Only the scanned image gets pushed.
  • A deploy gate. The deploy scripts for my public hosts run that check again before starting a container.
  • Per-finding triage. The nightly report now puts every known-exploited bug in a bucket: fixable now, waiting on upstream, no fix yet, or accepted with an expiry date. Anything untriaged leads the report and turns the dashboard red until a human looks at it. Hosts that were never scanned say so instead of reading clean.
  • Watching Sent. A mail in my own Sent folder that I did not write is now treated as a security signal: a poll flags it for review within minutes instead of leaving it to be noticed by accident.

The lessons, in the order I would want someone else to hear them

  1. Never hand an app a credential that can do more than the app needs, not even for a day. “It’s just for sending email, and I’ll swap it out later” is exactly how a full mailbox walks out the door. The narrow credential takes ten minutes to make; make it first.
  2. A version tag on a packaging repository is not the version of the software inside it. Check what actually got built.
  3. A finding you have seen before is still a finding. Summaries that count instead of list will hide the one that matters.
  4. Put the scanner in the path, not beside it. A report nobody has to act on is a report nobody acts on.
  5. Know what your own account looks like from the outside. The thing that caught this was a human reading their Sent folder.
  6. A same-day ask is not a reason to skip the gate. The page went up in hours because one person wanted to book that afternoon; the gate I skipped would have taken minutes. A calendar link in an email would have served them just as well that day.

I run a lot of infrastructure for a one-person shop, and most of it is automated. The automation did its job here; it reported the bug. What was missing was the part that refuses to let a known-exploited hole sit on a public host for four days without a human saying “yes, I accept that”, and the part of me that would have waited an hour before putting something new on the internet for a stranger. Both exist now.

Update, November 12: the scanner was right again

Since I wrote the lessons above, my nightly scan, now running against the vulnerability corpus a security friend had recommended, flagged a kernel bug rated critical, with a fix out from Ubuntu. It saw the bug on every host and filed each one into the fix queue with a seven-day deadline. That is exactly what it was built to do, and it was the wrong behaviour for this bug: a critical flaw on a host with public ports got the same calm seven-day row as a low-risk library on a box nobody can reach, and a fixed kernel that was installed but not yet booted was not a finding at all. One public server sat two days with the fix on disk and the old kernel running.

So lesson three has a sharper form. Counting findings hides the one that matters; severity without exposure hides it too. The scanner now has to know which of my hosts face the internet, and a critical finding on one of those is an alarm that reaches me, not a row that waits its turn. A kernel update is not done until the fixed kernel is the one running. And I took one more piece of that friend’s advice: an adversarial reviewer now reads every infrastructure change as it is built, not after it is live.

Thanks to the security professional who read the first draft and told me, in so many words, that it should never have been deployed, and to two friends in the guild who had suggested parts of this before I needed them. They were right, and the gates above are their arguments turned into code.

]]>
https://jphein.com/how-my-booking-page-got-popped/feed/ 0 12551
How to Run a Modern Kernel on Ubuntu LTS with the HWE Stack https://jphein.com/how-to-run-a-modern-kernel-on-ubuntu-lts-with-the-hwe-stack/ https://jphein.com/how-to-run-a-modern-kernel-on-ubuntu-lts-with-the-hwe-stack/#respond Sun, 29 Mar 2026 18:11:12 +0000 https://jphein.com/?p=12277 If you’re running Ubuntu LTS and hitting hardware bugs — USB devices crashing, missing driver support, Wi-Fi not working — your first instinct might be to upgrade to the latest Ubuntu release. But there’s a better option that keeps the stability of LTS while giving you a much newer kernel: the HWE (Hardware Enablement) stack.

I run Ubuntu 24.04 LTS on my daily-driver workstation. It shipped with kernel 6.8. After upgrading to the HWE kernel (6.17), two USB bugs I’d been fighting for months — one cosmetic, one that required hard reboots — were fixed without changing anything else about my system.

What Is the HWE Kernel?

Every Ubuntu LTS release ships with a GA (General Availability) kernel — the version that was current when the release was finalized. For Ubuntu 24.04 LTS, that’s kernel 6.8. This kernel receives security patches for the full 5-year LTS lifecycle, but it doesn’t get new features, new drivers, or improvements to existing subsystems.

The HWE kernel is a newer kernel backported from a later Ubuntu release, packaged and tested for your LTS version. Canonical rolls these out roughly every 6 months, following each interim Ubuntu release. You get:

  • New and updated hardware drivers
  • Kernel subsystem improvements (USB, GPU, networking, storage)
  • Bug fixes that haven’t been backported to the GA kernel
  • The same LTS userspace — your libraries, init system, package repos, and everything else stays on 24.04

Think of it as upgrading the engine in your car without changing anything else. Same dashboard, same seats, same fuel system — just a newer engine that handles the road better.

How to Install It

One command:

sudo apt install linux-generic-hwe-24.04

Then reboot. That’s it. Verify with:

$ uname -r
6.17.0-19-generic

The GA kernel stays installed as a fallback — you can select it from the GRUB menu (“Advanced options for Ubuntu”) if the HWE kernel causes any issues. To go back permanently:

sudo apt install linux-generic
sudo apt remove linux-generic-hwe-24.04

What It Fixed for Me

I wrote about the full investigation in The USB Bug Trilogy. Here’s the short version of what the HWE kernel resolved.

Razer Kiyo Pro xHCI Death Spiral — Fixed

My Razer Kiyo Pro webcam (1532:0e05) had a firmware bug that would crash the entire xHCI USB host controller, disconnecting every USB device — keyboard, mouse, audio, everything. The only recovery was a hard reboot.

On kernel 6.8, a stress test crashed the controller consistently around round 25. I wrote three kernel patches and a userspace watchdog to work around it.

On kernel 6.17, the same stress test passes 50/50 rounds with 0ms delay — completely stock, no patches or workarounds applied. The kernel now does two things the older version didn’t:

  1. Automatic LPM disable — When the Kiyo responds slowly to Link Power Management transitions, the kernel dynamically disables U1 LPM instead of cascading to controller death: Hub-initiated U1 disabled due to long timeout 16800us
  2. Improved xHCI error recovery — Endpoint stalls no longer escalate into controller resets. The error is contained to the device.

The kernel is now doing at runtime what my USB_QUIRK_NO_LPM patch was trying to do statically — detecting that the device can’t handle LPM and disabling it automatically.

Phantom I/O Wait Counter Leak — Improved

A USB card reader (Genesys Logic 05e3:0751) was causing the kernel’s procs_blocked counter to leak during the boot-time async SCSI scan, making every monitoring tool report 40-60% iowait when there was actually zero disk I/O happening. On 6.8, the leaked count was 4-6. On 6.17, it dropped to 4 — partial improvement, but the bug is still present. I’ve filed it as Ubuntu bug #2146707.

When to Use HWE vs. GA

Use HWE when:

  • You have hardware that’s newer than your LTS release (bought a laptop or GPU after the release date)
  • You’re hitting driver bugs or missing hardware support
  • You need kernel subsystem improvements (USB, Bluetooth, Wi-Fi, GPU)
  • You’re running a desktop or workstation (Ubuntu Desktop installs HWE by default since 20.04)

Stick with GA when:

  • You’re running a production server where maximum stability matters more than hardware support
  • Your hardware works perfectly on the GA kernel
  • You rely on out-of-tree kernel modules (DKMS modules) that might not build against newer kernels
  • You’re in a regulated environment that requires a specific kernel version

Note: Ubuntu Desktop has shipped with the HWE kernel by default since 20.04. If you installed from the desktop ISO, you might already be on HWE. Check with dpkg -l | grep linux-generic-hwe.

HWE Lifecycle

The HWE kernel follows a rolling update model within the LTS lifecycle:

Ubuntu 24.04 LTSGA KernelHWE Kernel
Release (Apr 2024)6.86.8
24.04.1 (Aug 2024)6.86.8
24.04.2 (Feb 2025)6.86.11+
24.04.3 (Aug 2025)6.86.14+
24.04.4 (Feb 2026)6.86.17+

The GA kernel stays at 6.8 for the entire 5-year support period. The HWE kernel steps forward every ~6 months, pulling from the next interim release. Both receive security patches.

The Tradeoff

There’s always a tradeoff between newer kernels and stability. A newer kernel means newer code paths that have had less production exposure. In my case, the tradeoff was obvious — a kernel that crashes my entire USB bus on a stock webcam isn’t “stable” in any meaningful sense. The HWE kernel was strictly better.

But your situation might be different. If your hardware works fine on the GA kernel, there’s no reason to chase a newer one. The best kernel is the one that runs your hardware without problems.

For me, sudo apt install linux-generic-hwe-24.04 turned a webcam that required three kernel patches and a watchdog daemon into one that just works. Sometimes the fix really is that simple.

]]>
https://jphein.com/how-to-run-a-modern-kernel-on-ubuntu-lts-with-the-hwe-stack/feed/ 0 12277
The USB Bug Trilogy: Phantom I/O, Camera Crashes, and Kernel Accounting Lies https://jphein.com/the-usb-bug-trilogy-phantom-i-o-camera-crashes-and-kernel-accounting-lies/ https://jphein.com/the-usb-bug-trilogy-phantom-i-o-camera-crashes-and-kernel-accounting-lies/#respond Sun, 29 Mar 2026 13:59:54 +0000 https://jphein.com/the-usb-bug-trilogy-phantom-i-o-camera-crashes-and-kernel-accounting-lies/ I run a homelab with a dozen VLANs, 20+ monitored hosts, and a desktop workstation that doubles as my daily driver for development and gaming. Over the past few months I’ve hit four separate USB bugs on Linux that each took hours to diagnose — and they’re all related to how the Linux kernel handles USB devices. Here’s what happened, what I learned, and the fixes.

Bug 1: The Phantom I/O Wait — A USB Card Reader That Corrupts Kernel Accounting

I noticed my system was reporting 40-60% iowait in top and vmstat, with load averages spiking to 4-5 on an 8-core machine. My NVMe drive should be handling anything I throw at it. Something was wrong.

Running iotop showed zero actual disk I/O. Not a single byte being read or written. Yet the kernel insisted that processes were blocked waiting on I/O.

$ vmstat 1 3
procs -----------memory---------- ---swap-- -----io---- -system-- -------cpu-------
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 1  4      0 7810420 1361964 3957988    0    0     0     0  8303 23388 17  2 61 21  0
 0  4      0 7869484 1361964 3958112    0    0     0     0 12885 18690 13  3 50 35  0

The b=4 column means 4 processes in uninterruptible sleep (D state). But when I checked:

$ ps -eo pid,state,comm | awk '$2 == "D"'
(nothing)

Zero processes in D state. The kernel’s procs_blocked counter in /proc/stat was stuck at 4, permanently inflating the iowait percentage. Every monitoring tool that reads /proc/stat — top, vmstat, htop, Grafana node_exporter — was showing phantom I/O wait.

The Culprit

Initially I blamed a Genesys Logic USB card reader (05e3:0751) connected through a VIA Labs USB hub (a KVM-style switch with two upstream ports and a button to toggle between hosts). But after extensive testing, the leak turned out to have two sources: the USB card reader AND four empty AHCI/SATA ports (ata3-6) on the motherboard. Both go through the same boot-time async SCSI scan path, and both leak the nr_iowait counter.

During boot, each synchronous SCSI probe command goes through blk_execute_rq() → io_schedule_timeout(), which sets current->in_iowait = 1 and increments the kernel’s nr_iowait counter. The matching decrement is missed during the boot-time async scan — leaking one count per command. The counter is stuck until reboot.

Critically, unbinding and rebinding the USB card reader after boot triggers the exact same code path but does not leak — proving the bug is specific to the early boot async scanning environment, not the probe logic itself.

What I Tried

  • Kernel upgrade from 6.8 to 6.17 (Ubuntu HWE) — leaked count dropped from 4-6 to 4, partial improvement
  • Booting with an SD card inserted — still leaked
  • Booting without the USB hub — clean b=0, but the counter leaked as soon as I plugged the hub back in
  • usb-storage.quirks=05e3:0751:i — card reader properly ignored (confirmed in dmesg), but procs_blocked still 4 — the AHCI empty ports also leak
  • scsi_mod.scan=sync — no effect
  • usb-storage.quirks=05e3:0751:u (ignore UAS) — no effect, device doesn’t support UAS anyway
  • usb-storage.delay_use=10 — no effect, the delay just postpones the same buggy probe path
  • libata.force=3:disable,4:disable,5:disable,6:disable — dropped procs_blocked from 4 to 2, confirming AHCI ports as a leak source

Update: Root Cause Identified via ftrace

Using ftrace with stack traces, I traced the exact code path that leaks the counter. Every SCSI probe command goes through:

io_schedule_timeout
 ← __wait_for_common
  ← wait_for_completion_io_timeout
   ← blk_execute_rq
    ← scsi_execute_cmd
     ← scsi_probe_lun
      ← do_scan_async
       ← async_run_entry_fn

The io_schedule_timeout() call sets current->in_iowait = 1 and increments the kernel’s nr_iowait counter. During normal operation, the matching decrement happens when the IO completes. But during the boot-time async SCSI scan, the decrement is missed — leaking one count per probe command.

The critical evidence: unbinding and rebinding the USB card reader after boot triggers the exact same code path but does NOT leak the counter. This proves the bug is specific to the boot-time async scanning environment, not the probe logic itself.

Update: Two leak sources identified. Further testing revealed that ignoring the card reader (quirks=:i) still left procs_blocked=4 — the four empty AHCI/SATA ports on the motherboard also leak through the same async scan path. Adding libata.force=3:disable,4:disable,5:disable,6:disable dropped the count from 4 to 2, confirming two independent sources. Both the USB and AHCI SCSI probe paths share the same buggy boot-time io_schedule_timeout accounting.

I’ve filed this as Ubuntu bug #2146707 with full ftrace data and a suggested diagnostic kernel patch.

The Fix

There isn’t a clean one yet. The procs_blocked counter leak is a kernel bug that persists from at least 6.8 through 6.17. Your options are:

Option 1: Reduce the leak with kernel parameters:

# Edit /etc/default/grub, add to GRUB_CMDLINE_LINUX_DEFAULT:
#   usb-storage.quirks=05e3:0751:i        (ignores the card reader)
#   libata.force=3:disable,4:disable,...   (reduces AHCI leak)
# Then regenerate GRUB:
sudo update-grub

This won’t fully eliminate the leak (in my testing it dropped from 4 to 2), but it helps. Disabling unused SATA ports in BIOS may also help.

Option 2: Accept the cosmetic iowait — iotop is your source of truth for actual I/O activity. The phantom counter doesn’t affect real performance.

Bonus: Re-enabling the Card Reader On Demand

Since the warm reprobe (after boot) doesn’t leak the counter, you can safely enable the card reader when you need it. The usb-storage.quirks parameter is writable at runtime:

#!/bin/bash
# card-reader.sh — toggle Genesys Logic card reader on/off
# Boot uses quirks=:i to prevent the phantom iowait bug.
# Warm reprobe after boot is safe — does NOT leak the counter.

VENDOR="05e3"
PRODUCT="0751"

find_device() {
    for dev in /sys/bus/usb/devices/*; do
        [ "$(cat "$dev/idVendor" 2>/dev/null)" = "$VENDOR" ] &&
        [ "$(cat "$dev/idProduct" 2>/dev/null)" = "$PRODUCT" ] &&
        basename "$dev" && return 0
    done
    return 1
}

case "$1" in
    on)
        DEV=$(find_device) || { echo "Card reader not found"; exit 1; }
        # Clear the ignore quirk
        echo "${VENDOR}:${PRODUCT}:" | sudo tee /sys/module/usb_storage/parameters/quirks
        # Rebind the driver
        echo "${DEV}:1.0" | sudo tee /sys/bus/usb/drivers/usb-storage/bind
        echo "Card reader enabled"
        ;;
    off)
        DEV=$(find_device) || { echo "Card reader not found"; exit 1; }
        echo "${DEV}:1.0" | sudo tee /sys/bus/usb/drivers/usb-storage/unbind
        echo "${VENDOR}:${PRODUCT}:i" | sudo tee /sys/module/usb_storage/parameters/quirks
        echo "Card reader disabled"
        ;;
    *)  echo "Usage: $0 {on|off}" ;;
esac

How to Reproduce the ftrace Diagnosis

If you’re seeing phantom iowait and suspect a USB mass storage device, here’s how to trace it. As root:

# 1. Check for the phantom counter
grep procs_blocked /proc/stat      # nonzero?
ps -eo pid,state,comm | awk '$2 == "D"'  # no D-state processes?

# 2. Set up ftrace
cd /sys/kernel/debug/tracing
echo 0 > tracing_on
echo > trace
echo function > current_tracer
echo io_schedule >> set_ftrace_filter
echo io_schedule_timeout >> set_ftrace_filter
echo blk_execute_rq >> set_ftrace_filter
echo scsi_execute_cmd >> set_ftrace_filter
echo 1 > options/func_stack_trace
echo 1 > tracing_on

# 3. Trigger a reprobe of the suspect device
echo <interface> > /sys/bus/usb/drivers/usb-storage/unbind
sleep 3
echo <interface> > /sys/bus/usb/drivers/usb-storage/bind
sleep 5

# 4. Stop and check
echo 0 > tracing_on
grep procs_blocked /proc/stat      # did it increase?
cat trace > /tmp/scsi_trace.txt    # save for analysis

If procs_blocked increases after the reprobe, the trace will show you exactly which SCSI commands are leaking the counter. If it stays the same (as it did for me), that narrows the bug to the boot-time async scan path.

The lesson: If your Linux system shows high iowait but iotop shows zero disk activity, check for USB mass storage devices. The SCSI probe path can permanently corrupt the kernel’s I/O accounting during boot.

Bug 2: The Camera That Kills All USB — Razer Kiyo Pro xHCI Death Spiral

My Razer Kiyo Pro webcam (1532:0e05, firmware 8.21) has a much more dramatic failure mode: it can crash the entire xHCI host controller, disconnecting every USB device on the bus — keyboard, mouse, audio interface, everything. The only recovery is a hard reboot.

The failure has two independent triggers, and the kernel’s built-in error recovery makes both of them worse.

Trigger 1: Link Power Management Resume Failure

The Kiyo Pro fails to reinitialize after USB Link Power Management (LPM) transitions. When the kernel tries to wake the camera from a low-power state, it produces EPIPE (-32) errors on UVC SET_CUR operations. The stalled endpoint triggers an xHCI stop-endpoint timeout, and the kernel declares the entire controller dead.

Trigger 2: Rapid Control Transfer Overflow

Approximately 25 rapid consecutive UVC SET_CUR operations overwhelm the camera’s firmware. The standard UVC error-recovery query (GET_CUR after EPIPE) amplifies the failure by sending a second transfer to the already-stalling device. The kernel detects the fault, resets the controller, the reset triggers another fault, and the system enters a death spiral.

Testing confirmed that disabling LPM alone is insufficient — a stress test with NO_LPM active still caused delayed controller death 13 minutes later via TRB warning escalation.

Update: Partially Improved in Kernel 6.17, But Still Crashes

After installing the HWE (Hardware Enablement) kernel on Ubuntu 24.04 LTS (sudo apt install linux-generic-hwe-24.04), which brought me to 6.17.0-19-generic, I retested without any patches or workarounds applied.

Initially the v4l2-ctl stress test appeared to pass 50/50 rounds, but further testing revealed that udev workarounds (autosuspend disable, avoid_reset_quirk) were still active. With all workarounds removed, the stress test crashes at round 44 with repeated endpoint stalls. On 6.8, the same test crashed around round 25 — so 6.17 is slightly more resilient but still vulnerable.

However, starting a video call still triggers the full hc_died() cascade on 6.17. The crash path is different — it involves LPM transitions during isochronous stream setup rather than rapid control transfers:

usb 2-3.4: disable of device-initiated U1 failed.
usb 2-3.4: Failed to set U2 timeout to 0x0,error code -110
uvcvideo 2-3.4:1.1: usb_set_interface Failed to disable LPM
usb 2-3.4: Failed to query (SET_CUR) UVC control 11 on unit 3: -71 (exp. 1).
[errors escalate from -71 EPROTO to -110 ETIMEDOUT]
usb 2-3.4: 3:1: cannot set freq 48000 to ep 0x82
xhci_hcd 0000:00:14.0: xHCI host not responding to stop endpoint command
xhci_hcd 0000:00:14.0: xHCI host controller not responding, assume dead
xhci_hcd 0000:00:14.0: HC died; cleaning up

The trigger is the LPM U1/U2 transition when the kernel sets up the video stream. The kernel tries to disable LPM, that fails, the firmware locks up, and every subsequent transfer times out until the controller is declared dead. The kernel patches (especially USB_QUIRK_NO_LPM) are still needed to prevent this.

Workarounds for Older Kernels (6.8 and Earlier)

If you’re stuck on an older kernel, you’ll need multiple layers of defense:

  1. Kernel module quirk — snd-usb-audio quirk flags to skip sample rate readback and defer audio interface setup: options snd-usb-audio quirk_flags=0x4000001
  2. Kernel patches — Three patches submitted to [email protected]:
    • USB_QUIRK_NO_LPM for device 1532:0e05
    • A new UVC_QUIRK_CTRL_THROTTLE that rate-limits SET_CUR transfers (50ms minimum interval) and skips error-code queries after EPIPE
    • Razer Kiyo Pro device entry combining throttle, disable-autosuspend, and no-reset-resume quirks
  3. Udev rule — Sets avoid_reset_quirk=1 to prevent USB errors from cascading to the xHCI controller
  4. Userspace watchdog — A systemd service that monitors kernel logs for xHCI fatal errors and performs escalating recovery: rebind the port, then reset the controller, then reload the driver. If all three fail, it stops — no retry loops, no death spirals.

Quick Runtime Workaround (Older Kernels)

If you have a Razer Kiyo Pro on kernel 6.8 or earlier and just want it to stop crashing your USB bus:

# Disable LPM for the Kiyo at runtime
echo "1532:0e05:k" | sudo tee /sys/module/usbcore/parameters/quirks

# Make it permanent
echo 'options usbcore quirks=1532:0e05:k' | sudo tee /etc/modprobe.d/razer-kiyo-usb.conf
sudo update-initramfs -u

This only addresses the LPM trigger. Full protection on older kernels requires the CTRL_THROTTLE kernel patch. The best fix is upgrading to kernel 6.17 or later.

Bug 3: The Initial Discovery — Tracker Meets a Slow USB Drive

The investigation that led me down this rabbit hole started with a much simpler problem. I plugged in an old 128GB LITEON SATA SSD in a USB enclosure (Realtek RTL9201 bridge) to grab some files. Within minutes, my system ground to a halt — real iowait this time, 50-60%, with the NVMe feeling sluggish.

GNOME’s tracker-miner-fs-3 had automatically started indexing the drive. The old SSD contained a full Ubuntu installation — hundreds of thousands of files under /usr, /lib, /snap. Tracker was hammering it with random reads, and the slow SATA-over-USB interface was bottlenecking everything.

Killing tracker and unmounting the drive should have fixed it. But when I ran udisksctl unmount, the USB enclosure physically disconnected mid-cache-sync:

sd 6:0:0:0: [sdc] Synchronize Cache(10) failed: Result: hostbyte=DID_ERROR driverbyte=DRIVER_OK

This left 6 SCSI error handler threads stuck in uninterruptible sleep — and that’s when the phantom procs_blocked counter leak began. The threads eventually recovered, but the kernel’s accounting never decremented. This is the same class of bug as the card reader issue, just triggered through a different path (disconnect during cache flush vs. probe of removable media).

Bug 4: The Webcam Mic That Vanishes — Logitech StreamCam PipeWire Conflict

The Logitech StreamCam (046d:0893) is a USB 3.0 webcam that exposes both UVC video and UAC audio interfaces. On Ubuntu with Wayland and PipeWire, it mostly works — until you try to use it for streaming.

The Problem

After switching from X11 to Wayland with PipeWire (for screen capture in OBS), the StreamCam mic worked fine in veadotube. But the moment I added a PipeWire screen capture source in OBS, the mic stopped working in both OBS and veadotube. WirePlumber logged:

Failed to call Lookup: GDBus.Error:org.freedesktop.portal.Error.NotFound: No entry for camera

The issue is a conflict between PipeWire’s camera portal and the audio routing. When OBS requests screen capture through the PipeWire portal, WirePlumber’s session management interferes with the existing audio node connections to the StreamCam. The mic’s PipeWire node gets orphaned — it still exists, but no application can connect to it.

Additional Issues

The StreamCam also exposed two other quirks:

  • USB reset permission denied — usbreset "Logitech StreamCam" fails as a normal user. The fallback is toggling the sysfs authorized flag to force a re-enumeration: echo 0 > /sys/bus/usb/devices/*/authorized && echo 1 > /sys/bus/usb/devices/*/authorized
  • Wrong V4L2 node in OBS — The StreamCam exposes two video nodes: /dev/video0 (main capture) and /dev/video1 (metadata). OBS can pick the wrong one, resulting in no video. Always use /dev/video0.

The Fix

Restart the entire PipeWire stack to clear stale node connections:

# Restart PipeWire stack (fixes mic routing)
systemctl --user restart pipewire pipewire-pulse wireplumber

# If that doesn't work, reset the USB device first
pkexec usbreset "Logitech StreamCam"
sleep 1
systemctl --user restart pipewire pipewire-pulse wireplumber

I wrote a fix-mic.sh script that automates this: it tests if the mic is working, and if not, resets the USB device and restarts PipeWire. It runs automatically as part of my streaming startup script.

The Common Thread

All four bugs live in the space where USB hardware meets Linux’s kernel subsystems — SCSI, xHCI, UVC, UAC, and PipeWire. Each layer has its own error handling and recovery logic, and when a USB device misbehaves, these layers can interact in unexpected ways.

The specific issues:

  • SCSI probe accounting — The scheduler’s iowait counter can be permanently corrupted during boot-time async SCSI scanning — affects both USB mass storage and AHCI/SATA devices (bug #2146707)
  • xHCI error recovery — The kernel’s “fix it by resetting everything” approach can create death spirals with devices that have buggy firmware
  • USB disconnect handling — Cache sync operations on devices that physically disappear leave orphaned kernel accounting state
  • PipeWire session conflicts — USB devices that expose multiple interfaces (video + audio) can have their audio routing broken when PipeWire’s portal system manages video capture separately

Recommendations

If you’re running Linux with USB peripherals (especially on a workstation or homelab):

  1. Install iotop — It reads per-process I/O accounting, which is more accurate than /proc/stat. When top shows high iowait but iotop shows zero, you know it’s a phantom counter.
  2. Check usb-storage quirks — If you have USB card readers or enclosures causing issues, the usb-storage.quirks boot parameter is your friend.
  3. Disable LPM for problem cameras (older kernels) — On kernels before 6.17, many USB cameras have firmware bugs exposed by Linux’s aggressive power management. The usbcore quirks parameter can disable LPM per-device. On 6.17+, the kernel handles this automatically.
  4. Keep your kernel updated — Kernel 6.17 (available on Ubuntu 24.04 LTS via sudo apt install linux-generic-hwe-24.04) improves xHCI error handling for control transfers, but the Razer Kiyo Pro crash during video calls still occurs. The kernel patches are still needed for full protection.
  5. Use udisksctl power-off before physically unplugging USB drives — this prevents the cache sync race condition that can leak kernel accounting state.
  6. Restart PipeWire after USB webcam issues — If your webcam’s mic stops working (especially after adding screen capture sources in OBS), run systemctl --user restart pipewire pipewire-pulse wireplumber. PipeWire’s portal system can orphan audio nodes when managing video and audio from the same USB device.

The Linux USB subsystem handles thousands of device combinations, and most of them work flawlessly. But when they don’t, the failure modes can be subtle and deeply confusing — phantom I/O wait, cascading controller resets, kernel counters that lie to every monitoring tool on your system, and audio routing that silently breaks. Understanding the layers underneath USB devices — SCSI, xHCI, UVC, PipeWire — is the key to diagnosing these issues.

All of the patches and scripts mentioned here are available on GitHub: kiyo-xhci-fix (Razer Kiyo Pro patches and watchdog) and streamcam-fixes (Logitech StreamCam mic fix).

]]>
https://jphein.com/the-usb-bug-trilogy-phantom-i-o-camera-crashes-and-kernel-accounting-lies/feed/ 0 12253
How a Google Nest Hub Took Down My Entire Network https://jphein.com/how-a-google-nest-hub-took-down-my-entire-network/ https://jphein.com/how-a-google-nest-hub-took-down-my-entire-network/#respond Wed, 25 Mar 2026 13:40:24 +0000 https://jphein.com/?p=12240 I run a homelab with 12 VLANs, an OpenWrt firewall, and about 70 devices. Last night I enabled Cloudflare’s proxy (the \”orange cloud\”) on my domain realm.watch and woke up to find every device on my network had lost its IPv4 address. Phones, laptops, servers, IoT devices — all down. Here’s what happened and how I tracked it down.

The Symptom

After enabling CF proxy, devices on my admin VLAN (10.0.6.0/24) stopped renewing their DHCPv4 leases. My workstation was being handed a DHCPv6 address instead. Disabling the orange cloud immediately fixed it. Toggling it back on broke things again — reproducible every time.

The Investigation

My first instinct was to blame my own infrastructure. I checked:

  • OpenWrt’s odhcpd on my firewall (gatekeeper) — disabled RA on all interfaces, confirmed via tcpdump it wasn’t sending any Router Advertisements
  • dnsmasq on my hypervisor — stopped it entirely, RAs continued
  • My realm-portal Alpine VM — confirmed it was receiving RAs, not sending them
  • libvirt’s dnsmasq — only on virbr0 (isolated bridge), not on the VLAN bridge

None of my infrastructure was the source. So I ran a targeted tcpdump on the VLAN 6 bridge:

tcpdump -i br-lan.6 'icmp6 and ip6[40]=134'

And there it was — a device I didn’t expect:

fe80::1c3c:3716:1534:2392 > ff02::1: ICMP6, router advertisement
  Flags [managed, other stateful, ipv6 only]
  router lifetime 0s
  prefix: fd39:c3aa:8cfe:6bb8::/64, valid 1800s
  route: fd40:b451:5824:1::/64, lifetime 1800s

The Culprit: A Google Nest Hub

The source MAC was 24:e5:0f:d7:01:1d — a Google device. I hit its local API:

curl http://10.0.6.124:8008/setup/eureka_info

It was my Kitchen hub — a Google Nest Hub sitting on the counter. It was acting as a Thread/Matter border router, broadcasting IPv6 Router Advertisements with the ipv6 only flag (RFC 8781). This flag tells every device on the network: \”IPv6 is sufficient, you don’t need IPv4.\”

Why Cloudflare Proxy Triggered It

When you enable CF proxy on a domain, Cloudflare automatically publishes AAAA (IPv6) records alongside the A record. This introduces IPv6 DNS activity on the LAN — clients start making IPv6 lookups, generating multicast traffic. The Nest Hub’s Thread border router detected this IPv6 activity and responded by broadcasting Router Advertisements telling every device on the network to go IPv6-only.

The effect was immediate and reproducible: orange cloud on → RAs start → DHCPv4 leases expire → network down. Orange cloud off → IPv6 DNS activity drops → RAs stop → devices recover.

The Fix

Three layers of defense:

  1. Firewall block — Added persistent nftables rules on my OpenWrt firewall to drop Router Advertisements from this MAC address:
    nft add rule inet fw4 forward ether saddr 24:e5:0f:d7:01:1d meta l4proto icmpv6 icmpv6 type nd-router-advert drop
  2. Moved the device — Deauthed the Nest Hub from the admin SSID and moved it to the IoT VLAN where its RAs can’t affect critical infrastructure
  3. Disabled RA/DHCPv6 on all firewall interfaces as an additional safety net

Lessons Learned

  • Consumer smart home devices can break your entire network. A Google Nest Hub acting as a Thread/Matter border router was sending rogue Router Advertisements that poisoned DHCPv4 for every device on the VLAN.
  • The \”ipv6 only\” RA flag (RFC 8781) is dangerous on mixed networks. It tells clients to stop using IPv4 entirely. One misbehaving device can take down your whole network.
  • Segment your IoT devices. Smart speakers, hubs, and Thread/Matter devices should never be on the same VLAN as your servers and workstations.
  • Enabling Cloudflare proxy can have surprising LAN-side effects by introducing AAAA records and increasing IPv6 activity, which can trigger latent issues with devices that react to IPv6 traffic.
  • Google Cast devices expose a local API on port 8008 (/setup/eureka_info) that returns device identity without authentication — invaluable for identifying mystery devices.
  • Use RA Guard or firewall rules to block unauthorized Router Advertisements. Only your actual router should be sending RAs.

The whole investigation took about an hour. The hardest part was accepting that my own infrastructure wasn’t the problem — it was a \$100 smart display on the kitchen counter.

]]>
https://jphein.com/how-a-google-nest-hub-took-down-my-entire-network/feed/ 0 12240
Building a Home File Server with Ubuntu, RAID, Docker, and Tailscale https://jphein.com/building-a-home-file-server-with-ubuntu-raid-docker-and-tailscale/ https://jphein.com/building-a-home-file-server-with-ubuntu-raid-docker-and-tailscale/#respond Sun, 22 Mar 2026 07:14:29 +0000 https://jphein.com/building-a-home-file-server-with-ubuntu-raid-docker-and-tailscale/ Building a headless Ubuntu file server doesn’t require fancy hardware or expensive NAS appliances. In this guide, I’ll walk through how I turned an old Sandy Bridge desktop into a reliable home file server running RAID 1, LVM, and a full suite of self-hosted media services — all accessible from anywhere via Tailscale VPN.

The Hardware

This build starts with modest hardware — a retired desktop with an Intel Sandy Bridge quad-core CPU, no discrete GPU, and a mix of drives:

Component Detail
CPU Intel Sandy Bridge, 4 cores, AES-NI
RAM 8GB DDR3
Boot Drive 112G WD SSD
Disk 1 932G Toshiba HDD
Disk 2 1.82T Seagate HDD
Disk 3 932G Western Digital HDD
GPU Intel HD 2000/3000 (integrated only)

No discrete GPU means no hardware transcoding — but that’s fine. We’ll configure everything for direct play and disable ML features that need GPU acceleration.

Storage Architecture

The storage layout uses two strategies: RAID 1 for active data that needs redundancy, and LVM for bulk archive storage.

┌─────────────────────────────────────────────────────────┐
│                      /mnt/raid (923G)                   │
│                     RAID 1 — "mirror"                   │
│   ┌─────────────────────┐  ┌─────────────────────┐     │
│   │  sda2 (923G)        │  │  sdc3 (923G)        │     │
│   │  Toshiba DT01ACA100 │  │  WD WD10EZEX        │     │
│   └─────────────────────┘  └─────────────────────┘     │
└─────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────┐
│                   /mnt/storage (1.82T)                  │
│                  LVM — VG "lvm" / LV "storage"          │
│   ┌─────────────────────────────────────────────┐       │
│   │  sdb (1.82T) — Seagate ST2000VM003          │       │
│   └─────────────────────────────────────────────┘       │
└─────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────┐
│                    sdd — Boot Drive                     │
│                  112G WD SSD (ext4 + EFI)               │
└─────────────────────────────────────────────────────────┘

RAID 1 mirrors two drives so active data (documents, photos, music, videos, projects) survives a single drive failure. LVM on the 1.82T Seagate holds archives and backups — data that either exists elsewhere or can be re-downloaded.

The key principle: irreplaceable data goes on RAID, regenerable data goes on LVM. This guides every storage decision on the server.

Setting up the RAID array was straightforward since it was a pre-existing array from 2019:

sudo mdadm --assemble /dev/md0 /dev/sda2 /dev/sdc3
sudo mount /dev/md0 /mnt/raid

The LVM volume just needed activation:

sudo lvchange -ay lvm/storage
sudo mount /dev/lvm/storage /mnt/storage

Both volumes auto-mount via /etc/fstab with the nofail flag, so the system boots even if a data disk fails.

File Sharing: NFS + Samba

The server exports both volumes over NFS v4.2 (for Linux clients) and SMB3 (for Windows and macOS).

NFS v4.2

NFSv4.2 is the cleanest option for Linux-to-Linux file sharing. The server uses a pseudo-root at /srv/nfs with bind mounts:

# /etc/exports
/srv/nfs        10.0.6.0/24(rw,sync,fsid=0,crossmnt,no_subtree_check)
/srv/nfs/raid   10.0.6.0/24(rw,sync,no_subtree_check)
/srv/nfs/storage 10.0.6.0/24(rw,sync,no_subtree_check)

Clients mount with a single line:

sudo mount -t nfs4 -o vers=4.2,noatime,nodiratime disks.local:/ /mnt/disks

Samba / SMB3

For Windows and macOS clients, Samba serves the same volumes with SMB3 encryption and macOS Time Machine compatibility via the fruit VFS module. A dedicated family share gives household members access to shared music and documents.

Docker Media Stack

The heart of this build is a Docker Compose stack running eight self-hosted services behind a Caddy reverse proxy:

Service Purpose URL
Jellyfin Video streaming jellyfin.jphe.in
Navidrome Music streaming (Subsonic API) navidrome.jphe.in
Immich Photo management & phone backup immich.jphe.in
Syncthing Bidirectional file sync syncthing.jphe.in
Nextcloud Calendar, contacts & webmail nextcloud.jphe.in
Outline Wiki & knowledge base outline.jphe.in
Vaultwarden Password manager (Bitwarden-compatible) vault.jphe.in

Jellyfin — Direct Play Only

Without a discrete GPU, Jellyfin is configured for direct play only — no transcoding. This means clients need to support the media formats natively. In practice, most modern clients (phones, smart TVs, web browsers) handle H.264/H.265 just fine.

If a file won’t play on a particular client, I pre-transcode it on my workstation with ffmpeg before adding it to the library.

Navidrome — Lightweight Music Streaming

Navidrome is impressively lightweight — about 30MB of RAM to serve an entire music library. It speaks the Subsonic API, so any Subsonic-compatible client works: Symfonium on Android, play:Sub on iOS, or Sublime Music on Linux.

Immich — Self-Hosted Google Photos

Immich provides a Google Photos-like experience for photo management and mobile backup. Since we have no GPU, the machine learning features (face detection, CLIP search) are disabled — but the core photo browsing, timeline, and mobile auto-upload work perfectly.

Immich Storage Layout

Getting Immich’s storage right took some iteration. The key insight: phone uploads are irreplaceable originals and need RAID redundancy, but thumbnails and transcoded videos are regenerable and can live on cheaper storage.

The final layout uses Docker bind mounts to split data across volumes:

volumes:
  # Base upload directory on LVM (thumbnails, transcodes, backups)
  - /mnt/storage/immich-data:/usr/src/app/upload
  # Phone uploads overlaid onto RAID for redundancy
  - /mnt/raid/immich-upload:/usr/src/app/upload/upload
  - /mnt/raid/immich-library:/usr/src/app/upload/library
  # External photo libraries (read-only)
  - /mnt/raid/photos:/usr/src/app/external-raid:ro

Docker processes volume mounts in order, so the bind mounts for upload/ and library/ overlay onto the base LVM mount. This gives us:

Data Type Location Why
Phone uploads (originals) /mnt/raid (RAID 1) Irreplaceable, needs redundancy
Thumbnails /mnt/storage (LVM) Regenerable from originals
Encoded video /mnt/storage (LVM) Regenerable from originals
DB backups /mnt/storage (LVM) Separate backup chain handles this
Postgres database /mnt/raid (RAID 1) Bind mount at /mnt/raid/docker/immich-db

Lesson learned the hard way: Docker named volumes live under /var/lib/docker/volumes/ on the root filesystem — typically a small boot SSD. If Immich starts processing thousands of photos, thumbnails and transcoded videos can eat 20+ GB fast. Always use bind mounts to explicit paths on your data drives.

Fixing Bad EXIF Dates

Old photos from cameras with dead batteries or no real-time clock often have EXIF dates like January 1, 1980 or December 26, 1970. Immich sorts by EXIF date, so these photos end up in the wrong decade.

For JPEGs, exiftool can fix the dates on disk:

exiftool -overwrite_original -DateTimeOriginal="2018:04:01 12:00:00" photo.JPG

For formats that don’t support EXIF writes (like AVI), fix the dates directly in Immich’s Postgres database:

docker exec immich-db psql -U postgres -d immich -c \
  "UPDATE asset_exif SET \"dateTimeOriginal\" = '2023-05-01 12:00:00'
   WHERE \"assetId\" IN (SELECT id FROM asset WHERE \"originalPath\" LIKE '%folder-name%');"

Nextcloud — Calendar, Contacts & Webmail

Nextcloud fills the last major gap in the self-hosted stack: CalDAV for calendar sync and CardDAV for contacts, plus a built-in webmail client that connects to existing email accounts via IMAP/SMTP.

The architecture mirrors Immich — Nextcloud Apache container backed by Postgres 16 and Redis, all on RAID bind mounts. CalDAV/CardDAV client autodiscovery requires /.well-known/caldav and /.well-known/carddav redirects in Caddy, per RFC 6764:

nextcloud.jphe.in {
    redir /.well-known/carddav /remote.php/dav 301
    redir /.well-known/caldav /remote.php/dav 301
    reverse_proxy nextcloud:80
}

With these redirects, phone and desktop calendar/contacts clients only need the hostname — no manual URL entry required. One critical environment variable: OVERWRITEPROTOCOL=https tells Nextcloud it’s behind a TLS-terminating proxy, so it generates correct https:// links instead of http://.

Outline — Team Wiki

Outline provides a clean, fast wiki for shared documentation and knowledge management. It’s the self-hosted alternative to Notion — Markdown-native, real-time collaborative editing, and a powerful search.

Rather than adding yet another authentication system, Outline uses Nextcloud as an OIDC provider. Anyone with a Nextcloud account can log into Outline — no separate credentials needed. This is configured by registering an OAuth2 client in Nextcloud’s admin settings and pointing Outline’s OIDC environment variables at Nextcloud’s authorization endpoints.

File uploads (images, attachments) are stored directly on the RAID filesystem rather than requiring an S3-compatible object store like MinIO. For a personal/family wiki, local storage is simpler and perfectly adequate — Outline supports this with FILE_STORAGE=local.

Vaultwarden — Self-Hosted Password Manager

Vaultwarden is a lightweight, Rust-based implementation of the Bitwarden API. It runs on minimal resources and is fully compatible with all Bitwarden clients — browser extensions, mobile apps, and the bw CLI tool.

The database lives on RAID for redundancy, and automated daily backups provide an additional safety net (more on that below).

Syncthing — Project Sync

Syncthing keeps my ~/Projects directory synchronized between my workstation and the server’s RAID array. It’s bidirectional, peer-to-peer, and encrypted — no cloud service involved.

HTTPS with Caddy + Cloudflare DNS

Every service gets its own subdomain with automatic Let’s Encrypt certificates. Caddy handles this with the Cloudflare DNS-01 challenge — no ports 80/443 need to be exposed to the internet.

One gotcha: the upstream caddy-dns/cloudflare module rejects Cloudflare’s newer cfut_-prefixed API tokens. I used a patched fork that fixes this.

The Caddyfile is clean — each service is just a few lines:

jellyfin.jphe.in {
    reverse_proxy jellyfin:8096
}

Caddy Timeout Tuning for Large Uploads

If you’re uploading large videos through Immich (or any service behind Caddy), the default proxy timeouts will kill the connection mid-upload. The fix is to increase both the request body size limit and the proxy transport timeouts:

immich.jphe.in {
    request_body {
        max_size 20GB
    }
    reverse_proxy immich:2283 {
        transport http {
            read_timeout 600s
            write_timeout 600s
        }
    }
}

Caddy supports hot-reloading — caddy reload applies config changes without dropping existing connections.

Remote Access with Tailscale

All the *.jphe.in DNS records point to the server’s Tailscale IP (100.x.x.x), not a public IP. This means:

  • From home (LAN): The OpenWrt router intercepts *.jphe.in queries and resolves them to the local IP (10.0.6.120)
  • From anywhere else: DNS resolves to the Tailscale IP, and traffic flows through the Tailscale mesh

No port forwarding. No dynamic DNS. No exposing services to the internet. Just install Tailscale on your devices and everything works.

Server Tuning

A few targeted optimizations make a noticeable difference on this hardware:

Kernel / sysctl

Setting Value Why
vm.swappiness 10 Prefer file cache over swap
vm.dirty_ratio 40 Allow large write batches before flushing
vm.vfs_cache_pressure 50 Keep directory/inode caches longer
net.ipv4.tcp_congestion_control bbr Google’s BBR for faster throughput
net.core.rmem_max / wmem_max 16MB Large TCP buffers for big file transfers

Storage I/O

HDDs get the mq-deadline scheduler with 2MB readahead and write caching enabled. The SSD boot drive uses none (passthrough). Head parking is disabled on the HDDs (hdparm -B254) to avoid the click-of-death wear pattern.

SSH

SSH is tuned to use hardware-accelerated AES-GCM ciphers (the Sandy Bridge CPU has AES-NI), and reverse DNS lookups are disabled for faster connections.

Terminal compatibility tip: If you use Kitty terminal, remote servers won’t have the xterm-kitty terminfo entry. Tools like top, htop, and nano will break. Fix it by installing the terminfo on the server:

infocmp -x xterm-kitty | ssh disks "mkdir -p ~/.terminfo && tic -x -o ~/.terminfo /dev/stdin"

Automated Backups

The backup strategy has two layers: database dumps for application state, and BorgBackup for file-level deduplication.

Database Backups (Daily at 2:30 AM)

Every service with a database gets a daily dump to /mnt/raid/backups/databases/:

Service DB Type Method
Immich Postgres pg_dump (consistent snapshot)
Nextcloud Postgres pg_dump (consistent snapshot)
Outline Postgres pg_dump (consistent snapshot)
Vaultwarden SQLite sqlite3 .backup (safe while running)
Jellyfin SQLite sqlite3 .backup
Navidrome SQLite sqlite3 .backup

The dumps land on RAID so they’re included in the Borg backup that follows. Old dumps are pruned after 7 days.

Why not just back up the database files directly? Postgres stores data across multiple files that must be consistent with each other. Copying them while Postgres is running can give you a corrupted snapshot. pg_dump produces a clean SQL dump regardless of database activity. SQLite has the same issue — the .backup command ensures a consistent copy.

BorgBackup (Daily at 3:00 AM)

BorgBackup runs 30 minutes after the database dumps, deduplicating critical data from RAID to the storage volume:

# Backs up: documents, keys, projects, database dumps, photos
# Retention: 7 daily, 4 weekly, 6 monthly
# Compression: zstd level 3
# Destination: /mnt/storage/backups/borg-raid

Borg’s deduplication means incremental backups are fast and space-efficient — only changed blocks are stored. The entire backup history compresses to around 320MB of deduplicated storage.

The Backup Chain

2:30 AM  Database dumps → /mnt/raid/backups/databases/
3:00 AM  Borg backup    → /mnt/raid/* → /mnt/storage/backups/borg-raid/
6:00 AM  Disk health    → SMART checks, logged to /var/log/disk-health.log

This means the storage volume holds a complete, deduplicated history of everything on RAID — including consistent database snapshots.

Cloud Backup with rclone

Local backups protect against drive failure, but not against fire, theft, or disaster. For geographic redundancy, the server syncs critical data to cloud storage using rclone.

The Setup

rclone is configured with three cloud remotes:

Remote Provider Storage
box-personal Box (personal) 100GB
box-techempower Box (work) 100GB
gdrive Google Drive 25GB

That’s 225GB of cloud storage across three accounts — enough for database dumps, documents, phone uploads, music, and a chunk of the photo library.

Google Drive as a FUSE Mount

Google Drive is mounted as a regular filesystem at /mnt/gdrive using rclone’s FUSE mount capability, managed by a systemd service:

[Service]
Type=notify
User=jp
ExecStart=/usr/bin/rclone mount gdrive: /mnt/gdrive \
    --vfs-cache-mode full \
    --vfs-cache-max-size 2G \
    --dir-cache-time 72h \
    --allow-other

The --vfs-cache-mode full setting caches files locally before serving them, so reads and writes behave like a normal filesystem. The --allow-other flag (plus user_allow_other in /etc/fuse.conf) lets other system users and services like Samba access the mount.

OAuth on a Headless Server

Box and Google Drive both use OAuth2 for authentication, which normally requires a web browser. Since the server is headless, the trick is to run rclone config on a workstation that has a browser, complete the OAuth flow there, then copy ~/.config/rclone/rclone.conf to the server. The tokens persist in the config file and rclone handles refresh automatically.

Disk Health Monitoring

smartd runs weekly short tests and monthly long tests on all drives. A custom health check script runs daily at 6am and logs to /var/log/disk-health.log. On a server with aging drives, early warning of failure is critical.

Lessons Learned

A few things I ran into during the build:

  1. Old EFI partitions cause boot confusion. The BIOS was trying to boot a 2019-era GRUB installation from one of the data drives instead of the actual boot SSD. Clearing the old EFI entries fixed it.
  2. Always run e2fsck before operating on corrupt inodes. I tried to clean up files on a filesystem with corrupt inodes and triggered a kernel panic — VFS spinlock deadlock. The fix was to unmount and run e2fsck -y first.
  3. Docker volume permissions matter. Syncthing’s config volume was created as root but the container runs as UID 1000. Switching to a bind mount with explicit user mapping solved it.
  4. RAID cleanup freed massive space. The RAID array was 99% full. Moving backups and archives to the storage volume brought it down to 38% — from 917G used to 320G.
  5. No GPU doesn’t mean no media server. Direct play works great for most use cases. The GPU upgrade path is documented for when I eventually add one.
  6. Docker named volumes default to the root filesystem. Immich’s thumbnails and transcoded videos filled 23GB on the boot SSD before I noticed. Always use bind mounts for data-heavy containers, pointing to your bulk storage.
  7. Symlinks don’t work inside Docker volumes. A symlink on the host points to a path as seen inside the container. If the target path isn’t mounted in the container, the symlink leads nowhere. Use Docker bind mounts instead.
  8. Back up your databases, not just your files. BorgBackup captures files, but copying a live Postgres data directory gives you a potentially corrupt snapshot. I lost an entire Immich database (all photo metadata, albums, users) because there was no pg_dump backup. Now every database gets a daily dump before Borg runs.
  9. Separate irreplaceable from regenerable data. Phone photo uploads need RAID redundancy. Thumbnails and transcoded videos can be regenerated from originals and belong on cheaper storage. This distinction should drive your volume layout from day one.
  10. Caddy needs timeout tuning for large uploads. The default proxy timeouts are fine for web browsing but kill multi-gigabyte video uploads. Configure read_timeout and write_timeout explicitly for services that handle large files.
  11. Use rsync, not mv, across filesystems. mv between different filesystems is a silent copy+delete with no progress indicator and no resume on failure. rsync -ah --progress gives you visibility and idempotent restarts.

The Final Stack

Here’s what the complete setup looks like:

Layer Technology
OS Ubuntu 24.04 (headless)
Storage mdadm RAID 1 + LVM
File Sharing NFS v4.2 + Samba/SMB3
Media Jellyfin + Navidrome + Immich
PIM Nextcloud (CalDAV/CardDAV/Mail)
Knowledge Base Outline (Nextcloud OIDC auth)
Passwords Vaultwarden (Bitwarden-compatible)
Sync Syncthing
Reverse Proxy Caddy + Let’s Encrypt (DNS-01)
Remote Access Tailscale mesh VPN
Backups Daily DB dumps + BorgBackup + rclone cloud sync
Cloud Storage rclone → Box (2×100GB) + Google Drive (25GB FUSE mount)
Monitoring smartd + daily health checks

Total cost: effectively $0 in new hardware. The server is quiet, draws minimal power, and serves media to every device in the house — plus anywhere I have Tailscale installed.

If you have an old desktop gathering dust, it’s more than capable of running this entire stack. The only thing I’d eventually add is a discrete GPU for Jellyfin transcoding and Immich ML — but honestly, direct play has been perfectly fine.

]]>
https://jphein.com/building-a-home-file-server-with-ubuntu-raid-docker-and-tailscale/feed/ 0 12226
How to Route a VLAN Through a WireGuard VPN Exit Gateway with OpenWrt, AdGuard Home, and Azure https://jphein.com/how-to-route-a-vlan-through-a-wireguard-vpn-exit-gateway-with-openwrt-adguard-home-and-azure/ https://jphein.com/how-to-route-a-vlan-through-a-wireguard-vpn-exit-gateway-with-openwrt-adguard-home-and-azure/#respond Sun, 22 Mar 2026 06:45:18 +0000 https://jphein.com/how-to-route-a-vlan-through-a-wireguard-vpn-exit-gateway-with-openwrt-adguard-home-and-azure/ The Goal

Route an entire VLAN through a WireGuard tunnel to an Azure VM, so every device on that network exits the internet from a cloud IP — with ad blocking, DNS encryption, and a kill switch. No split tunneling, no DNS leaks, no IPv6 leaks.

The result: connect to a dedicated “vpn” WiFi SSID at home, and all your traffic exits through Azure. Disconnect, and you are back on your normal internet. Simple for the user, robust underneath.

Architecture

Devices on VLAN 9 ("vpn" WiFi)
       ↓ (policy routing)
OpenWrt router (gatekeeper) ──WireGuard──→ Azure VM (gig)
       ↓                                      ↓
  AdGuard Home (LAN DNS)              AdGuard Home (VPN DNS)
  Cloudflare DoT upstream             Cloudflare DoT upstream

Key components:

  • gatekeeper — OpenWrt 24.10 router (x86, i7, 16GB RAM) handling all VLANs, firewall, and policy routing
  • gig — Azure Ubuntu 24.04 VM acting as the WireGuard exit node
  • VLAN 9 — Dedicated VPN network (10.0.9.0/24) with its own WiFi SSID, DHCP, and firewall zone
  • AdGuard Home — Network-wide ad blocking on both ends, with encrypted DNS upstream

Step 1: WireGuard Tunnel

Azure VM (gig)

Install WireGuard and enable IP forwarding:

sudo apt install wireguard
sudo sysctl -w net.ipv4.ip_forward=1
echo "net.ipv4.ip_forward=1" | sudo tee -a /etc/sysctl.conf

Generate keys and create /etc/wireguard/wg0.conf:

[Interface]
Address = 10.5.34.1/24
ListenPort = 51820
PrivateKey = <server-private-key>
PostUp = iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostDown = iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE

[Peer]
# gatekeeper
PublicKey = <gatekeeper-public-key>
AllowedIPs = 10.5.34.10/32

Enable and start:

sudo systemctl enable wg-quick@wg0
sudo systemctl start wg-quick@wg0

Open UDP port 51820 in the Azure Network Security Group and in UFW:

sudo ufw allow 51820/udp
sudo ufw allow in on wg0 from 10.5.34.0/24

OpenWrt Router (gatekeeper)

Install WireGuard:

opkg update
opkg install wireguard-tools kmod-wireguard

Configure the interface via UCI:

uci set network.wireguardgig=interface
uci set network.wireguardgig.proto=wireguard
uci set network.wireguardgig.private_key=<gatekeeper-private-key>
uci add_list network.wireguardgig.addresses=10.5.34.10/24
uci set network.wireguardgig.mtu=1420
uci set network.wireguardgig.metric=90

uci add network wireguard_wireguardgig
uci set network.@wireguard_wireguardgig[-1].public_key=<server-public-key>
uci set network.@wireguard_wireguardgig[-1].endpoint_host=<your-vm-hostname>
uci set network.@wireguard_wireguardgig[-1].endpoint_port=51820
uci set network.@wireguard_wireguardgig[-1].persistent_keepalive=25
uci add_list network.@wireguard_wireguardgig[-1].allowed_ips=0.0.0.0/0

uci commit network
/etc/init.d/network restart

Important: Add a static route to pin the WireGuard endpoint through your real WAN, so the tunnel does not try to route itself through itself:

uci add network route
uci set network.@route[-1].interface=wan
uci set network.@route[-1].target=<azure-vm-public-ip>/32
uci set network.@route[-1].gateway=<your-wan-gateway>
uci commit network

Step 2: VLAN 9 and Policy Routing

Create a dedicated VPN network on VLAN 9. On OpenWrt:

# Bridge and VLAN interface
uci set network.vpn=interface
uci set network.vpn.proto=static
uci set network.vpn.ipaddr=10.0.9.1
uci set network.vpn.netmask=255.255.255.0
uci set network.vpn.device=br-lan.9

Set up policy routing so VLAN 9 traffic uses the WireGuard tunnel instead of the normal WAN:

# Default route through tunnel in table 2
uci add network route
uci set network.@route[-1].interface=wireguardgig
uci set network.@route[-1].target=0.0.0.0/0
uci set network.@route[-1].table=2

# Rule: traffic from VPN zone uses table 2
uci add network rule
uci set network.@rule[-1].src=10.0.9.0/24
uci set network.@rule[-1].lookup=2

uci commit network
/etc/init.d/network restart

Devices on VLAN 9 now exit through Azure. Devices on every other VLAN are unaffected.

Step 3: Firewall — Kill Switch and Leak Prevention

The firewall is critical. If the tunnel drops, VPN traffic must NOT fall back to the regular WAN.

# VPN zone — devices on VLAN 9
uci add firewall zone
uci set firewall.@zone[-1].name=vpn
uci set firewall.@zone[-1].input=REJECT
uci set firewall.@zone[-1].output=ACCEPT
uci set firewall.@zone[-1].forward=REJECT
uci add_list firewall.@zone[-1].network=vpn

# WAN guard zone — the WireGuard tunnel exit
uci add firewall zone
uci set firewall.@zone[-1].name=wanguard
uci set firewall.@zone[-1].input=REJECT
uci set firewall.@zone[-1].output=ACCEPT
uci set firewall.@zone[-1].forward=REJECT
uci add_list firewall.@zone[-1].network=wireguardgig
uci set firewall.@zone[-1].masq=1
uci set firewall.@zone[-1].mtu_fix=1

# Only forwarding: vpn → wanguard (kill switch)
uci add firewall forwarding
uci set firewall.@forwarding[-1].src=vpn
uci set firewall.@forwarding[-1].dest=wanguard

# Allow DNS and DHCP into VPN zone
# ... (DNS on port 53, DHCP on port 67)

# Drop all IPv6 from VPN zone
uci add firewall rule
uci set firewall.@rule[-1].name=VPN-Drop-IPv6
uci set firewall.@rule[-1].src=vpn
uci set firewall.@rule[-1].family=ipv6
uci set firewall.@rule[-1].proto=all
uci set firewall.@rule[-1].target=DROP

uci commit firewall
/etc/init.d/firewall restart

There is no vpn → wan forwarding. If the tunnel is down, traffic is dropped — not leaked.

Step 4: DNS — No Leaks, With Ad Blocking

DNS is the most common VPN leak. We handle it in layers.

AdGuard Home on gig (VPN DNS)

Install AdGuard Home on the Azure VM, listening only on the WireGuard address:

curl -s -S -L https://raw.githubusercontent.com/AdguardTeam/AdGuardHome/master/scripts/install.sh | sh

Configure via the web UI at http://10.5.34.1:3000:

  • DNS listen address: 10.5.34.1:53
  • Upstream DNS: tls://1.1.1.1 and tls://1.0.0.1 (Cloudflare DNS-over-TLS)
  • Enable DNSSEC and optimistic caching
  • Enable the AdGuard DNS filter (~163K rules), AdAway, and Peter Lowe blocklists

Both the web UI and DNS are bound to the WireGuard interface only — not accessible from the public internet.

AdGuard Home on gatekeeper (LAN DNS)

Install from opkg and configure to listen on 127.0.0.1:5353, then point dnsmasq at it:

opkg install adguardhome

# Point dnsmasq at AdGuard Home instead of Stubby
uci add_list dhcp.@dnsmasq[0].server='127.0.0.1#5353'
uci set dhcp.@dnsmasq[0].noresolv=1
uci commit dhcp
/etc/init.d/dnsmasq restart

This replaces Stubby — AdGuard Home handles DNS-over-TLS upstream natively. The DNS chain becomes: dnsmasq (:53) → AdGuard Home (:5353) → Cloudflare DoT.

DHCP: Force VPN Clients to Use Tunnel DNS

uci set dhcp.vpn.dhcp_option='6,10.5.34.1'
uci commit dhcp

VPN clients receive 10.5.34.1 as their DNS server. Since this IP is on the WireGuard subnet, all DNS queries go through the tunnel to AdGuard Home on gig.

DNS Intercept: Catch Hardcoded DNS

Some devices (Chromecast, Android) ignore DHCP and hardcode DNS servers like 8.8.8.8. A firewall DNAT redirect catches them:

uci add firewall redirect
uci set firewall.@redirect[-1].target=DNAT
uci set firewall.@redirect[-1].name='Intercept DNS VPN'
uci set firewall.@redirect[-1].src=vpn
uci set firewall.@redirect[-1].src_dport=53
uci set firewall.@redirect[-1].dest=wanguard
uci set firewall.@redirect[-1].dest_ip=10.5.34.1
uci set firewall.@redirect[-1].dest_port=53
uci set firewall.@redirect[-1].proto='tcp udp'
uci commit firewall
/etc/init.d/firewall restart

Any DNS query leaving the VPN zone gets redirected to AdGuard Home on gig, through the tunnel. No exceptions.

IPv6 Leak Prevention

IPv6 can leak your real address even when IPv4 is tunneled. Disable it at four layers:

  1. Sysctl: net.ipv6.conf.br-lan/9.disable_ipv6=1
  2. DHCP: RA disabled, DHCPv6 disabled on VPN interface
  3. Firewall: DROP all IPv6 from VPN zone
  4. DHCP options: No IPv6 DNS servers advertised

Step 5: Performance Tuning

Out of the box, the tunnel achieved ~305/332 Mbps (up/down). After tuning: ~390/453 Mbps.

Both Sides

  • BBR congestion control — Replaces CUBIC. Better throughput on high-latency links. net.ipv4.tcp_congestion_control=bbr
  • TCP buffer tuning — Scale rmem_max/wmem_max for the bandwidth-delay product
  • ECN — Reduces retransmits. net.ipv4.tcp_ecn=1
  • MTU 1420 — Standard for WireGuard over Ethernet

Azure VM (gig)

  • fq qdisc on eth0 and wg0 — BBR needs a pacing-aware qdisc. Without it, BBR falls back to burst-based sending which causes buffer bloat
  • TCP Fast Open — net.ipv4.tcp_fastopen=3
  • 26MB socket buffers — Sized for the bandwidth-delay product of a ~12ms RTT gigabit link

OpenWrt Router (gatekeeper)

  • CAKE SQM on the WAN link — 500/500 Mbps with nat and ack-filter. Prevents buffer bloat
  • CAKE SQM on wireguardgig — Per-flow fairness inside the tunnel. Prevents one bulk download from starving interactive traffic
  • RPS (Receive Packet Steering) — Spread softirq across all CPU cores. Persistent via /etc/hotplug.d/net/99-rps

Step 6: Dedicated VPN WiFi SSID

On an OpenWrt access point, create a 5GHz SSID that bridges to VLAN 9:

uci set wireless.vpn_5g=wifi-iface
uci set wireless.vpn_5g.device=radio2
uci set wireless.vpn_5g.mode=ap
uci set wireless.vpn_5g.ssid=vpn
uci set wireless.vpn_5g.encryption=psk2
uci set wireless.vpn_5g.key=<your-password>
uci set wireless.vpn_5g.network=vpn
uci commit wireless
wifi reload

The AP bridges the “vpn” SSID to VLAN 9. Connect to this SSID and all traffic routes through Azure.

Verifying It Works

From a device on the VPN WiFi:

# Check your exit IP — should be the Azure VM
curl ifconfig.me

# Check DNS — ad domains should be blocked
nslookup ads.google.com
# Expected: 127.0.0.1

# Check for DNS leaks at https://www.dnsleaktest.com
# Should show Cloudflare, not your ISP

# Check for IPv6 leaks at https://ipv6leak.com
# Should show no IPv6 connectivity

Easy Ad Blocking Toggle

AdGuard Home includes a web dashboard with a full query log. You can:

  • One-click whitelist any blocked domain from the query log
  • Disable protection globally for 10 seconds, 30 seconds, 1 minute, etc.
  • Per-client rules for different filtering per device

Access the dashboards at:

  • LAN: http://<router-ip>:3000
  • VPN: http://10.5.34.1:3000 (through the tunnel)

For even quicker toggling, the AdGuard Browser Extension lets you disable filtering per-site from the toolbar.

Summary

Layer What
Tunnel WireGuard, MTU 1420, BBR, 25s keepalive
Routing VLAN 9 → policy route table 2 → wireguardgig
Kill switch vpn → wanguard only, no vpn → wan forwarding
DNS AdGuard Home on both ends, Cloudflare DoT upstream
DNS leak prevention DHCP option 6 + DNAT intercept for hardcoded DNS
IPv6 leak prevention Disabled at sysctl, DHCP, RA, and firewall
Ad blocking ~173K rules (AdGuard DNS + AdAway + Peter Lowe)
Performance CAKE SQM, RPS, fq qdisc, tuned TCP buffers
Access Dedicated 5GHz WiFi SSID — connect and go

The whole setup was built and tuned in a single session with Claude Code handling the configuration across both hosts simultaneously — SSH into the router and VM, running commands, testing, and fixing issues in real time.

]]>
https://jphein.com/how-to-route-a-vlan-through-a-wireguard-vpn-exit-gateway-with-openwrt-adguard-home-and-azure/feed/ 0 12218
Hardening a WordPress Server with Claude Code https://jphein.com/hardening-a-wordpress-server-with-claude-code/ https://jphein.com/hardening-a-wordpress-server-with-claude-code/#respond Sun, 08 Mar 2026 16:23:35 +0000 https://jphein.com/hardening-a-wordpress-server-with-claude-code/ The Problem

I’ve been running jphein.com on a Google Cloud e2-micro instance since 2022. It started as a basic Docker Compose setup — WordPress, MySQL 5.7, and an nginx reverse proxy — with a backup script I wrote and mostly forgot about. Over time, things drifted: the auto-update script stopped working (silently!), legacy files accumulated, and MySQL 5.7 went end-of-life without me noticing.

I decided to use Claude Code to audit and harden the entire setup. Here’s what we found and fixed in a single session.

What Claude Code Found

Critical Issues

  • Auto-update completely broken — The script ran Docker commands via cron, but the jp user wasn’t in the docker group. Every Sunday at 2am it would fail silently and report “completed successfully” because the pipe-to-while-read pattern swallowed all errors.
  • MySQL 5.7 end-of-life — No security patches since October 2023. Running for over two years without updates.
  • Restore script had a broken GRANT statement — GRANT ALL ON wp_db.* TO @% grants to nobody. If I ever needed to restore, the database user wouldn’t have access.
  • MySQL port 3306 exposed to the internet — Docker bypasses UFW by default, so even though UFW didn’t have a rule for 3306, Docker’s own iptables chain was forwarding it publicly.

Security Gaps

  • Zero HTTP security headers — No HSTS, no X-Frame-Options, no Content-Type-Options. The server was also broadcasting X-Powered-By: PHP/8.3.30 to anyone who asked.
  • Legacy files with hardcoded credentials — An old RDP launcher script (acrobat) containing a plaintext password was sitting in the web root since 2022, publicly accessible.
  • WordPress port 8080 exposed — Same Docker-bypasses-UFW issue.

What We Fixed

Infrastructure

  • MySQL 5.7 → 8.0.45 — In-place upgrade. Required bumping thread_stack from 128K to 256K and removing deprecated query_cache settings. The upgrade ran automatically when the new container started.
  • Custom WordPress Dockerfile — The old setup ran apt-get install cron on every container restart, which was slow and fragile (network-dependent). Now cron is baked into the image.
  • Ports locked down — MySQL and WordPress ports bound to 127.0.0.1 in docker-compose. Port 8080 removed from UFW.

Security

  • nginx security headers — Added Strict-Transport-Security, X-Frame-Options, X-Content-Type-Options, Referrer-Policy, and Permissions-Policy. Stripped X-Powered-By.
  • Removed 9 legacy files from the web root — test scripts, old LTSP launchers, a Duplicator backup, and the credential-leaking acrobat file.
  • Removed 4 inactive plugins — Each unused plugin is unnecessary attack surface.

Reliability

  • Rewrote auto-update script — Docker access pre-flight check, proper error capture (no more pipe-swallowing), warning tracking in email reports.
  • Fixed restore script — Correct GRANT syntax with proper username and password.
  • Added set -uo pipefail to the backup script.
  • Set up email alerts — Installed msmtp with Gmail SMTP so backup failures and update reports actually reach my inbox instead of printing to a log file nobody reads.

Housekeeping

  • Trimmed backups from 12 to 6 months — Reduced GCS storage from 20 GB to 11 GB. Six months of daily restore points is plenty for a personal site.
  • Cleaned Docker images, WP cache, old logs — Freed about 900 MB on disk.

Current Architecture

Internet → Cloudflare → SWAG (nginx + Let's Encrypt)
                            ↓
                     WordPress (PHP 8.3, custom Dockerfile)
                            ↓
                     MySQL 8.0 (localhost only)

Backups: daily incremental to GCS via duplicity (6 months retention)
Updates: weekly via WP-CLI + Docker pull + apt upgrade
Alerts:  msmtp → Gmail
Access:  Tailscale only (no public SSH)

Lessons Learned

  1. Silent failures are the worst kind. The auto-update script “worked” for months while doing nothing. Always check that your monitoring actually detects failures — pipe-to-while-read in bash swallows exit codes.
  2. Docker bypasses UFW. If you expose a port in docker-compose, it’s public regardless of your firewall rules. Always bind to 127.0.0.1 for services that don’t need external access.
  3. Test your restore. A backup you can’t restore from is worthless. My GRANT statement was broken — I would have discovered this at the worst possible time.
  4. EOL software is a ticking clock. MySQL 5.7 was EOL for over two years. Set a calendar reminder when your database engine reaches end-of-life.

The whole audit and remediation took about an hour with Claude Code doing the heavy lifting — reading configs, running tests, making changes, and verifying everything worked after each step.

]]>
https://jphein.com/hardening-a-wordpress-server-with-claude-code/feed/ 0 12207
How to Host WordPress for Free with GCP and Docker — The Complete Guide https://jphein.com/how-to-host-wordpress-for-free-with-gcp-and-docker/ https://jphein.com/how-to-host-wordpress-for-free-with-gcp-and-docker/#respond Tue, 24 Feb 2026 02:36:35 +0000 https://jphein.com/how-to-host-wordpress-for-free-with-gcp-and-docker/ A practical guide to running a personal WordPress site on Google Cloud’s Always Free tier using Docker Compose, automatic SSL, security hardening, email alerts, and daily backups to cloud storage — all at zero cost.

What you’ll end up with:

  • WordPress + MySQL 8.0 + nginx/SSL running in Docker on a free GCP VM
  • Automatic HTTPS via Let’s Encrypt (auto-renewing)
  • Security headers, localhost-only port bindings, and a hardened nginx config
  • Daily incremental backups to a free GCS bucket (~6 months of history)
  • Email alerts when backups fail
  • Automated weekly updates for WordPress, Docker images, and OS packages
  • SSH locked down via Tailscale — port 22 closed to the public internet
  • ~$0/month, indefinitely

What this costs: Nothing. GCP’s Always Free tier covers the VM, and the GCS bucket stays free as long as you keep it under 5 GB (backups for a small site are well under that).


Table of Contents

  1. Prerequisites
  2. Create the GCP VM
  3. Lock down SSH with Tailscale
  4. Tune Ubuntu for 1 GB RAM
  5. Point your domain at the VM with Cloudflare
  6. Install Docker
  7. Create the site directory
  8. Write the config files
  9. Start the stack
  10. Finish WordPress setup
  11. Set up email alerts
  12. Set up backups
  13. Set up auto-updates
  14. Maintenance
  15. How the memory budget works
  16. Troubleshooting

1. Prerequisites

  • A Google account (for GCP and Google Cloud Storage)
  • A domain name you control (e.g. from Namecheap, Google Domains, Cloudflare, etc.)
  • A Tailscale account — free at tailscale.com (up to 100 devices)
  • A Gmail account with an app password (for email alerts)
  • Basic comfort with a Linux terminal

2. Create the GCP VM

GCP’s Always Free tier includes one e2-micro instance per month in certain US regions, forever — no credit card charges as long as you stay within the limits.

Create the instance

  1. Go to console.cloud.google.com → Compute Engine → VM instances → Create instance
  2. Set:
    • Name: anything (e.g. wordpress-server)
    • Region: us-east1, us-west1, or us-central1 (required for Always Free)
    • Machine type: e2-micro (2 vCPU, 1 GB RAM)
    • Boot disk: Ubuntu 22.04 LTS, 30 GB standard persistent disk
  3. Under Firewall, check both Allow HTTP traffic and Allow HTTPS traffic
  4. Click Create

The 30 GB disk is within the Always Free 30 GB/month standard disk limit. Do not use SSD — only standard persistent disk is free.

Note your external IP

Once created, copy the External IP from the VM list. You’ll need it for DNS.

Open SSH for initial setup

Click SSH in the GCP console to open a browser terminal. You’ll use this for the next step (installing Tailscale), after which you can close public SSH permanently.


3. Lock down SSH with Tailscale

Port 22 open to the internet is the single most-scanned port on any public server. Tailscale gives you a private encrypted network between your devices — SSH stays open on that network and closed to everyone else.

Install Tailscale on the VM

In the GCP browser SSH terminal:

curl -fsSL https://tailscale.com/install.sh | sh
sudo tailscale up

tailscale up prints an authentication URL. Open it in your browser, log in with your Tailscale account, and the VM will appear in your Tailscale admin console.

Get the VM’s Tailscale IP (always in the 100.x.x.x range):

tailscale ip -4

Install Tailscale on your local machine

Download from tailscale.com/download for macOS, Windows, or Linux and sign in with the same account. Both devices will now be on your private Tailscale network.

Test SSH over Tailscale before closing the public port

From your local machine:

ssh [email protected]   # use the Tailscale IP from above

Confirm this works before the next step.

Close port 22 in GCP’s firewall

In the GCP console:

  1. Go to VPC network → Firewall
  2. Find the rule named default-allow-ssh (allows TCP port 22 from 0.0.0.0/0)
  3. Click it → Delete (or Disable if you want to re-enable it later)

Port 22 is now closed to the public internet. Your Tailscale SSH connection still works because Tailscale operates over UDP 41641 (or falls back to HTTPS), not port 22.

GCP console SSH still works. The browser SSH button in the GCP console uses IAP (Identity-Aware Proxy), which tunnels through Google’s internal network — it does not go through the public firewall rule you just removed.

Optional: restrict sshd to the Tailscale interface

For maximum hardening, tell sshd to only listen on the Tailscale interface:

# Find the Tailscale interface name (usually tailscale0)
ip link show | grep tailscale

# Add to /etc/ssh/sshd_config:
echo "ListenAddress 100.x.x.x" | sudo tee -a /etc/ssh/sshd_config

sudo systemctl restart ssh

Replace 100.x.x.x with your actual Tailscale IP. After this, ssh to the public IP will simply time out even if the firewall rule were ever re-enabled.


4. Tune Ubuntu for 1 GB RAM

A fresh Ubuntu 22.04 install on GCP is not optimised for a memory-constrained server. These steps reclaim memory and prevent a few common failure modes before you install anything.

Create a swap file

The e2-micro has 1 GB of RAM. Without swap, a single memory spike from Docker pulling a new image or WordPress processing a large upload can OOM-kill a container. A swap file is cheap insurance.

# Check whether swap already exists
swapon --show

# If nothing is listed, create a 4 GB swap file
sudo fallocate -l 4G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

# Make it permanent across reboots
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab

Reduce swappiness

The default vm.swappiness of 60 tells the kernel to move pages to swap aggressively. On a server where you want RAM for active processes, 10 is better — use swap as a last resort, not a first choice:

echo 'vm.swappiness=10' | sudo tee /etc/sysctl.d/99-tuning.conf
sudo sysctl -p /etc/sysctl.d/99-tuning.conf

# Verify
cat /proc/sys/vm/swappiness   # should print 10

Cap the systemd journal size

By default journald keeps logs until the disk is 10% full. On a 30 GB boot disk that means up to 3 GB of logs — a significant chunk of your free space. Cap it:

sudo mkdir -p /etc/systemd/journald.conf.d

sudo tee /etc/systemd/journald.conf.d/size.conf > /dev/null <<'EOF'
[Journal]
SystemMaxUse=200M
RuntimeMaxUse=50M
EOF

sudo systemctl restart systemd-journald

# Vacuum logs that are already over the new limit
sudo journalctl --vacuum-size=200M

Disable services you don't need

multipathd — manages multipath block devices (SANs, iSCSI). Irrelevant on a GCP VM:

sudo systemctl disable --now multipathd

rsyslog — a second logging daemon that duplicates what journald already does. Ubuntu installs both by default:

sudo systemctl disable --now rsyslog

LXD — a full VM and container manager installed via snap. Not needed when you're using Docker:

sudo snap remove lxd

Removing LXD also removes the core18 and core20 snap bases it depended on, freeing several hundred MB of disk space.

Set up UFW firewall

UFW provides a local firewall layer in addition to GCP's network firewall — defense in depth:

sudo ufw allow 22/tcp    # SSH (Tailscale access)
sudo ufw allow 80/tcp    # HTTP (Let's Encrypt + redirect)
sudo ufw allow 443/tcp   # HTTPS
sudo ufw allow 51820/udp # Tailscale (WireGuard)
sudo ufw enable

Verify memory after tuning

free -h
sudo docker stats --no-stream   # run after Docker is installed

At idle you should see roughly 200 MB used by the OS, leaving ~750 MB for your containers.


5. Point your domain at the VM with Cloudflare

Cloudflare is the recommended DNS provider for this setup. The free tier gives you DNS, DDoS protection, and a CDN — all at no cost. You just point your domain's nameservers at Cloudflare instead of your registrar.

Add your site to Cloudflare

  1. Sign up at cloudflare.com and click Add a site
  2. Enter your domain and select the Free plan
  3. Cloudflare will scan your existing DNS records. Review and continue.
  4. Cloudflare gives you two nameservers, e.g.:
    arlo.ns.cloudflare.com
    june.ns.cloudflare.com
  5. Log into your domain registrar and replace its nameservers with the two Cloudflare ones
  6. Click Done in Cloudflare — propagation takes a few minutes to a few hours

Add DNS records

In the Cloudflare dashboard under DNS → Records, add:

Type: A    Name: @    IPv4: YOUR_VM_IP
Type: A    Name: www  IPv4: YOUR_VM_IP

Proxy toggle: orange cloud vs grey cloud

Each DNS record has a Proxy status toggle — the orange cloud icon:

Setting What it means
Proxied (orange cloud) Traffic flows through Cloudflare's CDN. Hides your VM's real IP, adds DDoS protection and caching. Recommended.
DNS only (grey cloud) Cloudflare is just DNS. Traffic goes directly to your VM.

Use proxied (orange cloud). It's one of the main reasons to use Cloudflare.

Let's Encrypt HTTP-01 validation works fine through the Cloudflare proxy — swag handles it automatically.

Set Cloudflare SSL/TLS mode to Full

This is a required step when using the orange cloud proxy.

In Cloudflare: SSL/TLS → Overview → select Full (not Flexible, not Full Strict).

  • Flexible — Cloudflare encrypts to visitors but sends plain HTTP to your server. Broken with swag.
  • Full — Cloudflare encrypts both legs. Works correctly with swag's Let's Encrypt cert.
  • Full (Strict) — Same as Full but validates the origin cert against a CA. Also works, but requires the Let's Encrypt cert to be valid before you can turn this on.

Verify DNS before starting the stack

Let's Encrypt needs the domain to resolve before it can issue a certificate:

dig +short yourdomain.com
# Should return a Cloudflare IP (not your VM IP — that's expected when proxied)

# Test that port 80 reaches your server through Cloudflare
curl -I http://yourdomain.com

6. Install Docker

SSH into your VM and run:

# Install dependencies
sudo apt update && sudo apt install -y ca-certificates curl gnupg

# Add Docker's official GPG key
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg \
    | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

# Add the Docker apt repository
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] \
    https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" \
    | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

# Install Docker Engine and Compose plugin
sudo apt update && sudo apt install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin

# Add your user to the docker group (needed for cron scripts)
sudo usermod -aG docker $USER

# Verify
sudo docker compose version

Important: always use docker compose (with a space, V2). The old docker-compose hyphenated command is a separate, outdated Python tool that is incompatible with modern Docker image formats.

Important: adding your user to the docker group lets cron-scheduled scripts (backup, auto-update) access Docker without sudo. Log out and back in for the group change to take effect.


7. Create the site directory

mkdir -p ~/mysite/{www,config}
mkdir -p ~/mysqldump
cd ~/mysite

Your layout will be:

~/mysite/
├── docker-compose.yml
├── wordpress.Dockerfile   # Custom WordPress image with cron
├── default.conf           # nginx config with security headers
├── custom.ini             # PHP overrides
├── mpm_prefork.conf       # Apache worker tuning
├── mysql.cnf              # MySQL 8.0 low-memory tuning
├── .env                   # Secrets (gitignored)
├── config/                # swag runtime data (SSL certs, nginx state)
└── www/                   # WordPress files

~/mysqldump/
└── database.sql           # daily MySQL dump (written by backup script)

8. Write the config files

Create each file below. Replace yourdomain.com and [email protected] throughout.

.env (secrets)

Keep passwords out of your compose file. Generate strong random passwords:

cat > .env <<'EOF'
MYSQL_ROOT_PASSWORD=CHANGE_ME_USE_openssl_rand_base64_16
MYSQL_PASSWORD=CHANGE_ME_USE_openssl_rand_base64_16
MYSQL_DATABASE=wp_db
MYSQL_USER=wp_db_user
EOF
chmod 600 .env

docker-compose.yml

This defines three containers: swag (nginx + SSL), wordpress (Apache + PHP), and db (MySQL 8.0). All have memory limits to stay within the 1 GB budget. Ports are bound to 127.0.0.1 to prevent Docker from bypassing your firewall.

services:

  swag:
    image: linuxserver/swag
    container_name: swag
    restart: always
    depends_on:
      - wordpress
    volumes:
      - ./config:/config
      - ./default.conf:/config/nginx/site-confs/default.conf
    environment:
      - [email protected]
      - URL=yourdomain.com
      - VALIDATION=http
      - TZ=America/Los_Angeles
      - PUID=1000
      - PGID=1000
    ports:
      - "443:443"
      - "80:80"
    mem_limit: 128m

  wordpress:
    build:
      context: .
      dockerfile: wordpress.Dockerfile
    container_name: wordpress
    hostname: wordpress
    depends_on:
      - db
    restart: always
    ports:
      - "127.0.0.1:8080:80"
    volumes:
      - ./www/:/var/www/html/
      - ./custom.ini:/usr/local/etc/php/conf.d/custom.ini
      - ./mpm_prefork.conf:/etc/apache2/mods-available/mpm_prefork.conf
    environment:
      WORDPRESS_DB_HOST: db
      WORDPRESS_DB_USER: ${MYSQL_USER}
      WORDPRESS_DB_PASSWORD: ${MYSQL_PASSWORD}
      WORDPRESS_DB_NAME: ${MYSQL_DATABASE}
      WORDPRESS_CONFIG_EXTRA: |
        define( 'WP_MEMORY_LIMIT', '96M' );
    mem_limit: 300m

  db:
    image: mysql:8.0
    container_name: db
    volumes:
      - /var/lib/mysql:/var/lib/mysql
      - ./mysql.cnf:/etc/mysql/conf.d/lowmem.cnf
    restart: always
    ports:
      - "127.0.0.1:3306:3306"
    environment:
      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
      MYSQL_DATABASE: ${MYSQL_DATABASE}
      MYSQL_USER: ${MYSQL_USER}
      MYSQL_PASSWORD: ${MYSQL_PASSWORD}
    mem_limit: 128m

Why 127.0.0.1 on ports? Docker manipulates iptables directly, bypassing UFW. Without the 127.0.0.1: prefix, ports 3306 and 8080 would be publicly accessible even if UFW blocks them. Binding to localhost ensures only local connections and the swag reverse proxy can reach these services.

Why /var/lib/mysql on the host? Mounting the MySQL data directory directly on the host (rather than in a named Docker volume) means the database survives container removal and is easy to access for backups via mysqldump.

wordpress.Dockerfile

A custom Dockerfile that pre-installs cron into the WordPress image. This avoids running apt-get install on every container restart, which is slow and fragile:

FROM wordpress:latest

RUN apt-get update && \
    apt-get install -y --no-install-recommends cron && \
    rm -rf /var/lib/apt/lists/*

RUN echo '* * * * * www-data php /var/www/html/index.php -- wpaicg_builder=yes' > /etc/cron.d/wp-cron && \
    chmod 0644 /etc/cron.d/wp-cron

CMD ["sh", "-c", "cron && docker-entrypoint.sh apache2-foreground"]

default.conf (nginx with security headers)

Redirects HTTP → HTTPS, proxies everything to the WordPress container, and adds a full set of security headers:

server {
    listen 80;
    listen [::]:80;
    server_name _;
    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl http2 default_server;
    listen [::]:443 ssl http2 default_server;

    root /var/www/html/example;
    index index.html index.htm index.php;

    server_name _;

    include /config/nginx/proxy-confs/*.subfolder.conf;
    include /config/nginx/ssl.conf;

    client_max_body_size 64m;

    # Security headers
    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
    add_header X-Content-Type-Options "nosniff" always;
    add_header X-Frame-Options "SAMEORIGIN" always;
    add_header Referrer-Policy "strict-origin-when-cross-origin" always;
    add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always;
    proxy_hide_header X-Powered-By;

    location / {
        try_files $uri $uri/ /index.php?$args @app;
    }

    location @app {
        proxy_pass http://wordpress;
        proxy_set_header Host $host;
        proxy_redirect off;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto https;
        proxy_set_header X-Real-IP $remote_addr;
    }
}

The security headers do the following:

Header What it does
Strict-Transport-Security Forces browsers to always use HTTPS for your domain
X-Content-Type-Options Prevents browsers from MIME-type sniffing (blocks attacks that disguise scripts as images)
X-Frame-Options Prevents your site from being embedded in iframes on other sites (clickjacking protection)
Referrer-Policy Controls how much URL info is sent when users click links to other sites
Permissions-Policy Explicitly disables access to camera, microphone, and geolocation APIs
proxy_hide_header X-Powered-By Strips the PHP version header — less info for attackers

custom.ini (PHP overrides)

file_uploads = On
memory_limit = 128M
upload_max_filesize = 64M
max_input_vars = 3000
post_max_size = 64M
max_execution_time = 600

mpm_prefork.conf (Apache worker limits)

Apache's default settings spawn up to 150 workers. On a 1 GB VM each PHP worker uses ~30 MB, so the default would consume all available memory. Cap it at 4:

<IfModule mpm_prefork_module>
    StartServers            2
    MinSpareServers         1
    MaxSpareServers         3
    MaxRequestWorkers       4
    MaxConnectionsPerChild  200
</IfModule>

For a personal or low-traffic site, 4 concurrent requests is plenty. If you start seeing 503 errors under load, raise MaxRequestWorkers and bump the mem_limit in docker-compose.yml.

mysql.cnf (MySQL 8.0 memory tuning)

MySQL's defaults assume a dedicated server with gigabytes of RAM. These settings bring it down to ~40 MB idle on a shared 1 GB host:

[mysqld]
# InnoDB — default is 128M, 32M is plenty for a small WordPress site
innodb_buffer_pool_size         = 32M
innodb_log_file_size            = 8M
innodb_flush_method             = O_DIRECT

# Disabling performance_schema saves ~400MB at default settings
performance_schema              = OFF

# Reduce caches from their large defaults
table_open_cache                = 64
thread_cache_size               = 4
thread_stack                    = 256K

# Per-connection buffers (only allocated when in use)
read_buffer_size                = 128K
read_rnd_buffer_size            = 128K
sort_buffer_size                = 256K
join_buffer_size                = 256K

Note: thread_stack must be at least 256K for MySQL 8.0 (128K worked in 5.7 but causes stack overflows in 8.0). The query_cache settings from MySQL 5.7 have been removed entirely — MySQL 8.0 dropped the query cache feature.


9. Start the stack

cd ~/mysite
sudo docker compose up -d

Watch the logs to make sure everything comes up:

sudo docker compose logs -f

On first start, swag will:

  1. Request a Let's Encrypt certificate for your domain (takes ~30 seconds)
  2. Start nginx with HTTPS enabled

You should see mysqld: ready for connections in the db logs and then the WordPress container come up. Once swag shows Server ready, visit https://yourdomain.com.

If Let's Encrypt fails, check that your DNS A record has propagated and that ports 80/443 are open in GCP's firewall.


10. Finish WordPress setup

Navigate to https://yourdomain.com — you'll see the WordPress installation wizard.

  1. Choose your language
  2. Enter site title, admin username, password, and email
  3. Click Install WordPress

You're done. Your site is live at https://yourdomain.com with a valid SSL certificate that renews automatically.


11. Set up email alerts

Get notified when backups fail or updates have issues. We'll use msmtp — a lightweight SMTP client that sends through Gmail.

Create a Gmail app password

  1. Go to myaccount.google.com/apppasswords
  2. Select Mail and Other (custom name), enter "Server alerts"
  3. Copy the 16-character app password

Install and configure msmtp

sudo DEBIAN_FRONTEND=noninteractive apt install -y msmtp msmtp-mta

Create ~/.msmtprc:

defaults
auth           on
tls            on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
logfile        ~/.msmtp.log

account        gmail
host           smtp.gmail.com
port           587
from           [email protected]
user           [email protected]
password       YOUR_APP_PASSWORD_HERE

account default : gmail
chmod 600 ~/.msmtprc

Test it:

echo "Test alert from $(hostname)" | msmtp [email protected]

The msmtp-mta package creates a sendmail symlink, so the backup and auto-update scripts can use sendmail to send alerts without any additional configuration.


12. Set up backups

This backup system dumps MySQL daily and backs up all site files to a Google Cloud Storage bucket using duplicity (incremental backups, ~6 months of history).

Create a GCS bucket

In the GCP console:

  1. Go to Cloud Storage → Create bucket
  2. Name it something unique (e.g. mysite-backup-abc123)
  3. Region: same region as your VM
  4. Storage class: Standard
  5. Leave public access blocked

The first 5 GB of GCS storage is free per month. A WordPress backup set is typically well under that.

Install backup tools

sudo apt install -y duplicity python3-pip gcsfuse

gcsfuse lets you mount the GCS bucket as a local filesystem so duplicity can write to it. Authentication uses the VM's service account automatically — no key file needed.

Create directories

mkdir -p ~/backup-bucket   # GCS mount point
mkdir -p ~/mysqldump

Write the backup script

Save this as ~/backup and make it executable (chmod +x ~/backup). Replace YOUR_BUCKET_NAME and [email protected]:

#!/bin/bash
set -uo pipefail
#
# backup — daily backup for mysite
# Dumps MySQL, backs up ~/mysite to GCS via duplicity.
# Run as your regular user (NOT sudo) — gcsfuse needs user permissions.
# Schedule: 0 0 * * * ~/backup > ~/backup.log 2>&1
#

NOTIFY_EMAIL="[email protected]"
WD="$HOME"
BUCKET="YOUR_BUCKET_NAME"
BACKUP_DEST="file://$WD/backup-bucket/backups"

# Load database credentials from .env
source "$WD/mysite/.env"

log()  { echo "[$(date '+%Y-%m-%d %H:%M:%S')] $*"; }

fail() {
    log "ERROR: $*"
    local msg="Backup failed on $(hostname) at $(date): $*"
    if command -v sendmail &>/dev/null; then
        printf "Subject: Backup FAILED\nTo: %s\n\n%s\n" "$NOTIFY_EMAIL" "$msg" \
            | sendmail "$NOTIFY_EMAIL"
    fi
    mount | grep -q "$WD/backup-bucket" && fusermount -u "$WD/backup-bucket"
    exit 1
}

log "Backup started"

# 1. Mount GCS bucket
if mount | grep -q "$WD/backup-bucket"; then
    log "Already mounted."
else
    gcsfuse "$BUCKET" "$WD/backup-bucket" || fail "gcsfuse mount failed"
fi

# 2. Dump MySQL
log "Dumping MySQL..."
mysqldump --opt -h localhost --protocol=tcp \
    --user="root" --password="$MYSQL_ROOT_PASSWORD" \
    "$MYSQL_DATABASE" > "$WD/mysqldump/database.sql" \
    || fail "mysqldump failed"
log "Dump size: $(du -sh $WD/mysqldump/database.sql | cut -f1)"

# 3. Clean up any incomplete previous backup
duplicity cleanup --force --no-encryption "$BACKUP_DEST" \
    || log "WARNING: cleanup returned non-zero (may be harmless)"

# 4. Incremental backup (full if last full is >1 month old)
log "Running duplicity backup..."
duplicity --progress --no-encryption \
    --exclude "$WD/backup-bucket" \
    --full-if-older-than 1M \
    "$WD" "$BACKUP_DEST" \
    || fail "duplicity failed"

# 5. Prune old chains — keep 6 fulls (~6 months)
duplicity remove-all-but-n-full 6 --force --no-encryption "$BACKUP_DEST" \
    || log "WARNING: prune returned non-zero (may be harmless)"

# 6. Unmount
fusermount -u "$WD/backup-bucket" || log "WARNING: unmount failed"

log "Backup completed successfully"

Key improvements over a basic backup script:

  • set -uo pipefail — catches unset variables and pipe failures
  • Credentials loaded from .env — no passwords hardcoded in the script
  • Email alerts on failure via sendmail (provided by msmtp)
  • 6-month retention keeps backup size manageable (~11 GB for a typical WordPress site)

Important: Run the backup script as your regular user, not with sudo. Running as root causes gcsfuse permission issues because the mount point ownership changes.

Test it manually before scheduling:

~/backup
cat ~/backup.log

13. Set up auto-updates

Automate WordPress, Docker, and OS updates with a weekly script. Save this as ~/auto-update and make it executable:

#!/bin/bash
set -uo pipefail
#
# auto-update — weekly WordPress, Docker, and OS updates
# Run as your regular user (NOT sudo).
# Schedule: 0 2 * * 0 ~/auto-update > ~/auto-update.log 2>&1
#

NOTIFY_EMAIL="[email protected]"
SITE_DIR="$HOME/mysite"
COMPOSE="docker compose -f $SITE_DIR/docker-compose.yml"
SITE_URL="https://yourdomain.com"
HAD_ERRORS=false

log()  { echo "[$(date '+%Y-%m-%d %H:%M:%S')] $*"; }
warn() { log "WARNING: $*"; HAD_ERRORS=true; }

# Load database credentials from .env
source "$SITE_DIR/.env"

wpcli() {
    docker run --rm \
        -v "$SITE_DIR/www":/var/www/html \
        --network mysite_default \
        -e WORDPRESS_DB_HOST=db \
        -e WORDPRESS_DB_USER="$MYSQL_USER" \
        -e WORDPRESS_DB_PASSWORD="$MYSQL_PASSWORD" \
        -e WORDPRESS_DB_NAME="$MYSQL_DATABASE" \
        wordpress:cli wp --allow-root "$@"
}

# Pre-flight: verify Docker access
docker info &>/dev/null || { log "ERROR: Cannot access Docker. Is $USER in the docker group?"; exit 1; }

# Verify site is up before starting
curl -sf "$SITE_URL" > /dev/null || { log "ERROR: Site is down before updates — aborting"; exit 1; }

log "Auto-update started"

# 1. WordPress updates via WP-CLI
log "Updating WordPress core..."
output=$(wpcli core update 2>&1) && log "$output" || warn "Core update issue: $output"

log "Updating plugins..."
output=$(wpcli plugin update --all 2>&1) && log "$output" || warn "Plugin update issue: $output"

log "Updating themes..."
output=$(wpcli theme update --all 2>&1) && log "$output" || warn "Theme update issue: $output"

# 2. Health check after WordPress updates
if ! curl -sf "$SITE_URL" > /dev/null; then
    warn "Site is DOWN after WordPress updates — skipping Docker/OS updates"
    # Send alert and exit
    if command -v sendmail &>/dev/null; then
        printf "Subject: Auto-update FAILED — site down\nTo: %s\n\n%s\n" \
            "$NOTIFY_EMAIL" "Site went down after WordPress updates. Check immediately." \
            | sendmail "$NOTIFY_EMAIL"
    fi
    exit 1
fi

# 3. Docker image updates
log "Pulling Docker images..."
$COMPOSE pull 2>&1 | while read -r line; do log "$line"; done
log "Recreating containers..."
$COMPOSE down && $COMPOSE up -d --build
sleep 15

# 4. OS updates
log "Running apt upgrade..."
sudo apt update -qq && sudo apt upgrade -y -qq 2>&1 | while read -r line; do log "$line"; done

# 5. Clean up
log "Pruning unused Docker images..."
docker image prune -f 2>&1 | while read -r line; do log "$line"; done

# 6. Send summary email
SUBJECT="Auto-update complete"
$HAD_ERRORS && SUBJECT="Auto-update complete (WARNINGS)"

if command -v sendmail &>/dev/null; then
    {
        printf "Subject: %s\nTo: %s\n\n" "$SUBJECT" "$NOTIFY_EMAIL"
        cat ~/auto-update.log
    } | sendmail "$NOTIFY_EMAIL"
fi

log "Auto-update finished"

Schedule both scripts with cron

crontab -e

Add:

# Daily backup at midnight
0 0 * * * /home/YOUR_USERNAME/backup > /home/YOUR_USERNAME/backup.log 2>&1

# Weekly auto-update: Sundays at 2am
0 2 * * 0 /home/YOUR_USERNAME/auto-update > /home/YOUR_USERNAME/auto-update.log 2>&1

Important: Both scripts must run as your regular user (not root). Your user must be in the docker group (sudo usermod -aG docker $USER).


14. Maintenance

Check container status and memory

sudo docker compose -f ~/mysite/docker-compose.yml ps
sudo docker stats --no-stream

View logs

sudo docker compose -f ~/mysite/docker-compose.yml logs --tail=50 db
sudo docker compose -f ~/mysite/docker-compose.yml logs --tail=50 wordpress
sudo docker compose -f ~/mysite/docker-compose.yml logs --tail=50 swag

Restart a container

sudo docker compose -f ~/mysite/docker-compose.yml restart wordpress

Update WordPress manually (plugins, themes, core)

Easiest via the admin dashboard at https://yourdomain.com/wp-admin.

For command-line updates using WP-CLI (runs as a temporary container — nothing to install):

wpcli() {
    sudo docker run --rm \
        -v ~/mysite/www:/var/www/html \
        --network mysite_default \
        -e WORDPRESS_DB_HOST=db \
        -e WORDPRESS_DB_USER=wp_db_user \
        -e WORDPRESS_DB_PASSWORD=YOUR_APP_DB_PASSWORD \
        -e WORDPRESS_DB_NAME=wp_db \
        wordpress:cli wp --allow-root "$@"
}

wpcli core version
wpcli core update
wpcli plugin update --all
wpcli theme update --all

Update Docker images manually

# Pull latest images and rebuild
sudo docker compose -f ~/mysite/docker-compose.yml pull
sudo docker compose -f ~/mysite/docker-compose.yml down
sudo docker compose -f ~/mysite/docker-compose.yml up -d --build

# Clean up old images
sudo docker image prune -f

Restore from backup

To restore the database from the latest backup:

# Mount bucket
gcsfuse YOUR_BUCKET_NAME ~/backup-bucket

# Extract the database dump
duplicity restore \
    --no-encryption \
    --file-to-restore mysqldump/database.sql \
    file://$HOME/backup-bucket/backups \
    /tmp/database.sql

# Import it
mysql -h localhost --protocol=tcp -u root -pYOUR_ROOT_DB_PASSWORD wp_db < /tmp/database.sql

To restore WordPress files or restore from a specific date, swap in the appropriate --file-to-restore path and add --time "2025-06-01".

SSL certificates

Let's Encrypt certificates renew automatically inside the swag container. No action needed. To check renewal status:

sudo docker logs swag 2>&1 | grep -i "cert\|renew\|expire" | tail -10

OS updates

sudo apt update && sudo apt upgrade -y

# Check if a reboot is required
[ -f /var/run/reboot-required ] && echo "REBOOT NEEDED" || echo "No reboot needed"

# If a kernel update was installed — containers restart automatically via restart: always
sudo reboot

15. How the memory budget works

The e2-micro has 1 GB RAM. Here's how it's allocated at idle:

Component Idle usage Hard limit
OS + Docker daemon ~200 MB —
swag (nginx) ~42 MB 128 MB
wordpress (Apache + PHP) ~142 MB 300 MB
db (MySQL 8.0) ~58 MB 128 MB
Total ~442 MB ~756 MB

This leaves ~250 MB of headroom before the 1 GB ceiling. Under load, Apache spawns up to 4 PHP workers (capped by mpm_prefork.conf), each using ~30 MB — so peak WordPress memory is around 250 MB, still under the 300 MB container limit.

If a container ever exceeds its mem_limit, the kernel OOM-kills it and Docker immediately restarts it (restart: always). Check with sudo docker stats --no-stream if the site feels slow.

The three biggest memory levers, in order of impact:

  1. performance_schema = OFF in mysql.cnf — saves up to 400 MB
  2. MaxRequestWorkers 4 in mpm_prefork.conf — caps Apache worker count
  3. innodb_buffer_pool_size = 32M in mysql.cnf — cuts InnoDB cache from 128 MB

16. Troubleshooting

"Error establishing a database connection"

# Check if the db container is running
sudo docker compose -f ~/mysite/docker-compose.yml ps

# If it's missing, start it
sudo docker compose -f ~/mysite/docker-compose.yml up -d db

# Check db logs for errors
sudo docker compose -f ~/mysite/docker-compose.yml logs --tail=30 db

# Test connection directly
mysql -h 127.0.0.1 -P 3306 -u root -pYOUR_ROOT_DB_PASSWORD -e "SELECT 1;"

Let's Encrypt certificate fails on first start

  • Verify DNS has propagated: dig +short yourdomain.com should return a Cloudflare IP
  • Verify GCP firewall has port 80 open (required for HTTP-01 challenge)
  • Check swag logs: sudo docker compose logs swag

Site is slow or returning 503

# Check memory — is any container near its limit?
sudo docker stats --no-stream

# Check Apache worker count inside the wordpress container
sudo docker exec wordpress apache2ctl status

If memory is tight, the safest fix is to upgrade the VM to e2-small (2 GB RAM, ~$17/month) rather than loosening the memory caps.

Site returns 500 after a plugin update

# Check for PHP errors
sudo docker logs wordpress 2>&1 | grep "PHP Fatal" | tail -10

# Disable the offending plugin by renaming its directory
sudo mv ~/mysite/www/wp-content/plugins/PLUGIN_NAME{,.disabled}

# Restart WordPress
sudo docker compose -f ~/mysite/docker-compose.yml restart wordpress

Backup script fails with permission errors

Most likely you ran it with sudo. The backup script must run as your regular user — gcsfuse mounts with user-level permissions that break when root takes over:

# Wrong
sudo ~/backup

# Right
~/backup

Docker bypasses your firewall

Docker manipulates iptables directly, bypassing UFW. If you expose a port in docker-compose.yml without the 127.0.0.1: prefix, it's publicly accessible regardless of UFW rules. Always bind non-public ports to localhost:

# Bad — publicly accessible even with UFW blocking 3306
ports:
  - "3306:3306"

# Good — only accessible from the host
ports:
  - "127.0.0.1:3306:3306"
]]>
https://jphein.com/how-to-host-wordpress-for-free-with-gcp-and-docker/feed/ 0 12199
How to form a nonprofit in California https://jphein.com/how-to-form-a-nonprofit-in-california/ https://jphein.com/how-to-form-a-nonprofit-in-california/#respond Fri, 03 Feb 2023 07:23:02 +0000 https://jphein.com/?p=11124 Updated guide: This 2023 post is kept for reference, and some of its fees have changed. The current, checked version is at TechPorch.org: Starting a nonprofit in California (checked November 16, 2026).

The most common type of charitable nonprofit organization is a 501(c)(3) organization, also known as a public charity. These organizations are exempt from federal income tax and are eligible to receive tax-deductible donations. The most common type of 501(c)(3) organizations are those that focus on providing education, health care, social services, or other types of charitable work.

Cost

For small starting organizations, the actual fees for starting a nonprofit can be relatively low, especially if the organization takes advantage of online filing options and does not require extensive legal or tax services. However, it’s important to keep in mind that even small nonprofits must still comply with all applicable laws and regulations, and it may be necessary to invest in professional services to ensure compliance and ensure the long-term success of the organization.

FeeDescriptionAmount
Domain name registrationFees for registering a domain name for the nonprofit’s website$10 per year
Secretary of State name reservation fee (optional)Fees for reserving the name of the nonprofit with the California Secretary of State$10
State filing fee (online)Filing fee for registering the nonprofit with the California Secretary of State (online)Free
State filing fee (paper copy) (optional)Filing fee for registering the nonprofit with the California Secretary of State (paper copy)$5
Employer Identification Number (EIN)Federal tax ID number required for opening a bank account and filing taxesFree
Bank account setupFees for opening a business bank account for the nonprofitFree
Form 1023 filing feeFiling fee for obtaining tax-exempt status from the IRS$0 (for most small nonprofits) or $600
California Franchise Tax Board feeFiling fee for obtaining tax-exempt status from the California Franchise Tax Board$25
Filing a Statement of Information (Form SI-100)For providing updated information about your nonprofit to the California Secretary of State. You have 90 days to do this.$20, every two years
Starting a nonprofit can involve additional costs beyond those listed in the fees table, such as hiring a lawyer for legal advice, a tax professional for guidance on tax-exempt status and tax reporting, obtaining any necessary business licenses, and purchasing insurance to protect the organization and its directors and officers. These costs can vary depending on the size and complexity of the organization, and it’s always a good idea to consult with a professional or an attorney to get an accurate estimate of all the costs associated with starting a nonprofit.

Making Decisions and Filling out Forms

Establish your mission

How are you going to help? Your business may not engage in political activities and must not overcompensate its members. For Example:

“Our mission is to empower youth in underserved communities by providing access to education, mentorship, and leadership development opportunities. We believe that every young person has the potential to succeed and make a positive impact in their communities, and we strive to create a supportive and inclusive environment that helps them achieve their goals. Through our programs and partnerships, we aim to break down barriers to success and create a more equitable and just society for all.”

Take the nonprofit startup assessment tool

The Nonprofit Startup Assessment Tool is a resource provided by Candid, a nonprofit organization that provides tools and information for nonprofits and philanthropy. The tool is designed to help individuals and organizations that are considering starting a nonprofit understand the steps and considerations involved in the process.

To access the tool, simply follow the link below and scroll down to the “Nonprofit Startup Resources” section. From there, you can click on the “Startup Assessment Tool” link to begin the assessment. The tool will walk you through a series of questions about your organization and provide customized guidance based on your responses.

https://learning.candid.org/resources/nonprofit-startup-resources/

Remember that the tool is just a starting point, and there are many other resources available to help you start and run a successful nonprofit. Good luck on your nonprofit journey!

Find a mentor

🤝 Looking for expert guidance in starting or growing your nonprofit organization? SCORE.org can help! 🌟

SCORE is a national nonprofit organization that provides free mentoring services to small business owners and entrepreneurs, including those in the nonprofit sector. Their experienced mentors can offer valuable insights and guidance on a wide range of topics, from business planning and fundraising to marketing and strategic growth.

To request a mentor for your nonprofit organization, simply visit their website and fill out the Mentor Request Form. This form will help pair you with the best mentor based on your specific needs and goals.

Don’t navigate the world of nonprofit entrepreneurship alone – let SCORE help you achieve your goals! Contact them today to get started. 💻🤝

Visit their website to learn more and fill out the form: https://www.score.org/find-mentor/request-mentor

Create a nonprofit ecosystem blueprint

📝 A nonprofit ecosystem blueprint is like a business model canvas for nonprofits 🌱

It helps break down key components such as 💡value proposition, 🎯target beneficiaries, 🔑key activities, 💰revenue streams and 🔌partnerships. This helps develop a more comprehensive understanding of the organization and create a clear vision, well-designed strategy, and necessary resources to achieve your goals.

CategoryDescription
KEY PARTNERSList of organizations, gov’t offices, or individuals to partner with
PROGRAMMINGDetails on the programming provided to fulfill the mission
ORGANIZATIONAL VALUEExplanation of why the organization is uniquely suited to fulfill its mission and the problems it’s trying to solve
CONSUMER RELATIONSHIPSStrategies for finding consumers to access the programming
CONSUMER SEGMENTSDescription of the key demographic for the programming
KEY RESOURCESPhysical space, staff, and tools needed to fulfill the mission
OUTREACHStrategies for marketing the organization to consumers and funders
COST STRUCTUREDescription of the most expensive elements of the organization and costs that vary with consumer volume
FUNDINGOverview of the organization’s funding sources, including committed funding, grants, contracts, and consumer payments

👉 Check out this free PDF template to create your own nonprofit ecosystem blueprint: https://drive.google.com/file/d/1mL7Y2UI-Axr50HB95T2imbid9TC5gc1O/view?usp=sharing

This is a presentation: https://prezi.com/wwlfmc-poqfn/nonprofit-ecosystem-blueprint/#

Creating a nonprofit ecosystem blueprint can help you communicate your organization’s vision and strategy to stakeholders and ensure that you have a clear path forward for success. 🚀

Choose a name

  1. Choose a name for your nonprofit 💡: Make sure the name you choose is not already in use by another organization in California by checking the California Secretary of State’s database:
    https://bizfileonline.sos.ca.gov/search/business ⚙
  2. Optional: Reserve your chosen name with the California Secretary of State 📄: If the name you’ve chosen is available, you can reserve it with the California Secretary of State by filing a name reservation request. This will prevent someone else from using the same name while you’re completing the other steps in creating your nonprofit. The fee for reserving a name in California is currently $10.00.
    • To reserve your chosen name with the California Secretary of State, you’ll need to follow these steps:
    • a. Complete the Name Reservation Request form: You can find the form on the California Secretary of State’s website:
      https://bizfileonline.sos.ca.gov/forms/business
    • b. Submit the form and fee: You can submit the form and fee by mail or in person at the California Secretary of State’s office. You can find more information on submitting the form and fee on the California Secretary of State’s website.
    • Once your name reservation request is approved, your chosen name will be reserved for 60 days, giving you time to complete the other steps in creating your nonprofit.
  3. You’ll also want to make sure that the website domain name is available, so you can check availability on a domain registrar such as Google Domains:
    https://domains.google.com/registrar/search 🌐
    To register your domain name, you’ll need to follow these steps:
    • a. Search for your desired domain name: Use the search function on the domain registrar’s website to check if your desired domain name is available.
    • b. Choose a domain extension: Choose a domain extension, such as .org, .com, .net, etc.
    • c. Complete the registration process: Fill out the necessary information and complete the registration process by paying the fee.
    • Once your domain name is registered, you’ll have a unique web address for your nonprofit, which you can use to create a website and establish an online presence.

File

File the Articles of Incorporation with the California Secretary of State 💼: To officially create your Nonprofit Public Benefit Corporation in California, you’ll need to file Articles of Incorporation with the California Secretary of State. The Articles of Incorporation must include specific information about your nonprofit, including its name, purpose, and the names and addresses of the incorporators. You can find the form for the Articles of Incorporation on the California Secretary of State’s website:
https://www.sos.ca.gov/business-programs/business-entities/forms/

Once you’ve completed the Articles of Incorporation and submitted them along with the required fee to the California Secretary of State, your Nonprofit Public Benefit Corporation will be officially recognized in California.

The next steps are:

  1. Obtain an Employer Identification Number (EIN) from the IRS 💼: Your nonprofit will need an EIN, also known as an Employer Identification Number, in order to open a bank account, file taxes, and engage in other financial transactions. You can obtain an EIN from the IRS for free by completing Form SS-4: https://www.irs.gov/forms-pubs/about-form-ss-4 or online at https://sa.www4.irs.gov/modiein/individual/index.jsp
  2. Open a bank account for your nonprofit 💰: Once you have obtained an EIN, you can open a bank account for your nonprofit. You’ll need to provide the bank with your nonprofit’s name, EIN, and formation documents, as well as the names and addresses of the individuals who will have signing authority on the account.
  3. File for tax-exempt status with the IRS 💸: To be recognized as a tax-exempt nonprofit by the IRS, you’ll need to file for tax-exempt status. The type of form you’ll need to file will depend on the type of nonprofit you’re forming, but the most common form for a 501(c)(3) organization is Form 1023:
    https://www.irs.gov/forms-pubs/about-form-1023 More info: http://www.501c3book.com/www.form1023help.com.html and https://form1023.org/
  4. File for tax-exempt status with the California Franchise Tax Board 💰: If your nonprofit is exempt from federal income tax, you may also be exempt from paying the annual franchise tax fee in California. To claim this exemption, you’ll need to file for tax-exempt status with the California Franchise Tax Board. The fee for filing for tax-exempt status with the California Franchise Tax Board is $25.00. You can find more information on the process of obtaining tax-exempt status in California, including the required forms and fees, on the California Franchise Tax Board website:
    https://www.ftb.ca.gov/forms/misc/927.html
  5. File Statement of a nonprofit corporation is required to file an initial Statement of Information (Form SI-100) within 90 days of filing the Articles of Incorporation with the California Secretary of State. This statement must include information such as the name of the nonprofit, the registered agent’s name and address, the names and addresses of the directors, and the address of the principal office and mailing address of the business.

Note: Charitable organizations that are exempt from federal income tax under section 501(c)(3) of the Internal Revenue Code and that have annual gross receipts that are normally less than or equal to $50,000 💰 are exempt from the $800 state tax minimum, but you must file an exemption detailed above.

Governance

Step 2 in creating a nonprofit organization in California involves establishing the governance structure of your nonprofit. This includes creating bylaws and electing a board of directors. Here are the steps involved in step 2:

  1. Draft bylaws 📝: Bylaws are the internal rules and regulations that govern the operation of your nonprofit. They outline the responsibilities of the board of directors, the duties of the officers, and the procedures for conducting meetings, voting, and making decisions. You can find sample bylaws for nonprofits online or work with an attorney to draft custom bylaws for your organization.
  2. Elect a board of directors 🗳: The board of directors is the governing body of your nonprofit. It is responsible for setting policies, making decisions, and overseeing the operations of the organization. The size of the board, the qualifications for serving on the board, and the terms of office for directors are all outlined in the bylaws.
  3. Hold an organizational meeting 💬: After the bylaws have been adopted and the board of directors has been elected, the board should hold an organizational meeting to adopt policies, elect officers, and make any other decisions necessary to begin the operations of the nonprofit.

Annual Reports and Taxes

I can provide you with a step-by-step explanation of filing annual reports for a nonprofit in California:

  1. Determine the filing deadline: Most states, including California, require nonprofits to file an annual report with the Secretary of State. The due date for filing the annual report in California is the 15th day of the 4th month after the close of the fiscal year.
  2. Gather information: Before filing the annual report, gather information about the organization’s activities and financial information for the previous year. This information should be accurate and up-to-date.
  3. File the report: The annual report can be filed online through the California Secretary of State’s website. The fee for filing an annual report in California is $30.
  4. Confirm receipt: After filing the annual report, wait for confirmation from the California Secretary of State that the report has been received and processed.

It is important to note that the annual report is a critical document for maintaining a nonprofit’s good standing with the state. Filing the report on time and with accurate information is essential to preserving the organization’s tax-exempt status. More info here: https://calnonprofits.org/resources/nonprofit-compliance-checklist and here: https://www.irs.gov/pub/irs-pdf/p4221pc.pdf

Taxes

Filing your first tax return as a nonprofit can be a complex process, but with the right preparation and guidance, it can be manageable. Here is a step-by-step guide to help you file your first tax return as a nonprofit:

  1. Determine your tax-exempt status: The first step in filing your tax return is to determine your tax-exempt status. Most nonprofits are exempt from federal income tax under section 501(c)(3) of the Internal Revenue Code.
  2. Choose a tax year: Nonprofits must choose a tax year, which is the 12-month period used to calculate the organization’s taxable income. The most common tax year for nonprofits is the calendar year (January 1 to December 31).
  3. Gather financial information: Before you can file your tax return, you will need to gather financial information for the tax year, including revenue, expenses, and any other financial transactions.
  4. Choose the right form: The most common tax form for nonprofits is Form 990. This form provides information about the organization’s activities, financial information, and governance. Depending on the size of the organization, you may need to file a different form, such as Form 990-EZ or Form 990-N (also known as the e-Postcard).
  5. Complete the form: Complete the form with the financial information and other required information. You may need to consult with an accountant or tax professional to help you complete the form.
  6. File the return: File the tax return with the IRS by the deadline, which is usually 5 months after the end of the tax year.
  7. Maintain records: Keep a copy of the tax return and any supporting documentation for at least 3 years in case the IRS needs to review your return.

By following these steps, you can successfully file your first tax return as a nonprofit and maintain your tax-exempt status. It’s important to note that the specific requirements and procedures may vary depending on the specifics of your organization, so it’s always a good idea to consult with a professional or an attorney to ensure that you are meeting all the necessary requirements.

Support

Nevada County

The Community Foundation of Nevada County 🌐 https://www.nevcofoundation.org/ 💼 is a nonprofit organization that supports community organizations, schools, and individuals in the Nevada County area of California. 🌲🌻🌄

🖥 Sierra Small Business Development Center’s webinars! https://www.sierrasbdc.com/webinars/ Sierra SBDC offers a variety of free online webinars that cover topics such as business planning, social media marketing, and financial management. These webinars are designed to help small business owners and entrepreneurs develop the knowledge and skills they need to succeed. With expert instructors and a wealth of practical insights, Sierra SBDC’s webinars are a great way to stay up-to-date with the latest best practices and trends. Visit their website to see the upcoming schedule and register for a webinar today! 💻👨‍💼

California

  1. California Association of Nonprofits 🌐 https://calnonprofits.org/ 💼: The California Association of Nonprofits provides advocacy, resources, and training to help nonprofits succeed in California.
  2. Northern California Grantmakers 🌐 https://ncg.org/ 💼: Northern California Grantmakers provides resources and support to help nonprofits in Northern California.
  3. Philanthropy California 🌐 https://www.philanthropyca.org/ 💼: Philanthropy California provides resources and support to help nonprofits and foundations in California.
  4. The Law Foundation of Silicon Valley 🌐 https://www.lawfoundation.org/ 💼: The Law Project of Silicon Valley provides legal services and support to help nonprofits and other community organizations.
  5. Center for Volunteer & Nonprofit Leadership 🌐 https://www.cvnl.org/ 💼: The Center for Volunteer & Nonprofit Leadership provides training, resources, and support to help nonprofits in Northern California.
  6. Silicon Valley Council of Nonprofits 🌐 https://svcn.org/ 💼: The Silicon Valley Council of Nonprofits provides advocacy, resources, and support to help nonprofits in the Silicon Valley region.
  7. Center for Nonprofit Management 🌐 https://cnmsocal.org/ 💼: The Center for Nonprofit Management provides training, resources, and support to help individuals and organizations start and manage nonprofits in Southern California. They offer a variety of resources and services, including in-person training, consulting, and online resources.

These are just a few examples of nonprofits that offer resources and support to help people start and run nonprofits in California. The specific resources and services offered may vary, but these organizations can be a helpful starting point for those seeking support in California.

Nationwide

  1. Candid 🌐 https://candid.org/ 💼: Candid (formerly known as GuideStar and Foundation Center) is a nationwide nonprofit that provides resources and tools to help individuals and organizations start and manage nonprofits. They offer a variety of training and support programs, including webinars, in-person workshops, and a library of online resources.
  2. SCORE 🌐 https://www.score.org/ 💼: SCORE is a national nonprofit that provides mentoring and resources to help small businesses and nonprofits succeed. They offer free workshops, mentoring, and online resources to help people start and grow nonprofits.
  3. Nonprofit Ready 🌐 https://www.nonprofitready.org/ 💼: Nonprofit Ready is an online platform that provides free training and resources to help individuals and organizations build and strengthen their nonprofits. They offer courses on topics such as fundraising, board governance, and financial management.
  4. Taproot Foundation 🌐 https://taprootfoundation.org/ 💼: Taproot Foundation is a nonprofit organization that connects skilled volunteers with other nonprofits in need of pro bono services. From website design to marketing strategy, Taproot volunteers offer their expertise to help organizations make a bigger impact. Whether you’re a professional looking to give back or a nonprofit in need of support, Taproot Foundation is a fantastic resource. Visit their website to learn more and get involved! 🤝💻
  5. Hurwit & Associates 🌐 https://www.hurwitassociates.com/ 💼:Hurwit & Associates is a leading law firm that specializes in nonprofit law, and their Q&A page is a great resource for anyone looking to start a nonprofit foundation. The page covers a wide range of topics, including incorporation, tax-exempt status, fundraising, and governance.The Q&A format is user-friendly and provides clear, concise answers to some of the most common questions about starting up a nonprofit foundation. Whether you’re just getting started or looking to refine your existing foundation, Hurwit & Associates’ Q&A page is a valuable resource to have on hand. 💻🌟
  6. Nonprofit Technology Network 🌐 https://www.nten.org/ 💼: The Nonprofit Technology Network provides resources, training, and support to help nonprofits use technology effectively. They offer a variety of resources and tools, including webinars, online courses, and an annual conference.
  7. National Council of Nonprofits 🌐 https://www.councilofnonprofits.org/ 💼: The National Council of Nonprofits is a nationwide nonprofit that provides advocacy, education, and resources to help nonprofits thrive. They offer a variety of resources and guides on topics such as starting a nonprofit, fundraising, and board governance.
  8. Independent Sector 🌐 https://independentsector.org/ 💼: Independent Sector is a national nonprofit that provides advocacy, resources, and support to help nonprofits succeed. They offer a variety of resources and tools, including research, policy analysis, and webinars.
  9. BoardSource 🌐 https://boardsource.org/ 💼: BoardSource is a national nonprofit that provides training, resources, and support to help nonprofit boards and board members. They offer a variety of resources and tools, including online courses, publications, and consulting services.
  10. Nonprofit Finance Fund 🌐 https://nff.org/ 💼: The Nonprofit Finance Fund provides financing, consulting, and support to help nonprofits achieve financial sustainability. They offer a variety of financial products and services, including loans, lines of credit, and financial management consulting.
  11. United Way 🌐 https://www.unitedway.org/ 💼: United Way is a national nonprofit that provides resources and support to help individuals and organizations create positive community change. They offer a variety of programs and initiatives, including fundraising campaigns, community engagement programs, and advocacy efforts.

The types of support and resources provided by these nonprofits vary, and not all of the support may be free. Some nonprofits may offer free resources and services, while others may charge a fee for certain programs or services.

For example, some of the resources and training offered by Foundation Center, Nonprofit Ready, and TechSoup are free of charge. Others, such as consulting services or in-depth training programs, may have a fee associated with them.

It’s important to research each nonprofit and the specific resources or programs they offer to determine if there are any associated costs. Some nonprofits may offer scholarships or other forms of financial assistance to help cover the costs of their programs or services.

In general, many nonprofits that offer support to help people start and run nonprofits are committed to providing accessible resources and services to help strengthen the nonprofit sector, so it’s worth exploring the available options to find the best fit for your organization and budget.

More guides

https://www.canva.com/design/DAEBTDbDsFc/IJ698pBYbkcK4rbGdb3Lkw/view#1

https://learning.candid.org/resources/knowledge-base/starting-a-nonprofit/

https://www.score.org/philadelphia/resource/article/nonprofit-resources

]]>
https://jphein.com/how-to-form-a-nonprofit-in-california/feed/ 0 11124
Free Resources for Nonprofits https://jphein.com/free-resources-for-nonprofits/ https://jphein.com/free-resources-for-nonprofits/#respond Wed, 25 Jan 2023 20:19:22 +0000 https://blog.jphein.com/?p=5991 Updated guide: This 2023 list is kept for reference; some of its links have moved or closed. The current, checked version is at TechPorch.org: Free and discounted tools for nonprofits (checked November 16, 2026).

Nevada County
Local Resources

  • The County of Nevada Nonprofit monthly office equipment giveaway. They computer equipment as well as office supplies and furniture. Last Friday of the month at the stoplight warehouse.
  • Briar patch has several programs for nonprofits: https://briarpatch.coop/giving-back/
  • Connect with United Way NC https://uwnc.org/become-a-uwnc-partner
  • Local Volunteer Center 🤝: A resource for finding volunteer opportunities in your local community. People are looking for ways to give back to their community and make a positive impact, some may consider checking out their local volunteer center. These organizations provide a wealth of resources and opportunities for volunteers, including information on local volunteer opportunities, resources for volunteer management and coordination, and training and support for volunteers. To find your local volunteer center, simply search online for “local volunteer center” followed by the name of your city or region.

Regional Resources

  • eScript for local donations at Grocery Stores www.escrip.com
  • CVS grant for giftcards for nonprofits https://www.cvshealth.com/social-responsibility/our-giving
  • Home depot project grants for nonprofits (gift cards) https://corporate.homedepot.com/page/home-depot-foundation
  • Foundation Directory Online 💰: Free access from your local library.
    A database of foundations and grants, available for free through many libraries. Foundation Directory Online is a comprehensive database of foundations and grants, providing valuable information on funding opportunities for nonprofits. This resource is available for free through many libraries, providing organizations with a convenient and affordable way to research funding opportunities and plan their fundraising strategies. To learn more about Foundation Directory Online and how it can help your nonprofit, visit https://fdo.foundationcenter.org/. candid?

Online resources

This is not an exhaustive list, nor is it sorted in any particular order. Although, the ones at the top are more generally useful to the nonprofit. Many of them use techsoup.org to verify nonprofit eligibility.

Technology Help

  • Online Impacts – a 501(c)(3) nonprofit organization that develops/hosts websites, provides digital marketing guidance, and creates technology solutions for impact-based nonprofits – https://onlineimpacts.org/ – Online Impacts is a great resource for nonprofits looking to maximize their impact. They offer comprehensive web development, marketing, and tech solutions to help organizations create meaningful change.
  • NTEN – technology resources for nonprofits – https://www.nten.org/ – NTEN is a nonprofit that provides technology resources, best practices, and training for nonprofits to help them use technology more effectively. They also offer free webinars, conferences, and other events for nonprofits to learn and network.
  • Idealware – tech training for nonprofits – http://idealware.org/ – Idealware provides tech training and resources specifically tailored for nonprofits, making it a great way for organizations to stay up to date on the latest tech tools.
  • Nonprofit Tech for Good An informative blog with easy-to-understand information, news, and resources related to nonprofit technology, online communications, and social and mobile fundraising. https://www.nptechforgood.com/about-nonprofit-tech-for-good/
  • Whole Whale 🐳: A nonprofit digital consultancy with resources and expertise available for free. Whole Whale is a nonprofit digital consultancy that provides a range of resources and expertise to organizations looking to maximize their impact through technology. From website design and development to data analysis and strategy, Whole Whale provides nonprofits with the tools and support they need to succeed in the digital age. And the best part? Their resources and expertise are available for free. To learn more about Whole Whale and how they can help your nonprofit, visit https://wholewhale.com/.
  • Techsoup – discounted software – https://www.techsoup.org/ – Techsoup is a great resource for nonprofits looking to save money on technology. They offer discounted software licenses and hardware, as well as training and other resources to help nonprofits succeed.

Hardware

  • Good360 – donated goods for nonprofits – https://good360.org/ – Good360 is an organization that provides nonprofits with donated goods such as school supplies, clothes, baby items, computers, etc. Their service is free for qualifying nonprofits, and a great way for organizations to get the items they need to succeed.
  • ConnectAll – technology for nonprofits and people with low income – https://connectall.org/ – ConnectAll is a great resource for nonprofits and people with low incomes, offering discounted access to technology resources.

Cloud Services

  • Google – https://www.google.com/nonprofits/
    • Google Workspace for Nonprofits – free productivity suite -https://www.google.com/nonprofits/offerings/workspace/ – Google Workspace for Nonprofitsis a suite of tools designed to help nonprofits collaborate, communicate, and get work done more efficiently. It includes tools like Gmail, Drive, Calendar, Hangouts, and more.
    • Google Ad Grants – free online advertising – https://www.google.com/grants/ – Google Ad Grants is a free online advertising program that helps nonprofits reach new audiences. It provides free ad credits that can be used to promote the organization’s website and message.
    • Youtube Nonprofit Program – https://www.google.com/nonprofits/offerings/youtube-nonprofit-program/ – Engage your supporters using video with the YouTube Nonprofit Program. Unlock the power of video storytelling, so you can reach a global audience and amplify your cause. Plus, make it easy for supporters to give with YouTube Giving features (currently available in the U.S.).
    • Google Earth Nonprofit – https://www.google.com/nonprofits/offerings/google-earth-and-maps/ – Google for Nonprofits provides Google Maps Platform credits to nonprofits. Show your nonprofit’s impact with Google Earth and Maps. Develop compelling data visualizations to track and share your organization’s impact. Plus, use Google Maps Platform to help people locate community programs and resources closest to them.
  • Microsoft
    • Office 365 for Nonprofits – productivity suite – https://www.microsoft.com/en-us/nonprofits – Microsoft Office 365 offer a variety of tools and resources to help nonprofits stay productive and efficient.
    • Azure for Nonprofits – https://www.microsoft.com/en-us/nonprofits/offers-for-nonprofits – Leverage $3,500 (USD) Azure services credits per year and access the complete portfolio of Azure products and cloud services. Sign up for the Nonprofit Azure Onboarding Concierge and Success Center to set up your credits.
  • Canva for Nonprofits – https://www.canva.com/canva-for-nonprofits/– Canva for Nonprofits is a free design tool that allows nonprofits to create beautiful visuals for websites, social media, and other marketing materials.
  • Slack for Nonprofits – https://slack.com/nonprofit – Slack is a great way for teams to communicate and collaborate in real-time. Slack for Nonprofits provides additional features and discounts to help nonprofits stay connected.
  • Asana for Nonprofits – https://asana.com/nonprofits – Asana is a great tool for project management and task organization. Asana for Nonprofits provides discounts and additional features to help nonprofits stay organized.
  • Cloudflare – https://www.cloudflare.com/ – Cloudflare provides reliable and secure web services to nonprofits of all sizes, making it easier for them to reach their audiences and expand their reach online. With its free plan, nonprofits can use a range of services to boost their online presence, including enhanced security, faster page loading times, and improved performance
  • Box.org – free cloud storage for nonprofits – https://www.box.com/industries/non-profit – Box.org provides free cloud storage for nonprofits. It’s a great way for nonprofits to securely store, share,and access data, documents, and other files.
  • CivicChamps – managing volunteers – https://www.civicchamps.com/ – CivicChamps is a great way for nonprofits to recruit, manage, and track volunteers. It offers 50% off to help nonprofits save money.
  • Dreamhost – web host provider – https://www.dreamhost.com/ – Dreamhost is a web host provider that offers free shared website and email hosting for nonprofits. It’s a great way for organizations to save money on web hosting costs.
  • eBay – waives selling fees for Nonprofits – https://charity.ebay.com/for-nonprofits/ – eBay waives their selling fees for nonprofits, making it an easy and cost-effective way to raise money for causes.
  • T-Mobile Network – unlimited Internet 4G WiFi Hotspot for nonprofits for $10/month with $18 for hotspot device – www.mobilebeacon.org/ – The T-Mobile Network offers unlimited 4G internet for nonprofits at a discounted price of $10/month and $18 for a hotspot device.
  • PayPal Giving Fund – donations for nonprofits – https://www.paypal.com/us/webapps/mpp/donations – PayPal Giving Fund is a great way for nonprofits to receive donations from PayPal users. It’s a free service that makes donating easy and secure.
  • Facebook Fundraisers – donations for nonprofits – https://www.facebook.com/fundraisers – Facebook Fundraisers are a great way for nonprofits to reach a larger audience and raise money for their cause. They provide an easy and secure way for users to donate to their favorite nonprofits.
  • Salesforce Nonprofit Cloud – free CRM software – https://www.salesforce.org/nonprofit – Salesforce Nonprofit Cloud is a free Customer Relationship Management (CRM) software designed to help nonprofits build better relationships with their donors and supporters.
  • GitHub Nonprofit Program – free developer tools – https://socialimpact.github.com/ – GitHub Nonprofit Program provides free developer tools and services to help nonprofits build software and manage projects.
  • MailChimp 📧: An email marketing platform with a free plan for nonprofits. Mailchimp offers a range of features including email design templates, automation, and analytics. Nonprofits can send up to 12,000 emails to 2,000 subscribers per month for free. Check it out at: https://mailchimp.com/
  • Hubspot 💼: A comprehensive marketing, sales, and customer service platform with a free nonprofit plan. Hubspot offers a range of features including website builder, email marketing, and a CRM. Nonprofits can access all the tools for free, with no time limits or restrictions. Learn more at: https://www.hubspot.com/
  • Buffer 📊: A social media management tool with a free plan for nonprofits. Buffer allows nonprofits to schedule, publish, and analyze posts on multiple social media platforms from one place. Nonprofits can access the basic plan for free, including support for three social media profiles. Get started at: https://buffer.com/
  • Otter.ai 🎙: An AI-powered tool for transcribing and recording meetings, available for free to nonprofits. Otter.ai uses AI to transcribe and organize audio and video recordings in real-time. Nonprofits can access 600 minutes of transcription per month for free. Find out more at: https://otter.ai/
  • Givelively 💰: A fundraising platform that is free for nonprofits to use. Givelively offers a range of features including online fundraising pages, donation processing, and donor management. Nonprofits can use the platform for free, with no transaction fees or hidden costs. Get started at: https://www.givelively.org/
  • Mobilize 🚀: A platform for organizing volunteer events and campaigns, available for free to nonprofits. Mobilize makes it easy for nonprofits to recruit, manage, and mobilize volunteers. Nonprofits can use the platform for free, with no limits on the number of volunteers or events. Sign up at: https://mobilize.us/
  • LinkedIn 💼: A professional networking platform with a free nonprofit account. LinkedIn is a platform designed for professional networking, connecting millions of professionals from around the world. Nonprofits can take advantage of LinkedIn’s free nonprofit account, which provides access to a wealth of resources and tools to help organizations build their online presence and connect with potential supporters, partners, and collaborators. To learn more about the free nonprofit account offered by LinkedIn, visit https://business.linkedin.com/non-profits.
  • ClickUp 📅: A project management tool with a free plan for nonprofits.ClickUp is a comprehensive project management tool that can help organizations of all sizes streamline their workflows and collaborate more effectively. The tool is available for free to nonprofits, offering a range of features and tools to help organizations stay organized and on track, including task management, project tracking, and team collaboration. To learn more about ClickUp and how it can help your nonprofit, visit https://clickup.com/.
  • Webflow 🌐: A website design and development platform that offers a free plan for nonprofits. With Webflow, nonprofits can create beautiful, functional websites without having to write code. Nonprofits can take advantage of Webflow’s intuitive design tools, extensive design library, and customizable templates to create a website that meets their unique needs. To get started with Webflow, visit https://webflow.com/
  • Codesandbox 💻: A code editor and development environment that is available for free to nonprofits. Codesandbox provides a collaborative environment for developers to create and test their code, making it easier for nonprofits to build and maintain their websites and applications. To access Codesandbox, go to https://codesandbox.io/
  • Twilio.org – https://twilio.org
    Twilio offers free and discounted access for nonprofits to it’s powerful SMS and messaging platform. They are a proud member of the Pledge 1% for companies, redirecting 1% of their profit to social impact. They also run an annual impact fund for funding direct ideas in the community using SMS. More about this on our podcast with Twilio.org.
  • Okta Cloud-based identity management platform for nonprofits. Okta offers a discount to eligible nonprofits, providing up to 50 free licenses for their identity management.platform.https://www.okta.com/nonprofits/
  • Loom 🎥: A screen and camera recording tool with a free plan for nonprofits. Loom is a screen and camera recording tool that makes it easy to capture and share video content with others. The tool is available for free to nonprofits, providing organizations with a convenient and affordable way to create and share videos for a variety of purposes, including fundraising, marketing, and community engagement. To learn more about Loom and how it can help your nonprofit, visit https://www.loom.com/.
  • GrantAdviser – a safe way to anonymously give and receive feedback on grantmaking – https://grantadvisor.org/ – GrantAdviser is a platform that allows nonprofits to review and rate their grantmaking experiences. It provides a safe and anonymous environment to share experiences and feedback that can help other organizations.
  • Charity Navigator is a nonprofit that rates charities in the US based on financial health, accountability, and transparency. Their rating system uses one to four stars. They also offer resources for donors and a paid service for personalized giving recommendations. Visit their website at: 🌐 https://www.charitynavigator.org/

You don’t pay taxes on communication services if you are certain type of nonprofit.

Other ideas

ewaste drives

Further reading

https://www.idealist.org/en/fundraising-resources/free-or-low-cost-services

]]>
https://jphein.com/free-resources-for-nonprofits/feed/ 0 5991
How to secure your custom website, and domain email services for free using Cloudflare https://jphein.com/how-to-secure-your-custom-website-and-domain-email-services-for-free-using-cloudflare/ https://jphein.com/how-to-secure-your-custom-website-and-domain-email-services-for-free-using-cloudflare/#respond Wed, 25 Jan 2023 20:13:35 +0000 https://blog.jphein.com/?p=10166 You want a custom domain for your website and email, but you don’t want to pay someone to manage your email security?

Preparation:

  1. Sign up for a free Gmail.com account
  2. Sign up for Cloudflare.com

Steps:

  1. Register your domain with Cloudflare
  2. Add your website to Cloudflare
  3. Configure DNSEC, SPF, DKIM, and DMARC with Cloudflare
    • DNSEC is easy if your domain is registered with Cloudflare
    • Configure SPF to include Google (support.google.com/googleapps), and your own website IP address.
    • Set up DKIM
    • Set up DMARC
  4. Set up email forwarding in Cloudflare to your Gmail account
  5. Set up “send as” address in Gmail
  6. Test sending and receiving email with your custom domain through your Gmail account
  7. Check your email deliverability score at mail-tester.com

More Reading:

  • help.17hats.com/en/articles/2933143-how-to-set-up-email-forwarding-with-cloudflare
  • dmarcly.com/blog/how-to-use-dmarc-to-protect-your-domain

Note: This guide assumes that you have already signed up for a Gmail account and Cloudflare account.

Email security is important to protect your organization from phishing attacks and email fraud. There are several email security features that you can enable for your custom domain, including DNSSEC, SPF, DKIM, and DMARC. DNSSEC is a security protocol that authenticates DNS data and can help prevent DNS spoofing attacks. SPF is a security protocol that helps to prevent email spoofing by verifying that email messages come from authorized senders. DKIM is a security protocol that uses digital signatures to verify the authenticity of email messages. DMARC is a security protocol that helps to prevent email spoofing by verifying the alignment of SPF and DKIM policies. Enabling these email security features for your custom domain can help to protect you from email fraud and phishing attacks. As well as make sure that your legitimate email is not marked as spam.

Illustration: an envelope, a padlock and an arrow, for securing email and a website

Preparation

Sign up for a free gmail.com account. Google has the best deliverability, and spam filters in my experience. I’d recommend signing up for cloudflare.com as well. They have the lowest cost domain registration as well. $8/year. They have a really good free account for everything else. They can help you set up the below domain, and email settings:

  • DNSSEC
  • SPF
  • DKIM
  • DMARC
  • Email forwarding to your gmail account.

Steps

  1. Sign up for gmail.com, protonmail.com, or your own mail server.
  2. Sign up for cloudlfare.com
  3. Register your domain with cloudflare
  4. Add your website to cloudflare
  5. Configure DNSEC, DKIM, SPF, and DMARC with cloudflare.
    1. DNSEC is easy if domain is registered with cloudflare.
    2. DKIM
    3. SPF (make sure to include google in your SPF) https://support.google.com/googlecloud/answer/10756302
    4. DMARC
  6. Set up email forwarding in cloudflare to your gmail account
  7. Set up “send as” address in Gmail
  8. Test
    1. Test sending and receiving email with your custom domain through your gmail account.
    2. Test email deliverability score at https://www.mail-tester.com/

More reading

https://help.17hats.com/en/articles/865530-how-to-ensure-emails-do-not-end-up-in-spam

https://dmarcly.com/blog/how-to-implement-dmarc-dkim-spf-to-stop-email-spoofing-phishing-the-definitive-guide

]]>
https://jphein.com/how-to-secure-your-custom-website-and-domain-email-services-for-free-using-cloudflare/feed/ 0 10166
Internet Options in Nevada County https://jphein.com/internet-options-in-nevada-county/ https://jphein.com/internet-options-in-nevada-county/#respond Wed, 25 Jan 2023 19:05:00 +0000 https://blog.jphein.com/?p=4942 Map of Nevada County and its neighbours with broadband coverage shaded: red for none, yellow and green for served areas
Image from: https://www.broadbandmap.ca.gov/

National Broadband Map

The new Broadband Map website maintained by the Federal Communications Commission (FCC) is an online tool that allows users to search and compare broadband internet availability and speeds at their specific address. The website provides a wealth of information related to broadband connectivity, including information on broadband providers, types of service available, and connection speeds. Be sure to dispute any carrier that is on this map, but can’t provide you service. Be sure to check that out: https://broadbandmap.fcc.gov/home

NEWSFLASH

https://www.nevadacountyca.gov/CivicAlerts.aspx?AID=6430

🎉 Great news for residents of Nevada County, California! The county is set to streamline compliance with the California Environmental Quality Act (CEQA) to remove barriers and accelerate broadband development, with the final environmental impact report set to be presented before the Board of Supervisors on 28 February. The countywide report, available from 10 February, aims to speed up the granting of federal and state funds to individual fibre projects. The county said construction of the latter could start as early as spring 2023.

📄 For those interested in accessing the programmatic FEIR, it can be found on the Nevada County Community Development Agency’s website at https://www.nevadacountyca.gov/513/Projects-Supporting-Documents. The PDF report can be directly accessed at https://www.nevadacountyca.gov/DocumentCenter/View/47183/Broadband-Program-Final-Environmental-Impact-Report.

📰 To stay informed on the latest broadband news, residents can sign up for the Broadband in Nevada County Newsletter at https://www.mynevadacounty.com/broadband. For any questions, concerns, or opportunities to bring service to undeserved areas, connect with the county via email at [email protected]. 💻👍

FREE INTERNET for people with low income

The FCC launched a new program called the Affordable Connectivity Program (ACP) on December 31, 2021. The ACP is a new $14.2 billion program that is part of the Consolidated Appropriations Act of 2021. It is designed to provide low-income households with affordable broadband internet service and connected devices, such as laptops or tablets.

The ACP replaces the Emergency Broadband Benefit program that was launched earlier in 2021. It expands the scope of the Emergency Broadband Benefit program by providing a more comprehensive set of benefits to eligible households. Specifically, the ACP provides eligible households with a $30 monthly discount on broadband service and up to $100 off a connected device, such as a laptop or tablet. The program also covers the cost of installation and provides ongoing technical support to help ensure that households are able to take advantage of the benefits provided by the program.

Eligibility for the ACP is based on income and participation in certain assistance programs, such as Medicaid or the Supplemental Nutrition Assistance Program (SNAP). Eligible households can enroll in the program through participating broadband providers or directly through the ACP website.

The goal of the ACP is to provide affordable and reliable broadband internet access to low-income households, thereby helping to bridge the digital divide and promote greater economic opportunity and social equity. The program is expected to provide critical support to millions of households across the United States and help to ensure that they have access to the tools and resources needed to participate fully in the digital economy.

ACP eligible providers that provide a $0 with ACP plan:


TREELINK Fixed Wireless – Looking for affordable internet? Check out Treelink’s distributed mesh fixed wireless! 📶🌐 They offer a $0 plan with ACP eligibility. Sign up at http://treelink.us/ to enjoy internet connectivity. Treelink uses Althea blockchain technology to make internet available to residents near Nevada City. The service area uses ADI (AT&T Dedicated Internet), and Comcast as exit nodes. 🌉🌲


AT&T DSL – Get connected to the internet with DSL ATT! 📶🌐 With ACP eligibility, you can get their $0 plan and enjoy reliable internet connectivity. Check out their offerings at https://www.att.com/help/affordable-connectivity-program/. 💻


PCSFORPEOPLE LTE Cellular – Get affordable internet and technology options from @pcsforpeople! 💻📱 They offer mobile hotspot-based internet service using the 📶 T-Mobile network, with unlimited 4G LTE and up to 23GB/month of high-speed prioritized data. After 23GB, heavy data users may experience slower speeds due to data deprioritization. Plus, you can snag a laptop for just $10 💻 www.pcsforpeople.org.


Other low income Internet programs:

  • Comcast – http://www.internetessentials.com/ $10/month
  • ATT- https://accessatt.solixcs.com/#/home $5-$10/month
  • Suddenlink – https://www.alticeadvantageinternet.com/ $15/month
  • Cellular Human-I-T https://hitconnect.org/sales/buyInternet?product=6616 $15/month
http://www.cheapinternet.com/low-income-internet

Complete List of Available Internet Options

List is sorted by relative speed, and type.

Fiber Internet (synchronous)

Pros:

  • Very fast and reliable speeds, both upstream and downstream
  • Good for heavy internet usage, such as streaming and online gaming
  • Future-proof technology that can handle increasing demands

Cons:

  • Can be expensive, especially for higher speeds
  • Limited availability in some areas due to infrastructure requirements
  • Vulnerable to damage from construction and natural disasters
ProviderService AreaNotesSignup Link
AT&T ABFMetroShared: Best option if available.N/A
AT&T ADI/MISMost placesDedicated: Very expensive.N/A
Vast NetworksCoverage mapMiddle-mile project funded by ARRA, can be better price than ADI. Not sure about last mile.https://vastnetworks.com/
Race CommunicationsHwy 174 to Airport in Grass ValleyGoes down often, well priced. Speeds are much slower than advertised.https://www.race.com/
Newtown FiberNewtown Rd.N/A
Nevada County FiberBanner MountainAccepts ACP.https://www.nevcofiber.com/
Northern Sierra BBPBuck Mountain Road, Oak Drive, Arianna Court, Sunset View Court, and Mountain ParkThe Northern Sierra Broadband Project (Not built yet)N/A
Spiral FiberNorth of Nevada City limits(Not built yet)https://www.spiral.com/
Plumas SierraTruckeehttps://www.plumassierratelecom.com/

Cable Internet

Pros:

  • Faster speeds than DSL
  • Generally more widely available than fiber
  • Often bundled with TV and phone services

Cons:

  • Speeds can be affected by network traffic
  • Connection speeds can vary depending on location
  • Not as reliable or fast as fiber
ProviderService AreaNotesSignup Link
Comcast (Xfinity)Grass Valley, Nevada City, Penn Valley areashttps://www.xfinity.com/
Comcast BusinessSame as abovehttps://business.comcast.com/
SuddenLinkAlta Sierra, parts of south county, Truckee areashttps://www.suddenlink.com/

Fixed Wireless

Pros:

  • Can be a good option for rural areas where other types of internet are not available
  • Can be more affordable than other types of internet
  • Can be installed quickly

Cons:

  • Can be affected by weather, terrain, and other factors
  • Can have slower speeds and less reliability than fiber or cable
  • Limited availability in some areas
ProviderService AreaNotesSignup Link
TreelinkOutside of Nevada CityAlthea Distributed mesh. Uses ADI (AT&T Dedicated Internet) and Comcast as exit nodes.https://treelink.us/
Digital PathWestern Nevada County up to 5-Mile HouseNo data limits.https://digitalpath.net/
Smarter BroadbandSome parts of Western Nevada Countyhttps://www.smarterbroadband.net/
Succeend.netLake Wildwood?https://www.succeed.net/
ExwireTruckee?https://www.exwire.com/
Colfax.netColfax & parts of Hwy 174 area to Grass Valleyhttps://www.colfax.net/
GoSkyWestLime Kiln, McCourntney, Wolf Rd., and morehttps://goskywest.com/

Low Earth Orbit Satellite Internet

Pros:

  • Can be a good option for rural areas where other types of internet are not available
  • Fast speeds and low latency
  • Can be used anywhere with a clear view of the sky

Cons:

  • Can be affected by weather and other factors
  • Can be expensive, especially for heavy internet usage
  • Limited availability and long waitlists in some areas
ProviderService AreaNotesSignup Link
StarlinkCurrent round is sold out in our area. RV edition also sold out in our area.https://www.starlink.com/

5G Cellular Internet

Pros:

  • Fast speeds and low latency
  • Can be used anywhere with 5G coverage
  • Can be bundled with other cellular services

Cons:

  • Limited coverage in some areas
  • Can be affected by network congestion and other factors
  • Can be expensive for heavy internet usage
ProviderService AreaNotesSignup Link
AT&TNot available yet in our areaN/A
T-MobileNot available yet in our areaN/A
VerizonNot available yet in our areaN/A

4G & LTE Cellular Internet

Pros:

  • Can be used anywhere with cellular coverage
  • Can be bundled with other cellular services
  • Portable and easy to use

Cons:

  • Can be expensive for heavy internet usage
  • Slower speeds and higher latency than other types of internet
  • Limited coverage in some areas
ProviderService AreaNotesSignup Link
VerizonHotspothttps://www.verizon.com/
AT&THotspothttps://www.att.com/
T-MobileHotspothttps://www.t-mobile.com/

DSL (aDSL) or U-verse

Pros:

  • Can be more affordable than other types of internet
  • More widely available than fiber
  • Can be bundled with phone services

Cons:

  • Speeds can be affected by distance from the provider
  • Not as reliable or fast as fiber
  • Limited availability in some areas
ProviderService AreaNotesSignup Link
AT&T InternetGrass Valley, Nevada City, Penn Valley, TruckeeDigital Pair Gain from a fiber connected terminal. ACP eligible.N/A

Geosynchronous Orbit Satellite Internet

Pros:

  • Can be used anywhere with a clear view of the sky
  • More widely available than Low Earth Orbit satellite internet
  • Can be bundled with other satellite services

Cons:

  • Higher latency and slower speeds than other types of internet
  • Can be affected by weather and other factors
  • Limited availability in some areas
ProviderService AreaNotesSignup Link
ViasatAlso known as Exede or Wildblue. Viasat-2 satellite launched in 2017. Viasat-3 satellites in development.https://www.viasat.com/internet
HughesNethttps://www.hughesnet.com/
SkycastersVSAT services for enterprise and government customers.https://www.skycasters.com/

Legacy Providers

  • [wiki]Fiber Internet[/wiki] (synchronous)
    • AT&T ABF (AT&T Business Fiber) Shared : The BEST option if available.
      SERVICE AREA: Metro
    • AT&T ADI (AT&T Dedicated Internet) aka MIS (Managed Internet Service) ATT Dedicated Business Fiber (Available many places, but very expensive) ~$500/month for 10Mbps ~$2300/month for 1Gbps symmetrical up to 10Gbps
      SERVICE AREA: Most places
    • Vast Networks http://vastnetworks.com Coverage map
      A middle-mile project that had been funded by the American Recovery and Reinvestment Act (ARRA)
      NOTES: Can be a better price than ADI, like $1000/month for 1Gbps symetrical.
      Not sure about last mile.
    • Race Communications race.com (Zone 1 has been completed)
      SERVICE AREA: On Hwy 174 to Airport in Grass Valley
      NOTES: Goes DOWN many times a week! Speeds are much slower than advertised. Is well priced at ~$100/month for 1Gbps symmetrical.
    • Newtown Fiber? (VAST)
      SERVICE AREA: Newtown rd.
    • Nevada County Fiber (ATT) ACCEPTS ACP!
      SERVICE AREA: Banner Mountain
      https://www.nevcofiber.com/
    • The Northern Sierra Broadband Project (Not built yet) (ATT)
      SERVICE AREA: Buck Mountain Road, Oak Drive, Arianna Court, Mountain View Court, Sunset View Court, and Mountain Park Court, in unincorporated Grass Valley
    • Spiral Fiber (Not built yet) (Vast)
      https://www.spiral.com/
      SERVICE AREA: north of the Nevada City limits in the Lake Vera Purdon Road and North Bloomfield Road neighborhoods
    • plumassierratelecommunications.com
      SERVICE AREA: Truckee
  • [wiki]Cable Internet[/wiki]
    • Comcast (Xfinity)
      SERVICE AREA: Grass Valley, Nevada City, Penn Valley areas
    • Comcast business
      SERVICE AREA: same as above
    • SuddenLink
      SERVICE AREA: Alta Sierra, parts of south county, Truckee areas
  • [wiki]Fixed Wireless[/wiki]
    • Treelink – distributed mesh
      Signup here: http://treelink.us/
      Althea blockchain technology http://althea.net/ SERVICE AREA: Outside of Nevada City NOTES: Uses ADI (AT&T Dedicated Internet), and Comcast as exit nodes.
    • Digital Path
      SERVICE AREA: Western Nevada County up to 5-Mile House
    • Smarter Broadband
      SERVICE AREA: Some parts of Western Nevada County
    • Succeend.net
      SERVICE AREA: (Lake Wildwood?)
    • exwire.com
      SERVICE AREA: (Truckee?)
    • colfax.net 
      SERVICE AREA: Colfax & parts of Hwy 174 area to Grass Valley
    • goskywest.com
      SERVICE AREA: Lime Kiln, McCourntney, Wolf Rd., and in south Alta Sierra, Golden Oaks, the Cottage Hill area off Running M, Lake of the Pines and the Ranchos.
  • 5G [wiki]Cellular Internet[/wiki] (Not available yet in our area)
    • AT&T
    • T-Mobile
    • Verizon
  • [wiki]Low Earth Orbit[/wiki] [wiki] Satellite Internet[/wiki]
    • Starlink Current round is sold out in our area. RV edition also is sold out in our area. Waitlist is until 2023.
  • 4G & LTE [wiki]Cellular Internet[/wiki] Hotspot
  • [wiki]DSL[/wiki] (aDSL) or [wiki]U-verse[/wiki] (aDSL2+ or vDSL)
    • AT&T Internet – U-verse (aDSL2+) Digital Pair Gain from a fiber connected terminal. ACP eligible.
    • Third party ATT resellers
      • Omsoft in Davis (Subcontracts to SonicNet)
        SERVICE AREA: Grass Valley, Nevada City, Penn Valley, and Truckee areas
        No data limits
    • AT&T DSL Legacy (Shutting down June 30th 2022)
      • Copper from the main office (No longer available from ATT in many places)
  • [wiki]Geosynchronous Orbit[/wiki] [wiki]Satellite Internet[/wiki]
    (!low on list because of High Latency realtime interaction is delayed)
  • 3G[wiki] Cellular Internet[/wiki] Hotspot (Average 600Kbps – 1.4 Mbps and up to 3.1 Mbps)
    ATTENTION: All carriers are disabling 3G by 2022.
    • Verizon,
    • AT&T,
    • T-mobile,
    • or third party resellers…
  • [wiki]ISDN[/wiki] – Integrated Services Digital Network
    Not sure this still exists…
  • [wiki]56K Modem[/wiki] over AT&T phone line
    • other third party
    • ATT

Coverage Maps

As you can see, https://www.nevadacountyca.gov/1460/Local-Broadband-Providers-Coverage-Maps, needs some updating.

California coverage map: https://www.broadbandmap.ca.gov/
Federal coverage map: https://broadbandmap.fcc.gov/.
(Hopefully, this should be more accurate by the end of Summer 2020: https://www.benton.org/blog/congress-tells-fcc-fix-broadband-maps-now)

Background

Many in Nevada County live outside the city centers. Combined with the varied terrain, and heavy forests. This makes finding a reliable and fast internet connection sometimes exceedingly difficult.

Broadband internet is currently defined by the FCC as 20Mbps down and 3Mbps up with latency of less than 100ms. More recently it has been mentioned by California as 25Mbps down and 25Mbps up with latency  suitable for real time interaction.

Only Fiber and Cable offer upload speeds that high. Fixed wireless, and occasionally 4G LTE Cellular can offer adequate download speeds. If possible, Fiber and Cable are the top choices for speed and reliability. There are many areas in Nevada County that do not have any internet options or can only access internet over unreliable high latency satellite, cellular or wireless connections. This is a huge issue. Part of the problem is that many ISPs (Internet Service Providers) are misreporting areas served. Or, reporting that they serve the whole block if they serve a single house within the block. Also, many ISPs try to block new companies or municipalities from serving these misreported areas. As well as cause problems for new ISPs getting grants.

https://gizmodo.com/new-report-suggests-fcc-massively-overstated-gigabit-co-1845842681

There are currently many grants, and bills in the works to expand broadband into rural areas like Nevada County. Much of this is overseen by The California Public Utilites Commision (CPUC): https://www.cpuc.ca.gov/Communications/
Using the California Coverage Map, you can see which areas are supposedly served, and what speeds you should get. You can also see which areas are eligible for two of these grant programs; the California Advanced Services Fund (CASF) Infrastructure Grant, and the Connect America Fund Phase II. The CASF has a local presence through the Sierra Business Council called the Gold Country Broadband Consortium. Nevada County has a page with some of the projects they have worked on regarding to broadband
here: https://www.mynevadacounty.com/1433/The-Countys-Role.

The rural digital opportunity fund is also in the works. There are may be some more grants coming with this bill too:
https://www.engadget.com/house-approves-100-billion-broadband-funding-010021883.html
More recently there have been a bunch of reverse auctions by the FCC to disburse grant funds. The newest round of rural broadband grant winners interactive map: https://experience.arcgis.com/experience/0b324cabf7b94d9ca34caa9361122d94/

Some info from: https://www.nevadacountyconnected.com/wp-content/uploads/2019/05/NevadaCounty-InternetAccess-June2019.pdf

Here is a spreadsheet of the above data: https://docs.google.com/spreadsheets/d/1-zEAGucrrkgLL9jWyW8w2XvtHmrJuvMNb9PwUQsrHAU/edit?usp=sharing

More Reading

Also check out this http://www.nevadacountyconnected.com/broadband-pricing.

More reading: https://thesungazette.com/article/news/2020/05/06/rural-residents-are-left-disconnected/

Get Involved!

https://mediajustice.org/campaign/internet-4-all/

http://www.internetforallnow.org/

asfi sheheen http://netequity.net

]]>
https://jphein.com/internet-options-in-nevada-county/feed/ 0 4942