Commit Graph

4923 Commits

Author SHA1 Message Date
usmannasir
46e40d6822 Fix permission race condition in fixPermissions function
Fixes #1583 - Ubuntu 24 permission issues causing 404 errors

Changes:
- Move main public_html permission setting to END of fixPermissions function
- Ensures public_html maintains user:nogroup ownership (not user:user)
- Prevents child domain processing from interfering with main directory permissions
- Changed all async popenExecutioner calls to sync executioner calls
- Reordered operations: permissions first, then ownership

This fixes the issue where clicking "Fix Permissions" in file manager
would incorrectly change public_html group from nogroup to the user's group,
causing 404 errors on Ubuntu 24.
2025-10-16 16:11:28 +05:00
usmannasir
acc6cad623 Fix permission issues on Ubuntu 24 causing 404 errors
Fixes #1583

The fixPermissions function in file manager was causing sites to become
inaccessible after running "Fix Permissions" on Ubuntu 24. The root causes:

1. Async execution (popenExecutioner) caused race conditions where commands
   executed in unpredictable order
2. The public_html directory group was incorrectly changed from 'nogroup'
   to the user's group, breaking web server access

Changes:
- Changed all async popenExecutioner calls to sync executioner calls
- Reordered commands to set permissions before ownership
- Ensured public_html directory maintains correct group ownership (nogroup)
- Added comments to clarify the purpose of each step

This ensures the file manager's "Fix Permissions" feature works correctly
on Ubuntu 24 while maintaining proper security.
2025-10-16 14:50:28 +05:00
usmannasir
9d0d5fbd35 Fix backup restore permission error and improve SFTP fallback
- Ensure /home/cyberpanel directory exists with proper permissions before download
- Set directory permissions to 755 to allow application write access
- Refactor SCP/SFTP fallback logic to work regardless of debug mode
- Add better status messages during download process
2025-10-15 04:30:43 +05:00
usmannasir
32db00d1ae Fix backup file moving to handle compressed database backups
- Check for .sql.gz files first, then fallback to .sql
- Also move .backup.json metadata files alongside compressed backups
- Maintains backward compatibility with legacy .sql backups
2025-10-15 00:56:45 +05:00
usmannasir
7864ef63c1 Remove strict exit code checking in database restore functions
- MySQL restore may return warnings that don't indicate actual failure
- Database restoration verification is handled by subsequent password operations
- Improves reliability of compressed backup restoration
2025-10-15 00:53:31 +05:00
usmannasir
10edef5d87 Fix compressed database backup verification logic
- Changed from checking exit code to verifying file existence and size
- Resolves issue where successful mysqldump was incorrectly reported as failed
- Ensures backup file is created and not empty before marking as successful
2025-10-15 00:50:55 +05:00
usmannasir
cac2e09fce Enhance database backup with compression support and backward compatibility
- Added configurable compression for database backups using gzip streaming
- Implemented auto-detection in restore function for compressed and uncompressed formats
- Added performance optimizations including --single-transaction and --extended-insert
- Created configuration file for gradual feature rollout with safe defaults
- Added helper functions for checking system capabilities and configuration
- Included comprehensive test suite to verify backward compatibility
- Maintained 100% backward compatibility with existing backup infrastructure
2025-10-14 19:54:11 +05:00
usmannasir
b6f20a6a5e Add storage stats, last backup info, and error logs to ManageOCBackups page
- Add comprehensive backup account overview with visual stats cards
- Display storage usage (total, used, available, percentage) from platform API
- Show last backup run timestamp and status (success/failed)
- Display total backups count and failed backups count
- Add recent backup error logs table with timestamp, website, and error message
- Fetch all stats from platform.cyberpersons.com/Billing/GetBackupStats endpoint
- Beautiful gradient cards for visual presentation of stats
- Progress bar for storage usage visualization
- Conditional display of error logs (only shown if errors exist)
- Add account info card showing SFTP user and plan name
- Graceful fallback to N/A if platform API is unavailable
- Comprehensive error logging for API failures
2025-10-14 19:11:38 +05:00
usmannasir
fb02243245 Improve One-Click Backup verification with multi-method approach
- Implement timestamp-based filename verification (Method 1)
- Add file size validation with 1KB minimum requirement (Method 2)
- Filter to only check today's backup directory for accuracy (Method 3)
- Add optional SHA256 checksum verification for integrity (Method 5)
- Use find command with size filter for efficient SSH verification
- Fallback to SFTP with comprehensive file validation
- Enhanced logging for all verification steps and failures
- Remove unused 'Yesterday' variable that was never used
- Prevents false positives from old backup files
- Detects corrupted/incomplete backups via size check
2025-10-14 18:49:41 +05:00
usmannasir
c9b711d5bd Fix critical bug in One-Click Backup failure notification logic
- Fix inverted .find() logic that sent notifications when backups SUCCEEDED
- Add 'status': 'failed' field required by platform API
- Change HTTP to HTTPS for BackupFailedNotify endpoint
- Add comprehensive error handling and logging
- Add 30-second timeout on API requests
- Properly handle actualDomain vs site.domain.domain cases
2025-10-14 16:23:41 +05:00
usmannasir
6381a9ee55 Refactor DeployAccount to eliminate code duplication and improve error handling
- Remove duplicate code blocks that handled success and "already deployed" cases
- Consolidate deployment logic into single code path
- Add validation for backup plan state before deployment
- Add specific exception handling for API requests and JSON parsing
- Add timeout to API requests (30 seconds)
- Change API endpoint from HTTP to HTTPS for security
- Improve error messages with actionable guidance
- Add comprehensive logging for all error paths
- Clarify return status: status=1 only on full success, status=0 on any failure
- Add early validation for missing SSH public key
- Handle edge case where account is deployed but destination creation fails
2025-10-14 15:35:02 +05:00
usmannasir
4da45eebf1 Improve exception handling in One-Click Backup fetchOCSites function
- Add specific exception handlers for common failure scenarios
- Support multiple SSH key formats (RSA, Ed25519, ECDSA, DSS)
- Add SSH key validation before connection attempts
- Add connection timeout and proper cleanup with finally block
- Provide actionable error messages for users
- Handle empty backup folders as success instead of error
- Add comprehensive logging for all error paths
- Improve path parsing with bounds checking
2025-10-14 15:31:42 +05:00
usmannasir
7cbb563d9c fix some ux on list wp sites 2025-10-13 13:09:06 +05:00
usmannasir
77e66cfe3d fix design of wp manager home 2025-10-13 00:24:45 +05:00
usmannasir
1ef188a20a bug fix: python 3.6 compatibility 2025-10-10 17:59:01 +05:00
usmannasir
ac6db0e575 bug fix: python 3.6 compatibility 2025-10-10 17:26:50 +05:00
usmannasir
e4b2584ae0 Fix AlmaLinux 8 installation: Add python-dotenv to requirements (v2.4.4)
- Install python-dotenv in virtual environment during CyberPanel setup
- Fixes Django's inability to load .env file on AlmaLinux 8
- Resolves "Access denied for user 'cyberpanel'@'localhost'" errors
- Added to all installation paths (normal, DEV, and after_install)

