3 points · by mnkypete · 13y ago · 6 comments
It runs:
- Apache with phpMyAdmin - MySQL - Glassfish
To secure this stuff, I installed a squid proxy which routes requests from the outside to localhost. In addition, all the services (MySQL, phpMyAdmin, Glassfish admin console) are only bound to localhost, so that you cannot access them from the outside (only throug the password secured squid). The only thing exposed is the application running on the Glassfish.
As we plan to move from dedicated server to Amazon hosting (for scaling etc), I was wondering if that stuff was a good idea in the first place. What are your experiences on this, was I wasting time?
Thanks!
Basically I would advise to follow some simple guidelines (back to basics):
-> Don't run stuff with more permissions than needed (ergo, create a user for the services, lock them down, etc)
-> Make sure you can check the logs to monitor for weird stuff (really, this is important, if you can react quickly you can mitigate many issues before they become serious)
-> Don't run unnecessary services (do a cleanup on the host)
-> As best as possible use repository stuff; much easier to be up-to-date (security patches and so on)
-> Prepare an "emergency lockdown" script. Imagine something you can run that will lock nearly everything and put a nice page for the users, stating "We are performing some super-duper maintenance, blah, blah", don't scare the hell out of them, but allow yourself to carefully check what is happening without worrying with extra leakage. This can allow you to change passwords, block some suspicious IPs, etc (bonus points if you prepare a script to block IPs)
-> Encrypt passwords and salt them. Really. This is a must, respect your customers.
-> Extra bonus for a system that emails you as soon as there is a login in the system.
Just common sense I would say.Oh, and DO change passwords every 90 days, at least.
PS: There is a script for MySQL that does some security check-ups. Google for mysql_secure_installation
Best regards and best of lucks.
Everything else miaumiua lists is great. I'd throw in a few random things I think of off the top of my head... mod_security, csf, mount tmp as noexec, LYNIS, phpsuexec, linux maldet.
Oh, and don't forget chroot (or something more modern, like jails or even SElinux).
Having said all of the above, for the typical startup, the main threat is not an attack on the server but some shoddy application code committed under yet another tight deadline.