From 66a04862f9449d0eacd92b709b3d08abb4a4c118 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Sat, 15 Oct 2022 16:44:48 +0200 Subject: [PATCH] Override Mullvad password (#233) Set "m" as per official documentation: https://mullvad.net/en/help/installing-mullvad-iphone-and-ipad/ --- CHANGELOG.md | 1 + .../Managers/ProfileManager+Keychain.swift | 4 ++-- .../Managers/VPNManager+Configuration.swift | 14 +++++++++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d1a3be0b..fdc55d11 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Oeck provider is available again to free users. - Randomic crashes on profile updates. [#229](https://github.com/passepartoutvpn/passepartout-apple/pull/229) +- Mullvad: enforce password to avoid "Auth failed". [#233](https://github.com/passepartoutvpn/passepartout-apple/pull/233) ## 2.0.0 (2022-10-02) diff --git a/PassepartoutLibrary/Sources/PassepartoutProfiles/Managers/ProfileManager+Keychain.swift b/PassepartoutLibrary/Sources/PassepartoutProfiles/Managers/ProfileManager+Keychain.swift index dc1ebad4..925bed3f 100644 --- a/PassepartoutLibrary/Sources/PassepartoutProfiles/Managers/ProfileManager+Keychain.swift +++ b/PassepartoutLibrary/Sources/PassepartoutProfiles/Managers/ProfileManager+Keychain.swift @@ -29,7 +29,7 @@ import PassepartoutCore import PassepartoutUtils extension ProfileManager { - public func savePassword(forProfile profile: Profile) { + public func savePassword(forProfile profile: Profile, newPassword: String? = nil) { guard !profile.isPlaceholder else { assertionFailure("Placeholder") return @@ -37,7 +37,7 @@ extension ProfileManager { guard let keychainEntry = profile.keychainEntry else { return } - let password = profile.account.password + let password = newPassword ?? profile.account.password guard !password.isEmpty else { keychain.removePassword( for: keychainEntry, diff --git a/PassepartoutLibrary/Sources/PassepartoutVPN/Managers/VPNManager+Configuration.swift b/PassepartoutLibrary/Sources/PassepartoutVPN/Managers/VPNManager+Configuration.swift index d50ad1f8..7ef17c78 100644 --- a/PassepartoutLibrary/Sources/PassepartoutVPN/Managers/VPNManager+Configuration.swift +++ b/PassepartoutLibrary/Sources/PassepartoutVPN/Managers/VPNManager+Configuration.swift @@ -56,8 +56,20 @@ extension VPNManager { } } + // specific provider customizations + var newPassword: String? + if let providerName = profile.providerName { + switch providerName { + case .mullvad: + newPassword = "m" + + default: + break + } + } + // IMPORTANT: must commit password to keychain (tunnel needs a password reference) - profileManager.savePassword(forProfile: profile) + profileManager.savePassword(forProfile: profile, newPassword: newPassword) let parameters = VPNConfigurationParameters( profile,