Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Osync to target with ssh proxy jump works out of the box. BUT: ssh-target checking would be great. #235

Open
smilster opened this issue Feb 14, 2022 · 0 comments

Comments

@smilster
Copy link

Hi there,

First of all: Great job! I really like this tool. What I liked most is that osync even works with a ssh proxy jump. Maybe you mention it somewhere, but I couldn't find in readme.

Let's say I want to synchronize from initiatior with target through proxy. In my instance, the target and proxy are in the same LAN, but only proxy can be reached from outside with PROXYIP. Target has some LOCALTARGETIP in the LAN, that only proxy can reach.

One simply sets up the osync config as follows

TARGET_SYNC_DIR="ssh://TARGETUSER@LOCALTARGETIP:TARGETPORT//dir1"

SSH_OPTIONAL_ARGS="-A -J PROXYUSER@PROXYIP:PROXYPORT"

(not sure if the -A flag is needed here)

Works great!

The optional rsync options don't need to be modified as the ssh command is passed to rsync anyway, if I understood correctly.

This is something you might want to add to your readme and doc (unless I missed that). It is very useful
as it comes out of the osync box.

However, since the checking for host is done though pinging, the target would always appear unreachable. meaning, I have to set
REMOTE_HOST_PING=false

If I still want to check if the target is up, one would have to wrap the osync in another script that checks via ssh if the target is reachable, utilizing
ssh -q -o BatchMode=yes -o StrictHostKeyChecking=no -o ConnectTimeout=5 LOCALTARGETIP -p TARGETPORT -J PROXYUSER@PROXYIP:PROXYPORT 'exit 0'

Subsequently, the command

echo $?

gives 0 if target is reachable through ssh. As pinging is much faster then the ssh-check, maybe there is a ping way via proxy? I'm not sure.

Perhaps you might want to include an optional ssh-target check. It is slower, but it is more reliable since a target that is reachable via ping is not necessarily reachable via ssh and rsync.

In case something like this is already implemented, I'm sorry for "bugging" and not reading the readme and instructions thoroughly enough. By the way, it was only tested for linux systems (arch and ubuntu).

Best regards
Sebastian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant