Skip to content

Commit

Permalink
Various TLS enhancements and some other smaller fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mickem authored Feb 13, 2025
2 parents 47de5ac + 389592b commit 166956e
Show file tree
Hide file tree
Showing 75 changed files with 929 additions and 3,288 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
runs-on: windows-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true

Expand All @@ -52,7 +52,7 @@ jobs:
shell: pwsh

- id: python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ ENV.PYTHON_VERSION }}
architecture: ${{ inputs.architecture }}
Expand Down Expand Up @@ -182,7 +182,7 @@ jobs:
- name: CMake (installer_lib)
working-directory: tmp/installer_lib
run: |
cmake ../../installer_lib -T v141 -G "Visual Studio 17" -A ${{ steps.setup.outputs.platform }} -DBOOST_ROOT=${{ steps.paths.outputs.static_boost_root }} -DBOOST_LIBRARYDIR=${{ steps.paths.outputs.static_boost_librarydir }} -D BUILD_VERSION=${{ inputs.version }}
cmake ../../installer_lib -T v141 -G "Visual Studio 17" -A ${{ steps.setup.outputs.platform }} -DBOOST_ROOT=${{ steps.paths.outputs.static_boost_root }} -DBOOST_LIBRARYDIR=${{ steps.paths.outputs.static_boost_librarydir }} -DOPENSSL_ROOT_DIR=${{ steps.openssl.outputs.path_unix }} -DBUILD_VERSION=${{ inputs.version }}
- name: Build installer_lib
working-directory: tmp/installer_lib
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/get-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ jobs:
runs-on: windows-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true

- id: python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ ENV.PYTHON_VERSION }}

Expand All @@ -44,9 +44,9 @@ jobs:
uses: ncipollo/release-action@v1
with:
tag: ${{ inputs.version }}
name: Preview for ${{ inputs.version }}
name: ${{ inputs.version }}
draft: true
prerelease: true
prerelease: false
generateReleaseNotes: true
artifacts: |
NSCP-${{ inputs.version }}-docs.zip
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
[submodule "ext/json-protobuf"]
path = ext/json-protobuf
url = https://github.com/mickem/json-protobuf.git
[submodule "ext/google-breakpad"]
path = ext/google-breakpad
url = https://github.com/mickem/google-breakpad.git
[submodule "ext/md-protobuf"]
path = ext/md-protobuf
url = https://github.com/mickem/md-protobuf.git
Expand Down
73 changes: 73 additions & 0 deletions build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Building NSClient++ on Windows

This is the embryo of instruction for building NSClient++ on Windows.
I always recommend to use the Pipelines in GitHub Actions to build the project.

But if you want to build it locally, here is how you can do it.


## Prerequisites

You need the following tools installed on your machine and likely in your path:
* Visual Studio (Community Edition is fine)
* CMake
* 7zip
* Perl (I use strawberry perl)

## Libraries

### Open SSL

Run the following commands in a Visual Studio Command Prompt (2015 x64 Native):

```commandline
SET OPENSSL_VERSION=1.1.1w
curl -L https://www.openssl.org/source/openssl-%OPENSSL_VERSION%.tar.gz --output openssl.tar.gz
7z x openssl.tar.gz
7z x openssl.tar
cd openssl-%OPENSSL_VERSION%
perl Configure VC-WIN64A no-asm no-shared
nmake
cd ..
```

### Boost

Run the following commands in a Visual Studio Command Prompt (2015 x64 Native):

```commandline
SET BOOST_VERSION=1.82.0
SET BOOST_VERSION_=%BOOST_VERSION:.=_%
curl -L https://archives.boost.io/release/%BOOST_VERSION%/source/boost_%BOOST_VERSION_%.tar.gz --output boost.tar.gz
7z x -y boost.tar.gz
7z x -y boost.tar
xcopy boost_%BOOST_VERSION_% boost_%BOOST_VERSION_%_static /E /I
cd boost_%BOOST_VERSION_%
call bootstrap.bat
b2.exe --layout=system address-model=64 toolset=msvc-14.16 variant=release link=shared runtime-link=shared warnings=off -d0 --with-system --with-filesystem --with-thread --with-regex --with-date_time --with-program_options --with-python --with-chrono
cd ..
cd boost_%BOOST_VERSION_%_static
call bootstrap.bat
b2.exe --layout=system address-model=64 toolset=msvc-14.16 variant=release link=static runtime-link=shared warnings=off -d0 --with-system --with-filesystem
cd ..
```

