TunSafe Forum

Welcome to the TunSafe Community Forum. This is open for discussions related to TunSafe and the WireGuard protocol.

You are not logged in.

#1 2019-12-05 14:37:17

Registered: 2019-12-05
Posts: 1

PostUp too early and/or always blocking


I'd like to automatically map a network drive to a share on the other end of the tunnel when the connection is established. And then remove it right before the tunnel goes down again.

The PostUp/PreDown options seem like the obvious way to do it.

Alas, PostUp triggers before the IP connection is actually established. So the server is not available at that point in time. Which makes drive mappings... difficult.

I also tried to use Windows' start command (which launches a program and returns immediately). The idea was that the script might be started early, but it could just keep pinging the server until TunSafe (which would instantly resume its workflow) actually had the tunnel up and running.

Problem here: TunSafe seems to always block and wait for the command to finish. Even when 'start' is used.

I found this thread from last year which seems to confirm that the "post" in PostUp actually refers to the interface setup, not the tunnel itself. Not sure what use that would have, or whether it is what a normal, unassuming user would understand PostUp to mean.

So what are my options here? Is there another PostUp-like option that refers to the tunnel itself? Can I somehow convince TunSafe to do a fire-and-forget launch of the command? I guess I could try and run TunSafe from the command line and then use a wrapper script to map the drives afterwards, but I can't find any documentation on the command line syntax. Is there any info available on that?


#2 2020-01-14 14:20:30

Registered: 2020-01-12
Posts: 3

Re: PostUp too early and/or always blocking

I had this same problem and agree with PostUP not really being just that, at least when it comes to a fully functional tunnel with traffic.

So what I did was make a script that takes the exact time (HH:MM) and incremented that with one minute (HH:MM+1) and scheduled a task to perform what I want it to do when the connections is really up. Ie, it doesnt hold up tunsafe and it can complete the connection and about a minute after I get what I need and want. Just a suggestion on how you can do it, even though I wish there was in tunsafe to begin with that PostUp is just that, since PreUp works fine already, there is no need to have PostUP being anything other then a fully functional connection IMHO.



Board footer

Powered by FluxBB