diff --git a/CHANGELOG.md b/CHANGELOG.md index fe8968a..7fb1bae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +### Added + +- Handle `--data-ciphers` from OpenVPN 2.5 + ## 3.2.0 (2021-01-07) ### Changed diff --git a/TunnelKit/Sources/Protocols/OpenVPN/Authenticator.swift b/TunnelKit/Sources/Protocols/OpenVPN/Authenticator.swift index d6a6452..ec1eb20 100644 --- a/TunnelKit/Sources/Protocols/OpenVPN/Authenticator.swift +++ b/TunnelKit/Sources/Protocols/OpenVPN/Authenticator.swift @@ -156,7 +156,11 @@ extension OpenVPN { } // peer info - raw.appendSized(Z(CoreConfiguration.OpenVPN.peerInfo, nullTerminated: true)) + var extra: [String: String] = [:] + if let dataCiphers = options.dataCiphers { + extra["IV_CIPHERS"] = dataCiphers.map { $0.rawValue }.joined(separator: ":") + } + raw.appendSized(Z(CoreConfiguration.OpenVPN.peerInfo(extra: extra), nullTerminated: true)) if CoreConfiguration.logsSensitiveData { log.debug("TLS.auth: Put plaintext (\(raw.count) bytes): \(raw.toHex())") diff --git a/TunnelKit/Sources/Protocols/OpenVPN/CoreConfiguration+OpenVPN.swift b/TunnelKit/Sources/Protocols/OpenVPN/CoreConfiguration+OpenVPN.swift index bda07e1..2c45335 100644 --- a/TunnelKit/Sources/Protocols/OpenVPN/CoreConfiguration+OpenVPN.swift +++ b/TunnelKit/Sources/Protocols/OpenVPN/CoreConfiguration+OpenVPN.swift @@ -63,7 +63,7 @@ extension CoreConfiguration { // MARK: Authentication - static let peerInfo: String = { + static func peerInfo(extra: [String: String]? = nil) -> String { let platform: String #if os(iOS) platform = "ios" @@ -83,9 +83,12 @@ extension CoreConfiguration { if LZOIsSupported() { info.append("IV_LZO=1") } + if let extra = extra { + info.append(contentsOf: extra.map { "\($0)=\($1)" }) + } info.append("") return info.joined(separator: "\n") - }() + } static let randomLength = 32