GithubHelp home page GithubHelp logo

jakeswenson / bitbetter Goto Github PK

View Code? Open in Web Editor NEW
480.0 32.0 103.0 101 KB

Modify bit warden to provide my own licensing for self hosting

C# 77.02% Shell 20.65% Dockerfile 2.33%
bitwarden license self-hosting

bitbetter's Introduction

BitBetter

BitBetter is is a tool to modify Bitwarden's core dll to allow you to generate your own individual and organisation licenses. You must have an existing installation of Bitwarden for BitBetter to modify.

Please see the FAQ below for details on why this software was created.

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

Table of Contents

Getting Started

The following instructions are for unix-based systems (Linux, BSD, macOS), it is possible to use a Windows systems assuming you are able to enable and install WSL.

Dependencies

Aside from docker, which you also need for Bitwarden, BitBetter requires the following:

  • Bitwarden (tested with 1.47.1, might work on lower versions)
  • openssl (probably already installed on most Linux or WSL systems, any version should work)

Setting up BitBetter

With your dependencies installed, begin the installation of BitBetter by downloading it through Github or using the git command:

git clone https://github.com/jakeswenson/BitBetter.git

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.

From the BitBetter directory, simply run:

./build.sh

This will create a new self-signed certificate in the .keys directory if one does not already exist and then create a modified version of the official bitwarden/api called bitbetter/api and a modified version of the bitwarden/identity called bitbetter/identity.

You may now simply create the file /path/to/bwdata/docker/docker-compose.override.yml with the following contents to utilize the modified images.

version: '3'

services:
  api:
    image: bitbetter/api

  identity:
    image: bitbetter/identity

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.

Replace dockerComposePull
with #dockerComposePull

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.

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.1


Updating Bitwarden and BitBetter

To update Bitwarden, the provided update-bitwarden.sh script can be used. It will rebuild the BitBetter images and automatically update Bitwarden afterwards. Docker pull errors can be ignored for api and identity images.

You can either run this script without providing any parameters in interactive mode (./update-bitwarden.sh) or by setting the parameters as follows, to run the script in non-interactive mode:

./update-bitwarden.sh param1 param2 param3

param1: The path to the directory containing your bwdata directory

param2: If you want the docker-compose file to be overwritten (either y or n)

param3: If you want the bitbetter images to be rebuild (either y or n)

If you are updating from versions <= 1.46.2, you may need to run update-bitwarden.sh twice to complete the update process.

Generating Signed Licenses

There is a tool included in the directory src/licenseGen/ that will generate new individual and organization licenses. These licenses will be accepted by the modified Bitwarden because they will be signed by the certificate you generated in earlier steps.

First, from the BitBetter/src/licenseGen directory, build the license generator.2

./build.sh

In order to run the tool and generate a license you'll need to get a user's GUID in order to generate an invididual license or the server's install ID to generate an Organization license. These can be retrieved most easily through the Bitwarden Admin Portal.

The user must have a verified email address at the time of license import, otherwise Bitwarden will reject the license key. Nevertheless, the license key can be generated even before the user's email is verified.

If you generated your keys in the default BitBetter/.keys directory, you can simply run the license gen in interactive mode from the Bitbetter directory and follow the prompts to generate your license.

./src/licenseGen/run.sh interactive

The license generator will spit out a JSON-formatted license which can then be used within the Bitwarden web front-end to license your user or org!


Note: Alternative Ways to Generate License

If you wish to run the license gen from a directory aside from the root BitBetter one, you'll have to provide the absolute path to your cert.pfx.

./src/licenseGen/run.sh /Absolute/Path/To/BitBetter/.keys/cert.pfx interactive

Additional, instead of interactive mode, you can also pass the parameters directly to the command as follows.

./src/licenseGen/run.sh /Absolute/Path/To/BitBetter/.keys/cert.pfx user "Name" "E-Mail" "User-GUID" ["Storage Space in GB"] ["Custom LicenseKey"]
./src/licenseGen/run.sh /Absolute/Path/To/BitBetter/.keys/cert.pfx org "Name" "E-Mail" "Install-ID used to install the server" ["Storage Space in GB"] ["Custom LicenseKey"]

FAQ: Questions you might have.

Why build a license generator for open source software?

We agree that Bitwarden is great. If we didn't care about it then we wouldn't be doing this. We believe that if a user wants to host Bitwarden themselves, in their house, for their family to use and with the ability to share access, they would still have to pay a monthly enterprise organization fee. When hosting and maintaining the software yourself there is no need to pay for the level of service that an enterprise customer needs.

