Compare commits

...

15 Commits

Author SHA1 Message Date
Lorenzo Moscati
77a7023153 Merge 90e563e21f into 676dd7b85c 2025-07-03 23:38:17 +02:00
Lorenzo Moscati
90e563e21f Update Program.cs
Set three new license options to true: UseRiskInsights, UseOrganizationDomains, and UseAdminSponsoredFamilies.
2025-07-03 23:33:57 +02:00
h44z
676dd7b85c Fix warning in Dockerfile (#230) 2025-05-17 14:22:29 +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
Alessandro
180ad94838 Move Manually generating Certificate & Key section in README.md (#216)
Move `Manually generating Certificate & Key` section from `Building BitBetter` to `Setting up BitBetter` and mark it as `Optional` instead of `Note`.

Co-authored-by: h44z <christoph.h@sprinternet.at>
2024-11-24 19:10:11 +01:00
vdmchkv
38c43a43c9 Prevent docker compose from attempting to pull BitBetter images from the Docker repository (#219)
Co-authored-by: Vadim Iouchkov <vadim.iouchkov@d-gl.de>
2024-11-24 19:02:48 +01:00
Michiel Hazelhof
bfc821e918 Update documentation to reflect changes (#214) 2024-11-03 10:22:14 +01:00
Michiel Hazelhof
3ec7b3d843 Quick and dirty fix (#213)
* Quick and dirty fix

* Don't push obsolete code

* Improve code
2024-11-01 14:36:03 +00:00
Shuttleu
7f64e2cd4a Update license to version 15 (#211)
Co-authored-by: captainhook <16797541+captainhook@users.noreply.github.com>
2024-10-10 14:29:59 +01:00
Michiel Hazelhof
a65277198c Use new location (#202) 2024-06-30 01:33:01 +00:00
kasperk81
12da7d7249 use correct framework (#193)
* use correct framework

* use correct framework
2024-03-30 09:31:27 +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
Rakesh
b93c9487eb Update License to use Secrets Manager fully (#182) 2024-01-19 18:02:14 +00:00
Ayitaka
e173c06320 Updated license version to 12, added SM options, increased max seats (short to int) (#172)
* - Updated license version to 12
- Added new SM license options

* Change seats, smseats, smserviceaccounts from short to int, like they are in the Bitwarden server code, to allow for the accurate maximum amount of seats
2023-11-29 12:07:21 +00:00
Ayitaka
80c0808e72 Update licenseGen with latest version and options (#165)
- Changed Version to 10
- Uncommented UseScim
- Added UseCustomPermissions
2023-04-21 14:24:41 +02:00
8 changed files with 43 additions and 33 deletions

View File

@@ -14,8 +14,8 @@ Credit to https://github.com/h44z/BitBetter and https://github.com/jakeswenson/B
- [Getting Started](#getting-started) - [Getting Started](#getting-started)
- [Dependencies](#dependencies) - [Dependencies](#dependencies)
- [Setting up BitBetter](#setting-up-bitbetter) - [Setting up BitBetter](#setting-up-bitbetter)
- [Optional: Manually generating Certificate & Key](#optional-manually-generating-certificate--key)
- [Building BitBetter](#building-bitbetter) - [Building BitBetter](#building-bitbetter)
- [Note: Manually generating Certificate & Key](#note-manually-generating-certificate--key)
- [Updating Bitwarden and BitBetter](#updating-bitwarden-and-bitbetter) - [Updating Bitwarden and BitBetter](#updating-bitwarden-and-bitbetter)
- [Generating Signed Licenses](#generating-signed-licenses) - [Generating Signed Licenses](#generating-signed-licenses)
- [Note: Alternative Ways to Generate License](#note-alternative-ways-to-generate-license) - [Note: Alternative Ways to Generate License](#note-alternative-ways-to-generate-license)
@@ -40,6 +40,21 @@ With your dependencies installed, begin the installation of BitBetter by downloa
git clone https://github.com/jakeswenson/BitBetter.git git clone https://github.com/jakeswenson/BitBetter.git
``` ```
### Optional: Manually generating Certificate & Key
If you wish to generate your self-signed cert & key manually, you can run the following commands.
```bash
cd .keys
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.cert -days 36500 -outform DER -passout pass:test
openssl x509 -inform DER -in cert.cert -out cert.pem
openssl pkcs12 -export -out cert.pfx -inkey key.pem -in cert.pem -passin pass:test -passout pass:test
```
> Note that the password here must be `test`.<sup>[1](#f1)</sup>
---
## Building BitBetter ## Building BitBetter
Now that you've set up your build environment, you can **run the main build script** to generate a modified version of the `bitwarden/api` and `bitwarden/identity` docker images. Now that you've set up your build environment, you can **run the main build script** to generate a modified version of the `bitwarden/api` and `bitwarden/identity` docker images.
@@ -54,8 +69,6 @@ This will create a new self-signed certificate in the `.keys` directory if one d
You may now simply create the file `/path/to/bwdata/docker/docker-compose.override.yml` with the following contents to utilize the modified images. You may now simply create the file `/path/to/bwdata/docker/docker-compose.override.yml` with the following contents to utilize the modified images.
```yaml ```yaml
version: '3'
services: services:
api: api:
image: bitbetter/api image: bitbetter/api
@@ -70,19 +83,6 @@ You'll also want to edit the `/path/to/bwdata/scripts/run.sh` file. In the `func
You can now start or restart Bitwarden as normal and the modified api will be used. **It is now ready to accept self-issued licenses.** You can now start or restart Bitwarden as normal and the modified api will be used. **It is now ready to accept self-issued licenses.**
---
### Note: Manually generating Certificate & Key
If you wish to generate your self-signed cert & key manually, you can run the following commands.
```bash
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.cert -days 36500 -outform DER -passout pass:test
openssl x509 -inform DER -in cert.cert -out cert.pem
openssl pkcs12 -export -out cert.pfx -inkey key.pem -in cert.pem -passin pass:test -passout pass:test
```
> Note that the password here must be `test`.<sup>[1](#f1)</sup>
--- ---
## Updating Bitwarden and BitBetter ## Updating Bitwarden and BitBetter

View File

@@ -13,10 +13,10 @@ echo "Building BitBetter for BitWarden version $BW_VERSION"
cp "$DIR/.keys/cert.cert" "$DIR/src/bitBetter/.keys" cp "$DIR/.keys/cert.cert" "$DIR/src/bitBetter/.keys"
docker run --rm -v "$DIR/src/bitBetter:/bitBetter" -w=/bitBetter mcr.microsoft.com/dotnet/sdk:6.0 sh build.sh docker run --rm -v "$DIR/src/bitBetter:/bitBetter" -w=/bitBetter mcr.microsoft.com/dotnet/sdk:8.0 sh build.sh
docker build --no-cache --build-arg BITWARDEN_TAG=bitwarden/api:$BW_VERSION --label com.bitwarden.product="bitbetter" -t bitbetter/api "$DIR/src/bitBetter" # --squash docker build --no-cache --build-arg BITWARDEN_TAG=ghcr.io/bitwarden/api:$BW_VERSION --label com.bitwarden.product="bitbetter" -t bitbetter/api "$DIR/src/bitBetter" # --squash
docker build --no-cache --build-arg BITWARDEN_TAG=bitwarden/identity:$BW_VERSION --label com.bitwarden.product="bitbetter" -t bitbetter/identity "$DIR/src/bitBetter" # --squash docker build --no-cache --build-arg BITWARDEN_TAG=ghcr.io/bitwarden/identity:$BW_VERSION --label com.bitwarden.product="bitbetter" -t bitbetter/identity "$DIR/src/bitBetter" # --squash
docker tag bitbetter/api bitbetter/api:latest docker tag bitbetter/api bitbetter/api:latest
docker tag bitbetter/identity bitbetter/identity:latest docker tag bitbetter/identity bitbetter/identity:latest

View File

@@ -1,7 +1,7 @@
ARG BITWARDEN_TAG ARG BITWARDEN_TAG
FROM ${BITWARDEN_TAG} FROM ${BITWARDEN_TAG}
COPY bin/Debug/netcoreapp6.0/publish/* /bitBetter/ COPY bin/Release/net8.0/publish/* /bitBetter/
COPY ./.keys/cert.cert /newLicensing.cer COPY ./.keys/cert.cert /newLicensing.cer
RUN set -e; set -x; \ RUN set -e; set -x; \

View File

@@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>netcoreapp6.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/sdk:6.0 as build FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /licenseGen WORKDIR /licenseGen
@@ -12,6 +12,6 @@ RUN set -e; set -x; \
FROM bitbetter/api FROM bitbetter/api
COPY --from=build /licenseGen/bin/Debug/netcoreapp6.0/publish/* /app/ COPY --from=build /licenseGen/bin/Release/net8.0/publish/* /app/
ENTRYPOINT [ "dotnet", "/app/licenseGen.dll", "--core", "/app/Core.dll", "--cert", "/cert.pfx" ] ENTRYPOINT [ "dotnet", "/app/licenseGen.dll", "--core", "/app/Core.dll", "--cert", "/cert.pfx" ]

View File

@@ -398,7 +398,7 @@ namespace bitwardenSelfLicensor
var type = core.GetType("Bit.Core.Models.Business.OrganizationLicense"); var type = core.GetType("Bit.Core.Models.Business.OrganizationLicense");
var licenseTypeEnum = core.GetType("Bit.Core.Enums.LicenseType"); var licenseTypeEnum = core.GetType("Bit.Core.Enums.LicenseType");
var planTypeEnum = core.GetType("Bit.Core.Enums.PlanType"); var planTypeEnum = core.GetType("Bit.Core.Billing.Enums.PlanType");
var license = Activator.CreateInstance(type); var license = Activator.CreateInstance(type);
@@ -414,14 +414,14 @@ namespace bitwardenSelfLicensor
set("BillingEmail", email); set("BillingEmail", email);
set("BusinessName", string.IsNullOrWhiteSpace(businessName) ? "BitBetter" : businessName); set("BusinessName", string.IsNullOrWhiteSpace(businessName) ? "BitBetter" : businessName);
set("Enabled", true); set("Enabled", true);
set("Plan", "Custom"); set("Plan", "Enterprise (Annually)");
set("PlanType", Enum.Parse(planTypeEnum, "Custom")); set("PlanType", Enum.Parse(planTypeEnum, "EnterpriseAnnually"));
set("Seats", (int)short.MaxValue); set("Seats", int.MaxValue);
set("MaxCollections", short.MaxValue); set("MaxCollections", short.MaxValue);
set("UsePolicies", true); set("UsePolicies", true);
set("UseSso", true); set("UseSso", true);
set("UseKeyConnector", true); set("UseKeyConnector", true);
//set("UseScim", true); // available in version 10, which is not released yet set("UseScim", true);
set("UseGroups", true); set("UseGroups", true);
set("UseEvents", true); set("UseEvents", true);
set("UseDirectory", true); set("UseDirectory", true);
@@ -429,15 +429,25 @@ namespace bitwardenSelfLicensor
set("Use2fa", true); set("Use2fa", true);
set("UseApi", true); set("UseApi", true);
set("UseResetPassword", true); set("UseResetPassword", true);
set("UseCustomPermissions", true);
set("MaxStorageGb", storage == 0 ? short.MaxValue : storage); set("MaxStorageGb", storage == 0 ? short.MaxValue : storage);
set("SelfHost", true); set("SelfHost", true);
set("UsersGetPremium", true); set("UsersGetPremium", true);
set("Version", 9); set("UsePasswordManager", true);
set("UseSecretsManager", true);
set("SmSeats", int.MaxValue);
set("SmServiceAccounts", int.MaxValue);
set("Version", 15); //This is set to 15 to use AllowAdminAccessToAllCollectionItems can be changed to 13 to just use Secrets Manager
set("Issued", DateTime.UtcNow); set("Issued", DateTime.UtcNow);
set("Refresh", DateTime.UtcNow.AddYears(100).AddMonths(-1)); set("Refresh", DateTime.UtcNow.AddYears(100).AddMonths(-1));
set("Expires", DateTime.UtcNow.AddYears(100)); set("Expires", DateTime.UtcNow.AddYears(100));
set("Trial", false); set("Trial", false);
set("LicenseType", Enum.Parse(licenseTypeEnum, "Organization")); 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("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 }))); set("Signature", Convert.ToBase64String((byte[])type.GetMethod("Sign").Invoke(license, new object[] { cert })));

View File

@@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>netcoreapp6.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@@ -32,14 +32,14 @@ RECREATE_OV=${tmprecreate:-$RECREATE_OV}
if [[ $RECREATE_OV =~ ^[Yy]$ ]] if [[ $RECREATE_OV =~ ^[Yy]$ ]]
then then
{ {
echo "version: '3'"
echo ""
echo "services:" echo "services:"
echo " api:" echo " api:"
echo " image: bitbetter/api:$BW_VERSION" echo " image: bitbetter/api:$BW_VERSION"
echo " pull_policy: never"
echo "" echo ""
echo " identity:" echo " identity:"
echo " image: bitbetter/identity:$BW_VERSION" echo " image: bitbetter/identity:$BW_VERSION"
echo " pull_policy: never"
echo "" echo ""
} > $BITWARDEN_BASE/bwdata/docker/docker-compose.override.yml } > $BITWARDEN_BASE/bwdata/docker/docker-compose.override.yml
echo "BitBetter docker-compose override created!" echo "BitBetter docker-compose override created!"
@@ -71,7 +71,7 @@ cd $BITWARDEN_BASE
./bitwarden.sh updateself ./bitwarden.sh updateself
# Update the bitwarden.sh: automatically patch run.sh to fix docker-compose pull errors for private images # Update the bitwarden.sh: automatically patch run.sh to fix docker-compose pull errors for private images
awk '1;/function downloadRunFile/{c=6}c&&!--c{print "sed -i '\''s/dccmd pull/dccmd pull --ignore-pull-failures || true/g'\'' $SCRIPTS_DIR/run.sh"}' $BITWARDEN_BASE/bitwarden.sh > tmp_bw.sh && mv tmp_bw.sh $BITWARDEN_BASE/bitwarden.sh sed -i 's/chmod u+x $SCRIPTS_DIR\/run.sh/chmod u+x $SCRIPTS_DIR\/run.sh\n sed -i \x27s\/dccmd pull\/dccmd pull --ignore-pull-failures || true\/g\x27 $SCRIPTS_DIR\/run.sh/g' -i $BITWARDEN_BASE/bitwarden.sh
chmod +x $BITWARDEN_BASE/bitwarden.sh chmod +x $BITWARDEN_BASE/bitwarden.sh
echo "Patching bitwarden.sh completed..." echo "Patching bitwarden.sh completed..."