Update for Pritunl v1.30.3108.50

This commit is contained in:
Simon Beginn
2022-03-18 23:47:31 +01:00
parent 0e7ab6900b
commit abb00d3b74
9 changed files with 125 additions and 102 deletions

View File

@@ -3,7 +3,7 @@ This neat script provides a little fake API to unlock all premium/enterprise/ent
## How to setup (server) ## ## How to setup (server) ##
Take a look into the `server` folder: You _could_ use the Pritunl source there (or just download this specific version from their GitHub repo) to compile a guaranteed compatible version for this API or just download any other version of the Pritunl server and try your luck. Take a look into the `server` folder: You _could_ use the Pritunl source there (or just download this specific version from their GitHub repo) to compile a guaranteed compatible version for this API or just download any other version of the Pritunl server and try your luck.
Then you'll need to execute the `setup.sh` script (preferable as `root`, as it needs to modify the Pritunl files directly). Then you'll need to execute the `setup.py` script (preferable as `root`, as it needs to modify the Pritunl files directly).
After that log in into the dashboard - there should be a "Update Notification": After that log in into the dashboard - there should be a "Update Notification":
![login-msg](docs/login-msg.png) ![login-msg](docs/login-msg.png)
@@ -16,22 +16,22 @@ A valid command would be `bad premium` or `active ultimate`:
![active-ultimate](docs/active-ultimate.png) ![active-ultimate](docs/active-ultimate.png)
When everything worked, your subscription should now look like this: If everything worked, your subscription should now look like this:
![done](docs/done.png) ![done](docs/done.png)
Make sure to support the developers by buying the choosen subscription for your enterprise or company! Make sure to support the developers by buying the choosen subscription for your enterprise or company!
## How to setup (api) (optional) ## ## How to setup (api) (optional) ##
This is _optional_. You can simply use the default instance of this API (host is noted inside the `setup.sh` script) and profit from "automatic" updates. This is _optional_. You can simply use the default instance of this API (host is noted inside the `setup.py` script) and profit from "automatic" updates.
Just transfer the `www` files inside a public accessible root-folder on your _seperate_ Apache (really everthing with PHP support works) webserver. Also make sure your instance has a valid SSL-certificate (Let's encrypt is enough), otherwise it may won't work. Just transfer the `www` files inside a public accessible root-folder on your _dedicated_ Apache webserver (really everthing with PHP support works). Also make sure your instance has a valid SSL-certificate (Let's encrypt is enough), otherwise it may won't work.
An example Apache install process can be found [here](docs/apache/install.md). When you want to test your instance, just open the public accessible url in your browser and append `/notification` to it - when you see some JSON with the text, everthing worked! An example Apache install process can be found [here](docs/apache/install.md). If you want to test your instance, just open the public accessible URI in your browser and append `/notification` to it - if you see some JSON with the text, then everything worked!
### Nett2Know ### ### Nett2Know ###
* This modification will also block any communication to the Pritunl servers - so no calling home :) * This modification will also block any communication to the Pritunl servers - so no calling home :)
* The `ultimate` mode is still a little bit buggy. This is caused by some hacky workarounds to get all features displayed (the server is already unlocked). Caused by this workaround some items are maybe shown instead o being hidden. If you find such thing - just inform me about it. * The `ultimate` mode is still a little bit buggy. This is caused by some hacky workarounds to get all features displayed (the server is already unlocked). Caused by this workaround some items are maybe shown instead of being hidden. If you find such thing - just ping me about it.
* SSO will not work with this api version! As Pritunls own authentication servers handle the whole SSO stuff, track instance ids and verify users I won't implement this part for privacy concerns (and also this would need to be securly implemented and a database). * SSO will not work with this api version! As Pritunls own authentication servers handle the whole SSO stuff, track instance ids and verify users I won't implement this part for privacy concerns (and also this would need to be securly implemented and need a database).
* This api has also its own docker image. Take a look into the `docker` folder and enjoy! * This api has also its own docker image. Take a look into the `docker` folder and enjoy!
Have fun with your new premium/enterprise/ultimate Pritunl instance! Have fun with your new premium/enterprise/ultimate Pritunl instance!

