LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 09-30-2010, 08:06 AM   #1
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,681
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
logging in as root over rsync/ssh for backups


I need to login as root, or at least get root privileges, in a cron triggered backup run. The straight way to do this would be the backup server making an ssh connection to the server to be backed up (this way because I want to avoid many servers being backed up in parallel and the backup server itself would be managing this diversity), via the rsync command which would be performing the backup's synchronization step.

I'm looking for alternatives to this in some form. I'd like to disallow direct root login to my ssh port (not 22).

One idea I have is to have the backup server initiate an ssh login as a non-root user, to either the actual source server, or to a server that can reach the source server ... and set up port forwarding. Over the forwarded port, then initiate the rsync that logs in as root via another port that allows direct root, but cannot be reached from the internet at all (because the border firewall doesn't include this port as allowed in).

FYI, these logins will be using ssh keys, not passwords. I do need to keep ownership metadata for files being backed up, so this is why I am using root. Also, rsync is needed to get the incremental updates to keep bandwidth usage lower (otherwise I could just transfer a tarball each day).

Anyone have any other ideas or comments, for security issues, based on experience doing things like this (backups, routine data replication, etc)?
 
Old 09-30-2010, 08:24 AM   #2
alunduil
Member
 
Registered: Feb 2005
Location: San Antonio, TX
Distribution: Gentoo
Posts: 684

Rep: Reputation: 62
I'm sure you've already considered using a complete backup solution like bacula or amanda? If those aren't acceptable it sounds like you've got a good solution figured out for your particular case.

To allow root logins you need to change the parameter, PermitRootLogin, to yes in `/etc/ssh/sshd_config`.

Regards,

Alunduil
 
Old 09-30-2010, 01:39 PM   #3
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,681

Original Poster
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
Yeah, I've got dual port setups for sshd already, with one allowing root and the other not allowing root.

Although these other backup solutions have to-disk capability, they are still originally designed as tape backups. And that has always been painful for incrementals, especially with their sensitivity to file dates to determine the need to make a backup. And even so, they still seem to need periodic full backups and that just doesn't make sense when going to-disk and rsync is available which can do incrementals indefinitely.

I have my own program that "peels off" incrementals from the on-disk copy of the rsync target. After running rsync for the backup cycle from the place being backed up to the backup location, my program then runs at the backup location. Whatever changed since the last cycle is archived as an incremental. If a file was deleted by rsync, it will still be present in the reference tree kept by this program. It will then move that file over to the incremental tree for this cycle. Files that are newly created are just logged so it is known what date it appeared, so a restore for a previous date won't include it. It works in such a way that you can just remove the older increments any time you wish. For really long term archiving, copy those older increments to a couple tapes and remove the on-disk copy.

We're doing these backups to multiple sites, over the internet. So avoiding full backups is highly desired . A full backup of what we have backing up now takes about 20 hours over gigabit ethernet within the LAN. Imagine what it would take over a T3 link (and we don't even have that, yet).

Tapes for backup is so "2nd millennium"
 
Old 09-30-2010, 01:56 PM   #4
alunduil
Member
 
Registered: Feb 2005
Location: San Antonio, TX
Distribution: Gentoo
Posts: 684

Rep: Reputation: 62
Good analysis. Have you ever heard of rdiff-backup? It's built on rsync and only requires the first backup to be full and then does incrementals after that.

Regards,

Alunduil
 
Old 09-30-2010, 02:20 PM   #5
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,681

Original Poster
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
Yes, I looked at rdiff-backup. It did the rsync part of it integrated, and that just didn't seem to be as flexible as I'd like. For example, in some cases I'd like to do the rsync every 2nd hour, but generate the delta just daily.
 
Old 10-07-2010, 10:50 AM   #6
ramram29
Member
 
Registered: Jul 2003
Location: Miami, Florida, USA
Distribution: Debian
Posts: 848
Blog Entries: 1

Rep: Reputation: 47
You can lock down the ssh access to only a certain username and domain. For example, root@remotesite.com. On top of that, using tcpwrapper you can specify which URL or host can have access to SSH; not to mention iptables rules that you can specify as well. You can also enable and disable all this with a script during a certain hour of the night to lock it down even further. Last, I would recommend to use squashfs filesystem for random access to the restores. It beats having to restore from a huge linear tar file.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Series of rsync backups over SSH - avoid multiple logins Meson Linux - Server 1 04-25-2008 07:21 AM
How to prevent root user from logging into ssh linuxjamil Linux - Server 2 10-08-2007 06:10 PM
Rsync backups gabsik Linux - General 3 11-24-2006 07:14 PM
LXer: Create Incremental Snapshot-style Backups With rSync And SSH LXer Syndicated Linux News 0 08-13-2006 08:21 PM
Anyway to use rsync ssh without allowing root access? ifm Linux - Security 0 06-12-2002 01:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 10:32 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration