Appearance
Security Best Practices
This guide covers security best practices for protecting your OmniSuite CMS installation, including server security, application security, user security, and data protection.
Table of Contents
- Overview
- Server Security
- Application Security
- User Security
- Data Protection
- SSL/HTTPS Setup
- Security Updates
Overview
Why Security Matters
- ✅ Protect user data
- ✅ Prevent unauthorized access
- ✅ Maintain trust
- ✅ Comply with regulations
- ✅ Prevent attacks
Security Layers
Multiple Layers:
- Server security
- Application security
- User security
- Data protection
- Network security
Server Security
Server Hardening
Update System
Regular Updates:
bash
# Ubuntu/Debian
sudo apt update && sudo apt upgrade -y
# CentOS/RHEL
sudo yum update -yFirewall Configuration
UFW (Ubuntu/Debian):
bash
sudo ufw allow OpenSSH
sudo ufw allow 'Nginx Full'
sudo ufw enableFirewalld (CentOS/RHEL):
bash
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --reloadSSH Security
Disable Root Login:
bash
# /etc/ssh/sshd_config
PermitRootLogin no
PasswordAuthentication no # Use SSH keysUse SSH Keys:
- Generate SSH key pair
- Add public key to server
- Disable password authentication
File Permissions
Correct Permissions
Directories:
bash
find . -type d -exec chmod 755 {} \;Files:
bash
find . -type f -exec chmod 644 {} \;Writable Directories:
bash
chmod -R 775 storage bootstrap/cacheSensitive Files:
bash
chmod 600 .envApplication Security
Environment Configuration
.env File Security
Protect .env:
- Never commit to version control
- Restrict file permissions (600)
- Use strong passwords
- Rotate keys regularly
Application Key
Generate Key:
bash
php artisan key:generateKeep Secret:
- Never expose in code
- Don't share publicly
- Rotate if compromised
Password Security
Strong Passwords
Requirements:
- Minimum 8 characters
- Mix of uppercase, lowercase, numbers, symbols
- No common words
- Unique per account
Password Hashing
Laravel Default:
- Uses bcrypt
- Automatically hashed
- Salt included
SQL Injection Prevention
Laravel Protection:
- Uses prepared statements
- Query builder protection
- Eloquent ORM protection
Best Practices:
- Always use query builder
- Never concatenate SQL
- Validate input
- Use parameter binding
XSS Protection
Laravel Protection:
- Automatic escaping
- Blade template protection
- CSRF protection
Best Practices:
- Escape output
- Use Blade syntax
- Validate input
- Sanitize user content
CSRF Protection
Laravel CSRF:
- Automatic token generation
- Form token validation
- API token protection
Best Practices:
- Always include tokens
- Verify on POST requests
- Use middleware
User Security
Authentication
Strong Authentication
Requirements:
- Strong passwords
- Email verification
- Two-factor authentication (if available)
- Account lockout
Session Security
Configuration:
- Secure session cookies
- HTTP-only cookies
- Same-site cookies
- Session timeout
Authorization
Role-Based Access
Best Practices:
- Principle of least privilege
- Regular permission review
- Remove unused permissions
- Monitor access
User Permissions
Management:
- Assign appropriate roles
- Review regularly
- Remove when no longer needed
- Audit access
Account Security
Account Lockout
Configuration:
- Max login attempts
- Lockout duration
- Automatic unlock
- Notification
Password Policies
Enforce:
- Minimum length
- Complexity requirements
- Password expiration
- Password history
Data Protection
Data Encryption
At Rest
Database:
- Encrypt sensitive fields
- Use database encryption
- Secure backups
Files:
- Encrypt sensitive files
- Secure storage
- Access control
In Transit
HTTPS:
- Always use HTTPS
- SSL/TLS encryption
- Secure connections
Data Backup Security
Backup Security:
- Encrypt backups
- Secure storage
- Access control
- Regular testing
Privacy Protection
User Data
Protection:
- Collect only necessary data
- Secure storage
- Access control
- Data retention policies
GDPR Compliance
Requirements:
- User consent
- Data access rights
- Data deletion
- Privacy policy
SSL/HTTPS Setup
Why SSL is Important
- ✅ Encrypts data transmission
- ✅ Builds user trust
- ✅ Required for payments
- ✅ Improves SEO
- ✅ Prevents man-in-the-middle attacks
Obtaining SSL Certificate
Let's Encrypt (Free)
Install Certbot:
bash
# Ubuntu/Debian
sudo apt install certbot python3-certbot-nginx
# CentOS/RHEL
sudo yum install certbot python3-certbot-nginxObtain Certificate:
bash
# Nginx
sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com
# Apache
sudo certbot --apache -d yourdomain.com -d www.yourdomain.comAuto-Renewal:
bash
sudo certbot renew --dry-runForce HTTPS
Application Configuration
.env:
env
APP_URL=https://yourdomain.comMiddleware:
- Force HTTPS middleware
- Redirect HTTP to HTTPS
- Secure cookies
Security Updates
Regular Updates
Application Updates
Laravel:
bash
composer update
php artisan migrateDependencies:
- Update regularly
- Check for vulnerabilities
- Test before production
System Updates
Server:
- Update OS regularly
- Update PHP
- Update web server
- Update database
Security Monitoring
Log Monitoring
Monitor:
- Access logs
- Error logs
- Security logs
- Application logs
Vulnerability Scanning
Tools:
- Security scanners
- Dependency checkers
- Penetration testing
- Regular audits
Incident Response
Response Plan
Identify:
- Detect security issue
- Assess impact
- Contain threat
Respond:
- Fix vulnerability
- Restore services
- Notify users if needed
Recover:
- Verify fix
- Monitor for issues
- Document incident
Best Practices
General Security
Keep Updated:
- Regular updates
- Security patches
- Dependency updates
Use Strong Credentials:
- Complex passwords
- Unique per account
- Rotate regularly
Limit Access:
- Principle of least privilege
- Remove unused access
- Regular review
Monitor Activity:
- Log monitoring
- Anomaly detection
- Regular audits
Backup Regularly:
- Automated backups
- Test restores
- Secure storage
Troubleshooting
Security Issues
Solutions:
- Review security logs
- Check permissions
- Verify configurations
- Update software
- Consult security experts
Related Documentation
Last Updated: [Date will be updated during final review]