Error Loading extension section usr_cert
Asked Answered
E

5

13

I am running openvpn on an Ubuntu 14.04 box. The setup was fine until an OpenSSL upgrade, then when I try to create new client cert with easy-rsa, I got this message:

root@:easy-rsa# ./pkitool onokun
Using Common Name: onokun
Generating a 2048 bit RSA private key
.+++
........+++
writing new private key to 'onokun.key'
-----
Using configuration from /etc/openvpn/easy-rsa/openssl-1.0.0.cnf
Error Loading extension section usr_cert
3074119356:error:0E06D06C:configuration file routines:NCONF_get_string:no value:conf_lib.c:335:group=CA_default name=email_in_dn
3074119356:error:2207507C:X509 V3 routines:v2i_GENERAL_NAME_ex:missing value:v3_alt.c:537:
3074119356:error:22098080:X509 V3 routines:X509V3_EXT_nconf:error in extension:v3_conf.c:93:name=subjectAltName, value=onokun

This problem is different from a reported bug that the which opensslcnf script can not find an matching version of openssl.cnf to use (above message shows openssl-1.0.0.cnf). I performed a Google search but did not find an answer.

Here are some environment information:

## openvpn
OpenVPN 2.3.2 i686-pc-linux-gnu [SSL (OpenSSL)] [LZO] [EPOLL] [PKCS11] [eurephia] [MH] [IPv6] built on Feb  4 2014
Originally developed by James Yonan

## openssl
OpenSSL 1.0.1f 6 Jan 2014

## dpkg --get-selections | grep ssl
libgnutls-openssl27:i386                        install
libio-socket-ssl-perl                           install
libnet-smtp-ssl-perl                            install
libnet-ssleay-perl                              install
libssl-dev:i386                                 install
libssl-doc                                      install
libssl0.9.8:i386                                install
libssl1.0.0:i386                                install
openssl                                         install
ssl-cert                                        install

What should I look at to solve this? Thanks,

Elke answered 17/6, 2014 at 3:18 Comment(0)
D
7
Using configuration from /etc/openvpn/easy-rsa/openssl-1.0.0.cnf
Error Loading extension section usr_cert

I don't have a /etc/openvpn/easy-rsa/openssl-1.0.0.cnf, so take this with a grain of salt...

opensslconf.h from OpenSSL's distribution does include that section:

openssl-1.0.1h$ grep -R usr_cert *
apps/openssl-vms.cnf:x509_extensions    = usr_cert      # The extensions to add to the cert
apps/openssl-vms.cnf:[ usr_cert ]
apps/openssl.cnf:x509_extensions    = usr_cert      # The extensions to add to the cert
apps/openssl.cnf:[ usr_cert ]

Can you restore an old version of /etc/openvpn/easy-rsa/openssl-1.0.0.cnf?

Here's the section from apps/openssl.cnf. You might consider adding it to Easy RSA's configuration file if its missing. First, try an empty section. Then try adding the original code back.

[ usr_cert ]

# These extensions are added when 'ca' signs a request.

# This goes against PKIX guidelines but some CAs do it and some software
# requires this to avoid interpreting an end user certificate as a CA.

basicConstraints=CA:FALSE

# Here are some examples of the usage of nsCertType. If it is omitted
# the certificate can be used for anything *except* object signing.

# This is OK for an SSL server.
# nsCertType            = server

# For an object signing certificate this would be used.
# nsCertType = objsign

# For normal client use this is typical
# nsCertType = client, email

# and for everything including object signing:
# nsCertType = client, email, objsign

# This is typical in keyUsage for a client certificate.
# keyUsage = nonRepudiation, digitalSignature, keyEncipherment

# This will be displayed in Netscape's comment listbox.
nsComment           = "OpenSSL Generated Certificate"

# PKIX recommendations harmless if included in all certificates.
subjectKeyIdentifier=hash
authorityKeyIdentifier=keyid,issuer

