11 Commits

Author SHA1 Message Date
ElevenNotes
23892c6d0b switch to next branch of kms base image 2025-02-10 10:50:54 +01:00
ElevenNotes
58f22ed34c add DEBUG option 2025-02-07 10:49:24 +01:00
ElevenNotes
63d616adfd chown /opt/py-kms 2025-02-07 10:28:35 +01:00
ElevenNotes
b6f69b4860 remove truncation from clients.html 2025-02-07 10:26:29 +01:00
ElevenNotes
ed3ea34868 add img 2025-02-07 09:24:53 +01:00
ElevenNotes
11cf777dbd new base layer 11notes/kms:${APP_VERSION} 2025-02-07 09:17:38 +01:00
ElevenNotes
70680a384b new base layer 11notes/kms:${APP_VERSION} 2025-02-07 09:17:05 +01:00
ElevenNotes
4b3005630d add custom KMS Database xml 2025-02-07 08:33:11 +01:00
ElevenNotes
6bd0fcdd8a add LICENSE 2025-02-07 08:21:02 +01:00
ElevenNotes
14fd52cc83 add LICENSE 2025-02-07 08:12:02 +01:00
ElevenNotes
58e32a5d1a drop ls 2025-02-06 18:27:54 +01:00
11 changed files with 178 additions and 62 deletions

View File

@@ -1,5 +1,5 @@
.git*
*.md
LICENSE
img/
maintain/
project*

View File