This ensures Django can properly load database credentials from .env file
on AlmaLinux 8 systems where python-dotenv was missing.
2025-10-10 01:00:22 +05:00
usmannasir
d540b24c8f bug fix: alma8 install 2025-10-10 00:09:42 +05:00
usmannasir
4408ca04c8 bug fix: staging site issue 2025-09-22 18:16:05 +05:00
usmannasir
503c464e48 bug fix: staging site issue 2025-09-22 17:46:10 +05:00
usmannasir
f48e7286df bug fix: staging site issue 2025-09-22 16:57:35 +05:00
usmannasir
ecd44c9d6a bug fix: staging site issue 2025-09-22 14:08:51 +05:00
usmannasir
fb16f4cf56 bug fix: staging site issue 2025-09-22 13:31:20 +05:00
usmannasir
26425dd397 bug fix: allowed host issue 2025-09-15 12:07:15 +05:00
usmannasir
d64b53ef63 bug fix: allowed host issue 2025-09-15 11:26:58 +05:00
Usman Nasir
7bd67d3df2 Merge pull request #1501 from master3395/v2.5.5-dev
V2.5.5 dev
2025-09-14 22:14:52 +05:00
Master3395
1fbbf66481 Add contributing guide link to README and improve security notice in SECURITY_INSTALLATION.md 2025-09-13 22:34:03 +02:00
Master3395
7bd66f7f06 Enhance environment variable management and security
- Updated .gitignore to include additional sensitive files and directories.
- Added python-dotenv to requirements for loading environment variables.
- Modified settings.py to load environment variables for sensitive configurations, including SECRET_KEY, DEBUG, and database credentials.
- Implemented secure .env file generation during installation to avoid hardcoding sensitive information.
- Introduced fallback method for settings update if environment generation fails.
2025-09-13 19:07:03 +02:00
Master3395
938fb6442b Merge pull request #1 from master3395/stable
Update backup controller to include backup frequency and retention data
2025-09-13 18:53:47 +02:00
Master3395
71275c8c56 Merge branch 'v2.5.5-dev' of https://github.com/master3395/cyberpanel into v2.5.5-dev 2025-09-13 18:39:00 +02:00
Master3395
0773d8d9a4 Add cosmetic context processor and update templates for custom CSS
- Introduced a new `cosmetic_context` processor to provide custom CSS data to templates.
- Updated `settings.py` to include the new context processor.
- Modified multiple HTML templates to utilize the `cosmetic` variable for dynamic CSS styling.
- Enhanced user interface elements with improved styling and accessibility features, including ARIA labels for form controls.
2025-09-13 18:38:57 +02:00
Usman Nasir
0c37a94e66 Merge pull request #1498 from master3395/v2.5.5-dev
V2.5.5 dev - New example plugin + Documentation + Security
2025-09-13 20:45:50 +05:00
Master3395
97fd4e055a Enhance security by adding rel="noopener" to external links
- Updated multiple HTML templates to include rel="noopener" on links that open in a new tab, improving security by preventing potential reverse tabnabbing attacks.
- This change affects various templates across the backup, base, file manager, mail server, and website functions sections.
2025-09-13 17:44:37 +02:00
Master3395
99bf8d9c96 Update backup controller to include backup frequency and retention data
https://www.facebook.com/groups/cyberpanel/permalink/3977223309255954/
2025-09-13 17:36:50 +02:00
Master3395
f95566d3eb Add pull image functionality and enhance error handling
- Implemented a new `pullImage` method in `ContainerManager` to pull Docker images with validation and error handling.
- Added a corresponding URL route for the `pullImage` view.
- Updated the `views.py` to handle user permissions and session management for the new feature.
- Improved error handling across the codebase by replacing `BaseException` with `Exception`.
- Enhanced rate limiting logic to support JSON format for tracking timestamps.
- Updated UI styles in `manageImages.html` for consistency in gradient backgrounds.
2025-09-12 22:35:02 +02:00
Master3395
1f4a577077 Enhance environment variable management with advanced mode and import/export features
- Implement advanced environment variable mode for bulk editing and easier management.
- Add functionality to import environment variables from existing Docker containers.
- Introduce export options for environment variables to .env files.
- Update UI to toggle between simple and advanced modes, with corresponding input fields.
- Enhance Docker Compose integration with environment variable handling and user guidance.
2025-09-12 21:10:06 +02:00
Master3395
583680ff90 Fix monthly bandwidth for websites
Fix monthly bandwidth for websites:
https://github.com/usmannasir/cyberpanel/issues/1496
2025-09-12 10:41:11 +02:00
Master3395
3d72839b33 Fix mirror gettoforge
https://github.com/usmannasir/cyberpanel/issues/1499
2025-09-12 09:42:52 +02:00
Master3395
601434eab6 Add security and more documentation
Add security and more documentation
2025-09-11 20:17:54 +02:00
Master3395
dfbbccf073 Add better plugin description + new example plugin
Add better plugin description + new example plugin
2025-09-11 20:04:09 +02:00
Usman Nasir
dbce860260 Merge pull request #1497 from master3395/v2.5.5-dev
Fix Mariadb on almalinux 9
2025-09-11 11:46:14 +05:00
Master3395
41ead838ef Add sieve by default.
Add sieve by default.
2025-09-10 20:01:52 +02:00
Master3395
90abff30ae Fix Mariadb on almalinux 9
Fix Mariadb on almalinux 9
2025-09-10 17:36:09 +02:00
usmannasir
b05d9cb5bb Implement comprehensive security for Docker container command execution
- Add command whitelist validation with 60+ safe commands
- Implement multi-layer security: whitelist + blacklist + specific rules
- Add rate limiting: max 10 commands per minute per user-container
- Enable comprehensive logging for all command executions
- Add input validation for container names and command syntax
- Implement output size limits to prevent memory exhaustion
- Allow privileged mode but restrict through command validation
- Add specific validation rules for systemctl, kill, wget/curl commands
- Block dangerous patterns: command injection, path traversal, destructive operations
- Maintain ACL-based container ownership verification
2025-09-10 14:23:40 +05:00
Usman Nasir
fb7bc20fa3 Merge pull request #1495 from master3395/stable
docs cleanup, link fixes, container console support, almalinux 10 compatibility, and adminpass special-char handling
2025-09-10 11:20:55 +05:00
Master3395
c5bb2f89ea Add Norwegian Bokmål language.
Add Norwegian Bokmål language.
2025-09-08 16:48:38 +02:00
Master3395
c06533b986 Fix ALL documentation links.
Fix ALL documentation links.
2025-09-08 11:50:35 +02:00
Master3395
0c8ee38c2b Add Almalinux 10 and php 84+85
Add Almalinux 10 and php 84+85
2025-09-07 22:57:53 +02:00
Master3395
c49200cca0 Resolve issue 1493
Should solve the issue in https://github.com/usmannasir/cyberpanel/issues/1493
2025-09-07 20:40:29 +02:00
Master3395
ef89effb80 Update README.md 2025-09-05 01:15:44 +02:00