Merge branch 'development-SDXPINN' into SDXPINN

This commit is contained in:
Cameron Thompson
2025-02-01 02:04:47 -05:00
14 changed files with 343 additions and 15 deletions

View File

@@ -0,0 +1 @@
/etc/config/wireguard

View File

@@ -1,5 +1,5 @@
Package: luci-app-go-wireguard
Version: 4.500-1
Version: 4.500-2
Depends: libc, wireguard-tools, kmod-wireguard, luci-proto-wireguard, udptunnel, eoip
Source: package/rooter/0optionalapps/ext-wireguard
SourceName: ext-wireguard

View File

@@ -1,4 +0,0 @@
#!/bin/sh
[ -s ${IPKG_INSTROOT}/lib/functions.sh ] || exit 0
. ${IPKG_INSTROOT}/lib/functions.sh
default_prerm $0 $@

View File

@@ -324,4 +324,5 @@ fi
uci set wireguard."$WG".active="1"
uci commit wireguard
service firewall reload

View File

@@ -0,0 +1,7 @@
Package: warp
Depends: libc, wgcf, luci-app-go-wireguard
Version: 1.0
Architecture: sdxpinn
Maintainer: iamromulan
Source: github.com/iamromulan
Description: Installs the 'warp' command to help setup Cloudflare WARP on SDXPINN

View File

