4umfreak
01-25-2010, 03:55 PM
I'm running a WHM account and use the common php script to trigger backups to a remote ftp server.
What I'm looking for here is some sense of how good / bad / scary it might be to further automate this solution. I can manage the programming side of it but want some thought from the community on how (in)secure it might be.
Here's the kicker. With a pure php solution triggered daily by cron, I need to edit / maintain a file and a cron job for each account. This is too much work, especially as I get more clients and things get moving.
Anyway to my point. Here's the system I'm building.
A) Cron script runs every 10 minutes to call a doMyBackup.php passing it a url parameter (E.g. ?myKey=0123456789)
B) Inside doMyBackup.php, the value of myKey is then passed to a script on a second domain requesting a page over https to get the password for a mySql database.
C) With the MySql password, the doMyBackup.php script connects to it's AccountInfo database to get the details for one account at a time. It will execute the CPanel backup for that account and flag that account as done for the day. Once all the accounts are done for that day, the script exits quietly.
D) On the remote FTP server another cron will move files out of the FTP root as soon as the upload is complete.
In order to compromise my sites a user would need three things:
1) The cron command to get the value of myKey required to fetch the database password.
2) The name, location and url structure of the magic script that provides the mysql password.
3) The location, name, username and password of the mysql database.
All the files used in this system have been chmodded to 600 and they're all placed in folders with long garbage names that contain an empty index.html file. All of the scripts will send me an email if someone calls them without the expected url parameters.
My biggest concern of course is the mysql database that has account usernames and passwords in one spot.
Is there any way - short of not doing automatic backups that I can make this system more secure?
I'd like to keep all the account info in one place so that adding new accounts is easy and doesn't require testing and maintenance of individual files.
Am I looking for something that's not possible?
-4umfreak
What I'm looking for here is some sense of how good / bad / scary it might be to further automate this solution. I can manage the programming side of it but want some thought from the community on how (in)secure it might be.
Here's the kicker. With a pure php solution triggered daily by cron, I need to edit / maintain a file and a cron job for each account. This is too much work, especially as I get more clients and things get moving.
Anyway to my point. Here's the system I'm building.
A) Cron script runs every 10 minutes to call a doMyBackup.php passing it a url parameter (E.g. ?myKey=0123456789)
B) Inside doMyBackup.php, the value of myKey is then passed to a script on a second domain requesting a page over https to get the password for a mySql database.
C) With the MySql password, the doMyBackup.php script connects to it's AccountInfo database to get the details for one account at a time. It will execute the CPanel backup for that account and flag that account as done for the day. Once all the accounts are done for that day, the script exits quietly.
D) On the remote FTP server another cron will move files out of the FTP root as soon as the upload is complete.
In order to compromise my sites a user would need three things:
1) The cron command to get the value of myKey required to fetch the database password.
2) The name, location and url structure of the magic script that provides the mysql password.
3) The location, name, username and password of the mysql database.
All the files used in this system have been chmodded to 600 and they're all placed in folders with long garbage names that contain an empty index.html file. All of the scripts will send me an email if someone calls them without the expected url parameters.
My biggest concern of course is the mysql database that has account usernames and passwords in one spot.
Is there any way - short of not doing automatic backups that I can make this system more secure?
I'd like to keep all the account info in one place so that adding new accounts is easy and doesn't require testing and maintenance of individual files.
Am I looking for something that's not possible?
-4umfreak
