Commit Graph

25 Commits

Author SHA1 Message Date
Pascal Pothmann
8def331bb6 Update to .NET 10.0 and fix certificate validation for Bitwarden server 2026.5.0 (#282)
* Update to .NET 10.0 for Bitwarden server 2026.5.0 compatibility

Bitwarden server 2026.5.0 ships with .NET 10.0 runtime only, breaking
the fast-patch build. This commit updates all .NET projects and build
pipelines to target net10.0 and the dotnet/sdk:10.0 image.

Additionally:
- Replace obsolete X509Certificate2(byte[]) constructors with
  X509CertificateLoader.LoadCertificate() / LoadPkcs12FromFile()
  to resolve SYSLIB0057 warnings introduced in .NET 9/10
- Add -certpbe AES-256-CBC -keypbe AES-256-CBC -macalg SHA256 to
  generate-keys.sh PKCS#12 export, fixing OpenSSL 3.x errors caused
  by the deprecated RC2-40-CBC legacy algorithm
- Update FixRuntimeConfig fallback framework version to 10.0.0

Fixes #281

Signed-off-by: Pascal Pothmann <19438422+p0thi@users.noreply.github.com>

* Fix certificate validation by replacing all thumbprint occurrences

Bitwarden's LicensingService performs two validation checks:
1. Validates _creationCertificate thumbprint
2. Validates all certificates in _verificationCertificates

The thumbprint constants are inlined at compile time, creating multiple
Ldstr instructions in the IL code. The patcher was only replacing the
first occurrence, causing the second validation to fail with:
'Invalid license verifying certificate.'

This fix replaces ALL occurrences of the old thumbprint to ensure both
validation checks pass.

Fixes runtime error: 'Invalid license verifying certificate'

---------

Signed-off-by: Pascal Pothmann <19438422+p0thi@users.noreply.github.com>
Co-authored-by: Pascal Pothmann <19438422+p0thi@users.noreply.github.com>
2026-06-03 21:57:45 +02:00
Lorenzo Moscati
9962717481 Fast patching via IL rewriting of Bitwarden images (#278)
* Fast patching via IL rewriting of Bitwarden images

Brings back the pre-047c4dd approach of patching pre-built Bitwarden
images instead of cloning and building from source. The fast patch mode
(now default) pulls ghcr.io/bitwarden/{api,identity} and rewrites
Core.dll in-place using Mono.Cecil, bypassing the full source build.

Updated to work with current Bitwarden:
- Uses SingleFileExtractor.Core to extract Core.dll from the
  PublishSingleFile bundle before patching; replaces the native
  launcher with a shell script wrapper (exec dotnet /app/Api.dll)
  so entrypoint.sh continues to work unchanged
- LicensingService search is now namespace-agnostic (handles the
  Bit.Core.Services → Bit.Core.Billing.Services rename)
- Thumbprint matching uses Contains() instead of Equals() to handle
  the hidden Unicode LRM character prepended to the production
  thumbprint string literal in the compiled IL

The original source-build path is preserved and accessible via
BITBETTER_BUILD_FROM_SOURCE=1.

Signed-off-by: Lorenzo Moscati <lorenzo@moscati.page>

* Address review: fix correctness and robustness

- dotnet publish -c Release with explicit -o to match Dockerfile expectation
- Add --platform "$TARGETPLATFORM" to fast-patch docker builds for parity with source-build mode
- mkdir -p for idempotent .keys directory creation
- Align namespace to BitwardenSelfLicensor (repo convention)
- Branch bundle extraction on .dll extension instead of bare catch; exit 1 with clear message on failure
- Replace First() with FirstOrDefault() + targeted error on missing licensing resource
- FixRuntimeConfig derives framework name/version from includedFrameworks; switch to LatestPatch rollForward

Signed-off-by: Lorenzo Moscati <lorenzo@moscati.page>

* Add BITBETTER_BUILD_FROM_SOURCE notes to README.md

Signed-off-by: Lorenzo Moscati <lorenzo@moscati.page>

---------

Signed-off-by: Lorenzo Moscati <lorenzo@moscati.page>
Co-authored-by: h44z <christoph.h@sprinternet.at>
2026-04-12 11:03:25 +01:00
h44z
31a08b7e89 fix error message after build (#263), improve readme (#266) 2025-12-09 22:04:28 +01:00
captainhook
2c9e4fd9fa Enhance build script to support multi-platform builds and improve Docker build experience (#262)
* Enhance build script to support multi-platform builds and improve Docker build experience

* Update build.sh

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Correct value for --platform argument

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-12 19:01:34 +02:00
Joseph Gigantino
ac01b0c7ec Update build.sh (#246)
Match change in upstream location of LicensingService.cs

Signed-off-by: Joseph Gigantino <128943406+Jgigantino31@users.noreply.github.com>
2025-07-29 19:45:55 +02:00
Pablo
f3e36ab404 [Fix] TRUSTED CERTIFICATE (#238)
Fix for this error:

unable to load certificate
140067633099200:error:0909006C:PEM routines:get_name:no start line:../crypto/pem/pem_lib.c:745:Expecting: TRUSTED CERTIFICATE
2025-07-11 05:10:23 -07:00
Genva
047c4ddf6f Build image from source (#234)
* Build image from source

* Clone only current version tag

* remove obsolete project

* support loading Core.dll from single file application

* pass single file application to license gen

* remove loose file parameter

* fix executable parameter

* Remove unnecessary changes in LicensingService.cs

* Revert "Remove unnecessary changes in LicensingService.cs"

This reverts commit d8465e1aec.

* Changed comment
2025-07-09 01:04:58 +00:00
Lorenzo Moscati
0b33567820 Updated container repository (#225)
Updated the container image registries from Docker Hub to GitHub Container Registry. Fixes #224
2025-03-29 17:16:26 +00:00
Jan Schöppach
3c703f517d Update to .NET 8.0 to fix building with bitwarden v2024.2.2 (#187)
* Update to .NET 8.0 to fix building with bitwarden v2024.2.2

* Also update license gen to .NET 8.0
2024-02-22 23:16:34 +00:00
h44z
b819fe0c7d update to dotnet 6.0 (#148) (#150) 2022-09-01 14:43:34 -07:00
Grommish
338ea68b08 BitBetter: update build.sh / update-bitwarden.sh (#135)
* BitBetter: update build.sh / update-bitwarden.sh

Bitwarden has changed the way they report version numbers for
self-hosted installations.

Fixes https://github.com/jakeswenson/BitBetter/issues/134

Credit to @Ayitaka for the fix

Tested and Verified, Updated install to 1.47.1

Signed-off-by: Donald Hoskins <grommish@gmail.com>

* Update build.sh

Remove extraneous comment
2022-04-08 21:49:08 -07:00
Reliacon Developer
d2377d0f84 Update bitwarden.sh path (#127)
* Update bitwarden.sh path

* Update update-bitwarden.sh

Co-authored-by: Alex Pearce <alexpearce92@gmail.com>
2022-03-03 19:28:02 +01:00
clanto007
af2d744061 fix '3.1.0' was not found (#116)
* Update build.sh

* Update Dockerfile

* Update bitBetter.csproj

* Update Dockerfile

* Update Dockerfile

* Update licenseGen.csproj

* Apply suggestions from code review

Co-authored-by: h44z <christoph.h@sprinternet.at>

* Update src/licenseGen/Dockerfile

Co-authored-by: h44z <christoph.h@sprinternet.at>

* Update src/licenseGen/Dockerfile

Co-authored-by: h44z <christoph.h@sprinternet.at>
2021-08-31 10:18:29 +02:00
h44z
91d0155725 Fix build.sh and update script (#75) (#77)
* possible fix for #75

* Remove outdated bitbetter images as suggested by Ayitaka

* Fix exit status if no old images have been removed
2020-09-19 23:36:15 +01:00
captainhook
7d8f0b1082 Make Sso available in org license (#73)
* Exclude cert.cert from git

* Use latest release of bitwarden as base image (#67, #66)

* Add a script which simplifies Bitwarden updates

* fix typo

* Add UseApi

* Updated version, created update section

* Workaround for docker-compose --ignore-pull-failures bugs (4377 and 7127)

* use version from docker script

* check if bitbetter images are outdated

* Make Sso available in org license

Add `UseSso` var and enable

* Update README.md

Co-authored-by: Christoph Haas <christoph.h@sprinternet.at>
Co-authored-by: Lework <kuailemy123@163.com>
Co-authored-by: Captainhook <ec14018@qmul.ac.uk>
2020-09-10 15:36:44 -04:00
Michiel Hazelhof
006fa1fecf Update .net core and newtonsoft.json
Co-authored-by: Michiel Hazelhof <m.hazelhof@fyn.nl>

Due to compatibility issues laid out in issue #53:

Update from .net core 2.0 to 3.1 and newtonsoft.json 12.0.1 to 12.0.3.
2020-03-14 07:00:25 -04:00
Vinrobot
3e44d7347b Improve build and scripts (#30)
* Use absolute path rather than relative path in scripts

* Remove src/bitBetter/.keys/cert.cert

* Build licenseGen in Docker
This way we don't have to install dotnet sdk on the host

* Build bitBetter in Docker
This way we don't have to install dotnet sdk on the host

* Change DIR in run.sh to point to the project root

* Replace echo in Dockerfiles by set -x and set -e

* Use same Dockerfile for api and identity images

* Update README.md

* Update CircleCI config
The Docker Executor can't mount volume.
https://support.circleci.com/hc/en-us/articles/360007324514
https://circleci.com/docs/2.0/executor-types/#using-machine

* Make scripts work with sh

* Remove the container used to build bitBetter
2019-07-07 12:18:27 -04:00
Jan Schöppach
5d01d3c661 Fix recreation of keys on every execution (#27)
* Fix recreation of keys on every execution
2019-06-19 09:34:33 -04:00
Jeff Alyanak
15371c362c Bitbetter identity Core.dll (#14)
* Added a Key Generating script

To make the keygen process a bit easier I've added a `generate-keys.sh` script that can be found in the `.keys` directory. It will generate the key & cert and bundle them into the required pkcs#12 file automatically when running the build script if none already exist.

* Generate bitbetter/identiry container with modified Core.dll

Added the generation of a second modified container, bitbetter/identity, which contains the modified dll. Fixes #12.

This works on my testing environment but has not gone through extensive testing. I'd recommend a review and cleanup of this commit before it is merged into the develop or master branches.
2019-05-25 18:12:10 -04:00
Jake Swenson
b1a8ec5031 typo 2017-10-29 12:19:20 -07:00
Jake Swenson
1b2dd6bb10 type; fix build 2017-10-29 12:16:28 -07:00
Jake Swenson
f7ec8b477d updates 2017-10-29 12:13:38 -07:00
Jake Swenson
5c58b0d8fd adding license gen 2017-10-29 09:57:49 -07:00
Jake Swenson
8d930e58e5 no squash 2017-10-22 10:41:02 -07:00
Jake Swenson
13f33a900a build script 2017-10-22 10:09:25 -07:00