ivpn / ios-app

Official IVPN iOS app
https://www.ivpn.net/apps-ios
GNU General Public License v3.0
451 stars 94 forks source link

Rotate WireGuard keys when manually connecting from iOS Settings #348

Closed jurajhilje closed 11 months ago

jurajhilje commented 1 year ago

We want to improve the background key rotation to support manually connecting to VPN from the iOS Settings.

This can be accomplished in 2 ways:

Notes for QA

Now when VPN is connected (also from the iOS Settings), key is rotated immediately if rotation period is due.

jurajhilje commented 11 months ago

@gorkapernas Available for QA in 2.11.1 (1). Key rotation debug is enabled in 2.11.1 (2).

gorkapernas commented 11 months ago

@jurajhilje not sure if it's related to this ticket, but on version 2.11.1 (1), and with WireGuard, after coming back from sleep mode, the app displays the following error.

wireguad error

The issue happens when connected with WireGuard and let the device go to sleep mode, if V2Ray is enabled, after awaking the device, the app will simply be disconnected from the VPN, if V2Ray is disabled, you get the error that you can see in the screenshot above.

STR:

  1. Install v2.11.1 (1).
  2. Login.
  3. Connect with WireGuard.
  4. Let the device go to sleep mode.
  5. Awake the device.
  6. Observe the issue.
  7. Repeat steps 3 to 6, but with V2Ray enabled.

Can you confirm the issue and if it's related to these changes?

jurajhilje commented 11 months ago

@gorkapernas New build is available, with different logic - just shorter key rotation evaluation, instead trying to rotate the keys at the same time as connecting (which I think it might caused your issue).

gorkapernas commented 11 months ago

Verified with the latest beta builds, when the user is connected via iOS VPN Settings, the key is generated in the background when the key rotation period expires. Furthermore if the key rotation period is expired, the user can also successfully connect via iOS VPN settings, in this case, the WireGuard key is generated upon connection.

Note: A couple of issues have been reported regarding the VPN management via iOS Settings. These can be fixed in future releases. https://github.com/ivpn/ios-app/issues/405 https://github.com/ivpn/ios-app/issues/409