RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1330753 - libtasn1 doesn't handle OIDs which have elements of size which exceed 32-bits
Summary: libtasn1 doesn't handle OIDs which have elements of size which exceed 32-bits
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libtasn1
Version: 7.1
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Nikos Mavrogiannopoulos
QA Contact: Alicja Kario
URL:
Whiteboard:
Depends On:
Blocks: 1323644 1382094
TreeView+ depends on / blocked
 
Reported: 2016-04-26 21:12 UTC by John Mitsch
Modified: 2016-11-04 08:28 UTC (History)
10 users (show)

Fixed In Version: libtasn1-3.8-3.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1382094 (view as bug list)
Environment:
Last Closed: 2016-11-04 08:28:59 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
working cert (5.04 KB, text/x-vhdl)
2016-04-26 21:12 UTC, John Mitsch
no flags Details
working key (1.64 KB, text/x-vhdl)
2016-04-26 21:13 UTC, John Mitsch
no flags Details
working ca cert (5.39 KB, text/plain)
2016-04-26 21:13 UTC, John Mitsch
no flags Details
not working cert (2.38 KB, text/x-vhdl)
2016-04-26 21:14 UTC, John Mitsch
no flags Details
not working key (1.64 KB, text/x-vhdl)
2016-04-26 21:14 UTC, John Mitsch
no flags Details
not working ca cert (5.39 KB, text/plain)
2016-04-26 21:14 UTC, John Mitsch
no flags Details
http logs syncing an ostree repo from the capsule (4.14 KB, text/plain)
2016-05-03 20:45 UTC, John Mitsch
no flags Details
http logs using curl from a capsule (2.63 KB, text/plain)
2016-05-03 20:45 UTC, John Mitsch
no flags Details
http logs syncing an ostree repo from the capsule (23.42 KB, text/plain)
2016-05-03 21:25 UTC, John Mitsch
no flags Details
ostree certs and repo config for reproducing (8.39 KB, application/zip)
2016-07-01 19:20 UTC, John Mitsch
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1353838 0 unspecified CLOSED libtasn1 doesn't handle OIDs which have elements of size which exceed 32-bits 2021-02-22 00:41:40 UTC
Red Hat Product Errata RHBA-2016:2551 0 normal SHIPPED_LIVE libtasn1 bug fix update 2016-11-03 14:20:41 UTC

Description John Mitsch 2016-04-26 21:12:25 UTC
Description of problem:

I am unable to access an ostree repository with the certs we generate, but I am able to access it with curl with those certs. I am also able to access it with different certs (I will attach both)

The error message is -- error: Server required TLS certificate

Version-Release number of selected component (if applicable):

ostree 2016.1
  +libsoup +gpgme +libarchive +selinux

How reproducible:

Always

Steps to Reproduce:
I will give instructions to reproduce it in a production server of Satellite in a private comment below.

Actual results:

I am restricted from accessing the repo

Expected results:

The certs work on the repo

Comment 1 John Mitsch 2016-04-26 21:12:53 UTC
Created attachment 1151115 [details]
working cert

Comment 2 John Mitsch 2016-04-26 21:13:11 UTC
Created attachment 1151116 [details]
working key

Comment 3 John Mitsch 2016-04-26 21:13:37 UTC
Created attachment 1151118 [details]
working ca cert

Comment 4 John Mitsch 2016-04-26 21:14:03 UTC
Created attachment 1151119 [details]
not working cert

Comment 5 John Mitsch 2016-04-26 21:14:24 UTC
Created attachment 1151121 [details]
not working key

Comment 6 John Mitsch 2016-04-26 21:14:49 UTC
Created attachment 1151122 [details]
not working ca cert

Comment 8 Colin Walters 2016-04-26 21:43:21 UTC
What's the version of libsoup in use here?  Or more generally what is the system hosting ostree?  Is it e.g. RHEL 7.2, is it Fedora 24, etc?

Comment 9 Colin Walters 2016-04-26 21:49:13 UTC
And just to sanity check, can you access the Akamai CDN with this copy of ostree using entitled certs?

Comment 11 John Mitsch 2016-04-27 13:49:08 UTC
Colin,

