MacTalk Forums

Go Back   MacTalk Forums > Using Your Computer > Projects: Audio, Graphics, Video, HTPC and Programming

Notices

Projects: Audio, Graphics, Video, HTPC and Programming Discuss your software and hardware projects, web sites, programming, music, design and home theatre and other set-ups here.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 7th April 2009, 03:35 PM
forgie's Avatar
NSLog(@"%@", [self customTitle]);
 
Join Date: May 2005
Location: Melbourne
Posts: 3,939
View forgie's Twitter Page View forgie's Last.fm Playlist
Default Security implications for a Backup Script that contains a password

I'm doing a bit of a "backup audit"... in other words, setting up automated backups for every piece of technology that I depend on in any significant way that is automatically backupable. One of these devices is my home modem/router.

I have worked out how to backup the router configuration using a combination of curl commands and basic HTTP authentication. I have written a nice Ruby backup script that downloads the backup, runs it through bzip2, then puts it in a dated folder. I want this script to run every 24 hours. A launchd Daemon set to fire every 24 hours seems like the appropriate way to do it.

There are two security concerns here - one is that the script itself stores the username/password in cleartext. The other is that the downloaded config files have my router username/password in cleartext.

For the script, what's the best security policy? Should I make a new user named "backups", and make the script file only accessible to the "backups" user, then run the launchd Daemon as the "backups" user? Is there a better way?

For the actual backup files themselves, does anyone have any good suggestions? I guess I could make all the backup files only readable by "backups" as well, which would require a sudo or other authentication to access them.

How does one normally solve the problem of username/password credentials as cleartext in a script?

edit: for the moment, I have made the script Root:Wheel, with 700 permissions. launchd Daemons default to run as root, so it runs just fine.

__________________
"The need is not for, say, half a million ¼-inch drill bits. The need is that there are ten million ¼-inch holes that need to be drilled." - Robert Noyce
forgecode.net

Last edited by forgie; 7th April 2009 at 04:27 PM.
Reply With Quote
  #2 (permalink)  
Old 7th April 2009, 04:37 PM
mac_man_luke's Avatar  
Join Date: Jan 2005
Location: Adelaide
Posts: 2,529
Send a message via AIM to mac_man_luke
View mac_man_luke's Twitter Page View mac_man_luke's Flickr Page
Default

if run as root surely is fairly secure but may i ask:

Does your router config actually change on a daily basis? why not manually backup when you make changes?
__________________
Mac Pro Dual Intel Xeon 2.8GHz Quad, 6GB Ram, 320GB HDD, Nvidia 8800GT, Mac OS X 10.5.6
MacBook White 2GHz Intel Core Duo, 2GB Ram, 250GB HD
AusDataHost | My Flickr | Portfolio/Photoblog
Reply With Quote
  #3 (permalink)  
Old 7th April 2009, 04:39 PM
dotnet's Avatar
I come in peace
 
Join Date: Feb 2007
Location: Toongabbie, NSW
Posts: 1,499
Default

Do you really need to backup the router configuration every 24 hours? I mean, it only changes if you change it manually, correct? In that case you could run the backup script manually after configuration changes, and have it prompt you for the login credentials. If you're after backing up other things on the router, such as logs, you might consider syslogging them off to another machine in the first place.

If you really need an unattended backup routine you could use a script that starts at first logon to the Mac and keeps running forever, doing its job every 24 hours. It could prompt for username and password on start-up and keep them scrambled in secure memory.

As for sensitive information in the backed up data, you can have the script GPG encrypt it, using a public key the secret counterpart of which isn't on the system or passphrase protected.

Cheers
Steffen.
__________________
It's a Unix, Jim, but not as we know it...
Reply With Quote
  #4 (permalink)  
Old 7th April 2009, 05:31 PM
forgie's Avatar
NSLog(@"%@", [self customTitle]);
 
Join Date: May 2005
Location: Melbourne
Posts: 3,939
View forgie's Twitter Page View forgie's Last.fm Playlist
Default

Quote:
Originally Posted by mac_man_luke View Post
Does your router config actually change on a daily basis? why not manually backup when you make changes?
No, I probably change my router config on average every 2 weeks or so. The problem is that I forget to back it up. I want to have a Time Machine style system that automatically has the latest copy of everything. Ultimately I want the peace of mind of knowing that I always have the latest data in a safe place.
__________________
"The need is not for, say, half a million ¼-inch drill bits. The need is that there are ten million ¼-inch holes that need to be drilled." - Robert Noyce
forgecode.net
Reply With Quote
  #5 (permalink)  
Old 8th April 2009, 12:24 AM
 
Join Date: Sep 2008
Location: Sydney
Posts: 13
Default

Interesting dilemma.

I'm wondering whether you're able to SSH to the router? If so, you could use a public/private key pair to do the authentication to the router, then download your configs across the SSH session. Of course, you probably shouldn't be running the script as root, but some other user with no password defined, and no shell.
Reply With Quote
  #6 (permalink)  
Old 8th April 2009, 01:10 AM
forgie's Avatar
NSLog(@"%@", [self customTitle]);
 
Join Date: May 2005
Location: Melbourne
Posts: 3,939
View forgie's Twitter Page View forgie's Last.fm Playlist
Default

Unfortunately, this router (Billion 7401VGP) doesn't have SSH. I'll be setting something similar up for someone else who does have networking gear that has SSH access though, so that'll be how I do it for them.

As for storing the backup files, what's involved in using GPG? Are there any other easy options (that use pre-existing OSX components) for say, encrypting a file so that you need a specific password to decrypt it?
__________________
"The need is not for, say, half a million ¼-inch drill bits. The need is that there are ten million ¼-inch holes that need to be drilled." - Robert Noyce
forgecode.net
Reply With Quote
Reply

Bookmarks

Tags
backup, implications, password, script, security

Click here to advertise on MacTalk!

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +11. The time now is 12:46 PM.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
MacTalk Media Pty Ltd is not responsible for the content of individual messages posted by others. Other content copyright MacTalk Media Pty Ltd.
Content Relevant URLs by vBSEO 3.3.0