Self-Hosted Password Manager & Automated Disaster Recovery

Identifying and addressing password reuse within VNTheJeweler through a self-hosted, security-focused password management solution.

This project documents the design, deployment, and security configuration of a Vaultwarden password management platform hosted on a Raspberry Pi 5.

The implementation includes containerization, secure remote access, multifactor authentication, encrypted off-site backups, automated recovery processes, and external backup monitoring.

Vaultwarden Raspberry Pi 5 Linux Docker Cloudflare Tunnel SQLite Restic Rclone Google Drive Systemd Healthchecks.io

The Business Problem: Password Reuse

As the founder and operator of VNTheJeweler, I manage numerous accounts across e-commerce marketplaces, financial platforms, business services, supplier websites, and other operational systems.

While reviewing my business's account security practices, I identified a recurring issue: passwords were being reused across multiple business accounts.

Although password reuse may simplify account management, it creates a significant cybersecurity risk. If a reused password becomes compromised through a data breach, phishing attack, or credential theft, an attacker may attempt to use that same password to access additional accounts.

For an e-commerce business, unauthorized account access could potentially expose customer information, disrupt business operations, compromise financial accounts, or result in fraudulent transactions.

Identified Security Risk

Reusing passwords across business accounts increases exposure to credential-stuffing attacks and creates unnecessary dependencies between otherwise separate systems.

My objective was to eliminate the operational need for password reuse by implementing a centralized password management solution.

Rather than relying solely on manually changing passwords, I wanted to develop a sustainable solution that would make generating, storing, and retrieving unique credentials practical for everyday business operations.


Project Objectives

The primary objective was to address the password reuse problem while gaining hands-on experience deploying and securing a production-style application.


System Architecture

The solution is hosted on a Raspberry Pi 5 running a Linux-based operating system. Docker is used to isolate and manage the application services.

Vaultwarden and Cloudflared operate in separate containers connected through a shared Docker bridge network.

Cloudflare Tunnel provides external HTTPS access without requiring inbound port forwarding on the home router.

Client Device | | HTTPS v Cloudflare Network | | Cloudflare Tunnel v Raspberry Pi 5 | +----------------------------------+ | Docker Network | | | | Cloudflared Container | | | | | v | | Vaultwarden Container | | | | +----------|-----------------------+ | v Persistent Application Data | v SQLite Backup | v Restic Encryption | v Rclone | v Google Drive | v Healthchecks Success Ping | v External Monitoring

Infrastructure Components

Technology Purpose
Raspberry Pi 5 Physical application host
Docker Containerized application deployment
Vaultwarden Self-hosted password management
Cloudflare Tunnel Secure remote connectivity
SQLite Application database
Restic Encrypted backup repository
Rclone Google Drive integration
Systemd Backup automation and retries
Healthchecks.io Backup execution monitoring

Containerized Application Deployment

Vaultwarden was deployed using Docker Compose, allowing the application to run independently from other services hosted on the Raspberry Pi.

Persistent storage was configured to preserve application data across container restarts and updates.

The Vaultwarden container was connected to an existing Docker network shared with the Cloudflared container.

Internal Container Communication

Cloudflared communicates with Vaultwarden using Docker's internal networking and container name resolution.

http://vaultwarden:80

This approach allows Cloudflared to reach Vaultwarden without requiring the application to be directly exposed through a router port-forwarding rule.

Secure External Connectivity

A dedicated Cloudflare Tunnel hostname was configured for the password manager.

Incoming HTTPS requests are routed through Cloudflare to the Cloudflared connector, which forwards requests to the Vaultwarden container.

This design provides remote accessibility while reducing direct exposure of the home network to inbound connections.


Security Implementation

Multifactor Authentication

Two-factor authentication was enabled to provide an additional authentication requirement beyond the account's master password.

Restricted Account Registration

Public account registration was disabled to prevent unauthorized users from creating accounts on the self-hosted application.

SIGNUPS_ALLOWED=false

Encrypted Backup Storage

Backup data is encrypted using Restic before being uploaded to Google Drive.

This provides confidentiality for off-site backup data while reducing reliance on the cloud storage provider's access controls alone.

Restricted File Permissions

Sensitive local configuration files, including the backup encryption password, were protected using restrictive Linux file permissions.

Defense in Depth

The solution combines multiple security controls rather than relying on a single protective mechanism.


Automated Backup & Disaster Recovery

