How can I restrict incoming root rsync over ssh to specified command?

From: mjcsfo (mjcsfo_at_yahoo.com)
Date: 02/04/04

  • Next message: Tim Haynes: "Re: How can I restrict incoming root rsync over ssh to specified command?"
    Date: 4 Feb 2004 14:50:50 -0800
    
    

    I'm trying to setup a centralized backup server on RHEL 3.0, which
    will use rsync over ssh to pull certain directories from the ssh
    server/rsync source
    to the ssh client/rsync destination. Here's an example of the command,
    in a
    script run via cron as root:

    rsync --rsh="ssh -i /root/.ssh/rsync-id_rsa" \
          -avR --stats --delete --max-delete=100 \
          $HOST:/etc/ $CURR_DIR

    $HOST would be static but $CURR_DIR would vary on each call - it
    basically
    contains a path containing the date and time, such as:

    HOST=myserver
    CURR_DIR=/var/spool/backups/$HOST/2004-02-04.18

    for a backup run on Feb 4, 2004 at 6pm.

    I've setup a non-password protected private key as noted above to
    allow
    non-interactive complete access to all files I want to backup. I'm
    currently
    using "PermitRootLogin without-password" in sshd_config and the
    from="myclient", no-port-forwarding, no-X11-forwarding,
    no-agent-forwarding,
    no-pty options in authorized_keys to restrict how this key can be
    used. But
    this method would allow anyone who managed to obtain the private key
    non-
    password protected root access to all servers which are being backed
    up with
    this approach - hopfully without a terminal, but I don't know what
    risks
    there are in this technique.

    I was hoping to use the command="command" option, but from the
    description
    in the man pages it seems like this wouldn't work, since it seems like
    the
    command must be static, any command I send is ignored, and I'm not
    sure of
    which command I'd run on the other end to implement the rsync
    technique I
    want to do in any case.

    I did think potentially the remote command could use environment
    variables
    which I could set remotely via "PermitUserEnvironment yes" in
    sshd_config,
    hopefully thereby allowing the remote command to be static, but I
    don't see
    how this would work with rsync using ssh as an underlying transport.

    Questions:
    1. Does anyone think that the technique I'm using today is simply too
       insecure? Even with the server locked up in a room with no user
       access and running no daemons?

    2. Is there a way to implement what I'm trying to do with rsync using
       some variant of the command="" option to prevent any other use of
       this non-password protected key?

    Thanks in advance!

    Mike

    P.S. Please, no spam even though I'm posting through Google and can't
    hide
    my email address!


  • Next message: Tim Haynes: "Re: How can I restrict incoming root rsync over ssh to specified command?"

    Relevant Pages

    • Re: [Info-ingres] problems with ssh
      ... Check the SSHD log on the server for errors. ... ancient version of SSH, unfortunately. ... the command seems to have functioned - but just wont terminate and leaves a process hanging around. ... Duckman: You got anymore of those glues? ...
      (comp.databases.ingres)
    • Re: How safe are FTP servers?
      ... decent server software with a good track record, ... that rsync can run transparently over a few protocols, including SSH ... Just to clarify, rsync uses it's own rsync protocol over SSH, stuffed ... server if you then use something like Basic HTTP authentication as well - ...
      (comp.os.linux.security)
    • Re: ssh: start vnc server remotely
      ... > I have x11vnc on my computer and I want to start the server using ssh ... > command in ssh and that command just runs on the computer I'm connected ... The only people for me are the mad ones -- the ones who are mad to live, mad to talk, mad to be saved, desirous of everything at the same time, the ones who never yawn or say a commonplace thing, but burn, burn, burn like fabulous yellow Roman candles. ...
      (comp.os.linux.misc)
    • Rsync problem
      ... In our Institut i was able to use rsync with ssh for backup my data from PC to linux server. ... debug: SshAuthMethodClient/sshauthmethodc.c:85: Added "keyboard-interactive" to ...
      (comp.security.ssh)
    • Re: supplying password to subprocess.call(rsync ...), os.system(rsync ...)
      ... I want to write a python script that runs rsync on a given directory ... I build the command line string, but when I try to run ... I can't ssh w/o supplying a password. ... If you use ssh public keys, you can also setup the public key so that ...
      (comp.lang.python)