updated everything to not require gs-secret manually

This commit is contained in:
Luxferre
2026-07-26 09:50:04 +03:00
parent f7e67801a5
commit 7b0d1582d7
5 changed files with 23 additions and 25 deletions
+1 -4
View File
@@ -1,5 +1,5 @@
all:
@echo "Usage: make server | make stop-server | make server-secret | make simple"
@echo "Usage: make server|stop-server|ovpn|start|stop|clean"
server:
@cd server && docker compose up --build -d
@@ -10,9 +10,6 @@ stop-server:
clean:
@cd server && docker compose down -v
server-secret:
@cd server && printf 'Enter server secret: ' && read -r GS_SECRET && echo "GS_SECRET=$$GS_SECRET" > .env
ovpn:
@docker cp gsocket-vpn:/vpn/client.ovpn . && echo 'client.ovpn saved!'
+14 -11
View File
@@ -31,32 +31,35 @@ Client-side dependencies:
Assumes having Docker and Make. From the repo root:
1. Enter and save the GSocket secret: `make server-secret`
2. Build (if necessary) and start the server: `make server`
3. Export the `client.ovpn` file to the current directory: `make ovpn`
4. Stop the server (without removing the data): `make stop-server`
5. Stop the server and remove all data: `make clean`
1. Build (if necessary) and start the server: `make server`
2. Export the `client.ovpn` file to the current directory: `make ovpn`
3. Stop the server (without removing the data): `make stop-server`
4. Stop the server and remove all data: `make clean`
Note: the `client.ovpn` file is the sole access key to the entire tunnel. Treat is as confidential data.
### On the client ("simple" approach, Make-based)
1. Get the `client.ovpn` file from the server and put it into the `client` directory.
2. Run `make start`, enter your GSocket server secret and then your sudo password (if necessary).
2. Run `make start` and then enter your sudo password (if necessary).
3. To stop the client, run `make stop.`
### On the client (manual approach, POSIX)
1. Get the `client.ovpn` file from the server.
2. Run these commands directly: `gs-netcat -D -s your_gsocket_secret -p 1194 && sudo openvpn --daemon gs-warp --config client.ovpn`
3. To stop, first stop the OpenVPN process and then gs-netcat.
2. Get the GS secret as the MD5 hash of the `client.ovpn` file: `export GS_SECRET=$(md5sum client.ovpn | cut -d ' ' -f 1)`
3. Run these commands directly: `gs-netcat -D -s $GS_SECRET -p 1194 && sudo openvpn --daemon gs-warp --config client.ovpn`
4. To stop, first stop the OpenVPN process and then gs-netcat.
### On the client (manual approach, non-POSIX)
This is suitable for non-POSIX environments. You'll need any OpenVPN client and `gs-netcat` binary for your platform.
1. Get the `client.ovpn` file from the server and put it into your OpenVPN client's profile. Do not start the client yet.
2. In a separate terminal window, run `gs-netcat -D -s your_gsocket_secret -p 1194`.
3. Start the OpenVPN connection in the client.
4. To stop, first stop the OpenVPN connection and then terminate the gs-netcat process.
2. Get the GS secret as the MD5 hash of the `client.ovpn` file using whatever means available.
3. In a separate terminal window, run `gs-netcat -D -s $GS_SECRET -p 1194`.
4. Start the OpenVPN connection in the client.
5. To stop, first stop the OpenVPN connection and then terminate the gs-netcat process.
More client options coming soon!
+4 -2
View File
@@ -1,8 +1,10 @@
#!/bin/sh
[ -z "$GS_SECRET" ] && GS_SECRET="$1"
[ -z "$GS_SECRET" ] && printf 'Enter GSocket secret: ' && read -r GS_SECRET
# Client-side GS-Warp launcher
# Created by Luxferre in 2026, released into the public domain
[ -z "$OVPNCFG" ] && OVPNCFG="$2"
[ -z "$OVPNCFG" ] && OVPNCFG="client.ovpn"
GS_SECRET="$(md5sum "$OVPNCFG" | cut -d ' ' -f 1)"
GSPIDFILE='/tmp/gswarp-gs.pid'
OVPIDFILE='/tmp/gswarp-ov.pid'
-2
View File
@@ -3,8 +3,6 @@ services:
build: .
container_name: gsocket-vpn
restart: unless-stopped
environment:
- GS_SECRET=${GS_SECRET}
dns:
- 1.1.1.1
- 8.8.8.8
+4 -6
View File
@@ -1,11 +1,8 @@
#!/usr/bin/env bash
set -e
# Server-side core (entrypoint) for GS-Warp
# Created by Luxferre in 2026, released into the public domain
if [ -z "$GS_SECRET" ]; then
echo "[!] ERROR: GS_SECRET environment variable is missing."
echo " Please start the container with -e GS_SECRET=\"your_secret_key\""
exit 1
fi
set -e
# Ensure TUN device node exists in container namespace
if [ ! -c /dev/net/tun ]; then
@@ -151,5 +148,6 @@ openvpn --config /vpn/server.conf \
sleep 2
# 4. Forward GSocket stream directly to 127.0.0.1:1194
GS_SECRET="$(md5sum /vpn/client.ovpn | cut -d ' ' -f 1)"
echo "[+] Starting gs-netcat port forwarder..."
exec gs-netcat -s "$GS_SECRET" -l -d 127.0.0.1 -p 1194