### Build Crypto++

TODO

## Build installer library

```commandline
set SOURCE_ROOT=<where you cloned the repository>
set BUILD_FOLDER=<where you build everything>
set VERSION=0.6.0
mkdir installer_lib
cd installer_lib
cmake %SOURCE_ROOT%/installer_lib -T v141 -G "Visual Studio 17" -A x64 -DBOOST_ROOT=%BUILD_FOLDER%\boost_%BOOST_VERSION_%_static -DBOOST_LIBRARYDIR=%BUILD_FOLDER%\boost_%BOOST_VERSION_%_static/stage/lib -DOPENSSL_ROOT_DIR=%BUILD_FOLDER%\openssl-%OPENSSL_VERSION% -DBUILD_VERSION=%VERSION%
msbuild installer_lib.sln /p:Configuration=Release /p:Platform=x64
```
97 changes: 0 additions & 97 deletions build/cmake/FindGoogleBreakpad.cmake

This file was deleted.

2 changes: 1 addition & 1 deletion build/cmake/FindGoogleTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ if(GTEST_INCLUDE_DIR)
${GTEST_${UPPERCOMPONENT}_LIBRARY_DEBUG})
set(GTEST_${UPPERCOMPONENT}_LIBRARY
${GTEST_${UPPERCOMPONENT}_LIBRARY}
CACHE FILEPATH "The breakpad ${UPPERCOMPONENT} library")
CACHE FILEPATH "The google test ${UPPERCOMPONENT} library")
else(GTEST_${UPPERCOMPONENT}_LIBRARY_RELEASE
AND GTEST_${UPPERCOMPONENT}_LIBRARY_DEBUG)
if(CMAKE_TRACE)
Expand Down
19 changes: 0 additions & 19 deletions build/cmake/GoogleBreakpad.cmake

This file was deleted.

9 changes: 0 additions & 9 deletions build/cmake/dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ find_package(PROTOC_GEN_JSON)
find_package(ProtocGenMd)
find_package(GoogleProtoBuf)
find_package(GoogleTest)
find_package(GoogleBreakpad)
find_package(OpenSSL)
find_package(Miniz)
if(WIN32)
Expand Down Expand Up @@ -124,14 +123,6 @@ else(PROTOBUF_FOUND)
message(
STATUS " ! protocol buffers not found: PROTOBUF_ROOT=${PROTOBUF_ROOT}")
endif(PROTOBUF_FOUND)
if(BREAKPAD_FOUND)
message(STATUS " - google breakpad found in: ${BREAKPAD_INCLUDE_DIR}")
else(BREAKPAD_FOUND)
message(
STATUS
" ! google breakpad not found: TODO=${BREAKPAD_EXCEPTION_HANDLER_INCLUDE_DIR}"
)
endif(BREAKPAD_FOUND)
if(GTEST_FOUND)
message(STATUS " - google test found in: ${GTEST_INCLUDE_DIR}")
else(GTEST_FOUND)
Expand Down
16 changes: 0 additions & 16 deletions build/cmake/functions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -381,22 +381,6 @@ macro(NSCP_FORCE_INCLUDE _TARGET _SRC)
endif(WIN32)
endmacro()

macro(SETUP_BREAKPAD _SRC)
if(BREAKPAD_FOUND)
if(WIN32)
set(${_SRC} ${${_SRC}}
${NSCP_INCLUDEDIR}/breakpad/exception_handler_win32.cpp)
set(${_SRC} ${${_SRC}}
${NSCP_INCLUDEDIR}/breakpad/exception_handler_win32.hpp)
set(${_SRC} ${${_SRC}} ${NSCP_INCLUDEDIR}/ServiceCmd.cpp)
set(${_SRC} ${${_SRC}} ${NSCP_INCLUDEDIR}/ServiceCmd.h)
endif(WIN32)
add_definitions(-DUSE_BREAKPAD)
include_directories(${BREAKPAD_INCLUDE_DIR})
set(EXTRA_LIBS ${EXTRA_LIBS} ${BREAKPAD_COMMON_LIBRARY} ${BREAKPAD_LIBRARY})
endif(BREAKPAD_FOUND)
endmacro()

