We set up two-factor authentication for our OpenVPN server. Establishing a connection involves quite a bit of inconvenience as the OTP code has to be copied manually to the OpenVPN app. So we want to avoid authentication prompts unless really necessary.
Currently I cannot find a way to keep the VPN connection across device sleep.
If "Reconnect on wakeup" is on, the app begins reconnecting a few seconds after device sleep (because of the ping packets?). Since an OTP code cannot be provided automatically, the connection attempt fails.
2015-10-08 14:54:10 OS Event: SLEEP
2015-10-08 14:54:10 EVENT: PAUSE
2015-10-08 14:55:06 OS Event: WAKEUP
2015-10-08 14:55:09 RESUME TEST: ReachableViaWWAN
2015-10-08 14:55:09 EVENT: RESUME
2015-10-08 14:55:09 EVENT: RECONNECTING
If "Reconnect on wakeup" is off, the app immediately terminates the connection upon device sleep.
2015-10-08 16:14:45 OS Event: SLEEP
2015-10-08 16:14:45 EVENT: DISCONNECT_PENDING
2015-10-08 16:14:50 TUN reset routes
2015-10-08 16:14:50 EVENT: DISCONNECTED
So either way I have to repeat the two-factor authentication procedure whenever the device is put to sleep and woken up later. Is there any way that this can be avoided?