working prototype

This commit is contained in:
root 2020-04-05 13:27:46 -04:00
parent 85a1f4f17e
commit 566a8b675d
2 changed files with 4 additions and 3 deletions

View File

@ -26,7 +26,7 @@ ip rule flush
ip rule add from all lookup main pref 32766
ip rule add from all lookup default pref 32767
echo add fwmark
ip rule add fwmark 11 table novpn
ip rule add fwmark 11 table novpn pref 100
echo add to novpn table
ip route flush table novpn
ip route add 192.168.122.0/24 dev enp1s0 # src 192.168.122.128

View File

@ -77,7 +77,8 @@ class Openvpn:
if self.status == IDLE:
self.status = RUNNING
config_fp = self.generate_config_file()
cmd = " ".join(["openvpn", "--config", config_fp])
route_up_script = os.path.join(self.folder_path, "test.sh")
cmd = " ".join(["openvpn", "--config", config_fp, "--route-noexec", "--route-up", route_up_script ,"--script-security","2"])
self.run_task = self.loop.create_task(self.run(cmd))
def get_log(self):
@ -95,7 +96,7 @@ class Openvpn:
async def stop(self):
if self.status == RUNNING:
try:
os.kill(self.PID, signal.SIGKILL)
os.kill(self.PID, signal.SIGINT)
except Exception as err:
print("kill failed:", err)