Skip to content

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

Merged
ginuerzh merged 1 commit into
ginuerzh:masterfrom
knyar:accept
Jan 19, 2023
Merged

ginuerzh merged 1 commit into
ginuerzh:masterfrom
knyar:accept

Conversation

@knyar

@knyar knyar commented Oct 31, 2022 •

Copy link
Copy Markdown
Contributor

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

knyar commented Nov 24, 2022

Copy link
Copy Markdown
Contributor Author

@ginuerzh any thoughts on this?

@ginuerzh

Copy link
Copy Markdown
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

knyar commented Nov 30, 2022

Copy link
Copy Markdown
Contributor Author

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

knyar commented Jan 16, 2023

Copy link
Copy Markdown
Contributor Author

Any other feedback on this?

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

Copy link
Copy Markdown
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.

2 participants

⌂ 换网址