Skip to content

Commit e9870eb

Browse files
berrangemelwitt
authored andcommitted
nova: add support for TLS between novnc proxy & compute nodes
Nova is gaining the ability to run TLS over the connection between the novnc proxy service and the QEMU/KVM compute node VNC server. This adds a new config param - 'NOVA_CONSOLE_PROXY_COMPUTE_TLS=True' - which instructs devstack to configure libvirt/QEMU to enable TLS for the VNC server, and to configure the novncproxy to use TLS when connecting. NB this use of TLS is distinct from use of TLS for the public facing API controlled by USE_SSL, they can be enabled independently. This is done in a generic manner so that it is easy to extend to cover use of TLS with the SPICE and serial console proxy services too. Change-Id: Ib29d3f5f18533115b9c51e27b373e92fc0a28d1a Depends-on: I9cc9a380500715e60bd05aa5c29ee46bc6f8d6c2 Implements bp: websocket-proxy-to-host-security
1 parent 9640d3b commit e9870eb

3 files changed

Lines changed: 52 additions & 0 deletions

File tree

lib/nova

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ if is_service_enabled tls-proxy; then
8282
NOVA_SERVICE_PROTOCOL="https"
8383
fi
8484

85+
# Whether to use TLS for comms between the VNC/SPICE/serial proxy
86+
# services and the compute node
87+
NOVA_CONSOLE_PROXY_COMPUTE_TLS=${NOVA_CONSOLE_PROXY_COMPUTE_TLS:-False}
88+
8589
# Public facing bits
8690
NOVA_SERVICE_HOST=${NOVA_SERVICE_HOST:-$SERVICE_HOST}
8791
NOVA_SERVICE_PORT=${NOVA_SERVICE_PORT:-8774}
@@ -197,6 +201,13 @@ function is_n-cell_enabled {
197201
return 1
198202
}
199203

204+
# is_nova_console_proxy_compute_tls_enabled() - Test if the Nova Console Proxy
205+
# service has TLS enabled
206+
function is_nova_console_proxy_compute_tls_enabled {
207+
[[ ${NOVA_CONSOLE_PROXY_COMPUTE_TLS} = "True" ]] && return 0
208+
return 1
209+
}
210+
200211
# Helper to clean iptables rules
201212
function clean_iptables {
202213
# Delete rules
@@ -524,6 +535,17 @@ function create_nova_conf {
524535
iniset $NOVA_CONF vnc server_proxyclient_address "$VNCSERVER_PROXYCLIENT_ADDRESS"
525536
iniset $NOVA_CONF vnc novncproxy_host "$NOVA_SERVICE_LISTEN_ADDRESS"
526537
iniset $NOVA_CONF vnc xvpvncproxy_host "$NOVA_SERVICE_LISTEN_ADDRESS"
538+
539+
if is_nova_console_proxy_compute_tls_enabled ; then
540+
iniset $NOVA_CONF vnc auth_schemes "vencrypt"
541+
iniset $NOVA_CONF vnc vencrypt_client_key "/etc/pki/nova-novnc/client-key.pem"
542+
iniset $NOVA_CONF vnc vencrypt_client_cert "/etc/pki/nova-novnc/client-cert.pem"
543+
iniset $NOVA_CONF vnc vencrypt_ca_certs "/etc/pki/nova-novnc/ca-cert.pem"
544+
545+
sudo mkdir -p /etc/pki/nova-novnc
546+
deploy_int_CA /etc/pki/nova-novnc/ca-cert.pem
547+
deploy_int_cert /etc/pki/nova-novnc/client-cert.pem /etc/pki/nova-novnc/client-key.pem
548+
fi
527549
else
528550
iniset $NOVA_CONF vnc enabled false
529551
fi

lib/nova_plugins/functions-libvirt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,18 @@ EOF
147147
fi
148148
fi
149149

150+
if is_nova_console_proxy_compute_tls_enabled ; then
151+
if is_service_enabled n-novnc ; then
152+
echo "vnc_tls = 1" | sudo tee -a $QEMU_CONF
153+
echo "vnc_tls_x509_verify = 1" | sudo tee -a $QEMU_CONF
154+
155+
sudo mkdir -p /etc/pki/libvirt-vnc
156+
sudo chown libvirt-qemu:libvirt-qemu /etc/pki/libvirt-vnc
157+
deploy_int_CA /etc/pki/libvirt-vnc/ca-cert.pem
158+
deploy_int_cert /etc/pki/libvirt-vnc/server-cert.pem /etc/pki/libvirt-vnc/server-key.pem
159+
fi
160+
fi
161+
150162
# Service needs to be started on redhat/fedora -- do a restart for
151163
# sanity after fiddling the config.
152164
restart_service $LIBVIRT_DAEMON

lib/tls

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,24 @@ function make_root_CA {
340340
fi
341341
}
342342

343+
# Deploy the service cert & key to a service specific
344+
# location
345+
function deploy_int_cert {
346+
local cert_target_file=$1
347+
local key_target_file=$2
348+
349+
sudo cp "$INT_CA_DIR/$DEVSTACK_CERT_NAME.crt" "$cert_target_file"
350+
sudo cp "$INT_CA_DIR/private/$DEVSTACK_CERT_NAME.key" "$key_target_file"
351+
}
352+
353+
# Deploy the intermediate CA cert bundle file to a service
354+
# specific location
355+
function deploy_int_CA {
356+
local ca_target_file=$1
357+
358+
sudo cp "$INT_CA_DIR/ca-chain.pem" "$ca_target_file"
359+
}
360+
343361
# If a non-system python-requests is installed then it will use the
344362
# built-in CA certificate store rather than the distro-specific
345363
# CA certificate store. Detect this and symlink to the correct

0 commit comments

Comments
 (0)