Unfortunately, Bitwarden doesn't seem to have any method for receiving donations so we recommend making a one-time donation to your open source project of choice for each BitBetter license you generate if you can afford to do so.

Shouldn't you have reached out to Bitwarden to ask them for alternative licensing structures?

In the past we have done so but they were not focused on the type of customer that would want a one-time license and would be happy to sacrifice customer service. We believe the features that are currently behind this subscription paywall to be critical ones and believe they should be available to users who can't afford an enterprise payment structure. We'd even be happy to see a move towards a Gitlab-like model where premium features are rolled out first to the enterprise subscribers before being added to the fully free version.

UPDATE: Bitwarden now offers a cheap license called Families Organization that provides premium features and the ability to self-host Bitwarden for six persons.

Footnotes

1 If you wish to change this you'll need to change the value that src/licenseGen/Program.cs uses for its GenerateUserLicense and GenerateOrgLicense calls. Remember, this is really unnecessary as this certificate does not represent any type of security-related certificate.

2This tool builds on top of the bitbetter/api container image so make sure you've built that above using the root ./build.sh script.

bitbetter's People

Contributors

accolon avatar alexdetsch avatar ayitaka avatar captainhook avatar clanto007 avatar dns13 avatar gieltje avatar grommish avatar h44z avatar jakeswenson avatar jeffalyanak avatar kasperk81 avatar kenwoodfox avatar kerenon avatar p0thi avatar raksta01 avatar reliacon-dev avatar vinrobot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bitbetter's Issues

identity removing premium

Whenever I restart the identity server and login at the web interface I get this the identity pod logs this:

