OpenVPN client-connect script: "mode server required" ?



  • Hello!

    Im new to pfsense, and i just setup pfsense 2.4.4-RELEASE amd64.
    So far everything is working like a charm.
    I seriously love this firewall already! - Lots of advanced stuff and options!

    OpenVPN is also working and performing well, but i'd like to use the "client-connect" parameter to run a script to mount Windows shares on connect.
    But it always fails when i add it. The log says:

    Options error: --client-connect requires --mode server
    

    But "mode server" doesn't sound like the correct mode for a windows SSL VPN client, right?
    I see the topic has been discussed here:
    https://forum.netgate.com/topic/45652/openvpn-problems
    But that thread wasnt helpful in my case.

    Is there other option i am missing? Or do i really have to make it "mode server" for some reason?

    here is my client config:

    dev tun
    persist-tun
    persist-key
    cipher AES-128-CBC
    auth SHA256
    tls-client
    client
    resolv-retry infinite
    remote myDomain.org 1194 udp
    auth-user-pass
    ca mars-UDP4-1194-ca.crt
    tls-auth mars-UDP4-1194-tls.key 1
    remote-cert-tls server
    script-security 3
    client-connect C:\\openvpn-scripts\\up.bat
    client-disconnect C:\\openvpn-scripts\\down.bat
    

    Thanks in advance
    ND



  • So, you are on Windows running a client to pfSense.
    You are in the wrong forum if that is the case.

    Here is a post I wrote on a Dutch form that describes what you need,
    can use an online translator:
    https://www.synology-forum.nl/vpn-server/openvpn-9-automatisch-share(s)-(ont)koppelen/msg225285/#msg225285



  • Hi Pippin!

    I used the installer-package on the windows-client, that was generated by pfsense itself. So i guess im in the right Forum :)

    Thanks for your link.
    But what u describe is just what i have configured.
    I still get the same error with this.

    Any other suggestions?
    ND



  • @ndev said in OpenVPN client-connect script: "mode server required" ?:

    But what u describe is just what i have configured.

    No it's not, please try to read carefully.



  • You want to run a script as a client, that's why:

    Options error: --client-connect requires --mode server
    

    See now?



  • Yep you are right!
    I seen it now. client-connect is the wrong option in this case, its simply "up".
    I changed it now and its working.

    Thanks!
    Regards , ND



  • Welcome.