BitBetter icon indicating copy to clipboard operation
BitBetter copied to clipboard

Releasing Docker Image

Open alexyao2015 opened this issue 4 years ago • 15 comments

Are there any harms/dangers to security with releasing a BitBetter image along with the private keys? It appears that the certificate is used solely for licensing which should not impact security.

This would make running the image easier with simply a change to the docker-compose.override.

The same could be said with the license gen.

alexyao2015 avatar Jun 25 '20 15:06 alexyao2015

It shouldn't constitute a security issue, so this is a possibility.

JeffAlyanak avatar Jun 25 '20 18:06 JeffAlyanak

Might not be beneficial in the end, we could easily create a docker image that generates them if they do not excist and the might patch future updates to block a specific key and screw everyone using it over. However releasing docker images should not be too dificult, it just needs weighing against the current setup (we now have an update script since the most recent patches which should solve a lot of issues.

GieltjE avatar Sep 10 '20 19:09 GieltjE

@GieltjE I'll leave this issue open for now as we get some feedback from the new patches and then we can decide from there whether we ought to tackle docker images.

JeffAlyanak avatar Sep 10 '20 20:09 JeffAlyanak

Take a look here. This is setup to automatically update Bitwarden images upon release and has the ability to automatically regenerate certificates if necessary.

alexyao2015 avatar Sep 11 '20 00:09 alexyao2015

I'm not a fan of shared keys, even if they are only for licensing. This would allow anyone to obtain a valid license against someone's public instance with registration enabled - not sure why anyone would do that and it's an unlikely case but regardless it does leave that hole open.

If we do it such that keys are generated and stored on a mounted volume at first run that would avoid such a security issue.

@alexyao2015 nice work with the docker change... perhaps you could adapt your change to do what I've mentioned above instead of carrying a fixed private key, what do you reckon?

captainhook avatar Sep 11 '20 00:09 captainhook

And... Done!

alexyao2015 avatar Sep 11 '20 02:09 alexyao2015

I'm not a fan of shared keys, even if they are only for licensing. This would allow anyone to obtain a valid license against someone's public instance with registration enabled - not sure why anyone would do that and it's an unlikely case but regardless it does leave that hole open.

It's not a security issue, as a registered user has to log in to apply the license and applying the license wouldn't grant them any additional privileges that they didn't already have aside from unlocking features.

There is a minor downside to using unique keys generated at build time. If the user loses their keys after building their instance they'll be unable to generate new licenses without rebuilding their image.

JeffAlyanak avatar Sep 11 '20 08:09 JeffAlyanak

The nice thing about this is there is no need to rebuild the image for certificate replacements. It automatically replaces the certificate at runtime. Either way, there are two different images provided there to satisfy both people.

alexyao2015 avatar Sep 11 '20 08:09 alexyao2015

The nice thing about this is there is no need to rebuild the image for certificate replacements. It automatically replaces the certificate at runtime. Either way, there are two different images provided there to satisfy both people.

It recompiles the Core.dll with the new cert at runtime?

JeffAlyanak avatar Sep 11 '20 08:09 JeffAlyanak

That's correct.

alexyao2015 avatar Sep 11 '20 09:09 alexyao2015

There's no real work to be done anymore. There is nothing manual to do since it is all done automatically now. See here and here

alexyao2015 avatar Sep 19 '20 05:09 alexyao2015

@alexyao2015 can I safely use this, when BitBetter was previously installed and there are organisations already?

sutidor avatar Dec 18 '20 20:12 sutidor

Yep! It will automatically generate and store new certificates in the bwdata folder if you use the custom image. If you are already using BitBetter, you can copy over your existing certificates for a seamless migration. Alternatively, you can use the prebuilt images with public keys and generate your own licenses from there. If you decide to let it generate new certificates, Bitwarden will invalidate any old licenses you have installed. You will then just need to generate and install a new license.

alexyao2015 avatar Dec 18 '20 21:12 alexyao2015

Since I messed up this time... Which keys are the ones to preserve in order to keep licenses intact, bwdata/bitbetter/ ones? Also I suppose that if I run the container once with wrong keys, the orgs are invalidated, even if I restore the correct ones, right?

sutidor avatar Dec 20 '20 19:12 sutidor

It should be in .keys.

The organization itself will not be invalidated. Just the licenses for it. Really not a big deal to start over with new keys. Just need to go in and generate new licenses.

alexyao2015 avatar Dec 20 '20 20:12 alexyao2015

Closed due to inactivity.

h44z avatar Aug 18 '22 19:08 h44z