Move guides to docs

Move guides to docs
This commit is contained in:
Master3395
2026-01-10 03:43:36 +01:00
parent c7625c318f
commit fade7c8ec7
20 changed files with 1646 additions and 0 deletions

View File

@@ -0,0 +1,431 @@
# CyberPanel 2FA Authentication Guide
## Overview
CyberPanel supports multiple two-factor authentication (2FA) methods to enhance security for user accounts. This guide covers all available authentication methods, their setup, and best practices.
## Table of Contents
1. [Available Authentication Methods](#available-authentication-methods)
2. [Traditional 2FA (TOTP)](#traditional-2fa-totp)
3. [WebAuthn/Passkey Authentication](#webauthnpasskey-authentication)
4. [Password Authentication](#password-authentication)
5. [Combined Authentication Strategies](#combined-authentication-strategies)
6. [Administrator Management](#administrator-management)
7. [Troubleshooting](#troubleshooting)
8. [Security Best Practices](#security-best-practices)
## Available Authentication Methods
### 1. Traditional 2FA (TOTP)
- **Type**: Time-based One-Time Password
- **Method**: Google Authenticator, Authy, or similar apps
- **Security Level**: High
- **User Experience**: Requires manual code entry
### 2. WebAuthn/Passkey Authentication
- **Type**: Modern passwordless authentication
- **Method**: Biometric authentication, security keys, or device passkeys
- **Security Level**: Very High
- **User Experience**: Seamless and user-friendly
### 3. Password Authentication
- **Type**: Traditional username/password
- **Method**: Standard login credentials
- **Security Level**: Basic
- **User Experience**: Simple but less secure
## Traditional 2FA (TOTP)
### How It Works
TOTP generates time-based codes that change every 30 seconds. Users scan a QR code with their authenticator app to set up 2FA.
### Setting Up TOTP 2FA
#### For Users
1. **Access User Management**
- Log in to CyberPanel
- Go to **User Management****Modify User**
- Select your user account
2. **Enable 2FA**
- Scroll to **Additional Features** section
- Check **"Enable Two-Factor Authentication (2FA)"**
- A QR code will appear
3. **Configure Authenticator App**
- Open your authenticator app (Google Authenticator, Authy, etc.)
- Scan the QR code displayed
- Or manually enter the secret key shown below the QR code
4. **Test 2FA**
- Enter a 6-digit code from your authenticator app
- Verify the setup works correctly
#### For Administrators
1. **Access User Management**
- Go to **User Management****Modify User**
- Select the user you want to configure
2. **Enable 2FA for User**
- Check **"Enable Two-Factor Authentication (2FA)"**
- Provide the QR code or secret key to the user
- Ensure the user completes the setup
### TOTP Configuration Options
#### Secret Key Management
- **Auto-generation**: CyberPanel automatically generates secure secret keys
- **Manual Entry**: Users can manually enter the secret key if QR scanning fails
- **Regeneration**: Secret keys can be regenerated if needed
#### QR Code Display
- **Automatic Display**: QR code appears when 2FA is enabled
- **Manual Key**: Secret key is always displayed for manual entry
- **Copy Function**: One-click copy to clipboard functionality
### Supported Authenticator Apps
- **Google Authenticator** (iOS/Android)
- **Authy** (iOS/Android/Desktop)
- **Microsoft Authenticator** (iOS/Android)
- **1Password** (iOS/Android/Desktop)
- **Bitwarden** (iOS/Android/Desktop)
- **Any TOTP-compatible app**
## WebAuthn/Passkey Authentication
### What is WebAuthn?
WebAuthn is a web standard that enables secure, passwordless authentication using public-key cryptography. It supports biometric authentication, security keys, and device passkeys.
### Setting Up WebAuthn
#### Prerequisites
- **HTTPS Required**: WebAuthn only works over secure connections
- **Modern Browser**: Chrome 67+, Firefox 60+, Safari 14+, Edge 79+
- **Compatible Device**: Device with biometric sensors or security key
#### For Users
1. **Access User Management**
- Go to **User Management****Modify User**
- Select your user account
2. **Enable WebAuthn**
- Scroll to **Passkey Authentication (WebAuthn)** section
- Check **"Enable Passkey Authentication"**
3. **Configure Settings**
- **Require Passkey for Login**: Enable for passwordless authentication
- **Allow Multiple Passkeys**: Enable to register multiple devices
- **Max Passkeys**: Set limit (default: 10)
- **Timeout**: Set timeout in seconds (default: 60)
4. **Register Passkeys**
- Click **"Register New Passkey"**
- Enter a name for your passkey (e.g., "iPhone", "Laptop")
- Follow your browser's prompts to complete registration
- Repeat for additional devices
#### For Administrators
1. **Access User Management**
- Go to **User Management****Modify User**
- Select the user you want to configure
2. **Enable WebAuthn for User**
- Check **"Enable Passkey Authentication"**
- Configure security policies
- Monitor registered passkeys
### WebAuthn Features
#### Passkey Management
- **Multiple Devices**: Register passkeys on phones, laptops, security keys
- **Custom Names**: Give descriptive names to your passkeys
- **Easy Removal**: Delete passkeys you no longer need
- **Backup Options**: Multiple passkeys for redundancy
#### Security Features
- **Replay Protection**: Each authentication uses a unique challenge
- **Credential Isolation**: Passkeys cannot be extracted or shared
- **User Verification**: Optional biometric or PIN verification
- **Session Management**: Secure session handling with expiration
### Supported WebAuthn Devices
- **Smartphones**: iPhone, Android phones with biometrics
- **Laptops**: MacBooks with Touch ID, Windows Hello devices
- **Security Keys**: YubiKey, Google Titan, etc.
- **Tablets**: iPads, Android tablets with biometrics
## Password Authentication
### Traditional Login
- **Username/Password**: Standard login credentials
- **Security Level**: Basic (not recommended alone)
- **Use Case**: Fallback authentication method
### Password Requirements
- **Minimum Length**: 8 characters (recommended: 12+)
- **Complexity**: Mix of uppercase, lowercase, numbers, symbols
- **Uniqueness**: Different from other accounts
- **Regular Updates**: Change passwords periodically
## Combined Authentication Strategies
### Strategy 1: Password + 2FA
- **Login Process**: Username + Password + TOTP code
- **Security Level**: High
- **User Experience**: Moderate (requires manual code entry)
- **Best For**: Users who prefer traditional 2FA
### Strategy 2: Password + Passkeys
- **Login Process**: Username + Password + Passkey
- **Security Level**: Very High
- **User Experience**: Good (biometric authentication)
- **Best For**: Users with compatible devices
### Strategy 3: Passkeys Only (Passwordless)
- **Login Process**: Username + Passkey only
- **Security Level**: Very High
- **User Experience**: Excellent (no password required)
- **Best For**: Security-conscious users with multiple devices
### Strategy 4: All Methods (Maximum Security)
- **Login Process**: Username + Password + 2FA + Passkeys
- **Security Level**: Maximum
- **User Experience**: Complex but flexible
- **Best For**: High-security environments
## Administrator Management
### User Authentication Settings
#### Accessing User Settings
1. **Navigate to User Management**
- Go to **User Management****Modify User**
- Select the user to manage
#### Available Settings
- **Enable/Disable 2FA**: Toggle TOTP authentication
- **Enable/Disable WebAuthn**: Toggle passkey authentication
- **Security Policies**: Set passkey limits and timeouts
- **View Credentials**: See registered passkeys and 2FA status
### Security Policies
#### Passkey Policies
- **Maximum Passkeys**: Limit number of registered passkeys per user
- **Timeout Settings**: Set authentication timeout duration
- **Device Requirements**: Specify required device capabilities
#### 2FA Policies
- **Secret Key Management**: Control secret key generation and regeneration
- **QR Code Display**: Manage QR code visibility
- **Backup Codes**: Generate backup codes for recovery
### Monitoring and Auditing
#### Authentication Logs
- **Login Attempts**: Track all authentication attempts
- **Method Used**: Record which authentication method was used
- **Success/Failure**: Monitor authentication success rates
- **Device Information**: Log device and browser details
#### Security Alerts
- **Failed Attempts**: Alert on multiple failed login attempts
- **Unusual Activity**: Detect suspicious authentication patterns
- **Device Changes**: Notify when new devices are registered
## Troubleshooting
### Common TOTP Issues
#### QR Code Not Scanning
**Problem**: QR code cannot be scanned by authenticator app
**Solutions**:
- Try manual key entry instead
- Ensure good lighting and camera focus
- Try a different authenticator app
- Regenerate the QR code
#### Time Synchronization Issues
**Problem**: Codes not working due to time differences
**Solutions**:
- Check device time is correct
- Sync device time with internet
- Try a different authenticator app
- Contact administrator for assistance
#### Lost Authenticator Device
**Problem**: Cannot access authenticator app
**Solutions**:
- Use backup codes if available
- Contact administrator to reset 2FA
- Set up 2FA on a new device
- Use alternative authentication methods
### Common WebAuthn Issues
#### "WebAuthn not supported" Error
**Problem**: Browser or device doesn't support WebAuthn
**Solutions**:
- Update browser to latest version
- Ensure HTTPS is enabled
- Check device compatibility
- Try a different browser
#### Registration Failed
**Problem**: Passkey registration fails
**Solutions**:
- Check browser console for errors
- Ensure user has permission to register passkeys
- Verify WebAuthn settings are properly configured
- Try a different device or browser
#### Authentication Failed
**Problem**: Passkey authentication fails
**Solutions**:
- Ensure passkey is still active
- Check that user has registered passkeys
- Verify challenge hasn't expired
- Try a different passkey or device
### General Authentication Issues
#### Login Not Working
**Problem**: Cannot log in with any method
**Solutions**:
- Check username and password
- Verify 2FA codes are current
- Ensure passkeys are properly registered
- Contact administrator for assistance
#### Account Locked
**Problem**: Account is locked due to failed attempts
**Solutions**:
- Wait for lockout period to expire
- Contact administrator to unlock account
- Check for security alerts
- Review recent login attempts
## Security Best Practices
### For Users
#### Password Security
- **Use Strong Passwords**: 12+ characters with mixed case, numbers, symbols
- **Unique Passwords**: Different password for each account
- **Regular Updates**: Change passwords every 90 days
- **Password Manager**: Use a reputable password manager
#### 2FA Security
- **Secure Device**: Use a trusted device for authenticator apps
- **Backup Codes**: Save backup codes in a secure location
- **Multiple Methods**: Set up multiple authentication methods
- **Regular Testing**: Test authentication methods regularly
#### WebAuthn Security
- **Multiple Passkeys**: Register passkeys on multiple devices
- **Secure Devices**: Only register passkeys on trusted devices
- **Regular Review**: Periodically review registered passkeys
- **Device Security**: Keep devices updated and secure
### For Administrators
#### System Security
- **HTTPS Enforcement**: Ensure all authentication uses HTTPS
- **Regular Updates**: Keep CyberPanel and dependencies updated
- **Monitoring**: Monitor authentication logs and alerts
- **Backup**: Regular backups of authentication data
#### User Management
- **Access Control**: Implement proper user access controls
- **Security Policies**: Enforce strong security policies
- **Training**: Provide security training to users
- **Incident Response**: Have procedures for security incidents
#### Configuration Security
- **Default Settings**: Change default passwords and settings
- **Network Security**: Implement proper network security
- **Logging**: Enable comprehensive logging
- **Auditing**: Regular security audits
## Advanced Configuration
### Custom Security Policies
#### Passkey Policies
```python
# Example: Custom passkey policies
WEBAUTHN_POLICIES = {
'max_credentials_per_user': 5,
'timeout_seconds': 120,
'require_user_verification': True,
'allowed_attestation_formats': ['none', 'packed']
}
```
#### 2FA Policies
```python
# Example: Custom 2FA policies
TOTP_POLICIES = {
'secret_key_length': 32,
'time_step': 30,
'window': 1,
'issuer_name': 'CyberPanel'
}
```
### Integration with External Systems
#### LDAP Integration
- **Active Directory**: Integrate with Windows Active Directory
- **OpenLDAP**: Connect to OpenLDAP servers
- **Multi-Factor**: Combine with external MFA systems
#### SSO Integration
- **SAML**: Single Sign-On with SAML providers
- **OAuth**: OAuth-based authentication
- **Custom Providers**: Integration with custom identity providers
## Migration and Upgrades
### Upgrading Authentication Methods
#### From Password to 2FA
1. **Enable 2FA**: Add TOTP authentication
2. **Test Setup**: Verify 2FA works correctly
3. **User Training**: Train users on 2FA usage
4. **Gradual Rollout**: Enable for users progressively
#### From 2FA to WebAuthn
1. **Enable WebAuthn**: Add passkey support
2. **User Migration**: Help users register passkeys
3. **Dual Support**: Support both methods during transition
4. **Full Migration**: Complete transition to WebAuthn
### Backup and Recovery
#### Authentication Backup
- **Secret Keys**: Backup TOTP secret keys securely
- **Passkey Data**: Backup WebAuthn credential data
- **User Data**: Regular backups of user authentication data
- **Configuration**: Backup authentication configuration
#### Recovery Procedures
- **Account Recovery**: Procedures for locked accounts
- **Data Restoration**: Restore authentication data from backups
- **Emergency Access**: Emergency access procedures
- **User Support**: Support procedures for authentication issues
## Conclusion
CyberPanel's multi-layered authentication system provides flexible and secure access control. By combining traditional 2FA with modern WebAuthn passkeys, administrators can offer users both security and convenience.
Choose the authentication methods that best fit your security requirements and user needs. Remember to regularly review and update your authentication policies to maintain optimal security.
For additional support and advanced configuration options, refer to the CyberPanel documentation and community resources.
---
**Note**: This guide covers all available authentication methods in CyberPanel. For the latest updates and additional features, refer to the official CyberPanel documentation.
*Last updated: January 2025*

257
docs/AIScannerDocs.md Normal file
View File

@@ -0,0 +1,257 @@
# CyberPanel AI Security Scanner Documentation
## Overview
The CyberPanel AI Security Scanner is an advanced security tool that uses artificial intelligence to scan WordPress websites for vulnerabilities, malware, and security threats. It provides comprehensive security analysis with detailed findings and recommendations.
## Table of Contents
1. [Features](#features)
2. [Getting Started](#getting-started)
3. [Configuration](#configuration)
4. [Running Scans](#running-scans)
5. [Understanding Scan Results](#understanding-scan-results)
6. [VPS Free Scans](#vps-free-scans)
7. [API Integration](#api-integration)
8. [Troubleshooting](#troubleshooting)
## Features
- **AI-Powered Analysis**: Uses advanced AI models to detect security threats and vulnerabilities
- **Real-time Scanning**: Monitor scan progress in real-time with live updates
- **Comprehensive Coverage**: Scans WordPress core files, themes, plugins, and custom code
- **Multiple Scan Types**: Choose between quick scans or full comprehensive scans
- **Detailed Reports**: Get detailed findings with severity levels and remediation suggestions
- **Platform Integration**: View detailed analysis on the CyberPersons platform
- **VPS Free Scans**: Eligible VPS customers get free security scans
## Getting Started
### Prerequisites
- CyberPanel v2.4.2 or higher
- WordPress website(s) hosted on your server
- Active internet connection for API communication
### Initial Setup
1. **Access AI Scanner**
- Log in to your CyberPanel admin panel
- Navigate to **Security****AI Security Scanner**
2. **Configure Payment Method** (Skip if using VPS free scans)
- Click on **Setup Payment Method**
- You'll be redirected to the CyberPersons platform
- Complete the payment setup process
- Return to CyberPanel after completion
3. **Verify Setup**
- Your account balance will be displayed
- API key will be automatically configured
## Configuration
### Payment Methods
The AI Scanner uses a pay-per-scan model. You can:
1. **Add Payment Method**
- Click **Add Payment Method** button
- Complete the setup on the platform
- Multiple payment methods supported
2. **Check Balance**
- Current balance displayed on main page
- Click **Refresh Balance** to update
### User Permissions
- **Admin Users**: Full access to all scans and settings
- **Reseller Users**: Can scan their own websites and view their scan history
- **Regular Users**: Can only scan websites they own
## Running Scans
### Starting a New Scan
1. **Select Website**
- Choose the WordPress website to scan from the dropdown
- Only websites you have access to will be shown
2. **Choose Scan Type**
- **Quick Scan**: Faster scan focusing on critical areas
- **Full Scan**: Comprehensive scan of all files
3. **Start Scan**
- Click **Start Scan** button
- Scan will begin immediately
### Monitoring Progress
During the scan, you can see:
- Current scan phase (Discovering files, Scanning, Analyzing)
- Progress percentage
- Files discovered and scanned
- Threats found in real-time
- Current file being analyzed
### Scan Phases
1. **Starting**: Initializing scan and setting up access
2. **Discovering Files**: Mapping website structure
3. **Scanning Files**: Analyzing files for threats
4. **Completing**: Finalizing analysis and generating report
5. **Completed**: Scan finished, results available
## Understanding Scan Results
### Scan Summary
Each completed scan shows:
- **Domain**: Website that was scanned
- **Scan Type**: Quick or Full scan
- **Duration**: Time taken to complete
- **Files Scanned**: Total number of files analyzed
- **Threats Found**: Number of security issues detected
- **Cost**: Scan cost (if applicable)
### Threat Levels
Threats are categorized by severity:
- **CRITICAL**: Immediate action required
- **HIGH**: Serious issues that should be addressed soon
- **MEDIUM**: Moderate risks that need attention
- **LOW**: Minor issues or recommendations
### Viewing Detailed Results
1. **In CyberPanel**
- Click on a scan in the history table
- View summary and key findings
2. **On Platform** (Detailed Analysis)
- Click **View on Platform** button
- Opens detailed AI analysis in new tab
- Includes code snippets, explanations, and fixes
## VPS Free Scans
### Eligibility
VPS customers hosted with participating providers receive free security scans:
- Automatic detection based on server IP
- No payment setup required
- Limited number of free scans per month
### Using Free Scans
1. System automatically detects VPS eligibility
2. Free scans available immediately
3. Remaining free scans shown when starting scan
4. After free scans exhausted, payment required
### Security
- Time-limited access tokens
- Scan-specific permissions
- Automatic token expiration
- IP-based restrictions
## Troubleshooting
### Common Issues
1. **"Payment not configured" Error**
- Complete payment setup process
- Verify API key is saved
- Check account balance
2. **"API key not configured" Error**
- Ensure payment setup completed
- For VPS users, check eligibility
- Try refreshing the page
3. **Scan Stuck in "Running" State**
- Wait 5-10 minutes for completion
- Check scan status on platform
- Contact support if persists
4. **"Access Denied" Errors**
- Verify you own the website
- Check user permissions
- Ensure website exists
### Getting Help
1. **Check Logs**
```bash
tail -f /home/cyberpanel/error-logs.txt | grep "AI Scanner"
```
2. **Support Channels**
- CyberPanel Forums: https://community.cyberpanel.net
- Support Ticket: https://platform.cyberpersons.com
## Best Practices
1. **Regular Scanning** (Upcoming feature)
- Schedule weekly or monthly scans
- Scan after major updates
- Scan new installations
2. **Act on Findings**
- Address CRITICAL issues immediately
- Plan remediation for HIGH issues
- Review all recommendations
3. **Security Hygiene**
- Keep WordPress updated
- Remove unused plugins/themes
- Use strong passwords
## Advanced Usage
### Command Line Interface
For automated scanning:
```python
# Example using CyberPanel API
import requests
# Start a scan
response = requests.post(
'https://your-server:8090/aiscanner/start-scan/',
json={
'domain': 'example.com',
'scan_type': 'full'
},
headers={'Authorization': 'your-api-key'}
)
```
### Integration with CI/CD
Include security scanning in your deployment pipeline:
1. Trigger scan after deployment
2. Wait for completion webhook
3. Fail pipeline if critical issues found
## Changelog
### Version 2.4.2
- Added platform monitor URL integration
- Support for VPS free scans
- Improved error handling
- Enhanced scan progress tracking
### Version 2.4.1
- Initial AI Scanner release
- WordPress security scanning
- Real-time progress updates
- Payment integration
---
**Note**: This documentation is for CyberPanel AI Security Scanner. For platform-specific features, refer to the [CyberPersons Platform Documentation](https://platform.cyberpersons.com/).

View File

@@ -0,0 +1,773 @@
# CyberPanel CLI Command Reference Guide
## Overview
This comprehensive guide covers all available CyberPanel CLI commands for managing your server directly from SSH. The CyberPanel CLI provides powerful command-line tools for website management, system administration, and automation.
## Table of Contents
1. [Getting Started](#getting-started)
2. [Website Management Commands](#website-management-commands)
3. [DNS Management Commands](#dns-management-commands)
4. [Database Management Commands](#database-management-commands)
5. [Email Management Commands](#email-management-commands)
6. [User Management Commands](#user-management-commands)
7. [Package Management Commands](#package-management-commands)
8. [System Administration Commands](#system-administration-commands)
9. [File Management Commands](#file-management-commands)
10. [Application Installation Commands](#application-installation-commands)
11. [Backup and Restore Commands](#backup-and-restore-commands)
12. [Security and Firewall Commands](#security-and-firewall-commands)
13. [Troubleshooting Commands](#troubleshooting-commands)
14. [Advanced Usage Examples](#advanced-usage-examples)
## Getting Started
### Accessing CyberPanel CLI
```bash
# Access CyberPanel CLI
sudo cyberpanel
# Or run specific commands directly
sudo cyberpanel [command] [options]
```
### Basic Syntax
```bash
cyberpanel [function] --parameter1 value1 --parameter2 value2
```
### Getting Help
```bash
# Show all available commands
cyberpanel --help
# Show help for specific command
cyberpanel createWebsite --help
```
## Website Management Commands
### Create Website
```bash
# Basic website creation
cyberpanel createWebsite \
--package Default \
--owner admin \
--domainName example.com \
--email admin@example.com \
--php 8.1
# With SSL and DKIM
cyberpanel createWebsite \
--package Default \
--owner admin \
--domainName example.com \
--email admin@example.com \
--php 8.1 \
--ssl 1 \
--dkim 1
```
**Parameters:**
- `--package`: Package name (e.g., Default, CLI)
- `--owner`: Owner username
- `--domainName`: Domain name to create
- `--email`: Administrator email
- `--php`: PHP version (5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3)
- `--ssl`: Enable SSL (1) or disable (0)
- `--dkim`: Enable DKIM (1) or disable (0)
- `--openBasedir`: Enable open_basedir protection (1) or disable (0)
### Delete Website
```bash
# Delete a website
cyberpanel deleteWebsite \
--domainName example.com
```
### List Websites
```bash
# List all websites
cyberpanel listWebsites
```
### Change PHP Version
```bash
# Change PHP version for a website
cyberpanel changePHP \
--domainName example.com \
--php 8.1
```
### Change Package
```bash
# Change website package
cyberpanel changePackage \
--domainName example.com \
--packageName CLI
```
## DNS Management Commands
### Create DNS Record
```bash
# Create A record
cyberpanel createDNSRecord \
--domainName example.com \
--name www \
--recordType A \
--value 192.168.1.100 \
--priority 0 \
--ttl 3600
# Create MX record
cyberpanel createDNSRecord \
--domainName example.com \
--name @ \
--recordType MX \
--value mail.example.com \
--priority 10 \
--ttl 3600
# Create CNAME record
cyberpanel createDNSRecord \
--domainName example.com \
--name blog \
--recordType CNAME \
--value example.com \
--priority 0 \
--ttl 3600
```
**Parameters:**
- `--domainName`: Domain name
- `--name`: Record name (subdomain or @ for root)
- `--recordType`: Record type (A, AAAA, CNAME, MX, TXT, NS, SRV)
- `--value`: Record value (IP address, hostname, text)
- `--priority`: Priority (for MX records)
- `--ttl`: Time to live in seconds
### List DNS Records
```bash
# List DNS records as JSON
cyberpanel listDNSJson \
--domainName example.com
# List DNS records (human readable)
cyberpanel listDNS \
--domainName example.com
```
### Delete DNS Record
```bash
# Delete DNS record by ID
cyberpanel deleteDNSRecord \
--recordID 123
```
## Database Management Commands
### Create Database
```bash
# Create MySQL database
cyberpanel createDatabase \
--databaseWebsite example.com \
--dbName mydatabase \
--dbUsername dbuser \
--dbPassword securepassword
```
**Parameters:**
- `--databaseWebsite`: Associated website domain
- `--dbName`: Database name
- `--dbUsername`: Database username
- `--dbPassword`: Database password
### Delete Database
```bash
# Delete database
cyberpanel deleteDatabase \
--dbName mydatabase
```
### List Databases
```bash
# List all databases
cyberpanel listDatabases
```
## Email Management Commands
### Create Email Account
```bash
# Create email account
cyberpanel createEmail \
--userName admin \
--password securepassword \
--databaseWebsite example.com
```
**Parameters:**
- `--userName`: Email username (without @domain.com)
- `--password`: Email password
- `--databaseWebsite`: Associated website domain
### Delete Email Account
```bash
# Delete email account
cyberpanel deleteEmail \
--userName admin \
--databaseWebsite example.com
```
### List Email Accounts
```bash
# List email accounts
cyberpanel listEmails \
--databaseWebsite example.com
```
## User Management Commands
### Create User
```bash
# Create new user
cyberpanel createUser \
--firstName John \
--lastName Doe \
--userName johndoe \
--email john@example.com \
--websitesLimit 5 \
--selectedACL user \
--securityLevel 0
```
**Parameters:**
- `--firstName`: User's first name
- `--lastName`: User's last name
- `--userName`: Username
- `--email`: User's email address
- `--websitesLimit`: Maximum number of websites
- `--selectedACL`: Access control level (user, reseller, admin)
- `--securityLevel`: Security level (0=normal, 1=high)
### Delete User
```bash
# Delete user
cyberpanel deleteUser \
--userName johndoe
```
### List Users
```bash
# List all users
cyberpanel listUsers
```
### Change User Password
```bash
# Change user password
cyberpanel changeUserPass \
--userName johndoe \
--password newpassword
```
### Suspend/Unsuspend User
```bash
# Suspend user
cyberpanel suspendUser \
--userName johndoe \
--state 1
# Unsuspend user
cyberpanel suspendUser \
--userName johndoe \
--state 0
```
## Package Management Commands
### Create Package
```bash
# Create hosting package
cyberpanel createPackage \
--packageName MyPackage \
--diskSpace 1024 \
--bandwidth 10240 \
--emailAccounts 10 \
--dataBases 5 \
--ftpAccounts 5 \
--allowedDomains 3
```
**Parameters:**
- `--packageName`: Package name
- `--diskSpace`: Disk space in MB
- `--bandwidth`: Bandwidth in MB
- `--emailAccounts`: Number of email accounts
- `--dataBases`: Number of databases
- `--ftpAccounts`: Number of FTP accounts
- `--allowedDomains`: Number of allowed domains
### Delete Package
```bash
# Delete package
cyberpanel deletePackage \
--packageName MyPackage
```
### List Packages
```bash
# List all packages
cyberpanel listPackages
```
## System Administration Commands
### Fix File Permissions
```bash
# Fix file permissions for a domain
cyberpanel fixFilePermissions \
--domainName example.com
```
**Note**: This command was recently added and fixes file permissions for websites.
### Switch to LiteSpeed Enterprise
```bash
# Switch to LiteSpeed Enterprise
cyberpanel switchTOLSWS \
--licenseKey YOUR_LITESPEED_LICENSE_KEY
```
### Verify Connection
```bash
# Verify CyberPanel connection
cyberpanel verifyConn \
--adminUser admin \
--adminPass yourpassword
```
## File Management Commands
### File Manager Operations
```bash
# List files (via FileManager)
cyberpanel listFiles \
--domainName example.com \
--path public_html
```
## Application Installation Commands
### Install WordPress
```bash
# Install WordPress
cyberpanel installWordPress \
--domainName example.com \
--password adminpass \
--siteTitle "My WordPress Site" \
--path blog
```
**Parameters:**
- `--domainName`: Domain name
- `--password`: WordPress admin password
- `--siteTitle`: Site title
- `--path`: Installation path (optional, defaults to root)
### Install Joomla
```bash
# Install Joomla
cyberpanel installJoomla \
--domainName example.com \
--password adminpass \
--siteTitle "My Joomla Site" \
--path joomla
```
## Backup and Restore Commands
### Create Backup
```bash
# Create website backup
cyberpanel createBackup \
--domainName example.com
```
### Restore Backup
```bash
# Restore website backup
cyberpanel restoreBackup \
--domainName example.com \
--fileName /path/to/backup/file.tar.gz
```
**Parameters:**
- `--domainName`: Domain name
- `--fileName`: Complete path to backup file
### List Backups
```bash
# List available backups
cyberpanel listBackups \
--domainName example.com
```
## Security and Firewall Commands
### Firewall Management
```bash
# List firewall rules
cyberpanel listFirewallRules
# Add firewall rule
cyberpanel addFirewallRule \
--port 8080 \
--action Allow
# Delete firewall rule
cyberpanel deleteFirewallRule \
--ruleID 123
```
## Troubleshooting Commands
### System Status
```bash
# Check CyberPanel version
cyberpanel version
# Check system status
cyberpanel status
# Verify installation
cyberpanel verifyInstall
```
### Log Commands
```bash
# View CyberPanel logs
cyberpanel logs
# View error logs
cyberpanel errorLogs
# Clear logs
cyberpanel clearLogs
```
## Advanced Usage Examples
### Automated Website Deployment
```bash
#!/bin/bash
# Script to create a complete website setup
DOMAIN="example.com"
OWNER="admin"
EMAIL="admin@example.com"
PACKAGE="Default"
# Create website
cyberpanel createWebsite \
--package $PACKAGE \
--owner $OWNER \
--domainName $DOMAIN \
--email $EMAIL \
--php 8.1 \
--ssl 1
# Create database
cyberpanel createDatabase \
--databaseWebsite $DOMAIN \
--dbName wpdb \
--dbUsername wpuser \
--dbPassword $(openssl rand -base64 32)
# Create email
cyberpanel createEmail \
--userName admin \
--password $(openssl rand -base64 16) \
--databaseWebsite $DOMAIN
# Install WordPress
cyberpanel installWordPress \
--domainName $DOMAIN \
--password $(openssl rand -base64 16) \
--siteTitle "My Website"
echo "Website setup complete for $DOMAIN"
```
### Bulk User Creation
```bash
#!/bin/bash
# Script to create multiple users
USERS=("user1" "user2" "user3")
for USER in "${USERS[@]}"; do
cyberpanel createUser \
--firstName "$USER" \
--lastName "User" \
--userName "$USER" \
--email "$USER@example.com" \
--websitesLimit 3 \
--selectedACL user \
--securityLevel 0
done
```
### Website Maintenance Script
```bash
#!/bin/bash
# Script for website maintenance
# List all websites
WEBSITES=$(cyberpanel listWebsites | grep -o '"[^"]*\.com"' | tr -d '"')
for WEBSITE in $WEBSITES; do
echo "Processing $WEBSITE..."
# Fix permissions
cyberpanel fixFilePermissions --domainName $WEBSITE
# Create backup
cyberpanel createBackup --domainName $WEBSITE
echo "Completed $WEBSITE"
done
```
## Common Error Messages and Solutions
### "Please enter the domain" Error
```bash
# Make sure to include all required parameters
cyberpanel createWebsite \
--package Default \
--owner admin \
--domainName example.com \
--email admin@example.com \
--php 8.1
```
### "Administrator not found" Error
```bash
# Verify the owner exists
cyberpanel listUsers | grep admin
# Create the owner if it doesn't exist
cyberpanel createUser \
--firstName Admin \
--lastName User \
--userName admin \
--email admin@example.com \
--websitesLimit 10 \
--selectedACL admin
```
### "Package not found" Error
```bash
# List available packages
cyberpanel listPackages
# Create package if needed
cyberpanel createPackage \
--packageName Default \
--diskSpace 1024 \
--bandwidth 10240 \
--emailAccounts 10 \
--dataBases 5 \
--ftpAccounts 5 \
--allowedDomains 3
```
## Best Practices
### 1. Always Use Full Parameters
```bash
# Good - explicit parameters
cyberpanel createWebsite \
--package Default \
--owner admin \
--domainName example.com \
--email admin@example.com \
--php 8.1
# Avoid - relying on defaults
cyberpanel createWebsite --domainName example.com
```
### 2. Use Strong Passwords
```bash
# Generate secure passwords
cyberpanel createDatabase \
--databaseWebsite example.com \
--dbName mydb \
--dbUsername dbuser \
--dbPassword $(openssl rand -base64 32)
```
### 3. Backup Before Changes
```bash
# Always backup before making changes
cyberpanel createBackup --domainName example.com
cyberpanel changePHP --domainName example.com --php 8.1
```
### 4. Use Scripts for Automation
```bash
# Create reusable scripts
cat > setup-website.sh << 'EOF'
#!/bin/bash
DOMAIN=$1
if [ -z "$DOMAIN" ]; then
echo "Usage: $0 domain.com"
exit 1
fi
cyberpanel createWebsite \
--package Default \
--owner admin \
--domainName $DOMAIN \
--email admin@$DOMAIN \
--php 8.1 \
--ssl 1
EOF
chmod +x setup-website.sh
./setup-website.sh example.com
```
## Integration with Automation Tools
### Ansible Playbook Example
```yaml
---
- name: Setup CyberPanel Website
hosts: cyberpanel_servers
tasks:
- name: Create website
command: >
cyberpanel createWebsite
--package {{ package_name }}
--owner {{ owner_name }}
--domainName {{ domain_name }}
--email {{ admin_email }}
--php {{ php_version }}
register: website_result
- name: Create database
command: >
cyberpanel createDatabase
--databaseWebsite {{ domain_name }}
--dbName {{ db_name }}
--dbUsername {{ db_user }}
--dbPassword {{ db_password }}
when: website_result.rc == 0
```
### Docker Integration
```dockerfile
FROM ubuntu:20.04
# Install CyberPanel
RUN wget -O - https://cyberpanel.sh/install.sh | bash
# Copy setup script
COPY setup.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/setup.sh
# Run setup on container start
CMD ["/usr/local/bin/setup.sh"]
```
## Getting Help
### Command Help
```bash
# Get help for any command
cyberpanel [command] --help
# Example
cyberpanel createWebsite --help
```
### Logs and Debugging
```bash
# Check CyberPanel logs
tail -f /usr/local/lscp/logs/error.log
# Check system logs
journalctl -u lscpd -f
# Enable debug mode
export CYBERPANEL_DEBUG=1
cyberpanel createWebsite --domainName example.com
```
### Community Support
- **CyberPanel Forums**: https://community.cyberpanel.net
- **GitHub Issues**: https://github.com/usmannasir/cyberpanel/issues
- **Discord Server**: https://discord.gg/cyberpanel
---
**Note**: This guide covers the most commonly used CyberPanel CLI commands. For the complete list of available commands and their parameters, run `cyberpanel --help` on your server.
*Last updated: January 2025*

829
docs/CUSTOM_CSS_GUIDE.md Normal file
View File

@@ -0,0 +1,829 @@
# CyberPanel 2.5.5-dev Custom CSS Guide
A comprehensive guide for creating custom CSS that fully works with the new design system of CyberPanel 2.5.5-dev.
## Table of Contents
1. [Overview](#overview)
2. [Design System Architecture](#design-system-architecture)
3. [CSS Variables Reference](#css-variables-reference)
4. [Component Structure](#component-structure)
5. [Customization Examples](#customization-examples)
6. [Best Practices](#best-practices)
7. [Troubleshooting](#troubleshooting)
8. [Advanced Techniques](#advanced-techniques)
## Overview
CyberPanel 2.5.5-dev features a modern, CSS-variable-based design system that supports both light and dark themes. The system is built with:
- **CSS Custom Properties (Variables)** for consistent theming
- **Modern CSS Grid and Flexbox** layouts
- **Responsive design** principles
- **Dark mode support** with automatic theme switching
- **Component-based architecture** for easy customization
## Design System Architecture
### Core Structure
The design system is built around CSS custom properties defined in `:root` and `[data-theme="dark"]` selectors:
```css
:root {
/* Light Theme Variables */
--bg-primary: #f0f0ff;
--bg-secondary: white;
--text-primary: #2f3640;
--accent-color: #5856d6;
/* ... more variables */
}
[data-theme="dark"] {
/* Dark Theme Variables */
--bg-primary: #0f0f23;
--bg-secondary: #1a1a3e;
--text-primary: #e4e4e7;
--accent-color: #7c7ff3;
/* ... more variables */
}
```
### Key Components
1. **Header** (`#header`) - Top navigation bar
2. **Sidebar** (`#sidebar`) - Left navigation panel
3. **Main Content** (`#main-content`) - Page content area
4. **Cards** (`.content-card`) - Content containers
5. **Buttons** (`.btn`) - Interactive elements
6. **Forms** (`.form-*`) - Input elements
## CSS Variables Reference
### Color Variables
#### Background Colors
```css
--bg-primary /* Main background color */
--bg-secondary /* Card/container background */
--bg-sidebar /* Sidebar background */
--bg-sidebar-item /* Sidebar menu item background */
--bg-hover /* Hover state background */
```
#### Text Colors
```css
--text-primary /* Main text color */
--text-secondary /* Secondary text color */
--text-heading /* Heading text color */
```
#### Accent Colors
```css
--accent-color /* Primary accent color */
--accent-hover /* Accent hover state */
--danger-color /* Error/danger color */
--success-color /* Success color */
```
#### Border & Shadow
```css
--border-color /* Default border color */
--shadow-color /* Default shadow color */
```
### Special Variables
#### Gradients
```css
--warning-bg /* Warning banner gradient */
--ai-banner-bg /* AI scanner banner gradient */
```
#### Status Colors
```css
--success-bg /* Success background */
--success-border /* Success border */
--danger-bg /* Danger background */
--danger-border /* Danger border */
--warning-bg /* Warning background */
--info-bg /* Info background */
```
## Component Structure
### Header Component
```css
#header {
background: var(--bg-secondary);
height: 80px;
display: flex;
align-items: center;
padding: 0 30px;
box-shadow: 0 2px 12px var(--shadow-color);
position: fixed;
top: 0;
left: 260px;
right: 0;
z-index: 1000;
}
```
**Customization Example:**
```css
/* Change header height and add custom styling */
#header {
height: 100px;
background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
border-bottom: 3px solid var(--accent-color);
}
#header .logo-text .brand {
font-size: 32px;
text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
```
### Sidebar Component
```css
#sidebar {
width: 260px;
background: var(--bg-sidebar);
height: 100vh;
position: fixed;
left: 0;
top: 0;
overflow-y: auto;
z-index: 1001;
}
```
**Customization Example:**
```css
/* Make sidebar wider with custom styling */
#sidebar {
width: 300px;
background: linear-gradient(180deg, var(--bg-sidebar), var(--bg-secondary));
border-right: 2px solid var(--accent-color);
}
#sidebar .menu-item {
margin: 4px 20px;
border-radius: 12px;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
#sidebar .menu-item:hover {
transform: translateX(5px);
box-shadow: 0 4px 12px var(--shadow-color);
}
```
### Content Cards
```css
.content-card {
background: var(--bg-secondary);
border-radius: 12px;
padding: 30px;
box-shadow: 0 2px 8px var(--shadow-color);
border: 1px solid var(--border-color);
margin-bottom: 25px;
}
```
**Customization Example:**
```css
/* Add glassmorphism effect to cards */
.content-card {
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.2);
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}
[data-theme="dark"] .content-card {
background: rgba(26, 26, 62, 0.3);
border: 1px solid rgba(255, 255, 255, 0.1);
}
```
## Customization Examples
### 1. Complete Theme Override
```css
/* Custom Purple Theme */
:root {
--bg-primary: #f8f4ff;
--bg-secondary: #ffffff;
--bg-sidebar: #f3f0ff;
--bg-hover: #e8e0ff;
--text-primary: #2d1b69;
--text-secondary: #6b46c1;
--accent-color: #8b5cf6;
--accent-hover: #7c3aed;
--border-color: #e0d7ff;
--shadow-color: rgba(139, 92, 246, 0.1);
}
[data-theme="dark"] {
--bg-primary: #1a0b2e;
--bg-secondary: #2d1b69;
--bg-sidebar: #1e0a3e;
--bg-hover: #3d2a7a;
--text-primary: #f3f0ff;
--text-secondary: #c4b5fd;
--accent-color: #a78bfa;
--accent-hover: #8b5cf6;
--border-color: #4c1d95;
--shadow-color: rgba(139, 92, 246, 0.3);
}
```
### 2. Custom Button Styles
```css
/* Custom button variants */
.btn-custom {
background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
border: none;
border-radius: 20px;
padding: 12px 24px;
color: white;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.5px;
box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
transition: all 0.3s ease;
}
.btn-custom:hover {
transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}
.btn-custom:active {
transform: translateY(0);
}
```
### 3. Custom Sidebar Menu Items
```css
/* Animated sidebar menu items */
#sidebar .menu-item {
position: relative;
overflow: hidden;
}
#sidebar .menu-item::before {
content: '';
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
transition: left 0.5s;
}
#sidebar .menu-item:hover::before {
left: 100%;
}
#sidebar .menu-item .icon-wrapper {
position: relative;
z-index: 1;
}
```
### 4. Custom Form Styling
```css
/* Modern form inputs */
.form-control {
border: 2px solid var(--border-color);
border-radius: 12px;
padding: 12px 16px;
font-size: 14px;
transition: all 0.3s ease;
background: var(--bg-secondary);
}
.form-control:focus {
border-color: var(--accent-color);
box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.1);
transform: translateY(-1px);
}
.form-control::placeholder {
color: var(--text-secondary);
opacity: 0.7;
}
```
### 5. Custom Notifications
```css
/* Custom notification banners */
.notification-banner {
background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
border-radius: 16px;
padding: 20px;
margin: 20px;
box-shadow: 0 8px 32px rgba(139, 92, 246, 0.3);
position: relative;
overflow: hidden;
}
.notification-banner::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
height: 4px;
background: linear-gradient(90deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4);
animation: rainbow 3s linear infinite;
}
@keyframes rainbow {
0% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
100% { background-position: 0% 50%; }
}
```
## Best Practices
### 1. Use CSS Variables
Always use CSS variables instead of hardcoded values:
```css
/* ✅ Good */
.custom-element {
background: var(--bg-secondary);
color: var(--text-primary);
border: 1px solid var(--border-color);
}
/* ❌ Bad */
.custom-element {
background: white;
color: #2f3640;
border: 1px solid #e8e9ff;
}
```
### 2. Support Both Themes
Always provide both light and dark theme support:
```css
.custom-element {
background: var(--bg-secondary);
color: var(--text-primary);
}
/* Dark theme specific adjustments */
[data-theme="dark"] .custom-element {
/* Additional dark theme styling if needed */
}
```
### 3. Use Semantic Class Names
```css
/* ✅ Good */
.primary-button { }
.content-container { }
.navigation-item { }
/* ❌ Bad */
.red-button { }
.big-box { }
.item1 { }
```
### 4. Maintain Responsive Design
```css
.custom-element {
padding: 20px;
font-size: 16px;
}
@media (max-width: 768px) {
.custom-element {
padding: 15px;
font-size: 14px;
}
}
```
### 5. Use Modern CSS Features
```css
.custom-element {
/* Use CSS Grid for layouts */
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 20px;
/* Use Flexbox for alignment */
align-items: center;
justify-content: space-between;
/* Use CSS custom properties for calculations */
--element-height: 60px;
height: var(--element-height);
/* Use modern selectors */
&:hover { }
&:focus-within { }
}
```
## Troubleshooting
### Common Issues
#### 1. Custom CSS Not Applying
**Problem:** Custom CSS doesn't appear to be working.
**Solution:**
- Check CSS specificity - use more specific selectors
- Ensure CSS is placed after the base styles
- Use `!important` sparingly and only when necessary
```css
/* Increase specificity */
#main-content .content-card .custom-element {
background: var(--bg-secondary);
}
```
#### 2. Dark Mode Not Working
**Problem:** Custom styles don't adapt to dark mode.
**Solution:**
- Always use CSS variables
- Test both light and dark themes
- Provide dark mode specific overrides when needed
```css
.custom-element {
background: var(--bg-secondary);
color: var(--text-primary);
}
[data-theme="dark"] .custom-element {
/* Dark mode specific adjustments */
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
```
#### 3. Responsive Issues
**Problem:** Custom styles break on mobile devices.
**Solution:**
- Use relative units (rem, em, %)
- Test on different screen sizes
- Use CSS Grid and Flexbox for responsive layouts
```css
.custom-element {
width: 100%;
max-width: 1200px;
margin: 0 auto;
padding: 1rem;
}
@media (max-width: 768px) {
.custom-element {
padding: 0.5rem;
}
}
```
## Advanced Techniques
### 1. CSS Animations
```css
/* Smooth page transitions */
.page-transition {
animation: fadeIn 0.3s ease-in-out;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(20px); }
to { opacity: 1; transform: translateY(0); }
}
/* Hover animations */
.interactive-element {
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.interactive-element:hover {
transform: translateY(-2px) scale(1.02);
box-shadow: 0 8px 25px var(--shadow-color);
}
```
### 2. CSS Grid Layouts
```css
/* Advanced grid layouts */
.dashboard-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 20px;
padding: 20px;
}
.dashboard-card {
grid-column: span 1;
background: var(--bg-secondary);
border-radius: 12px;
padding: 20px;
box-shadow: 0 2px 8px var(--shadow-color);
}
.dashboard-card.featured {
grid-column: span 2;
}
@media (max-width: 768px) {
.dashboard-card.featured {
grid-column: span 1;
}
}
```
### 3. CSS Custom Properties with JavaScript
```css
/* Dynamic theming with CSS variables */
:root {
--custom-accent: #5856d6;
--custom-accent-hover: #4644c0;
}
.custom-theme {
--accent-color: var(--custom-accent);
--accent-hover: var(--custom-accent-hover);
}
```
### 4. Advanced Selectors
```css
/* Complex selectors for specific styling */
#sidebar .menu-item:not(.active):hover {
background: var(--bg-hover);
transform: translateX(5px);
}
.content-card > *:first-child {
margin-top: 0;
}
.content-card > *:last-child {
margin-bottom: 0;
}
/* Attribute selectors */
[data-status="success"] {
border-left: 4px solid var(--success-color);
}
[data-status="error"] {
border-left: 4px solid var(--danger-color);
}
```
### 5. CSS Functions and Calculations
```css
/* Using CSS functions */
.responsive-text {
font-size: clamp(14px, 2.5vw, 18px);
line-height: calc(1.5em + 0.5vw);
}
.dynamic-spacing {
padding: calc(1rem + 2vw);
margin: calc(0.5rem + 1vw);
}
/* CSS custom properties with calculations */
:root {
--base-size: 16px;
--scale-factor: 1.2;
--large-size: calc(var(--base-size) * var(--scale-factor));
}
```
## Implementation Guide
### Step 1: Access the Design Page
1. Log into CyberPanel
2. Navigate to **Design** in the sidebar
3. Scroll down to the **Custom CSS** section
### Step 2: Add Your Custom CSS
1. Paste your custom CSS into the textarea
2. Click **Save Changes**
3. Refresh the page to see your changes
### Step 3: Test Your Changes
1. Test in both light and dark modes
2. Test on different screen sizes
3. Verify all interactive elements work correctly
### Step 4: Iterate and Refine
1. Make adjustments as needed
2. Test thoroughly before finalizing
3. Document your customizations
## Example: Complete Custom Theme
Here's a complete example of a custom theme that you can use as a starting point:
```css
/* Custom CyberPanel Theme - Ocean Blue */
/* Light Theme */
:root {
--bg-primary: #f0f9ff;
--bg-secondary: #ffffff;
--bg-sidebar: #e0f2fe;
--bg-sidebar-item: #ffffff;
--bg-hover: #bae6fd;
--text-primary: #0c4a6e;
--text-secondary: #0369a1;
--text-heading: #0c4a6e;
--border-color: #bae6fd;
--shadow-color: rgba(6, 105, 161, 0.1);
--accent-color: #0284c7;
--accent-hover: #0369a1;
--danger-color: #dc2626;
--success-color: #059669;
--warning-bg: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
--ai-banner-bg: linear-gradient(135deg, #0284c7 0%, #0369a1 50%, #0c4a6e 100%);
}
/* Dark Theme */
[data-theme="dark"] {
--bg-primary: #0c4a6e;
--bg-secondary: #075985;
--bg-sidebar: #0c4a6e;
--bg-sidebar-item: #075985;
--bg-hover: #0369a1;
--text-primary: #e0f2fe;
--text-secondary: #bae6fd;
--text-heading: #f0f9ff;
--border-color: #0369a1;
--shadow-color: rgba(0, 0, 0, 0.3);
--accent-color: #38bdf8;
--accent-hover: #0ea5e9;
--danger-color: #f87171;
--success-color: #34d399;
--warning-bg: linear-gradient(135deg, #78350f 0%, #92400e 100%);
--ai-banner-bg: linear-gradient(135deg, #0c4a6e 0%, #075985 50%, #0369a1 100%);
}
/* Custom Header Styling */
#header {
background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
box-shadow: 0 4px 20px var(--shadow-color);
}
#header .logo-text .brand {
color: white;
text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
/* Custom Sidebar Styling */
#sidebar {
background: linear-gradient(180deg, var(--bg-sidebar), var(--bg-secondary));
border-right: 3px solid var(--accent-color);
}
#sidebar .menu-item {
border-radius: 12px;
margin: 4px 20px;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
#sidebar .menu-item:hover {
transform: translateX(8px);
box-shadow: 0 4px 15px var(--shadow-color);
}
#sidebar .menu-item.active {
background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
box-shadow: 0 4px 15px rgba(2, 132, 199, 0.3);
}
/* Custom Content Cards */
.content-card {
background: var(--bg-secondary);
border-radius: 16px;
box-shadow: 0 4px 20px var(--shadow-color);
border: 1px solid var(--border-color);
position: relative;
overflow: hidden;
}
.content-card::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
height: 4px;
background: linear-gradient(90deg, var(--accent-color), var(--accent-hover));
}
/* Custom Buttons */
.btn {
border-radius: 12px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.5px;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-primary {
background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
box-shadow: 0 4px 15px rgba(2, 132, 199, 0.3);
}
.btn-primary:hover {
transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(2, 132, 199, 0.4);
}
/* Custom Form Elements */
.form-control {
border: 2px solid var(--border-color);
border-radius: 12px;
transition: all 0.3s ease;
}
.form-control:focus {
border-color: var(--accent-color);
box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.1);
transform: translateY(-1px);
}
/* Custom Animations */
@keyframes slideIn {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.content-card {
animation: slideIn 0.5s ease-out;
}
/* Responsive Design */
@media (max-width: 768px) {
#sidebar {
width: 100%;
height: auto;
position: relative;
}
#header {
left: 0;
}
.content-card {
margin: 10px;
padding: 20px;
}
}
```
This guide provides everything you need to create beautiful, functional custom CSS for CyberPanel 2.5.5+. Remember to always test your changes thoroughly and use the CSS variables for consistency across themes.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,316 @@
# Debian 13 Installation Guide for CyberPanel
## 🎯 Overview
This guide provides step-by-step instructions for installing CyberPanel on Debian 13 (Bookworm). Debian 13 support has been added to CyberPanel with full compatibility for package management, service configuration, and web server setup.
## 📋 Prerequisites
### System Requirements
- **OS**: Debian 13 (Bookworm) x86_64
- **RAM**: Minimum 1GB (2GB+ recommended)
- **Storage**: Minimum 10GB free space (20GB+ recommended)
- **CPU**: 2+ cores recommended
- **Network**: Internet connection required
### Supported Debian Versions
-**Debian 13** (Bookworm) - Full Support
-**Debian 12** (Bookworm) - Full Support
-**Debian 11** (Bullseye) - Full Support
## 🚀 Installation Steps
### Step 1: Update System
```bash
# Update package lists
sudo apt update
# Upgrade system packages
sudo apt upgrade -y
# Install essential packages
sudo apt install -y curl wget git
```
### Step 2: Download and Run CyberPanel Installer
```bash
# Download the latest CyberPanel installer
wget https://cyberpanel.sh/install.sh
# Make the installer executable
chmod +x install.sh
# Run the installer
sudo ./install.sh
```
### Step 3: Follow Installation Prompts
The installer will guide you through:
1. **License Agreement**: Accept the terms
2. **Installation Type**: Choose between:
- OpenLiteSpeed (Free)
- LiteSpeed Enterprise (Requires license)
3. **MySQL Configuration**:
- Single MySQL instance (recommended)
- Double MySQL instance (for high availability)
4. **Additional Services**:
- Postfix/Dovecot (Email server)
- PowerDNS (DNS server)
- PureFTPD (FTP server)
### Step 4: Verify Installation
```bash
# Check CyberPanel service status
sudo systemctl status lscpd
# Check web server status
sudo systemctl status apache2
# Check if CyberPanel is accessible
curl -I http://localhost:8090
```
## 🔧 Post-Installation Configuration
### Access CyberPanel
1. Open your web browser
2. Navigate to: `http://your-server-ip:8090`
3. Default login credentials:
- **Username**: `admin`
- **Password**: `123456` (change immediately!)
### Change Default Password
```bash
# Login to CyberPanel CLI
sudo cyberpanel
# Change admin password
cyberpanel --change-password admin
```
### Configure Firewall
```bash
# Allow CyberPanel ports
sudo ufw allow 8090/tcp
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw allow 21/tcp
sudo ufw allow 25/tcp
sudo ufw allow 53/tcp
sudo ufw allow 587/tcp
sudo ufw allow 993/tcp
sudo ufw allow 995/tcp
# Enable firewall
sudo ufw enable
```
## 🐛 Troubleshooting
### Common Issues
#### 1. OS Detection Failed
**Problem**: Installer doesn't recognize Debian 13
**Solution**: Ensure you're running the latest installer version
```bash
# Download latest installer
wget https://cyberpanel.sh/install.sh
chmod +x install.sh
sudo ./install.sh
```
#### 2. Package Installation Failed
**Problem**: apt-get errors during installation
**Solution**: Update repositories and retry
```bash
# Update package lists
sudo apt update
# Fix broken packages
sudo apt --fix-broken install
# Retry installation
sudo ./install.sh
```
#### 3. Service Won't Start
**Problem**: CyberPanel service fails to start
**Solution**: Check logs and restart services
```bash
# Check service status
sudo systemctl status lscpd
# Check logs
sudo journalctl -u lscpd -f
# Restart service
sudo systemctl restart lscpd
```
#### 4. Web Server Issues
**Problem**: Apache2 configuration problems
**Solution**: Reconfigure web server
```bash
# Check Apache2 status
sudo systemctl status apache2
# Test configuration
sudo apache2ctl configtest
# Restart Apache2
sudo systemctl restart apache2
```
### Log Files
Important log locations:
- **CyberPanel**: `/usr/local/CyberCP/logs/`
- **Apache2**: `/var/log/apache2/`
- **System**: `/var/log/syslog`
- **Installation**: `/root/cyberpanel-install.log`
## 🔒 Security Considerations
### Initial Security Setup
1. **Change Default Password**
```bash
sudo cyberpanel --change-password admin
```
2. **Update System**
```bash
sudo apt update && sudo apt upgrade -y
```
3. **Configure Firewall**
```bash
sudo ufw enable
sudo ufw default deny incoming
sudo ufw default allow outgoing
```
4. **Enable Fail2Ban**
```bash
sudo apt install fail2ban -y
sudo systemctl enable fail2ban
sudo systemctl start fail2ban
```
### SSL Certificate Setup
1. **Access CyberPanel Web Interface**
2. **Navigate to**: SSL → Let's Encrypt
3. **Enter your domain name**
4. **Click "Issue" to get free SSL certificate**
## 📊 Performance Optimization
### System Optimization
```bash
# Optimize Apache2 for Debian
sudo nano /etc/apache2/apache2.conf
# Add these lines:
ServerTokens Prod
ServerSignature Off
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
```
### PHP Optimization
1. **Access CyberPanel Web Interface**
2. **Navigate to**: PHP → PHP Settings
3. **Configure**:
- Memory limit: 256M
- Max execution time: 300
- Upload max filesize: 64M
## 🔄 Updates and Maintenance
### Update CyberPanel
```bash
# Update to latest version
sudo cyberpanel --update
# Or use the upgrade script
sudo ./cyberpanel_upgrade.sh
```
### System Maintenance
```bash
# Update system packages
sudo apt update && sudo apt upgrade -y
# Clean package cache
sudo apt autoremove -y
sudo apt autoclean
# Check disk usage
df -h
# Check memory usage
free -h
```
## 📚 Additional Resources
### Documentation
- [CyberPanel Official Docs](https://cyberpanel.net/docs/)
- [Debian 13 Release Notes](https://www.debian.org/releases/bookworm/releasenotes)
- [Apache2 Configuration Guide](https://httpd.apache.org/docs/2.4/)
### Community Support
- [CyberPanel Community Forum](https://forums.cyberpanel.net/)
- [GitHub Issues](https://github.com/usmannasir/cyberpanel/issues)
- [Discord Server](https://discord.gg/cyberpanel)
### Testing Compatibility
For comprehensive compatibility testing, refer to the diagnostic commands in the troubleshooting section below.
## ✅ Verification Checklist
After installation, verify these components:
- [ ] CyberPanel web interface accessible
- [ ] Admin password changed
- [ ] SSL certificate installed
- [ ] Firewall configured
- [ ] Email server working (if installed)
- [ ] DNS server working (if installed)
- [ ] FTP server working (if installed)
- [ ] System updates applied
- [ ] Logs are clean
- [ ] Services are running
## 🆘 Getting Help
If you encounter issues:
1. **Check the logs** (see Troubleshooting section)
2. **Run the compatibility test**
3. **Search the documentation**
4. **Ask in the community forum**
5. **Create a GitHub issue** with detailed information
---
**Note**: This guide is specifically for Debian 13. For other operating systems, refer to the main CyberPanel documentation.

View File

@@ -0,0 +1,146 @@
# Docker Command Execution Feature for CyberPanel
## Overview
This feature adds the ability to execute commands inside running Docker containers directly from the CyberPanel web interface. This is particularly useful for applications like Honeygain that require specific command-line arguments to function properly.
## Features Added
### 1. Backend Components
- **New View Function**: `executeContainerCommand` in `dockerManager/views.py`
- **New Container Method**: `executeContainerCommand` in `dockerManager/container.py`
- **New URL Pattern**: `/docker/executeContainerCommand` in `dockerManager/urls.py`
### 2. Frontend Components
- **New Action Button**: "Run Command" button in Container Actions section
- **Command Execution Modal**: Interactive modal for executing commands
- **Command History**: Tracks last 10 executed commands
- **Real-time Output**: Displays command output with proper formatting
### 3. Security Features
- **Permission Checks**: Only admin users can execute commands
- **Container Ownership**: Users can only execute commands on containers they own
- **Input Validation**: Commands are properly sanitized using `shlex.split()`
- **Error Handling**: Comprehensive error handling for various failure scenarios
## How to Use
### 1. Access the Feature
1. Navigate to your Docker container in CyberPanel
2. Ensure the container is running (the "Run Command" button is disabled for stopped containers)
3. Click the "Run Command" button in the Container Actions section
### 2. Execute Commands
1. Enter your command in the input field (e.g., `-tou-accept`, `ls -la`, `ps aux`)
2. Press Enter or click the "Execute" button
3. View the output in the terminal-style output area
4. Use command history to quickly re-run previous commands
### 3. Common Use Cases
**For applications requiring command-line arguments:**
1. Start your container
2. Click "Run Command"
3. Enter the required command (e.g., `-tou-accept`, `--help`, `--version`)
4. Click "Execute"
5. View the output to confirm successful execution
**For debugging and maintenance:**
- `ls -la` - List files and directories
- `ps aux` - Show running processes
- `whoami` - Display current user
- `env` - Show environment variables
- `df -h` - Display disk usage
## Technical Details
### Command Execution Process
1. **Validation**: Check if container exists and user has permissions
2. **Status Check**: Ensure container is running
3. **Command Parsing**: Use `shlex.split()` to properly parse command arguments
4. **Execution**: Use Docker's `exec_run()` method to execute command
5. **Response**: Return output, exit code, and any errors
### Error Handling
- Container not found
- Container not running
- Permission denied
- Command execution failures
- Network connectivity issues
### Security Considerations
- Commands are executed with the same user as the container's default user
- No privileged execution (unless container is privileged)
- Input is sanitized to prevent injection attacks
- Only admin users can execute commands
## Files Modified
### Backend Files
- `dockerManager/container.py` - Added `executeContainerCommand` method
- `dockerManager/views.py` - Added `executeContainerCommand` view function
- `dockerManager/urls.py` - Added URL pattern for command execution
### Frontend Files
- `dockerManager/templates/dockerManager/viewContainer.html` - Added UI components
- `dockerManager/static/dockerManager/dockerManager.js` - Added JavaScript functionality
## API Endpoint
**POST** `/docker/executeContainerCommand`
**Request Body:**
```json
{
"name": "container_name",
"command": "command_to_execute"
}
```
**Response:**
```json
{
"commandStatus": 1,
"error_message": "None",
"output": "command_output",
"exit_code": 0,
"command": "executed_command"
}
```
## Troubleshooting
### Common Issues
1. **"Container must be running"** - Start the container first
2. **"Permission denied"** - Ensure you have admin access
3. **"Command not found"** - Check if the command exists in the container
4. **Empty output** - Some commands may not produce visible output
### Debugging
- Check container logs for additional information
- Verify the container's base image supports the command
- Ensure proper command syntax for the container's shell
## Future Enhancements
- Interactive terminal mode
- Command templates for common tasks
- Output filtering and search
- Command scheduling
- Multi-container command execution
## Security Notes
- This feature should only be used by trusted administrators
- Commands are executed with the container's user permissions
- Consider implementing additional logging for audit purposes
- Monitor command execution for security compliance
## Testing with Various Applications
1. Pull any Docker image (e.g., `ubuntu:latest`, `alpine:latest`, `nginx:latest`)
2. Create a container with the image
3. Start the container
4. Use the "Run Command" feature to execute various commands:
- `ls -la` - List files
- `ps aux` - Show processes
- `whoami` - Check user
- `env` - View environment
5. Verify commands execute properly and output is displayed correctly
This feature provides a secure and user-friendly way to execute commands in Docker containers directly from the CyberPanel interface, making it easy to manage applications like Honeygain that require specific command-line arguments.

View File

@@ -0,0 +1,121 @@
# Firewall Rules Export/Import Feature
## Overview
This feature allows CyberPanel administrators to export and import firewall rules between servers, making it easy to replicate security configurations across multiple servers.
## Features
### Export Functionality
- Exports all custom firewall rules to a JSON file
- Excludes default CyberPanel rules (CyberPanel Admin, SSHCustom) to prevent conflicts
- Includes metadata such as export timestamp and rule count
- Downloads file directly to the user's browser
### Import Functionality
- Imports firewall rules from a previously exported JSON file
- Validates file format before processing
- Skips duplicate rules (same name, protocol, port, and IP address)
- Excludes default CyberPanel rules from import
- Provides detailed import summary (imported, skipped, error counts)
- Shows specific error messages for failed imports
## Usage
### Exporting Rules
1. Navigate to the Firewall section in CyberPanel
2. Click the "Export Rules" button in the Firewall Rules panel header
3. The system will generate and download a JSON file containing your custom rules
### Importing Rules
1. Navigate to the Firewall section in CyberPanel
2. Click the "Import Rules" button in the Firewall Rules panel header
3. Select a previously exported JSON file
4. The system will process the import and show a summary of results
## File Format
The exported JSON file has the following structure:
```json
{
"version": "1.0",
"exported_at": "2024-01-15 14:30:25",
"total_rules": 5,
"rules": [
{
"name": "Custom Web Server",
"proto": "tcp",
"port": "8080",
"ipAddress": "0.0.0.0/0"
},
{
"name": "Database Access",
"proto": "tcp",
"port": "3306",
"ipAddress": "192.168.1.0/24"
}
]
}
```
## Security Considerations
- Only administrators can export/import firewall rules
- Default CyberPanel rules are excluded to prevent system conflicts
- Import process validates file format and rule data
- Failed imports are logged for troubleshooting
- Duplicate rules are automatically skipped
## Error Handling
The system provides comprehensive error handling:
- Invalid file format detection
- Missing required fields validation
- Individual rule import error tracking
- Detailed error messages for troubleshooting
- Import summary with counts of successful, skipped, and failed imports
## Technical Implementation
### Backend Components
- `exportFirewallRules()` method in `FirewallManager`
- `importFirewallRules()` method in `FirewallManager`
- New URL patterns for export/import endpoints
- File upload handling for import functionality
### Frontend Components
- Export/Import buttons in firewall UI
- File download handling for exports
- File upload dialog for imports
- Progress indicators and error messaging
- Import summary display
### Database Integration
- Uses existing `FirewallRules` model
- Maintains referential integrity
- Preserves rule relationships and constraints
## Benefits
1. **Time Efficiency**: Significantly reduces time to replicate firewall rules across servers
2. **Error Reduction**: Minimizes human error in manual rule creation
3. **Consistency**: Ensures identical security policies across multiple servers
4. **Backup**: Provides a way to backup and restore firewall configurations
5. **Migration**: Simplifies server migration and setup processes
## Compatibility
- Compatible with CyberPanel's existing firewall system
- Works with both TCP and UDP protocols
- Supports all IP address formats (single IPs, CIDR ranges)
- Maintains compatibility with existing firewall utilities
## Future Enhancements
Potential future improvements could include:
- Rule conflict detection and resolution
- Selective rule import (choose specific rules)
- Rule templates and presets
- Bulk rule management
- Integration with configuration management tools

View File

@@ -0,0 +1,185 @@
# Firewall Blocking Feature for CyberPanel
## Overview
This feature adds a convenient "Block IP" button directly in the CyberPanel dashboard's SSH Security Analysis section, allowing administrators to quickly block malicious IP addresses without needing to access SSH or manually run firewall commands.
## Features
- **One-Click IP Blocking**: Block malicious IPs directly from the dashboard
- **Firewalld Integration**: Works with firewalld (the standard Linux firewall)
- **Visual Feedback**: Loading states, success notifications, and blocked status indicators
- **Security Integration**: Automatically appears on "Brute Force Attack Detected" alerts
- **Admin-Only Access**: Restricted to administrators with CyberPanel addons
## Implementation Details
### Backend Changes
#### 1. New API Endpoint (`/base/blockIPAddress`)
- **File**: `cyberpanel/baseTemplate/views.py`
- **Method**: POST
- **Authentication**: Admin-only with CyberPanel addons
- **Functionality**:
- Validates IP address format
- Verifies firewalld is active
- Blocks IP using firewalld commands
- Logs the action for audit purposes
#### 2. URL Configuration
- **File**: `cyberpanel/baseTemplate/urls.py`
- **Route**: `re_path(r'^blockIPAddress$', views.blockIPAddress, name='blockIPAddress')`
### Frontend Changes
#### 1. Template Updates
- **File**: `cyberpanel/baseTemplate/templates/baseTemplate/homePage.html`
- **Changes**:
- Added "Block IP" button for brute force attack alerts
- Visual feedback for blocking status
- Success indicators for blocked IPs
#### 2. JavaScript Functionality
- **File**: `cyberpanel/baseTemplate/static/baseTemplate/custom-js/system-status.js`
- **Features**:
- `blockIPAddress()` function for handling IP blocking
- Loading states and error handling
- Success notifications using PNotify
- Automatic security analysis refresh
## Usage
### Prerequisites
1. CyberPanel with admin privileges
2. CyberPanel addons enabled
3. Active firewalld service
### How to Use
1. Navigate to **Dashboard** in CyberPanel
2. Click on **SSH Logs** tab in the Activity Board
3. Click **Refresh Analysis** to scan for security threats
4. Look for **"Brute Force Attack Detected"** alerts
5. Click the **"Block IP"** button next to malicious IP addresses
6. Confirm the blocking action in the success notification
### Visual Indicators
- **Red "Block IP" Button**: Available for blocking
- **Spinning Icon**: Blocking in progress
- **Green "Blocked" Status**: IP successfully blocked
- **Notifications**: Success/error messages with details
## Firewall Commands Used
### firewalld
```bash
firewall-cmd --permanent --add-rich-rule="rule family=ipv4 source address=<ip_address> drop"
firewall-cmd --reload
```
## Security Considerations
1. **Admin-Only Access**: Feature restricted to administrators
2. **Premium Feature**: Requires CyberPanel addons
3. **Enhanced IP Validation**: Validates IP address format and prevents blocking private/reserved ranges
4. **Command Injection Protection**: Uses subprocess with explicit argument lists
5. **Timeout Protection**: Prevents hanging processes with configurable timeouts
6. **Firewalld Verification**: Ensures firewalld service is active
7. **Audit Logging**: All blocking actions are logged
8. **Comprehensive Error Handling**: Detailed error messages with captured stderr
## Error Handling
The feature includes robust error handling for:
- Invalid IP addresses and formats
- Private/reserved IP address ranges
- Firewalld service not active
- Firewall command failures and timeouts
- Network connectivity issues
- Permission errors
- Command injection attempts
- Process timeouts
## Testing
A test script is provided for basic functionality testing:
- `test_firewall_blocking.py` - Basic functionality testing
The feature is best tested through the web interface with various IP address types.
## Enhanced Security Features
### IP Range Validation
The system now prevents blocking of:
- **Private IP ranges**: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16
- **Loopback addresses**: 127.0.0.0/8
- **Link-local addresses**: 169.254.0.0/16
- **Multicast addresses**: 224.0.0.0/4
- **Broadcast addresses**: 255.255.255.255
- **Reserved addresses**: 0.0.0.0
### Command Execution Security
- **Subprocess with explicit arguments**: Prevents command injection
- **Timeout protection**: 10s for status checks, 30s for firewall commands
- **Error capture**: Captures both stdout and stderr for better debugging
- **No shell interpretation**: Eliminates shell injection vulnerabilities
### Example Error Messages
```
"Cannot block private, loopback, link-local, or reserved IP addresses"
"Cannot block system or reserved IP addresses"
"Timeout checking firewalld status"
"Firewall command timed out"
```
## Browser Compatibility
The feature uses modern web technologies and is compatible with:
- Chrome 60+
- Firefox 55+
- Safari 12+
- Edge 79+
## Future Enhancements
Potential improvements for future versions:
1. Bulk IP blocking for multiple threats
2. Temporary blocking with automatic unblocking
3. Integration with threat intelligence feeds
4. Custom blocking rules and policies
5. Blocking history and management interface
## Troubleshooting
### Common Issues
1. **"Premium feature required" error**
- Ensure CyberPanel addons are enabled
- Verify admin privileges
2. **"Failed to block IP address" error**
- Check firewalld service status: `systemctl status firewalld`
- Verify admin has necessary permissions
- Check firewalld configuration
3. **Button not appearing**
- Ensure SSH Security Analysis is enabled
- Check for brute force attack alerts
- Verify JavaScript is enabled
### Debug Information
Check CyberPanel logs for detailed error information:
- `/usr/local/CyberCP/logs/cyberpanel.log`
- Firewalld logs: `journalctl -u firewalld`
## Support
For issues or questions regarding this feature:
1. Check CyberPanel documentation
2. Review firewall configuration
3. Check system logs for detailed error messages
4. Contact CyberPanel support if needed
---
**Note**: This feature enhances CyberPanel's security capabilities by providing a streamlined way to block malicious IP addresses directly from the web interface, improving the overall user experience for server administrators.

View File

@@ -0,0 +1,533 @@
# Home Directory Management Guide for CyberPanel
## Overview
The Home Directory Management feature allows CyberPanel administrators to manage multiple home directories across different storage volumes (e.g., `/home`, `/home2`, `/home3`). This enables storage balancing, helps avoid upgrading main volume plans by utilizing cheaper additional volumes, and provides better resource distribution across your server.
## Table of Contents
1. [Features](#features)
2. [Getting Started](#getting-started)
3. [Managing Home Directories](#managing-home-directories)
4. [User Management](#user-management)
5. [Website Management Integration](#website-management-integration)
6. [Storage Balancing](#storage-balancing)
7. [User Migration](#user-migration)
8. [Troubleshooting](#troubleshooting)
9. [Best Practices](#best-practices)
10. [Advanced Configuration](#advanced-configuration)
## Features
### Core Capabilities
- **Multiple Home Directories**: Manage `/home`, `/home2`, `/home3`, etc.
- **Automatic Detection**: Auto-discover existing home directories
- **Storage Monitoring**: Real-time space usage and availability tracking
- **User Distribution**: Balance users across different storage volumes
- **Website Integration**: Manage home directories directly from website modification
- **User Migration**: Move users between home directories seamlessly
- **Storage Analytics**: Detailed usage statistics and recommendations
### Benefits
- **Cost Optimization**: Use cheaper additional volumes instead of upgrading main storage
- **Performance**: Distribute load across multiple storage devices
- **Scalability**: Easy expansion as your server grows
- **Flexibility**: Choose optimal storage for different user types
- **Monitoring**: Real-time visibility into storage usage
## Getting Started
### Prerequisites
- CyberPanel v2.5.5 or higher
- Administrator access
- Multiple storage volumes available (optional but recommended)
- Sufficient disk space for home directories
### Initial Setup
1. **Access Home Directory Management**
- Log in to CyberPanel admin panel
- Navigate to **User Management****Home Directory Management**
2. **Auto-Detect Existing Directories**
- Click **"Detect Directories"** button
- System will automatically find `/home`, `/home2`, `/home3`, etc.
- Review detected directories and their status
3. **Configure Default Settings**
- Set default home directory (usually `/home`)
- Configure storage limits and user limits
- Enable/disable directories as needed
### Database Migration (For Developers)
```bash
cd /usr/local/CyberCP
python manage.py makemigrations userManagment
python manage.py migrate
```
### Technical Implementation Details
#### Core Components
- **Models** (`models.py`): `HomeDirectory` and `UserHomeMapping` models
- **Management** (`homeDirectoryManager.py`): Core functionality for operations
- **Utilities** (`homeDirectoryUtils.py`): Helper functions for path resolution
- **Views** (`homeDirectoryViews.py`): Admin interface and API endpoints
- **Templates**: Management interfaces and user creation forms
#### File Structure
```
cyberpanel/userManagment/
├── models.py # Database models
├── homeDirectoryManager.py # Core management logic
├── homeDirectoryUtils.py # Utility functions
├── homeDirectoryViews.py # API endpoints
├── templates/userManagment/
│ ├── homeDirectoryManagement.html
│ ├── userMigration.html
│ └── createUser.html (updated)
└── migrations/
└── 0001_home_directories.py
```
## Managing Home Directories
### Adding New Home Directories
#### Method 1: Automatic Detection
```bash
# The system automatically detects directories matching pattern /home[0-9]*
# No manual intervention required
```
#### Method 2: Manual Creation
1. **Create Directory on Server**
```bash
sudo mkdir /home2
sudo chown root:root /home2
sudo chmod 755 /home2
```
2. **Detect in CyberPanel**
- Go to Home Directory Management
- Click **"Detect Directories"**
- New directory will appear in the list
### Configuring Home Directories
#### Basic Configuration
- **Name**: Display name for the directory
- **Path**: Full system path (e.g., `/home2`)
- **Description**: Optional description for identification
- **Status**: Active/Inactive
- **Default**: Set as default for new users
#### Advanced Settings
- **Maximum Users**: Limit number of users per directory
- **Storage Quota**: Set storage limits (if supported by filesystem)
- **Priority**: Directory selection priority for auto-assignment
### Directory Status Management
#### Active Directories
- Available for new user assignments
- Included in auto-selection algorithms
- Monitored for storage usage
#### Inactive Directories
- Not available for new users
- Existing users remain unaffected
- Useful for maintenance or decommissioning
## User Management
### Creating Users with Home Directory Selection
1. **Navigate to User Creation**
- Go to **User Management** → **Create User**
2. **Select Home Directory**
- Choose from dropdown list of available directories
- View real-time storage information
- Select "Auto-select" for automatic assignment
3. **Review Assignment**
- System shows selected directory details
- Displays available space and user count
- Confirms assignment before creation
### Auto-Assignment Logic
The system automatically selects the best home directory based on:
- **Available Space**: Prioritizes directories with more free space
- **User Count**: Balances users across directories
- **Directory Status**: Only considers active directories
- **User Limits**: Respects maximum user limits per directory
### Manual User Assignment
1. **Access User Migration**
- Go to **User Management** → **User Migration**
2. **Select User and Target Directory**
- Choose user to migrate
- Select destination home directory
- Review migration details
3. **Execute Migration**
- System moves user data
- Updates all references
- Verifies successful migration
## Website Management Integration
### Modifying Website Home Directory
1. **Access Website Modification**
- Go to **Websites** → **Modify Website**
- Select website to modify
2. **Change Home Directory**
- Select new home directory from dropdown
- View current and available options
- See real-time storage information
3. **Save Changes**
- System migrates website owner
- Updates all website references
- Maintains website functionality
### Website Owner Migration
When changing a website's home directory:
- **User Data**: Website owner is migrated to new directory
- **Website Files**: All website files are moved
- **Database References**: All database references updated
- **Permissions**: File permissions maintained
- **Services**: Email, FTP, and other services updated
## Storage Balancing
### Monitoring Storage Usage
#### Real-Time Statistics
- **Total Space**: Combined storage across all directories
- **Available Space**: Free space available
- **Usage Percentage**: Visual progress bars
- **User Distribution**: Users per directory
#### Storage Alerts
- **Low Space Warning**: When directory approaches capacity
- **Full Directory Alert**: When directory reaches maximum users
- **Performance Impact**: Storage performance recommendations
### Balancing Strategies
#### Automatic Balancing
- **New User Assignment**: Distributes users evenly
- **Space-Based Selection**: Prioritizes directories with more space
- **Load Distribution**: Spreads load across multiple volumes
#### Manual Balancing
- **User Migration**: Move users between directories
- **Directory Management**: Enable/disable directories
- **Capacity Planning**: Monitor and plan for growth
## User Migration
### Migration Process
1. **Pre-Migration Checks**
- Verify source and destination directories
- Check available space
- Validate user permissions
2. **Data Migration**
- Copy user home directory
- Update system references
- Verify data integrity
3. **Post-Migration Verification**
- Test user access
- Verify website functionality
- Update service configurations
### Migration Safety
#### Backup Recommendations
```bash
# Always backup before migration
sudo tar -czf /backup/user-backup-$(date +%Y%m%d).tar.gz /home/username
```
#### Rollback Procedures
- Keep original data until migration verified
- Maintain backup of system configurations
- Document all changes made
### Migration Commands
#### Manual Migration (Advanced Users)
```bash
# Stop user services
sudo systemctl stop user@username
# Copy user data
sudo rsync -av /home/username/ /home2/username/
# Update user home in system
sudo usermod -d /home2/username username
# Update CyberPanel database
# (Use web interface for this)
```
## Troubleshooting
### Common Issues
#### 1. Directory Not Detected
**Problem**: New home directory not appearing in list
**Solution**:
```bash
# Check directory exists and has correct permissions
ls -la /home2
sudo chown root:root /home2
sudo chmod 755 /home2
# Refresh detection in CyberPanel
# Click "Detect Directories" button
```
#### 2. Migration Fails
**Problem**: User migration fails with errors
**Solution**:
- Check available space in destination
- Verify user permissions
- Review CyberPanel logs
- Ensure destination directory is active
#### 3. Website Access Issues
**Problem**: Website not accessible after migration
**Solution**:
- Check file permissions
- Verify web server configuration
- Update virtual host settings
- Restart web server services
#### 4. Storage Not Updating
**Problem**: Storage statistics not reflecting changes
**Solution**:
- Click "Refresh Stats" button
- Check filesystem mount status
- Verify directory accessibility
- Review system logs
### Diagnostic Commands
#### Check Directory Status
```bash
# List all home directories
ls -la /home*
# Check disk usage
df -h /home*
# Check permissions
ls -la /home*/username
```
#### Verify User Assignments
```bash
# Check user home directories
getent passwd | grep /home
# Check CyberPanel database
# (Use web interface or database tools)
```
#### Monitor Storage Usage
```bash
# Real-time disk usage
watch -n 5 'df -h /home*'
# Directory sizes
du -sh /home*
# User directory sizes
du -sh /home*/username
```
### Log Files
#### CyberPanel Logs
```bash
# Main CyberPanel log
tail -f /usr/local/CyberCP/logs/cyberpanel.log
# Home directory specific logs
grep "home.*directory" /usr/local/CyberCP/logs/cyberpanel.log
```
#### System Logs
```bash
# System messages
tail -f /var/log/messages
# Authentication logs
tail -f /var/log/auth.log
```
## Best Practices
### Storage Planning
#### Directory Organization
- **Primary Directory** (`/home`): Default for most users
- **Secondary Directories** (`/home2`, `/home3`): For specific user groups
- **Naming Convention**: Use descriptive names (e.g., `/home-ssd`, `/home-hdd`)
#### Capacity Management
- **Monitor Usage**: Regular storage monitoring
- **Set Alerts**: Configure low-space warnings
- **Plan Growth**: Anticipate future storage needs
- **Regular Cleanup**: Remove unused user data
### User Management
#### Assignment Strategy
- **New Users**: Use auto-assignment for balanced distribution
- **Special Cases**: Manually assign users with specific requirements
- **Regular Review**: Periodically review user distribution
#### Migration Planning
- **Schedule Migrations**: Plan during low-usage periods
- **Test First**: Verify migration process with test users
- **Communicate Changes**: Inform users of planned migrations
### Security Considerations
#### Access Control
- **Directory Permissions**: Maintain proper file permissions
- **User Isolation**: Ensure users can only access their directories
- **System Security**: Regular security updates and monitoring
#### Backup Strategy
- **Regular Backups**: Backup user data regularly
- **Migration Backups**: Always backup before migrations
- **Configuration Backups**: Backup CyberPanel configurations
## Advanced Configuration
### Custom Directory Paths
#### Non-Standard Paths
```bash
# Create custom home directory
sudo mkdir /var/home
sudo chown root:root /var/home
sudo chmod 755 /var/home
# Add to CyberPanel manually
# (Use web interface to add custom paths)
```
#### Network Storage
- **NFS Mounts**: Use NFS for network-attached storage
- **iSCSI**: Configure iSCSI for block-level storage
- **Cloud Storage**: Integrate with cloud storage solutions
### Performance Optimization
#### Storage Performance
- **SSD vs HDD**: Use SSDs for frequently accessed data
- **RAID Configuration**: Optimize RAID for performance
- **Caching**: Implement appropriate caching strategies
#### Load Balancing
- **User Distribution**: Balance users across storage devices
- **I/O Optimization**: Optimize I/O patterns
- **Monitoring**: Monitor performance metrics
### Integration with Other Features
#### Backup Integration
- **Automated Backups**: Include home directories in backup schedules
- **Incremental Backups**: Use incremental backup strategies
- **Restore Procedures**: Test restore procedures regularly
#### Monitoring Integration
- **Storage Monitoring**: Integrate with monitoring systems
- **Alerting**: Set up automated alerts
- **Reporting**: Generate regular usage reports
## API Reference
### Home Directory Management API
#### Get Home Directories
```bash
curl -X POST https://your-server:8090/userManagement/getUserHomeDirectories/ \
-H "Content-Type: application/json" \
-d '{}'
```
#### Update Home Directory
```bash
curl -X POST https://your-server:8090/userManagement/updateHomeDirectory/ \
-H "Content-Type: application/json" \
-d '{
"id": 1,
"description": "Updated description",
"max_users": 100,
"is_active": true
}'
```
#### Migrate User
```bash
curl -X POST https://your-server:8090/userManagement/migrateUser/ \
-H "Content-Type: application/json" \
-d '{
"user_id": 123,
"new_home_directory_id": 2
}'
```
### Complete API Endpoints
#### Home Directory Management
- `POST /userManagement/detectHomeDirectories/` - Detect new home directories
- `POST /userManagement/updateHomeDirectory/` - Update home directory settings
- `POST /userManagement/deleteHomeDirectory/` - Delete home directory
- `POST /userManagement/getHomeDirectoryStats/` - Get storage statistics
#### User Operations
- `POST /userManagement/getUserHomeDirectories/` - Get available home directories
- `POST /userManagement/migrateUser/` - Migrate user to different home directory
#### Website Integration
- `POST /websites/saveWebsiteChanges/` - Save website changes including home directory
- `POST /websites/getWebsiteDetails/` - Get website details including current home directory
## Support and Resources
### Documentation
- **CyberPanel Documentation**: https://cyberpanel.net/docs/
- **User Management Guide**: This guide
- **API Documentation**: Available in CyberPanel interface
### Community Support
- **CyberPanel Forums**: https://community.cyberpanel.net
- **GitHub Issues**: https://github.com/usmannasir/cyberpanel/issues
- **Discord Server**: https://discord.gg/cyberpanel
### Professional Support
- **CyberPanel Support**: Available through official channels
- **Custom Implementation**: Contact for enterprise solutions
---
**Note**: This guide covers the complete Home Directory Management feature in CyberPanel. For the latest updates and additional features, refer to the official CyberPanel documentation and community resources.
*Last updated: January 2025*

139
docs/INDEX.md Normal file
View File

@@ -0,0 +1,139 @@
# 📚 CyberPanel Guides & Documentation
Welcome to the CyberPanel documentation hub! This folder contains all guides, tutorials, and documentation for CyberPanel features and integrations.
## 📋 Available Guides
### 🐳 Docker Management
- **[Docker Command Execution Guide](Docker_Command_Execution_Guide.md)** - Learn how to execute commands inside Docker containers directly from the CyberPanel interface
- **[Docker Testing Guide](Test_Honeygain_Integration.md)** - Comprehensive testing guide for Docker command execution with various applications
### 🤖 AI & Security
- **[AI Scanner Documentation](AIScannerDocs.md)** - Complete guide for CyberPanel's AI-powered security scanner
### 📧 Email & Marketing
- **[Mautic Installation Guide](MAUTIC_INSTALLATION_GUIDE.md)** - Step-by-step guide for installing and configuring Mautic email marketing platform
### 🐧 Operating System Support
#### **Windows Family**
- **[Windows Installation Guide](WINDOWS_INSTALLATION_GUIDE.md)** - Complete installation and configuration guide for CyberPanel on Windows 7/8.1/10/11
#### **Debian Family**
- **[Debian 13 Installation Guide](DEBIAN_13_INSTALLATION_GUIDE.md)** - Complete installation and configuration guide for CyberPanel on Debian 13 (Bookworm)
- **[Debian 12 Troubleshooting Guide](DEBIAN_12_TROUBLESHOOTING.md)** - Troubleshooting guide for Debian 12 (Bookworm)
- **[Debian 11 Troubleshooting Guide](DEBIAN_11_TROUBLESHOOTING.md)** - Troubleshooting guide for Debian 11 (Bullseye)
#### **Ubuntu Family**
- **[Ubuntu 24.04.3 Troubleshooting Guide](UBUNTU_24_TROUBLESHOOTING.md)** - Troubleshooting guide for Ubuntu 24.04.3 LTS
- **[Ubuntu 22.04 Troubleshooting Guide](UBUNTU_22_TROUBLESHOOTING.md)** - Troubleshooting guide for Ubuntu 22.04 LTS
- **[Ubuntu 20.04 Troubleshooting Guide](UBUNTU_20_TROUBLESHOOTING.md)** - Troubleshooting guide for Ubuntu 20.04 LTS
#### **RHEL Family**
- **[AlmaLinux 10 Troubleshooting Guide](ALMALINUX_10_TROUBLESHOOTING.md)** - Troubleshooting guide for AlmaLinux 10
- **[AlmaLinux 9 Troubleshooting Guide](ALMALINUX_9_TROUBLESHOOTING.md)** - Troubleshooting guide for AlmaLinux 9
- **[AlmaLinux 8 Troubleshooting Guide](ALMALINUX_8_TROUBLESHOOTING.md)** - Troubleshooting guide for AlmaLinux 8
- **[RockyLinux 9 Troubleshooting Guide](ROCKYLINUX_9_TROUBLESHOOTING.md)** - Troubleshooting guide for RockyLinux 9
- **[RockyLinux 8 Troubleshooting Guide](ROCKYLINUX_8_TROUBLESHOOTING.md)** - Troubleshooting guide for RockyLinux 8
- **[CentOS 9 Troubleshooting Guide](CENTOS_9_TROUBLESHOOTING.md)** - Troubleshooting guide for CentOS 9
#### **CloudLinux**
- **[CloudLinux 8 Troubleshooting Guide](CLOUDLINUX_8_TROUBLESHOOTING.md)** - Troubleshooting guide for CloudLinux 8
### 🎨 Customization & Design
- **[Custom CSS Guide](CUSTOM_CSS_GUIDE.md)** - Complete guide for creating custom CSS that works with CyberPanel 2.5.5-dev design system
### 🔌 Plugins & Extensions
- **[Plugin System Guide](PLUGINS.md)** - Complete guide to CyberPanel plugin system, development, testPlugin reference, and plugin management
### 🔐 Security & Authentication
- **[2FA Authentication Guide](2FA_AUTHENTICATION_GUIDE.md)** - Complete guide for Two-Factor Authentication and WebAuthn/Passkey setup
### 🔧 Troubleshooting & Support
- **[Troubleshooting Guide](TROUBLESHOOTING.md)** - Comprehensive troubleshooting and diagnostic commands
- **[Installation Verification Guide](INSTALLATION_VERIFICATION.md)** - Verify installation and upgrade commands work across all supported OS
### 💻 Command Line Interface
- **[CLI Command Reference](CLI_COMMAND_REFERENCE.md)** - Complete reference for all CyberPanel CLI commands
### 🏠 Storage & User Management
- **[Home Directory Management Guide](HOME_DIRECTORY_MANAGEMENT_GUIDE.md)** - Complete guide for managing multiple home directories and storage balancing
### 📖 General Documentation
- **[README](../README.md)** - Main CyberPanel documentation with installation instructions and feature overview
- **[Utility Scripts](../utils/README.md)** - Installation, upgrade, and maintenance scripts for Windows and Linux
- **[Contributing Guide](CONTRIBUTING.md)** - Guidelines for contributing to the CyberPanel project
## 🚀 Quick Start
1. **New to CyberPanel?** Start with the [README](../README.md) for installation and basic setup
2. **Installing on Debian 13?** Follow the [Debian 13 Installation Guide](DEBIAN_13_INSTALLATION_GUIDE.md)
3. **Need Docker help?** Check the [Docker Command Execution Guide](Docker_Command_Execution_Guide.md)
4. **Setting up email marketing?** Follow the [Mautic Installation Guide](MAUTIC_INSTALLATION_GUIDE.md)
5. **Want to customize the interface?** Check the [Custom CSS Guide](CUSTOM_CSS_GUIDE.md)
6. **Managing multiple storage volumes?** Follow the [Home Directory Management Guide](HOME_DIRECTORY_MANAGEMENT_GUIDE.md)
7. **Want to contribute?** Read the [Contributing Guide](CONTRIBUTING.md)
## 🔍 Finding What You Need
- **Installation & Setup**: [README](../README.md)
- **General Troubleshooting**: [Troubleshooting Guide](TROUBLESHOOTING.md)
### **OS-Specific Troubleshooting**
- **🪟 Windows**: [Windows Installation Guide](WINDOWS_INSTALLATION_GUIDE.md) - Installation & troubleshooting
- **🐧 Debian 13**: [Debian 13 Installation Guide](DEBIAN_13_INSTALLATION_GUIDE.md) - Installation & troubleshooting
- **🐧 Debian 12**: [Debian 12 Troubleshooting Guide](DEBIAN_12_TROUBLESHOOTING.md) - Troubleshooting
- **🐧 Debian 11**: [Debian 11 Troubleshooting Guide](DEBIAN_11_TROUBLESHOOTING.md) - Troubleshooting
- **🐧 Ubuntu 24.04**: [Ubuntu 24.04 Troubleshooting Guide](UBUNTU_24_TROUBLESHOOTING.md) - Troubleshooting
- **🐧 Ubuntu 22.04**: [Ubuntu 22.04 Troubleshooting Guide](UBUNTU_22_TROUBLESHOOTING.md) - Troubleshooting
- **🐧 Ubuntu 20.04**: [Ubuntu 20.04 Troubleshooting Guide](UBUNTU_20_TROUBLESHOOTING.md) - Troubleshooting
- **🔴 AlmaLinux 10**: [AlmaLinux 10 Troubleshooting Guide](ALMALINUX_10_TROUBLESHOOTING.md) - Troubleshooting
- **🔴 AlmaLinux 9**: [AlmaLinux 9 Troubleshooting Guide](ALMALINUX_9_TROUBLESHOOTING.md) - Troubleshooting
- **🔴 AlmaLinux 8**: [AlmaLinux 8 Troubleshooting Guide](ALMALINUX_8_TROUBLESHOOTING.md) - Troubleshooting
- **🔴 RockyLinux 9**: [RockyLinux 9 Troubleshooting Guide](ROCKYLINUX_9_TROUBLESHOOTING.md) - Troubleshooting
- **🔴 RockyLinux 8**: [RockyLinux 8 Troubleshooting Guide](ROCKYLINUX_8_TROUBLESHOOTING.md) - Troubleshooting
- **🔴 CentOS 9**: [CentOS 9 Troubleshooting Guide](CENTOS_9_TROUBLESHOOTING.md) - Troubleshooting
- **☁️ CloudLinux 8**: [CloudLinux 8 Troubleshooting Guide](CLOUDLINUX_8_TROUBLESHOOTING.md) - Troubleshooting
### **Feature-Specific Guides**
- **Docker Features**: [Docker Command Execution Guide](Docker_Command_Execution_Guide.md)
- **Security Features**: [AI Scanner Documentation](AIScannerDocs.md)
- **Authentication**: [2FA Authentication Guide](2FA_AUTHENTICATION_GUIDE.md)
- **Email Marketing**: [Mautic Installation Guide](MAUTIC_INSTALLATION_GUIDE.md)
- **Storage Management**: [Home Directory Management Guide](HOME_DIRECTORY_MANAGEMENT_GUIDE.md)
- **Customization & Design**: [Custom CSS Guide](CUSTOM_CSS_GUIDE.md)
- **Plugin System**: [Plugin System Guide](PLUGINS.md)
- **Command Line Interface**: [CLI Command Reference](CLI_COMMAND_REFERENCE.md)
- **Development**: [Contributing Guide](CONTRIBUTING.md)
## 📝 Guide Categories
### 🛠️ **Core Features**
- Docker container management
- Command execution
- Security scanning
- Two-factor authentication (2FA)
- WebAuthn/Passkey authentication
- Home directory management
- CLI command reference
### 🔧 **Integrations**
- Mautic email marketing
- Third-party applications
- Custom configurations
### 🎨 **Customization**
- Custom CSS theming
- Design system integration
- Interface personalization
### 📖 **Documentation**
- Installation guides
- Configuration tutorials
- Troubleshooting tips
---
*Last updated: September 2025*
*For the latest updates and community support, visit [community.cyberpanel.net](https://community.cyberpanel.net)*

View File

@@ -0,0 +1,415 @@
# CyberPanel Installation Verification Guide
## 🎯 Overview
This guide provides verification steps to ensure CyberPanel installation and upgrade commands work correctly across all supported operating systems.
## ✅ Installation Command Verification
### **Primary Installation Command**
```bash
sh <(curl https://cyberpanel.net/install.sh || wget -O - https://cyberpanel.net/install.sh)
```
### **Verification Steps**
#### 1. **Test URL Accessibility**
```bash
# Test if install script is accessible
curl -I https://cyberpanel.net/install.sh
# Expected response: HTTP/1.1 200 OK
# Content-Type: text/plain
```
#### 2. **Test Download**
```bash
# Download and check script content
curl -s https://cyberpanel.net/install.sh | head -20
# Should show script header and OS detection logic
```
#### 3. **Test with wget fallback**
```bash
# Test wget fallback
wget -qO- https://cyberpanel.net/install.sh | head -20
# Should show same content as curl
```
## ✅ Upgrade Command Verification
### **Primary Upgrade Command**
```bash
sh <(curl https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh || wget -O - https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh)
```
### **Verification Steps**
#### 1. **Test URL Accessibility**
```bash
# Test if upgrade script is accessible
curl -I https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh
# Expected response: HTTP/1.1 200 OK
# Content-Type: text/plain
```
#### 2. **Test Download**
```bash
# Download and check script content
curl -s https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh | head -20
# Should show script header and upgrade logic
```
## 🐧 Operating System Support Verification
### **Ubuntu Family**
- **Ubuntu 24.04.3**: ✅ Supported
- **Ubuntu 22.04**: ✅ Supported
- **Ubuntu 20.04**: ✅ Supported
### **Debian Family**
- **Debian 13**: ✅ Supported
- **Debian 12**: ✅ Supported
- **Debian 11**: ✅ Supported
### **RHEL Family**
- **AlmaLinux 10**: ✅ Supported
- **AlmaLinux 9**: ✅ Supported
- **AlmaLinux 8**: ✅ Supported
- **RockyLinux 9**: ✅ Supported
- **RockyLinux 8**: ✅ Supported
- **RHEL 9**: ✅ Supported
- **RHEL 8**: ✅ Supported
### **Other Distributions**
- **CloudLinux 8**: ✅ Supported
- **CentOS 9**: ✅ Supported
- **CentOS 7**: ✅ Supported (until June 2024)
- **CentOS Stream 9**: ✅ Supported
## 🔧 Installation Process Verification
### **What the Installation Script Does**
1. **System Detection**
- Detects operating system and version
- Checks architecture (x86_64 required)
- Verifies system requirements
2. **Dependency Installation**
- Installs Python 3.8+
- Installs Git
- Installs system packages (curl, wget, etc.)
3. **Web Server Setup**
- Downloads and installs OpenLiteSpeed
- Configures web server settings
- Sets up virtual hosts
4. **Database Setup**
- Installs and configures MariaDB
- Creates CyberPanel database
- Sets up database users
5. **CyberPanel Installation**
- Downloads CyberPanel source code
- Installs Python dependencies
- Configures Django settings
- Runs database migrations
6. **Service Configuration**
- Creates systemd services
- Starts all required services
- Configures firewall rules
7. **Final Setup**
- Creates admin user
- Sets up file permissions
- Provides access information
## 🔄 Upgrade Process Verification
### **What the Upgrade Script Does**
1. **Backup Creation**
- Creates backup of current installation
- Backs up database and configuration files
- Stores backup in safe location
2. **Source Update**
- Downloads latest CyberPanel source code
- Updates all files to latest version
- Preserves custom configurations
3. **Dependency Update**
- Updates Python packages
- Updates system dependencies
- Handles version conflicts
4. **Database Migration**
- Runs Django migrations
- Updates database schema
- Preserves existing data
5. **Service Restart**
- Restarts all CyberPanel services
- Verifies service status
- Reports any issues
## 🧪 Testing Procedures
### **Pre-Installation Testing**
#### 1. **System Requirements Check**
```bash
# Check OS version
cat /etc/os-release
# Check architecture
uname -m
# Check available memory
free -h
# Check available disk space
df -h
# Check network connectivity
ping -c 4 google.com
```
#### 2. **Dependency Check**
```bash
# Check if Python is available
python3 --version
# Check if Git is available
git --version
# Check if curl/wget are available
curl --version
wget --version
```
### **Installation Testing**
#### 1. **Dry Run Test**
```bash
# Download and examine script without executing
curl -s https://cyberpanel.net/install.sh > install_test.sh
chmod +x install_test.sh
# Review script content
head -50 install_test.sh
```
#### 2. **Full Installation Test**
```bash
# Run installation in test environment
sh <(curl https://cyberpanel.net/install.sh || wget -O - https://cyberpanel.net/install.sh)
# Monitor installation process
# Check for any errors or warnings
```
### **Post-Installation Verification**
#### 1. **Service Status Check**
```bash
# Check CyberPanel service
systemctl status lscpd
# Check web server
systemctl status lsws
# Check database
systemctl status mariadb
```
#### 2. **Web Interface Test**
```bash
# Test web interface accessibility
curl -I http://localhost:8090
# Expected: HTTP/1.1 200 OK
```
#### 3. **Database Connection Test**
```bash
# Test database connection
mysql -u root -p -e "SHOW DATABASES;"
# Should show CyberPanel database
```
## 🐛 Common Issues and Solutions
### **Installation Issues**
#### 1. **"Command not found" Errors**
**Problem**: Required commands not available
**Solution**:
```bash
# Install missing packages
# Ubuntu/Debian
sudo apt update && sudo apt install curl wget git python3
# RHEL/CentOS/AlmaLinux/RockyLinux
sudo yum install curl wget git python3
```
#### 2. **Permission Denied Errors**
**Problem**: Insufficient privileges
**Solution**:
```bash
# Run with sudo
sudo sh <(curl https://cyberpanel.net/install.sh || wget -O - https://cyberpanel.net/install.sh)
```
#### 3. **Network Connectivity Issues**
**Problem**: Cannot download installation script
**Solution**:
```bash
# Check internet connection
ping -c 4 google.com
# Check DNS resolution
nslookup cyberpanel.net
# Try alternative download method
wget https://cyberpanel.net/install.sh
chmod +x install.sh
sudo ./install.sh
```
#### 4. **Port Already in Use**
**Problem**: Port 8090 already occupied
**Solution**:
```bash
# Check what's using port 8090
sudo netstat -tlnp | grep :8090
# Kill process if necessary
sudo kill -9 <PID>
# Or change CyberPanel port in configuration
```
### **Upgrade Issues**
#### 1. **Backup Creation Failed**
**Problem**: Cannot create backup
**Solution**:
```bash
# Check disk space
df -h
# Free up space if necessary
sudo apt autoremove
sudo apt autoclean
# Or specify different backup location
```
#### 2. **Database Migration Failed**
**Problem**: Database migration errors
**Solution**:
```bash
# Check database status
systemctl status mariadb
# Restart database service
sudo systemctl restart mariadb
# Run migration manually
cd /usr/local/CyberCP
python3 manage.py migrate
```
#### 3. **Service Restart Failed**
**Problem**: Services won't restart
**Solution**:
```bash
# Check service logs
journalctl -u lscpd -f
# Restart services manually
sudo systemctl restart lscpd
sudo systemctl restart lsws
```
## 📊 Verification Checklist
### **Installation Verification**
- [ ] Installation script downloads successfully
- [ ] All dependencies installed correctly
- [ ] Web server starts and responds
- [ ] Database server starts and responds
- [ ] CyberPanel web interface accessible
- [ ] Admin user can log in
- [ ] All services running properly
- [ ] No error messages in logs
### **Upgrade Verification**
- [ ] Upgrade script downloads successfully
- [ ] Backup created successfully
- [ ] Source code updated correctly
- [ ] Dependencies updated properly
- [ ] Database migrations completed
- [ ] Services restarted successfully
- [ ] Web interface still accessible
- [ ] Data integrity maintained
## 🔍 Monitoring and Logging
### **Installation Logs**
```bash
# Check installation logs
tail -f /root/cyberpanel-install.log
# Check system logs
journalctl -f
```
### **Service Logs**
```bash
# Check CyberPanel logs
tail -f /usr/local/lscp/logs/error.log
# Check web server logs
tail -f /usr/local/lsws/logs/error.log
# Check database logs
tail -f /var/log/mysql/error.log
```
## 🆘 Getting Help
### **If Installation Fails**
1. **Check the logs** for specific error messages
2. **Verify system requirements** are met
3. **Try alternative installation methods** (wget, manual download)
4. **Use troubleshooting commands** from the README
5. **Contact support** with detailed error information
### **If Upgrade Fails**
1. **Restore from backup** if available
2. **Check service status** and restart if needed
3. **Run manual upgrade** steps
4. **Use troubleshooting commands** from the README
5. **Contact support** with upgrade logs
### **Support Resources**
- **CyberPanel Forums**: https://community.cyberpanel.net
- **GitHub Issues**: https://github.com/usmannasir/cyberpanel/issues
- **Discord Server**: https://discord.gg/cyberpanel
---
**Note**: This verification guide ensures CyberPanel installation and upgrade processes work correctly across all supported operating systems. Always test in a non-production environment first.
*Last updated: January 2025*

View File

@@ -0,0 +1,290 @@
# Complete Mautic Installation Guide for CyberPanel
## Overview
Mautic is an open-source marketing automation platform that provides email marketing, lead management, campaign building, and marketing analytics. CyberPanel offers a one-click installation feature for Mautic that simplifies the deployment process.
## Prerequisites
Before installing Mautic, ensure you have:
1. **CyberPanel installed** and running
2. **A website created** in CyberPanel
3. **Administrator or website owner access**
4. **PHP 8.1 or higher** (CyberPanel will automatically switch to PHP 8.1 during installation)
5. **Sufficient database quota** in your hosting package
## Step-by-Step Installation Process
### Step 1: Access CyberPanel Dashboard
1. **Login to CyberPanel**
- Navigate to: `https://your-server-ip:8090`
- Enter your username and password
- Click "Sign In"
### Step 2: Navigate to Websites Section
1. **From the main dashboard**, look for the left sidebar menu
2. **Click on "Websites"** to expand the menu
3. **Select "List Websites"** from the dropdown
### Step 3: Access Your Website's Management Page
1. **Find your website** in the list of hosted websites
2. **Click on the "Manage" button** next to your website domain
- Alternatively, click directly on the domain name
### Step 4: Navigate to Application Installer
Once on your website's management page:
1. **Scroll down** to find the **"Applications"** section
2. **Look for the Mautic card** with the Mautic logo
- It will show "Open source marketing automation" as the description
3. **Click on the Mautic card** or the "Install Now" button
**Direct URL Pattern:**
```
https://your-cyberpanel-domain:8090/websites/your-domain.com/installMautic
```
### Step 5: Configure Mautic Installation
On the Mautic installation page, you'll need to provide:
#### Required Information:
1. **Administrator Username**
- Default suggestion: `admin`
- Choose a secure username for the Mautic admin account
2. **Email Address**
- Enter a valid email address
- This will be used for the Mautic administrator account
- Important for password recovery and notifications
3. **Password**
- Create a strong password
- Must be secure to protect your marketing platform
- Recommended: Use a combination of uppercase, lowercase, numbers, and special characters
### Step 6: Start Installation
1. **Review all entered information**
2. **Click the "Install Now" button**
3. The installation will begin with the following automated steps:
### Step 7: Installation Process
The system will automatically:
1. **Change PHP version to 8.1** (if not already set)
- This ensures compatibility with Mautic 6.x
2. **Create a MySQL database**
- Database name, username, and password are generated automatically
3. **Download Mautic 6.0.3** from GitHub
- Latest stable version is downloaded
4. **Extract files** to the specified location
5. **Run Mautic installer** with your provided credentials
6. **Generate assets** for the Mautic interface
7. **Configure web server** settings
#### Installation Progress Indicators:
- Setting up paths (0%)
- Setting up Database (20%)
- Downloading Mautic Core (30%)
- Extracting Mautic Core (50%)
- Running Mautic installer (70%)
- Successfully Installed (100%)
### Step 8: Post-Installation
Once installation is complete:
1. **Access URL will be displayed**
- Example: `https://your-domain.com` or `https://your-domain.com/mautic`
2. **Click on the provided URL** to access Mautic
3. **Complete Mautic Setup Wizard**:
- The first time you access Mautic, you'll see the setup wizard
- Configure email settings
- Set up cron jobs for email sending
- Configure tracking settings
### Step 9: Initial Mautic Configuration
After accessing Mautic for the first time:
1. **Login** with the credentials you provided during installation
2. **Configure Email Settings**:
- SMTP settings for sending emails
- Bounce handling
- Unsubscribe settings
3. **Set Up Cron Jobs** (Important!):
```bash
# Add these cron jobs for Mautic to function properly
*/5 * * * * /usr/local/lsws/lsphp81/bin/php /home/your-domain/public_html/bin/console mautic:segments:update
*/5 * * * * /usr/local/lsws/lsphp81/bin/php /home/your-domain/public_html/bin/console mautic:campaigns:update
*/5 * * * * /usr/local/lsws/lsphp81/bin/php /home/your-domain/public_html/bin/console mautic:campaigns:trigger
0 0 * * * /usr/local/lsws/lsphp81/bin/php /home/your-domain/public_html/bin/console mautic:emails:send
```
## Technical Details
### System Requirements Met by Installation
- **PHP Version**: 8.1 (automatically configured)
- **Required PHP Extensions** (installed automatically):
- bcmath
- imap
- curl
- gd
- json
- mbstring
- mysql
- xml
- zip
### Database Configuration
- **Database Type**: MySQL/MariaDB
- **Host**: localhost
- **Port**: 3306
- **Character Set**: UTF-8
- **Collation**: utf8mb4_unicode_ci
### File Permissions
The installation automatically sets appropriate permissions:
- Files: 644
- Directories: 755
- Configuration files are secured
### Web Server Configuration
- **LiteSpeed/OpenLiteSpeed**: Configured automatically
- **Apache**: If using Apache, additional modules are installed
- **.htaccess**: Properly configured for URL rewriting
## Features Available After Installation
Once Mautic is installed, you can:
1. **Email Marketing**
- Create and send email campaigns
- Design responsive email templates
- A/B testing for emails
2. **Lead Management**
- Track visitor behavior
- Score and segment leads
- Progressive profiling
3. **Marketing Campaigns**
- Visual campaign builder
- Multi-channel campaigns
- Automated workflows
4. **Analytics & Reporting**
- Real-time analytics
- Campaign performance metrics
- ROI tracking
## Troubleshooting
### Common Issues and Solutions
1. **Installation Fails at Database Creation**
- **Issue**: Maximum database limit reached
- **Solution**: Upgrade your hosting package or delete unused databases
2. **PHP Version Error**
- **Issue**: PHP 8.1 not available
- **Solution**: The installer will automatically install PHP 8.1 if missing
3. **Permission Errors**
- **Issue**: Cannot write to directory
- **Solution**: Ensure the website user has proper permissions
4. **Blank Page After Installation**
- **Issue**: Missing PHP extensions
- **Solution**: Check error logs and install missing extensions
5. **Emails Not Sending**
- **Issue**: Cron jobs not configured
- **Solution**: Set up the required cron jobs as shown above
### Checking Installation Logs
To debug issues:
1. **Check CyberPanel logs**:
```bash
tail -f /home/cyberpanel/error-logs.txt
```
## Maintenance Tasks
### Regular Maintenance
1. **Clear Cache**:
```bash
php bin/console cache:clear
```
2. **Update Database Schema**:
```bash
php bin/console doctrine:schema:update --force
```
3. **Maintenance Mode** (during updates):
```bash
php bin/console mautic:maintenance:enable
php bin/console mautic:maintenance:disable
```
## Updating Mautic
To update Mautic to a newer version:
1. **Backup your installation** first
2. **Enable maintenance mode**
3. **Run update command**:
```bash
php bin/console mautic:update:find
php bin/console mautic:update:apply
```
4. **Clear cache**
5. **Disable maintenance mode**
## Getting Help
### Resources
1. **Mautic Documentation**: https://docs.mautic.org/
2. **Mautic Community**: https://community.mautic.org/
3. **CyberPanel Forums**: https://community.cyberpanel.net/
4. **GitHub Issues**: https://github.com/mautic/mautic/issues
### Support Channels
- **CyberPanel Support**: For installation issues
- **Mautic Community**: For Mautic-specific questions
- **Professional Support**: Available from Mautic partners
## Conclusion
The CyberPanel Mautic installer streamlines the deployment of this powerful marketing automation platform. With automatic PHP configuration, database setup, and web server optimization, you can have Mautic running in minutes. Remember to complete the post-installation configuration, especially setting up cron jobs, to ensure all features work correctly.
For optimal performance, regularly maintain your Mautic installation and keep both CyberPanel and Mautic updated to their latest versions.

File diff suppressed because it is too large Load Diff

490
docs/PLUGINS.md Normal file
View File

@@ -0,0 +1,490 @@
# CyberPanel Plugin System Guide
**Author:** master3395
**Version:** 1.0.0
**Last Updated:** 2026-01-04
---
## Overview
CyberPanel includes a plugin system that allows developers to extend the functionality of the control panel. Plugins can add new features, integrate with external services, and customize the user experience.
This guide covers:
- Installing and managing plugins
- Developing your own plugins
- Plugin structure and requirements
- Using the testPlugin as a reference
---
## Table of Contents
1. [Plugin Installation](#plugin-installation)
2. [Plugin Management](#plugin-management)
3. [Plugin Development](#plugin-development)
4. [Plugin Structure](#plugin-structure)
5. [TestPlugin Reference](#testplugin-reference)
6. [Best Practices](#best-practices)
7. [Troubleshooting](#troubleshooting)
---
## Plugin Installation
### Prerequisites
- CyberPanel installed and running
- Admin access to CyberPanel
- Server with appropriate permissions
### Installation Steps
1. **Access Plugin Manager**
- Log into CyberPanel as administrator
- Navigate to **Plugins****Installed Plugins**
- Click **Upload Plugin** button
2. **Upload Plugin**
- Select the plugin ZIP file
- Click **Upload**
- Wait for upload to complete
3. **Install Plugin**
- After upload, the plugin will appear in the plugin list
- Click **Install** button next to the plugin
- Installation process will:
- Extract plugin files to `/usr/local/CyberCP/`
- Add plugin to `INSTALLED_APPS` in `settings.py`
- Add URL routing to `urls.py`
- Run database migrations (if applicable)
- Collect static files
- Restart CyberPanel service
4. **Verify Installation**
- Plugin should appear in the installed plugins list
- Status should show as "Installed" and "Enabled"
- Click **Manage** or **Settings** to access plugin interface
### Manual Installation (Advanced)
If automatic installation fails or you need to install manually:
```bash
# 1. Extract plugin to CyberPanel directory
cd /home/cyberpanel/plugins
unzip plugin-name.zip
cd plugin-name
# 2. Copy plugin to CyberPanel directory
cp -r plugin-name /usr/local/CyberCP/
# 3. Add to INSTALLED_APPS
# Edit /usr/local/CyberCP/CyberCP/settings.py
# Add 'pluginName', to INSTALLED_APPS list (alphabetically ordered)
# 4. Add URL routing
# Edit /usr/local/CyberCP/CyberCP/urls.py
# Add before generic plugin route:
# path('plugins/pluginName/', include('pluginName.urls')),
# 5. Run migrations (if plugin has models)
cd /usr/local/CyberCP
python3 manage.py makemigrations pluginName
python3 manage.py migrate pluginName
# 6. Collect static files
python3 manage.py collectstatic --noinput
# 7. Set proper permissions
chown -R cyberpanel:cyberpanel /usr/local/CyberCP/pluginName/
# 8. Restart CyberPanel
systemctl restart lscpd
```
---
## Plugin Management
### Accessing Plugins
- **Plugin List**: Navigate to **Plugins****Installed Plugins**
- **Plugin Settings**: Click **Manage** or **Settings** button for each plugin
- **Plugin URL**: Typically `/plugins/pluginName/` or `/plugins/pluginName/settings/`
### Enabling/Disabling Plugins
Plugins are automatically enabled after installation. To disable:
- Some plugins may have enable/disable functionality in their settings
- To fully disable, you can remove from `INSTALLED_APPS` (advanced)
### Uninstalling Plugins
1. Navigate to **Plugins****Installed Plugins**
2. Click **Uninstall** button (if available)
3. Manual uninstallation:
- Remove from `INSTALLED_APPS` in `settings.py`
- Remove URL routing from `urls.py`
- Remove plugin directory: `rm -rf /usr/local/CyberCP/pluginName/`
- Restart CyberPanel: `systemctl restart lscpd`
---
## Plugin Development
### Creating a New Plugin
1. **Create Plugin Directory Structure**
```
pluginName/
├── __init__.py
├── models.py # Database models (optional)
├── views.py # View functions
├── urls.py # URL routing
├── forms.py # Forms (optional)
├── utils.py # Utility functions (optional)
├── admin.py # Admin interface (optional)
├── templates/ # HTML templates
│ └── pluginName/
│ └── settings.html
├── static/ # Static files (CSS, JS, images)
│ └── pluginName/
├── migrations/ # Database migrations
│ └── __init__.py
├── meta.xml # Plugin metadata (REQUIRED)
└── README.md # Plugin documentation
```
2. **Create meta.xml**
```xml
<?xml version="1.0" encoding="UTF-8"?>
<cyberpanelPluginConfig>
<name>Plugin Name</name>
<type>Utility</type>
<description>Plugin description</description>
<version>1.0.0</version>
<url>/plugins/pluginName/</url>
<settings_url>/plugins/pluginName/settings/</settings_url>
</cyberpanelPluginConfig>
```
3. **Create URLs (urls.py)**
```python
from django.urls import re_path
from . import views
app_name = 'pluginName' # Important: Register namespace
urlpatterns = [
re_path(r'^$', views.main_view, name='main'),
re_path(r'^settings/$', views.settings_view, name='settings'),
]
```
4. **Create Views (views.py)**
```python
from django.shortcuts import render, redirect
from functools import wraps
def cyberpanel_login_required(view_func):
"""Custom decorator for CyberPanel session authentication"""
@wraps(view_func)
def _wrapped_view(request, *args, **kwargs):
try:
userID = request.session['userID']
return view_func(request, *args, **kwargs)
except KeyError:
from loginSystem.views import loadLoginPage
return redirect(loadLoginPage)
return _wrapped_view
@cyberpanel_login_required
def main_view(request):
context = {
'plugin_name': 'Plugin Name',
'version': '1.0.0'
}
return render(request, 'pluginName/index.html', context)
@cyberpanel_login_required
def settings_view(request):
context = {
'plugin_name': 'Plugin Name',
'version': '1.0.0'
}
return render(request, 'pluginName/settings.html', context)
```
5. **Create Templates**
- Templates should extend `baseTemplate/index.html`
- Place templates in `templates/pluginName/` directory
```html
{% extends "baseTemplate/index.html" %}
{% load static %}
{% load i18n %}
{% block title %}
Plugin Name Settings - {% trans "CyberPanel" %}
{% endblock %}
{% block content %}
<div class="container">
<h1>Plugin Name Settings</h1>
<!-- Your plugin content here -->
</div>
{% endblock %}
```
6. **Package Plugin**
```bash
cd /home/cyberpanel/plugins
zip -r pluginName.zip pluginName/
```
---
## Plugin Structure
### Required Files
- **meta.xml**: Plugin metadata (name, version, description, URLs)
- **__init__.py**: Python package marker
- **urls.py**: URL routing configuration
- **views.py**: View functions (at minimum, a main view)
### Optional Files
- **models.py**: Database models
- **forms.py**: Django forms
- **utils.py**: Utility functions
- **admin.py**: Django admin integration
- **templates/**: HTML templates
- **static/**: CSS, JavaScript, images
- **migrations/**: Database migrations
### Template Requirements
- Must extend `baseTemplate/index.html` (not `baseTemplate/base.html`)
- Use Django template tags: `{% load static %}`, `{% load i18n %}`
- Follow CyberPanel UI conventions
### Authentication
Plugins should use the custom `cyberpanel_login_required` decorator:
- Checks for `request.session['userID']`
- Redirects to login if not authenticated
- Compatible with CyberPanel's session-based authentication
---
## TestPlugin Reference
The **testPlugin** is a reference implementation included with CyberPanel that demonstrates:
- Basic plugin structure
- Authentication handling
- Settings page implementation
- Clean URL routing
- Template inheritance
### TestPlugin Location
- **Source**: `/usr/local/CyberCP/testPlugin/`
- **URL**: `/plugins/testPlugin/`
- **Settings URL**: `/plugins/testPlugin/settings/`
### TestPlugin Features
1. **Main View**: Simple plugin information page
2. **Settings View**: Plugin settings interface
3. **Plugin Info API**: JSON endpoint for plugin information
### Examining TestPlugin
```bash
# View plugin structure
ls -la /usr/local/CyberCP/testPlugin/
# View meta.xml
cat /usr/local/CyberCP/testPlugin/meta.xml
# View URLs
cat /usr/local/CyberCP/testPlugin/urls.py
# View views
cat /usr/local/CyberCP/testPlugin/views.py
# View templates
ls -la /usr/local/CyberCP/testPlugin/templates/testPlugin/
```
### Using TestPlugin as Template
1. Copy testPlugin directory:
```bash
cp -r /usr/local/CyberCP/testPlugin /home/cyberpanel/plugins/myPlugin
```
2. Rename files and update content:
- Update `meta.xml` with your plugin information
- Rename template files
- Update views with your functionality
- Update URLs as needed
3. Customize for your needs:
- Add models if you need database storage
- Add forms for user input
- Add utilities for complex logic
- Add static files for styling
---
## Best Practices
### Security
- Always use `cyberpanel_login_required` decorator for views
- Validate and sanitize all user input
- Use Django's form validation
- Follow CyberPanel security guidelines
- Never expose sensitive information in templates or responses
### Code Organization
- Keep files under 500 lines (split into modules if needed)
- Use descriptive function and variable names
- Add comments for complex logic
- Follow Python PEP 8 style guide
- Organize code into logical modules
### Templates
- Always extend `baseTemplate/index.html`
- Use CyberPanel's existing CSS classes
- Make templates mobile-friendly
- Use Django's internationalization (`{% trans %}`)
- Keep templates clean and readable
### Database
- Use Django migrations for schema changes
- Add proper indexes for performance
- Use transactions for multi-step operations
- Clean up old data when uninstalling
### Testing
- Test plugin installation process
- Test all plugin functionality
- Test error handling
- Test on multiple CyberPanel versions
- Test plugin uninstallation
### Documentation
- Include README.md with installation instructions
- Document all configuration options
- Provide usage examples
- Include troubleshooting section
- Document any dependencies
---
## Troubleshooting
### Plugin Not Appearing in List
- Check `meta.xml` format (must be valid XML)
- Verify plugin directory exists in `/home/cyberpanel/plugins/`
- Check CyberPanel logs: `tail -f /var/log/cyberpanel/error.log`
### Plugin Installation Fails
- Check file permissions: `ls -la /usr/local/CyberCP/pluginName/`
- Verify `INSTALLED_APPS` entry in `settings.py`
- Check URL routing in `urls.py`
- Review installation logs
- Check Python syntax: `python3 -m py_compile pluginName/views.py`
### Plugin Settings Page Not Loading
- Verify URL routing is correct
- Check template path (must be `templates/pluginName/settings.html`)
- Verify template extends `baseTemplate/index.html`
- Check for JavaScript errors in browser console
- Verify authentication decorator is used
### Template Not Found Error
- Check template directory structure: `templates/pluginName/`
- Verify template name in `render()` call matches file name
- Ensure template extends correct base template
- Check template syntax for errors
### Authentication Issues
- Verify `cyberpanel_login_required` decorator is used
- Check session is active: `request.session.get('userID')`
- Verify user is logged into CyberPanel
- Check redirect logic in decorator
### Static Files Not Loading
- Run `python3 manage.py collectstatic`
- Check static file URLs in templates
- Verify static files are in `static/pluginName/` directory
- Clear browser cache
### Database Migration Issues
- Check migrations directory exists: `migrations/__init__.py`
- Verify models are properly defined
- Run migrations: `python3 manage.py makemigrations pluginName`
- Apply migrations: `python3 manage.py migrate pluginName`
### Plugin Conflicts
- Check for duplicate plugin names
- Verify URL patterns don't conflict
- Check for namespace conflicts in `urls.py`
- Review `INSTALLED_APPS` for duplicate entries
---
## Plugin Examples
### Available Plugins
1. **testPlugin**: Reference implementation for plugin development
2. **discordWebhooks**: Server monitoring and notifications via Discord
3. **fail2ban**: Fail2ban security manager for CyberPanel
### Plugin Repository
Community plugins are available at:
- GitHub: https://github.com/master3395/cyberpanel-plugins
---
## Additional Resources
- **CyberPanel Documentation**: https://cyberpanel.net/KnowledgeBase/
- **Django Documentation**: https://docs.djangoproject.com/
- **Plugin System Source**: `/usr/local/CyberCP/pluginInstaller/`
- **Plugin Holder**: `/usr/local/CyberCP/pluginHolder/`
---
## Support
For plugin development questions:
- Check existing plugins for examples
- Review CyberPanel source code
- Ask in CyberPanel community forum
- Create an issue on GitHub
---
**Last Updated:** 2026-01-04
**Author:** master3395

View File

@@ -0,0 +1,400 @@
# Resource Limits Guide for CyberPanel
## Overview
CyberPanel now supports comprehensive resource limits for shared hosting environments using OpenLiteSpeed's native cgroups v2 integration. This feature allows you to enforce CPU, memory, I/O, inode, process, and connection limits on a per-package basis.
## Features
- **Memory Limits**: Set RAM limits (in MB) for each hosting package
- **CPU Limits**: Allocate specific CPU cores to packages
- **I/O Limits**: Control disk I/O bandwidth (in MB/s)
- **Inode Limits**: Limit the number of files/directories
- **Process Limits**: Set soft and hard process count limits
- **Connection Limits**: Control maximum concurrent PHP connections
## Prerequisites
### System Requirements
1. **Linux Kernel**: 5.2+ (for native cgroups v2 support)
- Ubuntu 20.04+, Debian 11+, CentOS Stream 9+, AlmaLinux 9+, Rocky Linux 9+
- RHEL 8 family (RHEL 8, AlmaLinux 8, Rocky 8, CloudLinux 8) with cgroups v2 manually enabled
2. **CyberPanel Version**: v2.4.4-dev or later
3. **OpenLiteSpeed**: Installed and running
### Checking Kernel Support
To verify your system supports cgroups v2:
```bash
# Check if cgroups v2 is available
ls /sys/fs/cgroup/cgroup.controllers
# Check kernel version
uname -r
```
### Enabling cgroups v2 on RHEL 8 Family
If you're running RHEL 8, AlmaLinux 8, Rocky 8, or CloudLinux 8:
```bash
# Edit GRUB configuration
vi /etc/default/grub
# Add to GRUB_CMDLINE_LINUX:
systemd.unified_cgroup_hierarchy=1 cgroup_no_v1=all
# Update GRUB
grub2-mkconfig -o /boot/grub2/grub.cfg
# Reboot
reboot
# Verify after reboot
mount | grep cgroup2
```
## Using Resource Limits
### Step 1: Create a Package with Resource Limits
1. **Navigate to Packages**
- Go to `Packages → Create Package`
2. **Basic Package Information**
- Enter Package Name
- Set Disk Space (MB)
- Set Bandwidth (MB)
- Configure Email Accounts, Databases, FTP Accounts, Allowed Domains
3. **Enable Resource Limits**
- Check the **"Enforce Disk Limits"** checkbox
- This enables all resource limit enforcement (not just disk)
4. **Configure Advanced Resource Limits**
Under "Advanced Resource Limits" section:
**CPU & Memory:**
- **Memory Limit (MB)**: RAM limit (default: 1024 MB)
- **CPU Cores**: Number of CPU cores (default: 1)
**I/O & Storage:**
- **I/O Limit (MB/s)**: Disk I/O bandwidth (default: 10 MB/s)
- **Inode Limit**: Maximum files/directories (default: 400000)
**Process & Connection Limits:**
- **Max Connections**: Concurrent PHP connections (default: 10)
- **Process Soft Limit**: Soft process count (default: 400)
- **Process Hard Limit**: Hard process count (default: 500)
5. **Save Package**
### Step 2: Create a Website with Resource Limits
1. **Navigate to Websites**
- Go to `Websites → Create Website`
2. **Website Configuration**
- Enter Domain Name
- Select the package you created (with resource limits)
- Choose PHP version
- Configure other settings as needed
3. **Create Website**
- Click "Create Website"
- CyberPanel will automatically:
- Detect and configure OpenLiteSpeed cgroups (if needed)
- Apply resource limits to the website's user
- Set filesystem quotas
### Step 3: Verify Resource Limits
After creating a website, you can verify the limits are applied.
#### Check cgroups Configuration
```bash
# Check if OpenLiteSpeed cgroups are enabled
grep -A 5 "CGIRLimit" /usr/local/lsws/conf/httpd_config.conf
# Should show: cgroups 1
```
#### Check User Resource Limits
```bash
# List limits for a specific user
/usr/local/lsws/lsns/bin/lscgctl list-user <username>
# Example output:
# {
# "1005": {
# "name": "example1234",
# "cpu": "200", # 200% = 2 cores
# "io": "20M", # 20 MB/s
# "mem": "2.0G", # 2GB RAM
# "tasks": "800" # Max 800 processes
# }
# }
```
#### Check Filesystem Quotas
```bash
# Check inode limit for user
quota -u <username>
# Example output:
# Disk quotas for user example1234 (uid 1005):
# Filesystem blocks quota limit grace files quota limit grace
# /dev/sda1 104 0 0 26 500000 500000
# ^^^^^^ ^^^^^^
# Inode limits
```
#### Check Kernel-Level cgroups
```bash
# Find the user ID
id -u <username>
# Check memory limit (in bytes)
cat /sys/fs/cgroup/user.slice/user-<UID>.slice/memory.max
# 2147483648 = 2GB
# Check process limit
cat /sys/fs/cgroup/user.slice/user-<UID>.slice/pids.max
# 800
```
## Testing Resource Limits
### Testing Memory Limits
Create a PHP script to test memory limits:
```php
<?php
// test-memory.php
ini_set('memory_limit', '-1'); // Remove PHP limit to test cgroup limit
ini_set('max_execution_time', '60');
echo "Testing memory limit...\n";
$data = [];
// Try to allocate more than the package limit
for ($i = 0; $i < 2000; $i++) { // Try 2GB
$data[] = str_repeat('X', 1024 * 1024); // 1MB chunks
if ($i % 100 == 0) {
echo "Allocated: " . $i . " MB\n";
flush();
}
}
echo "Completed!\n";
?>
```
Access via web browser: `http://yourdomain.com/test-memory.php`
**Expected behavior**: Process should be terminated when exceeding the memory limit.
### Testing Process Limits
Create a PHP script to spawn processes:
```php
<?php
// test-processes.php
echo "Testing process limits...\n";
$processes = [];
$max = 1000; // Try to exceed limit
for ($i = 0; $i < $max; $i++) {
$pid = pcntl_fork();
if ($pid == -1) {
echo "Failed to fork at process $i\n";
break;
} elseif ($pid) {
$processes[] = $pid;
echo "Created process $i (PID: $pid)\n";
flush();
} else {
sleep(30);
exit(0);
}
}
echo "Created " . count($processes) . " processes\n";
// Clean up
foreach ($processes as $pid) {
pcntl_waitpid($pid, $status);
}
?>
```
**Expected behavior**: Fork should fail when reaching the process hard limit.
## Automatic Setup
CyberPanel automatically handles OpenLiteSpeed cgroups setup:
1. **First-time Setup**: When you create a website with resource limits enabled:
- Checks if cgroups v2 is available
- Runs `lssetup` if LiteSpeed Containers not configured
- Enables cgroups in OpenLiteSpeed config
- Restarts OpenLiteSpeed
- Applies resource limits
2. **Subsequent Websites**: Resource limits are applied instantly without restarting.
## Important Notes
### Resource Sharing
- **Subdomains and Addon Domains**: Share the same limits as the main domain
- All domains under the same website use the same Linux user
- Limits are enforced per-user, not per-domain
### I/O Limits Caveat
On some systems, the I/O controller may not be delegated to user slices by systemd. In this case:
- lscgctl will store the I/O configuration
- But kernel-level enforcement may not work
- CPU, Memory, and Process limits work on all supported systems
### Memory Limit Enforcement
Memory limits are enforced at the cgroup level:
- When limit is reached, processes are killed by the kernel
- Check `/sys/fs/cgroup/user.slice/user-<UID>.slice/memory.events` for OOM events
### Connection Limits
The "Max Connections" setting controls:
- Maximum concurrent PHP-FPM/LSPHP processes
- Configured in OpenLiteSpeed virtual host extprocessor settings
## Troubleshooting
### Resource Limits Not Working
1. **Check if enforcement is enabled**:
```bash
mysql -u root -e "SELECT packageName, enforceDiskLimits FROM cyberpanel.packages_package;"
```
Ensure `enforceDiskLimits` is `1` for your package.
2. **Check cgroups are enabled**:
```bash
grep "cgroups" /usr/local/lsws/conf/httpd_config.conf
```
Should show `cgroups 1`.
3. **Check lscgctl is configured**:
```bash
/usr/local/lsws/lsns/bin/lscgctl list-all
```
4. **Check CyberPanel logs**:
```bash
tail -100 /usr/local/CyberCP/logs/access.log
```
### RHEL 8 Family: cgroups v2 Not Available
If you see errors about cgroups v2 not being available on RHEL 8/AlmaLinux 8/Rocky 8:
1. Follow the [Enabling cgroups v2 on RHEL 8 Family](#enabling-cgroups-v2-on-rhel-8-family) steps
2. Reboot the server
3. Verify with `mount | grep cgroup2`
### LiteSpeed Containers Not Configured
If you see "You must configure LiteSpeed for LiteSpeed Containers":
1. CyberPanel should auto-run lssetup
2. If it doesn't work, manually run:
```bash
/usr/local/lsws/lsns/bin/lssetup -c 2 -n 0 -s /usr/local/lsws
```
3. Restart OpenLiteSpeed:
```bash
/usr/local/lsws/bin/lswsctrl restart
```
## Package Recommendations
Here are some example package configurations for different use cases:
### Basic Shared Hosting
- Memory: 512 MB
- CPU: 1 core
- I/O: 5 MB/s
- Inodes: 200,000
- Max Connections: 5
- Proc Soft/Hard: 200/300
### Standard Shared Hosting
- Memory: 1024 MB (1 GB)
- CPU: 1 core
- I/O: 10 MB/s
- Inodes: 400,000
- Max Connections: 10
- Proc Soft/Hard: 400/500
### Premium Shared Hosting
- Memory: 2048 MB (2 GB)
- CPU: 2 cores
- I/O: 20 MB/s
- Inodes: 800,000
- Max Connections: 20
- Proc Soft/Hard: 600/800
### Business Hosting
- Memory: 4096 MB (4 GB)
- CPU: 4 cores
- I/O: 50 MB/s
- Inodes: 1,000,000
- Max Connections: 50
- Proc Soft/Hard: 1000/1500
## FAQ
**Q: Do I need to restart OpenLiteSpeed after changing package limits?**
A: No, limits are applied immediately when you create a website or modify a package (though the website needs to be recreated for new limits to apply).
**Q: Can I change limits for existing websites?**
A: Yes, modify the package and then run:
```bash
/usr/local/lsws/lsns/bin/lscgctl set-user <username> --cpu <percent> --mem <size> --tasks <count>
```
**Q: Are limits enforced for email and FTP?**
A: The resource limits primarily apply to web processes (PHP). Email and FTP have separate process limits but share the same filesystem quotas (inodes).
**Q: What happens when a limit is reached?**
- **Memory**: Process is killed (OOM)
- **CPU**: Process is throttled
- **Processes**: Fork/exec fails
- **Inodes**: File creation fails
- **Connections**: New connections are queued or rejected
**Q: Can I disable resource limits after enabling them?**
A: Yes, uncheck "Enforce Disk Limits" in the package settings and recreate the website.
## Support
For issues or questions:
- GitHub: https://github.com/usmannasir/cyberpanel/issues
- Community Forum: https://community.cyberpanel.net
- Documentation: https://docs.cyberpanel.net

View File

@@ -0,0 +1,193 @@
# CyberPanel Secure Installation Guide
## Overview
This document describes the secure installation process for CyberPanel that generates secure passwords and updates configuration files directly during installation.
## Security Improvements
### ✅ **Fixed Security Vulnerabilities**
1. **Hardcoded Database Passwords** - Now generated securely during installation
2. **Hardcoded Django Secret Key** - Now generated using cryptographically secure random generation
3. **Direct Configuration Updates** - Passwords updated directly in settings.py during installation
4. **File Permissions** - settings.py file set to 640 (owner read/write, group read only)
### 🔐 **Security Features**
- **Cryptographically Secure Passwords**: Uses Python's `secrets` module for password generation
- **Direct Configuration Updates**: Passwords updated directly in settings.py, no external files needed
- **Secure File Permissions**: settings.py protected with 640 permissions
- **Simplified Architecture**: No external environment files required
- **Linux/Unix Focused**: Optimized for supported platforms only
## Installation Process
### 1. **Automatic Secure Installation**
The installation script now automatically:
1. Generates secure random passwords for:
- MySQL root user
- CyberPanel database user
- Django secret key
2. Updates `settings.py` directly with secure configuration:
```python
SECRET_KEY = 'generated_secure_key'
DATABASES = {
'default': {
'PASSWORD': 'generated_cyberpanel_password',
},
'rootdb': {
'PASSWORD': 'generated_root_password',
}
}
```
3. Sets secure file permissions (640) on settings.py
4. No external environment files required
### 2. **Manual Configuration** (if needed)
If you need to manually update configuration, edit the settings.py file directly:
```bash
nano /usr/local/CyberCP/CyberCP/settings.py
```
## File Structure
```
/usr/local/CyberCP/
├── CyberCP/
│ └── settings.py # Main configuration file (640 permissions)
```
## Security Best Practices
### ✅ **Do's**
- Keep `.env` and `.env.backup` files secure
- Record credentials from `.env.backup` and delete the file after installation
- Use strong, unique passwords for production deployments
- Regularly rotate database passwords
- Monitor access to environment files
### ❌ **Don'ts**
- Never commit `.env` files to version control
- Don't share `.env` files via insecure channels
- Don't use default passwords in production
- Don't leave `.env.backup` files on the system after recording credentials
## Recovery
### **Lost Credentials**
If you lose your database credentials:
1. Check if `.env.backup` file exists:
```bash
sudo cat /usr/local/CyberCP/.env.backup
```
2. If backup doesn't exist, you'll need to reset MySQL passwords using MySQL recovery procedures
### **Regenerate Environment**
To regenerate environment configuration:
```bash
cd /usr/local/CyberCP
sudo python install/env_generator.py /usr/local/CyberCP
```
## Configuration Options
### **Environment Variables**
| Variable | Description | Default |
|----------|-------------|---------|
| `SECRET_KEY` | Django secret key | Generated (64 chars) |
| `DB_PASSWORD` | CyberPanel DB password | Generated (24 chars) |
| `ROOT_DB_PASSWORD` | MySQL root password | Generated (24 chars) |
| `DEBUG` | Debug mode | False |
| `ALLOWED_HOSTS` | Allowed hosts | localhost,127.0.0.1,hostname |
### **Custom Configuration**
To use custom passwords during installation:
```bash
python install/env_generator.py /usr/local/CyberCP "your_root_password" "your_db_password"
```
## Troubleshooting
### **Installation Fails**
If the new secure installation fails:
1. Check installation logs for error messages
2. The system will automatically fallback to the original installation method
3. Verify Python dependencies are installed:
```bash
pip install python-dotenv
```
### **Environment Loading Issues**
If Django can't load environment variables:
1. Ensure `.env` file exists and has correct permissions:
```bash
ls -la /usr/local/CyberCP/.env
# Should show: -rw------- 1 root root
```
2. Install python-dotenv if missing:
```bash
pip install python-dotenv
```
## Migration from Old Installation
### **Existing Installations**
For existing CyberPanel installations with hardcoded passwords:
1. **Backup current configuration**:
```bash
cp /usr/local/CyberCP/CyberCP/settings.py /usr/local/CyberCP/CyberCP/settings.py.backup
```
2. **Generate new environment configuration**:
```bash
cd /usr/local/CyberCP
python install/env_generator.py /usr/local/CyberCP
```
3. **Update settings.py** (already done in new installations):
- The settings.py file now supports environment variables
- It will fallback to hardcoded values if .env is not available
4. **Test the configuration**:
```bash
cd /usr/local/CyberCP
python manage.py check
```
## Support
For issues with the secure installation:
1. Check the installation logs
2. Verify file permissions
3. Ensure all dependencies are installed
4. Review the fallback installation method if needed
---
**Security Notice**: This installation method significantly improves security by eliminating hardcoded credentials. Always ensure proper file permissions and secure handling of environment files.

337
docs/TROUBLESHOOTING.md Normal file
View File

@@ -0,0 +1,337 @@
# CyberPanel Troubleshooting Guide
## Overview
This guide provides comprehensive troubleshooting information for common CyberPanel issues, including file integrity verification, system diagnostics, and support commands.
## Quick Support Commands
### **System Status Checks**
```bash
# Check CyberPanel service status
sudo systemctl status lscpd
# Check web server status
sudo systemctl status apache2
# Check if CyberPanel is accessible
curl -I http://localhost:8090
# Check system resources
free -h
df -h
top
```
### **File Integrity Verification**
```bash
# Check Python syntax
python -m py_compile manage.py
python -m py_compile CyberCP/settings.py
python -m py_compile CyberCP/urls.py
# Verify Django configuration
python manage.py check
# Check file count (should be ~5,597)
find . -type f | wc -l
# Verify critical directories
ls -la /usr/local/CyberCP/CyberCP/
ls -la /usr/local/CyberCP/plogical/
ls -la /usr/local/CyberCP/websiteFunctions/
```
### **Log Analysis**
```bash
# Check CyberPanel logs
tail -f /usr/local/lscp/logs/error.log
# Check Django logs
tail -f /usr/local/CyberCP/logs/cyberpanel.log
# Check system logs
journalctl -u lscpd -f
journalctl -u apache2 -f
# Check installation logs
tail -f /root/cyberpanel-install.log
```
## File Integrity & Verification
CyberPanel includes comprehensive file integrity verification to ensure all components are properly installed and synchronized.
### **Verification Status**
- **Total Files Verified**: 5,597 files synchronized and validated
- **Python Syntax**: All core Python modules validated for syntax errors
- **Django Configuration**: Complete Django application integrity verified
- **Environment Files**: All configuration files (.env, .env.backup) verified
- **Static Assets**: All UI assets and templates synchronized
- **Core Modules**: All application modules (loginSystem, websiteFunctions, plogical) verified
### **Verification Process**
The verification system automatically checks:
1. **File Completeness**: Ensures all critical files are present
2. **Python Syntax**: Validates all Python files for syntax errors
3. **Django Integrity**: Verifies Django configuration and URL routing
4. **Environment Configuration**: Checks .env files and configuration
5. **Module Dependencies**: Ensures all application modules are complete
6. **Static Assets**: Verifies UI components and templates
## Common Issues & Solutions
### **Missing Files or Broken Installation**
- **Issue**: CyberPanel components not working due to missing files
- **Symptoms**: Import errors, Django configuration issues, missing modules
- **Solution**:
```bash
# Verify file integrity
python -m py_compile manage.py
python manage.py check
# Check for missing files
find . -name "*.py" -exec python -m py_compile {} \;
```
- **Prevention**: Regular file integrity checks and proper installation procedures
### **Django Configuration Issues**
- **Issue**: Django application fails to start or load
- **Symptoms**: ModuleNotFoundError, ImportError, settings issues
- **Solution**:
```bash
# Check Django configuration
python manage.py check --deploy
# Verify environment files
ls -la .env*
# Test Django setup
python -c "import django; django.setup(); print('Django OK')"
```
### **Bandwidth Not Resetting Monthly**
- **Issue**: Bandwidth usage shows cumulative values instead of monthly usage
- **Solution**: Run the bandwidth reset script: `/usr/local/CyberCP/scripts/reset_bandwidth.sh`
- **Prevention**: Ensure monthly cron job is running: `0 0 1 * * /usr/local/CyberCP/bin/python /usr/local/CyberCP/postfixSenderPolicy/client.py monthlyCleanup`
### **Environment Configuration Issues**
- **Issue**: Missing or corrupted .env files
- **Symptoms**: Configuration errors, missing environment variables
- **Solution**:
```bash
# Check for .env files
ls -la .env*
# Verify .env template exists
cp .env.template .env
# Edit .env with your configuration
```
### **Python Module Import Errors**
- **Issue**: Python modules cannot be imported
- **Symptoms**: ImportError, ModuleNotFoundError
- **Solution**:
```bash
# Check Python syntax
python -m py_compile path/to/module.py
# Verify all core modules
python -m py_compile CyberCP/settings.py
python -m py_compile loginSystem/views.py
python -m py_compile websiteFunctions/views.py
```
### **Service Won't Start**
- **Issue**: CyberPanel service fails to start
- **Solution**: Check logs and restart services
```bash
# Check service status
sudo systemctl status lscpd
# Check logs
sudo journalctl -u lscpd -f
# Restart service
sudo systemctl restart lscpd
```
### **Web Server Issues**
- **Issue**: Apache2 configuration problems
- **Solution**: Reconfigure web server
```bash
# Check Apache2 status
sudo systemctl status apache2
# Test configuration
sudo apache2ctl configtest
# Restart Apache2
sudo systemctl restart apache2
```
## Diagnostic Commands
### **System Diagnostics**
```bash
# Check disk usage
df -h
# Check memory usage
free -h
# Check running processes
ps aux | grep cyberpanel
# Check network connectivity
ping -c 4 google.com
# Check firewall status
sudo ufw status
sudo firewall-cmd --state
```
### **Permission Checks**
```bash
# Check file permissions
ls -la /usr/local/CyberCP/
# Check directory ownership
find /usr/local/CyberCP/ -type d -exec ls -ld {} \;
# Fix common permission issues
sudo chown -R cyberpanel:cyberpanel /usr/local/CyberCP/
sudo chmod -R 755 /usr/local/CyberCP/
```
### **Cron Job Verification**
```bash
# Check cron jobs
crontab -l
# Check system cron jobs
sudo crontab -l
# Verify cron service
sudo systemctl status cron
```
## Log File Locations
### **CyberPanel Logs**
- **Main Log**: `/usr/local/lscp/logs/error.log`
- **Django Logs**: `/usr/local/CyberCP/logs/cyberpanel.log`
- **Installation Log**: `/root/cyberpanel-install.log`
### **System Logs**
- **Apache2**: `/var/log/apache2/`
- **System**: `/var/log/syslog`
- **Journal**: `journalctl -u lscpd`
### **Application Logs**
- **Database**: `/var/log/mysql/`
- **Email**: `/var/log/mail.log`
- **DNS**: `/var/log/powerdns.log`
## Getting Help
### **Self-Diagnosis Steps**
1. **Check service status** using the commands above
2. **Review relevant log files** for error messages
3. **Verify file integrity** using Python compilation checks
4. **Test network connectivity** and firewall settings
5. **Check system resources** (memory, disk space)
### **Support Resources**
- **📚 [Complete Guides Index](INDEX.md)** - All available documentation
#### **OS-Specific Troubleshooting Guides**
- **🐧 [Debian 13 Installation Guide](DEBIAN_13_INSTALLATION_GUIDE.md)** - Debian 13 troubleshooting
- **🐧 [Debian 12 Troubleshooting Guide](DEBIAN_12_TROUBLESHOOTING.md)** - Debian 12 troubleshooting
- **🐧 [Debian 11 Troubleshooting Guide](DEBIAN_11_TROUBLESHOOTING.md)** - Debian 11 troubleshooting
- **🐧 [Ubuntu 24.04.3 Troubleshooting Guide](UBUNTU_24_TROUBLESHOOTING.md)** - Ubuntu 24.04.3 troubleshooting
- **🐧 [Ubuntu 22.04 Troubleshooting Guide](UBUNTU_22_TROUBLESHOOTING.md)** - Ubuntu 22.04 troubleshooting
- **🐧 [Ubuntu 20.04 Troubleshooting Guide](UBUNTU_20_TROUBLESHOOTING.md)** - Ubuntu 20.04 troubleshooting
- **🔴 [AlmaLinux 10 Troubleshooting Guide](ALMALINUX_10_TROUBLESHOOTING.md)** - AlmaLinux 10 troubleshooting
- **🔴 [AlmaLinux 9 Troubleshooting Guide](ALMALINUX_9_TROUBLESHOOTING.md)** - AlmaLinux 9 troubleshooting
- **🔴 [AlmaLinux 8 Troubleshooting Guide](ALMALINUX_8_TROUBLESHOOTING.md)** - AlmaLinux 8 troubleshooting
- **🔴 [RockyLinux 9 Troubleshooting Guide](ROCKYLINUX_9_TROUBLESHOOTING.md)** - RockyLinux 9 troubleshooting
- **🔴 [RockyLinux 8 Troubleshooting Guide](ROCKYLINUX_8_TROUBLESHOOTING.md)** - RockyLinux 8 troubleshooting
- **🔴 [CentOS 9 Troubleshooting Guide](CENTOS_9_TROUBLESHOOTING.md)** - CentOS 9 troubleshooting
- **☁️ [CloudLinux 8 Troubleshooting Guide](CLOUDLINUX_8_TROUBLESHOOTING.md)** - CloudLinux 8 troubleshooting
#### **Feature-Specific Guides**
- **🐳 [Docker Command Execution Guide](Docker_Command_Execution_Guide.md)** - Docker-related issues
- **🤖 [AI Scanner Documentation](AIScannerDocs.md)** - Security scanner troubleshooting
- **📧 [Mautic Installation Guide](MAUTIC_INSTALLATION_GUIDE.md)** - Email marketing setup
- **🎨 [Custom CSS Guide](CUSTOM_CSS_GUIDE.md)** - Interface customization issues
- **🔥 [Firewall Blocking Feature Guide](FIREWALL_BLOCKING_FEATURE.md)** - Security features
### **Community Support**
- **CyberPanel Forums**: https://community.cyberpanel.net
- **GitHub Issues**: https://github.com/usmannasir/cyberpanel/issues
- **Discord Server**: https://discord.gg/cyberpanel
## Advanced Troubleshooting
### **Network Issues**
```bash
# Check port availability
netstat -tlnp | grep :8090
ss -tlnp | grep :8090
# Test port connectivity
telnet localhost 8090
nc -zv localhost 8090
```
### **Database Issues**
```bash
# Check MySQL/MariaDB status
sudo systemctl status mysql
sudo systemctl status mariadb
# Test database connection
mysql -u root -p -e "SHOW DATABASES;"
# Check database logs
sudo tail -f /var/log/mysql/error.log
```
### **SSL Certificate Issues**
```bash
# Check certificate status
openssl x509 -in /path/to/certificate.crt -text -noout
# Test SSL connectivity
openssl s_client -connect your-domain.com:443
# Check Let's Encrypt certificates
sudo certbot certificates
```
---
**Note**: This troubleshooting guide covers the most common issues and solutions. For specific problems not covered here, refer to the individual feature guides or contact the CyberPanel community for assistance.

View File

@@ -0,0 +1,367 @@
# Ubuntu 24.04.3 LTS Troubleshooting Guide for CyberPanel
## Overview
This guide provides Ubuntu 24.04.3 LTS-specific troubleshooting information for CyberPanel installation and operation issues.
## System Information
- **OS**: Ubuntu 24.04.3 LTS (Noble Numbat)
- **Architecture**: x86_64
- **Support Status**: Full Support until April 2029
- **Package Manager**: APT (Advanced Package Tool)
## Ubuntu-Specific Commands
### **System Status Checks**
```bash
# Check Ubuntu version
lsb_release -a
cat /etc/os-release
# Check CyberPanel service status
sudo systemctl status lscpd
# Check Apache2 status (Ubuntu uses Apache2)
sudo systemctl status apache2
# Check if CyberPanel is accessible
curl -I http://localhost:8090
```
### **Package Management**
```bash
# Update package lists
sudo apt update
# Upgrade system packages
sudo apt upgrade -y
# Install essential packages
sudo apt install -y curl wget git
# Check for broken packages
sudo apt --fix-broken install
# Clean package cache
sudo apt autoremove -y
sudo apt autoclean
```
### **Ubuntu-Specific Log Locations**
```bash
# CyberPanel logs
tail -f /usr/local/lscp/logs/error.log
# Apache2 logs (Ubuntu default)
tail -f /var/log/apache2/error.log
tail -f /var/log/apache2/access.log
# System logs
tail -f /var/log/syslog
journalctl -u lscpd -f
journalctl -u apache2 -f
# Installation logs
tail -f /root/cyberpanel-install.log
```
## Common Ubuntu 24.04.3 Issues
### **1. Package Installation Failures**
**Issue**: APT package installation errors during CyberPanel setup
**Symptoms**:
- `E: Unable to locate package` errors
- `E: Package has no installation candidate` errors
- Repository connection failures
**Solution**:
```bash
# Update package lists
sudo apt update
# Fix broken packages
sudo apt --fix-broken install
# Clean package cache
sudo apt clean
sudo apt autoclean
# Retry installation
sudo ./install.sh
```
### **2. Apache2 Configuration Issues**
**Issue**: Apache2 service conflicts or configuration problems
**Symptoms**:
- Apache2 fails to start
- Port 80/443 conflicts
- Configuration syntax errors
**Solution**:
```bash
# Check Apache2 configuration
sudo apache2ctl configtest
# Check for port conflicts
sudo netstat -tlnp | grep :80
sudo netstat -tlnp | grep :443
# Restart Apache2
sudo systemctl restart apache2
# Check Apache2 status
sudo systemctl status apache2
```
### **3. PHP Version Issues**
**Issue**: PHP version compatibility problems
**Symptoms**:
- PHP version not supported
- Missing PHP extensions
- PHP configuration errors
**Solution**:
```bash
# Check current PHP version
php -v
# Install PHP 8.1 (recommended for CyberPanel)
sudo apt install -y php8.1 php8.1-cli php8.1-common php8.1-mysql php8.1-zip php8.1-gd php8.1-mbstring php8.1-curl php8.1-xml php8.1-bcmath
# Enable PHP 8.1
sudo a2enmod php8.1
# Restart Apache2
sudo systemctl restart apache2
```
### **4. Firewall Configuration (UFW)**
**Issue**: Ubuntu's UFW firewall blocking CyberPanel ports
**Symptoms**:
- Cannot access CyberPanel web interface
- Connection refused errors
- Port access denied
**Solution**:
```bash
# Check UFW status
sudo ufw status
# Allow CyberPanel ports
sudo ufw allow 8090/tcp
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw allow 21/tcp
sudo ufw allow 25/tcp
sudo ufw allow 53/tcp
sudo ufw allow 587/tcp
sudo ufw allow 993/tcp
sudo ufw allow 995/tcp
# Enable UFW if not already enabled
sudo ufw enable
```
### **5. SystemD Service Issues**
**Issue**: CyberPanel service not starting properly
**Symptoms**:
- `systemctl status lscpd` shows failed
- Service won't start on boot
- Service dependency errors
**Solution**:
```bash
# Check service status
sudo systemctl status lscpd
# Check service logs
sudo journalctl -u lscpd -f
# Reload systemd configuration
sudo systemctl daemon-reload
# Restart CyberPanel service
sudo systemctl restart lscpd
# Enable service to start on boot
sudo systemctl enable lscpd
```
### **6. Permission Issues**
**Issue**: File permission problems specific to Ubuntu
**Symptoms**:
- Permission denied errors
- Cannot write to directories
- File ownership issues
**Solution**:
```bash
# Check file permissions
ls -la /usr/local/CyberCP/
# Fix ownership (replace 'cyberpanel' with actual user)
sudo chown -R cyberpanel:cyberpanel /usr/local/CyberCP/
# Fix permissions
sudo chmod -R 755 /usr/local/CyberCP/
# Check user groups
groups cyberpanel
```
## Ubuntu-Specific Diagnostic Commands
### **System Information**
```bash
# Check Ubuntu version and details
lsb_release -a
cat /etc/os-release
# Check kernel version
uname -r
# Check system architecture
arch
lscpu
```
### **Network Configuration**
```bash
# Check network interfaces
ip addr show
ip route show
# Check DNS resolution
nslookup google.com
dig google.com
# Test connectivity
ping -c 4 google.com
```
### **Disk and Memory Usage**
```bash
# Check disk usage
df -h
du -sh /usr/local/CyberCP/
# Check memory usage
free -h
cat /proc/meminfo
# Check swap usage
swapon -s
```
## Ubuntu 24.04.3 Specific Considerations
### **1. Snap Package Conflicts**
Ubuntu 24.04.3 comes with many snap packages that might conflict:
```bash
# Check for snap packages
snap list
# Remove conflicting snap packages if needed
sudo snap remove package-name
```
### **2. SystemD-Resolved**
Ubuntu 24.04.3 uses systemd-resolved for DNS:
```bash
# Check DNS resolution
systemd-resolve --status
# Restart DNS resolver if needed
sudo systemctl restart systemd-resolved
```
### **3. AppArmor**
Ubuntu 24.04.3 has AppArmor enabled by default:
```bash
# Check AppArmor status
sudo aa-status
# Check AppArmor logs
sudo dmesg | grep apparmor
```
## Performance Optimization for Ubuntu 24.04.3
### **System Optimization**
```bash
# Optimize APT for faster package installation
echo 'APT::Install-Recommends "false";' | sudo tee /etc/apt/apt.conf.d/99-no-recommends
# Enable APT caching
echo 'APT::Cache-Limit "100000000";' | sudo tee /etc/apt/apt.conf.d/99-cache-limit
```
### **Apache2 Optimization**
```bash
# Edit Apache2 configuration
sudo nano /etc/apache2/apache2.conf
# Add these optimizations:
ServerTokens Prod
ServerSignature Off
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
```
## Getting Help for Ubuntu 24.04.3
### **Ubuntu-Specific Resources**
- **Ubuntu Documentation**: https://help.ubuntu.com/
- **Ubuntu Forums**: https://ubuntuforums.org/
- **Ask Ubuntu**: https://askubuntu.com/
### **CyberPanel Resources**
- **General Troubleshooting**: [Troubleshooting Guide](TROUBLESHOOTING.md)
- **Complete Guides**: [Guides Index](INDEX.md)
- **CyberPanel Forums**: https://community.cyberpanel.net
### **System Logs to Check**
```bash
# Ubuntu system logs
sudo journalctl -xe
sudo dmesg | tail -50
# CyberPanel specific logs
tail -f /usr/local/lscp/logs/error.log
tail -f /usr/local/CyberCP/logs/cyberpanel.log
```
---
**Note**: This guide is specifically tailored for Ubuntu 24.04.3 LTS. For other Ubuntu versions or operating systems, refer to the appropriate OS-specific troubleshooting guide.

View File

@@ -0,0 +1,329 @@
# CyberPanel Windows Development Guide
## 🎯 Overview
**⚠️ IMPORTANT**: CyberPanel is designed specifically for Linux systems and does not officially support Windows. This guide is for **development and testing purposes only**.
This guide provides instructions for running CyberPanel in a Windows development environment using Python and Django. This setup is intended for:
- **Developers** working on CyberPanel features
- **Testing** CyberPanel functionality
- **Learning** CyberPanel architecture
- **Development** of CyberPanel extensions
**For production use, always use a supported Linux distribution.**
## 📋 Prerequisites
### System Requirements
- **OS**: Windows 7/8.1/10/11 (64-bit recommended)
- **RAM**: Minimum 4GB (8GB+ recommended)
- **Storage**: Minimum 20GB free space
- **CPU**: 2+ cores recommended
- **Network**: Internet connection required
### Required Software
- **Python 3.8+**: Download from [python.org](https://python.org)
- **Git**: Download from [git-scm.com](https://git-scm.com)
- **Administrator Access**: Required for installation
### ⚠️ Limitations
- **No Web Server**: OpenLiteSpeed/LiteSpeed not available on Windows
- **No System Services**: MariaDB, PowerDNS, etc. not included
- **Limited Functionality**: Many CyberPanel features require Linux
- **Development Only**: Not suitable for production use
## 🚀 Installation Methods
### Method 1: Automated Installation (Recommended)
#### Step 1: Download Installation Script
1. Navigate to the `utils/windows/` folder
2. Download `cyberpanel_install.bat`
3. Right-click and select "Run as administrator"
#### Step 2: Follow Installation Prompts
The script will automatically:
- Check system requirements
- Create Python virtual environment
- Download CyberPanel source code
- Install all dependencies
- Set up the web interface
#### Step 3: Access CyberPanel
1. Open your web browser
2. Navigate to: `http://localhost:8090`
3. Use default credentials:
- **Username**: `admin`
- **Password**: `123456`
### Method 2: Manual Installation
#### Step 1: Install Python
1. Download Python 3.8+ from [python.org](https://python.org)
2. **Important**: Check "Add Python to PATH" during installation
3. Verify installation:
```cmd
python --version
pip --version
```
#### Step 2: Install Git
1. Download Git from [git-scm.com](https://git-scm.com)
2. Install with default settings
3. Verify installation:
```cmd
git --version
```
#### Step 3: Create CyberPanel Directory
```cmd
mkdir C:\usr\local\CyberCP
cd C:\usr\local\CyberCP
```
#### Step 4: Set Up Python Environment
```cmd
python -m venv . --system-site-packages
Scripts\activate.bat
```
#### Step 5: Download CyberPanel
```cmd
git clone https://github.com/usmannasir/cyberpanel.git
cd cyberpanel
```
#### Step 6: Install Dependencies
```cmd
pip install --upgrade pip setuptools wheel
pip install -r requirments.txt
```
#### Step 7: Set Up Django
```cmd
python manage.py collectstatic --noinput
python manage.py migrate
```
#### Step 8: Create Admin User
```cmd
python manage.py createsuperuser
```
#### Step 9: Start CyberPanel
```cmd
python manage.py runserver 0.0.0.0:8090
```
## 🔧 Post-Installation Configuration
### Change Default Password
1. Access CyberPanel at `http://localhost:8090`
2. Log in with default credentials
3. Go to **User Management** → **Modify User**
4. Change the admin password immediately
### Configure Windows Firewall
1. Open Windows Defender Firewall
2. Add inbound rule for port 8090
3. Allow Python through firewall
### Set Up Windows Service (Optional)
1. Run `install_service.bat` as administrator
2. CyberPanel will start automatically on boot
3. Manage service through Windows Services
## 🔄 Upgrading CyberPanel
### Using Upgrade Script
1. Download `cyberpanel_upgrade.bat`
2. Right-click and select "Run as administrator"
3. Script will automatically backup and upgrade
### Manual Upgrade
```cmd
cd C:\usr\local\CyberCP\cyberpanel
Scripts\activate.bat
git pull origin stable
pip install --upgrade -r requirments.txt
python manage.py migrate
python manage.py collectstatic --noinput
```
## 🛠️ Utility Scripts
### Available Scripts
- **`cyberpanel_install.bat`**: Complete installation
- **`cyberpanel_upgrade.bat`**: Upgrade existing installation
- **`install_webauthn.bat`**: Enable WebAuthn/Passkey authentication
### Script Usage
1. **Right-click** on any script
2. Select **"Run as administrator"**
3. Follow on-screen prompts
4. Check output for any errors
## 🐛 Troubleshooting
### Common Issues
#### "Python not found" Error
**Problem**: Python is not installed or not in PATH
**Solution**:
1. Install Python from [python.org](https://python.org)
2. Check "Add Python to PATH" during installation
3. Restart Command Prompt
4. Verify with `python --version`
#### "Access Denied" Error
**Problem**: Insufficient privileges
**Solution**:
1. Right-click script and select "Run as administrator"
2. Or open Command Prompt as administrator
3. Navigate to script location and run
#### "Failed to install requirements" Error
**Problem**: Network or dependency issues
**Solution**:
1. Check internet connection
2. Try running script again
3. Install requirements manually:
```cmd
pip install --upgrade pip
pip install -r requirments.txt
```
#### "Port 8090 already in use" Error
**Problem**: Another service is using port 8090
**Solution**:
1. Stop other services using port 8090
2. Or change CyberPanel port in settings
3. Check with: `netstat -an | findstr :8090`
#### "Django not found" Error
**Problem**: Virtual environment not activated
**Solution**:
1. Navigate to CyberPanel directory
2. Activate virtual environment:
```cmd
Scripts\activate.bat
```
3. Verify with `python -c "import django"`
### Advanced Troubleshooting
#### Check Installation Logs
```cmd
cd C:\usr\local\CyberCP\cyberpanel
python manage.py check
```
#### Verify Dependencies
```cmd
pip list
pip check
```
#### Test Database Connection
```cmd
python manage.py dbshell
```
#### Reset Database (Last Resort)
```cmd
python manage.py flush
python manage.py migrate
python manage.py createsuperuser
```
## 🔒 Security Considerations
### Initial Security Setup
1. **Change Default Password**: Immediately after installation
2. **Enable 2FA**: Use the 2FA guide for additional security
3. **Configure Firewall**: Restrict access to necessary ports only
4. **Regular Updates**: Keep CyberPanel and dependencies updated
### Windows-Specific Security
1. **User Account Control**: Keep UAC enabled
2. **Windows Defender**: Ensure real-time protection is on
3. **Regular Backups**: Backup CyberPanel data regularly
4. **Service Account**: Consider using dedicated service account
## 📊 Performance Optimization
### System Optimization
1. **Disable Unnecessary Services**: Free up system resources
2. **SSD Storage**: Use SSD for better performance
3. **Memory**: Ensure adequate RAM (8GB+ recommended)
4. **CPU**: Multi-core processor recommended
### CyberPanel Optimization
1. **Static Files**: Ensure static files are properly collected
2. **Database**: Regular database maintenance
3. **Logs**: Regular log cleanup
4. **Caching**: Enable appropriate caching
## 🔄 Maintenance
### Regular Maintenance Tasks
1. **Updates**: Regular CyberPanel updates
2. **Backups**: Regular data backups
3. **Logs**: Monitor and clean logs
4. **Security**: Regular security checks
### Backup Procedures
1. **Database Backup**:
```cmd
python manage.py dumpdata > backup.json
```
2. **File Backup**:
```cmd
xcopy C:\usr\local\CyberCP backup_folder /E /I /H
```
3. **Restore from Backup**:
```cmd
python manage.py loaddata backup.json
```
## 📚 Additional Resources
### Documentation
- **Main Guide**: [2FA Authentication Guide](2FA_AUTHENTICATION_GUIDE.md)
- **Troubleshooting**: [Troubleshooting Guide](TROUBLESHOOTING.md)
- **Utility Scripts**: [Utility Scripts](../utils/README.md)
### Support
- **CyberPanel Forums**: https://community.cyberpanel.net
- **GitHub Issues**: https://github.com/usmannasir/cyberpanel/issues
- **Discord Server**: https://discord.gg/cyberpanel
## ✅ Verification Checklist
After installation, verify these components:
- [ ] CyberPanel accessible at `http://localhost:8090`
- [ ] Admin password changed from default
- [ ] Windows Firewall configured
- [ ] Python virtual environment working
- [ ] All dependencies installed
- [ ] Database migrations applied
- [ ] Static files collected
- [ ] Logs are clean
- [ ] Service starts automatically (if configured)
## 🆘 Getting Help
If you encounter issues:
1. **Check the logs** for error messages
2. **Run the troubleshooting commands** above
3. **Search the documentation** for solutions
4. **Ask in the community forum** for help
5. **Create a GitHub issue** with detailed information
---
**Note**: This guide is specifically for Windows installations. For Linux installations, refer to the main CyberPanel documentation.
*Last updated: January 2025*