It is using libsoup-2.48.1-3.el7.x86_64 and it is a centos 7.1 machine

Neither of these certs will work with the cdn as they are generated by the Satellite.

I would like to clarify a few points:

- the satellite is generating a 'copy' of the cdn
- the satellite is generating its own entitlement certs (attached as "working") which work fine with ostree   
- the satellite is generating another ueber cert (attached as "not working") that does not work with ostree, but works with curl, yum, etc....

Comment 12 Jeff Ortel 2016-04-27 16:07:59 UTC
FWIW, Tried this on updated f23 box and got same error:

[jortel@f23d ostree]$ ostree --repo=. pull pulp


error: Server required TLS certificate

____________________

Installed:

ostree-2015.11-2.fc23.x86_64
libsoup-2.52.2-1.fc23.x86_64

Comment 13 John Mitsch 2016-05-03 12:39:27 UTC
I am wondering what the status of this bug is and if any more information is needed. Is there any more information we can provide? Any logging we can turn on for more debugging?

Comment 14 Colin Walters 2016-05-03 12:57:17 UTC
Sorry, meant to update it.  I've reproduced the problem, I suspect it's something going wrong inside the glib-networking gnutls integration.

There is the OSTREE_DEBUG_HTTP environment variable but it doesn't help with this.

Comment 15 Colin Walters 2016-05-03 18:36:28 UTC
Okay, so a very important detail here:

 - curl uses NSS (in Fedora/RHEL)
 - ostree uses glib-networking which currently uses GnuTLS (though there are non-upstream patches for OpenSSL)

Apparently coercing NSS to emit useful debuginfo requires recompiling it, which I tried but still didn't get it to work. ( https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS/Reference/NSS_environment_variables )  Will look at that more in a bit.

In contrast, GnuTLS offers GNUTLS_DEBUG_LEVEL: https://gnutls.org/manual/html_node/Debugging-and-auditing.html
which is pretty much exactly what we need.

The relevant failure seems to be:

...
gnutls[4]: HSK[0x7f3178315d00]: SERVER HELLO DONE (14) was received. Length 0[0], frag offset 0, frag length: 1, sequence: 0
gnutls[4]: HSK[0x7f3178315d00]: CERTIFICATE was queued [1759 bytes]
gnutls[4]: HSK[0x7f3178315d00]: CLIENT KEY EXCHANGE was queued [70 bytes]
gnutls[4]: HSK[0x7f3178315d00]: CERTIFICATE VERIFY was queued [264 bytes]
gnutls[4]: REC[0x7f3178315d00]: Sent ChangeCipherSpec
...
gnutls[4]: HSK[0x7f3178315d00]: Cipher Suite: ECDHE_RSA_AES_256_GCM_SHA384
gnutls[4]: HSK[0x7f3178315d00]: Initializing internal [write] cipher sessions
gnutls[4]: HSK[0x7f3178315d00]: recording tls-unique CB (send)
gnutls[4]: HSK[0x7f3178315d00]: FINISHED was queued [16 bytes]
...
gnutls[5]: REC[0x7fea901ff330]: SSL 3.3 Alert packet received. Epoch 0, length: 2
gnutls[5]: REC[0x7fea901ff330]: Expected Packet Handshake(22)
...
gnutls[5]: REC[0x7f3178315d00]: Alert[2|51] - Decrypt error - was received


For a successful, run, the last line looks like:

gnutls[5]: REC[0x7feba424fed0]: Received Packet Handshake(22) with length: 48

I do notice at least with Akamai, we negotiate:

gnutls[4]: HSK[0x7feba424fed0]: Cipher Suite: RSA_AES_256_CBC_SHA1

But AFAIK both should be fine, certainly GnuTLS knows about it:

# gnutls-cli -l |grep  ECDHE_RSA_AES_256_GCM_SHA384
TLS_ECDHE_RSA_AES_256_GCM_SHA384                  	0xc0, 0x30	TLS1.2
#

