Add comprehensive Plesk control panel support
Core Infrastructure Added: - lib/plesk-helpers.sh: 30+ Plesk-specific helper functions - Domain discovery (list, docroot, logdir, access/error logs) - User/subscription management - Database discovery - PHP version detection (/opt/plesk/php/) - PHP-FPM pool discovery - Configuration file locations - Mail functions - Service management - Version detection with log structure handling - lib/domain-discovery.sh: Unified control panel abstraction - Consistent API across cPanel, Plesk, InterWorx, standalone - list_all_domains() - works on any panel - get_domain_docroot() - panel-agnostic document root - get_domain_logdir() - panel-agnostic log discovery - get_domain_access_log() - access log paths - get_domain_error_log() - error log paths - get_all_log_files() - all logs across all domains - get_domain_owner() - domain owner/user - list_all_users() - user enumeration - get_domain_fpm_socket() - PHP-FPM pool sockets - get_domain_databases() - database discovery - domain_exists() - existence checks Documentation: - PLESK_REFERENCE.md: Complete Plesk architecture reference - Directory structure mapping - Log file locations (current & future versions) - PHP-FPM pool locations - Configuration file paths - Plesk CLI command reference - Key differences from cPanel - Subdomain handling differences - PLESK_SUPPORT_SUMMARY.md: Implementation summary - All functions documented - Usage examples - Migration guide for existing modules - Version compatibility notes - Testing checklist System Detection Enhanced: - lib/system-detect.sh: - Improved Plesk detection with version-aware log paths - Auto-sources plesk-helpers.sh when Plesk detected - Added /opt/plesk/php/ scanning for PHP versions - Sets SYS_USER_HOME_BASE=/var/www/vhosts for Plesk Email Menu Added: - launcher.sh: New Email Troubleshooting menu category - 9 email diagnostic/maintenance tools (placeholders) - Deliverability test, queue inspector, SMTP test - SPF/DKIM/DMARC check, blacklist check - Mail log analyzer, queue flush - Mailbox cleanup, size reports Plesk Architecture Support: - /var/www/vhosts/ base directory structure - system/DOMAIN/logs/ for Plesk <18.0.50 - DOMAIN/logs/ for Plesk 18.0.50+ - Automatic version detection - Subdomain separate directory handling - /opt/plesk/php/X.Y/ PHP version detection - /var/www/vhosts/system/DOMAIN/php-fpm.sock pools - /var/www/vhosts/system/DOMAIN/conf/ configs Fallback Mechanisms: - All functions work with or without Plesk CLI - Directory scanning fallbacks - MySQL direct query fallbacks - Path inference from standard locations Status: Core infrastructure complete, ready for module integration Next: Test on actual Plesk server, update existing modules Ref: system_map.tsv analysis from Plesk production system
This commit is contained in:
@@ -0,0 +1,313 @@
|
||||
# Plesk Control Panel Reference
|
||||
|
||||
This document maps Plesk paths and structures for toolkit compatibility.
|
||||
|
||||
## Plesk Detection
|
||||
|
||||
```bash
|
||||
# Version file
|
||||
/usr/local/psa/version
|
||||
|
||||
# Admin bin directory
|
||||
/usr/local/psa/bin/
|
||||
|
||||
# CLI tool
|
||||
/usr/local/psa/bin/plesk
|
||||
```
|
||||
|
||||
## Directory Structure
|
||||
|
||||
### User/Domain Home Base
|
||||
```
|
||||
/var/www/vhosts/
|
||||
```
|
||||
|
||||
**Structure:**
|
||||
```
|
||||
/var/www/vhosts/
|
||||
├── domain.com/ # Main domain directory
|
||||
│ ├── httpdocs/ # Public web root
|
||||
│ ├── httpsdocs/ # SSL web root (if separate)
|
||||
│ ├── cgi-bin/
|
||||
│ ├── private/
|
||||
│ ├── logs/ # (FUTURE: will move here in Plesk Obsidian 18.0.50+)
|
||||
│ ├── statistics/
|
||||
│ └── tmp/
|
||||
├── subdomain.domain.com/ # Subdomain (separate directory)
|
||||
│ ├── httpdocs/
|
||||
│ └── ...
|
||||
└── system/ # System directory (logs, configs)
|
||||
├── domain.com/
|
||||
│ ├── logs/ # Current location of access/error logs
|
||||
│ ├── conf/ # Apache/Nginx configs
|
||||
│ ├── etc/ # PHP.ini and other configs
|
||||
│ └── php-fpm.sock # PHP-FPM socket
|
||||
└── subdomain.domain.com/
|
||||
└── ...
|
||||
```
|
||||
|
||||
### Log Files
|
||||
|
||||
**Current Structure (Plesk 17.x - 18.0.49):**
|
||||
```
|
||||
/var/www/vhosts/system/DOMAIN/logs/
|
||||
├── access_log # HTTP access log
|
||||
├── access_ssl_log # HTTPS access log
|
||||
├── error_log # Error log (both HTTP/HTTPS)
|
||||
├── proxy_access_log # Nginx proxy access (if applicable)
|
||||
├── proxy_access_ssl_log # Nginx proxy HTTPS access
|
||||
└── proxy_error_log # Nginx proxy errors
|
||||
```
|
||||
|
||||
**Future Structure (Plesk Obsidian 18.0.50+):**
|
||||
```
|
||||
/var/www/vhosts/DOMAIN/logs/
|
||||
├── access_log
|
||||
├── access_ssl_log
|
||||
├── error_log
|
||||
└── ...
|
||||
```
|
||||
|
||||
### Configuration Files
|
||||
|
||||
**Per-Domain Configs:**
|
||||
```
|
||||
/var/www/vhosts/system/DOMAIN/conf/
|
||||
├── httpd.conf # Apache vhost config
|
||||
├── nginx.conf # Nginx config
|
||||
├── vhost.conf # Custom Apache directives
|
||||
├── vhost_ssl.conf # Custom SSL directives
|
||||
└── php.ini # In ../etc/php.ini
|
||||
```
|
||||
|
||||
**PHP Configuration:**
|
||||
```
|
||||
/var/www/vhosts/system/DOMAIN/etc/
|
||||
└── php.ini # Domain-specific PHP settings
|
||||
```
|
||||
|
||||
### PHP-FPM
|
||||
|
||||
**Pool Sockets:**
|
||||
```
|
||||
/var/www/vhosts/system/DOMAIN/php-fpm.sock
|
||||
```
|
||||
|
||||
**System PHP-FPM:**
|
||||
```
|
||||
/opt/plesk/php/X.Y/ # Plesk-managed PHP versions
|
||||
/usr/bin/php # System default PHP
|
||||
```
|
||||
|
||||
## Plesk CLI Commands
|
||||
|
||||
### Domain Management
|
||||
```bash
|
||||
# List all domains
|
||||
plesk bin domain --list
|
||||
|
||||
# Get domain info
|
||||
plesk bin domain --info DOMAIN
|
||||
|
||||
# Get domain document root
|
||||
plesk bin domain --info DOMAIN | grep "www root" | awk '{print $NF}'
|
||||
```
|
||||
|
||||
### User/Subscription Management
|
||||
```bash
|
||||
# List all subscriptions
|
||||
plesk bin subscription --list
|
||||
|
||||
# Get subscription info
|
||||
plesk bin subscription --info DOMAIN
|
||||
|
||||
# List users
|
||||
plesk bin user --list
|
||||
```
|
||||
|
||||
### Database Management
|
||||
```bash
|
||||
# List databases
|
||||
plesk bin database --list
|
||||
|
||||
# List databases for domain
|
||||
plesk bin database --list -domain DOMAIN
|
||||
```
|
||||
|
||||
### Log Files
|
||||
```bash
|
||||
# Get log file path for domain
|
||||
# Current: /var/www/vhosts/system/DOMAIN/logs/
|
||||
# Future: /var/www/vhosts/DOMAIN/logs/
|
||||
```
|
||||
|
||||
### PHP Version Detection
|
||||
```bash
|
||||
# List PHP handlers
|
||||
plesk bin php_handler --list
|
||||
|
||||
# Get domain PHP version
|
||||
plesk bin site --info DOMAIN | grep "PHP version"
|
||||
```
|
||||
|
||||
### Service Management
|
||||
```bash
|
||||
# Apache
|
||||
plesk bin service_node --start httpd
|
||||
plesk bin service_node --stop httpd
|
||||
plesk bin service_node --restart httpd
|
||||
|
||||
# Nginx
|
||||
plesk bin service_node --start nginx
|
||||
plesk bin service_node --stop nginx
|
||||
|
||||
# PHP-FPM
|
||||
plesk bin service_node --restart plesk-php*-fpm
|
||||
```
|
||||
|
||||
## User/Domain Discovery
|
||||
|
||||
### Finding All Domains
|
||||
```bash
|
||||
# Method 1: Using Plesk CLI
|
||||
plesk bin domain --list
|
||||
|
||||
# Method 2: Directory scan
|
||||
ls -1d /var/www/vhosts/*/ | grep -v "system\|chroot\|.skel\|default" | xargs -I{} basename {}
|
||||
|
||||
# Method 3: From system directory
|
||||
ls -1 /var/www/vhosts/system/ | grep -v "^[0-9]"
|
||||
```
|
||||
|
||||
### Finding Domain Owner
|
||||
```bash
|
||||
# Get subscription owner
|
||||
plesk bin subscription --info DOMAIN | grep "Owner's login"
|
||||
```
|
||||
|
||||
### Finding Document Roots
|
||||
```bash
|
||||
# Main domain
|
||||
/var/www/vhosts/DOMAIN/httpdocs
|
||||
|
||||
# Subdomains
|
||||
/var/www/vhosts/SUBDOMAIN.DOMAIN/httpdocs
|
||||
|
||||
# Via CLI
|
||||
plesk bin domain --info DOMAIN | grep "www root"
|
||||
```
|
||||
|
||||
## PHP Detection
|
||||
|
||||
### Plesk-Managed PHP Versions
|
||||
```bash
|
||||
# Location
|
||||
/opt/plesk/php/*/bin/php
|
||||
|
||||
# List all versions
|
||||
ls -1d /opt/plesk/php/*/bin/php 2>/dev/null
|
||||
|
||||
# Get versions
|
||||
for php in /opt/plesk/php/*/bin/php; do
|
||||
$php -v | head -1
|
||||
done
|
||||
```
|
||||
|
||||
### System PHP
|
||||
```bash
|
||||
/usr/bin/php
|
||||
php -v
|
||||
```
|
||||
|
||||
## Database Discovery
|
||||
|
||||
### MySQL/MariaDB
|
||||
```bash
|
||||
# Plesk stores DB mappings in:
|
||||
/var/lib/psa/dumps/
|
||||
|
||||
# Get databases via CLI
|
||||
plesk bin database --list
|
||||
|
||||
# Database naming convention
|
||||
DOMAIN_DBNAME (underscores replace dots)
|
||||
```
|
||||
|
||||
## Subdomain Handling
|
||||
|
||||
**Important:** Plesk creates separate directories for subdomains
|
||||
|
||||
```bash
|
||||
# Main domain
|
||||
/var/www/vhosts/domain.com/httpdocs
|
||||
|
||||
# Subdomain gets its own directory
|
||||
/var/www/vhosts/sub.domain.com/httpdocs
|
||||
|
||||
# Logs
|
||||
/var/www/vhosts/system/sub.domain.com/logs/
|
||||
```
|
||||
|
||||
## Email
|
||||
|
||||
### Mailboxes
|
||||
```bash
|
||||
# Location
|
||||
/var/qmail/mailnames/DOMAIN/USERNAME/Maildir/
|
||||
```
|
||||
|
||||
### Mail Logs
|
||||
```bash
|
||||
/var/log/maillog
|
||||
```
|
||||
|
||||
## Important Differences from cPanel
|
||||
|
||||
1. **No /home directory structure** - Uses /var/www/vhosts
|
||||
2. **Subdomains are separate** - Not under main domain's directory
|
||||
3. **Logs in system/** - Not in domain directory (until Plesk 18.0.50+)
|
||||
4. **PHP-FPM per domain** - Socket in system/DOMAIN/
|
||||
5. **No ea-php** - Uses /opt/plesk/php/X.Y/
|
||||
6. **CLI is different** - Uses `plesk bin` not WHM API
|
||||
7. **User != Domain** - Subscription owners, not cPanel users
|
||||
|
||||
## Toolkit Compatibility Requirements
|
||||
|
||||
### Path Variables
|
||||
```bash
|
||||
SYS_USER_HOME_BASE="/var/www/vhosts"
|
||||
SYS_LOG_DIR="/var/www/vhosts/system"
|
||||
```
|
||||
|
||||
### Domain Enumeration
|
||||
Must use:
|
||||
1. `plesk bin domain --list`
|
||||
2. Directory scan excluding: system, chroot, .skel, default, fs
|
||||
|
||||
### Log File Discovery
|
||||
```bash
|
||||
# Current Plesk
|
||||
find /var/www/vhosts/system/*/logs/ -name "access*log" -o -name "error_log"
|
||||
|
||||
# Future Plesk (18.0.50+)
|
||||
find /var/www/vhosts/*/logs/ -name "access*log" -o -name "error_log"
|
||||
```
|
||||
|
||||
### PHP-FPM Pool Discovery
|
||||
```bash
|
||||
# Find all PHP-FPM pools
|
||||
find /var/www/vhosts/system/*/php-fpm.sock -type s 2>/dev/null
|
||||
|
||||
# Or check config
|
||||
grep -r "listen = " /var/www/vhosts/system/*/etc/ 2>/dev/null
|
||||
```
|
||||
|
||||
## Version-Specific Notes
|
||||
|
||||
### Plesk Obsidian (18.0.x)
|
||||
- Version 18.0.50+ moves logs from system/DOMAIN/logs/ to DOMAIN/logs/
|
||||
- Toolkit should check both locations for compatibility
|
||||
|
||||
### Plesk Onyx (17.x)
|
||||
- Logs in system/DOMAIN/logs/
|
||||
- Stable structure
|
||||
Reference in New Issue
Block a user