oetiker / znapzend

zfs backup with remote capabilities and mbuffer integration.
www.znapzend.org
GNU General Public License v3.0
608 stars 138 forks source link

Incorrect SSH command escaping? #426

Closed Freeaqingme closed 3 years ago

Freeaqingme commented 5 years ago

Hi,

I've recently attempted to set up znapzend with automatic sending over SSH, I think config wise things are pretty normal:

root@hpv1:~# zfs get all rpool | grep dst_back
rpool  org.znapzend:dst_backup1       znapzend@backup1.domain:tank/hpv1.domain          local
rpool  org.znapzend:dst_backup1_plan  7days=>1hours,30days=>4hours,90days=>1days,1years=>1weeks,10years=>1months  local
root@hpv1:~# 

When I run this command, I get an error (mind the total of 3 quotes in the error):

root@hpv1:~# znapzend  --debug --runonce=rpool --features=compressed --autoCreation 
...
# ssh -o batchMode=yes -o ConnectTimeout=30 znapzend@backup1.domain zfs list -H -o name -t 'filesystem,volume' tank
invalid type ''filesystem'

However, If I perform the command manually:

root@hpv1:~# ssh -o batchMode=yes -o ConnectTimeout=30 znapzend@backup1.domain zfs list -H -o name -t 'filesystem,volume' tank
tank

It just works?

Used version: 0.19.1-1 (packaged by Malcolm Scott for Debian) on Debian 9

Edit: It seems to be somehow related to the use of SSH_ORIGINAL_COMMAND in my authorized_keys file. I have an entry there:

restrict,command="sudo $SSH_ORIGINAL_COMMAND" ssh-rsa AAAABfoobar

Without the command= option there appears to be no problem with an extra quote around one of the arguments. But it's still strange that that error is only returned when the ssh command is executed by znapzend, and not when I execute it manually.

oetiker commented 5 years ago

have you tried not adding the quotes ?

Freeaqingme commented 5 years ago

@oetiker what quotes do you refer to, the ones in the authorized_keys file? These are required by the openssh-deamon. For brevity's sake I did just attempt it without the quotes but that results in openssh errors.

oetiker commented 5 years ago

'filesystem,volume'

Freeaqingme commented 5 years ago

Oh, you mean by modifying the znapzend source? I didn't try that yet, because I wasn't really able to find out what file to modify. The files I did modify didn't result in any change of behavior (but it's probably related to the debian packaging), so that's something I'll have to dig in a little further.

oetiker commented 5 years ago

ah ... no the source you should not have to modify :) sorry did not get what you were doing

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.