Files
algo/roles/privacy/templates/privacy-shutdown-cleanup.service.j2
T
cddb5df395 Add comprehensive pre-commit hooks for code quality (#14831)
* Add comprehensive pre-commit hooks for code quality

- Set up pre-commit framework with hooks for Python, YAML, Ansible, and shell
- Configure ruff for Python linting and formatting
- Add yamllint for YAML validation
- Include ansible-lint and syntax checks
- Add shellcheck for shell scripts
- Create development documentation
- Auto-fix trailing whitespace and file endings

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Remove redundant DEVELOPMENT.md and update CONTRIBUTING.md

- Removed docs/DEVELOPMENT.md as it was redundant with existing documentation
- Added pre-commit hooks setup instruction to CONTRIBUTING.md for contributors
- Consolidated development guidance into a single location

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-09-15 10:03:46 -04:00

45 lines
1.1 KiB
Django/Jinja

# Privacy shutdown cleanup systemd service
# Clears logs and sensitive data on system shutdown
# Generated by Algo VPN privacy role
[Unit]
Description=Privacy Cleanup on Shutdown
DefaultDependencies=false
Before=shutdown.target reboot.target halt.target
Requires=-.mount
[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=/bin/true
ExecStop=/bin/bash -c '
# Clear all logs
find /var/log -type f -name "*.log" -exec truncate -s 0 {} \; 2>/dev/null || true;
# Clear rotated logs
find /var/log -type f \( -name "*.log.*" -o -name "*.gz" \) -delete 2>/dev/null || true;
# Clear systemd journal
if [ -d /var/log/journal ]; then
rm -rf /var/log/journal/* 2>/dev/null || true;
fi;
# Clear bash history
for user_home in /home/* /root; do
if [ -d "$user_home" ]; then
rm -f "$user_home"/.bash_history 2>/dev/null || true;
rm -f "$user_home"/.zsh_history 2>/dev/null || true;
fi;
done;
# Clear temporary files
rm -rf /tmp/* /var/tmp/* 2>/dev/null || true;
# Sync to ensure changes are written
sync;
'
TimeoutStopSec=30
[Install]
WantedBy=shutdown.target