mirror of
https://github.com/Jamesits/pve-fake-subscription
synced 2025-12-07 11:36:59 -05:00
Merge 1a12a0aefd into 31cd2b8746
This commit is contained in:
commit
179f8c6fa0
39
.github/workflows/main.yml
vendored
Normal file
39
.github/workflows/main.yml
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
name: Build and release package
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build and release package
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
outputs:
|
||||
package_version: ${{ steps.get_version.outputs.PACKAGE_VERSION }}
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
id: checkout_repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Build package
|
||||
id: build_package
|
||||
uses: jtdor/build-deb-action@v1
|
||||
env:
|
||||
DEB_BUILD_OPTIONS: noautodbgsym
|
||||
with:
|
||||
buildpackage-opts: -us -uc -b
|
||||
|
||||
- name: Get package version
|
||||
id: get_version
|
||||
run: echo "PACKAGE_VERSION=$(echo debian/artifacts/fake-proxmox-subscription_*_all.deb | awk -F'[_]' '{ print $2 }')" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Publish release
|
||||
id: publish_release
|
||||
uses: ncipollo/release-action@v1
|
||||
if: github.ref_type == 'tag'
|
||||
with:
|
||||
name: v${{ steps.get_version.outputs.package_version }}
|
||||
artifacts: debian/artifacts/fake-proxmox-subscription_${{ steps.get_version.outputs.package_version }}_all.deb
|
||||
8
.gitignore
vendored
8
.gitignore
vendored
@ -1,5 +1,9 @@
|
||||
*.deb
|
||||
/out/
|
||||
# Debian packaging files
|
||||
debian/*.debhelper*
|
||||
debian/fake-proxmox-subscription/
|
||||
debian/debhelper-build-stamp
|
||||
debian/fake-proxmox-subscription.substvars
|
||||
debian/files
|
||||
|
||||
# Created by https://www.gitignore.io/api/macos,python,windows,visualstudiocode
|
||||
# Edit at https://www.gitignore.io/?templates=macos,python,windows,visualstudiocode
|
||||
|
||||
14
Dockerfile
Normal file
14
Dockerfile
Normal file
@ -0,0 +1,14 @@
|
||||
FROM docker.io/library/debian:stable-slim AS base
|
||||
|
||||
ENV FOLDER=/opt/fake-proxmox-subscription
|
||||
|
||||
WORKDIR /opt/fake-proxmox-subscription
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends build-essential debhelper dpkg-dev
|
||||
|
||||
COPY . $FOLDER
|
||||
|
||||
RUN dpkg-buildpackage -us -uc -b
|
||||
RUN mkdir debian/artifacts
|
||||
RUN mv /opt/fake-proxmox-subscription_* $FOLDER/debian/artifacts/
|
||||
2
LICENSE
2
LICENSE
@ -23,4 +23,4 @@ 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.
|
||||
|
||||
Good luck and Godspeed.
|
||||
Good luck and Godspeed.
|
||||
|
||||
143
README.md
143
README.md
@ -1,98 +1,91 @@
|
||||
# pve-fake-subscription
|
||||
## fake-proxmox-subscription
|
||||
A Debian package that disables the "No valid subscription" dialog on all
|
||||
Proxmox products (in theory), regardless of their version.
|
||||
|
||||

|
||||
Based on [Jamesits/fake-pve-subscription][1]'s work. There are a few key
|
||||
differences between his repository and this repository:
|
||||
|
||||
Disables the "No valid subscription" dialog on all Proxmox products.
|
||||
1. The name `pve-fake-subscription` has been replaced with
|
||||
`fake-proxmox-subscription`. This should have been done in the first place
|
||||
since the package covers all 3 Proxmox products.
|
||||
2. Added proper Debian packaging so that `dpkg-buildpackage` could be used
|
||||
instead of `nFPM` nonsense.
|
||||
3. Added GitHub Actions workflow to build and then publish `.deb` packages.
|
||||
|
||||
> I am really poor and I can't afford a license. I just want to get rid of the annoying dialog.
|
||||
The 3rd point above is the most critical change here. This is because you
|
||||
wouldn't download and install a .deb that you can't verify has not been
|
||||
altered with, would you?
|
||||
|
||||
## Features
|
||||
|
||||
Works for:
|
||||
|
||||
- Proxmox VE (5.x or later; 3.x and 4.x [require some manual actions](#compatibility-information-for-old-proxmox-ve-versions))
|
||||
### Features
|
||||
This package should work and patch:
|
||||
- Proxmox VE (5.x or later - 3.x and 4.x requires some manual actions)
|
||||
- Proxmox Mail Gateway (5.x or later)
|
||||
- Proxmox Backup Server (1.x or later)
|
||||
|
||||
Highlights:
|
||||
What this package does is:
|
||||
1. **Non-Intrusive**: Performs 0 modifications to the system files.
|
||||
2. **Future-Proof**: Requires no adjustments between system updates & major
|
||||
upgrades.
|
||||
3. **Hassle-Free**: Install (or uninstall) with ease.
|
||||
4. **Debian-ized**: `fake-proxmox-license` is delivered as a proper Debian
|
||||
package, fresh from GitHub CI/CD to provide transparency and automation.
|
||||
5. **Fuck JavaScript**: No JavaScript is involved in the whole process, because
|
||||
fuck JavaScript.
|
||||
|
||||
- Non-intrusive: zero modification of any system file
|
||||
- Future-proof: persists between system updates & major upgrades
|
||||
- Hassle-free: you can uninstall at any time
|
||||
- Comes with standard Debian package, easy to manage and automate
|
||||
- **No JavaScript is involved** in the whole process, as I believe JavaScript is harmful to developers
|
||||
### Usage
|
||||
#### Installation
|
||||
Download the [latest `.deb`][2] file from the [releases][2] page and install it
|
||||
with `apt` or `apt-get`:
|
||||
|
||||
## Usage
|
||||
|
||||
### Installation
|
||||
|
||||
1. [Download the latest release](https://github.com/Jamesits/pve-fake-subscription/releases/latest)
|
||||
1. Install: run `dpkg -i pve-fake-subscription_*.deb` as root on every node
|
||||
1. (Optional) `echo "127.0.0.1 shop.maurer-it.com" | sudo tee -a /etc/hosts` to prevent fake keys from being checked against the Proxmox servers
|
||||
|
||||
Notes:
|
||||
|
||||
After installation, please refrain yourself from clicking the "check" button on the "Subscription" page. It will invalidate the cache and temporary revert your instance into an unlicensed status.
|
||||
|
||||
The fake subscription status doesn't grant you free access to the enterprise repository. You should switch to the no-subscription repository if not already done. Use the following method:
|
||||
|
||||
- [Proxmox VE (PVE)](https://pve.proxmox.com/wiki/Package_Repositories#sysadmin_no_subscription_repo)
|
||||
- [Proxmox Mail Gateway (PMG)](https://pmg.proxmox.com/pmg-docs/pmg-admin-guide.html#pmg_package_repositories)
|
||||
- [Proxmox Backup Server (PBS)](https://pbs.proxmox.com/docs/installation.html#proxmox-backup-no-subscription-repository)
|
||||
```
|
||||
# curl -s https://api.github.com/repos/arszilla/fake-proxmox-subscription/releases/latest | grep "browser_download_url.*deb" | cut -d : -f 2,3 | tr -d \" | wget -i - -O fake-proxmox-subscription.deb
|
||||
# apt install ./fake-proxmox-subscription.deb
|
||||
```
|
||||
|
||||
### Uninstallation
|
||||
To uninstall, run `apt` or `apt-get` with the `remove` flag and the package
|
||||
name:
|
||||
|
||||
Run as root:
|
||||
|
||||
```shell
|
||||
apt purge pve-fake-subscription
|
||||
```
|
||||
# apt remove fake-proxmox-subscription
|
||||
```
|
||||
|
||||
This will revert your system to a "no subscription key" status.
|
||||
### Build It Yourself
|
||||
You can easily build the package yourself, assuming you have a *Debian*-based
|
||||
system:
|
||||
|
||||
## Development Notes
|
||||
|
||||
### Building the Package
|
||||
|
||||
Install [nFPM](https://nfpm.goreleaser.com/install/), then:
|
||||
|
||||
```shell
|
||||
./package.sh
|
||||
```
|
||||
$ sudo apt-get update
|
||||
$ sudo apt-get install -y --no-install-recommends build-essential debhelper dpkg-dev
|
||||
$ git clone https://github.com/Arszilla/fake-proxmox-subscription
|
||||
$ cd fake-proxmox-subscription/
|
||||
$ dpkg-buildpackage -us -uc -b
|
||||
$ ls -al ../fake-proxmox-subscription_*
|
||||
```
|
||||
|
||||
### Compatibility Information for Old Proxmox VE Versions
|
||||
While at it, you can view and validate the contents of your newly built `.deb`:
|
||||
|
||||
#### PVE 4.x
|
||||
|
||||
After installation or updates, run:
|
||||
```shell
|
||||
sed -i'' -e's/pve8p/pve4p/g' /usr/bin/pve-fake-subscription
|
||||
pve-fake-subscription
|
||||
```
|
||||
$ dpkg-deb --info ../fake-proxmox-subscription_*.deb
|
||||
$ dpkg-deb --contents ./fake-proxmox-subscription_*.deb
|
||||
```
|
||||
|
||||
#### PVE 3.x
|
||||
Alternatively, if you want to use `podman` or `docker` to build the `.deb`, a
|
||||
`Dockerfile` is available:
|
||||
|
||||
Installation with `dpkg -i` will not work because of missing dependencies. Use the following script to install manually:
|
||||
```shell
|
||||
# extract the deb package
|
||||
mkdir -p /tmp/pve-fake-subscription
|
||||
dpkg-deb -x pve-fake-subscription_*.deb /tmp/pve-fake-subscription
|
||||
|
||||
# patch and install the script
|
||||
sed -i'' -e's/python3/python/g' -e's/pve8p/pve4p/g' /tmp/pve-fake-subscription/usr/bin/pve-fake-subscription
|
||||
mv /tmp/pve-fake-subscription/usr/bin/pve-fake-subscription /usr/local/bin/
|
||||
|
||||
# install the timer
|
||||
ln -sf /usr/local/bin/pve-fake-subscription /etc/cron.hourly/pve-fake-subscription
|
||||
|
||||
# invoke it once
|
||||
/usr/local/bin/pve-fake-subscription
|
||||
|
||||
# remove temporary files
|
||||
rm -rf /tmp/pve-fake-subscription
|
||||
```
|
||||
$ podman build -t fake-proxmox-subscription .
|
||||
$ podman run -it fake-proxmox-subscription:latest /bin/bash -c "ls -al /opt/fake-proxmox-subscription/debian/artifacts/"
|
||||
```
|
||||
|
||||
Removal:
|
||||
```shell
|
||||
rm -f /usr/local/bin/pve-fake-subscription /etc/cron.hourly/pve-fake-subscription /etc/subscription
|
||||
```
|
||||
Afterwards, transfer the generated `.deb` from
|
||||
`/opt/fake-proxmox-subscription/debian/artifacts/`.
|
||||
|
||||
The `Dockerfile` is basic and was primarily used for build testing,
|
||||
validating packaging, etc. I've only kept it in case someone might be
|
||||
interested in using it.
|
||||
|
||||
[1]: https://github.com/Jamesits/pve-fake-subscription
|
||||
[2]: https://github.com/Arszilla/fake-proxmox-subscription/releases/latest
|
||||
[3]: https://github.com/Arszilla/fake-proxmox-subscription/releases
|
||||
[4]: https://github.com/Jamesits
|
||||
|
||||
19
debian/changelog
vendored
Normal file
19
debian/changelog
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
fake-proxmox-subscription (1.0.0-3) trixie; urgency=medium
|
||||
|
||||
* Update changelog
|
||||
* Add "Conflicts" header to debian/control
|
||||
|
||||
-- Arslan Masood <contact@arszilla.com> Mon, 25 Aug 2025 08:10:55 +0300
|
||||
|
||||
fake-proxmox-subscription (1.0.0-2) trixie; urgency=medium
|
||||
|
||||
* Update changelog
|
||||
* Fix typo
|
||||
|
||||
-- Arslan Masood <contact@arszilla.com> Fri, 22 Aug 2025 00:45:35 +0300
|
||||
|
||||
fake-proxmox-subscription (1.0.0-1) trixie; urgency=medium
|
||||
|
||||
* Initial release
|
||||
|
||||
-- Arslan Masood <contact@arszilla.com> Thu, 21 Aug 2025 23:30:35 +0300
|
||||
24
debian/control
vendored
Normal file
24
debian/control
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
Source: fake-proxmox-subscription
|
||||
Section: misc
|
||||
Priority: optional
|
||||
Maintainer: Arslan Masood <contact@arszilla.com>
|
||||
Uploaders: Arslan Masood <contact@arszilla.com>
|
||||
Rules-Requires-Root: no
|
||||
Build-Depends:
|
||||
debhelper-compat (= 13),
|
||||
Standards-Version: 4.7.0
|
||||
Homepage: https://github.com/Arszilla/fake-proxmox-subscription
|
||||
Vcs-Browser: https://github.com/Arszilla/fake-proxmox-subscription
|
||||
Vcs-Git: https://github.com/Arszilla/fake-proxmox-subscription.git
|
||||
|
||||
Package: fake-proxmox-subscription
|
||||
Architecture: all
|
||||
Depends:
|
||||
${misc:Depends},
|
||||
${shlibs:Depends},
|
||||
python3:any,
|
||||
Conflicts:
|
||||
pve-fake-subscription,
|
||||
Description: Remove "No valid subscription" dialog box in Proxmox products
|
||||
A Debian package that disables the "No valid subscription" dialog on all
|
||||
Proxmox products (in theory), regardless of their version.
|
||||
42
debian/copyright
vendored
Normal file
42
debian/copyright
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Source: https://github.com/Arszilla/fake-proxmox-subscription
|
||||
Upstream-Name: fake-proxmox-subscription
|
||||
Upstream-Contact: Arslan Masood <contact@arszilla.com>
|
||||
|
||||
Files: usr/*
|
||||
Copyright:
|
||||
2025 Arslan Masood <contact@arszilla.com>
|
||||
2019-2024 Jamesits <x-from-github@ciexyz.net>
|
||||
License: GLWTS
|
||||
|
||||
Files: debian/*
|
||||
Copyright: 2025 Arslan Masood <contact@arszilla.com>
|
||||
License: GLWTS
|
||||
|
||||
License: GLWTS
|
||||
GLWTS(Good Luck With That Shit) Public License
|
||||
Copyright (c) Every-fucking-one, except the Author
|
||||
.
|
||||
Everyone is permitted to copy, distribute, modify, merge, sell, publish,
|
||||
sublicense or whatever the fuck they want with this software but at their
|
||||
OWN RISK.
|
||||
.
|
||||
Preamble
|
||||
.
|
||||
The author has absolutely no fucking clue what the code in this project
|
||||
does. It might just fucking work or not, there is no third option.
|
||||
.
|
||||
.
|
||||
GOOD LUCK WITH THAT SHIT PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION, AND MODIFICATION
|
||||
.
|
||||
0. You just DO WHATEVER THE FUCK YOU WANT TO as long as you NEVER LEAVE
|
||||
A FUCKING TRACE TO TRACK THE AUTHOR of the original product to blame for
|
||||
or held responsible.
|
||||
.
|
||||
IN NO EVENT SHALL THE AUTHORS 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.
|
||||
.
|
||||
Good luck and Godspeed.
|
||||
3
debian/fake-proxmox-subscription.install
vendored
Normal file
3
debian/fake-proxmox-subscription.install
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
usr/bin/fake-proxmox-subscription usr/bin/
|
||||
usr/lib/systemd/system/fake-proxmox-subscription.service usr/lib/systemd/system/
|
||||
usr/lib/systemd/system/fake-proxmox-subscription.timer usr/lib/systemd/system/
|
||||
@ -1,39 +1,44 @@
|
||||
#!/bin/sh
|
||||
|
||||
after_upgrade() {
|
||||
:
|
||||
DEBSYSTEMCTL=$(command -v deb-systemd-invoke || echo systemctl)
|
||||
|
||||
after_upgrade() {
|
||||
if command -v systemctl >/dev/null; then
|
||||
systemctl --system daemon-reload >/dev/null || true
|
||||
debsystemctl=$(command -v deb-systemd-invoke || echo systemctl)
|
||||
if ! systemctl is-enabled pve-fake-subscription.timer >/dev/null
|
||||
then
|
||||
: # Ensure this if-clause is not empty. If it were empty, and we had an 'else', then it is an error in shell syntax
|
||||
systemctl preset pve-fake-subscription.timer >/dev/null || true
|
||||
$debsystemctl start pve-fake-subscription.timer >/dev/null || true
|
||||
|
||||
if ! systemctl is-enabled fake-proxmox-subscription.timer >/dev/null; then
|
||||
# Ensure this if-clause is not empty.
|
||||
# If it was empty, and we had an 'else', then it is an error in shell syntax.
|
||||
systemctl preset fake-proxmox-subscription.timer >/dev/null || true
|
||||
$DEBSYSTEMCTL start fake-proxmox-subscription.timer >/dev/null || true
|
||||
|
||||
else
|
||||
$debsystemctl restart pve-fake-subscription.timer >/dev/null || true
|
||||
$DEBSYSTEMCTL restart fake-proxmox-subscription.timer >/dev/null || true
|
||||
|
||||
fi
|
||||
|
||||
else
|
||||
ln -sf /usr/bin/pve-fake-subscription /etc/cron.hourly/pve-fake-subscription
|
||||
ln -sf /usr/bin/fake-proxmox-subscription /etc/cron.hourly/fake-proxmox-subscription
|
||||
|
||||
fi
|
||||
|
||||
pve-fake-subscription
|
||||
# Execute the fake-proxmox-subscription script:
|
||||
fake-proxmox-subscription
|
||||
}
|
||||
|
||||
after_install() {
|
||||
:
|
||||
|
||||
if command -v systemctl >/dev/null; then
|
||||
systemctl --system daemon-reload >/dev/null || true
|
||||
debsystemctl=$(command -v deb-systemd-invoke || echo systemctl)
|
||||
systemctl preset pve-fake-subscription.timer >/dev/null || true
|
||||
$debsystemctl start pve-fake-subscription.timer >/dev/null || true
|
||||
systemctl preset fake-proxmox-subscription.timer >/dev/null || true
|
||||
$DEBSYSTEMCTL start fake-proxmox-subscription.timer >/dev/null || true
|
||||
|
||||
else
|
||||
ln -sf /usr/bin/pve-fake-subscription /etc/cron.hourly/pve-fake-subscription
|
||||
ln -sf /usr/bin/fake-proxmox-subscription /etc/cron.hourly/fake-proxmox-subscription
|
||||
|
||||
fi
|
||||
|
||||
pve-fake-subscription
|
||||
# Execute the fake-proxmox-subscription script:
|
||||
fake-proxmox-subscription
|
||||
}
|
||||
|
||||
if { [ "${1}" = "configure" ] && [ -z "${2}" ]; } || [ "${1}" = "abort-remove" ]; then
|
||||
@ -42,15 +47,18 @@ if { [ "${1}" = "configure" ] && [ -z "${2}" ]; } || [ "${1}" = "abort-remove" ]
|
||||
# In that case, this script, which should be idemptoent, is run
|
||||
# to ensure a clean roll-back of the removal.
|
||||
after_install
|
||||
|
||||
elif [ "${1}" = "configure" ] && [ -n "${2}" ]; then
|
||||
upgradeFromVersion="${2}"
|
||||
UPGRADEDFROMVERSION="${2}"
|
||||
# "after upgrade" here
|
||||
# NOTE: This slot is also used when deb packages are removed,
|
||||
# but their config files aren't, but a newer version of the
|
||||
# package is installed later, called "Config-Files" state.
|
||||
# basically, that still looks a _lot_ like an upgrade to me.
|
||||
after_upgrade "${2}"
|
||||
|
||||
elif echo "${1}" | grep -E -q "(abort|fail)"; then
|
||||
echo "Failed to install before the post-installation script was run." >&2
|
||||
exit 1
|
||||
|
||||
fi
|
||||
@ -1,21 +1,18 @@
|
||||
#!/bin/sh
|
||||
|
||||
after_remove() {
|
||||
:
|
||||
|
||||
rm -f /etc/subscription
|
||||
rm -f /etc/pmg/subscription
|
||||
rm -f /etc/proxmox-backup/subscription
|
||||
|
||||
rm -f /etc/cron.hourly/pve-fake-subscription
|
||||
rm -f /etc/cron.hourly/fake-proxmox-subscription
|
||||
}
|
||||
|
||||
after_purge() {
|
||||
:
|
||||
true
|
||||
}
|
||||
|
||||
dummy() {
|
||||
:
|
||||
true
|
||||
}
|
||||
|
||||
if [ "${1}" = "remove" ] || [ "${1}" = "abort-install" ]; then
|
||||
@ -24,11 +21,13 @@ if [ "${1}" = "remove" ] || [ "${1}" = "abort-install" ]; then
|
||||
# In that case, this script, which should be idemptoent, is run
|
||||
# to ensure a clean roll-back of the installation.
|
||||
after_remove
|
||||
|
||||
elif [ "${1}" = "purge" ] && [ -z "${2}" ]; then
|
||||
# like "on remove", but executes after dpkg deletes config files
|
||||
# 'apt-get purge' runs 'on remove' section, then this section.
|
||||
# There is no equivalent in RPM or ARCH.
|
||||
after_purge
|
||||
|
||||
elif [ "${1}" = "upgrade" ]; then
|
||||
# This represents the case where the old package's postrm is called after
|
||||
# the 'preinst' script is called.
|
||||
@ -37,7 +36,9 @@ elif [ "${1}" = "upgrade" ]; then
|
||||
# upgrade, not the uninstalled one, since it can't anticipate what new
|
||||
# things it will have to do to upgrade for the new version.
|
||||
dummy
|
||||
|
||||
elif echo "${1}" | grep -E -q '(fail|abort)'; then
|
||||
echo "Failed to install before the post-removal script was run." >&2
|
||||
exit 1
|
||||
|
||||
fi
|
||||
31
debian/fake-proxmox-subscription.prerm
vendored
Executable file
31
debian/fake-proxmox-subscription.prerm
vendored
Executable file
@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
|
||||
DEBSYSTEMCTL=$(command -v deb-systemd-invoke || echo systemctl)
|
||||
|
||||
before_remove() {
|
||||
$DEBSYSTEMCTL stop fake-proxmox-subscription.timer >/dev/null || true
|
||||
systemctl disable fake-proxmox-subscription.timer >/dev/null || true
|
||||
systemctl --system daemon-reload >/dev/null || true
|
||||
}
|
||||
|
||||
dummy() {
|
||||
true
|
||||
}
|
||||
|
||||
if [ "${1}" = "remove" ] && [ -z "${2}" ]; then
|
||||
# "before remove" goes here:
|
||||
before_remove
|
||||
|
||||
elif [ "${1}" = "upgrade" ]; then
|
||||
# This section is executed before the old version is removed upon upgrade.
|
||||
# Generally, we should not be doing anything here for the purposes of this
|
||||
# package. The newly installed package should do the upgrade, not the
|
||||
# uninstalled one. This is mainly because the uninstalled one cannot
|
||||
# anticipate what the updated package will change.
|
||||
dummy
|
||||
|
||||
elif echo "${1}" | grep -E -q "(fail|abort)"; then
|
||||
echo "Failed to install before the pre-removal script was run." >&2
|
||||
exit 1
|
||||
|
||||
fi
|
||||
15
debian/rules
vendored
Executable file
15
debian/rules
vendored
Executable file
@ -0,0 +1,15 @@
|
||||
#!/usr/bin/make -f
|
||||
|
||||
# output every command that modifies files on the build system.
|
||||
#export DH_VERBOSE = 1
|
||||
|
||||
%:
|
||||
dh $@
|
||||
|
||||
override_dh_install:
|
||||
dh_install
|
||||
|
||||
chmod 0755 usr/bin/fake-proxmox-subscription
|
||||
chmod 0644 usr/lib/systemd/system/fake-proxmox-subscription.service
|
||||
chmod 0644 usr/lib/systemd/system/fake-proxmox-subscription.timer
|
||||
|
||||
1
debian/source/format
vendored
Normal file
1
debian/source/format
vendored
Normal file
@ -0,0 +1 @@
|
||||
3.0 (quilt)
|
||||
5
debian/upstream/metadata
vendored
Normal file
5
debian/upstream/metadata
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
Bug-Database: https://github.com/Arszilla/fake-proxmox-subscription/issues
|
||||
Bug-Submit: https://github.com/Arszilla/fake-proxmox-subscription/issues/new
|
||||
Repository-Browse: https://github.com/Arszilla/fake-proxmox-subscription
|
||||
Repository: https://github.com/Arszilla/fake-proxmox-subscription.git
|
||||
40
nfpm.yaml
40
nfpm.yaml
@ -1,40 +0,0 @@
|
||||
name: "pve-fake-subscription"
|
||||
arch: "all"
|
||||
platform: "linux"
|
||||
version: "0.0.11"
|
||||
version_schema: "semver"
|
||||
version_metadata: "git"
|
||||
|
||||
epoch: 0
|
||||
release: 1
|
||||
section: "admin"
|
||||
priority: "optional"
|
||||
|
||||
maintainer: "Nobody <nobody@example.com>"
|
||||
|
||||
depends:
|
||||
- python3
|
||||
description: |
|
||||
Pollute the subscription cache of Proxmox VE (>=5.0), Proxmox Mail Gateway (>=5.0) & Proxmox Backup Server (>=1.0) so it won't alert you on dashboard login
|
||||
vendor: "none"
|
||||
homepage: "https://github.com/Jamesits/pve-fake-subscription"
|
||||
license: "GLWTS(Good Luck With That Shit) Public License"
|
||||
|
||||
contents:
|
||||
- src: "./usr/bin/pve-fake-subscription"
|
||||
dst: "/usr/bin/pve-fake-subscription"
|
||||
file_info:
|
||||
mode: 0755
|
||||
- src: "./usr/lib/systemd"
|
||||
dst: "/usr/lib/systemd"
|
||||
file_info:
|
||||
mode: 0644
|
||||
- src: "./usr/share/doc/pve-fake-subscription"
|
||||
dst: "/usr/share/doc/pve-fake-subscription"
|
||||
file_info:
|
||||
mode: 0644
|
||||
|
||||
scripts:
|
||||
postinstall: "./scripts/postinst"
|
||||
preremove: "./scripts/prerm"
|
||||
postremove: "./scripts/postrm"
|
||||
16
package.sh
16
package.sh
@ -1,16 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -Eeuo pipefail
|
||||
cd "$( dirname "${BASH_SOURCE[0]}" )" || exit 1
|
||||
|
||||
OUT_DIR="out"
|
||||
|
||||
rm -rf "${OUT_DIR}"
|
||||
mkdir -p "${OUT_DIR}"
|
||||
|
||||
# build package
|
||||
nfpm pkg --packager deb --target "${OUT_DIR}"
|
||||
|
||||
# generate checksum
|
||||
pushd "${OUT_DIR}" >/dev/null
|
||||
sha256sum -b -- * > sha256sum.txt
|
||||
popd >/dev/null
|
||||
@ -1,29 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
before_remove() {
|
||||
:
|
||||
|
||||
debsystemctl=$(command -v deb-systemd-invoke || echo systemctl)
|
||||
$debsystemctl stop pve-fake-subscription.timer >/dev/null || true
|
||||
systemctl disable pve-fake-subscription.timer >/dev/null || true
|
||||
systemctl --system daemon-reload >/dev/null || true
|
||||
}
|
||||
|
||||
dummy() {
|
||||
:
|
||||
}
|
||||
|
||||
if [ "${1}" = "remove" ] && [ -z "${2}" ]; then
|
||||
# "before remove" goes here
|
||||
before_remove
|
||||
elif [ "${1}" = "upgrade" ]; then
|
||||
# Executed before the old version is removed
|
||||
# upon upgrade.
|
||||
# We should generally not do anything here. The newly installed package
|
||||
# should do the upgrade, not the uninstalled one, since it can't anticipate
|
||||
# what new things it will have to do to upgrade for the new version.
|
||||
dummy
|
||||
elif echo "${1}" | grep -E -q "(fail|abort)"; then
|
||||
echo "Failed to install before the pre-removal script was run." >&2
|
||||
exit 1
|
||||
fi
|
||||
@ -1,8 +1,16 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Pollute Proxmox software subscription cache so it won't alert you on dashboard login
|
||||
# Should be scheduled to run every few hours with a timer to prevent cache from expiring
|
||||
# If you need to prevent it checking keys against a server, please block "shop.maurer-it.com" in your hosts file
|
||||
"""
|
||||
Pollutes the Proxmox software subscription cache so it won't doesn't nag you
|
||||
on login.
|
||||
|
||||
The script should be scheduled to run every few hours using a timer to prevent
|
||||
the cache from expiring.
|
||||
|
||||
If you need to prevent it from checking keys against a server, block
|
||||
"shop.maurer-it.com" in your /etc/hosts file (or block network traffic to the
|
||||
host)
|
||||
"""
|
||||
|
||||
from __future__ import print_function
|
||||
import hashlib
|
||||
@ -14,38 +22,46 @@ import sys
|
||||
import os
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
|
||||
# PVE & PMG: /usr/share/perl5/PVE/Subscription.pm
|
||||
# PBS: /usr/lib/x86_64-linux-gnu/proxmox-backup/* (source code at `https://git.proxmox.com/git/proxmox-backup.git`)
|
||||
# PBS: /usr/lib/x86_64-linux-gnu/proxmox-backup/*
|
||||
# (Source code available at https://git.proxmox.com/?p=proxmox-backup.git)
|
||||
shared_key_data = "kjfdlskfhiuewhfk947368"
|
||||
server_key_file = "/etc/ssh/ssh_host_rsa_key.pub"
|
||||
|
||||
# Default license keys
|
||||
lic_pve = "pve8p-1145141919"
|
||||
lic_pmg = "pmgp-1145141919"
|
||||
lic_pbs = "pbst-1145141919"
|
||||
# Default license keys:
|
||||
license_pve = "pve8p-1145141919"
|
||||
license_pmg = "pmgp-1145141919"
|
||||
license_pbs = "pbst-1145141919"
|
||||
|
||||
# UI customization:
|
||||
ui_product_name = "Proxmox"
|
||||
ui_message = "Jamesits and Arszilla has got your back"
|
||||
ui_url = "https://github.com/Arszilla/fake-proxmox-subscription"
|
||||
|
||||
# UI customization
|
||||
ui_product_name = "YajuuSenpai"
|
||||
ui_message = "Yajuu Senpai has got your back"
|
||||
ui_url = "https://github.com/Jamesits/pve-fake-subscription"
|
||||
|
||||
def get_timestamp():
|
||||
return int(time.time())
|
||||
|
||||
# Perl's md5_base64 implementation
|
||||
def md5_base64_perl(x):
|
||||
return base64.b64encode(hashlib.md5(x.encode()).digest()).strip(b'=').decode()
|
||||
|
||||
# Rust's `base64::encode(tools::md5sum("something")?);`
|
||||
# Perl's md5_base64 implementation:
|
||||
def md5_base64_perl(x):
|
||||
return base64.b64encode(hashlib.md5(x.encode()).digest()).strip(b"=").decode()
|
||||
|
||||
|
||||
# Rust's 'base64::encode(tools::md5sum("something")?);':
|
||||
def md5_base64_rs(x):
|
||||
return base64.b64encode(hashlib.md5(x.encode()).digest()).decode()
|
||||
|
||||
|
||||
def generate_server_id(key):
|
||||
return hashlib.md5(key.encode()).hexdigest().upper()
|
||||
|
||||
|
||||
def dt_string(format, offset_secs=0):
|
||||
return (datetime.now() + timedelta(seconds=offset_secs)).strftime(format)
|
||||
|
||||
|
||||
def generate_subscription_pve_pmg(key, server_ids, product_name=ui_product_name):
|
||||
localinfo = {
|
||||
"checktime": get_timestamp(),
|
||||
@ -63,74 +79,84 @@ def generate_subscription_pve_pmg(key, server_ids, product_name=ui_product_name)
|
||||
|
||||
return key + "\n" + csum + "\n" + data + "\n"
|
||||
|
||||
# key_pattern can be find in /usr/share/perl5/{PVE,PMG}/API2/Subscription.pm
|
||||
# PVE5+: r'pve([1248])([cbsp])-[0-9a-f]{10}'
|
||||
# PVE3/4: r'pve([124])([cbsp])-[0-9a-f]{10}'
|
||||
# PMG: r'pmg([cbsp])-[0-9a-f]{10}'
|
||||
|
||||
# key_pattern can be found in /usr/share/perl5/{PVE,PMG}/API2/Subscription.pm
|
||||
# PVE5+: r'pve([1248])([cbsp])-[0-9a-f]{10}'
|
||||
# PVE3/4: r'pve([124])([cbsp])-[0-9a-f]{10}'
|
||||
# PMG: r'pmg([cbsp])-[0-9a-f]{10}'
|
||||
def activate_pve_pmg(key, subscription_file, *args, **kwargs):
|
||||
# check if the key format is correct
|
||||
# Check if the key format is correct:
|
||||
# pattern = re.compile(key_pattern)
|
||||
# if not pattern.match(key):
|
||||
# print("key format error", file=sys.stderr)
|
||||
# sys.exit(1)
|
||||
|
||||
# get machine ID
|
||||
# Get machine ID:
|
||||
server_id = ""
|
||||
with open(server_key_file, "r") as f:
|
||||
server_id = generate_server_id(f.read())
|
||||
|
||||
# generate a license file
|
||||
# Generate a license file:
|
||||
subscription = generate_subscription_pve_pmg(key, [server_id], *args, **kwargs)
|
||||
|
||||
# write license file
|
||||
# Write the license file:
|
||||
with open(subscription_file, "w") as f:
|
||||
f.write(subscription)
|
||||
|
||||
|
||||
def generate_subscription_pbs(key, server_ids, product_name=ui_product_name, message=ui_message, url=ui_url):
|
||||
localinfo = {
|
||||
"status": "active", # PBS: `new`, `notfound`, `active`, `invalid`
|
||||
# Possible values for "status" in PBS:
|
||||
# - new
|
||||
# - notfound
|
||||
# - active
|
||||
# - invalid
|
||||
"status": "active",
|
||||
"serverid": ",".join(server_ids),
|
||||
"checktime": get_timestamp(),
|
||||
"key": key,
|
||||
"message": message,
|
||||
"productname": product_name,
|
||||
"regdate": dt_string("%Y-%m-%d %H:%M:%S"),
|
||||
"nextduedate": dt_string("%Y-%m-%d", 1296000), # 1296000: MAX_LOCAL_KEY_AGE in src/tools/subscription.rs
|
||||
# 1296000 is the MAX_LOCAL_KEY_AGE in src/tools/subscription.rs
|
||||
"nextduedate": dt_string("%Y-%m-%d", 1296000),
|
||||
"url": url,
|
||||
}
|
||||
|
||||
data = base64.standard_b64encode(json.dumps(localinfo).encode()).decode()
|
||||
cat = str(localinfo["checktime"]) + data + shared_key_data
|
||||
csum = md5_base64_rs(cat)
|
||||
checksum = md5_base64_rs(cat)
|
||||
|
||||
return key + "\n" + checksum + "\n" + data + "\n"
|
||||
|
||||
return key + "\n" + csum + "\n" + data + "\n"
|
||||
|
||||
# Key pattern: pbst-xxxxxxxxxx
|
||||
def activate_pbs(key, subscription_file, *args, **kwargs):
|
||||
# get machine ID
|
||||
# Get machine ID:
|
||||
server_id = ""
|
||||
with open(server_key_file, "r") as f:
|
||||
server_id = generate_server_id(f.read())
|
||||
|
||||
# generate a license file
|
||||
# Generate a license file:
|
||||
subscription = generate_subscription_pbs(key, [server_id], *args, **kwargs)
|
||||
|
||||
# write license file
|
||||
# Write the license file:
|
||||
with open(subscription_file, "w") as f:
|
||||
f.write(subscription)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Proxmox VE
|
||||
if os.path.exists("/etc/pve"):
|
||||
print("Activating Proxmox VE...")
|
||||
activate_pve_pmg(lic_pve, "/etc/subscription")
|
||||
activate_pve_pmg(license_pve, "/etc/subscription")
|
||||
|
||||
# Proxmox Mail Gateway
|
||||
if os.path.exists("/etc/pmg"):
|
||||
print("Activating Proxmox Mail Gateway...")
|
||||
activate_pve_pmg(lic_pmg, "/etc/pmg/subscription")
|
||||
activate_pve_pmg(license_pmg, "/etc/pmg/subscription")
|
||||
|
||||
# Proxmox Backup Server
|
||||
if os.path.exists("/etc/proxmox-backup"):
|
||||
print("Activating Proxmox Backup Server...")
|
||||
activate_pbs(lic_pbs, "/etc/proxmox-backup/subscription")
|
||||
activate_pbs(license_pbs, "/etc/proxmox-backup/subscription")
|
||||
@ -0,0 +1 @@
|
||||
enable fake-proxmox-subscription.timer
|
||||
@ -1 +0,0 @@
|
||||
enable pve-fake-subscription.timer
|
||||
6
usr/lib/systemd/system/fake-proxmox-subscription.service
Normal file
6
usr/lib/systemd/system/fake-proxmox-subscription.service
Normal file
@ -0,0 +1,6 @@
|
||||
[Unit]
|
||||
Description=Fake Proxmox Subscription - Service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/bin/fake-proxmox-subscription
|
||||
@ -1,5 +1,5 @@
|
||||
[Unit]
|
||||
Description=Refresh fake Proxmox VE subscription cache every day
|
||||
Description=Fake Proxmox Subscription - Refresher
|
||||
|
||||
[Timer]
|
||||
OnActiveSec=0s
|
||||
@ -1,6 +0,0 @@
|
||||
[Unit]
|
||||
Description=Fake a Proxmox VE subscription
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/bin/pve-fake-subscription
|
||||
@ -1,7 +0,0 @@
|
||||
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Upstream-Name: pve-fake-subscription
|
||||
Source: https://github.com/Jamesits/pve-fake-subscription
|
||||
|
||||
Files: *
|
||||
Copyright: 2019 Nobody
|
||||
License: GLWTS(Good Luck With That Shit) Public License
|
||||
Loading…
Reference in New Issue
Block a user