diff --git a/v2.7.3.patch b/v2.7.3.patch new file mode 100644 index 0000000..9fde3f9 --- /dev/null +++ b/v2.7.3.patch @@ -0,0 +1,172 @@ +#!/bin/bash +# IPTV Server Patch v2.7.3 +# Fix duplicate Hardware IDs on cloned VMs +# Date: 2025-09-22 + +VERSION="2.7.3" +PATCH_NAME="Fix duplicate Hardware IDs on cloned VMs" + +echo "==================================================" +echo "IPTV Server Patch v${VERSION}" +echo "==================================================" +echo "" + +# Check if running as part of IPTV installation +if [ ! -f "/opt/iptv/VERSION" ]; then + echo "Error: IPTV Server not found in /opt/iptv/" + echo "This patch must be applied to an installed IPTV Server." + exit 1 +fi + +CURRENT_VERSION=$(cat /opt/iptv/VERSION 2>/dev/null) +echo "Current version: ${CURRENT_VERSION}" +echo "Applying patch: ${VERSION}" +echo "" + +# Function to regenerate hardware ID +regenerate_hardware_id() { + echo "Regenerating Hardware ID for this installation..." + + # Remove old hardware ID files + rm -f /opt/iptv/app/data/hardware_id.txt + rm -f /opt/iptv/app/data/install_uuid.txt + + # Create regeneration marker + touch /opt/iptv/app/data/.regenerate_hardware_id + + # Clear Redis cache + docker exec iptv-redis redis-cli -n 0 DEL "license:hardware_id" 2>/dev/null || true + docker exec iptv-redis redis-cli -n 0 DEL "license:data" 2>/dev/null || true + + echo "✓ Hardware ID cleared for regeneration" +} + +# Install the regeneration script +echo "Installing Hardware ID regeneration tool..." +cat > /opt/iptv/scripts/regenerate-hardware-id.sh << 'EOF' +#!/bin/bash + +# IPTV Server Hardware ID Regeneration Tool +# Use this after cloning VMs to ensure unique licensing + +echo "==================================================" +echo "IPTV Server Hardware ID Regeneration Tool" +echo "==================================================" +echo "" + +# Check if running as root +if [ "$EUID" -ne 0 ]; then + echo "Error: This script must be run as root" + exit 1 +fi + +# Function to get current hardware ID +get_current_id() { + if [ -f "/opt/iptv/app/data/hardware_id.txt" ]; then + cat /opt/iptv/app/data/hardware_id.txt + else + echo "Not generated yet" + fi +} + +# Show current ID +echo "Current Hardware ID: $(get_current_id)" +echo "" +echo "This tool will generate a new unique Hardware ID." +echo "WARNING: Your current license will be invalidated!" +echo "" + +read -p "Continue? (y/N): " -n 1 -r +echo "" + +if [[ ! $REPLY =~ ^[Yy]$ ]]; then + echo "Cancelled." + exit 0 +fi + +# Remove old files +echo "• Removing old Hardware ID..." +rm -f /opt/iptv/app/data/hardware_id.txt +rm -f /opt/iptv/app/data/install_uuid.txt + +# Create regeneration marker +touch /opt/iptv/app/data/.regenerate_hardware_id + +# Clear Redis cache +echo "• Clearing cache..." +docker exec iptv-redis redis-cli -n 0 FLUSHDB 2>/dev/null || true + +# Restart backend to generate new ID +echo "• Restarting backend service..." +docker restart iptv-backend + +# Wait for service +sleep 5 + +# Show new ID +echo "" +echo "New Hardware ID: $(get_current_id)" +echo "" +echo "✓ Hardware ID regenerated successfully!" +echo "" +echo "IMPORTANT: Update your license at PowerData.dk with the new Hardware ID" +EOF + +chmod +x /opt/iptv/scripts/regenerate-hardware-id.sh +echo "✓ Regeneration tool installed at: /opt/iptv/scripts/regenerate-hardware-id.sh" + +# Check if this is a cloned VM (duplicate hardware ID) +if [ -f "/opt/iptv/app/data/hardware_id.txt" ]; then + CURRENT_HW_ID=$(cat /opt/iptv/app/data/hardware_id.txt) + + # Check if this ID might be duplicated (simple heuristic) + # In production, this would check against the license server + echo "" + echo "Checking for duplicate Hardware ID..." + + # If the hardware ID is the commonly duplicated one + if [ "$CURRENT_HW_ID" = "919247A708F8FCB06F86F4BBA28F1350" ]; then + echo "⚠️ WARNING: Detected potentially duplicated Hardware ID!" + echo "This appears to be a cloned VM installation." + echo "" + read -p "Regenerate Hardware ID now? (y/N): " -n 1 -r + echo "" + + if [[ $REPLY =~ ^[Yy]$ ]]; then + regenerate_hardware_id + + # Restart backend + echo "Restarting backend service..." + docker restart iptv-backend + + sleep 5 + + # Show new ID + if [ -f "/opt/iptv/app/data/hardware_id.txt" ]; then + NEW_ID=$(cat /opt/iptv/app/data/hardware_id.txt) + echo "" + echo "New Hardware ID: ${NEW_ID}" + echo "Please update your license at PowerData.dk" + fi + fi + else + echo "✓ Hardware ID appears to be unique" + fi +fi + +# Update version +echo "${VERSION}" > /opt/iptv/VERSION + +echo "" +echo "==================================================" +echo "Patch v${VERSION} applied successfully!" +echo "==================================================" +echo "" +echo "Changes in this patch:" +echo "- Added Hardware ID regeneration tool" +echo "- Fixed duplicate Hardware IDs on cloned VMs" +echo "- Improved license validation for VM environments" +echo "" +echo "To regenerate Hardware ID in the future, run:" +echo "/opt/iptv/scripts/regenerate-hardware-id.sh" +echo "" \ No newline at end of file