@@ -0,0 +1,74 @@
#!/bin/sh
# Script for building OpenWRT .ipk packages using tar by iamromulan
# Works with SDXPPINN OpenWRT - iamromulan
# This script accepts an optional path to the directory containing the `CONTROL` and `root` directories.
# Usage: ./build-ipk.sh [path]
# If no path is provided, the script will look in the current directory for `CONTROL` and `root` directories.
# This will spit out an ipk in the current directory
# Check if the script is run as root. If not, rerun with sudo.
if [ "$(id -u)" -ne 0 ]; then
echo "Script is not running as root. Re-executing with sudo..."
exec sudo "$0" "$@"
fi
# Set the default build path to the current directory
build_path="."
# Check if a path is provided as the first argument
if [ "$1" ]; then
build_path="$1"
fi
# Check if the required directories are present in the specified path
if [ ! -d "${build_path}/CONTROL" ] || [ ! -d "${build_path}/root" ]; then
echo "Error: CONTROL and root directories must be present in the specified path (${build_path})."
exit 1
fi
# Extract values from the CONTROL/control file in the specified path
pkgname=$(grep -i '^Package:' "${build_path}/CONTROL/control" | awk '{print $2}')
version=$(grep -i '^Version:' "${build_path}/CONTROL/control" | awk '{print $2}')
architecture=$(grep -i '^Architecture:' "${build_path}/CONTROL/control" | awk '{print $2}')
# Check if values are extracted correctly
if [ -z "$pkgname" ] || [ -z "$version" ] || [ -z "$architecture" ]; then
echo "Error: Failed to extract Package, Version, or Architecture from ${build_path}/CONTROL/control."
exit 1
fi
# Set the final IPK name based on the extracted values
ipkname="${pkgname}_${version}_${architecture}.ipk"
# Ensure all CONTROL scripts are executable
echo "Setting permissions for CONTROL scripts..."
chmod +x "${build_path}/CONTROL"/*
# Set ownership for CONTROL and root files
echo "Setting ownership for all package files..."
chown -R root:root "${build_path}/CONTROL"/*
chown -R root:root "${build_path}/root"/*
# Create control.tar.gz from the CONTROL directory
echo "Creating control.tar.gz..."
tar -czvf control.tar.gz -C "${build_path}/CONTROL" .
# Create data.tar.gz from the root directory
echo "Creating data.tar.gz..."
tar -czvf data.tar.gz -C "${build_path}/root" .
# Create debian-binary file (must contain exactly "2.0" without a newline)
echo -n "2.0" > debian-binary
chown -R root:root debian-binary
# Combine the components into the final .ipk file using tar
echo "Packaging ${ipkname}..."
tar -czvf "$ipkname" debian-binary control.tar.gz data.tar.gz
# Clean up intermediate files
echo "Cleaning up temporary files..."
rm -f control.tar.gz data.tar.gz debian-binary
echo "IPK package ${ipkname} created successfully using tar."

View File

@@ -0,0 +1,235 @@
#!/bin/sh
# Combined WARP management script
VERSION="1.0"
SCRIPT_NAME="warp"
# Configuration directories
WGCF_FREE_CONFIG_DIR="/etc/warp/free"
WGCF_PLUS_CONFIG_DIR="/etc/warp/plus"
# Color codes
GREEN='\033[0;32m'
NC='\033[0m' # No Color
# Usage information
show_usage() {
cat <<EOF
${SCRIPT_NAME} - WARP VPN management tool for SDXPINN by iamromulan v${VERSION}
Reqiures wgcf from https://github.com/ViRb3/wgcf
Usage:
${SCRIPT_NAME} <mode> <command>
Modes:
free Manage free WARP configuration
plus Manage WARP+ configuration
Commands:
setup Initial setup for WARP configuration
update-key Update license key in wgcf-account.toml
install-profile Install WARP profile to UCI config
Examples:
${SCRIPT_NAME} free setup
${SCRIPT_NAME} plus update-key
${SCRIPT_NAME} free install-profile
EOF
}
# Setup wizard
setup_warp() {
MODE=$1
case $MODE in
free)
CONFIG_DIR="$WGCF_FREE_CONFIG_DIR"
PROFILE_NAME="WARPfree"
;;
plus)
CONFIG_DIR="$WGCF_PLUS_CONFIG_DIR"
PROFILE_NAME="WARPplus"
;;
*) return 1 ;;
esac
# Create config directory if needed
mkdir -p "$CONFIG_DIR" || {
echo "Error: Failed to create configuration directory $CONFIG_DIR"
return 1
}
ACCOUNT_FILE="${CONFIG_DIR}/wgcf-account.toml"
PROFILE_FILE="${CONFIG_DIR}/wgcf-profile.conf"
# Check for existing account
if [ -f "$ACCOUNT_FILE" ]; then
echo "Warning: Existing account found in $CONFIG_DIR"
echo "This will DELETE ALL EXISTING CONFIGURATION for WARP $MODE!"
printf "Do you want to continue? [1=Yes 2=No] "
while true; do
read choice
case $choice in
1)
rm -f "$ACCOUNT_FILE" "$PROFILE_FILE"
break
;;
2)
echo "Setup aborted by user"
return 1
;;
*)
printf "Invalid choice. Enter 1 or 2: "
;;
esac
done
fi
# Register new account
echo "Creating new WARP $MODE account..."
if ! wgcf --config "$ACCOUNT_FILE" register; then
echo "Error: Failed to register WARP account"
return 1
fi
# Update license key for plus accounts
if [ "$MODE" = "plus" ]; then
echo "Please enter your WARP+ license key:"
if ! update_license_key "$MODE"; then
echo "Error: Failed to update license key"
return 1
fi
fi
# Generate profile
echo "Generating WireGuard profile..."
if ! wgcf --config "$ACCOUNT_FILE" update; then
echo "Error: Failed to update WARP account"
return 1
fi
if ! wgcf --config "$ACCOUNT_FILE" generate -p "$PROFILE_FILE"; then
echo "Error: Failed to generate WireGuard profile"
return 1
fi
# Install profile
if ! install_warp_profile "$MODE"; then
echo "Error: Failed to install WireGuard profile"
return 1
fi
# Success message
printf "${GREEN}Cloudflare WARP %s has been setup and installed to your WireGuard profiles in Luci.${NC}\n" "$MODE"
printf "${GREEN}Head to Luci to connect the VPN.${NC}\n"
}
# License key updater
update_license_key() {
MODE=$1
case $MODE in
free) CONFIG_DIR="$WGCF_FREE_CONFIG_DIR" ;;
plus) CONFIG_DIR="$WGCF_PLUS_CONFIG_DIR" ;;
*) return 1 ;;
esac
ACCOUNT="${CONFIG_DIR}/wgcf-account.toml"
LINE=$(grep -n "license_key" "$ACCOUNT" | cut -d: -f1)
if [ -z "$LINE" ]; then
echo "Error: License key line not found in $ACCOUNT"
return 1
fi
read -p "Enter WARP+ license key from your phone app: " NEW_KEY
sed -i "${LINE}s/'.*'/'$NEW_KEY'/" "$ACCOUNT"
echo "License key updated successfully in $ACCOUNT"
}
# Profile installer
install_warp_profile() {
MODE=$1
case $MODE in
free)
CONFIG_DIR="$WGCF_FREE_CONFIG_DIR"
PROFILE_NAME="WARPfree"
;;
plus)
CONFIG_DIR="$WGCF_PLUS_CONFIG_DIR"
PROFILE_NAME="WARPplus"
;;
*) return 1 ;;
esac
WGCF_CONF="${CONFIG_DIR}/wgcf-profile.conf"
# Validate config file exists
[ ! -f "$WGCF_CONF" ] && {
echo "Error: $WGCF_CONF not found"
return 1
}
# Extract values
ENDPOINT=$(awk -F' = ' '/Endpoint/ {print $2}' "$WGCF_CONF")
ENDPOINT_HOST=$(echo "$ENDPOINT" | cut -d':' -f1)
ENDPOINT_PORT=$(echo "$ENDPOINT" | cut -d':' -f2)
# Delete existing section
uci delete wireguard.${PROFILE_NAME} 2>/dev/null
# Create new section
uci add wireguard wireguard >/dev/null
uci rename wireguard.@wireguard[-1]="${PROFILE_NAME}"
# Set configuration values
uci batch <<EOF
set wireguard.${PROFILE_NAME}.privatekey="$(awk -F' = ' '/PrivateKey/ {print $2}' "$WGCF_CONF")"
set wireguard.${PROFILE_NAME}.addresses="$(awk -F' = ' '/Address/ {gsub(" ", "", $2); print $2}' "$WGCF_CONF")"
set wireguard.${PROFILE_NAME}.dns="$(awk -F' = ' '/DNS/ {gsub(" ", "", $2); print $2}' "$WGCF_CONF")"
set wireguard.${PROFILE_NAME}.mtu="$(awk -F' = ' '/MTU/ {print $2}' "$WGCF_CONF")"
set wireguard.${PROFILE_NAME}.publickey="$(awk -F' = ' '/PublicKey/ {print $2}' "$WGCF_CONF")"
set wireguard.${PROFILE_NAME}.ips="$(awk -F' = ' '/AllowedIPs/ {gsub(" ", "", $2); print $2}' "$WGCF_CONF")"
set wireguard.${PROFILE_NAME}.endpoint_host="$ENDPOINT_HOST"
set wireguard.${PROFILE_NAME}.sport="$ENDPOINT_PORT"
set wireguard.${PROFILE_NAME}.auto='0'
set wireguard.${PROFILE_NAME}.client='1'
set wireguard.${PROFILE_NAME}.active='0'
set wireguard.${PROFILE_NAME}.wginter='0'
set wireguard.${PROFILE_NAME}.persistent_keepalive='25'
set wireguard.${PROFILE_NAME}.udptunnel='0'
set wireguard.${PROFILE_NAME}.forward='1'
set wireguard.${PROFILE_NAME}.name='${PROFILE_NAME}'
set wireguard.${PROFILE_NAME}.presharedkey=''
EOF
uci commit wireguard
echo "${PROFILE_NAME} profile installed in /etc/config/wireguard"
}
# Main execution
if [ $# -lt 2 ]; then
show_usage
exit 1
fi
MODE=$1
COMMAND=$2
case $COMMAND in
setup)
setup_warp "$MODE"
;;
update-key)
update_license_key "$MODE"
;;
install-profile)
install_warp_profile "$MODE"
;;
*)
show_usage
exit 1
;;
esac
exit 0

View File

@@ -40,7 +40,7 @@ License: GPLv3
Package: luci-app-go-wireguard
Version: 4.500-1
Version: 4.500-2
Depends: libc, wireguard-tools, kmod-wireguard, luci-proto-wireguard, udptunnel, eoip
Source: package/rooter/0optionalapps/ext-wireguard
SourceName: ext-wireguard
@@ -48,9 +48,9 @@ Section: utils
Architecture: all
SourceDateEpoch: 1716401566
Maintainer: Created by DM/makefile by Cobia@whirlpool
MD5Sum: b586305255284278b9012483da246bc3
Size: 24327
Filename: luci-app-go-wireguard_4.500-1_all.ipk
MD5Sum: 66549e8d970b9046440e6a836f9c9639
Size: 24213
Filename: luci-app-go-wireguard_4.500-2_all.ipk
Description: Wireguard luci App
@@ -206,6 +206,18 @@ Description: It creates a secure network between your servers, computers, and cl
License: GPLv3
Package: warp
Depends: libc, wgcf, luci-app-go-wireguard
Version: 1.0
Architecture: sdxpinn
Maintainer: iamromulan
MD5Sum: ea95658bf84f619cabe5dd62280fe787
Size: 2698
Filename: warp_1.0_sdxpinn.ipk
Source: github.com/iamromulan
Description: Installs the 'warp' command to help setup Cloudflare WARP on SDXPINN
Package: wgcf
Version: 2.2.24
Depends: libc

Binary file not shown.

View File

@@ -1,8 +1,9 @@
Starting package analysis - Fri Jan 31 06:48:37 PM EST 2025
Starting package analysis - Sat Feb 1 02:03:08 AM EST 2025
No update needed for atinout (version 0.9.1, MD5: 444eb87488bad1927b6ed069dedf7393, size: 4323)
No update needed for kmod-wireguard (version 1, MD5: 98e77b68c2f1b5ff46ef7713b4f63a94, size: 789)
No update needed for luci-app-atinout-mod (version 1.3.4-20250119, MD5: 1ffee9ec8fe5723b8140bf2c21fea508, size: 4864)
No update needed for luci-app-go-wireguard (version 4.500-1, MD5: b586305255284278b9012483da246bc3, size: 24327)
Updating package info for luci-app-go-wireguard...
Updated luci-app-go-wireguard to version 4.500-2 with MD5: 66549e8d970b9046440e6a836f9c9639 and size: 24213
No update needed for luci-app-tailscale (version 1.2.3-2, MD5: 53c84c947c42d7518aecb4a6b8a9c5a8, size: 6501)
No update needed for ookla-speedtest (version 1.2.0, MD5: b26e1909599f73cab40ea0281c5a6283, size: 1075696)
No update needed for sdxpinn-console-menu (version 0.0.2, MD5: de75d2889510e92b57fc8a7ca087ced4, size: 7361)
@@ -14,7 +15,8 @@ No update needed for sms-tool (version 2025.1.19-APmod-iamromulan, MD5: 83dc8bfd
No update needed for socat-at-bridge (version 1.1.1, MD5: a5f4c4c371426fbe12bf2345938af195, size: 1795)
No update needed for tailscale (version 1.78.1-2, MD5: baa4d97ba49aa42ef104accba2dc2fd8, size: 9882856)
No update needed for tailscaled (version 1.78.1-4, MD5: 647b4d3c6e51f700dd96362f92f20b54, size: 17960998)
Updating package info for wgcf...
Updated wgcf to version 2.2.24 with MD5: b2ba181f9181c2bd8f37933c60c0713f and size: 3677883
Updating package info for warp...
Updated warp to version 1.0 with MD5: ea95658bf84f619cabe5dd62280fe787 and size: 2698
No update needed for wgcf (version 2.2.24, MD5: b2ba181f9181c2bd8f37933c60c0713f, size: 3677883)
Package file and signature updated successfully.
Package analysis completed - Fri Jan 31 06:48:38 PM EST 2025
Package analysis completed - Sat Feb 1 02:03:09 AM EST 2025

View File

@@ -1,2 +1,2 @@
untrusted comment: signed by key 6262698f038d1226
RWRiYmmPA40SJpD0jXhZMEUM4ylwICDZGrhRosYxvzDd8jNYm28pfIEWkND7+zmq1Z2U3sbUGIPZybNBERPVCxB25K/xI0Ik3As=
RWRiYmmPA40SJqh6swrZprVskraD3U4vDJ0Fd3If3BKSqtOGL0Yvz4pVu1kaEpPf2KhrK7DPlNkCh71BY4BuTsoFcmfCrYpbJA4=

Binary file not shown.

Binary file not shown.