From 12022770e89c6787c3eda4ca01a7cedaf2affa92 Mon Sep 17 00:00:00 2001 From: Ishan Gupta-AWS <74676865+ig15@users.noreply.github.com> Date: Wed, 22 Jan 2025 16:05:02 +0530 Subject: [PATCH] Update Boost library version to 1.87 (#175) * Update Boost library version to 1.87 * Fox CI workflow for Boost 1.87 upgradation --- .github/workflows/ci.yml | 18 +++++++++--------- CMakeLists.txt | 2 +- README.md | 8 ++++---- src/LocalproxyConfig.h | 2 +- src/TcpAdapterProxy.cpp | 26 +++++++++++++------------- src/TcpAdapterProxy.h | 2 +- src/WebProxyAdapter.cpp | 2 +- src/WebSocketStream.cpp | 2 +- src/WebSocketStream.h | 2 +- 9 files changed, 32 insertions(+), 32 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1b73905..80f2c6b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,9 +28,9 @@ jobs: - name: Install boost working-directory: ${{ github.workspace }} run: | - wget https://boostorg.jfrog.io/artifactory/main/release/1.84.0/source/boost_1_84_0.tar.gz -O /tmp/boost.tar.gz - tar xzvf /tmp/boost.tar.gz - cd boost_1_84_0 + wget https://sourceforge.net/projects/boost/files/boost/1.87.0/boost_1_87_0.tar.gz/download -O /tmp/boost_1_87_0.tar.gz + tar xzvf /tmp/boost_1_87_0.tar.gz + cd boost_1_87_0 ./bootstrap.sh --with-toolset=clang sudo ./b2 install toolset=clang link=static - name: Install protobuf @@ -75,9 +75,9 @@ jobs: - name: Install boost working-directory: ${{ github.workspace }} run: | - wget https://boostorg.jfrog.io/artifactory/main/release/1.84.0/source/boost_1_84_0.tar.gz -O /tmp/boost.tar.gz - tar xzvf /tmp/boost.tar.gz - cd boost_1_84_0 + wget https://sourceforge.net/projects/boost/files/boost/1.87.0/boost_1_87_0.tar.gz/download -O /tmp/boost_1_87_0.tar.gz + tar xzvf /tmp/boost_1_87_0.tar.gz + cd boost_1_87_0 ./bootstrap.sh sudo ./b2 install link=static - name: Install protobuf @@ -155,9 +155,9 @@ jobs: $env:Path += ";C:\Program Files (x86)\zlib\bin" - name: Install boost run: | - Invoke-WebRequest "https://boostorg.jfrog.io/artifactory/main/release/1.84.0/source/boost_1_84_0.zip" -OutFile "boost_1_84_0.zip" - Expand-Archive "boost_1_84_0.zip" -Force - cd .\boost_1_84_0\boost_1_84_0\ + Invoke-WebRequest "https://sourceforge.net/projects/boost/files/boost/1.87.0/boost_1_87_0.zip/download" -OutFile "boost_1_87_0.zip" + Expand-Archive "boost_1_87_0.zip" -Force + cd .\boost_1_87_0\ .\bootstrap.bat .\b2 toolset=msvc-14.2 address-model=64 install define=_WIN32_WINNT=0x0601 define=BOOST_WINAPI_VERSION_WIN7 link=static - name: Install protobuf diff --git a/CMakeLists.txt b/CMakeLists.txt index aa4e90b..a7f6d72 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -92,7 +92,7 @@ endif(BUILD_TESTS) set(Boost_USE_STATIC_LIBS ON) set(Boost_USE_DEBUG_RUNTIME OFF) #set_property(GLOBAL PROPERTY Boost_USE_MULTITHREADED ON) -set(BOOST_PKG_VERSION "1.81.0" CACHE STRING "") +set(BOOST_PKG_VERSION "1.87.0" CACHE STRING "") find_package(Boost ${BOOST_PKG_VERSION} REQUIRED COMPONENTS system log log_setup thread program_options date_time filesystem chrono) include_directories(${Boost_INCLUDE_DIRS}) foreach(BOOST_LIB ${Boost_LIBRARIES}) diff --git a/README.md b/README.md index 9dd7852..2c708ef 100644 --- a/README.md +++ b/README.md @@ -112,7 +112,7 @@ and you can add ` -p ` to expose a port from the docker container. * C++ 14 compiler * CMake 3.6+ * Development libraries required: - * Boost 1.81 + * Boost 1.87 * Protobuf 3.17.x * zlib 1.12.13+ * OpenSSL 1.0+ OR OpenSSL 3 @@ -141,9 +141,9 @@ Fedora example: #### 2. Download and install Boost dependency - wget https://boostorg.jfrog.io/artifactory/main/release/1.81.0/source/boost_1_81_0.tar.gz -O /tmp/boost.tar.gz - tar xzvf /tmp/boost.tar.gz - cd boost_1_81_0 + wget https://sourceforge.net/projects/boost/files/boost/1.87.0/boost_1_87_0.tar.gz/download -O /tmp/boost_1_87_0.tar.gz + tar xzvf /tmp/boost_1_87_0.tar.gz + cd boost_1_87_0 ./bootstrap.sh sudo ./b2 install link=static diff --git a/src/LocalproxyConfig.h b/src/LocalproxyConfig.h index 0f12ead..5aab9da 100644 --- a/src/LocalproxyConfig.h +++ b/src/LocalproxyConfig.h @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/TcpAdapterProxy.cpp b/src/TcpAdapterProxy.cpp index 59a001d..e2e1578 100644 --- a/src/TcpAdapterProxy.cpp +++ b/src/TcpAdapterProxy.cpp @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include #include #include @@ -923,7 +923,7 @@ namespace aws { namespace iot { namespace securedtunneling { if (!localproxy_config.no_ssl_host_verify) { tac.wss->set_ssl_verify_mode(boost::asio::ssl::verify_peer | boost::asio::ssl::verify_fail_if_no_peer_cert); - tac.wss->set_verify_callback(boost::asio::ssl::rfc2818_verification(tac.adapter_config.proxy_host)); + tac.wss->set_verify_callback(boost::asio::ssl::host_name_verification(tac.adapter_config.proxy_host)); } else { @@ -974,7 +974,7 @@ namespace aws { namespace iot { namespace securedtunneling { } else { - BOOST_LOG_SEV(log, debug) << "Resolved proxy server IP: " << results->endpoint().address(); + BOOST_LOG_SEV(log, debug) << "Resolved proxy server IP: " << results.begin()->endpoint().address(); //next connect tcp tac.wss->lowest_layer().async_connect(*results.begin(), on_tcp_connect); } @@ -986,8 +986,8 @@ namespace aws { namespace iot { namespace securedtunneling { BOOST_LOG_SEV(log, error) << (boost::format("Could not resolve DNS hostname of Web proxy: %1% - %2%") % tac.adapter_config.web_proxy_host % ec.message()).str(); basic_retry_execute(log, retry_config, [&]() { std::bind(&tcp_adapter_proxy::web_socket_close_and_stop, this, std::ref(tac)); }); } else { - BOOST_LOG_SEV(log, debug) << "Resolved Web proxy IP: " << results->endpoint().address(); - web_proxy_adapter.async_connect(on_tcp_connect, tac.wss, results->endpoint()); + BOOST_LOG_SEV(log, debug) << "Resolved Web proxy IP: " << results.begin()->endpoint().address(); + web_proxy_adapter.async_connect(on_tcp_connect, tac.wss, results.begin()->endpoint()); } }; @@ -1935,17 +1935,17 @@ namespace aws { namespace iot { namespace securedtunneling { } else { - BOOST_LOG_SEV(log, debug) << "Resolved bind IP: " << results->endpoint().address().to_string(); + BOOST_LOG_SEV(log, debug) << "Resolved bind IP: " << results.begin()->endpoint().address().to_string(); boost::system::error_code bind_ec; - server->acceptor_.open(results->endpoint().protocol()); + server->acceptor_.open(results.begin()->endpoint().protocol()); if (port_to_connect) { //if data port is 0 (means pick an empheral port), then don't set this option server->acceptor_.set_option(reuse_addr_option); } - server->acceptor_.bind(results->endpoint(), bind_ec); + server->acceptor_.bind(results.begin()->endpoint(), bind_ec); if (bind_ec) { - BOOST_LOG_SEV(log, error) << (boost::format("Could not bind to address: %1%:%2% -- %3%") % results->endpoint().address().to_string() % results->endpoint().port() % bind_ec.message()).str(); + BOOST_LOG_SEV(log, error) << (boost::format("Could not bind to address: %1%:%2% -- %3%") % results.begin()->endpoint().address().to_string() % results.begin()->endpoint().port() % bind_ec.message()).str(); basic_retry_execute(log, retry_config, []() { throw proxy_exception(SOURCE_LOCAL_PROXY_PORT_BIND_EXCEPTION); }); } @@ -1958,7 +1958,7 @@ namespace aws { namespace iot { namespace securedtunneling { if (listen_ec) { BOOST_LOG_SEV(log, error) << (boost::format("Could not listen on bind address: %1%:%2% -- %3%") - % results->endpoint().address().to_string() % local_port % listen_ec.message()).str(); + % results.begin()->endpoint().address().to_string() % local_port % listen_ec.message()).str(); basic_retry_execute(log, retry_config, []() { throw proxy_exception(SOURCE_LOCAL_PROXY_PORT_BIND_EXCEPTION); }); } @@ -2057,8 +2057,8 @@ namespace aws { namespace iot { namespace securedtunneling { } else { tcp_client::pointer client = tac.serviceId_to_tcp_client_map[service_id]; - std::string dst_host = results->endpoint().address().to_string(); - unsigned short dst_port = results->endpoint().port(); + std::string dst_host = results.begin()->endpoint().address().to_string(); + unsigned short dst_port = results.begin()->endpoint().port(); BOOST_LOG_SEV(log, debug) << "Resolved destination host to IP: " << dst_host << ", connecting ..."; boost::system::error_code connect_ec; @@ -2137,7 +2137,7 @@ namespace aws { namespace iot { namespace securedtunneling { } else { - BOOST_LOG_SEV(log, debug) << "Resolved bind IP: " << results->endpoint().address().to_string(); + BOOST_LOG_SEV(log, debug) << "Resolved bind IP: " << results.begin()->endpoint().address().to_string(); tuple endpoint_to_connect = tcp_adapter_proxy::get_host_and_port(endpoint, tac.adapter_config.bind_address.get()); std::string dst_host = std::get<0>(endpoint_to_connect); diff --git a/src/TcpAdapterProxy.h b/src/TcpAdapterProxy.h index 9bf13ef..972bb30 100644 --- a/src/TcpAdapterProxy.h +++ b/src/TcpAdapterProxy.h @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/WebProxyAdapter.cpp b/src/WebProxyAdapter.cpp index c2250f4..c14ec81 100644 --- a/src/WebProxyAdapter.cpp +++ b/src/WebProxyAdapter.cpp @@ -52,7 +52,7 @@ namespace aws { void WebProxyAdapter::async_ssl_handshake() { if (!localproxy_config.no_ssl_host_verify) { websocket_stream->get_web_proxy_ssl_stream()->set_verify_mode(ssl::verify_peer | ssl::verify_fail_if_no_peer_cert); - websocket_stream->get_web_proxy_ssl_stream()->set_verify_callback(boost::asio::ssl::rfc2818_verification(localproxy_config.web_proxy_host)); + websocket_stream->get_web_proxy_ssl_stream()->set_verify_callback(boost::asio::ssl::host_name_verification(localproxy_config.web_proxy_host)); } websocket_stream->get_web_proxy_ssl_stream()->async_handshake(ssl::stream_base::client, [this](error_code const &ec) { if (ec) { diff --git a/src/WebSocketStream.cpp b/src/WebSocketStream.cpp index 7790cce..9f603c5 100644 --- a/src/WebSocketStream.cpp +++ b/src/WebSocketStream.cpp @@ -163,7 +163,7 @@ namespace aws { } } - void WebSocketStream::set_verify_callback(const ssl::rfc2818_verification &callback) { + void WebSocketStream::set_verify_callback(const ssl::host_name_verification &callback) { if (localproxyConfig.is_web_proxy_using_tls) { BOOST_LOG_SEV(*log, trace) << "Calling set_verify_callback with type: double_ssl_stream"; return double_ssl_stream->set_verify_callback(callback); diff --git a/src/WebSocketStream.h b/src/WebSocketStream.h index 1d661e2..6dc0761 100644 --- a/src/WebSocketStream.h +++ b/src/WebSocketStream.h @@ -142,7 +142,7 @@ namespace aws { * proxy server and the localproxy. * @param callback the SSL callback. */ - void set_verify_callback(const ssl::rfc2818_verification &callback); + void set_verify_callback(const ssl::host_name_verification &callback); /** * Performs the SSL handshake between the localproxy and the proxy server asynchronously.