Comments (9)
Interesting, thanks for sharing! This is a bug and we should fix it. Can you submit a PR to fix? It should be pretty simple to search for the places we call bind() and figure out which one is for tunneling.
from eternalterminal.
SocketEndpoint::name
is being used to determine the ip to bind the socket on (here)
I think the proper place to set the name is here, so e.x. the solution would be:
} else {
PortForwardSourceRequest pfsr;
+++ pfsr.mutable_source()->set_name("localhost");
pfsr.mutable_source()->set_port(stoi(sourceDestination[0]));
pfsr.mutable_destination()->set_port(stoi(sourceDestination[1]));
pfsrs.push_back(pfsr);
}
at this point the ip is being controlled by the client and etserver just binds the socket to a requested ip (localhost in this case), also it may be later converted to an option or smth for the client.
On the other hand it can be hardcoded on the etserver side, ex. here:
ForwardSourceHandler::ForwardSourceHandler(
shared_ptr<SocketHandler> _socketHandler, const SocketEndpoint& _source,
const SocketEndpoint& _destination)
: socketHandler(_socketHandler),
source(_source),
destination(_destination) {
+++ source->set_name("localhost");
socketHandler->listen(source);
}
What solution is preferable?
from eternalterminal.
Yep, agreed that the first way makes the most sense.
from eternalterminal.
Ofc not that easy) Fails because of this. Btw it doesn't make sense for me to perform this check and fail while the source.name
is being used further in the networkSocketHandler
from eternalterminal.
That check was to prevent a different issue. If the name is "localhost" we can skip that check (i.e. let's change the check to allow localhost through)
from eternalterminal.
At this point it will be identical to just hardcoding localhost on the server. I think that theoretically server can listen for any host/ip that is specified by the client.
Furthermore, it seems for me that there only 2 types of tunneling: via pipe and via tcp. The check is performed for both pipe and tcp but it seems that it is required only to check that pipe filename is not specified on the client and forced to be generated on the server. Also, if the type of tunnel is pipe and there is a source
without name
, the code will skip temporarily filename creation without error and try to create a pipe socket without a filename. This is definitely not what should happen, so i suppose that the logic of this function should be a bit rewritten, so it could allow any source.name
for tcp tunnels (the goal of this issue), and do not allow any source
at all for pipe tunnels.
Basically:
if (!pfsr.has_source()) {
// pipe stuff
} else if (pfsr.source().has_port()) {
// tcp stuff
} else {
// error
}
from eternalterminal.
Hmm, i misunderstand this a bit, if pfsr.has_source()
it is always a tcp tunnel even now. Why not then allow to specify a name? What was the purpose to do this check and fail? If client specify a rubbish name (means wrong ip or wrong hostname or literally rubbish) then it will fail inside networkSocketHandler
with Error getting address info for ...
or Error binding ...
that i assume is the correct and obvious behavior, isn't it?
from eternalterminal.
At the end of the day i see this as a right solution lostystyg#1
Using it for a week and it feels good for me
If it's ok for you i will rebase the PR to the upstream
from eternalterminal.
That makes sense to me. Please submit a PR, thanks!
from eternalterminal.
Related Issues (20)
- "Error handling new client: Failed a call to readAll" HOT 4
- Starting multiple sessions for the same host in parallel leads to crash HOT 3
- Why does 6.2.8 install header and cmake files? HOT 6
- `--ssh-option=ControlPath=...` does not create any filesystem objects
- `et -t` does not accept IP address HOT 3
- APT-KEY is deprecated, update instructions for install HOT 3
- Segfault starting etserver on raspberry pi zero HOT 3
- package for pkgx HOT 1
- GCP IAP proxy HOT 3
- Ubuntu mantic et package (et_6.2.8-mantic1_amd64.deb) broken (bad dep on libtinfo5) HOT 9
- Need a good way to kill off ET sessions HOT 5
- A way to prevent sourcing the shell's configs twice HOT 1
- et needs ssh's -t option to support running tmux with et HOT 2
- Overrided CTRL+C -> CTRL+B not working
- DynamicForward -D option doesn't work HOT 1
- Can use SCP or SSHFS with EternalTerminal? HOT 5
- Please release a new version for the cpp-httplib CVE-2023-26130 fix HOT 1
- Flow Control HOT 5
- deb repositories no longer contain files for debian buster/bullseye HOT 3
- Failed to install via brew
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eternalterminal.