A significant component of the project involved designing an automated backup solution to protect the password manager's application data.

Because a self-hosted password manager can become a critical dependency for accessing business accounts, reliable backups are essential.

Database Backup

Vaultwarden uses SQLite for its application database.

To avoid copying an actively changing database file directly, the backup script uses SQLite's built-in backup functionality.

sqlite3 "$DATA_DIR/db.sqlite3" \
  ".backup '$STAGING_DIR/db.sqlite3'"

This creates a consistent database snapshot while the application remains operational.

Encrypted Cloud Backups

Restic encrypts the backup data and manages the backup repository.

Rclone provides connectivity between the Raspberry Pi and Google Drive.

The repository is stored remotely, providing an additional recovery option if the Raspberry Pi or its local storage becomes unavailable.

Automated Scheduling

A systemd timer executes the backup service daily at 3:00 AM.

[Timer]
OnCalendar=*-*-* 03:00:00
Persistent=true
Unit=vaultwarden-backup.service

The persistent timer configuration allows a missed scheduled backup to run after the host becomes available again.

Backup Retention Policy

Restic was configured to retain historical backup snapshots across multiple time periods.

Backup Type Retention
Daily 7 snapshots
Weekly 4 snapshots
Monthly 6 snapshots
restic forget \
  --tag vaultwarden \
  --group-by host,tags \
  --keep-daily 7 \
  --keep-weekly 4 \
  --keep-monthly 6 \
  --prune

The retention policy balances historical recovery options with storage management.

Automatic Failure Recovery

Systemd was configured to retry failed backup operations after a five-minute delay.

Restart=on-failure
RestartSec=5min

StartLimitIntervalSec=30min
StartLimitBurst=3

Rate limiting helps prevent excessive repeated attempts during extended failures.


Backup Monitoring & Alerting

Automated backups are only useful if failures can be detected.

To improve visibility into the backup process, I integrated Healthchecks.io.

After the backup script successfully uploads the encrypted data and applies the retention policy, it sends an HTTPS request to a monitoring endpoint.

Healthchecks.io monitors these check-ins and can generate email alerts when expected backups fail to report success.

Monitoring Design

The monitoring service operates independently of the Raspberry Pi.

This allows missed backup executions to be detected even when the host itself becomes unavailable.

The monitoring endpoint is stored separately from the backup script to avoid unnecessarily exposing the URL in project source code.


Testing & Verification

Multiple tests were performed to validate the application's functionality and backup infrastructure.

Application Accessibility

Verified that the Vaultwarden application was accessible through the configured Cloudflare Tunnel hostname.

Authentication Controls

Confirmed that multifactor authentication was enabled and public account registration was disabled.

Backup Execution

Executed the backup service manually and verified successful completion through systemd logs.

Backup Restoration

Restored an encrypted backup snapshot to a temporary recovery directory.

The restored SQLite database was tested using:

PRAGMA integrity_check;

The database returned:

ok

This confirmed that the restored database passed SQLite's integrity validation.

A complete application-level disaster recovery test remains a future improvement.

Monitoring Validation

Sent a test request to the Healthchecks.io endpoint and verified that the monitoring dashboard reported a healthy status.


Challenges & Troubleshooting

Restic / Rclone Connection Timeout

During implementation, an automated backup failed when Restic timed out while attempting to communicate with the remote Google Drive repository through Rclone.

I investigated the failure using systemd service status information and journal logs.

systemctl status vaultwarden-backup.service

journalctl -u vaultwarden-backup.service -n 50

The logs identified a timeout while Restic attempted to access the remote repository.

I tested Google Drive connectivity independently using Rclone, then verified repository accessibility through Restic.

Both connectivity tests succeeded, and a subsequent backup completed successfully.

This troubleshooting process reinforced the importance of validating individual infrastructure components before modifying an otherwise functional configuration.


Security Impact & Lessons Learned

The project established a centralized password management platform intended to replace password reuse across VNTheJeweler's business accounts.

By providing a practical method for generating and storing unique credentials, the solution supports stronger account security practices.

The implementation also provided hands-on experience with several important cybersecurity and infrastructure concepts.

Key Takeaway

This project demonstrates my ability to recognize a real-world cybersecurity concern, design a practical technical solution, deploy supporting infrastructure, and implement controls to improve reliability and data protection.


Future Improvements

← Back to Projects View on GitHub ↗ Contact Me