|
|
@@ -10,6 +10,8 @@ A simple, clean web publication system built with PHP and MariaDB. This system a
|
|
|
- **Search**: Full-text search across publications
|
|
|
- **Responsive Design**: Mobile-friendly interface for both admin and public sites
|
|
|
- **User Authentication**: Secure login system with password hashing
|
|
|
+- **LDAP Integration**: Optional LDAP directory authentication for enterprise environments
|
|
|
+- **User Management**: Import and manage LDAP users in the system
|
|
|
- **SEO Friendly**: Clean URLs and meta information
|
|
|
|
|
|
## Requirements
|
|
|
@@ -18,6 +20,7 @@ A simple, clean web publication system built with PHP and MariaDB. This system a
|
|
|
- MariaDB 10.3+ or MySQL 5.7+
|
|
|
- Web server (Apache, Nginx, or PHP built-in server)
|
|
|
- PHP extensions: PDO, PDO_MySQL, mbstring
|
|
|
+- **For LDAP support**: PHP LDAP extension (optional)
|
|
|
|
|
|
## Installation
|
|
|
|
|
|
@@ -43,12 +46,91 @@ Place the files in your web root or a subdirectory. For example:
|
|
|
### 3. Run Setup Script
|
|
|
|
|
|
1. Ensure the `setup/` directory is accessible via web browser
|
|
|
-2. Navigate to: `http://your-domain.com/web-pub-system/setup/`
|
|
|
+2. Navigate to: `http://your-domain.com/setup/`
|
|
|
3. Follow the installation wizard:
|
|
|
- Enter database connection details
|
|
|
- Set site title and admin credentials
|
|
|
+ - **Optional**: Configure LDAP authentication (see LDAP section below)
|
|
|
- Complete the installation
|
|
|
|
|
|
+## LDAP Authentication
|
|
|
+
|
|
|
+The system supports optional LDAP directory authentication for enterprise environments.
|
|
|
+
|
|
|
+### LDAP Setup During Installation
|
|
|
+
|
|
|
+When running the setup script, you can enable LDAP authentication by checking the "Enable LDAP Authentication" option. You'll need to provide:
|
|
|
+
|
|
|
+- **LDAP Server Host**: Your LDAP server hostname or IP address
|
|
|
+- **LDAP Port**: Usually 389 (standard) or 636 (LDAPS)
|
|
|
+- **LDAP Base DN**: The base distinguished name for your directory (e.g., `dc=example,dc=com`)
|
|
|
+- **User Search Filter**: Filter to find users (default: `(uid={username})`)
|
|
|
+- **Bind DN/Password**: Optional service account for LDAP queries
|
|
|
+- **Attribute Mapping**: Email and name attributes from your directory
|
|
|
+
|
|
|
+### LDAP Configuration Examples
|
|
|
+
|
|
|
+#### Active Directory
|
|
|
+```
|
|
|
+LDAP Server Host: ad.example.com
|
|
|
+LDAP Port: 389
|
|
|
+LDAP Base DN: dc=example,dc=com
|
|
|
+User Search Filter: (sAMAccountName={username})
|
|
|
+Email Attribute: mail
|
|
|
+Name Attribute: cn
|
|
|
+```
|
|
|
+
|
|
|
+#### OpenLDAP
|
|
|
+```
|
|
|
+LDAP Server Host: ldap.example.com
|
|
|
+LDAP Port: 389
|
|
|
+LDAP Base DN: ou=users,dc=example,dc=com
|
|
|
+User Search Filter: (uid={username})
|
|
|
+Email Attribute: mail
|
|
|
+Name Attribute: cn
|
|
|
+```
|
|
|
+
|
|
|
+### LDAP User Management
|
|
|
+
|
|
|
+After enabling LDAP authentication:
|
|
|
+
|
|
|
+1. **Access LDAP Users**: Navigate to Admin Panel > LDAP Users
|
|
|
+2. **Search Users**: Use the search interface to find directory users
|
|
|
+3. **Import Users**: Select users and import them into the system
|
|
|
+4. **Authentication**: Users can now login with their directory credentials
|
|
|
+
|
|
|
+### LDAP Authentication Flow
|
|
|
+
|
|
|
+1. User enters directory username and password
|
|
|
+2. System searches LDAP directory for the user
|
|
|
+3. System attempts to bind with user credentials
|
|
|
+4. If successful, user is authenticated and session is created
|
|
|
+5. User information is synchronized with local database
|
|
|
+
|
|
|
+### LDAP Troubleshooting
|
|
|
+
|
|
|
+#### Common Issues
|
|
|
+
|
|
|
+1. **Connection Failed**: Check LDAP server hostname, port, and network connectivity
|
|
|
+2. **Bind Failed**: Verify bind DN and password if using service account
|
|
|
+3. **User Not Found**: Check base DN and user search filter
|
|
|
+4. **Authentication Failed**: Ensure user exists in directory and password is correct
|
|
|
+
|
|
|
+#### Debug Steps
|
|
|
+
|
|
|
+1. Enable PHP error logging
|
|
|
+2. Test LDAP connection with external tools (ldapsearch, Apache Directory Studio)
|
|
|
+3. Check system logs for LDAP connection errors
|
|
|
+4. Verify LDAP server accessibility from web server
|
|
|
+
|
|
|
+### Security Considerations
|
|
|
+
|
|
|
+- Use LDAPS (port 636) for secure connections in production
|
|
|
+- Store bind passwords securely in configuration
|
|
|
+- Limit LDAP service account permissions
|
|
|
+- Monitor LDAP authentication logs
|
|
|
+- Regularly review imported user accounts
|
|
|
+
|
|
|
### 4. Secure Installation
|
|
|
|
|
|
After successful installation:
|
|
|
@@ -67,14 +149,15 @@ After successful installation:
|
|
|
## Directory Structure
|
|
|
|
|
|
```
|
|
|
-web-pub-system/
|
|
|
+website/
|
|
|
|-- admin/ # Admin interface files
|
|
|
| |-- index.php # Dashboard
|
|
|
-| |-- login.php # Login page
|
|
|
+| |-- login.php # Login page (supports LDAP)
|
|
|
| |-- edit.php # Create/edit publications
|
|
|
| |-- logout.php # Logout handler
|
|
|
| |-- publications.php # Publication management
|
|
|
| |-- categories.php # Category management
|
|
|
+| |-- ldap-users.php # LDAP user management
|
|
|
|-- public/ # Public-facing pages
|
|
|
| |-- index.php # Homepage with publication list
|
|
|
| |-- publication.php # Individual publication view
|
|
|
@@ -83,13 +166,14 @@ web-pub-system/
|
|
|
|-- includes/ # Core PHP classes
|
|
|
| |-- config.php # Configuration (created during setup)
|
|
|
| |-- database.php # Database connection class
|
|
|
-| |-- auth.php # Authentication class
|
|
|
+| |-- auth.php # Authentication class (supports LDAP)
|
|
|
+| |-- ldap.php # LDAP authentication class
|
|
|
| |-- publication.php # Publication model class
|
|
|
|-- css/ # Stylesheets
|
|
|
-| |-- style.css # Main stylesheet
|
|
|
+| |-- style.css # Main stylesheet (includes LDAP styles)
|
|
|
|-- setup/ # Installation files (delete after use)
|
|
|
-| |-- setup.php # Setup wizard
|
|
|
-| |-- database.sql # Database schema
|
|
|
+| |-- setup.php # Setup wizard (includes LDAP config)
|
|
|
+| |-- database.sql # Database schema (supports LDAP)
|
|
|
|-- README.md # This file
|
|
|
```
|
|
|
|
|
|
@@ -97,13 +181,24 @@ web-pub-system/
|
|
|
|
|
|
### Admin Panel
|
|
|
|
|
|
-1. Access the admin panel at: `http://your-domain.com/web-pub-system/admin/`
|
|
|
-2. Login with the credentials you created during setup
|
|
|
+1. Access the admin panel at: `http://your-domain.com/admin/`
|
|
|
+2. Login with your credentials (local or LDAP)
|
|
|
3. From the dashboard you can:
|
|
|
- Create new publications
|
|
|
- Edit existing publications
|
|
|
- Manage categories
|
|
|
- View statistics
|
|
|
+ - **If LDAP enabled**: Manage LDAP users (import, search, sync)
|
|
|
+
|
|
|
+### LDAP User Management
|
|
|
+
|
|
|
+If LDAP authentication is enabled:
|
|
|
+
|
|
|
+1. **Import Users**: Navigate to Admin Panel > LDAP Users
|
|
|
+2. **Search Directory**: Find users by username, name, or email
|
|
|
+3. **Bulk Import**: Select multiple users and import them
|
|
|
+4. **User Roles**: Imported users get default "editor" role
|
|
|
+5. **Login**: Users authenticate with directory credentials
|
|
|
|
|
|
### Creating Publications
|
|
|
|
|
|
@@ -119,7 +214,7 @@ web-pub-system/
|
|
|
|
|
|
### Public Site
|
|
|
|
|
|
-The public site is available at: `http://your-domain.com/web-pub-system/public/`
|
|
|
+The public site is available at: `http://your-domain.com/public/`
|
|
|
|
|
|
Features:
|
|
|
- Browse all published publications
|
|
|
@@ -141,8 +236,19 @@ define('DB_PASS', 'your_db_password');
|
|
|
|
|
|
// Site configuration
|
|
|
define('SITE_TITLE', 'Web Publication System');
|
|
|
-define('SITE_URL', 'http://your-domain.com/web-pub-system/');
|
|
|
+define('SITE_URL', 'http://your-domain.com/');
|
|
|
define('ADMIN_EMAIL', 'admin@example.com');
|
|
|
+
|
|
|
+// LDAP configuration (if enabled)
|
|
|
+define('LDAP_ENABLED', true);
|
|
|
+define('LDAP_HOST', 'ldap.example.com');
|
|
|
+define('LDAP_PORT', '389');
|
|
|
+define('LDAP_BASE_DN', 'dc=example,dc=com');
|
|
|
+define('LDAP_USER_FILTER', '(uid={username})');
|
|
|
+define('LDAP_BIND_DN', 'cn=admin,dc=example,dc=com');
|
|
|
+define('LDAP_BIND_PASSWORD', 'bind_password');
|
|
|
+define('LDAP_EMAIL_ATTRIBUTE', 'mail');
|
|
|
+define('LDAP_NAME_ATTRIBUTE', 'cn');
|
|
|
```
|
|
|
|
|
|
## Security Considerations
|
|
|
@@ -152,6 +258,11 @@ define('ADMIN_EMAIL', 'admin@example.com');
|
|
|
3. **File permissions**: Ensure proper file permissions on sensitive files
|
|
|
4. **HTTPS**: Use HTTPS in production for secure login
|
|
|
5. **Regular updates**: Keep PHP and MariaDB updated
|
|
|
+6. **LDAP Security**:
|
|
|
+ - Use LDAPS for secure LDAP connections
|
|
|
+ - Limit LDAP service account permissions
|
|
|
+ - Securely store LDAP bind credentials
|
|
|
+ - Monitor LDAP authentication logs
|
|
|
|
|
|
## Customization
|
|
|
|