Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable TLS renegotiation, bump Windows deps and fix Icinga DB crashes #9945

Merged
merged 5 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions doc/21-development.md
Original file line number Diff line number Diff line change
Expand Up @@ -477,18 +477,18 @@ File Type: EXECUTABLE IMAGE

Image has the following dependencies:

boost_coroutine-vc142-mt-gd-x64-1_82.dll
boost_date_time-vc142-mt-gd-x64-1_82.dll
boost_filesystem-vc142-mt-gd-x64-1_82.dll
boost_thread-vc142-mt-gd-x64-1_82.dll
boost_regex-vc142-mt-gd-x64-1_82.dll
boost_coroutine-vc142-mt-gd-x64-1_83.dll
boost_date_time-vc142-mt-gd-x64-1_83.dll
boost_filesystem-vc142-mt-gd-x64-1_83.dll
boost_thread-vc142-mt-gd-x64-1_83.dll
boost_regex-vc142-mt-gd-x64-1_83.dll
libssl-3_0-x64.dll
libcrypto-3_0-x64.dll
WS2_32.dll
dbghelp.dll
SHLWAPI.dll
msi.dll
boost_unit_test_framework-vc142-mt-gd-x64-1_82.dll
boost_unit_test_framework-vc142-mt-gd-x64-1_83.dll
KERNEL32.dll
SHELL32.dll
ADVAPI32.dll
Expand Down Expand Up @@ -1763,7 +1763,7 @@ mkdir build
cd .\build\

& "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" `
-DICINGA2_UNITY_BUILD=OFF -DBoost_INCLUDE_DIR=C:\local\boost_1_82_0-Win64 `
-DICINGA2_UNITY_BUILD=OFF -DBoost_INCLUDE_DIR=C:\local\boost_1_83_0-Win64 `
-DBISON_EXECUTABLE=C:\ProgramData\chocolatey\lib\winflexbison3\tools\win_bison.exe `
-DFLEX_EXECUTABLE=C:\ProgramData\chocolatey\lib\winflexbison3\tools\win_flex.exe `
-DICINGA2_WITH_MYSQL=OFF -DICINGA2_WITH_PGSQL=OFF ..
Expand Down Expand Up @@ -1936,29 +1936,29 @@ Download the [boost-binaries](https://sourceforge.net/projects/boost/files/boost
- 64 for 64 bit builds

```
https://sourceforge.net/projects/boost/files/boost-binaries/1.82.0/boost_1_82_0-msvc-14.2-64.exe/download
https://sourceforge.net/projects/boost/files/boost-binaries/1.82.0/boost_1_83_0-msvc-14.2-64.exe/download
```

Run the installer and leave the default installation path in `C:\local\boost_1_82_0`.
Run the installer and leave the default installation path in `C:\local\boost_1_83_0`.


##### Source & Compile

In order to use the boost development header and library files you need to [download](https://www.boost.org/users/download/)
Boost and then extract it to e.g. `C:\local\boost_1_82_0`.
Boost and then extract it to e.g. `C:\local\boost_1_83_0`.

> **Note**
>
> Just use `C:\local`, the zip file already contains the sub folder. Extraction takes a while,
> the archive contains more than 70k files.

In order to integrate Boost into Visual Studio, open the `Developer Command Prompt` from the start menu,
and navigate to `C:\local\boost_1_82_0`.
and navigate to `C:\local\boost_1_83_0`.

Execute `bootstrap.bat` first.

```
cd C:\local\boost_1_82_0
cd C:\local\boost_1_83_0
bootstrap.bat
```

Expand Down Expand Up @@ -2041,8 +2041,8 @@ You need to specify the previously installed component paths.

Variable | Value | Description
----------------------|----------------------------------------------------------------------|-------------------------------------------------------
`BOOST_ROOT` | `C:\local\boost_1_82_0` | Root path where you've extracted and compiled Boost.
`BOOST_LIBRARYDIR` | Binary: `C:\local\boost_1_82_0\lib64-msvc-14.2`, Source: `C:\local\boost_1_82_0\stage` | Path to the static compiled Boost libraries, directory must contain `lib`.
`BOOST_ROOT` | `C:\local\boost_1_83_0` | Root path where you've extracted and compiled Boost.
`BOOST_LIBRARYDIR` | Binary: `C:\local\boost_1_83_0\lib64-msvc-14.2`, Source: `C:\local\boost_1_83_0\stage` | Path to the static compiled Boost libraries, directory must contain `lib`.
`BISON_EXECUTABLE` | `C:\ProgramData\chocolatey\lib\winflexbison\tools\win_bison.exe` | Path to the Bison executable.
`FLEX_EXECUTABLE` | `C:\ProgramData\chocolatey\lib\winflexbison\tools\win_flex.exe` | Path to the Flex executable.
`ICINGA2_WITH_MYSQL` | OFF | Requires extra setup for MySQL if set to `ON`. Not supported for client setups.
Expand Down Expand Up @@ -2079,8 +2079,8 @@ $env:ICINGA2_INSTALLPATH = 'C:\Program Files\Icinga2-debug'
$env:ICINGA2_BUILDPATH='debug'
$env:CMAKE_BUILD_TYPE='Debug'
$env:OPENSSL_ROOT_DIR='C:\OpenSSL-Win64'
$env:BOOST_ROOT='C:\local\boost_1_82_0'
$env:BOOST_LIBRARYDIR='C:\local\boost_1_82_0\lib64-msvc-14.2'
$env:BOOST_ROOT='C:\local\boost_1_83_0'
$env:BOOST_LIBRARYDIR='C:\local\boost_1_83_0\lib64-msvc-14.2'
```

