ReviewOS

also looking at this

mail-os/mail

Harden encrypted mail storage, recovery, and forwarding

#8
Merged chris wants to merge codex/mail-storage-hardening into main
50 files +1701 -9001
packages/cloud/cloud.config.tsmodified+9-0
Changes to packages/cloud/cloud.config.ts
@@ -70,6 +70,7 @@ const mailConfig = {
7070 'python3',
7171 'python3-pip',
7272 'openssl',
73 'cryptsetup',
7374 'sqlite',
7475 'fail2ban',
7576 'bind-utils',
@@ -327,6 +328,14 @@ chown -R mail-server:mail-server ${cfg.paths.logDir}
327328chown -R mail-server:mail-server ${cfg.paths.mailDir}
328329chown -R mail-server:mail-server ${cfg.paths.installDir}/mail
329330
331# Encrypt every persistent mail path by default. The LUKS2 volume key is
332# machine-bound in systemd's encrypted credential store and is never exposed
333# to the mail-server service as a persistent plaintext file.
334chmod +x ${cfg.paths.installDir}/scripts/setup-encrypted-storage.sh
335MAIL_ROOT=${cfg.paths.installDir} \
336 MAIL_ENCRYPTED_IMAGE_SIZE="\${MAIL_ENCRYPTED_IMAGE_SIZE:-4G}" \
337 ${cfg.paths.installDir}/scripts/setup-encrypted-storage.sh
338
330339# Get instance metadata
331340echo "Getting instance metadata..."
332341TOKEN=\$(curl -s -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600")