vi / websocat

Command-line client for WebSockets, like netcat (or curl) for ws:// with advanced socat-like functions
MIT License
7.01k stars 272 forks source link

panic when trying to run the wss broadcast example #180

Open akiross opened 1 year ago

akiross commented 1 year ago

Hello, today I was trying to use websocat to broadcast messages over wss, but it panics with this message:

thread 'main' panicked at 'lint should have caught the missing pkcs12_der option', src/ssl_peer.rs:228:10

Here a run enabling the backtrace

$ websocat --version
websocat 1.11.0

$ RUST_BACKTRACE=full websocat -t wss-l:127.0.0.1:4445 log:broadcast:mirror:
websocat: Unfortunately, serving multiple clients without --exit-on-eof (-E) or with -U option is prone to socket leak in this websocat version
thread 'main' panicked at 'lint should have caught the missing pkcs12_der option', src/ssl_peer.rs:228:10
stack backtrace:
   0:     0x55752655f05b - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::he3010f3ff51b55ac
   1:     0x557526510ecc - core::fmt::write::hdfaf46c08a67cd92
   2:     0x557526577a94 - std::io::Write::write_fmt::h0c8cb8452451d559
   3:     0x55752657ead4 - std::panicking::default_hook::{{closure}}::h5f89d231703325b8
   4:     0x55752657f5fc - std::panicking::rust_panic_with_hook::hc7eecadc23f906e1
   5:     0x55752655f4e2 - std::panicking::begin_panic_handler::{{closure}}::h425c6c4810da3633
   6:     0x55752655f456 - std::sys_common::backtrace::__rust_end_short_backtrace::h75a4c4b09ed50e09
   7:     0x55752657efe0 - rust_begin_unwind
   8:     0x5575264c04b2 - core::panicking::panic_fmt::hed5cc02befa9fbd6
   9:     0x557526519de0 - core::panicking::panic_display::hc4fe67d211135e19.514
  10:     0x557526519d8b - core::panicking::panic_str::h47ea5c90abeec45a.513
  11:     0x5575264c0806 - core::option::expect_failed::h4c457d396ce16a48
  12:     0x5575265d70e8 - websocat::ssl_peer::ssl_accept::hdb1f9ab11a03bd34
  13:     0x5575265f0ef8 - <websocat::ssl_peer::TlsAccept<T> as websocat::specifier::Specifier>::construct::{{closure}}::h6325ef810cbfa301
  14:     0x5575265f2cf7 - websocat::util::<impl websocat::PeerConstructor>::map::{{closure}}::h35460a1b0583ab64
  15:     0x5575265eed3e - websocat::util::<impl websocat::PeerConstructor>::map::{{closure}}::he84d75427203623e
  16:     0x5575264cc55d - <futures::future::map_err::MapErr<A,F> as futures::future::Future>::poll::heb51461ad411a07f
  17:     0x5575264c8ac5 - tokio::runtime::current_thread::runtime::Runtime::block_on::hc51533c2c0cc8879
  18:     0x5575264d4317 - websocat::main::hfd1e7de720f5a080
  19:     0x5575264c5ee5 - std::sys_common::backtrace::__rust_begin_short_backtrace::ha8abdba0c76ef23c
  20:     0x5575264e06cc - main
  21:     0x7fc37770824e - __libc_start_call_main
  22:     0x7fc377708309 - __libc_start_main@@GLIBC_2.34
  23:     0x5575264c5de5 - _start
  24:                0x0 - <unknown>
fish: Job 1, 'RUST_BACKTRACE=full websocat -t…' terminated by signal SIGABRT (Abort)

After the server was started, the client was used like this:

$ websocat wss://127.0.0.1:4445
websocat: WebSocketError: WebSocket SSL error: Connection reset by peer (os error 104)
websocat: error running

This happens both with the nix packaged version and using containers, so I don't think it depends on how it was built:

$ podman run -it --rm --net=host docker.io/vi0oss/websocat:0.11.0 -t wss-l:127.0.0.1:4445 log:broadcast:mirror:
websocat: Unfortunately, serving multiple clients without --exit-on-eof (-E) or with -U option is prone to socket leak in this websocat version
thread 'main' panicked at 'lint should have caught the missing pkcs12_der option', src/ssl_peer.rs:228:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

EDIT: trying with containerized version 0.10.0, it seems it catches the problem:

websocat: SSL listerer and --pkcs12-der option should go together
vi commented 1 year ago

lint should have caught the missing pkcs12_der option

Something happened to the CLI options checker. This error should only be observable with --no-fixups option.