Bug 3014 - [Enhancement] Tokens for RemoteForward - for unix sockets
Summary: [Enhancement] Tokens for RemoteForward - for unix sockets
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: ssh (show other bugs)
Version: 8.0p1
Hardware: All All
: P4 enhancement
Assignee: Assigned to nobody
URL:
Keywords:
: 3104 (view as bug list)
Depends on:
Blocks: V_8_3 3140
  Show dependency treegraph
 
Reported: 2019-05-29 05:37 AEST by jirib
Modified: 2021-10-14 01:40 AEDT (History)
5 users (show)

See Also:


Attachments
Add percent expansion to LocalForward and RemoteForward (10.43 KB, patch)
2020-04-03 15:39 AEDT, Darren Tucker
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description jirib 2019-05-29 05:37:45 AEST
It would be great if tokens would work for RemoteForward keyword so one could use them to define "dynamically" unix socket paths, for example when running borg backup sw via unix sockets.

Example:

---%>---
Host *.example.com
  User backup
  Compression no
  Ciphers aes128-ctr
  MACs umac-64-etm@openssh.com
  IdentitiesOnly yes
  IdentityFile ~/.ssh/id_ed25519.%r%-example.com
  ExitOnForwardFailure yes
  StreamLocalBindUnlink yes
  RemoteForward /home/%r/tmp/borg.sock ~/tmp/%h-borg.sock # here!
  PermitLocalCommand yes
  LocalCommand socat UNIX-LISTEN:$HOME/tmp/%h-borg.sock "EXEC:borg serve --append-only --restrict-to-path /borgbackup/example.com/%h --umask 0007 --verbose" &
---%<---

And ssh command...

---%>---
export BACKUP_CLIENT=foo.example.com
export BACKUP_DOMAIN=$(echo ${BACKUP_CLIENT} | rev | cut -d'.' -f1-2 | rev)
ssh -q ${BACKUP_CLIENT} "./bin/borgwrapper create --list -s --exclude-caches ssh://localhost/borgbackup/${BACKUP_DOMAIN}/${BACKUP_CLIENT}::'{now:%Y-%m-%dT%H:%M:%S}' /" ; pkill -f "socat .*${BACKUP_CLIENT}"
---%<---
Comment 1 Jan Palus 2019-12-04 06:46:15 AEDT
*** Bug 3104 has been marked as a duplicate of this bug. ***
Comment 2 Daniel Kahn Gillmor 2020-03-27 03:52:56 AEDT
*** Bug 3104 has been marked as a duplicate of this bug. ***
Comment 3 Daniel Kahn Gillmor 2020-03-27 04:32:29 AEDT
see also #3140
Comment 4 Darren Tucker 2020-04-03 15:39:01 AEDT
Created attachment 3371 [details]
Add percent expansion to LocalForward and RemoteForward

The patch implements this on OpenBSD.  Unfortunately it relies on some recent changes only in HEAD so it won't apply directly to any current releases.
Comment 5 Darren Tucker 2020-04-10 11:48:30 AEST
This has been added and will be in the next major release.

Thanks.
Comment 6 Damien Miller 2021-04-23 15:02:03 AEST
closing resolved bugs as of 8.6p1 release
Comment 7 Ahmed Sayeed 2021-10-14 01:40:15 AEDT
[spam removed]