1
docker/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
setup.py

View File

@@ -1,20 +1,8 @@
FROM goofball222/pritunl:latest FROM goofball222/pritunl:latest
ENV ORIG_API_SERVER app.pritunl.com # Yes, you will need to copy it over into the build context...
ENV FAKE_API_SERVER pritunl-api.simonmicro.de COPY setup.py .
ENV ORIG_AUTH_SERVER auth.pritunl.com
ENV FAKE_AUTH_SERVER pritunl-api.simonmicro.de\\/auth
# This is basically the classic installer script... RUN chmod +x setup.py
RUN ORIG_API_SERVER_ESCAPED=$(echo "$ORIG_API_SERVER" | sed -e 's/\./\\./g') && \ RUN python3 -u setup.py --install
FAKE_API_SERVER_ESCAPED=$(echo "$FAKE_API_SERVER" | sed -e 's/\./\\./g') && \ #RUN rm setup.py
ORIG_AUTH_SERVER_ESCAPED=$(echo "$ORIG_AUTH_SERVER" | sed -e 's/\./\\./g') && \
FAKE_AUTH_SERVER_ESCAPED=$(echo "$FAKE_AUTH_SERVER" | sed -e 's/\./\\./g') && \
echo 'Rewriting pritunl api endpoint: libs' && \
find /usr/lib/python* -type f -print0 | xargs -0 sed -i "s/$ORIG_API_SERVER_ESCAPED/$FAKE_API_SERVER_ESCAPED/g" && \
echo 'Rewriting pritunl api endpoint: www' && \
find /usr/share/pritunl/www/ -type f -print0 | xargs -0 sed -i "s/$ORIG_API_SERVER_ESCAPED/$FAKE_API_SERVER_ESCAPED/g" && \
echo 'Rewriting pritunl auth (SSO) endpoint: libs+www' && \
find /usr/lib/python* -type f -print0 | xargs -0 sed -i "s/$ORIG_AUTH_SERVER_ESCAPED/$FAKE_AUTH_SERVER_ESCAPED/g" && \
find /usr/share/pritunl/www/ -type f -print0 | xargs -0 sed -i "s/$ORIG_AUTH_SERVER_ESCAPED/$FAKE_AUTH_SERVER_ESCAPED/g" && \
echo 'Done...'

View File

@@ -7,10 +7,9 @@ services:
- ./mongodb:/data/db - ./mongodb:/data/db
pritunl: pritunl:
image: realsimonmicro/pritunl-with-fake-api:latest
# Use the following to build the image from source. # Use the following to build the image from source.
# build: build:
# context: . context: .
restart: always restart: always
depends_on: depends_on:
- mongodb - mongodb

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:280be8e934ce996ccaca169429463d81a2450ad20769330f7ae520714ec2a895
size 5053764

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2fc70b1940bbb57bd1f344d9fe7fe2a03237e6f403cb9e35ce19129193372f18
size 5095046

100
server/setup.py Normal file
View File

