How to connect to host itself automatically?
FunDeckHermit opened this issue · 6 comments
My usecase is somewhat different then the examples given:
- I have a VPS with a fixed IP
- I host some services at home and tunnel them through wireguard to the VPS
- sshpiper is running on the VPS in a docker container
Using the docker container and a simple home-like directory sshpiper_upstream
file I'm able to SSH my homeserver through the wireguard VPN.
Is sshpiper aware of the already existing users on the VPS? Is there a method to forward/pipe all users without a home-like directory to the host?
here is an example to use grpc upstream
https://github.com/tg123/sshpiper/blob/master/sshpiperd/upstream/grpcupstream/simpleserver/impl.go#L22
you can write your own code to forward/auth connections to anywhere.
This seems a bit above my skill-level, I'm just running it in Docker.
So I would need to exec into the container, find the impl.go file and edit it to fit my needs?
Thanks for the quick reply!
I might make a feature request for some kind of wildcard/default pipe.
here is another yaml based upstream driver which support regex
https://github.com/tg123/sshpiper/blob/master/sshpiperd/e2e/sshpiperd.yaml#L65
you can also use
--upstream-workingdir-fallbackusername=
to set a username where to go whenever no working directory found.
I didn't see the .yaml based upstream driver in the documentation. Thanks for pointing it out!
So next to the WorkDir, Database and K8s there's also .yaml based and grpc ?
Can I use the regex match as variable input for the mapped_username ?
regex match var
is not supported at the moment
you are welcome to use customized grpc server to do it. just a small piece of code
mapped := REGEXMATCH(request.UserName)
return &grpcupstream.FindUpstreamReply{
ToAddr: s.ToAddr,
MappedUserName: mapped
}, nil
reopen if cannot do it with grpc