aws-samples / aws-iot-securetunneling-localproxy

AWS Iot Secure Tunneling local proxy reference C++ implementation
https://docs.aws.amazon.com/iot/latest/developerguide/what-is-secure-tunneling.html
Apache License 2.0
74 stars 71 forks source link

Fix bus error from boost socket.shutdown in tcp_socket_error() and link statically to OpenSSL #145

Closed dbouras closed 3 months ago

dbouras commented 10 months ago

Under MacOS (Darwin 23.1, arm64), building with Boost 1.81.0, localproxytest test-cases 'Test source mode" and 'Test source mode with client token' fail due to a bus error when calling connection->socket_.shutdown in tcp_adapter_proxy::tcp_socket_error. The exact same issue is triggered in localproxy, when a connection that's been setup through the tunnel, is subsequently closed (e.g. using SSH to login to the remote end and then logging out).

In addition, OpenSSL is not linked statically when both shared and dynamic libs are available.

Motivation

Without this fix, localproxy is still usable but requires restarting under MacOS whenever a connection through the secure tunnel is closed -- this complicates things further since tunnel credentials must be rotated when the connection drops after localproxy crashes with a bus error.

Modifications

Change summary

Testing

Is your change tested? If not, please justify the reason.
Please list your testing steps and test results.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.