0 votes
Hello guys!
I am using ClearOS 7 with OpenVPN application. It runs as two servers - one for UDP and one for TCP.
ClearOS generates personal configuration and certificates for users and by default we get OpenVPN configuration for UDP connection.
How to set ClearOS to generate it for TCP instead? I know that it easy just to replace one string in existing config but I want it to be done automatically without disturbing the user.
Saturday, July 01 2017, 08:23 AM
Share this post:
Responses (1)
  • Accepted Answer

    Saturday, July 01 2017, 09:07 AM - #Permalink
    0 votes
    At a big guess, it is one of these two:
    grep udp /usr/clearos/apps/openvpn/* -r
    /usr/clearos/apps/openvpn/libraries/OpenVPN.php: const DEFAULT_PROTOCOL = "udp";
    /usr/clearos/apps/openvpn/libraries/OpenVPN.php: const CONSTANT_PROTOCOL_UDP = "udp";
    I can't read php, but it likes like the .ovpn file is generated around lines 273 to 305 and reads the parameter $protocol. On line 369 $protocol seems to come from the get_client_protocol() from this file which is at line 341. This uses the value in DEFAULT_PROTOCOL *or* whatever is returned by config['proto']. At that point I think I am lost.

    It therefore looks like the quick and dirty method is to hard code the two relevant lines between 273 and 305. Alternatively you may be able to override DEFAULT_PROTOCOL. It is only used in the one function. I don't know what switching to a manual configuration in the webconfig will allow. From memory, not much, and it is difficult to switch back.

    Note that changing this file always risks being overwritten by a ClearOS update
    The reply is currently minimized Show
Your Reply