Hi,

On Thu, Apr 01, 2021 at 11:13:50AM +0200, Ralf Hildebrandt wrote:
> > Use 2.5, which has asynchronous (deferred) client-connect scripts.
> 
> Are there any changes needed for that in the config / on the script
> side of things?

None in the config, but the script needs to change.

There is a new env variable, "$client_connect_deferred_file", which 
controls if the server can do it (2.5 and up) - so the script might
want to check that

    # redirect output so we can see it in the cc.log
    exec >>/my/private/tmp/cc.log 2>&1

    # tell server we want deferred handling (= it should regularily
    # check that file for updates
    echo 2 >$client_connect_deferred_file

    # child process - simple shell backgrounding here
    ( 
        echo "backgrounded..."
        # do mighty important work
        sleep 10
        if [ something failed ]
            echo "async done, signal FAIL!"
            ret=0
        else
            echo "async done, signal success!"
            ret=1
        fi

        # this is how the server knows -> the "2" changes to "0" or "1"
        # in that file
        echo $ret >$client_connect_deferred_file
    ) &

    # parent process must "exit 0" (with "2" in the file) to signal "defer OK"
    exit 0


The manpage (... saga) also has more material on this, if you know to
search for "client_connect_deferred_file" :-)

Feel free to be very confused by the available documentation, and in 
the end suggest wording that helps find your way more easily.  Arne and
I have done our best, but it might still be confusing.

gert

-- 
"If was one thing all people took for granted, was conviction that if you 
 feed honest figures into a computer, honest figures come out. Never doubted 
 it myself till I met a computer with a sense of humor."
                             Robert A. Heinlein, The Moon is a Harsh Mistress

Gert Doering - Munich, Germany                             g...@greenie.muc.de

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Openvpn-users mailing list
Openvpn-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-users

Reply via email to