Comment 16 Colin Walters 2016-05-03 19:12:44 UTC
It doesn't seem to be related to the cipher suite, if I e.g. use G_TLS_GNUTLS_PRIORITY="NONE:+VERS-TLS-ALL:+MAC-ALL:+RSA:+AES-128-CBC:+SIGN-ALL:+COMP-NULL" (from https://gnutls.org/manual/html_node/Priority-Strings.html )
to force a pretty basic RSA setup, it still fails the same way.

Any chance you could get an equivalent TLS log from the server?

Comment 17 Colin Walters 2016-05-03 19:39:56 UTC
So in a quick look at the Pulp source, the core architecture is an Apache frontend calling into the Pulp code via WSGI, and the certificate data is passed through and re-parsed and re-validated on the Pulp side via M2Crypto?

Let's first determine where the error is being generated on the server side.  Is the request making it through Apache to the pulp layer at all?

Comment 18 John Mitsch 2016-05-03 20:45:09 UTC
Created attachment 1153585 [details]
http logs syncing an ostree repo from the capsule

Comment 19 John Mitsch 2016-05-03 20:45:49 UTC
Created attachment 1153586 [details]
http logs using curl from a capsule

Comment 20 John Mitsch 2016-05-03 20:47:05 UTC
Colin,

I attached the http logs on a ostree sync from pulp (capsule to server) and a curl command (capsule to server). What other logs can I provide?

Comment 21 John Mitsch 2016-05-03 21:03:14 UTC
It looks as if the request isn't even making it to the apache layer

Comment 22 John Mitsch 2016-05-03 21:25:44 UTC
Created attachment 1153588 [details]
http logs syncing an ostree repo from the capsule

I uploaded the logs syncing the wrong repo. This is the correct satellite logs syncing an ostree repo from capsule to the satellite.

Comment 23 John Mitsch 2016-05-10 13:10:20 UTC
Colin,

What is the status of this bug? Any idea of the timeline to get it fixed? Just wondering as it is blocking https://bugzilla.redhat.com/show_bug.cgi?id=1323644 

Thanks,
John

Comment 24 Colin Walters 2016-05-10 14:28:39 UTC
Can you confirm the relevant error is:

[Tue May 03 17:22:23.179630 2016] [ssl:error] [pid 19033] [client 192.168.121.204:59734] AH02039: Certificate Verification: Error (7): certificate signature failure

If so...a quick read of the OpenSSL code shows there's only one place in the code that returns this error.  Ultimately it's a wrapper for `ASN1_item_verify` - but AFAICS we ignore the error code that the ASN1 layer returns =/  For all we know it could have failed due to OOM.

What seems most likely though is that the client certificate is being somehow corrupted in transit.

This is going to be hard to debug without having a reproducer case to hand myself.  Can I get shell access to that server sufficient to e.g. install a patched openssl?

Comment 29 John Mitsch 2016-06-10 13:48:06 UTC
Just wondering the status of this bug and if it I am correct in understanding it is able to be reproduced?

Comment 30 Colin Walters 2016-06-21 16:52:43 UTC
This one could use a quick glance from the GnuTLS maintainer - Nikos, are you aware of any known issues here?

https://gitlab.com/gnutls/gnutls/issues/39 perhaps?

Any tips/references for tools/strategies to debug this?

Comment 31 Nikos Mavrogiannopoulos 2016-06-22 09:05:01 UTC
That doesn't seem to indicate a problem in gnutls. What is the server running? I could help more if you provide a way to reproduce the issue somehow (e.g., using gnutls-cli).

If the server is running NSS this may be related to:
https://bugzilla.redhat.com/show_bug.cgi?id=1238369

Comment 33 Colin Walters 2016-06-27 17:53:06 UTC
John, sorry about the delay on this, but I think we're in a better place to debug this now.  If you or someone else could generate non-expired certs, that would help.

It'd likely be a bit easier to attach them as one zip file or so.

Comment 34 Colin Walters 2016-06-27 17:58:44 UTC
Stef, does this sound like the issue Cockpit was hitting too?

Comment 35 John Mitsch 2016-06-29 18:22:36 UTC
Colin,

Sounds good, working now to get you new certs and/or access to a machine to debug with. I'll update accordingly.

Comment 38 John Mitsch 2016-07-01 19:20:09 UTC
Created attachment 1175089 [details]
ostree certs and repo config for reproducing

