diff --git a/.env.sample b/.env.sample index 0fd8b31..a157557 100644 --- a/.env.sample +++ b/.env.sample @@ -29,3 +29,4 @@ LETS_ENCRYPT_ENV=production SECRET_SECRET_KEY_VERSION=v1 SECRET_JWT_KEY_VERSION=v1 +# COMPOSE_FILE="$COMPOSE_FILE:compose.license.yml" diff --git a/README.md b/README.md index e85263b..c918fe5 100644 --- a/README.md +++ b/README.md @@ -27,5 +27,13 @@ * For environments with 2GB or less RAM, run `abra app config ` and uncomment the `For low-resource machines` config block * More info: https://hub.docker.com/r/baserow/baserow/#scaling-options +## Baserow Crack + +* `abra app config `. Uncomment the final line of the config `# COMPOSE_FILE="$COMPOSE_FILE:compose.license.yml"` +* `abra app undeploy ` +* `abra app deploy ` +* Navigate to the admin panel -> manage licenses. Click Register License and type in any string. An enterprise without support license should be given. +* Refresh the page to access features! + For more, see [`docs.coopcloud.tech`](https://docs.coopcloud.tech). diff --git a/abra.sh b/abra.sh index 6d93447..253b82d 100644 --- a/abra.sh +++ b/abra.sh @@ -1 +1,3 @@ -export PG_BACKUP_CONFIG_VERSION=v1 \ No newline at end of file +export PG_BACKUP_CONFIG_VERSION=v1 +export ENTRYPOINT_VERSION=v1 +export LICENSE_FIX_VERSION=v1 diff --git a/compose.license.yml b/compose.license.yml new file mode 100644 index 0000000..a18d37c --- /dev/null +++ b/compose.license.yml @@ -0,0 +1,23 @@ +--- +version: "3.8" + +services: + app: + configs: + - source: entrypoint + target: /entrypoint.sh + mode: 0555 + - source: license_fix + target: /baserow/license-fix.patch + mode: 0644 + entrypoint: + /entrypoint.sh + +configs: + license_fix: + name: ${STACK_NAME}_license_fix_${LICENSE_FIX_VERSION} + file: license-fix.patch + entrypoint: + name: ${STACK_NAME}_entrypoint_${ENTRYPOINT_VERSION} + file: entrypoint.sh.tmpl + template_driver: golang \ No newline at end of file diff --git a/compose.yml b/compose.yml index 3b21ad5..cba70d0 100644 --- a/compose.yml +++ b/compose.yml @@ -3,7 +3,7 @@ version: "3.8" services: app: - image: baserow/baserow:2.0.5 + image: baserow/baserow:2.3.0 networks: - proxy environment: @@ -33,7 +33,7 @@ services: - "backupbot.backup.pre-hook=/backup.sh pre-backup" - "backupbot.backup.post-hook=/backup.sh post-backup" - "backupbot.restore.post-hook=/backup.sh post-restore" - - "coop-cloud.${STACK_NAME}.version=2.0.0+2.0.5" + - "coop-cloud.${STACK_NAME}.version=2.2.0+2.3.0" healthcheck: test: ["CMD", "./baserow.sh", "backend-cmd", "backend-healthcheck"] interval: 30s diff --git a/entrypoint.sh.tmpl b/entrypoint.sh.tmpl new file mode 100644 index 0000000..10efb65 --- /dev/null +++ b/entrypoint.sh.tmpl @@ -0,0 +1,7 @@ +#!/bin/bash + +cd baserow +patch -p1 < license-fix.patch +cd .. + +/baserow.sh start "$@" \ No newline at end of file diff --git a/license-fix.patch b/license-fix.patch new file mode 100644 index 0000000..de5ecfb --- /dev/null +++ b/license-fix.patch @@ -0,0 +1,82 @@ +diff --git a/premium/backend/src/baserow_premium/license/handler.py b/premium/backend/src/baserow_premium/license/handler.py +index dea20281e..70448036b 100755 +--- a/premium/backend/src/baserow_premium/license/handler.py ++++ b/premium/backend/src/baserow_premium/license/handler.py +@@ -381,7 +381,7 @@ class LicenseHandler: + :param license_objects: The license objects that must be checked + :return: The updated license objects. + """ +- ++ return license_objects + try: + authority_response = ( + cls.send_license_info_and_fetch_license_status_with_authority( +@@ -474,7 +474,13 @@ class LicenseHandler: + :raises LicenseHasExpiredError: When the license has expired. + :return: The created license instance. + """ +- ++ obj = License( ++ license="", ++ last_check=None, ++ cached_untrusted_instance_wide=True ++ ) ++ obj.save() ++ return obj + if not requesting_user.is_staff: + raise IsNotAdminError() + +diff --git a/premium/backend/src/baserow_premium/license/models.py b/premium/backend/src/baserow_premium/license/models.py +index f0d8d08d9..2184c759d 100644 +--- a/premium/backend/src/baserow_premium/license/models.py ++++ b/premium/backend/src/baserow_premium/license/models.py +@@ -35,7 +35,23 @@ class License(models.Model): + @cached_property + def payload(self): + from .handler import LicenseHandler +- ++ return { ++ "id": 0, ++ "license_id": "", ++ "is_active": True, ++ "last_check": None, ++ "valid_from": "2023-01-01T00:00:00Z", ++ "valid_through": "2100-01-01T00:00:00Z", ++ "free_users_count": 100000, ++ "seats_taken": 0, ++ "seats": 100000, ++ "application_users_taken": 0, ++ "application_users": 0, ++ "product_code": "enterprise_without_support", ++ "issued_on": "2023-01-01T00:00:00Z", ++ "issued_to_name": "", ++ "issued_to_email": "", ++ } + possibly_encoded_license = self.license + if isinstance(possibly_encoded_license, str): + encoded_license = possibly_encoded_license.encode() +@@ -61,7 +77,6 @@ class License(models.Model): + An active license is one which is valid right now and has valid cached + properties which haven't been manipulated. + """ +- + return ( + self.valid_from <= datetime.now(tz=timezone.utc) <= self.valid_through + and self.valid_cached_properties +@@ -87,7 +102,7 @@ class License(models.Model): + decoded properties from the signed license. If they don't match then manual + changes have been made to the cached properties. + """ +- ++ return True + return self.cached_untrusted_instance_wide == self.license_type.instance_wide + + @property +@@ -118,7 +133,6 @@ class License(models.Model): + @property + def license_type(self): + from baserow_premium.license.registries import license_type_registry +- + return license_type_registry.get(self.product_code) + +