I've built a system and have put a ton of work into making sure is super secure. But I have a (potentially irrational) fear that if someone were able to break into my server, they could just change the PHP code I've written and it'd be game over. No feature I could build could withstand someone with access to the server.
I do all the right things as far as picking good passwords for my server access, not saving them anywhere, etc... But I got to believe from the constant stream of news reports about mega-companies getting hacked that no matter what I do, there's still going to be some vulnerability somewhere that an experienced hacker can use to get into my system.
So what do you think of this plan?
- Create a file titled something nondescript (we'll say secretFile.php for this example) and bury the file somewhere on the server.
- Make that file simply return an md5 hash of the directory where all my code is.
- Sign up for a second, completely separate host, and set up a cron job (cron.php) to call www.mySite.com/secretFile.php every X minutes
- cron.php records the results of secretFile.php
- If there's a change from the last time it checked in, send me a notification, trigger a kill switch, call 911, whatever...
I realize this plan could be foiled if someone were to also break into my secondary server, or if they knew about secretFile.php on my primary server. But in the name of "every bit of security helps", do you feel like this bit of security would actually help?
(Also, I know there are certain extensions that can be installed on my primary server that listen for file changes. But if someone has access to my primary server, I figure they could also just disable that extension too.)