@@ -0,0 +1,100 @@
#!/usr/lib/python3
import os
import glob
import time
import base64
import argparse
originalApiServer = 'app.pritunl.com'
originalAuthServer = 'auth.pritunl.com'
newApiServer = 'pritunl-api.simonmicro.de'
searchIn = [*glob.glob('/usr/lib/python3*'), '/usr/lib/pritunl/', '/usr/share/pritunl/www/', '/usr/lib/pritunl/', '/usr/share/pritunl/www/']
print(" ____ _ _ _ _____ _ _ ____ ___ ")
print(" | _ \ _ __(_) |_ _ _ _ __ | | | ___|_ _| | _____ / \ | _ \_ _|")
print(" | |_) | '__| | __| | | | '_ \| | | |_ / _` | |/ / _ \ / _ \ | |_) | | ")
print(" | __/| | | | |_| |_| | | | | | | _| (_| | < __/ / ___ \| __/| | ")
print(" |_| |_| |_|\__|\__,_|_| |_|_| |_| \__,_|_|\_\___| /_/ \_\_| |___|")
print(" ")
sel = None
interactive = True
parser = argparse.ArgumentParser()
parser.add_argument('--install', type=str, default='DEFAULT', nargs='?', help='Do not ask and install new API endpoint.')
parser.add_argument('--reset', type=str, default='DEFAULT', nargs='?', help='Do not ask and remove new API endpoint.')
args = parser.parse_args()
if args.install != 'DEFAULT':
interactive = False
newApiServer = args.install if args.install is not None else newApiServer
sel = 'I'
if args.reset != 'DEFAULT':
interactive = False
newApiServer = args.reset if args.reset is not None else newApiServer
sel = 'R'
if interactive:
while sel not in ['I', 'U', 'B', 'Q']:
sel = input('[I]nstall, [R]eset, [B]uy Pritunl, [Q]uit? ').upper()
print()
def doTheReplace(fromApiStr, toApiStr, fromAuthStr, toAuthStr):
print(f'Okay. We will change "{fromApiStr}" to "{toApiStr}" and "{fromAuthStr}" to "{toAuthStr}" now...')
numFiles = 0
for i in range(len(searchIn)):
print(f'[{i+1}/{len(searchIn)}] Replacing in {searchIn[i]}...')
for p, d, f in os.walk(searchIn[i]):
for ff in f:
try:
fh = open(os.path.join(p, ff), 'r')
lines = fh.read()
fh.close()
newLines = lines.replace(fromApiStr, toApiStr)
newLines = newLines.replace(fromAuthStr, toAuthStr)
# Special case for changes from c1772d9b3268f91de409ad552e3d4d54d5ae1125
newLines = newLines.replace(base64.b64encode(f'https://{fromApiStr}/subscription'.encode()).decode(), base64.b64encode(f'https://{toApiStr}/subscription'.encode()).decode())
if newLines != lines:
numFiles += 1
fh = open(os.path.join(p, ff), 'w')
fh.writelines(newLines)
fh.close()
except UnicodeDecodeError:
# Brrr - binary files...
pass
print(f'Modified {numFiles} files in {len(searchIn)} paths.')
if sel == 'I':
if interactive:
print(f'By default, the Pritunl API endpoint is hosted at "{originalApiServer}".')
print(f'In case you want to use your own instance, you also have to support HTTPS!')
print(f'Note, that the SSO implementation of Pritunl is hosted at their servers (closed source) and will just be "disabled".')
ownApiServer = input(f'Please enter the new API endpoint [{newApiServer}]: ')
if ownApiServer == '':
ownApiServer = newApiServer
else:
ownApiServer = newApiServer
doTheReplace(originalApiServer, ownApiServer, originalAuthServer, ownApiServer + '/auth/')
print('Please make sure to restart the Pritunl daemon now and please support the developer.')
elif sel == 'R':
if interactive:
print(f'To properly revert any changes to your Pritunl server, this script must exactly know what (custom) API endpoint you have choosen.')
ownApiServer = input(f'Please enter the current API endpoint [{newApiServer}]: ')
if ownApiServer == '':
ownApiServer = newApiServer
print('Make sure to REMOVE ANY FAKED SUBSCRIPTION KEY (by not entering an other command - just remove them). You have now 30 seconds time to hit CTRL+C and do this.')
time.sleep(30)
else:
ownApiServer = newApiServer
doTheReplace(ownApiServer, originalApiServer, ownApiServer + '/auth/', originalAuthServer)
print('Please make sure to restart the Pritunl daemon now.')
elif sel == 'B':
print('Sure thing, buddy... Why did you try to use this?')
print('Visit https://pritunl.com/ for you own license!')
try:
import webbrowser
webbrowser.open('https://pritunl.com/')
print('Let me help you...')
except:
pass
elif sel == 'Q':
print('Bye!')

View File

