Allow configuration of OpenVPN keepalive
The keepalive option is always added to an OpenVPN server configuration.
There are many scenarios where this is not wanted and will prevent the required behavior. In my case, when working with iOS VPN on demand rule-driven behavior, the keepalive had to be removed (by commenting out line 453 in openvpn.inc).
What's even worse is that, with the keepalive option configured, you can't even add options such as ping, ping-exit and inactive (i.e., via OpenVPN's "Advanced configuration") because the server fails to start when you do, citing a conflict with the keepalive option.
I'd suggest that the keepalive option should be an optional item configured via the GUI. A more complete/useful strategy would be to allow configuration of all of the following via the GUI:
- keepalive & both time parameters (should be mutually exclusive with ping/ping-exit)
- ping with time parameter
- ping exit with time parameter
- inactive with time parameter
along with a checkbox-type option to also push any of these to the client.
Fix OpenVPN keepalive default values. Fixes #3473
(cherry picked from commit 99d7e8c10e96e6f22ad47973d07258cd02426fe6)
#9 Updated by IT Sex over 1 year ago
Ran into the problem. Found out that you can comment-out or change the way the keepalive directive is added to new openVPN configurations using pfSense's Diagnostics>Edit File feature. Browse to /etc/inc/ and open /etc/inc/openvpn.inc, then find "keepalive" to see the line of the pfSense script where it is added. Adding a # to the argument (changing it to "#keepalive 10 60\n") and saving the script seems like the minimum-impact way to disable keepalive, and worked to let me add ping to my configs.
Just for clarity, this seems to keep pfSense from adding the keepalive directive to any (new?) openVPN (client?) configurations. It could break stuff that depends on that, although in my experience running openVPN clients without keepalive works just fine, and you should be able to add in back in manually with the advanced settings option. I did try looking for the openVPN config files themselves, but it looks like those are generated only temporarily (using the script edited above) when you run them.
#12 Updated by Jim Pingle 6 months ago
- Status changed from Feedback to In Progress
I have not changed anything in my configuration, and after upgrading to a snapshot with these changes, I am seeing errors in the OpenVPN log:
Sep 20 10:37:33 clara openvpn: Options error: Unrecognized option or missing or extra parameter(s) in /var/etc/openvpn/client1.conf:10: keepalive (2.4.7) Sep 20 10:37:33 clara openvpn: Use --help for more information.
: grep -n keepalive /var/etc/openvpn/client1.conf 10:keepalive
It's missing the default set of parameters that should be after it (