How smehtani83/secure-personal-cloud works
Project Type and Purpose
• This is a hybrid system:
• A client-side CLI tool (“spc”) written in Python and Bash scripts that lets users observe, encrypt, and sync directories.
• A server-side component implemented as a Django web application (ssl_project/) with two apps (login, signup), using SQLite to store metadata and encrypted blobs.
• Purpose: enable authenticated users to register and manage encryption keys, observe local directories, perform end-to-end encryption (RSA/MD5), and synchronize encrypted files over SSH/SCP to a central server, with support for sharing and receiving files among users.
Directory Structure
• Top-level scripts (blob.py, dec.py, rsa.py, rsa_gen.py, sbwa.py, md5get.py, scp_commands.sh, helper.sh, install.sh) implement the CLI interface, encryption routines, and shell wrappers for SSH/SCP.
• ssl_project/ is a standard Django project:
• ssl_project/ssl_project/: settings.py, urls.py, wsgi.py
• ssl_project/login/ and ssl_project/signup/: apps, models.py, views.py, urls.py, templates, tests, migrations.
• ssl_project/db.sqlite3 persists users, keys, file metadata.
• ssl_project/encryption_helper, blob.py, backfromblob.py, dec.py provide server-side encryption/decryption logic.
README Insights
• CLI commands (spc login, spc register, spc observe, spc sync, spc send, spc rec, etc.) define the client workflow: authenticate, initialize or load keys, mark local directory for sync, push encrypted files, share or receive files.
• All communications with the server appear to go over SSH/SCP (no REST API references), with the server running a Django app that responds to file drops and key exchanges.
Main Components
a. Client Tier
• CLI Wrapper (“spc” command dispatcher)
• Local Encryption Module (rsa.py, md5get.py, blob.py, dec.py)
• Filesystem Observer & Sync Engine (sbwa.py, sync.py)
• SSH/SCP Transport Layer (scp_commands.sh, helper.sh)
b. Network
• Secure Channel (SSH)
c. Server Tier
• Django Web Application
• Auth & Key Management App (signup, login apps)
• File Metadata & Sharing Logic
• Views for file receipts, directory status
• Server-side Encryption Helper (encryption_helper, backfromblob.py, dec.py)
• Database (SQLite)
• Persistent File Storage (encrypted blob directory or DB blobs)
Relationships and Data Flows
• User invokes spc <command> → CLI Wrapper
• CLI calls Local Encryption Module → produces encrypted blobs and MD5 checksums
• CLI invokes SSH/SCP scripts → transfers blobs and metadata to server
• On server arrival, Django’s file upload endpoints trigger server-side encryption_helper to validate or re-encrypt, then persist records in SQLite and store blob on disk
• For spc status or spc server, CLI retrieves metadata via SSH/SCP, then presents back to user
• For spc send/spc rec, CLI coordinates with Django apps to add sharing keys in DB, then pulls or pushes blobs
Architectural Patterns and Design Principles
• Client-Server architecture over SSH/SCP
• Modular encryption pipeline (separate RSA keygen, blob encryption, MD5 checksum stages)
• MVC pattern inside Django: models (file metadata & keys), views (file endpoints, status queries), templates (login/register pages)
• Thin CLI that delegates heavy lifting to reusable Python modules and shell scripts
Technologies and Frameworks
• Python 3 scripts (CLI logic, encryption modules)
• Bash scripts for orchestration (scp_commands.sh, helper.sh)
• SSH/SCP as transport
• Django 2.x for server, SQLite for persistence
• RSA cryptography and MD5 hashing
Essential Elements Without Over-Segmentation
• You cover all major scripts and Django apps, but group related modules into logical containers (e.g., “Encryption Modules” rather than each .py file).
• Interactions (authentication & key exchange, file upload/download, status queries).