1
0
mirror of https://github.com/ArcticFoxes-net/ONC-Converter synced 2024-11-13 15:41:33 -05:00

Use the correct format for the client certificates

They're usually not in the PKCS#12 format but in X509.
This commit is contained in:
thomkeh 2018-07-17 15:41:28 +01:00 committed by GitHub
parent 552770e79b
commit 12e1f5501a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -220,11 +220,13 @@
let [cas, caGuids] = createCerts(keys, ovpn['ca'], 'Authority') let [cas, caGuids] = createCerts(keys, ovpn['ca'], 'Authority')
params['ServerCARefs'] = caGuids params['ServerCARefs'] = caGuids
certs = certs.concat(cas) certs = certs.concat(cas)
let [clientCerts, clientCertGuids] = createCerts(keys, ovpn['cert'], 'Client') let [clientCerts, clientCertGuids] = createCerts(keys, ovpn['cert'], 'Authority')
if (clientCerts[0]) { if (clientCerts) {
params['ClientCertType'] = 'Ref' params['ClientCertType'] = 'Pattern'
params['ClientCertRef'] = clientCertGuids[0] params['ClientCertPattern'] = {
certs.push(clientCerts[0]) 'IssuerCARef': clientCertGuids
}
certs = certs.concat(clientCerts)
} else { } else {
params['ClientCertType'] = 'None' params['ClientCertType'] = 'None'
} }
@ -344,14 +346,16 @@
alert("Please provide the file '" + certName + "' in 'Certificates and keys'") alert("Please provide the file '" + certName + "' in 'Certificates and keys'")
} }
let rawCerts = extractCas(cert) let rawCerts = extractCas(cert)
const format = (certType === 'Authority') ? 'X509' : 'PKCS12'
for (const cert of rawCerts) { for (const cert of rawCerts) {
const guid = `{${uuidv4()}}` const guid = `{${uuidv4()}}`
certGuids.push(guid) certGuids.push(guid)
certs.push({ let oncCert = {
'GUID': guid, 'GUID': guid,
'Type': certType, 'Type': certType
'X509': cert }
}) oncCert[format] = cert
certs.push(oncCert)
} }
} }
return [certs, certGuids] return [certs, certGuids]