@@ -1,69 +0,0 @@
ORIG_API_SERVER='app.pritunl.com'
ORIG_AUTH_SERVER='auth.pritunl.com'
if hash dialog 2>/dev/null; then
echo "Dialog found..."
else
echo "Error: Package 'dialog' missing!"
exit 1
fi
if hash find 2>/dev/null; then
echo "Find found..."
else
echo "Error: Package 'find' missing!"
exit 1
fi
if hash sed 2>/dev/null; then
echo "Sed found..."
else
echo "Error: Package 'sed' missing!"
exit 1
fi
winX=80
winY=8
choices=$(dialog --menu "What can I do for you?" 0 $winX 0 "Change" "Changes the API endpoint to your choice" "Reset" "Changes the API endpoint back to $ORIG_API_SERVER" 2>&1 >/dev/tty)
ORIG_API_SERVER_ESCAPED=$(echo "$ORIG_API_SERVER" | sed -e 's/\./\\./g')
ORIG_AUTH_SERVER_ESCAPED=$(echo "$ORIG_AUTH_SERVER" | sed -e 's/\./\\./g')
get_fake_api() {
FAKE_API_SERVER=$(dialog --title "Fake API address" --inputbox "Please enter the address from your faked API (with a valid HTTPS certificate). If you don't have one yourself, just leave the default." $winY $winX 'pritunl-api.simonmicro.de' 2>&1 >/dev/tty)
FAKE_API_SERVER_ESCAPED=$(echo "$FAKE_API_SERVER" | sed -e 's/\./\\./g')
FAKE_AUTH_SERVER="$FAKE_API_SERVER\/auth\/"
FAKE_AUTH_SERVER_ESCAPED=$(echo "$FAKE_AUTH_SERVER" | sed -e 's/\./\\./g')
echo "Please wait, while this script is modifying all necessary parts of the server. This can take up to several minutes..."
}
show_info() {
dialog --msgbox "$1" $winY $winX
}
set -e
for choice in $choices
do
case $choice in
Change)
get_fake_api
find /usr/lib/pritunl/ -type f -print0 | xargs -0 sed -i "s/$ORIG_API_SERVER_ESCAPED/$FAKE_API_SERVER_ESCAPED/g"
find /usr/share/pritunl/www/ -type f -print0 | xargs -0 sed -i "s/$ORIG_API_SERVER_ESCAPED/$FAKE_API_SERVER_ESCAPED/g"
find /usr/lib/pritunl/ -type f -print0 | xargs -0 sed -i "s/$ORIG_AUTH_SERVER_ESCAPED/$FAKE_AUTH_SERVER_ESCAPED/g"
find /usr/share/pritunl/www/ -type f -print0 | xargs -0 sed -i "s/$ORIG_AUTH_SERVER_ESCAPED/$FAKE_AUTH_SERVER_ESCAPED/g"
sleep 4
show_info "Changed $ORIG_API_SERVER to $FAKE_API_SERVER (and blocked any SSO server). Please make sure to restart the pritunl daemon now."
;;
Reset)
echo "Make sure to REMOVE ANY FAKED SUBSCRIPTION KEY (not by entering an other command - just remove them). You have now 30 seconds time to hit CTRL+C and do this."
sleep 30
get_fake_api
find /usr/lib/pritunl/ -type f -print0 | xargs -0 sed -i "s/$FAKE_API_SERVER_ESCAPED/$ORIG_API_SERVER_ESCAPED/g"
find /usr/share/pritunl/www/ -type f -print0 | xargs -0 sed -i "s/$FAKE_API_SERVER_ESCAPED/$ORIG_API_SERVER_ESCAPED/g"
find /usr/lib/pritunl/ -type f -print0 | xargs -0 sed -i "s/$FAKE_AUTH_SERVER_ESCAPED/$ORIG_AUTH_SERVER_ESCAPED/g"
find /usr/share/pritunl/www/ -type f -print0 | xargs -0 sed -i "s/$FAKE_AUTH_SERVER_ESCAPED/$ORIG_AUTH_SERVER_ESCAPED/g"
sleep 4
show_info "Changed $FAKE_API_SERVER to $ORIG_API_SERVER (and unblocked SSO features). Please make sure to restart the pritunl daemon now."
;;
esac
done
exit 0