Comment 41 Colin Walters 2016-07-05 18:17:20 UTC
To clarify,
https://brewweb.engineering.redhat.com/brew/buildinfo?buildID=499851
is ~equivalent to 2016.6 for the pull code.

https://wiki.centos.org/SpecialInterestGroup/Atomic/Devel
tracks git master.

For Fedora,
https://bodhi.fedoraproject.org/updates/FEDORA-2016-244f34363c has been outstanding for a while with no karma, but please try that instead of older versions.

Comment 45 Colin Walters 2016-07-06 20:56:39 UTC
(In reply to Nikos Mavrogiannopoulos from comment #31)
> That doesn't seem to indicate a problem in gnutls. What is the server
> running? I could help more if you provide a way to reproduce the issue
> somehow (e.g., using gnutls-cli).

Is the latest zip file here usable for you?  I find it most convenient to use "pet" Docker containers to test out ostree, but you can also just install it via yum on your workstation, or a (remote) VM etc.

> If the server is running NSS this may be related to:
> https://bugzilla.redhat.com/show_bug.cgi?id=1238369

That's a very useful hint.  I do see:

gnutls[2]: sign handshake cert vrfy: picked RSA-SHA512 with SHA512

Is nss advertising support for SHA512 but actually only handling SHA256?

I tried to trick gnutls into doing only sha256 via:

env GNUTLS_DEBUG_LEVEL=9 G_TLS_GNUTLS_PRIORITY="NONE:+VERS-TLS-1.2:+MAC-SHA256:+RSA:+AES-128-CBC:+SIGN-RSA-SHA256:+COMP-NULL" ostree --repo=satellite pull --commit-metadata-only --mirror satellite

but wasn't successful (it stil gave me the same output).

Comment 53 Colin Walters 2016-07-07 15:25:51 UTC
Okay, this should help by dropping ostree out of the picture and just looking at the libsoup -> glib-networking -> gnutls) layers:

https://gist.github.com/cgwalters/065d68bb6122bb500b4abd2f6fd5815e

Now, my testing environment for client certs is an Atomic Host system I have configured to talk to the stage CDN.

On that system I did:
atomic run centos/tools
yum -y install 'pkgconfig(libsoup)'
cd /root
curl -L -o soup-get.c https://gist.githubusercontent.com/cgwalters/065d68bb6122bb500b4abd2f6fd5815e/raw/82e843b37fc633c95fb60a68bfaf83f0badcdb9d/soup-get.c
gcc -Wall $(pkg-config --cflags --libs libsoup-2.4) -o soup-get ./soup-get.c

Now, try to fetch without a client cert:
env GSETTINGS_BACKEND=memory ./soup-get -h --ca-file /host/etc/rhsm/ca/redhat-uep.pem https://cdn.stage.redhat.com/content/dist/rhel/atomic/7/7Server/x86_64/ostree/repo/config
/content/dist/rhel/atomic/7/7Server/x86_64/ostree/repo/config: 6 Server required TLS certificate (no handshake status)

Provide the keys:
env GSETTINGS_BACKEND=memory ./soup-get -h --ca-file /host/etc/rhsm/ca/redhat-uep.pem --cert /host/etc/pki//entitlement/2867616212724431168.pem --key /host/etc/pki/entitlement/2867616212724431168-key.pem  https://cdn.stage.redhat.com/content/dist/rhel/atomic/7/7Server/x86_64/ostree/repo/config
/content/dist/rhel/atomic/7/7Server/x86_64/ostree/repo/config: 200 O K

This client tool also gives the same error when talking to satellite.