@@ -2,12 +2,19 @@ name: create and publish docker image
on:
workflow_dispatch:
inputs:
release:
description: 'create release or not'
required: false
default: true
type: 'boolean'
push:
tags:
- 'v*'
env:
DOCKER_USERNAME: 11notes
RELEASE: true
jobs:
build-and-push-image:
@@ -36,19 +43,27 @@ jobs:
export LOCAL_SEMVER_MAJOR=$(awk -F. '{ print $1 }' <<< ${json_version})
export LOCAL_SEMVER_MINOR=$(awk -F. '{ print $2 }' <<< ${json_version})
export LOCAL_SEMVER_PATCH=$(awk -F. '{ print $3 }' <<< ${json_version})
export LOCAL_TAGS="${json_image}:latest"
export LOCAL_TAGS="${json_image}:${LOCAL_SHA}"
if [ ! -z ${LOCAL_SEMVER_MAJOR} ]; then LOCAL_TAGS="${LOCAL_TAGS},${json_image}:${LOCAL_SEMVER_MAJOR}"; fi
if [ ! -z ${LOCAL_SEMVER_MINOR} ]; then LOCAL_TAGS="${LOCAL_TAGS},${json_image}:${LOCAL_SEMVER_MAJOR}.${LOCAL_SEMVER_MINOR}"; fi
if [ ! -z ${LOCAL_SEMVER_PATCH} ]; then LOCAL_TAGS="${LOCAL_TAGS},${json_image}:${LOCAL_SEMVER_MAJOR}.${LOCAL_SEMVER_MINOR}.${LOCAL_SEMVER_PATCH}"; fi
if echo "${LOCAL_TAGS}" | grep -q "${json_stable}" ; then LOCAL_TAGS="${LOCAL_TAGS},${json_image}:stable"; fi
if echo "${LOCAL_TAGS}" | grep -q "${json_latest}" ; then LOCAL_TAGS="${LOCAL_TAGS},${json_image}:latest"; fi
if [ ! -z ${json_tags} ]; then SPECIAL_LOCAL_TAGS=$(echo ${json_tags} | sed 's/,/ /g'); for LOCAL_TAG in ${json_tags}; do LOCAL_TAGS="${LOCAL_TAGS},${json_image}:${LOCAL_TAG}"; done; fi
LOCAL_TAGS="${LOCAL_TAGS},${json_image}:${LOCAL_SHA}"
echo "IMAGE_TAGS=${LOCAL_TAGS}" >> $GITHUB_ENV
: # if for whatever reason UID/GID must be changed at build time
echo "IMAGE_UID=${json_uid:-1000}" >> $GITHUB_ENV
echo "IMAGE_GID=${json_gid:-1000}" >> $GITHUB_ENV
: # echo inputs
echo "${{ toJSON(github.event.inputs) }}"
- name: github / disable release
if: ${{ inputs.release != null && inputs.release == false }}
run: |
echo "RELEASE=false" >> $GITHUB_ENV
- name: docker / login to hub
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
with:
@@ -77,6 +92,7 @@ jobs:
APP_ROOT=${{ env.json_root }}
APP_UID=${{ env.IMAGE_UID }}
APP_GID=${{ env.IMAGE_GID }}
NO_CACHE=$(date +%s)
tags: |
${{ env.json_image }}:grype
@@ -87,6 +103,10 @@ jobs:
image: ${{ env.json_image }}:grype
severity-cutoff: high
- name: grype / report / print
if: success() || failure()
run: cat ${{ steps.scan.outputs.sarif }}
- name: grype / delete tag
if: success() || failure()
run: |
@@ -101,9 +121,6 @@ jobs:
with:
sarif_file: ${{ steps.scan.outputs.sarif }}
- name: grype / report / print
run: cat ${{ steps.scan.outputs.sarif }}
- name: docker / build & push
uses: docker/build-push-action@67a2d409c0a876cbe6b11854e3e25193efe4e62d
with:
@@ -122,13 +139,16 @@ jobs:
APP_ROOT=${{ env.json_root }}
APP_UID=${{ env.IMAGE_UID }}
APP_GID=${{ env.IMAGE_GID }}
NO_CACHE=$(date +%s)
tags: |
${{ env.IMAGE_TAGS }}
- name: github / create release notes
if: ${{ env.RELEASE == 'true' && hashFiles('RELEASE.md') != '' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release create ${{ github.ref_name }} -F RELEASE.md
run: |
gh release create ${{ github.ref_name }} -F RELEASE.md
- name: github / update description and set repo defaults
run: |

7
.json
View File

@@ -2,9 +2,10 @@
"image":"11notes/kms-gui",
"description":"Activate any version of Windows and Office, forever",
"name":"kms-gui",
"version":"646f476",
"version":"465f4d1",
"root":"/kms",
"stable":"646f476",
"parent":"11notes/alpine:stable"
"stable":"465f4d1",
"latest":"465f4d1",
"parent":"11notes/kms:465f4d1"
}

21
LICENSE Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020 11notes
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -1,11 +1,11 @@
![Banner](https://github.com/11notes/defaults/blob/main/static/img/banner.png?raw=true)
# 🏔️ kms-gui on Alpine
[<img src="https://img.shields.io/badge/github-source-blue?logo=github&color=040308">](https://github.com/11notes/docker-kms-gui)![size](https://img.shields.io/docker/image-size/11notes/kms-gui/646f476?color=0eb305)![version](https://img.shields.io/docker/v/11notes/kms-gui/646f476?color=eb7a09)![pulls](https://img.shields.io/docker/pulls/11notes/kms-gui?color=2b75d6)[<img src="https://img.shields.io/github/issues/11notes/docker-kms-gui?color=7842f5">](https://github.com/11notes/docker-kms-gui/issues)
[<img src="https://img.shields.io/badge/github-source-blue?logo=github&color=040308">](https://github.com/11notes/docker-kms-gui)![size](https://img.shields.io/docker/image-size/11notes/kms-gui/465f4d1?color=0eb305)![version](https://img.shields.io/docker/v/11notes/kms-gui/465f4d1?color=eb7a09)![pulls](https://img.shields.io/docker/pulls/11notes/kms-gui?color=2b75d6)[<img src="https://img.shields.io/github/issues/11notes/docker-kms-gui?color=7842f5">](https://github.com/11notes/docker-kms-gui/issues)
**Activate any version of Windows and Office, forever**
![slmgr](https://github.com/11notes/docker-kms-gui/blob/main/GUI.png?raw=true)
![GUI](https://github.com/11notes/docker-kms-gui/blob/master/img/GUI.png "Web Interface")
# SYNOPSIS 📖
**What can I do with this?** This image will run a web GUI for your [11notes/kms](https://hub.docker.com/r/11notes/kms) server.
@@ -25,7 +25,7 @@ services:
- "1688:1688/tcp"
restart: always
kms-gui:
image: "11notes/kms-gui:646f476"
image: "11notes/kms-gui:465f4d1"
container_name: "kms-gui"
environment:
TZ: Europe/Zurich
@@ -42,21 +42,21 @@ volumes:
| Parameter | Value | Default |
| --- | --- | --- |
| `TZ` | [Time Zone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) | |
| `DEBUG` | Show debug messages from image **not** app | |
| `DEBUG` | Will activate debug option for container image and app (if available) | |
# SOURCE 💾
* [11notes/kms-gui](https://github.com/11notes/docker-kms-gui)
# PARENT IMAGE 🏛️
* [11notes/alpine:stable](https://hub.docker.com/r/11notes/alpine)
* [11notes/kms:465f4d1](https://hub.docker.com/r/11notes/kms)
# BUILT WITH 🧰
* [py-kms](https://github.com/Py-KMS-Organization/py-kms)
* [alpine](https://alpinelinux.org)
# TIPS 📌
* Use a reverse proxy like Traefik, Nginx, HAproxy to terminate TLS with a valid certificate
* Use Lets Encrypt certificates to protect your SSL endpoints
# GENERAL TIPS 📌
* Use a reverse proxy like Traefik, Nginx, HAproxy to terminate TLS and to protect your endpoints
* Use Lets Encrypt DNS-01 challenge to obtain valid SSL certificates for your services
# ElevenNotes™
This image is provided to you at your own risk. Always make backups before updating an image to a different version. Check the [releases](https://github.com/11notes/docker-kms-gui/releases) for breaking changes. If you have any problems with using this image simply raise an [issue](https://github.com/11notes/docker-kms-gui/issues), thanks . You can find all my repositories on [github](https://github.com/11notes?tab=repositories).
This image is provided to you at your own risk. Always make backups before updating an image to a different version. Check the [releases](https://github.com/11notes/docker-kms-gui/releases) for breaking changes. If you have any problems with using this image simply raise an [issue](https://github.com/11notes/docker-kms-gui/issues), thanks. You can find all my repositories on [github](https://github.com/11notes?tab=repositories).

View File

@@ -1,2 +1,2 @@
### 🪄 Features
* switch to new github workflow and build process
### 🚀 Updates
* switch to next branch of kms base image

View File

@@ -1,31 +1,7 @@
# :: Util
FROM alpine AS util
RUN set -ex; \
apk --no-cache --update add \
git; \
git clone https://github.com/11notes/docker-util.git;
# :: Build / redis
FROM python:3.12-alpine AS build
ARG TARGETARCH
ARG APP_VERSION
USER root
RUN set -ex; \
apk --update --no-cache add \
git; \
mkdir -p /opt/py-kms-gui; \
git clone https://github.com/Py-KMS-Organization/py-kms.git; \
cd /py-kms/py-kms; \
git checkout ${APP_VERSION}; \
cp -R /py-kms/py-kms/* /opt/py-kms-gui; \
cp -R /py-kms/docker/docker-py3-kms/requirements.txt /opt/py-kms-gui;
ARG APP_VERSION=stable
# :: Header
FROM 11notes/alpine:stable
FROM 11notes/kms:${APP_VERSION}
# :: arguments
ARG TARGETARCH
@@ -41,26 +17,28 @@
ENV APP_ROOT=${APP_ROOT}
ENV PYKMS_SQLITE_DB_PATH=/kms/var/kms.db
ENV PYKMS_LICENSE_PATH=/opt/py-kms/LICENSE
ENV PYKMS_VERSION_PATH=/opt/py-kms/VERSION
ENV PORT=8080
ENV LOG_LEVEL=INFO
# :: multi-stage
COPY --from=util /docker-util/src/ /usr/local/bin
COPY --from=build /opt/py-kms-gui/ /opt/py-kms-gui
COPY ./LICENSE /opt/py-kms
# :: Run
USER root
# :: install application
RUN set -ex; \
apk --no-cache --update add \
python3=3.12.8-r1; \
apk --no-cache --update --virtual .build add \
py3-pip;
RUN set -ex; \
mkdir -p ${APP_ROOT}/var; \
cd /opt/py-kms-gui; \
pip3 install --no-cache-dir -r /opt/py-kms-gui/requirements.txt --break-system-packages; \
cd /opt/py-kms; \
echo "${APP_VERSION}" > VERSION; \
echo "master" >> VERSION; \
pip3 install --no-cache-dir -r /opt/py-kms/requirements.gui.txt --break-system-packages; \
apk del --no-network .build;
# :: copy filesystem changes and set correct permissions
@@ -68,13 +46,12 @@
RUN set -ex; \
chmod +x -R /usr/local/bin; \
chown -R 1000:1000 \
${APP_ROOT};
# :: Volumes
VOLUME ["${APP_ROOT}/var"]
/usr/local/bin \
${APP_ROOT} \
/opt/py-kms;
# :: Monitor
HEALTHCHECK --interval=5s --timeout=2s CMD curl -X GET -kILs --fail http://localhost:${PORT} || exit 1
HEALTHCHECK --interval=5s --timeout=2s CMD curl -X GET -kILs --fail http://localhost:${PORT}/livez || exit 1
# :: Start
USER docker

View File

@@ -11,7 +11,7 @@ services:
- "1688:1688/tcp"
restart: always
kms-gui:
image: "11notes/kms-gui:646f476"
image: "11notes/kms-gui:465f4d1"
container_name: "kms-gui"
environment:
TZ: Europe/Zurich

View File

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 52 KiB

View File

@@ -0,0 +1,91 @@
{% extends 'base.html' %}
{% block title %}clients{% endblock %}
{% block style %}
th {
white-space: nowrap;
}
{% endblock %}
{% block content %}
{% if error %}
<article class="message is-danger">
<div class="message-header">
Whoops! Something went wrong...
</div>
<div class="message-body">
{{ error }}
</div>
</article>
{% else %}
<nav class="level">
<div class="level-item has-text-centered">
<div>
<p class="heading">Clients</p>
<p class="title">{{ count_clients }}</p>
</div>
</div>
<div class="level-item has-text-centered">
<div>
<p class="heading">Windows</p>
<p class="title">{{ count_clients_windows }}</p>
</div>
</div>
<div class="level-item has-text-centered">
<div>
<p class="heading">Office</p>
<p class="title">{{ count_clients_office }}</p>
</div>
</div>
<div class="level-item has-text-centered">
<div>
<p class="heading">Products</p>
<p class="title"><a href="/products">{{ count_projects }}</a></p>
</div>
</div>
</nav>
<hr>
{% if clients %}
<table class="table is-striped is-hoverable is-fullwidth">
<thead>
<tr>
<th>Client ID</th>
<th>Machine Name</th>
<th>Application ID</th>
<th><abbr title="Stock Keeping Unit">SKU</abbr> ID</th>
<th>License Status</th>
<th>Last Seen</th>
<th>KMS <abbr title="Enhanced Privacy ID">EPID</abbr></th>
<th>Seen Count</th>
</tr>
</thead>
<tbody>
{% for client in clients %}
<tr>
<th><pre class="clientMachineId">{{ client.clientMachineId }}</pre></th>
<td class="machineName">{{ client.machineName }}</td>
<td>{{ client.applicationId }}</td>
<td>{{ client.skuId }}</td>
<td>{{ client.licenseStatus }}</td>
<td class="convert_timestamp">{{ client.lastRequestTime }}</td>
<td>{{ client.kmsEpid }}</td>
<td>{{ client.requestCount }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<article class="message is-warning">
<div class="message-header">
<p>Whoops?</p>
</div>
<div class="message-body">
This page seems to be empty, because no clients are available. Try to use the server with a compartible client to add it to the database.
</div>
</article>
{% endif %}
{% endif %}
{% endblock %}

View File

@@ -1,10 +1,16 @@
#!/bin/ash
if [ -z "${1}" ]; then
cd /opt/py-kms-gui
ls -lah
if [ ! -z "${DEBUG}" ]; then
LOG_LEVEL="DEBUG"
eleven log debug "setting kms-gui log level to DEBUG"
fi
cd /opt/py-kms
set -- "gunicorn" \
--log-level INFO \
--log-level ${LOG_LEVEL} \
pykms_WebUI:app
eleven log start
fi