Parse dataCiphersFallback as last resort
Prioritize over deprecate cipher.
This commit is contained in:
parent
7ea088e4a1
commit
c15d6f521a
|
@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
### Added
|
||||
|
||||
- Handle `--data-ciphers` from OpenVPN 2.5
|
||||
- Handle `--data-ciphers` and `data-ciphers-fallback` from OpenVPN 2.5
|
||||
|
||||
## 3.2.0 (2021-01-07)
|
||||
|
||||
|
|
|
@ -44,6 +44,8 @@ extension OpenVPN {
|
|||
|
||||
static let dataCiphers = NSRegularExpression("^(data-ciphers|ncp-ciphers) +[^,\\s]+(:[^,\\s]+)*")
|
||||
|
||||
static let dataCiphersFallback = NSRegularExpression("^data-ciphers-fallback +[^,\\s]+")
|
||||
|
||||
static let auth = NSRegularExpression("^auth +[\\w\\-]+")
|
||||
|
||||
static let compLZO = NSRegularExpression("^comp-lzo.*")
|
||||
|
@ -202,6 +204,7 @@ extension OpenVPN {
|
|||
var currentBlock: [String] = []
|
||||
|
||||
var optDataCiphers: [Cipher]?
|
||||
var optDataCiphersFallback: Cipher?
|
||||
var optCipher: Cipher?
|
||||
var optDigest: Digest?
|
||||
var optCompressionFraming: CompressionFraming?
|
||||
|
@ -363,6 +366,13 @@ extension OpenVPN {
|
|||
optDataCiphers?.append(cipher)
|
||||
}
|
||||
}
|
||||
Regex.dataCiphersFallback.enumerateArguments(in: line) {
|
||||
isHandled = true
|
||||
guard let rawValue = $0.first else {
|
||||
return
|
||||
}
|
||||
optDataCiphersFallback = Cipher(rawValue: rawValue.uppercased())
|
||||
}
|
||||
Regex.auth.enumerateArguments(in: line) {
|
||||
isHandled = true
|
||||
guard let rawValue = $0.first else {
|
||||
|
@ -635,7 +645,7 @@ extension OpenVPN {
|
|||
|
||||
// MARK: General
|
||||
|
||||
sessionBuilder.cipher = optCipher
|
||||
sessionBuilder.cipher = optDataCiphersFallback ?? optCipher
|
||||
sessionBuilder.dataCiphers = optDataCiphers
|
||||
sessionBuilder.digest = optDigest
|
||||
sessionBuilder.compressionFraming = optCompressionFraming
|
||||
|
|
Loading…
Reference in New Issue