From d026004db3f3ba20339b70bb7c77d8e469bdc930 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Tue, 23 Oct 2018 18:59:53 +0200 Subject: [PATCH] Raise exception on external file in .ovpn - ca - cert - key - tls-auth - tls-crypt --- .../Sources/VPN/TunnelKitProvider+FileConfiguration.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Passepartout/Sources/VPN/TunnelKitProvider+FileConfiguration.swift b/Passepartout/Sources/VPN/TunnelKitProvider+FileConfiguration.swift index 66a0152d..f9a644f1 100644 --- a/Passepartout/Sources/VPN/TunnelKitProvider+FileConfiguration.swift +++ b/Passepartout/Sources/VPN/TunnelKitProvider+FileConfiguration.swift @@ -53,6 +53,8 @@ extension TunnelKitProvider.Configuration { static let keyDirection = Utils.regex("^key-direction +\\d") + static let externalFiles = Utils.regex("^(ca|cert|key|tls-auth|tls-crypt)") + static let blockBegin = Utils.regex("^<[\\w\\-]+>") static let blockEnd = Utils.regex("^<\\/[\\w\\-]+>") @@ -209,6 +211,9 @@ extension TunnelKitProvider.Configuration { Regex.fragment.enumerateArguments(in: line) { (_) in unsupportedError = ApplicationError.unsupportedConfiguration(option: "fragment") } + Regex.externalFiles.enumerateArguments(in: line) { (_) in + unsupportedError = ApplicationError.unsupportedConfiguration(option: "external file: \"\(line)\"") + } if let error = unsupportedError { throw error