View File

@@ -1,5 +1,5 @@
<?php <?php
//Author: Simon Beginn 2020 //Author: simonmicro 2022
header("Access-Control-Allow-Origin: *"); //Allow access from everywhere... header("Access-Control-Allow-Origin: *"); //Allow access from everywhere...
$code = 200; $code = 200;
@@ -13,7 +13,7 @@ if(isset($_GET['path'])) {
//Any notification/[version] will be answered here //Any notification/[version] will be answered here
if(preg_match('/notification.*/', $_GET['path'])) { if(preg_match('/notification.*/', $_GET['path'])) {
$result = new stdClass; $result = new stdClass;
$result->message = 'Fake API endpoint for v1.30.2945.60 active and reachable (contacted at ' . date('r') . ').'; $result->message = 'Fake API endpoint for v1.30.3108.50 active and reachable (contacted at ' . date('r') . ').';
$result->vpn = false; //Idk $result->vpn = false; //Idk
$result->www = false; //Idk $result->www = false; //Idk
} else if(isset($body->license) && preg_match('/subscription.*/', $_GET['path'])) { } else if(isset($body->license) && preg_match('/subscription.*/', $_GET['path'])) {
@@ -41,6 +41,10 @@ if(isset($_GET['path'])) {
} }
$stylesheet .= "* { color: rgb(57, 83, 120); }\n.dark * { color: rgb(200, 242, 242); }\n.navbar .navbar-brand { animation-name: pritunl-logo; animation-duration: 20s; animation-iteration-count: infinite; }\n@keyframes pritunl-logo { 0% { transform:rotate3d(1, 0, 0, 360deg); } 25% { transform:rotate3d(1, 0, 0, 0deg); } 50% { transform:rotate3d(0, 1, 0, 0deg); } 75% { transform:rotate3d(0, 1, 0, 360deg); } 100% { transform:rotate3d(0, 1, 0, 360deg); } }\n.footer-brand {visibility: hidden; }\n.footer-brand::before { visibility: visible; position: absolute; bottom: 0; right: 0; content: ''; background: url('https://" . $_SERVER['HTTP_HOST'] . "/logo.png'); background-size: cover; width: 1em; height: 1em; margin: 0.3em; }\n/* Generated for $license license */"; $stylesheet .= "* { color: rgb(57, 83, 120); }\n.dark * { color: rgb(200, 242, 242); }\n.navbar .navbar-brand { animation-name: pritunl-logo; animation-duration: 20s; animation-iteration-count: infinite; }\n@keyframes pritunl-logo { 0% { transform:rotate3d(1, 0, 0, 360deg); } 25% { transform:rotate3d(1, 0, 0, 0deg); } 50% { transform:rotate3d(0, 1, 0, 0deg); } 75% { transform:rotate3d(0, 1, 0, 360deg); } 100% { transform:rotate3d(0, 1, 0, 360deg); } }\n.footer-brand {visibility: hidden; }\n.footer-brand::before { visibility: visible; position: absolute; bottom: 0; right: 0; content: ''; background: url('https://" . $_SERVER['HTTP_HOST'] . "/logo.png'); background-size: cover; width: 1em; height: 1em; margin: 0.3em; }\n/* Generated for $license license */";
# Workaround for 70b354a10df55d60515f76d851dee42939864395
if($body->version >= 1003031084050)
$stylesheet = base64_encode($stylesheet);
$state = null; $state = null;
if($license) { //The following only makes sense if you selected any license if($license) { //The following only makes sense if you selected any license
if(strpos($body->license, 'bad') !== false) { if(strpos($body->license, 'bad') !== false) {
@@ -130,4 +134,4 @@ if(false) {
if(isset($_GET['clear'])) if(isset($_GET['clear']))
file_put_contents('access.log', ''); file_put_contents('access.log', '');
} }
?> ?>