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

Do not exit the server loop on obfs4 connection errors #901

Merged
merged 1 commit into from Jan 19, 2023

Conversation

knyar
Copy link
Contributor

@knyar knyar commented Oct 31, 2022

obfs4Listener.Accept() returns an error when obfs4 handshake fails, which in practice happens routinely when someone scans a machine that has an open listening port.

Currently the accept loop in server.go exits on first such error, which makes further connections to the same port impossible.

This change wraps obfs4 handshake errors into a custom error type that satisfies net.Error and presents itself as temporary, which will prevent such errors from aborting the server.

I think this is what was causing #243.

@knyar
Copy link
Contributor Author

knyar commented Nov 24, 2022

@ginuerzh any thoughts on this?

@ginuerzh
Copy link
Owner

If an unrecoverable error occurred (such as closing the listener), then it will loop forever.

obfs4Listener.Accept() returns an error when obfs4 handshake fails, which in
practice happens routinely when someone scans a machine that has an open
listening port.

Currently the accept loop in server.go exits on first such error, which makes
further connections to the same port impossible.

This change wraps obfs4 handshake errors into a custom error type that
satisfies net.Error and presents itself as temporary, which will prevent such
errors from aborting the server.
@knyar knyar changed the title Do not exit the server loop on accept errors Do not exit the server loop on obfs4 connection errors Nov 30, 2022
@knyar
Copy link
Contributor Author

knyar commented Nov 30, 2022

Thanks @ginuerzh – I have spent a bit more time digging into obfs.go and have an alternative fix now that does not modify the generic accept loop and instead makes obfs4 handshake errors retryable. PTAL?

@knyar
Copy link
Contributor Author

knyar commented Jan 16, 2023

Any other feedback on this?

@ginuerzh ginuerzh merged commit c07cdef into ginuerzh:master Jan 19, 2023
@ginuerzh
Copy link
Owner

Well done, thanks!

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

Successfully merging this pull request may close these issues.

None yet

2 participants