Coverage for nova/console/rfb/auth.py: 93%
27 statements
« prev ^ index » next coverage.py v7.6.12, created at 2025-04-17 15:08 +0000
« prev ^ index » next coverage.py v7.6.12, created at 2025-04-17 15:08 +0000
1# Copyright (c) 2014-2017 Red Hat, Inc
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
15import abc
16import enum
18VERSION_LENGTH = 12
19SUBTYPE_LENGTH = 4
21AUTH_STATUS_FAIL = b"\x00"
22AUTH_STATUS_PASS = b"\x01"
25@enum.unique
26class AuthType(enum.IntEnum):
28 INVALID = 0
29 NONE = 1
30 VNC = 2
31 RA2 = 5
32 RA2NE = 6
33 TIGHT = 16
34 ULTRA = 17
35 TLS = 18 # Used by VINO
36 VENCRYPT = 19 # Used by VeNCrypt and QEMU
37 SASL = 20 # SASL type used by VINO and QEMU
38 ARD = 30 # Apple remote desktop (screen sharing)
39 MSLOGON = 0xfffffffa # Used by UltraVNC
42class RFBAuthScheme(metaclass=abc.ABCMeta):
44 @abc.abstractmethod
45 def security_type(self):
46 """Return the security type supported by this scheme
48 Returns the nova.console.rfb.auth.AuthType.XX
49 constant representing the scheme implemented.
50 """
51 pass
53 @abc.abstractmethod
54 def security_handshake(self, compute_sock):
55 """Perform security-type-specific functionality.
57 This method is expected to return the socket-like
58 object used to communicate with the server securely.
60 Should raise exception.RFBAuthHandshakeFailed if
61 an error occurs
63 :param compute_sock: socket connected to the compute node instance
64 """
65 pass