How Can I Further Harden My Laravel Web App and VPS Setup?
Asked by
unusual suspects
I'm currently developing a Laravel web application with a Vue.js front-end. Unfortunately, my freelance development team hasn't prioritized securing our VPS, and I've noticed several vulnerabilities in their setup. I've taken some steps to improve our security, but I'm not sure if it's enough. Here's a summary of what I've done so far:
1. Disabled root access.
2. Enforced public key authentication and disabled password login for SSH.
3. Installed fail2ban to prevent unauthorized access.
4. Configured UFW Firewall to only allow Cloudflare IPs for HTTP and HTTPS traffic.
5. Disabled IPv6 SSH connections.
6. Set up my VPS provider's firewall to only whitelist my bastion server IP for SSH access.
7. Enabled authenticated origin pull mTLS via Cloudflare.
8. Restricted PHP execution in Nginx configuration, allowing it only for the `index.php` file.
Is this setup secure enough, or are there additional measures I should consider taking?
Answers
Your setup looks promising! Just remember that the biggest vulnerabilities can often come from application-level issues, not just SSH or network breaches. Ensure your Laravel environment is correctly configured with strict security headers and verify your application's security posture periodically.
Reply to this answer
Your network and SSH hardening looks promising. But donโt forget about the application layer! Consider using a Web Application Firewall (WAF) and ensure you're following OWASP best practices for the Laravel/PHP stack.
Reply to this answer
Itโs good that youโre locking down SSH, but disabling IPv6 altogether might not be necessary. While you might find it easier to manage IPv4 security, consider the benefits of allowing IPv6 connections, as it can enhance user experience on modern networks.
Reply to this answer
Youโve got a solid start! However, I'd recommend checking against established guidelines like CIS Benchmarks or DISA STIGs. The second level of the CIS Benchmark is a great place to aim for. Also, implementing multi-factor authentication (MFA) could enhance your SSH security even further, even if you're already using public key authentication.
Reply to this answer
The baseline youโve established is decent, but itโs vital to monitor your logs consistently and automate updates for your software stack. Compromises often happen above the network layer, so be sure to patch regularly and handle sensitive information safely.
Reply to this answer
Add your answer
Answers are reviewed before publication.
Related Discussions