Compare commits

..

10 Commits

Author SHA1 Message Date
h44z
31a08b7e89 fix error message after build (#263), improve readme (#266) 2025-12-09 22:04:28 +01:00
Michiel Hazelhof
5387d1803d Add note for the new lite version (#268)
Not sure about the correct url
2025-12-09 21:14:00 +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
h44z
0e2c9d42aa Fix path of OrganizationLicense object (#254)
* Fix path of OrganizationLicense object (see https://github.com/bitwarden/server/tree/main/src/Core/Billing/Organizations/Models)
2025-08-10 10:53:29 +02:00
Joseph Gigantino
063ab1d316 Test generating user and organization licenses during build check (#252)
Add commands to build check to build licensegen image as well and test if the created licensegen image can actually generate user and organization licenses. run.sh will print the generated license to stdout and return zero if successful. If an error occurs, a non zero error code is returned which should cause a build error.

Signed-off-by: Joseph Gigantino <128943406+Jgigantino31@users.noreply.github.com>
2025-07-30 19:15:45 +02:00
h44z
df9e74bb7a Fix license generator according to upstream changes (#245) (#249) 2025-07-29 21:08:44 +00: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
Lorenzo Moscati
b9c46fffb2 Update Program.cs (#237)
Set three new license options to true: UseRiskInsights, UseOrganizationDomains, and UseAdminSponsoredFamilies.
2025-07-10 22:43:22 +00: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
4 changed files with 62 additions and 6 deletions

View File

@@ -13,3 +13,12 @@ jobs:
- run:
name: Build script
command: ./build.sh
- run:
name: Build licenseGen
command: ./src/licenseGen/build.sh
- run:
name: Test generating user license
command: ./src/licenseGen/run.sh ./.keys/cert.pfx user TestName TestEmail@example.com 4a619d4a-522d-4c70-8596-affb5b607c23
- run:
name: Test generating organization license
command: ./src/licenseGen/run.sh ./.keys/cert.pfx org TestName TestEmail@example.com 4a619d4a-522d-4c70-8596-affb5b607c23

View File

@@ -4,6 +4,8 @@ BitBetter is is a tool to modify Bitwarden's core dll to allow you to generate y
Please see the FAQ below for details on why this software was created.
Looking for a solution to the Lite (formerly unified) version of bitwarden, [go to the Lite branch](../../tree/lite).
_Beware! BitBetter does janky stuff to rewrite the bitwarden core dll and allow the installation of a self signed certificate. Use at your own risk!_
Credit to https://github.com/h44z/BitBetter and https://github.com/jakeswenson/BitBetter
@@ -72,9 +74,11 @@ You may now simply create the file `/path/to/bwdata/docker/docker-compose.overri
services:
api:
image: bitbetter/api
pull_policy: never
identity:
image: bitbetter/identity
pull_policy: never
```
You'll also want to edit the `/path/to/bwdata/scripts/run.sh` file. In the `function restart()` block, comment out the call to `dockerComposePull`.

View File

@@ -6,17 +6,57 @@ BW_VERSION=$(curl -sL https://go.btwrdn.co/bw-sh-versions | grep '^ *"'coreVersi
echo "Building BitBetter for BitWarden version $BW_VERSION"
# Enable BuildKit for better build experience and to ensure platform args are populated
export DOCKER_BUILDKIT=1
export COMPOSE_DOCKER_CLI_BUILD=1
# Determine host architecture to use as default BUILDPLATFORM / TARGETPLATFORM if not supplied.
# Allow override via environment variables when invoking the script.
HOST_UNAME_ARCH=$(uname -m 2>/dev/null || echo unknown)
case "$HOST_UNAME_ARCH" in
x86_64|amd64) DEFAULT_ARCH=amd64 ;;
aarch64|arm64) DEFAULT_ARCH=arm64 ;;
armv7l|armv7) DEFAULT_ARCH=arm/v7 ;;
*) DEFAULT_ARCH=amd64 ;;
esac
: "${BUILDPLATFORM:=linux/${DEFAULT_ARCH}}"
: "${TARGETPLATFORM:=linux/${DEFAULT_ARCH}}"
echo "Using BUILDPLATFORM=$BUILDPLATFORM TARGETPLATFORM=$TARGETPLATFORM"
# If there aren't any keys, generate them first.
[ -e "$DIR/.keys/cert.cert" ] || "$DIR/.keys/generate-keys.sh"
# Prepare Bitwarden server repository
rm -rf $DIR/server
git clone --branch "v${BW_VERSION}" --depth 1 https://github.com/bitwarden/server.git $DIR/server
# Replace certificate file and thumbprint
old_thumbprint=$(openssl x509 -inform DER -fingerprint -noout -in $DIR/server/src/Core/licensing.cer | cut -d= -f2 | tr -d ':')
new_thumbprint=$(openssl x509 -inform DER -fingerprint -noout -in $DIR/.keys/cert.cert | cut -d= -f2 | tr -d ':')
sed -i -e "s/$old_thumbprint/$new_thumbprint/g" $DIR/server/src/Core/Billing/Services/Implementations/LicensingService.cs
cp $DIR/.keys/cert.cert $DIR/server/src/Core/licensing.cer
# Build docker images
docker build --no-cache --label com.bitwarden.product="bitbetter" $DIR/server -f $DIR/server/src/Api/Dockerfile -t bitbetter/api
docker build --no-cache --label com.bitwarden.product="bitbetter" $DIR/server -f $DIR/server/src/Identity/Dockerfile -t bitbetter/identity
docker build \
--no-cache \
--platform "$TARGETPLATFORM" \
--build-arg BUILDPLATFORM="$BUILDPLATFORM" \
--build-arg TARGETPLATFORM="$TARGETPLATFORM" \
--label com.bitwarden.product="bitbetter" \
-f $DIR/server/src/Api/Dockerfile \
-t bitbetter/api \
$DIR/server
docker build \
--no-cache \
--platform "$TARGETPLATFORM" \
--build-arg BUILDPLATFORM="$BUILDPLATFORM" \
--build-arg TARGETPLATFORM="$TARGETPLATFORM" \
--label com.bitwarden.product="bitbetter" \
-f $DIR/server/src/Identity/Dockerfile \
-t bitbetter/identity \
$DIR/server
docker tag bitbetter/api bitbetter/api:latest
docker tag bitbetter/identity bitbetter/identity:latest
@@ -24,5 +64,5 @@ docker tag bitbetter/api bitbetter/api:$BW_VERSION
docker tag bitbetter/identity bitbetter/identity:$BW_VERSION
# Remove old instances of the image after a successful build.
ids=$( docker images bitbetter/* | grep -E -v -- "CREATED|latest|${BW_VERSION}" | awk '{ print $3 }' )
ids=$( docker image ls --format="{{ .ID }} {{ .Tag }}" 'bitbetter/*' | grep -E -v -- "CREATED|latest|${BW_VERSION}" | awk '{ ids = (ids ? ids FS $1 : $1) } END { print ids }' )
[ -n "$ids" ] && docker rmi $ids || true

View File

@@ -350,7 +350,7 @@ namespace BitwardenSelfLicensor
{
var core = AssemblyLoadContext.Default.LoadFromAssemblyPath(corePath);
var type = core.GetType("Bit.Core.Models.Business.UserLicense");
var type = core.GetType("Bit.Core.Billing.Models.Business.UserLicense");
var licenseTypeEnum = core.GetType("Bit.Core.Enums.LicenseType");
var license = Activator.CreateInstance(type);
@@ -383,7 +383,7 @@ namespace BitwardenSelfLicensor
{
var core = AssemblyLoadContext.Default.LoadFromAssemblyPath(corePath);
var type = core.GetType("Bit.Core.Models.Business.OrganizationLicense");
var type = core.GetType("Bit.Core.Billing.Organizations.Models.OrganizationLicense");
var licenseTypeEnum = core.GetType("Bit.Core.Enums.LicenseType");
var planTypeEnum = core.GetType("Bit.Core.Billing.Enums.PlanType");
@@ -432,6 +432,9 @@ namespace BitwardenSelfLicensor
set("LicenseType", Enum.Parse(licenseTypeEnum, "Organization"));
set("LimitCollectionCreationDeletion", true); //This will be used in the new version of BitWarden but can be applied now
set("AllowAdminAccessToAllCollectionItems", true);
set("UseRiskInsights", true);
set("UseOrganizationDomains", true);
set("UseAdminSponsoredFamilies", true);
set("Hash", Convert.ToBase64String((byte[])type.GetMethod("ComputeHash").Invoke(license, new object[0])));
set("Signature", Convert.ToBase64String((byte[])type.GetMethod("Sign").Invoke(license, new object[] { cert })));