1
0
mirror of https://github.com/ArcticFoxes-net/ONC-Converter synced 2024-09-19 08:04:43 -04:00

Correctly parse verify-x509

This commit is contained in:
thomkeh 2018-07-17 16:31:08 +01:00 committed by GitHub
parent 7cbfd683f2
commit c66de4268e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -251,12 +251,26 @@
params['TLSAuthContents'] = convertKey(keyString)
if (authKey[1]) params['KeyDirection'] = authKey[1]
}
// TODO: figure out what to do with this
// if (ovpn['verify-x509-name']) {
// params['VerifyX509'] = {
// 'Name': ovpn['verify-x509-name']
// }
// }
if (ovpn['verify-x509-name']) {
const x509String = ovpn['verify-x509-name']
let x509 = {}
if (x509String.includes("'")) {
// the name is quoted with '
const parts = x509String.split("'")
x509['Name'] = `'${parts[1]}'`
if (parts[2]) {
x509['Type'] = parts[2].trim()
}
} else {
const parts = x509String.split(' ')
x509['Name'] = parts[0]
if (parts[1]) {
x509['Type'] = parts[1]
}
}
params['VerifyX509'] = x509
}
// set parameters if they exist in the ovpn config
let conditionalSet = (ovpnName, oncName, type = 'str') => {
if (ovpn[ovpnName]) {