Compare commits
No commits in common. "e15d424a3833e7be67d1aa2cd8de93dcd80ee4fb" and "243f72c103f139f7ab857527d95a05be3fd3605d" have entirely different histories.
e15d424a38
...
243f72c103
12
Makefile
12
Makefile
@ -1,6 +1,6 @@
|
|||||||
CFLAGS = -std=gnu99 -pie -fPIC -pedantic -Wno-imports -Wunused -Wno-missing-field-initializers -Wextra -Wunreachable-code -O3
|
CFLAGS = -std=gnu99 -pie -fPIC -pedantic -Wno-imports -Wunused -Wno-missing-field-initializers -Wextra -Wunreachable-code -O3
|
||||||
|
|
||||||
all: wireguard_mount wireguard_resolve vpn
|
all: wireguard_mount wireguard_resolve enter_vpn
|
||||||
|
|
||||||
wireguard_mount: src/wireguard-mount.c
|
wireguard_mount: src/wireguard-mount.c
|
||||||
mkdir -p bin
|
mkdir -p bin
|
||||||
@ -10,9 +10,9 @@ wireguard_resolve: src/resolve.c src/resolve.s
|
|||||||
mkdir -p bin
|
mkdir -p bin
|
||||||
gcc -shared -o bin/wireguard-resolve.so -nostdlib -fPIC src/resolve.c src/resolve.s
|
gcc -shared -o bin/wireguard-resolve.so -nostdlib -fPIC src/resolve.c src/resolve.s
|
||||||
|
|
||||||
vpn: src/vpn.c
|
enter_vpn: src/enter_vpn.c
|
||||||
mkdir -p bin
|
mkdir -p bin
|
||||||
gcc $(CFLAGS) -o bin/vpn src/vpn.c
|
gcc $(CFLAGS) -o bin/enter_vpn src/enter_vpn.c
|
||||||
|
|
||||||
format: src scripts
|
format: src scripts
|
||||||
clang-format -i src/*.c
|
clang-format -i src/*.c
|
||||||
@ -31,10 +31,12 @@ install_mount: systemd bin
|
|||||||
install_basic: systemd scripts bin
|
install_basic: systemd scripts bin
|
||||||
mkdir -p /snacks/wireguard/bin
|
mkdir -p /snacks/wireguard/bin
|
||||||
mkdir -p /snacks/wireguard/scripts
|
mkdir -p /snacks/wireguard/scripts
|
||||||
|
cp bin/wireguard-resolve.so /snacks/wireguard/bin/wireguard-resolve.so
|
||||||
cp systemd/vpnclient-wg-basic.service /etc/systemd/system/vpnclient-wg-basic.service
|
cp systemd/vpnclient-wg-basic.service /etc/systemd/system/vpnclient-wg-basic.service
|
||||||
cp scripts/connect_basic.py /snacks/wireguard/scripts/connect_basic.py
|
cp scripts/connect_basic.py /snacks/wireguard/scripts/connect_basic.py
|
||||||
cp scripts/inner_basic.sh /snacks/wireguard/scripts/inner_basic.sh
|
cp scripts/inner_basic.sh /snacks/wireguard/scripts/inner_basic.sh
|
||||||
cp bin/vpn /usr/local/bin/vpn
|
|
||||||
setcap cap_sys_admin,cap_sys_ptrace=ep /usr/local/bin/vpn
|
|
||||||
chmod -R 755 /snacks/wireguard
|
chmod -R 755 /snacks/wireguard
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import subprocess
|
import subprocess, os
|
||||||
import os
|
|
||||||
|
|
||||||
newenv = os.environ.copy()
|
newenv = os.environ.copy()
|
||||||
newenv["LD_PRELOAD"] = "/snacks/wireguard/bin/wireguard-resolve.so"
|
newenv["LD_PRELOAD"] = "/snacks/wireguard/bin/wireguard-resolve.so"
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import subprocess
|
import subprocess, os
|
||||||
import os
|
|
||||||
|
newenv = os.environ.copy()
|
||||||
|
newenv["LD_PRELOAD"] = "/snacks/wireguard/bin/wireguard-resolve.so"
|
||||||
|
|
||||||
|
|
||||||
def default_devices():
|
def default_devices():
|
||||||
@ -68,6 +70,7 @@ def wireguard():
|
|||||||
)
|
)
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
["nsenter", "--net=/run/vpn/net", "/snacks/wireguard/scripts/inner_basic.sh"],
|
["nsenter", "--net=/run/vpn/net", "/snacks/wireguard/scripts/inner_basic.sh"],
|
||||||
|
env=newenv,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ int main() {
|
|||||||
perror("open /run/vpn/net");
|
perror("open /run/vpn/net");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
execl(shell, shell, NULL);
|
execl("csshell", "bshell", NULL);
|
||||||
perror(NULL);
|
perror(NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user