#### Icinga 2 in Visual Studio
Expand Down
4 changes: 2 additions & 2 deletions doc/win-dev.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ function ThrowOnNativeFailure {

$VsVersion = 2019
$MsvcVersion = '14.2'
$BoostVersion = @(1, 82, 0)
$OpensslVersion = '3_0_9'
$BoostVersion = @(1, 83, 0)
$OpensslVersion = '3_0_12'

switch ($Env:BITS) {
32 { }
Expand Down
12 changes: 12 additions & 0 deletions lib/base/tlsutility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#include <boost/asio/ssl/context.hpp>
#include <openssl/opensslv.h>
#include <openssl/crypto.h>
#include <openssl/ssl.h>
#include <openssl/ssl3.h>
#include <fstream>

namespace icinga
Expand Down Expand Up @@ -91,6 +93,16 @@ static void InitSslContext(const Shared<boost::asio::ssl::context>::Ptr& context

flags |= SSL_OP_CIPHER_SERVER_PREFERENCE;

#if OPENSSL_VERSION_NUMBER < 0x10100000L
SSL_CTX_set_info_callback(sslContext, [](const SSL* ssl, int where, int) {
if (where & SSL_CB_HANDSHAKE_DONE) {
ssl->s3->flags |= SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS;
}
});
#else /* OPENSSL_VERSION_NUMBER < 0x10100000L */
flags |= SSL_OP_NO_RENEGOTIATION;
#endif /* OPENSSL_VERSION_NUMBER < 0x10100000L */

SSL_CTX_set_options(sslContext, flags);

SSL_CTX_set_mode(sslContext, SSL_MODE_ENABLE_PARTIAL_WRITE | SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER);
Expand Down
4 changes: 4 additions & 0 deletions lib/icingadb/icingadb-objects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1570,6 +1570,9 @@ IcingaDB::CreateConfigUpdate(const ConfigObject::Ptr& object, const String typeN

void IcingaDB::SendConfigDelete(const ConfigObject::Ptr& object)
{
if (!m_Rcon || !m_Rcon->IsConnected())
return;

Type::Ptr type = object->GetReflectionType();
String typeName = type->GetName().ToLower();
String objectKey = GetObjectIdentifier(object);
Expand Down Expand Up @@ -1853,6 +1856,7 @@ void IcingaDB::SendStartedDowntime(const Downtime::Ptr& downtime)
"scheduled_end_time", Convert::ToString(TimestampToMilliseconds(downtime->GetEndTime())),
"has_been_cancelled", Convert::ToString((unsigned short)downtime->GetWasCancelled()),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you have cherry-picked the wrong version of #9896.

"trigger_time", Convert::ToString(TimestampToMilliseconds(downtime->GetTriggerTime())),
"cancel_time", Convert::ToString(TimestampToMilliseconds(downtime->GetRemoveTime())),
"event_id", CalcEventID("downtime_start", downtime),
"event_type", "downtime_start"
});
Expand Down
4 changes: 2 additions & 2 deletions tools/win32/configure-dev.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ if (-not (Test-Path env:OPENSSL_ROOT_DIR)) {
$env:OPENSSL_ROOT_DIR = 'c:\local\OpenSSL-Win64'
}
if (-not (Test-Path env:BOOST_ROOT)) {
$env:BOOST_ROOT = 'c:\local\boost_1_82_0'
$env:BOOST_ROOT = 'c:\local\boost_1_83_0'
}
if (-not (Test-Path env:BOOST_LIBRARYDIR)) {
$env:BOOST_LIBRARYDIR = 'c:\local\boost_1_82_0\lib64-msvc-14.2'
$env:BOOST_LIBRARYDIR = 'c:\local\boost_1_83_0\lib64-msvc-14.2'
}
if (-not (Test-Path env:FLEX_BINARY)) {
$env:FLEX_BINARY = 'C:\ProgramData\chocolatey\bin\win_flex.exe'
Expand Down
6 changes: 3 additions & 3 deletions tools/win32/configure.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ if (-not (Test-Path env:CMAKE_GENERATOR_PLATFORM)) {
}
}
if (-not (Test-Path env:OPENSSL_ROOT_DIR)) {
$env:OPENSSL_ROOT_DIR = "c:\local\OpenSSL_3_0_9-Win${env:BITS}"
$env:OPENSSL_ROOT_DIR = "c:\local\OpenSSL_3_0_12-Win${env:BITS}"
}
if (-not (Test-Path env:BOOST_ROOT)) {
$env:BOOST_ROOT = "c:\local\boost_1_82_0-Win${env:BITS}"
$env:BOOST_ROOT = "c:\local\boost_1_83_0-Win${env:BITS}"
}
if (-not (Test-Path env:BOOST_LIBRARYDIR)) {
$env:BOOST_LIBRARYDIR = "c:\local\boost_1_82_0-Win${env:BITS}\lib${env:BITS}-msvc-14.2"
$env:BOOST_LIBRARYDIR = "c:\local\boost_1_83_0-Win${env:BITS}\lib${env:BITS}-msvc-14.2"
}
if (-not (Test-Path env:FLEX_BINARY)) {
$env:FLEX_BINARY = 'C:\ProgramData\chocolatey\bin\win_flex.exe'
Expand Down
Loading