# This stuff is for subjectAltName and issuerAltname.
# Import the email address.
# subjectAltName=email:copy
# An alternative to produce certificates that aren't
# deprecated according to PKIX.
# subjectAltName=email:move

# Copy subject details
# issuerAltName=issuer:copy

#nsCaRevocationUrl      = http://www.domain.dom/ca-crl.pem
#nsBaseUrl
#nsRevocationUrl
#nsRenewalUrl
#nsCaPolicyUrl
#nsSslServerName

# This is required for TSA certificates.
# extendedKeyUsage = critical,timeStamping
Delgadillo answered 17/6, 2014 at 7:26 Comment(1)
Thanks, I copied the usr_cert section from yours and all went ok. My openssl-1.0.0.cnf came from a fresh install of Version: 2.2.2-1 (Ubuntu 14.04), for the record I diff'ed them here pastebin.com/gCwZX2Z0 and still trying to figure out what was wrong.Elke
L
7

By comparing an earlier Ubuntu 14.04 install that did not have this problem, it seems the specific issue is with "subjectAltName". I didn't read up on what this does, but the command below will fix your "openssl-1.0.0.cnf" file:

perl -p -i -e 's|^(subjectAltName=)|#$1|;' /etc/openvpn/easy-rsa/openssl-1.0.0.cnf

I should probably file a bug report.

Labyrinthine answered 27/9, 2014 at 19:41 Comment(3)
This seems to break the file and I get this error: error on line 222 of /usr/share/easy-rsa/openssl-1.0.0.cnfLockman
I commented the "subjectAltName=" line in ` /usr/share/easy-rsa/openssl-1.0.0.cnf ` instead of running this one-liner. All went OK.Wendellwendi
Had same issue, was using this guide, and this solved the issue (step 7) digitalocean.com/community/tutorials/…Unreserve
M
7

I finally got his working (on my machine) Firstly my setup is a little different, I'm on Windows10, running OpenSSL 1.0.2h. I'm trying to generate multiple certificates, CAs and other things for tests, I am getting the error:

configuration file routines:NCONF_get_string:no value:.\crypto\conf\conf_lib.c:324:group=CA_default name=email_in_dn

To fix it I found placing the entry email_in_dn = no in CA_Default openssl.cfg section as bellow

####################################################################
[ CA_default ]
dir     = ./demoCA              # Where everything is kept
certs       = $dir/certs        # Where the issued certs are kept
crl_dir     = $dir/crl          # Where the issued crl are kept
database    = $dir/index.txt    # database index file.
new_certs_dir   = $dir/newcerts # default place for new certs.

certificate = $dir/ca.crt       # The CA certificate
serial      = $dir/serial       # The current serial number
crl     = $dir/crl.pem          # The current CRL
private_key = $dir/private/caprivkey.pem# The private key
RANDFILE    = $dir/private/.rand    # private random number file
x509_extensions = usr_cert      # The extentions to add to the cert
email_in_dn = no                # <-- fixes CONF_get_string:no value

I hope this helps someone else.

Monkery answered 25/8, 2016 at 9:17 Comment(0)
G
1

This is filed as a bug in Ubuntu. See SSL certificate creation crashes without subjectAltName.

The work-around described by Yuriy seems to work (copied from launchpad):

in the file /usr/share/easy-rsa/pkitool

just replace expressions:

KEY_ALTNAMES="$KEY_CN"

to:

KEY_ALTNAMES="DNS:${KEY_CN}"

In my version of the file this is line 284, just after the string "Using Common Name"

Gully answered 17/2, 2016 at 11:47 Comment(0)
O
-1

To get rid of this error:

3074119356:error:0E06D06C:configuration file routines:NCONF_get_string:no value:conf_lib.c:335:group=CA_default name=email_in_dn

use

-noemailDN 

in the openssl command.

For example:

$  openssl ca -batch -config openssl.cnf -extensions usr_cert -noemailDN -days 375 -notext -md sha256 -in csr/www.example8.com.csr.pem -out certs/www.example8.com.cert.pem -verbose -passin pass:changeit
Overline answered 31/10, 2017 at 19:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.