nova-novncproxy does not handle TCP RST cleanly when using SSL
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Fix Released
|
Medium
|
melanie witt | ||
Rocky |
Fix Committed
|
Medium
|
Colleen Murphy | ||
Stein |
Fix Committed
|
Medium
|
Colleen Murphy | ||
OpenStack Security Advisory |
Won't Fix
|
Undecided
|
Unassigned |
Bug Description
Description
===========
We have nova-novncproxy configured to use SSL:
```
[DEFAULT]
ssl_only=true
cert = /etc/nova/
key = /etc/nova/
...
[vnc]
enabled = True
server_listen = "0.0.0.0"
server_
novncproxy_host = 192.168.237.81
novncproxy_port = 5554
novncproxy_base_url = https://<public hostname>
xvpvncproxy_host = 192.168.237.81
```
We also have haproxy acting as a load balancer, but not terminating SSL. We have an haproxy health check configured like this for nova-novncproxy:
```
listen nova-novncproxy
# irrelevant config...
server <internal hostname> 192.168.237.84:5554 check check-ssl verify none inter 2000 rise 5 fall 2
```
where 192.168.237.81 is a virtual IP address and 192.168.237.84 is the node's individual IP address.
With that health check enabled, we found the nova-novncproxy process CPU spiking and eventually causing the node to hang. With debug logging enabled, we noticed this in the nova-novncproxy logs:
2019-02-19 15:02:44.148 2880 INFO nova.console.
2019-02-19 15:02:44.149 2880 INFO nova.console.
2019-02-19 15:02:44.149 2880 INFO nova.console.
2019-02-19 15:02:44.149 2880 INFO nova.console.
2019-02-19 15:02:44.150 2880 INFO nova.console.
2019-02-19 15:02:44.151 2880 INFO nova.console.
2019-02-19 15:02:45.015 2880 DEBUG nova.console.
2019-02-19 15:02:45.184 2889 DEBUG oslo_db.
TUTION _check_
2019-02-19 15:02:45.377 2889 DEBUG nova.context [req-8552f48d-
2019-02-19 15:02:45.380 2889 DEBUG oslo_concurrenc
es/oslo_
2019-02-19 15:02:45.382 2889 DEBUG oslo_concurrenc
/oslo_concurren
2019-02-19 15:02:45.393 2889 DEBUG oslo_concurrenc
es/oslo_
2019-02-19 15:02:45.395 2889 DEBUG oslo_concurrenc
/oslo_concurren
2019-02-19 15:02:45.437 2889 DEBUG oslo_db.
TUTION _check_
2019-02-19 15:02:45.443 2889 DEBUG oslo_db.
TUTION _check_
2019-02-19 15:02:45.451 2889 INFO nova.compute.rpcapi [req-8552f48d-
2019-02-19 15:02:45.452 2889 INFO nova.console.
2019-02-19 15:02:45.452 2889 DEBUG nova.console.
2019-02-19 15:02:45.452 2889 ERROR nova.console.
2019-02-19 15:02:45.452 2889 ERROR nova.console.
2019-02-19 15:02:45.452 2889 ERROR nova.console.
2019-02-19 15:02:45.452 2889 ERROR nova.console.
2019-02-19 15:02:45.452 2889 ERROR nova.console.
2019-02-19 15:02:45.452 2889 ERROR nova.console.
2019-02-19 15:02:45.452 2889 ERROR nova.console.
2019-02-19 15:02:45.452 2889 ERROR nova.console.
2019-02-19 15:02:45.452 2889 ERROR nova.console.
2019-02-19 15:02:45.452 2889 ERROR nova.console.
2019-02-19 15:02:45.452 2889 ERROR nova.console.
2019-02-19 15:02:45.452 2889 ERROR nova.console.
2019-02-19 15:02:45.452 2889 ERROR nova.console.
2019-02-19 15:02:45.452 2889 ERROR nova.console.
2019-02-19 15:02:45.452 2889 ERROR nova.console.
2019-02-19 15:02:45.452 2889 ERROR nova.console.
2019-02-19 15:02:45.452 2889 ERROR nova.console.
2019-02-19 15:02:45.452 2889 ERROR nova.console.
2019-02-19 15:02:45.452 2889 ERROR nova.console.
2019-02-19 15:02:45.452 2889 ERROR nova.console.
2019-02-19 15:02:45.452 2889 ERROR nova.console.
2019-02-19 15:02:45.452 2889 ERROR nova.console.
2019-02-19 15:02:45.452 2889 ERROR nova.console.
2019-02-19 15:02:45.452 2889 ERROR nova.console.
2019-02-19 15:02:45.452 2889 ERROR nova.console.
2019-02-19 15:02:45.452 2889 ERROR nova.console.
2019-02-19 15:02:45.452 2889 ERROR nova.console.
2019-02-19 15:02:45.452 2889 ERROR nova.console.
2019-02-19 15:02:45.452 2889 ERROR nova.console.
2019-02-19 15:02:45.452 2889 ERROR nova.console.
2019-02-19 15:02:45.452 2889 ERROR nova.console.
2019-02-19 15:02:47.037 2880 DEBUG nova.console.
(paste: http://
This sequence starting with the "new handler Process" repeats continuously. It seems that the haproxy health checks initiate an SSL connection but then immediately send a TCP RST:
http://
For most services this does not seem to be an issue, but for nova-novncproxy it repeatedly initializes NovaProxyReques
Note that we tried upgrading to HEAD of websockify and eventlet which did not improve the issue.
Our workaround was to turn off check-ssl in haproxy and use a basic tcp check, but we're concerned that nova-novncproxy remains vulnerable to a DOS attack given how easy it is for haproxy to overload the service. For that reason I'm opening this initially as a security bug, though you could perhaps argue that it's no secret that making un-ratelimited requests at any service will cause high load.
Steps to reproduce
==================
1. Configure nova-novncproxy to use SSL by setting the cert= and key= parameters in [DEFAULT] and turn on debug logging.
2. You can simulate the haproxy SSL health check with this python script:
import socket, ssl, struct, time
host = '192.168.237.81'
port = 5554
while True:
sock = socket.
ssl_sock = ssl.wrap_
Expected result
===============
nova-novncproxy should gracefully handle the RST and not start overutilizing CPU. It should probably hold off on initializing database connections and such until a meaningful request other than an SSL HELLO is received.
Actual result
=============
The nova-novncproxy process quickly jumps to the top of the CPU% metrics of process analyzers like top and htop and if left unattended on a server with few cores will cause the server's overall performance to be degraded.
Environment
===========
We found this on the latest of the stable/rocky branch on SLES:
# cat /etc/os-release
NAME="SLES"
VERSION="12-SP4"
VERSION_ID="12.4"
PRETTY_NAME="SUSE Linux Enterprise Server 12 SP4"
# uname -a
Linux d52-54-77-77-01-01 4.12.14-
# zypper info openstack-nova
Information for package openstack-nova:
-------
Repository : Cloud
Name : openstack-nova
Version : 18.1.1~dev47-749.1
Arch : noarch
Vendor : obs://build.
Support Level : Level 3
Installed Size : 444.7 KiB
Installed : Yes
Status : up-to-date
Source package : openstack-
Summary : OpenStack Compute (Nova)
# zypper info haproxy
Information for package haproxy:
-------
Repository : Cloud
Name : haproxy
Version : 1.6.11-10.2
Arch : x86_64
Vendor : SUSE LLC <https:/
Support Level : Level 3
Installed Size : 3.1 MiB
Installed : Yes
Status : up-to-date
Source package : haproxy-
Changed in nova: | |
importance: | Undecided → Medium |
tags: | added: console |
no longer affects: | nova/queens |
Since this report concerns a possible security risk, an incomplete security advisory task has been added while the core security reviewers for the affected project or projects confirm the bug and discuss the scope of any vulnerability along with potential solutions.