Revision 1ec79365
Added by Jim Pingle almost 7 years ago
src/etc/inc/system.inc | ||
---|---|---|
1185 | 1185 |
$cert_hostname = "{$config['system']['hostname']}-{$cert['refid']}"; |
1186 | 1186 |
|
1187 | 1187 |
$dn = array( |
1188 |
'countryName' => "US", |
|
1189 |
'stateOrProvinceName' => "State", |
|
1190 |
'localityName' => "Locality", |
|
1191 | 1188 |
'organizationName' => "{$g['product_name']} webConfigurator Self-Signed Certificate", |
1192 |
'emailAddress' => "admin@{$config['system']['hostname']}.{$config['system']['domain']}", |
|
1193 | 1189 |
'commonName' => $cert_hostname, |
1194 | 1190 |
'subjectAltName' => "DNS:{$cert_hostname}"); |
1195 | 1191 |
$old_err_level = error_reporting(0); /* otherwise openssl_ functions throw warnings directly to a page screwing menu tab */ |
src/usr/local/www/system_certmanager.php | ||
---|---|---|
1304 | 1304 |
continue; |
1305 | 1305 |
} |
1306 | 1306 |
|
1307 |
$subject = cert_get_subject_array($ca['crt']);
|
|
1307 |
$subject = cert_get_subject_hash($ca['crt']);
|
|
1308 | 1308 |
?> |
1309 | 1309 |
case "<?=$ca['refid'];?>": |
1310 |
$('#dn_country').val(<?=json_encode(cert_escape_x509_chars($subject[0]['v'], true));?>);
|
|
1311 |
$('#dn_state').val(<?=json_encode(cert_escape_x509_chars($subject[1]['v'], true));?>);
|
|
1312 |
$('#dn_city').val(<?=json_encode(cert_escape_x509_chars($subject[2]['v'], true));?>);
|
|
1313 |
$('#dn_organization').val(<?=json_encode(cert_escape_x509_chars($subject[3]['v'], true));?>);
|
|
1314 |
$('#dn_organizationalunit').val(<?=json_encode(cert_escape_x509_chars($subject[6]['v'], true));?>);
|
|
1310 |
$('#dn_country').val(<?=json_encode(cert_escape_x509_chars($subject['C'], true));?>);
|
|
1311 |
$('#dn_state').val(<?=json_encode(cert_escape_x509_chars($subject['ST'], true));?>);
|
|
1312 |
$('#dn_city').val(<?=json_encode(cert_escape_x509_chars($subject['L'], true));?>);
|
|
1313 |
$('#dn_organization').val(<?=json_encode(cert_escape_x509_chars($subject['O'], true));?>);
|
|
1314 |
$('#dn_organizationalunit').val(<?=json_encode(cert_escape_x509_chars($subject['OU'], true));?>);
|
|
1315 | 1315 |
break; |
1316 | 1316 |
<?php |
1317 | 1317 |
endforeach; |
src/usr/local/www/system_usermanager.php | ||
---|---|---|
409 | 409 |
|
410 | 410 |
$cert['descr'] = $_POST['name']; |
411 | 411 |
|
412 |
$subject = cert_get_subject_array($ca['crt']); |
|
413 |
|
|
414 |
$dn = array( |
|
415 |
'countryName' => $subject[0]['v'], |
|
416 |
'stateOrProvinceName' => $subject[1]['v'], |
|
417 |
'localityName' => $subject[2]['v'], |
|
418 |
'organizationName' => $subject[3]['v'], |
|
419 |
'emailAddress' => $subject[4]['v'], |
|
420 |
'commonName' => $userent['name']); |
|
412 |
$subject = cert_get_subject_hash($ca['crt']); |
|
413 |
|
|
414 |
$dn = array(); |
|
415 |
if (!empty($subject['C'])) { |
|
416 |
$dn['countryName'] = $subject['C']; |
|
417 |
} |
|
418 |
if (!empty($subject['ST'])) { |
|
419 |
$dn['stateOrProvinceName'] = $subject['ST']; |
|
420 |
} |
|
421 |
if (!empty($subject['L'])) { |
|
422 |
$dn['localityName'] = $subject['L']; |
|
423 |
} |
|
424 |
if (!empty($subject['O'])) { |
|
425 |
$dn['organizationName'] = $subject['O']; |
|
426 |
} |
|
427 |
if (!empty($subject['OU'])) { |
|
428 |
$dn['organizationalUnit'] = $subject['OU']; |
|
429 |
} |
|
430 |
$dn['commonName'] = $userent['name']; |
|
421 | 431 |
$cn_altname = cert_add_altname_type($userent['name']); |
422 | 432 |
if (!empty($cn_altname)) { |
423 | 433 |
$dn['subjectAltName'] = $cn_altname; |
src/usr/local/www/wizards/openvpn_wizard.inc | ||
---|---|---|
271 | 271 |
$org = $pconfig['step6']['organization']; |
272 | 272 |
} else { |
273 | 273 |
$ca = lookup_ca($pconfig['step6']['authcertca']); |
274 |
$cavl = cert_get_subject_array($ca['crt']);
|
|
275 |
$country = $cavl[0]['v'];
|
|
276 |
$state = $cavl[1]['v'];
|
|
277 |
$city = $cavl[2]['v'];
|
|
278 |
$org = $cavl[3]['v'];
|
|
274 |
$cavl = cert_get_subject_hash($ca['crt']);
|
|
275 |
$country = $cavl['C'];
|
|
276 |
$state = $cavl['ST'];
|
|
277 |
$city = $cavl['L'];
|
|
278 |
$org = $cavl['O'];
|
|
279 | 279 |
} |
280 | 280 |
$fields =& $pkg['step'][$stepid]['fields']['field']; |
281 | 281 |
|
Also available in: Unified diff
Certs: Fix CA subject assumptions. Fixes #8801
Several areas made assumptions about the number and order of CA subject
fields that were no longer correct after issue #8381 was corrected.
While here, also remove some outdated references to fields that are no
longer needed in related areas.