๏ฟฝ[40m๏ฟฝ[32minfo๏ฟฝ[39m๏ฟฝ[22m๏ฟฝ[49m: Bit.Core.Services.LicensingService[12482444]
      Validating premium license for user ********-****-****-****-************([email protected]).
๏ฟฝ[40m๏ฟฝ[32minfo๏ฟฝ[39m๏ฟฝ[22m๏ฟฝ[49m: Bit.Core.Services.LicensingService[12482444]
      User ********-****-****-****-************([email protected]) has an invalid license and premium is being disabled. Reason: Invalid signature.
๏ฟฝ[40m๏ฟฝ[32minfo๏ฟฝ[39m๏ฟฝ[22m๏ฟฝ[49m: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
      Request finished in 2265.6261ms 200 application/json; charset=UTF-8

After this my premium state is obviously gone and I have to reupload my license.

I build my own api image due to the instructions.

Do I have to build a custom identity image as well?
And if yes: Are there other images I have to rewrite as well?

Error: pull access denied for bitbetter/identity

Everything ran fine. When going to rebuild bitwarden get the above error.
Pulling identity (bitbetter/identity:latest)...

Error: pull access denied for bitbetter/identity, repository does not exist or may require 'docker login'

Build Script should Generate docker-compose.override.yml

Hello,
Are there any specific instructions for updating Bitwarden while using BitBetter?

running ./bitwarden.sh update will not update the images as the config.yml file is modified to not regenerate the docker-compose.yml as part of the BitBetter installation.

Also, is it possible to modify the docker paramters by using docker-compose.override.yml instead of modifying the main docker-compose.yml file? so that the api and identity images use BitBetter instead of Bitwarden's?

Thanks in advance

error when trying to build bit better - net framework

hi all,

so ive installed the net framework 3.1 using this how to guide

https://docs.microsoft.com/en-us/dotnet/core/install/linux-package-manager-ubuntu-1804

but when i build bitbetter i get this error message

  • dotnet /bitBetter/bitBetter.dll
    It was not possible to find any compatible framework version
    The specified framework 'Microsoft.NETCore.App', version '3.1.0' was not found.

but when i check my version i have 3.1

root@lon-c-bw:/bitwarden/bwdata/BitBetter# dotnet --version
3.1.201

am i missing something here?

thanks,
rob

license gen error while running run.sh interactive

hi all,

im getting the below error when im running the run script to produce a license -

root@bitwarden_ubuntu:/bitwarden/bwdata/BitBetter/src/licenseGen# /bitwarden/bwdata/BitBetter/src/licenseGen/run.sh interactive
Cant find certificate at: /cert.pfx

Usage: interactive

any help would be much appreciated

thanks,
rob

bitbetter/identity restarting

Here is the error from Docker

Unhandled Exception: Interop+Crypto+OpenSslCryptographicException: error:23076071:PKCS12 routines:PKCS12_parse:mac verify failure
   at Internal.Cryptography.Pal.OpenSslPkcs12Reader.Decrypt(SafePasswordHandle password)
   at Internal.Cryptography.Pal.PkcsFormatReader.TryReadPkcs12(OpenSslPkcs12Reader pfx, SafePasswordHandle password, Boolean single, ICertificatePal& readPal, List`1& readCerts)
   at Internal.Cryptography.Pal.PkcsFormatReader.TryReadPkcs12(SafeBioHandle bio, SafePasswordHandle password, Boolean single, ICertificatePal& readPal, List`1& readCerts, Exception& openSslException)
   at Internal.Cryptography.Pal.CertificatePal.FromBio(SafeBioHandle bio, SafePasswordHandle password)
   at Internal.Cryptography.Pal.CertificatePal.FromFile(String fileName, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags)
   at System.Security.Cryptography.X509Certificates.X509Certificate..ctor(String fileName, String password, X509KeyStorageFlags keyStorageFlags)
   at Bit.Core.Utilities.ServiceCollectionExtensions.AddCustomIdentityServerServices(IServiceCollection services, IHostingEnvironment env, GlobalSettings globalSettings)
   at Bit.Identity.Startup.ConfigureServices(IServiceCollection services) in /home/appveyor/projects/server/src/Identity/Startup.cs:line 61
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.ConfigureServices(IServiceCollection services)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices()
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.Initialize()
   at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
   at Bit.Identity.Program.Main(String[] args) in /home/appveyor/projects/server/src/Identity/Program.cs:line 10

What is 'username' for generating a user license?

Running the licenseGen script interactively requests the 'username' as part of the process: 'Please provide the username this license will be registered to. [username]:' It is unclear what I should enter for a license key username.

BitWarden seems to use the email address as the user ID. The Admin panel (/admin/users/view/guid-of-user) doesn't display a username.

What should I enter for username?

user id

where do you get the user id from?

Circle-ci Checkout Key

The circle-ci checkout key seems to be incorrect, causing all circle-ci tests to fail. I think @jakeswenson is probably the only one who can fix that.

Step 1/5 : ARG BITWARDEN_TAG Please provide a source image with `from` prior to commit

Hi,
I installed bitwarden self-host and all went fine.
I have:

  • Docker version 1.13.1
  • docker-compose version 1.25.4
  • Bitwarden Version 2.12.0

Then I did

git clone https://github.com/jakeswenson/BitBetter.git

and ./build.sh but I got:

[root@xxx BitBetter]# ./build.sh 
+ dotnet add package Newtonsoft.Json --version 12.0.1
  Writing /tmp/tmppdM05N.tmp
info : Adding PackageReference for package 'Newtonsoft.Json' into project '/bitBetter/bitBetter.csproj'.
info : Restoring packages for /bitBetter/bitBetter.csproj...
info :   GET https://api.nuget.org/v3-flatcontainer/mono.cecil/index.json
info :   GET https://api.nuget.org/v3-flatcontainer/newtonsoft.json/index.json
info :   GET https://api.nuget.org/v3-flatcontainer/microsoft.netcore.app/index.json
info :   OK https://api.nuget.org/v3-flatcontainer/newtonsoft.json/index.json 196ms
info :   OK https://api.nuget.org/v3-flatcontainer/microsoft.netcore.app/index.json 197ms
info :   GET https://api.nuget.org/v3-flatcontainer/newtonsoft.json/12.0.1/newtonsoft.json.12.0.1.nupkg
info :   GET https://api.nuget.org/v3-flatcontainer/microsoft.netcore.app/2.0.0/microsoft.netcore.app.2.0.0.nupkg
info :   OK https://api.nuget.org/v3-flatcontainer/newtonsoft.json/12.0.1/newtonsoft.json.12.0.1.nupkg 18ms
info :   OK https://api.nuget.org/v3-flatcontainer/microsoft.netcore.app/2.0.0/microsoft.netcore.app.2.0.0.nupkg 18ms
info :   GET https://api.nuget.org/v3-flatcontainer/microsoft.netcore.dotnethostpolicy/index.json
info :   GET https://api.nuget.org/v3-flatcontainer/netstandard.library/index.json
info :   OK https://api.nuget.org/v3-flatcontainer/mono.cecil/index.json 453ms
info :   GET https://api.nuget.org/v3-flatcontainer/mono.cecil/0.10.0-beta6/mono.cecil.0.10.0-beta6.nupkg
info :   OK https://api.nuget.org/v3-flatcontainer/mono.cecil/0.10.0-beta6/mono.cecil.0.10.0-beta6.nupkg 18ms
info :   OK https://api.nuget.org/v3-flatcontainer/microsoft.netcore.dotnethostpolicy/index.json 127ms
info :   GET https://api.nuget.org/v3-flatcontainer/microsoft.netcore.dotnethostpolicy/2.0.0/microsoft.netcore.dotnethostpolicy.2.0.0.nupkg
info :   OK https://api.nuget.org/v3-flatcontainer/netstandard.library/index.json 128ms
info :   GET https://api.nuget.org/v3-flatcontainer/netstandard.library/2.0.0/netstandard.library.2.0.0.nupkg
info :   OK https://api.nuget.org/v3-flatcontainer/microsoft.netcore.dotnethostpolicy/2.0.0/microsoft.netcore.dotnethostpolicy.2.0.0.nupkg 20ms
info :   GET https://api.nuget.org/v3-flatcontainer/microsoft.netcore.dotnethostresolver/index.json
info :   OK https://api.nuget.org/v3-flatcontainer/netstandard.library/2.0.0/netstandard.library.2.0.0.nupkg 21ms
info :   OK https://api.nuget.org/v3-flatcontainer/microsoft.netcore.dotnethostresolver/index.json 127ms
info :   GET https://api.nuget.org/v3-flatcontainer/microsoft.netcore.dotnethostresolver/2.0.0/microsoft.netcore.dotnethostresolver.2.0.0.nupkg
info :   OK https://api.nuget.org/v3-flatcontainer/microsoft.netcore.dotnethostresolver/2.0.0/microsoft.netcore.dotnethostresolver.2.0.0.nupkg 17ms
info :   GET https://api.nuget.org/v3-flatcontainer/microsoft.netcore.dotnetapphost/index.json
info :   OK https://api.nuget.org/v3-flatcontainer/microsoft.netcore.dotnetapphost/index.json 127ms
info :   GET https://api.nuget.org/v3-flatcontainer/microsoft.netcore.dotnetapphost/2.0.0/microsoft.netcore.dotnetapphost.2.0.0.nupkg
info :   OK https://api.nuget.org/v3-flatcontainer/microsoft.netcore.dotnetapphost/2.0.0/microsoft.netcore.dotnetapphost.2.0.0.nupkg 17ms
info : Installing Microsoft.NETCore.DotNetAppHost 2.0.0.
info : Installing Microsoft.NETCore.DotNetHostResolver 2.0.0.
info : Installing Microsoft.NETCore.DotNetHostPolicy 2.0.0.
info : Installing NETStandard.Library 2.0.0.
info : Installing Microsoft.NETCore.App 2.0.0.
info : Installing Mono.Cecil 0.10.0-beta6.
info : Installing Newtonsoft.Json 12.0.1.
info : Package 'Newtonsoft.Json' is compatible with all the specified frameworks in project '/bitBetter/bitBetter.csproj'.
info : PackageReference for package 'Newtonsoft.Json' version '12.0.1' updated in file '/bitBetter/bitBetter.csproj'.
info : Committing restore...
info : Assets file has not changed. Skipping assets file writing. Path: /bitBetter/obj/project.assets.json
log  : Restore completed in 6.08 sec for /bitBetter/bitBetter.csproj.
+ dotnet restore
  Restore completed in 59.99 ms for /bitBetter/bitBetter.csproj.
+ dotnet publish
Microsoft (R) Build Engine version 16.2.37902+b5aaefc9f for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 59.24 ms for /bitBetter/bitBetter.csproj.
  bitBetter -> /bitBetter/bin/Debug/netcoreapp2.0/bitBetter.dll
  bitBetter -> /bitBetter/bin/Debug/netcoreapp2.0/publish/
Sending build context to Docker daemon  1.47 MB
Step 1/5 : ARG BITWARDEN_TAG
Please provide a source image with `from` prior to commit
Sending build context to Docker daemon  1.47 MB
Step 1/5 : ARG BITWARDEN_TAG
Please provide a source image with `from` prior to commit`

FYI, I don't have any bitbetter image after that:

[root@xxx ~]# docker image list
REPOSITORY                          TAG                 IMAGE ID            CREATED             SIZE
docker.io/certbot/certbot           latest              058bbcb454ed        13 days ago         157 MB
mcr.microsoft.com/dotnet/core/sdk   2.1                 f6b12daf495b        2 weeks ago         1.74 GB
docker.io/bitwarden/web             2.12.0              d9cb8eae5562        5 months ago        308 MB
docker.io/bitwarden/setup           1.32.0              da65b2fb2aed        5 months ago        223 MB
docker.io/bitwarden/mssql           1.32.0              d92a09dce472        5 months ago        1.39 GB
docker.io/bitwarden/admin           1.32.0              4d158aa7d9d1        5 months ago        298 MB
docker.io/bitwarden/events          1.32.0              abb2acd7bc0b        5 months ago        321 MB
docker.io/bitwarden/notifications   1.32.0              eb43e98b4135        5 months ago        289 MB
docker.io/bitwarden/icons           1.32.0              53b8984377c7        5 months ago        323 MB
docker.io/bitwarden/attachments     1.32.0              51e7de910b78        5 months ago        297 MB
docker.io/bitwarden/nginx           1.32.0              882998aaf5b7        5 months ago        133 MB
docker.io/bitwarden/identity        1.32.0              a4ca753ee423        5 months ago        321 MB
docker.io/bitwarden/api             1.32.0              85fd381456cf        5 months ago        331 MB

Can you support me please? Thanks.

[WIP]: `README.md` improvements

BitBetter README.md improvements

We should probably move it from README.md. I suggest to create either GitHub Wiki or files in the brackets bellow in the repo root or in the [repo_root]/docs folder. Then, the README.md should contain only the general information about the repository/project/program.

Add full documentation

  • How to install (INSTALL.md; cf my comment in #6)
    • List the dependencies with instructions how to install them (at least a link to a guide)
  • How to run (RUN.md)
  • How to upgrade (UPGRADE.md)
  • How to uninstall (UNINSTALL.md)
  • FAQs (FAQ.md)

Improve wording:

  • Replace Pre-requisites with Dependencies

Questions:

  • What is IL in janky IL magic? We should not use shortcuts like this in the docs.

Changing default MaxStorageGb

Hi,

Sorry this isn't an issue but rather a question of how-to.
How would one change 'MaxStorageGb'? I have changed it in Program.cs; is that the only place to change it (and then rebuild licensegen)?

Many thanks

made a script for organisation creation

hi all,

just thought i would share as i think this project is awesome!!!!!!

#!/bin/bash

echo "please enter organisation name":
read name

echo "please enter the owners email of this organisation (user must already exist)":
read owner

echo "please enter company":
read company

read -p "continue (y/n)?" CONT

if [ "$CONT" = "y" ]; then

/bitwarden/bwdata/BitBetter/src/licenseGen/run.sh /bitwarden/bwdata/BitBetter/.keys/cert.pfx org "$name" "$owner" installation-id "$company" >> /license_files/"$name".json

echo "this is the organisational license file" | swaks --to "$owner" --from [email protected] --server smtp_relay_ip --attach-type /license_files/"$name".json

rm -f /license_files/"$name".json

else
exit
fi

rob

Organization Does Not Show

When I add an organization via my user account using the license generated by BitBetter the operation completes successfully but the organization does not appear linked to my user account. However, the organization does show up in the admin panel. Does anyone have any experience with this? I can offer any logs files necessary.

Can't install on debian

I can't install on debian 9.
Could you provide me a step by step to install?
Thanks,

Mario

Update Docs

I'm going to try and sit down and update & consolidate the documentation/Readme. I think a well-written Readme with prerequisites and installation details will be worth the effort.

I'll probably break it into sections with Table of Contents to make it easy to navigate for anyone viewing it via Github or a markdown reader.

If there are any particular thoughts, ideas or concerns regarding this please let me know.

Ability to change "Business Name"

Hi,
This is a very superficial and cosmetic request but would make things neater.

Would it be possible to change the hard coded "BitBetter" under business name to something custom like your family name etc?

Documentation update

Hello guys,
There is paragraph in the documentation referring to modifying a run.sh file. I've downloaded the latest release of bitwarden and there doesn't seem to be a scripts directory.

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.

Replace dockerComposePull
with #dockerComposePull

Unable to find image 'bitbetter/licensegen:latest' locally

./src/licenseGen/run.sh interactive
Unable to find image 'bitbetter/licensegen:latest' locally
docker: Error response from daemon: pull access denied for bitbetter/licensegen, repository does not exist or may require 'docker login'.
See 'docker run --help'.

how do I solve this?

I did all the steps, but can't generale a license.

Regards

Issue after upgrading to 2.13.1

 ---> Running in 269e73d10a6c
+ dotnet /bitBetter/bitBetter.dll
It was not possible to find any compatible framework version
The framework 'Microsoft.NETCore.App', version '2.0.0' was not found.
  - The following frameworks were found:
      3.1.2 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]

You can resolve the problem by installing the specified framework and/or SDK.

The specified framework can be found at:
  - https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=2.0.0&arch=x64&rid=debian.10-x64
The command '/bin/sh -c set -e; set -x;     dotnet /bitBetter/bitBetter.dll &&     mv /app/Core.dll /app/Core.orig.dll &&     mv /app/modified.dll /app/Core.dll &&     rm -rf /bitBetter && rm -rf /newLicensing.cer' returned a non-zero code: 150

Made a backup of the keys, removed everything, pulled the git again and the problem remains. Ran a build command on 2.13.0 before upgrading and it was fine.

It just appears we need to upgrade to dotnet core 3.1, please see my pull request.

After adding Org license, and inviting users, the users are not in that organization.

So here's what I have, able to generate the Org license, imports fine and seems to unlock the features. I then go to the panel and invite a user. The user gets the email, signs up and logs in to the account, however they are not part of the org and the user was as if they just created a standalone account in the system. I can create a new org license for the user, however then they are put into their own org. It's like they just aren't connected.

invalid license once i copied over all of bwdata dir

hi all,

so i had to make a new ubuntu server and i did a fresh install of bitwarden and bitbetter again but i installed bitbetter and then/after i copied over all my bwdata dir including bitbetter and i think i have buggered it up as i can make organisations but the website is saying "invalid license"

do you think i should delete the bitbetter dir in my bwdata and start the install again?

many thanks,
rob

User ID - Please Help!

How on earth do you find the user ID for a given user? I'm to the point of generating a user license, but it gives me a "User ID not provided" error. What obviously thing am I missing? Thanks!!

does bitbetter work offline

hi all,

made bitwarden again this time doing it via the "Manual Docker Installations" so it doesnt need the internet to pull down the docker containers all the time

but if i make this an offline server will bitbetter still work or do i manually need to pull/save/load the bitbetter docker container?

many thanks,
rob

Error in the documentation

Hi,

I spotted a tiny little error in the documentation

You should replace
git clone https://github.com/online-stuff/BitBetter.git
by
git clone https://github.com/jakeswenson/BitBetter.git

Error cant find bitbetter/api

hi all,

i have installed bitwarden and its great but now i want to set up organisations

i have come accross this

https://github.com/jakeswenson/BitBetter

but im struggling to do it, i am running this command below in my "/bitwarden/bwdata/"

git clone https://github.com/jakeswenson/BitBetter.git

its made it here " /bitwarden/bwdata/BitBetter"

then i run the script

./build.sh

then i edit my file like it says ie

Replace image: bitwarden/api:x.xx.x
with image: bitbetter/api

Replace image: bitwarden/identity:x.xx.x
with image: bitbetter/identity

but when i restart bitwarden it throughs an error -
Trying to pull repository docker.io/bitbetter/api ...

ERROR: repository docker.io/bitbetter/api not found: does not exist or no pull access

so obviously i havnt saved it in the right directory
can anyone help me out please

thanks,

rob

Build issue (certificate related)

Hello,
Where are we supposed to generate the self-signed certificate?

I noticed that the build.sh script copies a cert.cer from .keys directory to ./src/bitBetter/.keys but during the build it says
"mkdir: cannot create directory โ€˜./src/bitBetter/.keysโ€™: File exists
cp: cannot stat '.keys/cert.cert': No such file or directory"

That's because there is what looks like a corrupt cert file in ./src/bitBetter/.keys whereas the .keys directory at the root is empty and contains a text file that says that!

invalid license error

Everything builds fine now. I can build get the run the script but getting invalid license when I go to upload them whether its user or organization.

[Question] BitBetter vs Removing Licencing

It seems to be relatively easy to override Bitwarden Licencing when building from scratch and scratch builds aren't that hard either (and due to AGPL it's fine to even host self-build docker images).
See:
https://github.com/imi415/bitwarden-server/tree/communism

With a little bit of magic it could be pretty much automated (install, update etc) the same way as bitwarden does.

Isn't this a much cleaner solution than overwriting a pre-build binary?

Edit
Even if the goal is to make licencing available to self-hosted users, isn't the right way of doing so just forking the codebase?

enforcing 2FA for all users

hi all,

i have read you cant enforce 2FA on normal bitwarden installations as its greyed out but as i have installed bitbetter i now have the option as i imagine i have the enterprise one or custom version?

is this possible to do now?

thanks,
rob

Certificate Generation

Hello i get the message

root@bitwarden:/home/bitwarden# ./src/licenseGen/run.sh /cert.pfx interactive
Cant find certificate at: /cert.pfx

Usage: interactive

The specified framework 'Microsoft.NETCore.App', version '3.1.0' was not found.

Is anyone seeing the below error, despite installing .NET 3.1?

Step 5/5 : RUN set -e; set -x;     dotnet /bitBetter/bitBetter.dll &&     mv /app/Core.dll /app/Core.orig.dll &&     mv /app/modified.dll /app/Core.dll &&     rm -rf /bitBetter && rm -rf /newLicensing.cer
 ---> Running in 005bb3d546de
+ dotnet /bitBetter/bitBetter.dll
It was not possible to find any compatible framework version
The specified framework 'Microsoft.NETCore.App', version '3.1.0' was not found.
  - Check application dependencies and target a framework version installed at:
      /usr/share/dotnet/
  - Installing .NET Core prerequisites might help resolve this problem:
      https://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
  - The .NET Core framework and SDK can be installed from:
      https://aka.ms/dotnet-download
  - The following versions are installed:
      2.2.6 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Step 5/5 : RUN set -e; set -x;     dotnet /bitBetter/bitBetter.dll &&     mv /app/Core.dll /app/Core.orig.dll &&     mv /app/modified.dll /app/Core.dll &&     rm -rf /bitBetter && rm -rf /newLicensing.cer
 ---> Running in 853e21484be1
+ dotnet /bitBetter/bitBetter.dll
It was not possible to find any compatible framework version
The specified framework 'Microsoft.NETCore.App', version '3.1.0' was not found.
  - Check application dependencies and target a framework version installed at:
      /usr/share/dotnet/
  - Installing .NET Core prerequisites might help resolve this problem:
      https://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
  - The .NET Core framework and SDK can be installed from:
      https://aka.ms/dotnet-download
  - The following versions are installed:
      2.2.6 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]

In /usr/share/dotnet/shared/Microsoft.NETCore.App/ I only have 3.1.3 (/usr/share/dotnet/shared/Microsoft.NETCore.App/3.1.3/), so it's a little bizzare.

Running Ubuntu 18.04.4 LTS

The only dotnet packages installed on this system are:
aspnetcore-runtime-3.1 aspnetcore-targeting-pack-3.1 dotnet-apphost-pack-3.1 dotnet-host dotnet-hostfxr-3.1 dotnet-runtime-3.1 dotnet-runtime-deps-3.1 dotnet-sdk-3.1 dotnet-targeting-pack-3.1,
and also: netstandard-targeting-pack-2.1

Interactive Mode for License Generator

In pursuit of a more streamlined user experience, I think it's worthwhile to give the license generator an interactive mode of operation.

Similar to how openssl operates when generating a key, it can ask for for the requisite details and offer reasonable defaults where applicable (business name for org licenses).

Something along the lines of:

$  What would you like to generate, a [u]ser license or an [o]rg license?
$  Enter your selection, default is [u]ser license: 

$ o

$ Please enter a business name for the org license, default is [BitBetter]: 

$ MyCompany

$ Please enter the Install-ID used to install the server:

I'm thinking that the parameters -i and --interactive would be used for this mode, with the existing operation being unchanged.

Cannot Generate license

Following the instructions in README.md allows me to successfully generate a PFX, build the bitwarden/api:latest image and the bitbetter/licensegen:latest image.

However, attempting to run the generator with:

./src/licenseGen/run.sh /absolute/path/to/cert.pfx

Will return the help text from the license generator (not from the run script):

Usage:  [options] [command]

Options:
  --cert            cert file
  --core            path to core dll
  -? | -h | --help  Show help information

Commands:
  org
  user

Use " [command] --help" for more information about a command.

The documentation on the org and user command don't appear to be complete and I'm unable to get it to return a license.

Same as #26

Does this work on the latest version of bitwarden? I noticed that your screenshot shows an older version in docker. I've tried this in the latest version of bw and I get the invalid license error as well. Just curious-thanks

Unable to generate a licence

Hello,
When running /run.sh /opt/BitBetter/.keys/cert.pfx user [email protected] [email protected] 12345679
I get the error message at the bottom: (Similar to issue #4)

I followed the instructions and installed dotnet add package Newtonsoft.Json --version 11.0.0 before running the build.sh

What am I doing wrong?

##Oops: System.IO.FileNotFoundException: Could not load file or assembly 'Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'. The system cannot find the file specified.

File name: 'Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'
   at System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type)
   at System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
   at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
   at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg)
   at System.Reflection.CustomAttribute.IsCustomAttributeDefined(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, RuntimeType attributeFilterType, Int32 attributeCtorToken, Boolean mustBeInheritable)
   at Newtonsoft.Json.Serialization.DefaultContractResolver.GetSerializableMembers(Type objectType)
   at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateProperties(Type type, MemberSerialization memberSerialization)
   at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateObjectContract(Type objectType)
   at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateContract(Type objectType)
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType)
   at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType)
   at Newtonsoft.Json.JsonConvert.SerializeObjectInternal(Object value, Type type, JsonSerializer jsonSerializer)
   at bitwardenSelfLicensor.Program.GenerateUserLicense(X509Certificate2 cert, String corePath, String userName, String email, Guid userId, String key) in /opt/BitBetter/src/licenseGen/Program.cs:line 175
   at bitwardenSelfLicensor.Program.<>c__DisplayClass0_1.<Main>b__6() in /opt/BitBetter/src/licenseGen/Program.cs:line 75
   at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
   at bitwardenSelfLicensor.Program.Main(String[] args) in /opt/BitBetter/src/licenseGen/Program.cs:line 137

The framework 'Microsoft.NETCore.App', version '2.0.0' was not found.

Hi,
./build.sh failed in step 5.
Step 5/5 : RUN set -e; set -x; dotnet /bitBetter/bitBetter.dll && mv /app/Core.dll /app/Core.orig.dll && mv /app/modified.dll /app/Core.dll && rm -rf /bitBetter && rm -rf /newLicensing.cer
---> Running in bebebdbeef85

  • dotnet /bitBetter/bitBetter.dll
    It was not possible to find any compatible framework version
    The framework 'Microsoft.NETCore.App', version '2.0.0' was not found.
    • The following frameworks were found:
      3.1.2 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]

You can resolve the problem by installing the specified framework and/or SDK.

The specified framework can be found at:

Identity container not running

Followed the instructions using the auto build script and also tried creating my own cert.
Api container seems to run fine but my Identity container just keeps restarting with the below error:

Parameter name: certificate at Microsoft.Extensions.DependencyInjection.IdentityServerBuilderExtensionsCrypto.AddSigningCredential(IIdentityServerBuilder builder, X509Certificate2 certificate) at Bit.Core.Utilities.ServiceCollectionExtensions.AddCustomIdentityServerServices(IServiceCollection services, IHostingEnvironment env, GlobalSettings globalSettings) at Bit.Identity.Startup.ConfigureServices(IServiceCollection services) in /home/appveyor/projects/server/src/Identity/Startup.cs:line 61 --- End of stack trace from previous location where exception was thrown --- at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.ConfigureServices(IServiceCollection services) at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices() at Microsoft.AspNetCore.Hosting.Internal.WebHost.Initialize() at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build() at Bit.Identity.Program.Main(String[] args) in /home/appveyor/projects/server/src/Identity/Program.cs:line 13

Running Bitwarden using Docker on Synology DSM 6.2 (Xpenology)
Any help would be appreciated ๐Ÿ˜Š

cp: cannot create regular file '/jobs/Core.dll': No such file or directory

Alright..

Started again on fresh/clean Debian Stretch system.

I am running ~/BitBetter/build.sh

I am getting this error at the end of the output.

modified dll
cp: cannot create regular file '/jobs/Core.dll': No such file or directory
The command '/bin/sh -c dotnet /bitBetter/bitBetter.dll && echo "modified dll" && mv /app/Core.dll /app/Core.orig.dll && mv /app/modified.dll /app/Core.dll && cp -f /app/Core.dll /jobs/Core.dll && echo "replaced dll" && rm -rf /bitBetter && rm -rf /newLicensing.cer && echo "cleaned up"' returned a non-zero code: 1

I have kept track of every command I have entered.. Hopefully when I have this working we can make a better install manual... ;)

why dot net on linux

not really an issue but I can not manage to install dotnet on my linux 18
=> so no way to test ;)

Invalid license or not supported version

Hi. First of all, thanks for your work.

Unfortunately, i have faced with problem - i have done all actions according to instruction. Compose was changed, identity, api succesfully builded - i saw other issues and double checked it. I succesful run licenseGen/run.sh, provided all information including installation_id from env
i got generated license file.

But this file is not accepted by my self-hosted application. I'm trying to get premium and upload license json - it says that "version 4 is not supported", or if i'm truing to make organization, it says "invalid license".

I am stuck.

dotnet add package Newtonsoft.Json -

I have tryed but

root@security:~/dotnet# dotnet add package Newtonsoft.Json --version 11.0.0
Could not find any project in /root/dotnet/.
Usage: dotnet add package [options] <PACKAGE_NAME>

how to stop accidental deletion from organisation from personnal vault

hi all,

i have noticed when i create an organisation and put stuff in the vault, it saves the stuff to my own personnal vault aswell

is there anyway of stopping this from happening as a user could delete stuff in there perssonal vault and it will replicate the deletetion to the organisation aswell

thanks,
rob

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.