Commit Graph

57 Commits

Author SHA1 Message Date
Claude
91ff467f2f security: fix critical vulnerabilities and code quality issues
Critical fixes:
- init_admin.py: replace hardcoded admin123 password with ADMIN_PASSWORD env var
- proxmox_client.py, models.py: change verify_ssl default from False to True
- api/proxmox.py: use server.verify_ssl instead of hardcoded verify=False in websocket handler
- ssh_client.py: replace AutoAddPolicy (MITM-vulnerable) with WarningPolicy + load_system_host_keys

Security hardening:
- main.py: add security headers middleware (CSP, X-Frame-Options, HSTS, X-XSS-Protection, Referrer-Policy)
- main.py: fix CORS — allow_credentials=True is incompatible with allow_origins=["*"]; read origins from CORS_ORIGINS env var
- auth.py, logging_middleware.py: validate X-Forwarded-For/X-Real-IP to prevent IP spoofing

Performance:
- monitoring_worker.py: wire up cleanup_expired_connections() as hourly scheduled job (was defined but never called)

Code quality:
- logging_service.py: move `import json` from inside function to module level
- ssh_client.py, proxmox_client.py, api/proxmox.py, rbac/migration.py, task_queue_service.py: replace all bare `except:` with `except Exception:`
- .env.example, config.py: document ADMIN_PASSWORD and CORS_ORIGINS settings

https://claude.ai/code/session_019rK2wvaWg5zXFwmAPPEB7R
2026-03-06 15:57:20 +00:00
8dced5479d Add git repository selection for panel updates
- Add repository URL setting to panel_settings table
- Support for multiple git hosting providers (GitHub, Gitea, GitLab, etc.)
- UI selector for predefined repositories (git.tzim.uz and github.com) or custom URL
- Update service now uses repository from database settings
- API endpoints: GET/PUT /api/updates/repository
- Migration for default repository setting
- Translations for repository selection UI
2025-12-16 20:04:57 +05:00
83626d94bc Fix duplicate key error when creating VM with previously deleted VMID
- Modified save_vm_instance to check for soft-deleted records before insert
- If a soft-deleted record exists with same server_id+vmid, restore and update it
- Prevents 'duplicate key value violates unique constraint' errors
2025-12-15 20:53:15 +05:00
cf456faa16 fix: Apply IPAM IP address to VM cloud-init configuration
- Fix field names in frontend: ipam_ip -> ip_address, ipam_gateway -> gateway
- Pass ipam_network_id to deploy API for proper network mask lookup
- Extract network mask from IPAM network CIDR (e.g., /24 from 10.10.10.0/24)
- Auto-fetch gateway from IPAM network if not provided
- Add detailed logging for VM IP configuration
- Remove hardcoded /24 mask, use actual network mask from IPAM

This fixes the issue where VMs were getting DHCP instead of the
static IP allocated from IPAM.
2025-12-15 20:30:17 +05:00
379afd0353 feat: Add SSH public key storage for users
- Add ssh_public_key column to User model for storing SSH keys
- Add database migration for ssh_public_key column
- Add SSH key section in user profile settings with validation
- Auto-inject user's SSH key when deploying VMs from templates
- Auto-inject user's SSH key when creating LXC containers
- Support for both regular and smart LXC creation endpoints
- Add i18n translations for SSH key UI (ru/en)
- Validate SSH key format (ssh-rsa, ssh-ed25519, ecdsa-sha2, ssh-dss)

Users can now save their SSH public key in Settings -> Account,
and it will be automatically added to any VM or LXC container
they create, enabling passwordless SSH access.
2025-12-15 20:22:42 +05:00
2b78d93710 Add password validation with i18n support and GitHub button improvements
- Add password field to UserUpdate schema for password change on edit
- Implement password validation in update_user endpoint
- Add i18n translations for password validation errors (ru/en)
- Update SecurityService.validate_password to support language parameter
- Add GitHub icon and repository name 'pvemanager' to header button
- Fix internal server error when updating user password
- Clean up hardcoded translations in frontend
2025-12-15 20:10:17 +05:00
f5a3903f5d Add complete project structure and all files 2025-12-15 13:03:29 +05:00