macro(sign_file PROJNAME _FILENAME)
if(WIN32)
if(EXISTS ${SIGN_CERTIFICATE})
Expand Down
4 changes: 0 additions & 4 deletions build/python/config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@

BREAKPAD_FOUND = "${BREAKPAD_FOUND}"
BREAKPAD_DUMPSYMS_EXE = "${BREAKPAD_DUMPSYMS_EXE}"
BUILD_TARGET_EXE_PATH = "${BUILD_TARGET_EXE_PATH}"
BUILD_PYTHON_FOLDER = "${BUILD_PYTHON_FOLDER}"
NSCP_VERSION_NUMBER = "${NSCP_VERSION_NUMBER}"
Expand All @@ -12,5 +10,3 @@
SCP_BINARY = 'c:\Progra~2\PuTTY\pscp.exe' # ${PSCP_EXE}
CREDENTIALS_FILE = "${BUILD_TARGET_EXE_PATH}/../credentials.txt"
DOCS_FOLDER = "docs/html"
#if CMAKE_CL_64 != "0": # Due to bug in x64 dump_symbols (or possible windows API)
# BREAKPAD_FOUND = "FALSE"
1 change: 0 additions & 1 deletion build/python/fetchdeps.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
SET(PROTOBUF_ROOT "$${LIBRARY_ROOT_FOLDER}/${protobuf_rel_folder}")
SET(OPENSSL_ROOT_DIR "$${LIBRARY_ROOT_FOLDER}/${openssl_rel_folder}")
SET(LUA_SOURCE_ROOT "$${LIBRARY_ROOT_FOLDER}/${lua_rel_folder}")
SET(BREAKPAD_ROOT "$${LIBRARY_ROOT_FOLDER}/${breakpad_rel_folder}")
SET(PYTHON_ROOT "${python_folder}")
SET(CRYPTOPP_ROOT "$${LIBRARY_ROOT_FOLDER}/${cryptopp_rel_folder}")
Expand Down
24 changes: 1 addition & 23 deletions build/python/postbuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import shutil

from config import BUILD_PYTHON_FOLDER, NSCP_VERSION_NUMBER, VERSION_ARCH, BUILD_TARGET_EXE_PATH, \
DOCS_FOLDER, BREAKPAD_FOUND, BREAKPAD_DUMPSYMS_EXE, ARCHIVE_FOLDER
DOCS_FOLDER, ARCHIVE_FOLDER

sys.path.append(BUILD_PYTHON_FOLDER)

Expand Down Expand Up @@ -35,28 +35,6 @@ def find_by_pattern(path, pattern):
zip.write(f, name)
zip.close()

target_name = 'NSCP-%s-%s-symbols.zip'%(NSCP_VERSION_NUMBER, VERSION_ARCH)
if BREAKPAD_FOUND == "TRUE":
print("Gathering symbols into %s"%target_name)
matches = find_by_pattern(BUILD_TARGET_EXE_PATH, '*.pdb')
zip = zipfile.ZipFile(target_name, 'w', zipfile.ZIP_DEFLATED)
for f in matches:
print("Processing: %s"%f)
out = f.replace('.pdb', '.sym')
os.system("%s %s > %s"%(BREAKPAD_DUMPSYMS_EXE, f, out))
name = 'invalid/%s'%os.path.basename(out)
with open(out, 'r') as f:
head = f.readline().strip()
try:
# MODULE windows x86 1FD4DBADB2B446CA81E0F689BE0FFCA61c nscp.pdb
(module, tos, tarch, guid, name) = head.split(' ')
name = 'NSCP.breakpad.syms/%s/%s/%s'%(name, guid, os.path.basename(out))
except:
print('Error failed to parse: %s'%out)

zip.write(out, name)
zip.close()

if ARCHIVE_FOLDER != "":
print("Archiving files...")
target_installer = "%s/%s"%(ARCHIVE_FOLDER,"installers")
Expand Down
5 changes: 2 additions & 3 deletions build/python/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
mkdocs==1.5.1
protobuf==4.23.4
jinja2==3.1.2
jinja2==3.1.5
mkdocs-material==9.1.21
setuptools==65.5.0
json-protobuf==2.0.1
lua-protobuf==2.0.3
md-protobuf==2.0.1
setuptools==65.5.0
setuptools==70.0.0
Loading

0 comments on commit 166956e

Please sign in to comment.