yrutschle / sslh

Applicative Protocol Multiplexer (e.g. share SSH and HTTPS on the same port)
https://www.rutschle.net/tech/sslh/README.html
GNU General Public License v2.0
4.58k stars 366 forks source link

Windows event log errors #427

Closed nono303 closed 8 months ago

nono303 commented 8 months ago

Hi @yrutschle Running sslh-ev 2.0.1 on Windows (https://github.com/nono303/sslh/blob/main/x64/sslh-ev.exe) is working like a charm but lot of errors are thrown in event log

image

https://github.com/yrutschle/sslh/blob/v2.0.1/common.c#L496

seems to be when client disconnect before moving data to target fd (like scanner...) Is there any way to avoid theses flooding and from quick look useless error?

yrutschle commented 8 months ago

Does this happen every time a client disconnects?

If that's the case, I suppose we can add the error code to the list that results in reporting FD_CNXCLOSED. In Linux, dropping the connection results in EPIPE which is handled separately. Can you find the symbol corresponding to errno 128 for Windows? On Linux it would be ENOTCONN but is 107. You should find it in a errno.h file.

nono303 commented 8 months ago

Does this happen every time a client disconnects?

no

If that's the case, I suppose we can add the error code to the list that results in reporting FD_CNXCLOSED. In Linux, dropping the connection results in EPIPE which is handled separately. Can you find the symbol corresponding to errno 128 for Windows? On Linux it would be ENOTCONN but is 107. You should find it in a errno.h file.

\Windows Kits\10\Include\10.0.22621.0\ucrt\errno.h #define ENOTSOCK 128

yrutschle commented 8 months ago

ok I added ENOTSOCK (which exists on Linux as well, just.. is not the error reported in that particular case... whatever) to the exclusion list. If it works for you and is useful, I can create a release (otherwise, it can wait until there is more new stuff :) ).

nono303 commented 8 months ago

If it works for you and is useful, I can create a release (otherwise, it can wait until there is more new stuff :) ).

Sounds great for me! If you can at minima push & tag as 2.0.2 or 2.0.1.1, whatever... I'll create the release

yrutschle commented 8 months ago

that's actually a 2.1.0, as it pulls in Landlock support (although I don't think Windows has that)

nono303 commented 8 months ago

Hi @yrutschle Just released 2.1.0 https://github.com/nono303/sslh/releases/tag/2.1.0 Updated deps & cleaned my build chain... here is a small patch to avoid compiler warning on redefine for cygwin (for next release)

diff --git "a/common.h" "b/common.h"
index c8399e1..14d5d79 100644
--- "a/common.h"
+++ "b/common.h"
@@ -5,6 +5,9 @@
  * enough for the macros to adapt (http://support.microsoft.com/kb/111855)
  */
 #ifdef __CYGWIN__
+#ifdef FD_SETSIZE
+#undef  FD_SETSIZE
+#endif
 #define FD_SETSIZE 4096
 #endif
yrutschle commented 8 months ago

Correct me if I'm wrong, but we can undef a symbol even if does not exist, which makes for the simple commit b94060a

nono303 commented 8 months ago

Correct me if I'm wrong, but we can undef a symbol even if does not exist, which makes for the simple commit b94060a

Yes ! Not sure but it might not raise a warning

nono303 commented 8 months ago

Correct me if I'm wrong, but we can undef a symbol even if does not exist, which makes for the simple commit b94060a

Yes ! Not sure but it might not raise a warning

I confirm https://github.com/yrutschle/sslh/commit/b94060ad7616b1820a48c471e42ca1e8eaed8fc4 did not raise warning