working prototype
This commit is contained in:
parent
85a1f4f17e
commit
566a8b675d
@ -26,7 +26,7 @@ ip rule flush
|
|||||||
ip rule add from all lookup main pref 32766
|
ip rule add from all lookup main pref 32766
|
||||||
ip rule add from all lookup default pref 32767
|
ip rule add from all lookup default pref 32767
|
||||||
echo add fwmark
|
echo add fwmark
|
||||||
ip rule add fwmark 11 table novpn
|
ip rule add fwmark 11 table novpn pref 100
|
||||||
echo add to novpn table
|
echo add to novpn table
|
||||||
ip route flush table novpn
|
ip route flush table novpn
|
||||||
ip route add 192.168.122.0/24 dev enp1s0 # src 192.168.122.128
|
ip route add 192.168.122.0/24 dev enp1s0 # src 192.168.122.128
|
||||||
|
|||||||
@ -77,7 +77,8 @@ class Openvpn:
|
|||||||
if self.status == IDLE:
|
if self.status == IDLE:
|
||||||
self.status = RUNNING
|
self.status = RUNNING
|
||||||
config_fp = self.generate_config_file()
|
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))
|
self.run_task = self.loop.create_task(self.run(cmd))
|
||||||
|
|
||||||
def get_log(self):
|
def get_log(self):
|
||||||
@ -95,7 +96,7 @@ class Openvpn:
|
|||||||
async def stop(self):
|
async def stop(self):
|
||||||
if self.status == RUNNING:
|
if self.status == RUNNING:
|
||||||
try:
|
try:
|
||||||
os.kill(self.PID, signal.SIGKILL)
|
os.kill(self.PID, signal.SIGINT)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
print("kill failed:", err)
|
print("kill failed:", err)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user