From 644d7be16ca995de5cdc28cf1998bae0c146f772 Mon Sep 17 00:00:00 2001 From: simonmicro Date: Tue, 28 May 2024 20:19:17 +0200 Subject: [PATCH 01/29] Revert "Removed all references to Docker Hub after their removal of "Free Team Organizations" -> https://web.docker.com/rs/790-SSB-375/images/privatereposfaq.pdf" This reverts commit 81e9973a40461113887c484173dab5ef6266047b, because they changed their minds. For now... --- .github/workflows/bake_to_latest.yml | 9 +++++++-- .github/workflows/bake_to_next.yml | 9 +++++++-- README.md | 1 + docs/Getting Started.md | 3 +++ 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/workflows/bake_to_latest.yml b/.github/workflows/bake_to_latest.yml index 0d5c8c6..c5c0cba 100644 --- a/.github/workflows/bake_to_latest.yml +++ b/.github/workflows/bake_to_latest.yml @@ -21,6 +21,11 @@ jobs: platforms: all - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1.6.0 + - name: Login to DockerHub + uses: docker/login-action@v1.10.0 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} - name: Login to GitHub Container Registry uses: docker/login-action@v1.10.0 with: @@ -34,7 +39,7 @@ jobs: file: ./docker/docker-py3-kms/Dockerfile platforms: linux/amd64,linux/386,linux/arm64/v8,linux/arm/v7,linux/arm/v6 push: true - tags: ghcr.io/py-kms-organization/py-kms:python3 + tags: pykmsorg/py-kms:python3,ghcr.io/py-kms-organization/py-kms:python3 build-args: | BUILD_COMMIT=${{ github.sha }} BUILD_BRANCH=${{ github.ref_name }} @@ -45,7 +50,7 @@ jobs: file: ./docker/docker-py3-kms-minimal/Dockerfile platforms: linux/amd64,linux/386,linux/arm64/v8,linux/arm/v7,linux/arm/v6 push: true - tags: ghcr.io/py-kms-organization/py-kms:latest,ghcr.io/py-kms-organization/py-kms:minimal + tags: pykmsorg/py-kms:latest,ghcr.io/py-kms-organization/py-kms:latest,pykmsorg/py-kms:minimal,ghcr.io/py-kms-organization/py-kms:minimal build-args: | BUILD_COMMIT=${{ github.sha }} BUILD_BRANCH=${{ github.ref_name }} diff --git a/.github/workflows/bake_to_next.yml b/.github/workflows/bake_to_next.yml index 5fc1b6c..f605731 100644 --- a/.github/workflows/bake_to_next.yml +++ b/.github/workflows/bake_to_next.yml @@ -21,6 +21,11 @@ jobs: platforms: all - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1.6.0 + - name: Login to DockerHub + uses: docker/login-action@v1.10.0 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} - name: Login to GitHub Container Registry uses: docker/login-action@v1.10.0 with: @@ -34,7 +39,7 @@ jobs: file: ./docker/docker-py3-kms/Dockerfile platforms: linux/amd64,linux/386,linux/arm64/v8,linux/arm/v7,linux/arm/v6 push: true - tags: ghcr.io/py-kms-organization/py-kms:python3-next + tags: pykmsorg/py-kms:python3-next,ghcr.io/py-kms-organization/py-kms:python3-next build-args: | BUILD_COMMIT=${{ github.sha }} BUILD_BRANCH=${{ github.ref_name }} @@ -45,7 +50,7 @@ jobs: file: ./docker/docker-py3-kms-minimal/Dockerfile platforms: linux/amd64,linux/386,linux/arm64/v8,linux/arm/v7,linux/arm/v6 push: true - tags: ghcr.io/py-kms-organization/py-kms:latest-next,ghcr.io/py-kms-organization/py-kms:minimal-next + tags: pykmsorg/py-kms:latest-next,ghcr.io/py-kms-organization/py-kms:latest-next,pykmsorg/py-kms:minimal-next,ghcr.io/py-kms-organization/py-kms:minimal-next build-args: | BUILD_COMMIT=${{ github.sha }} BUILD_BRANCH=${{ github.ref_name }} diff --git a/README.md b/README.md index 0ba649e..8eb8138 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ ![repo-size](https://img.shields.io/github/repo-size/Py-KMS-Organization/py-kms) ![open-issues](https://img.shields.io/github/issues/Py-KMS-Organization/py-kms) ![last-commit](https://img.shields.io/github/last-commit/Py-KMS-Organization/py-kms/master) +![docker-pulls](https://img.shields.io/docker/pulls/pykmsorg/py-kms) ![read-the-docs](https://img.shields.io/readthedocs/py-kms) *** diff --git a/docs/Getting Started.md b/docs/Getting Started.md index cb1e43e..54d2b08 100644 --- a/docs/Getting Started.md +++ b/docs/Getting Started.md @@ -5,6 +5,9 @@ What follows are some guides how to start the `pykms_Server.py` script, which pr You can simply manage a daemon that runs as a background process. This can be achieved by using any of the notes below or by writing your own solution. ### Docker +![docker-pulls](https://img.shields.io/docker/pulls/pykmsorg/py-kms) +![docker-size](https://img.shields.io/docker/image-size/pykmsorg/py-kms) + If you wish to get _py-kms_ just up and running without installing any dependencies or writing own scripts: Just use Docker ! Docker also solves problems regarding the explicit IPv4 and IPv6 usage (it just supports both). The following command will download, "install" and start _py-kms_ and also keep it alive after any service disruption. From 4f0b10c704152864cded77fb23f4e2b9bf60ce68 Mon Sep 17 00:00:00 2001 From: simonmicro Date: Tue, 28 May 2024 20:41:04 +0200 Subject: [PATCH 02/29] Formatting Signed-off-by: simonmicro --- py-kms/KmsDataBase.xml | 80 +++++++++++++++++++++--------------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/py-kms/KmsDataBase.xml b/py-kms/KmsDataBase.xml index 511afba..c03cd76 100644 --- a/py-kms/KmsDataBase.xml +++ b/py-kms/KmsDataBase.xml @@ -73,30 +73,30 @@ - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + @@ -454,7 +454,7 @@ - + @@ -591,7 +591,7 @@ - + @@ -605,7 +605,7 @@ - + @@ -871,7 +871,7 @@ - + @@ -997,21 +997,21 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + From 0f58e9bb6fa5bed221dc3224ceba1e7832d02a90 Mon Sep 17 00:00:00 2001 From: simonmicro Date: Tue, 28 May 2024 22:00:11 +0200 Subject: [PATCH 03/29] Added KmsDataBase.xml from @nliaudat He mentioned the new version being available at https://raw.githubusercontent.com/TheFlightSims/windowsserver-mgmttools/2dde6021fb3d0c0d5c76ef2b17315535c67dc62d/vlmcsd-beta/license-manager/KmsDataBase.xml Signed-off-by: simonmicro --- py-kms/KmsDataBase.xml | 545 ++++++++++++++++++++++++++++------------- 1 file changed, 378 insertions(+), 167 deletions(-) diff --git a/py-kms/KmsDataBase.xml b/py-kms/KmsDataBase.xml index c03cd76..ccedad7 100644 --- a/py-kms/KmsDataBase.xml +++ b/py-kms/KmsDataBase.xml @@ -1,10 +1,15 @@ - - + + - - + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + - + @@ -121,14 +223,14 @@ - + - + @@ -150,9 +252,10 @@ + - + @@ -171,7 +274,7 @@ - + @@ -193,7 +296,7 @@ - + @@ -204,7 +307,7 @@ - + @@ -213,7 +316,7 @@ - + @@ -223,7 +326,7 @@ - + @@ -233,9 +336,10 @@ + - + @@ -247,9 +351,10 @@ + - + @@ -260,9 +365,10 @@ + - + @@ -272,7 +378,7 @@ - + @@ -293,21 +399,24 @@ + + + - + @@ -324,7 +433,7 @@ - + @@ -344,14 +453,14 @@ - + - + @@ -360,7 +469,7 @@ - + @@ -375,7 +484,7 @@ - + @@ -392,20 +501,20 @@ - + - + - + @@ -418,7 +527,7 @@ - + @@ -432,15 +541,17 @@ - + + + @@ -448,18 +559,20 @@ + + - + @@ -470,7 +583,7 @@ - + @@ -479,43 +592,45 @@ - + - + - + + - + - + - + + @@ -523,41 +638,45 @@ + + - + - + - + - + + - + + @@ -566,82 +685,99 @@ - + - + + - + + + + - + + + + + - + + - + + - + + - + - + - + + - - - + + + + + - + + - - - - - - - - - - - + + + + + + + + + + + + + @@ -654,7 +790,7 @@ - + @@ -666,34 +802,39 @@ - + + - - - - + + + + + + - + - - + + + + - + - + @@ -702,7 +843,7 @@ - + @@ -716,12 +857,14 @@ - - - - - - + + + + + + + + @@ -741,79 +884,85 @@ - + - + - + - + - + - + - + - + - + - + - + - + + + - + + + + - + - + + @@ -823,21 +972,25 @@ + + + + @@ -845,10 +998,12 @@ + + @@ -856,17 +1011,20 @@ + + + @@ -874,6 +1032,7 @@ + @@ -883,12 +1042,13 @@ - + + - + - + @@ -896,103 +1056,112 @@ - + - + + + - + + - + - - + - + + + + + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - + - + - - + + - + - - + + - + - - - + + + - + - + - + @@ -1014,6 +1183,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From a639486121c07cab78c8d2d8f4224074ab8eecf5 Mon Sep 17 00:00:00 2001 From: simonmicro Date: Tue, 28 May 2024 22:51:12 +0200 Subject: [PATCH 04/29] Added groups to product page Signed-off-by: simonmicro --- py-kms/pykms_WebUI.py | 63 +++++++++++++++++----------------- py-kms/templates/products.html | 36 +++++++++++++------ 2 files changed, 57 insertions(+), 42 deletions(-) diff --git a/py-kms/pykms_WebUI.py b/py-kms/pykms_WebUI.py index 43285a5..06b7d7e 100644 --- a/py-kms/pykms_WebUI.py +++ b/py-kms/pykms_WebUI.py @@ -15,33 +15,34 @@ def _get_serve_count(): return _serve_count _kms_items = None -_kms_items_ignored = None +_kms_items_noglvk = None def _get_kms_items_cache(): - global _kms_items, _kms_items_ignored + global _kms_items, _kms_items_noglvk if _kms_items is None: - _kms_items = {} - _kms_items_ignored = 0 - queue = [kmsDB2Dict()] - while len(queue): - item = queue.pop(0) - if isinstance(item, list): - for i in item: - queue.append(i) - elif isinstance(item, dict): - if 'KmsItems' in item: - queue.append(item['KmsItems']) - elif 'SkuItems' in item: - queue.append(item['SkuItems']) - elif 'Gvlk' in item: - if len(item['Gvlk']): - _kms_items[item['DisplayName']] = item['Gvlk'] - else: - _kms_items_ignored += 1 - #else: - # print(item) - else: - raise NotImplementedError(f'Unknown type: {type(item)}') - return _kms_items, _kms_items_ignored + _kms_items = {} # {group: str -> {product: str -> gvlk: str}} + _kms_items_noglvk = 0 + for section in kmsDB2Dict(): + for element in section: + if "KmsItems" in element: + for product in element["KmsItems"]: + group_name = product["DisplayName"] + items = {} + for item in product["SkuItems"]: + items[item["DisplayName"]] = item["Gvlk"] + if not item["Gvlk"]: + _kms_items_noglvk += 1 + if len(items) == 0: + continue + if group_name not in _kms_items: + _kms_items[group_name] = {} + _kms_items[group_name].update(items) + elif "DisplayName" in element and "BuildNumber" in element and "PlatformId" in element: + pass # these are WinBuilds + elif "DisplayName" in element and "Activate" in element: + pass # these are CsvlkItems + else: + raise NotImplementedError(f'Unknown element: {element}') + return _kms_items, _kms_items_noglvk app = Flask('pykms_webui') app.jinja_env.globals['start_time'] = datetime.datetime.now() @@ -90,7 +91,7 @@ def root(): count_clients=countClients, count_clients_windows=countClientsWindows, count_clients_office=countClientsOffice, - count_projects=len(_get_kms_items_cache()[0]) + count_projects=sum([len(entries) for entries in _get_kms_items_cache()[0].values()]) ), 200 if error is None else 500 @app.route('/readyz') @@ -125,15 +126,15 @@ def license(): @app.route('/products') def products(): _increase_serve_count() - items, ignored = _get_kms_items_cache() - countProducts = len(items) - countProductsWindows = len([i for i in items if 'windows' in i.lower()]) - countProductsOffice = len([i for i in items if 'office' in i.lower()]) + items, noglvk = _get_kms_items_cache() + countProducts = sum([len(entries) for entries in items.values()]) + countProductsWindows = sum([len(entries) for (name, entries) in items.items() if 'windows' in name.lower()]) + countProductsOffice = sum([len(entries) for (name, entries) in items.items() if 'office' in name.lower()]) return render_template( 'products.html', path='/products/', products=items, - filtered=ignored, + filtered=noglvk, count_products=countProducts, count_products_windows=countProductsWindows, count_products_office=countProductsOffice diff --git a/py-kms/templates/products.html b/py-kms/templates/products.html index 9665304..d106ed1 100644 --- a/py-kms/templates/products.html +++ b/py-kms/templates/products.html @@ -32,22 +32,36 @@
+ + +{% for group_name, group_products in products | dictsort %} +

{{ group_name }}

- - + + - {% for name, gvlk in products | dictsort %} - {% if gvlk %} - - - - - {% endif %} - {% endfor %} + {% for name, gvlk in group_products | dictsort %} + + + + + {% endfor %}
NameGVLKNameGVLK
{{ name }}
{{ gvlk }}
{{ name }} + {% if gvlk %} +
{{ gvlk }}
{% endif %} +
-{% endblock %} \ No newline at end of file +{% endfor %} +{% endblock %} From 2ef58649f05ccb56d3ddff66523ec1bd865bcb9f Mon Sep 17 00:00:00 2001 From: simonmicro Date: Tue, 28 May 2024 23:28:55 +0200 Subject: [PATCH 05/29] Use ReleaseDate instead of MinDate Made InvalidWinBuild/NCountPolicy optional Signed-off-by: simonmicro --- py-kms/pykms_Client.py | 2 +- py-kms/pykms_PidGenerator.py | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/py-kms/pykms_Client.py b/py-kms/pykms_Client.py index d2fe1b5..142b316 100644 --- a/py-kms/pykms_Client.py +++ b/py-kms/pykms_Client.py @@ -184,7 +184,7 @@ def client_update(): if sName == name + 'Enterprise' or \ sName == name[:6] + 'ProfessionalPlus' + name[6:]: clt_config['KMSClientSkuID'] = skuitem['Id'] - clt_config['RequiredClientCount'] = int(kmsitem['NCountPolicy']) + clt_config['RequiredClientCount'] = int(kmsitem.get('NCountPolicy', 25)) # if not given default to 25 clt_config['KMSProtocolMajorVersion'] = int(float(kmsitem['DefaultKmsProtocol'])) clt_config['KMSProtocolMinorVersion'] = 0 clt_config['KMSClientLicenseStatus'] = 2 diff --git a/py-kms/pykms_PidGenerator.py b/py-kms/pykms_PidGenerator.py index bf84187..134bfb4 100644 --- a/py-kms/pykms_PidGenerator.py +++ b/py-kms/pykms_PidGenerator.py @@ -20,7 +20,7 @@ def epidGenerator(kmsId, version, lcid): for csvlkitem in csvlkitems: try: if kmsId in [ uuid.UUID(kmsitem) for kmsitem in csvlkitem['Activate'] ]: - pkeys.append( (csvlkitem['GroupId'], csvlkitem['MinKeyId'], csvlkitem['MaxKeyId'], csvlkitem['InvalidWinBuild']) ) + pkeys.append( (csvlkitem['GroupId'], csvlkitem['MinKeyId'], csvlkitem['MaxKeyId'], csvlkitem.get('InvalidWinBuild', '[]')) ) else: # fallback to Windows Server 2019 parameters. pkeys.append( ('206', '551000000', '570999999', '[0,1,2]') ) @@ -40,10 +40,11 @@ def epidGenerator(kmsId, version, lcid): hosts.append(winbuild) except KeyError: # fallback to Windows Server 2019 parameters. - hosts.append( {'BuildNumber':'17763', 'PlatformId':'3612', 'MinDate':'02/10/2018'} ) + hosts.append( {'BuildNumber':'17763', 'PlatformId':'3612', 'ReleaseDate':'2018-10-02T00:00:00Z'} ) host = random.choice(hosts) - BuildNumber, PlatformId, MinDate = host['BuildNumber'], host['PlatformId'], host['MinDate'] + + BuildNumber, PlatformId, ReleaseDate = host['BuildNumber'], host['PlatformId'], host['ReleaseDate'].rstrip("Z") # Generate Part 3 and Part 4: Product Key ID productKeyID = random.randint(MinKeyId, MaxKeyId) @@ -55,7 +56,7 @@ def epidGenerator(kmsId, version, lcid): languageCode = lcid # (C# CultureInfo.InstalledUICulture.LCID) # Generate Part 8: KMS Host Activation Date - d = datetime.datetime.strptime(MinDate, "%d/%m/%Y") + d = datetime.datetime.fromisoformat(ReleaseDate) minTime = datetime.date(d.year, d.month, d.day) # Generate Year and Day Number From 71f31d4fd0ed3495ea165197286643b7cd238032 Mon Sep 17 00:00:00 2001 From: zeroNounours Date: Thu, 27 Jun 2024 09:47:14 +0200 Subject: [PATCH 06/29] Fix Epid generation on linux Maybe related to #3 --- py-kms/pykms_PidGenerator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/py-kms/pykms_PidGenerator.py b/py-kms/pykms_PidGenerator.py index bf84187..1669341 100644 --- a/py-kms/pykms_PidGenerator.py +++ b/py-kms/pykms_PidGenerator.py @@ -59,7 +59,7 @@ def epidGenerator(kmsId, version, lcid): minTime = datetime.date(d.year, d.month, d.day) # Generate Year and Day Number - randomDate = datetime.date.fromtimestamp(random.randint(time.mktime(minTime.timetuple()), time.mktime(datetime.datetime.now().timetuple()))) + randomDate = datetime.date.fromtimestamp(random.randint(int(time.mktime(minTime.timetuple())), int(time.mktime(datetime.datetime.now().timetuple())))) firstOfYear = datetime.date(randomDate.year, 1, 1) randomDayNumber = int((time.mktime(randomDate.timetuple()) - time.mktime(firstOfYear.timetuple())) / 86400 + 0.5) From 9c1a61df19f7932f9728ad25be5f556093e6106b Mon Sep 17 00:00:00 2001 From: "Mr. Rubber Ducky" <79613254+MrRubberDucky@users.noreply.github.com> Date: Wed, 12 Feb 2025 16:27:03 +0100 Subject: [PATCH 07/29] Update KmsDataBase.xml --- py-kms/KmsDataBase.xml | 1605 ++++++++++++++++++---------------------- 1 file changed, 707 insertions(+), 898 deletions(-) diff --git a/py-kms/KmsDataBase.xml b/py-kms/KmsDataBase.xml index 511afba..a88b936 100644 --- a/py-kms/KmsDataBase.xml +++ b/py-kms/KmsDataBase.xml @@ -1,1001 +1,795 @@ - + - - + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + - - - + + + + - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - + + + - - - - - - - - + + + - - - - - - - - - + + + - - - - - - - - - - - + + + - - - - - - - - - - - - - + + + - - - - - - - - - - - - + + + - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - + + + - - - - - + + + - - - + + + - - - + + + - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - + + + - - - - - - + + + - - - - - - - - + + + - - - - - - - - - - - - - - + + + + + + - - - - - - - - - - - - - - - - + + + + + + - - - - - + + + + + + + - - - - - - + + + + + + + - - - - - - - - - - - - + + + + + - - - - - - - - - - - - - + + + + + - - - - + + + + + + - - - + + + + - - - - - - + + + + - - - - - + + + + - - - - + + + + - - - - - - - - - - + + + + - - - - - - - - + + + - - - - - - + + + - - - + + + - - - + + + - - - + + + - - - - - - + + + - - - - - + + + - - - - + + + - - - - - - + + + - - - - - + + + - - - - + + + - - - + - - - + - + + - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - + + + + - - - - + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + - - - - - - - - - - - + + + + + + - - - - - - - - - - - - - + + + + + - - - - - - - - - - + + + + - - - - - - - - - - + + + + - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + - - - - + + + + + - - - - - - + + + + - - - - - + + + + + + + + + + + - - - - - + + + + - - - - + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + - - - + + + + + + + + + + - - - - - - + + + + + + + + + + + + + - - - - - - - - + + + + + + + + + + + - - - - + + + + + + - - - - + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + @@ -1012,8 +806,23 @@ - - + + + + + + + + + + + + + + + + + From e1f2409e8826a52288e77c2a65392bbebe3236df Mon Sep 17 00:00:00 2001 From: "Mr. Rubber Ducky" <79613254+MrRubberDucky@users.noreply.github.com> Date: Wed, 12 Feb 2025 16:27:52 +0100 Subject: [PATCH 08/29] Update KmsDataBase.xml --- py-kms/KmsDataBase.xml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/py-kms/KmsDataBase.xml b/py-kms/KmsDataBase.xml index a88b936..496a8f0 100644 --- a/py-kms/KmsDataBase.xml +++ b/py-kms/KmsDataBase.xml @@ -3,12 +3,7 @@ + + - - + + + + From 525f8e98f899e1efe185489be0eb7aca4b590290 Mon Sep 17 00:00:00 2001 From: "Mr. Rubber Ducky" <79613254+MrRubberDucky@users.noreply.github.com> Date: Wed, 12 Feb 2025 17:55:15 +0100 Subject: [PATCH 10/29] Update based on 2024 Hotbird64 KmsDataBase.xml --- py-kms/KmsDataBase.xml | 964 ++++++++++++++++++++++++----------------- 1 file changed, 577 insertions(+), 387 deletions(-) diff --git a/py-kms/KmsDataBase.xml b/py-kms/KmsDataBase.xml index 5ea991b..3a751b3 100644 --- a/py-kms/KmsDataBase.xml +++ b/py-kms/KmsDataBase.xml @@ -1,16 +1,17 @@ - + + - + + @@ -82,44 +125,267 @@ https://forums.mydigitallife.net/threads/pkeyconfig-info-reader-gui-v8-0-0.88595 --> - - + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -175,77 +441,117 @@ https://forums.mydigitallife.net/threads/pkeyconfig-info-reader-gui-v8-0-0.88595 - - - + + + + + + + - - - + + + + + + + + + + + - - - - + + + + + + - - - - + + + + + + + + + - - + + + + + - - - + + + + + + + + + - + + + + + - + - + + + - + + + + + + + - + @@ -261,7 +567,7 @@ https://forums.mydigitallife.net/threads/pkeyconfig-info-reader-gui-v8-0-0.88595 - + @@ -294,132 +600,115 @@ https://forums.mydigitallife.net/threads/pkeyconfig-info-reader-gui-v8-0-0.88595 - - - - - - + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + - - + - - - - + + + - - + - - - - + + + - - - + + + + - @@ -433,14 +722,14 @@ https://forums.mydigitallife.net/threads/pkeyconfig-info-reader-gui-v8-0-0.88595 - + - + - + @@ -450,144 +739,128 @@ https://forums.mydigitallife.net/threads/pkeyconfig-info-reader-gui-v8-0-0.88595 - + - + + + + + + - - - + - - - - - - - - - - + - - - + + + - + + + + + + - - - - - - - - + - - + + + - - - - - - - - - - - - - + + + + + + + + + - - - - - - - - - - + - + + + + + - - - - - + + - + + + + + - + - - + + + - - - - - - + + + + + - - - - - - - - - + + + + + + - - - + + - - + + - + + @@ -595,206 +868,119 @@ https://forums.mydigitallife.net/threads/pkeyconfig-info-reader-gui-v8-0-0.88595 - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + + + + + + + + + + + + + + + + + + + + - + + + + + - - + - + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - + - + - - + + - + - - + + - + - - - + + + - - + + - + - + + + + - + @@ -808,20 +994,24 @@ https://forums.mydigitallife.net/threads/pkeyconfig-info-reader-gui-v8-0-0.88595 + + + - - - + - - + + + - - + + + + From 628fbc448bd2ee9a965fd2bf923e4d098dc549fe Mon Sep 17 00:00:00 2001 From: "Mr. Rubber Ducky" <79613254+MrRubberDucky@users.noreply.github.com> Date: Wed, 12 Feb 2025 18:28:27 +0100 Subject: [PATCH 11/29] Fix small screw ups --- py-kms/KmsDataBase.xml | 183 ++++++++++++++++++++++++++++------------- 1 file changed, 126 insertions(+), 57 deletions(-) diff --git a/py-kms/KmsDataBase.xml b/py-kms/KmsDataBase.xml index 3a751b3..d0c9d8a 100644 --- a/py-kms/KmsDataBase.xml +++ b/py-kms/KmsDataBase.xml @@ -6,7 +6,7 @@ https://forums.mydigitallife.net/threads/miscellaneous-kms-related-developments. https://github.com/Py-KMS-Organization/py-kms/pulls?q=is%3Apr+is%3Aclosed https://github.com/Py-KMS-Organization/py-kms/issues -Slightly modified for py-kms +Rewrite for later use, needs to be done fully. Documentation about options: - @@ -151,7 +148,7 @@ https://forums.mydigitallife.net/threads/pkeyconfig-info-reader-gui-v8-0-0.88595 - + @@ -177,7 +174,7 @@ https://forums.mydigitallife.net/threads/pkeyconfig-info-reader-gui-v8-0-0.88595 - + @@ -206,7 +203,6 @@ https://forums.mydigitallife.net/threads/pkeyconfig-info-reader-gui-v8-0-0.88595 - @@ -253,7 +249,7 @@ https://forums.mydigitallife.net/threads/pkeyconfig-info-reader-gui-v8-0-0.88595 - + @@ -389,50 +385,143 @@ https://forums.mydigitallife.net/threads/pkeyconfig-info-reader-gui-v8-0-0.88595 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + @@ -518,6 +607,7 @@ https://forums.mydigitallife.net/threads/pkeyconfig-info-reader-gui-v8-0-0.88595 + @@ -582,15 +672,11 @@ https://forums.mydigitallife.net/threads/pkeyconfig-info-reader-gui-v8-0-0.88595 - - - - - + @@ -603,11 +689,7 @@ https://forums.mydigitallife.net/threads/pkeyconfig-info-reader-gui-v8-0-0.88595 - - - + @@ -627,7 +709,6 @@ https://forums.mydigitallife.net/threads/pkeyconfig-info-reader-gui-v8-0-0.88595 - @@ -642,9 +723,7 @@ https://forums.mydigitallife.net/threads/pkeyconfig-info-reader-gui-v8-0-0.88595 - + @@ -656,9 +735,6 @@ https://forums.mydigitallife.net/threads/pkeyconfig-info-reader-gui-v8-0-0.88595 - @@ -744,11 +820,7 @@ https://forums.mydigitallife.net/threads/pkeyconfig-info-reader-gui-v8-0-0.88595 - - - + @@ -826,7 +898,6 @@ https://forums.mydigitallife.net/threads/pkeyconfig-info-reader-gui-v8-0-0.88595
- @@ -846,7 +917,6 @@ https://forums.mydigitallife.net/threads/pkeyconfig-info-reader-gui-v8-0-0.88595 - @@ -859,7 +929,6 @@ https://forums.mydigitallife.net/threads/pkeyconfig-info-reader-gui-v8-0-0.88595 - @@ -869,31 +938,31 @@ https://forums.mydigitallife.net/threads/pkeyconfig-info-reader-gui-v8-0-0.88595 - + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - + From 2a3e3fa1fd24756e272ba6c56ab1f316b25f1b58 Mon Sep 17 00:00:00 2001 From: "Mr. Rubber Ducky" <79613254+MrRubberDucky@users.noreply.github.com> Date: Wed, 12 Feb 2025 18:33:28 +0100 Subject: [PATCH 12/29] Correct PkeyConfig for Server 2022 and 2025 --- py-kms/KmsDataBase.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/py-kms/KmsDataBase.xml b/py-kms/KmsDataBase.xml index d0c9d8a..c6a1443 100644 --- a/py-kms/KmsDataBase.xml +++ b/py-kms/KmsDataBase.xml @@ -204,7 +204,7 @@ https://forums.mydigitallife.net/threads/pkeyconfig-info-reader-gui-v8-0-0.88595
- + From 6119d545df151b7329c8a16612d0f8be3e64d1eb Mon Sep 17 00:00:00 2001 From: "Mr. Rubber Ducky" <79613254+MrRubberDucky@users.noreply.github.com> Date: Wed, 12 Feb 2025 18:35:28 +0100 Subject: [PATCH 13/29] Remove one part that I mistakenly re-added again --- py-kms/KmsDataBase.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/py-kms/KmsDataBase.xml b/py-kms/KmsDataBase.xml index c6a1443..fd53095 100644 --- a/py-kms/KmsDataBase.xml +++ b/py-kms/KmsDataBase.xml @@ -2,11 +2,12 @@ - + - - - + + - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - @@ -553,118 +155,77 @@ https://forums.mydigitallife.net/threads/pkeyconfig-info-reader-gui-v8-0-0.88595 - - - - - - - + + + - - - - - - - - - + - + - - - - - - + + + + - - - - - - - - + + + - - - - - - - - - - - - - - - - + - - - - - + - + + + + + + + - + - - - + - - - - - - - - + @@ -680,7 +241,7 @@ https://forums.mydigitallife.net/threads/pkeyconfig-info-reader-gui-v8-0-0.88595 - + @@ -695,11 +256,15 @@ https://forums.mydigitallife.net/threads/pkeyconfig-info-reader-gui-v8-0-0.88595 + + + + - + @@ -709,90 +274,70 @@ https://forums.mydigitallife.net/threads/pkeyconfig-info-reader-gui-v8-0-0.88595 + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - + + - + - + - - - - - - + + + + + + - + + - - - + + + + @@ -821,14 +366,14 @@ https://forums.mydigitallife.net/threads/pkeyconfig-info-reader-gui-v8-0-0.88595 - + - + - + @@ -838,37 +383,40 @@ https://forums.mydigitallife.net/threads/pkeyconfig-info-reader-gui-v8-0-0.88595 - + - + - + + + - + + + + + + + + + + - + + + - - - - - - - - - - - + - + @@ -888,15 +436,10 @@ https://forums.mydigitallife.net/threads/pkeyconfig-info-reader-gui-v8-0-0.88595 - - - - - + - - + @@ -910,28 +453,29 @@ https://forums.mydigitallife.net/threads/pkeyconfig-info-reader-gui-v8-0-0.88595 - + - + + - - + - + + + + + - - - - + @@ -940,19 +484,19 @@ https://forums.mydigitallife.net/threads/pkeyconfig-info-reader-gui-v8-0-0.88595 - + - - + + - + @@ -961,12 +505,12 @@ https://forums.mydigitallife.net/threads/pkeyconfig-info-reader-gui-v8-0-0.88595 - - - + + + - + @@ -974,105 +518,107 @@ https://forums.mydigitallife.net/threads/pkeyconfig-info-reader-gui-v8-0-0.88595 - + - + + + - - + - + + - + - + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - + - + - - + + - + - - + + - + - - - + + + - - + + - + - + - - - - + @@ -1091,17 +637,17 @@ https://forums.mydigitallife.net/threads/pkeyconfig-info-reader-gui-v8-0-0.88595 - + + + - - - + + - - - + + From dfbf68d221ee36a75580a2c0c116b24c58af4c08 Mon Sep 17 00:00:00 2001 From: "Mr. Rubber Ducky" <79613254+MrRubberDucky@users.noreply.github.com> Date: Wed, 12 Feb 2025 20:10:40 +0100 Subject: [PATCH 16/29] Move Office LTSC 2024 Preview to correct KmsItem --- py-kms/KmsDataBase.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/py-kms/KmsDataBase.xml b/py-kms/KmsDataBase.xml index 01aefab..e166648 100644 --- a/py-kms/KmsDataBase.xml +++ b/py-kms/KmsDataBase.xml @@ -632,9 +632,6 @@ Ported to py-kms - - - @@ -650,6 +647,9 @@ Ported to py-kms + + + From ef73542ffa49a674ff5af509d360c0bd8a13a7ea Mon Sep 17 00:00:00 2001 From: "Mr. Rubber Ducky" <79613254+MrRubberDucky@users.noreply.github.com> Date: Sat, 15 Feb 2025 00:25:05 +0100 Subject: [PATCH 17/29] Add Office 2021+2024 preview, re-add Windows Server Next etc. --- py-kms/KmsDataBase.xml | 293 ++++++++++++++++++++++++++++------------- 1 file changed, 199 insertions(+), 94 deletions(-) diff --git a/py-kms/KmsDataBase.xml b/py-kms/KmsDataBase.xml index e166648..292587f 100644 --- a/py-kms/KmsDataBase.xml +++ b/py-kms/KmsDataBase.xml @@ -1,10 +1,83 @@ + + + @@ -46,7 +119,8 @@ Ported to py-kms - + + @@ -57,6 +131,7 @@ Ported to py-kms + @@ -69,6 +144,7 @@ Ported to py-kms + @@ -81,19 +157,21 @@ Ported to py-kms + - - - - + + + + + @@ -102,6 +180,7 @@ Ported to py-kms + @@ -110,6 +189,7 @@ Ported to py-kms + @@ -118,6 +198,7 @@ Ported to py-kms + @@ -126,30 +207,38 @@ Ported to py-kms - + + - + - + - + + - + - + + + + + + + @@ -203,6 +292,7 @@ Ported to py-kms + @@ -223,11 +313,13 @@ Ported to py-kms + + @@ -240,6 +332,7 @@ Ported to py-kms + @@ -300,7 +393,7 @@ Ported to py-kms - + @@ -308,36 +401,34 @@ Ported to py-kms - + - + - - + - - + + + - - + - - - - + + + @@ -368,12 +459,12 @@ Ported to py-kms - + - + @@ -386,7 +477,18 @@ Ported to py-kms - + + + + + + + + + + + + @@ -395,15 +497,14 @@ Ported to py-kms - - - - - - - - - + + + + + + + + @@ -434,6 +535,14 @@ Ported to py-kms + + + + + + + + @@ -455,24 +564,23 @@ Ported to py-kms - - + + + - - - - - + + + @@ -491,9 +599,9 @@ Ported to py-kms - - + + @@ -510,7 +618,7 @@ Ported to py-kms - + @@ -518,17 +626,15 @@ Ported to py-kms - + - + - - @@ -540,82 +646,78 @@ Ported to py-kms - - + - + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - + - - + + - + - - + + - + - - - - + - + - + + + + @@ -632,19 +734,22 @@ Ported to py-kms + + + - - - - + + + - - + + + From 86634eee250d63af4741cbdc3750543723555d22 Mon Sep 17 00:00:00 2001 From: "Mr. Rubber Ducky" <79613254+MrRubberDucky@users.noreply.github.com> Date: Sat, 15 Feb 2025 00:26:00 +0100 Subject: [PATCH 18/29] Remove missing entry for Office 2016 Pre-Release VL --- py-kms/KmsDataBase.xml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/py-kms/KmsDataBase.xml b/py-kms/KmsDataBase.xml index 292587f..ec54de9 100644 --- a/py-kms/KmsDataBase.xml +++ b/py-kms/KmsDataBase.xml @@ -349,10 +349,6 @@ You can read them using pkeyconfig-gui off MDL forums or Product Key Config. Rea - - - - From b6a99091a8197844bf8469a7b24e15ae825b8264 Mon Sep 17 00:00:00 2001 From: "Mr. Rubber Ducky" <79613254+MrRubberDucky@users.noreply.github.com> Date: Sat, 15 Feb 2025 00:26:57 +0100 Subject: [PATCH 19/29] Remove one leftover comment --- py-kms/KmsDataBase.xml | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/py-kms/KmsDataBase.xml b/py-kms/KmsDataBase.xml index ec54de9..0bc62c6 100644 --- a/py-kms/KmsDataBase.xml +++ b/py-kms/KmsDataBase.xml @@ -363,29 +363,6 @@ You can read them using pkeyconfig-gui off MDL forums or Product Key Config. Rea
- - From a7db498206b61a451ae028c7362bf919f8dfb8b5 Mon Sep 17 00:00:00 2001 From: simonmicro Date: Wed, 29 Oct 2025 18:25:33 +0100 Subject: [PATCH 20/29] Corrected ISO timestamp Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- py-kms/KmsDataBase.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/py-kms/KmsDataBase.xml b/py-kms/KmsDataBase.xml index dbeb7f7..fea1eee 100644 --- a/py-kms/KmsDataBase.xml +++ b/py-kms/KmsDataBase.xml @@ -124,7 +124,7 @@ You can read them using pkeyconfig-gui off MDL forums or Product Key Config. Rea - + From 94419c1a2f6159677d9c6a91f38c58b70b97b0e5 Mon Sep 17 00:00:00 2001 From: simonmicro Date: Sat, 8 Nov 2025 12:56:11 +0100 Subject: [PATCH 21/29] Added more permission hardening Signed-off-by: simonmicro --- docker/docker-py3-kms-minimal/Dockerfile | 7 +++++++ docker/docker-py3-kms/Dockerfile | 7 +++++++ docker/entrypoint.py | 20 +++++++++++++------- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/docker/docker-py3-kms-minimal/Dockerfile b/docker/docker-py3-kms-minimal/Dockerfile index a2d0df9..765be55 100644 --- a/docker/docker-py3-kms-minimal/Dockerfile +++ b/docker/docker-py3-kms-minimal/Dockerfile @@ -35,6 +35,13 @@ COPY docker/healthcheck.py /usr/bin/healthcheck.py COPY docker/start.py /usr/bin/start.py RUN chmod 555 /usr/bin/entrypoint.py /usr/bin/healthcheck.py /usr/bin/start.py +# Additional permission hardening: All files read-only for the executing user +RUN chown root: -R /home/py-kms && \ + chmod 444 -R /home/py-kms && \ + chown py-kms: /home/py-kms && \ + chmod 700 /home/py-kms && \ + find /home/py-kms -type d -print -exec chmod +x {} ';' + WORKDIR /home/py-kms EXPOSE ${PORT}/tcp diff --git a/docker/docker-py3-kms/Dockerfile b/docker/docker-py3-kms/Dockerfile index 16b3ab5..8ab1531 100644 --- a/docker/docker-py3-kms/Dockerfile +++ b/docker/docker-py3-kms/Dockerfile @@ -41,6 +41,13 @@ COPY docker/healthcheck.py /usr/bin/healthcheck.py COPY docker/start.py /usr/bin/start.py RUN chmod 555 /usr/bin/entrypoint.py /usr/bin/healthcheck.py /usr/bin/start.py +# Additional permission hardening: All files read-only for the executing user +RUN chown root: -R /home/py-kms && \ + chmod 444 -R /home/py-kms && \ + chown py-kms: /home/py-kms && \ + chmod 700 /home/py-kms && \ + find /home/py-kms -type d -print -exec chmod +x {} ';' + # Web-interface specifics COPY LICENSE /LICENSE RUN echo "$BUILD_COMMIT" > /VERSION && echo "$BUILD_BRANCH" >> /VERSION diff --git a/docker/entrypoint.py b/docker/entrypoint.py index 8035cd0..80fb347 100755 --- a/docker/entrypoint.py +++ b/docker/entrypoint.py @@ -25,29 +25,35 @@ def change_uid_grp(logger): new_gid = int(os.getenv('GID', str(gid))) new_uid = int(os.getenv('UID', str(uid))) os.chown("/home/py-kms", new_uid, new_gid) - os.chown("/usr/bin/start.py", new_uid, new_gid) + os.chmod("/home/py-kms", 0o700) + os.chmod("/usr/bin/start.py", 0o555) # allow execution by non-root users if os.path.isdir(dbPath): # Corret permissions recursively, as to access the database file, also its parent folder must be accessible - logger.debug(f'Correcting owner permissions on {dbPath}.') + logger.debug(f'Correcting owner permissions on {dbPath}') os.chown(dbPath, new_uid, new_gid) + os.chmod(dbPath, 0o700) # executable bit on dirs to allow interaction for root, dirs, files in os.walk(dbPath): for dName in dirs: dPath = os.path.join(root, dName) - logger.debug(f'Correcting owner permissions on {dPath}.') + logger.debug(f'Correcting owner permissions on {dPath}') os.chown(dPath, new_uid, new_gid) + os.chmod(dPath, 0o700) # executable bit on dirs to allow interaction for fName in files: fPath = os.path.join(root, fName) - logger.debug(f'Correcting owner permissions on {fPath}.') + logger.debug(f'Correcting owner permissions on {fPath}') os.chown(fPath, new_uid, new_gid) + os.chmod(fPath, 0o600) logger.debug(subprocess.check_output(['ls', '-la', dbPath]).decode()) + else: + logger.error(f'Database path {dbPath} is not a directory, will not correct owner permissions.') if 'LOGFILE' in os.environ and os.path.exists(os.environ['LOGFILE']): # Oh, the user also wants a custom log file -> make sure start.py can access it by setting the correct permissions (777) os.chmod(os.environ['LOGFILE'], 0o777) logger.error(str(subprocess.check_output(['ls', '-la', os.environ['LOGFILE']]))) - logger.info("Setting gid to '%s'." % str(new_gid)) + # Drop actual permissions + logger.info(f"Setting gid to {new_gid}") os.setgid(new_gid) - - logger.info("Setting uid to '%s'." % str(new_uid)) + logger.info(f"Setting uid to {new_uid}") os.setuid(new_uid) def change_tz(logger): From c86f24382972ee2de7c2a38c20bb680d9e08b779 Mon Sep 17 00:00:00 2001 From: simonmicro Date: Sat, 8 Nov 2025 12:56:24 +0100 Subject: [PATCH 22/29] Dependency updates Signed-off-by: simonmicro --- docker/docker-py3-kms-minimal/Dockerfile | 4 ++-- docker/docker-py3-kms/Dockerfile | 4 ++-- docker/docker-py3-kms/requirements.txt | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docker/docker-py3-kms-minimal/Dockerfile b/docker/docker-py3-kms-minimal/Dockerfile index 765be55..69bd8d2 100644 --- a/docker/docker-py3-kms-minimal/Dockerfile +++ b/docker/docker-py3-kms-minimal/Dockerfile @@ -1,5 +1,5 @@ # This is a minimized version from docker/docker-py3-kms/Dockerfile without SQLite support to further reduce image size -FROM alpine:3.15 +FROM alpine:3.22 ENV IP :: ENV DUALSTACK 1 @@ -23,7 +23,7 @@ bash \ ca-certificates \ shadow \ tzdata \ - && pip3 install --no-cache-dir -r /home/py-kms/requirements.txt \ + && pip3 install --break-system-packages --no-cache-dir -r /home/py-kms/requirements.txt \ && adduser -S py-kms -G users -s /bin/bash \ && chown py-kms:users /home/py-kms \ # Fix undefined timezone, in case the user did not mount the /etc/localtime diff --git a/docker/docker-py3-kms/Dockerfile b/docker/docker-py3-kms/Dockerfile index 8ab1531..85c6e10 100644 --- a/docker/docker-py3-kms/Dockerfile +++ b/docker/docker-py3-kms/Dockerfile @@ -1,5 +1,5 @@ # Switch to the target image -FROM alpine:3.15 +FROM alpine:3.22 ARG BUILD_COMMIT=unknown ARG BUILD_BRANCH=unknown @@ -28,7 +28,7 @@ RUN apk add --no-cache --update \ ca-certificates \ tzdata \ shadow \ - && pip3 install --no-cache-dir -r /home/py-kms/requirements.txt \ + && pip3 install --break-system-packages --no-cache-dir -r /home/py-kms/requirements.txt \ && mkdir /db/ \ && adduser -S py-kms -G users -s /bin/bash \ && chown py-kms:users /home/py-kms \ diff --git a/docker/docker-py3-kms/requirements.txt b/docker/docker-py3-kms/requirements.txt index 3210657..14b778f 100644 --- a/docker/docker-py3-kms/requirements.txt +++ b/docker/docker-py3-kms/requirements.txt @@ -1,5 +1,5 @@ -dnspython==2.6.1 -tzlocal==4.2 +dnspython==2.8.0 +tzlocal==5.3.1 -Flask==2.3.2 -gunicorn==22.0.0 \ No newline at end of file +Flask==3.1.2 +gunicorn==23.0.0 \ No newline at end of file From 88b5bb47c640b833e7a96f30e719048eaed36630 Mon Sep 17 00:00:00 2001 From: simonmicro Date: Sat, 8 Nov 2025 13:00:55 +0100 Subject: [PATCH 23/29] Updated all workflow jobs Signed-off-by: simonmicro --- .github/workflows/bake_to_latest.yml | 10 +++++----- .github/workflows/bake_to_next.yml | 10 +++++----- .github/workflows/bake_to_test.yml | 12 ++++++------ 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/bake_to_latest.yml b/.github/workflows/bake_to_latest.yml index c5c0cba..e15096f 100644 --- a/.github/workflows/bake_to_latest.yml +++ b/.github/workflows/bake_to_latest.yml @@ -14,13 +14,13 @@ jobs: contents: read steps: - name: Checkout - uses: actions/checkout@v2.3.4 + uses: actions/checkout@v5 - name: Set up QEMU - uses: docker/setup-qemu-action@v1 + uses: docker/setup-qemu-action@v3 with: platforms: all - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1.6.0 + uses: docker/setup-buildx-action@v3 - name: Login to DockerHub uses: docker/login-action@v1.10.0 with: @@ -33,7 +33,7 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v6 with: context: . file: ./docker/docker-py3-kms/Dockerfile @@ -44,7 +44,7 @@ jobs: BUILD_COMMIT=${{ github.sha }} BUILD_BRANCH=${{ github.ref_name }} - name: Build - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v6 with: context: . file: ./docker/docker-py3-kms-minimal/Dockerfile diff --git a/.github/workflows/bake_to_next.yml b/.github/workflows/bake_to_next.yml index f605731..481095a 100644 --- a/.github/workflows/bake_to_next.yml +++ b/.github/workflows/bake_to_next.yml @@ -14,13 +14,13 @@ jobs: contents: read steps: - name: Checkout - uses: actions/checkout@v2.3.4 + uses: actions/checkout@v5 - name: Set up QEMU - uses: docker/setup-qemu-action@v1 + uses: docker/setup-qemu-action@v3 with: platforms: all - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1.6.0 + uses: docker/setup-buildx-action@v3 - name: Login to DockerHub uses: docker/login-action@v1.10.0 with: @@ -33,7 +33,7 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v6 with: context: . file: ./docker/docker-py3-kms/Dockerfile @@ -44,7 +44,7 @@ jobs: BUILD_COMMIT=${{ github.sha }} BUILD_BRANCH=${{ github.ref_name }} - name: Build - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v6 with: context: . file: ./docker/docker-py3-kms-minimal/Dockerfile diff --git a/.github/workflows/bake_to_test.yml b/.github/workflows/bake_to_test.yml index 2790ba4..1e1878e 100644 --- a/.github/workflows/bake_to_test.yml +++ b/.github/workflows/bake_to_test.yml @@ -9,15 +9,15 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2.3.4 + uses: actions/checkout@v5 - name: Set up QEMU - uses: docker/setup-qemu-action@v1 + uses: docker/setup-qemu-action@v3 with: platforms: all - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1.6.0 + uses: docker/setup-buildx-action@v3 - name: Build - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v6 with: context: . file: ./docker/docker-py3-kms/Dockerfile @@ -27,7 +27,7 @@ jobs: BUILD_COMMIT=${{ github.sha }} BUILD_BRANCH=${{ github.ref_name }} - name: Build - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v6 with: context: . file: ./docker/docker-py3-kms-minimal/Dockerfile @@ -35,4 +35,4 @@ jobs: push: false build-args: | BUILD_COMMIT=${{ github.sha }} - BUILD_BRANCH=${{ github.ref_name }} \ No newline at end of file + BUILD_BRANCH=${{ github.ref_name }} From fc4f6b37e010fb9d3fb13fcc963883334a01c6bc Mon Sep 17 00:00:00 2001 From: simonmicro Date: Sat, 8 Nov 2025 13:04:01 +0100 Subject: [PATCH 24/29] New job labels Signed-off-by: simonmicro --- .github/workflows/bake_to_latest.yml | 4 ++-- .github/workflows/bake_to_next.yml | 4 ++-- .github/workflows/bake_to_test.yml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/bake_to_latest.yml b/.github/workflows/bake_to_latest.yml index e15096f..73a8c25 100644 --- a/.github/workflows/bake_to_latest.yml +++ b/.github/workflows/bake_to_latest.yml @@ -32,7 +32,7 @@ jobs: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Build + - name: Build (full) uses: docker/build-push-action@v6 with: context: . @@ -43,7 +43,7 @@ jobs: build-args: | BUILD_COMMIT=${{ github.sha }} BUILD_BRANCH=${{ github.ref_name }} - - name: Build + - name: Build (minimal) uses: docker/build-push-action@v6 with: context: . diff --git a/.github/workflows/bake_to_next.yml b/.github/workflows/bake_to_next.yml index 481095a..99032e0 100644 --- a/.github/workflows/bake_to_next.yml +++ b/.github/workflows/bake_to_next.yml @@ -32,7 +32,7 @@ jobs: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Build + - name: Build (full) uses: docker/build-push-action@v6 with: context: . @@ -43,7 +43,7 @@ jobs: build-args: | BUILD_COMMIT=${{ github.sha }} BUILD_BRANCH=${{ github.ref_name }} - - name: Build + - name: Build (minimal) uses: docker/build-push-action@v6 with: context: . diff --git a/.github/workflows/bake_to_test.yml b/.github/workflows/bake_to_test.yml index 1e1878e..72fc196 100644 --- a/.github/workflows/bake_to_test.yml +++ b/.github/workflows/bake_to_test.yml @@ -16,7 +16,7 @@ jobs: platforms: all - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Build + - name: Build (full) uses: docker/build-push-action@v6 with: context: . @@ -26,7 +26,7 @@ jobs: build-args: | BUILD_COMMIT=${{ github.sha }} BUILD_BRANCH=${{ github.ref_name }} - - name: Build + - name: Build (minimal) uses: docker/build-push-action@v6 with: context: . From 7098a455c3dff5a52fd443325daece0e1a07dcd4 Mon Sep 17 00:00:00 2001 From: simonmicro Date: Sat, 8 Nov 2025 13:08:00 +0100 Subject: [PATCH 25/29] Typo Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- docker/entrypoint.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/entrypoint.py b/docker/entrypoint.py index 80fb347..0323a85 100755 --- a/docker/entrypoint.py +++ b/docker/entrypoint.py @@ -28,7 +28,7 @@ def change_uid_grp(logger): os.chmod("/home/py-kms", 0o700) os.chmod("/usr/bin/start.py", 0o555) # allow execution by non-root users if os.path.isdir(dbPath): - # Corret permissions recursively, as to access the database file, also its parent folder must be accessible + # Correct permissions recursively, as to access the database file, also its parent folder must be accessible logger.debug(f'Correcting owner permissions on {dbPath}') os.chown(dbPath, new_uid, new_gid) os.chmod(dbPath, 0o700) # executable bit on dirs to allow interaction From af78d24b94074027d272bc2944586d3d5b030712 Mon Sep 17 00:00:00 2001 From: simonmicro Date: Sat, 8 Nov 2025 13:08:32 +0100 Subject: [PATCH 26/29] As the code continues regardless, only show a warning Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- docker/entrypoint.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/entrypoint.py b/docker/entrypoint.py index 0323a85..b4f77ea 100755 --- a/docker/entrypoint.py +++ b/docker/entrypoint.py @@ -45,7 +45,7 @@ def change_uid_grp(logger): os.chmod(fPath, 0o600) logger.debug(subprocess.check_output(['ls', '-la', dbPath]).decode()) else: - logger.error(f'Database path {dbPath} is not a directory, will not correct owner permissions.') + logger.warning(f'Database path {dbPath} is not a directory, will not correct owner permissions.') if 'LOGFILE' in os.environ and os.path.exists(os.environ['LOGFILE']): # Oh, the user also wants a custom log file -> make sure start.py can access it by setting the correct permissions (777) os.chmod(os.environ['LOGFILE'], 0o777) From 6b6fb3513f728e0b948585da667e143e47a303da Mon Sep 17 00:00:00 2001 From: simonmicro Date: Sat, 8 Nov 2025 13:15:23 +0100 Subject: [PATCH 27/29] Fix RTD Signed-off-by: simonmicro --- .readthedocs.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index e962b25..51107d5 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -1,12 +1,15 @@ version: 2 build: - os: "ubuntu-22.04" + os: "ubuntu-24.04" tools: - python: "3.10" + python: "3.12" python: install: - requirements: docs/requirements.txt +sphinx: + configuration: docs/conf.py + formats: all From d1660687217f02d69ebe5fe0e21c374b52fbb7b8 Mon Sep 17 00:00:00 2001 From: simonmicro Date: Sat, 8 Nov 2025 13:39:34 +0100 Subject: [PATCH 28/29] Addressed changed key format, as noted in https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/ Signed-off-by: simonmicro --- docker/docker-py3-kms-minimal/Dockerfile | 24 ++++++++++---------- docker/docker-py3-kms/Dockerfile | 28 ++++++++++++------------ 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/docker/docker-py3-kms-minimal/Dockerfile b/docker/docker-py3-kms-minimal/Dockerfile index 69bd8d2..1807b37 100644 --- a/docker/docker-py3-kms-minimal/Dockerfile +++ b/docker/docker-py3-kms-minimal/Dockerfile @@ -1,19 +1,19 @@ # This is a minimized version from docker/docker-py3-kms/Dockerfile without SQLite support to further reduce image size FROM alpine:3.22 -ENV IP :: -ENV DUALSTACK 1 -ENV PORT 1688 -ENV EPID "" -ENV LCID 1033 -ENV CLIENT_COUNT 26 -ENV ACTIVATION_INTERVAL 120 -ENV RENEWAL_INTERVAL 10080 +ENV IP=:: +ENV DUALSTACK=1 +ENV PORT=1688 +ENV EPID="" +ENV LCID=1033 +ENV CLIENT_COUNT=26 +ENV ACTIVATION_INTERVAL=120 +ENV RENEWAL_INTERVAL=10080 ENV HWID RANDOM -ENV LOGLEVEL INFO -ENV LOGFILE STDOUT -ENV LOGSIZE "" -ENV WEBUI 0 +ENV LOGLEVEL=INFO +ENV LOGFILE=STDOUT +ENV LOGSIZE="" +ENV WEBUI=0 COPY docker/docker-py3-kms-minimal/requirements.txt /home/py-kms/requirements.txt RUN apk add --no-cache --update \ diff --git a/docker/docker-py3-kms/Dockerfile b/docker/docker-py3-kms/Dockerfile index 85c6e10..547171b 100644 --- a/docker/docker-py3-kms/Dockerfile +++ b/docker/docker-py3-kms/Dockerfile @@ -4,20 +4,20 @@ FROM alpine:3.22 ARG BUILD_COMMIT=unknown ARG BUILD_BRANCH=unknown -ENV IP :: -ENV DUALSTACK 1 -ENV PORT 1688 -ENV EPID "" -ENV LCID 1033 -ENV CLIENT_COUNT 26 -ENV ACTIVATION_INTERVAL 120 -ENV RENEWAL_INTERVAL 10080 -ENV HWID RANDOM -ENV LOGLEVEL INFO -ENV LOGFILE STDOUT -ENV LOGSIZE "" -ENV TZ America/Chicago -ENV WEBUI 1 +ENV IP=:: +ENV DUALSTACK=1 +ENV PORT=1688 +ENV EPID="" +ENV LCID=1033 +ENV CLIENT_COUNT=26 +ENV ACTIVATION_INTERVAL=120 +ENV RENEWAL_INTERVAL=10080 +ENV HWID=RANDOM +ENV LOGLEVEL=INFO +ENV LOGFILE=STDOUT +ENV LOGSIZE="" +ENV TZ=America/Chicago +ENV WEBUI=1 COPY docker/docker-py3-kms/requirements.txt /home/py-kms/ RUN apk add --no-cache --update \ From d006e2e587ae7748b4f425754e43df8807d064ae Mon Sep 17 00:00:00 2001 From: simonmicro Date: Sat, 8 Nov 2025 13:41:17 +0100 Subject: [PATCH 29/29] Removed duplicate perm-setting (already part of Dockerfile) Signed-off-by: simonmicro --- docker/entrypoint.py | 1 - 1 file changed, 1 deletion(-) diff --git a/docker/entrypoint.py b/docker/entrypoint.py index b4f77ea..b564966 100755 --- a/docker/entrypoint.py +++ b/docker/entrypoint.py @@ -26,7 +26,6 @@ def change_uid_grp(logger): new_uid = int(os.getenv('UID', str(uid))) os.chown("/home/py-kms", new_uid, new_gid) os.chmod("/home/py-kms", 0o700) - os.chmod("/usr/bin/start.py", 0o555) # allow execution by non-root users if os.path.isdir(dbPath): # Correct permissions recursively, as to access the database file, also its parent folder must be accessible logger.debug(f'Correcting owner permissions on {dbPath}')