Run OpenFOIA entirely from an encrypted USB drive. No traces are left on the host machine (assuming no swap and careful use).
- A USB drive (16 GB or larger recommended).
- A host machine with Python 3.11+ and a USB port.
- (Optional) LUKS/VeraCrypt for full-disk encryption of the USB.
# Identify the USB device (e.g., /dev/sdb) -- BE VERY CAREFUL
lsblk
# Create a LUKS-encrypted partition
sudo cryptsetup luksFormat /dev/sdb1
sudo cryptsetup luksOpen /dev/sdb1 openfoia_usb
sudo mkfs.ext4 /dev/mapper/openfoia_usb
sudo mount /dev/mapper/openfoia_usb /mnt/openfoia
sudo chown $USER:$USER /mnt/openfoiapython3 -m venv /mnt/openfoia/venv
source /mnt/openfoia/venv/bin/activate
pip install openfoiaexport OPENFOIA_DATA_DIR="/mnt/openfoia/data"
openfoia initsource /mnt/openfoia/venv/bin/activate
export OPENFOIA_DATA_DIR="/mnt/openfoia/data"
openfoia servesudo umount /mnt/openfoia
sudo cryptsetup luksClose openfoia_usbVeraCrypt works on Linux, macOS, and Windows.
- Download and install VeraCrypt.
- Create an encrypted volume on the USB drive:
- Select "Create an encrypted file container" or encrypt the entire partition.
- Choose AES-256 + SHA-512.
- Set a strong passphrase.
Mount the VeraCrypt volume (let's say it mounts at /Volumes/OPENFOIA on
macOS or V:\ on Windows):
# macOS / Linux
python3 -m venv /Volumes/OPENFOIA/venv
source /Volumes/OPENFOIA/venv/bin/activate
pip install openfoia
export OPENFOIA_DATA_DIR="/Volumes/OPENFOIA/data"
openfoia init# Windows
python -m venv V:\venv
V:\venv\Scripts\activate
pip install openfoia
set OPENFOIA_DATA_DIR=V:\data
openfoia initAlways dismount the VeraCrypt volume when done. This re-encrypts everything.
# Create a 2 GB encrypted sparse image
hdiutil create -size 2g -encryption AES-256 -type SPARSE \
-fs APFS -volname OPENFOIA ~/openfoia.sparseimage
# Mount it
hdiutil attach ~/openfoia.sparseimage
# Install
python3 -m venv /Volumes/OPENFOIA/venv
source /Volumes/OPENFOIA/venv/bin/activate
pip install openfoia
export OPENFOIA_DATA_DIR="/Volumes/OPENFOIA/data"
openfoia initCreate a run.sh on the USB for convenience:
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
export OPENFOIA_DATA_DIR="$SCRIPT_DIR/data"
source "$SCRIPT_DIR/venv/bin/activate"
openfoia "$@"Then: chmod +x run.sh and use ./run.sh serve, ./run.sh request list, etc.
- Swap: Disable swap on the host machine or use encrypted swap. Sensitive
data in RAM can be written to swap on disk.
- Linux:
sudo swapoff -a - macOS: Swap is encrypted by default when FileVault is enabled.
- Linux:
- Temp files: Python may write temp files to
/tmp. On Linux,/tmpis usually tmpfs (RAM-backed). On macOS, setTMPDIRto a directory on the encrypted USB if concerned. - Browser cache: When using
openfoia browse, Playwright stores browser profiles in a temp directory. Use--headlessand the profiles are cleaned up on exit. - USB forensics: Even with LUKS/VeraCrypt, wear-leveling on flash storage means deleted data may persist in spare blocks. For maximum security, use a hardware-encrypted USB drive (e.g., Apricorn Aegis, Kingston IronKey).
openfoia init --password REAL_SECRET --duress-password DECOY_SECRETIf forced to decrypt the USB and open OpenFOIA, use the duress password. The decoy database with innocuous data will be shown instead.