Comment 55 Nikos Mavrogiannopoulos 2016-07-07 16:13:40 UTC
(In reply to Colin Walters from comment #45)
> (In reply to Nikos Mavrogiannopoulos from comment #31)
> > That doesn't seem to indicate a problem in gnutls. What is the server
> > running? I could help more if you provide a way to reproduce the issue
> > somehow (e.g., using gnutls-cli).
> 
> Is the latest zip file here usable for you?  I find it most convenient to
> use "pet" Docker containers to test out ostree, but you can also just
> install it via yum on your workstation, or a (remote) VM etc.
> 
> > If the server is running NSS this may be related to:
> > https://bugzilla.redhat.com/show_bug.cgi?id=1238369
> 
> That's a very useful hint.  I do see:
> 
> gnutls[2]: sign handshake cert vrfy: picked RSA-SHA512 with SHA512
> 
> Is nss advertising support for SHA512 but actually only handling SHA256?
> 
> I tried to trick gnutls into doing only sha256 via:
> 
> env GNUTLS_DEBUG_LEVEL=9
> G_TLS_GNUTLS_PRIORITY="NONE:+VERS-TLS-1.2:+MAC-SHA256:+RSA:+AES-128-CBC:
> +SIGN-RSA-SHA256:+COMP-NULL" ostree --repo=satellite pull
> --commit-metadata-only --mirror satellite

I can reproduce it using:
$ gnutls-cli sat-r220-10.lab.eng.rdu2.redhat.com --insecure --x509keyfile ueber.key --x509certfile ueber.cert --priority NORMAL:-SIGN-RSA-SHA512:-SIGN-RSA-SHA384:-SIGN-RSA-SHA224:-SIGN-RSA-SHA256

*** Fatal error: A TLS fatal alert has been received.
*** Received alert [51]: Decrypt error
*** Handshake has failed
GnuTLS error: A TLS fatal alert has been received.

|<4>| HSK[0x559d8a0655f0]: Server's version: 3.3
|<4>| HSK[0x559d8a0655f0]: Selected cipher suite: ECDHE_RSA_AES_256_GCM_SHA384
|<2>| sign handshake cert vrfy: picked RSA-SHA1 with SHA1

So the signature algorithm is not an issue.

Let's try reproducing with local openssl:
$ openssl version
OpenSSL 1.0.2h-fips  3 May 2016

$ openssl s_server -cert cert-rsa.pem -key key-rsa.pem -port 5556
Using default temp DH parameters
ACCEPT


$ gnutls-cli localhost --insecure --x509keyfile ueber.key --x509certfile ueber.cert --priority NORMAL -p 5556 -d 6
|<4>| HSK[0x5653655c0a80]: Server's version: 3.3
|<4>| HSK[0x5653655c0a80]: Selected cipher suite: ECDHE_RSA_AES_256_GCM_SHA384
|<4>| HSK[0x5653655c0a80]: Selected ECC curve SECP256R1 (2)
|<2>| sign handshake cert vrfy: picked RSA-SHA512 with SHA512


and works...

So there is something is going on the server side. Is this apache instance at sat-r220-10.lab.eng.rdu2.redhat.com using mod_ssl or mod_nss? Which version of those?

I tried openssl 1.0.1, and gnutls still interoperates, so knowing what the apache runs is crucial.
/home/nmavrogi/rhel/openssl/openssl-1.0.1e/apps/openssl version
OpenSSL 1.0.1e-fips 11 Feb 2013


A work around for this server is to disable TLS 1.2 and use TLS 1.1 (via priority: "NORMAL:-VERS-TLS1.2")

Comment 57 Colin Walters 2016-07-07 17:28:39 UTC
Nikos, see https://bugzilla.redhat.com/show_bug.cgi?id=1330753#c17

Though someone with more knowledge about the Satellite codebase could answer better.

Comment 58 Nikos Mavrogiannopoulos 2016-07-07 17:35:02 UTC
It seems I figured the issue. The certificate send by gnutls has different size than the one sent by openssl or nss. If I compare the output of the certificates sent using certlint-x509helper, I get something like:
-                <extnID>1.3.6.1.4.1.2312.9.1.24290245979.1</extnID>
+                <extnID>1.3.6.1.4.1.2312.9.1.1467399257435.1</extnID>

It seems that there is an in libtasn1 handling OID elements >2^32. If you'd like a fix on rhel-7 please file a bug as soon so I could fix that issue within the rhel-7.3 deadline.

Comment 59 Colin Walters 2016-07-07 17:36:11 UTC
Let's just move this one.

Comment 68 errata-xmlrpc 2016-11-04 08:28:59 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-2551.html


Note You need to log in before you can comment on or make changes to this bug.