File: wl15800_cipher_test.inc

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (116 lines) | stat: -rw-r--r-- 6,079 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#
# Usage:
# --let $CIPHER_DB = dbname
# --let $USER = user
# --let $TLS_VERSION = "TLSv1.2" or "TLSv1.3"
#
# --source ../inc/cipher_test.inc
#

# Usage:
# --source ../inc/set_ciphers.inc
--let $records = `SELECT JSON_LENGTH(ciphers) FROM $cipher_db.acceptable`
if ($records != "") {
  --echo
  --echo #-----------------------------------------------------------------------
  --echo
  --echo # Checking accetable ciphers
  --let $CIPHER_TABLE =acceptable
  --let $BLOCKED_CIPHERS=0
  --source set_ciphers.inc
  --let $i = 0
  while ($i < $records) {
    --let $CIPHER_NAME = `SELECT JSON_UNQUOTE(JSON_EXTRACT(ciphers, '$[$i]')) FROM $cipher_db.acceptable`
    if ($TLS_VERSION == "TLSv1.2") {
      --echo # Expecting connection success with cipher: $CIPHER_NAME on main channel
      --exec $MYSQL --protocol=TCP --host=127.0.0.1 -P $MASTER_MYPORT --ssl-mode=REQUIRED --tls-version=TLSv1.2 -u$USER --ssl-cipher=$CIPHER_NAME -e "SHOW STATUS LIKE 'Ssl_cipher'" 2>&1
      --echo # Expecting connection success with cipher: $CIPHER_NAME on admin channel
      --exec $MYSQL --protocol=TCP --host=127.0.0.1 -P $MASTER_ADMINPORT --ssl-mode=REQUIRED --tls-version=TLSv1.2 -u$USER --ssl-cipher=$CIPHER_NAME -e "SHOW STATUS LIKE 'Ssl_cipher'" 2>&1
    }

    if ($TLS_VERSION == "TLSv1.3") {
      --echo # Expecting connection success with cipher: $CIPHER_NAME on main channel
      --exec $MYSQL --protocol=TCP --host=127.0.0.1 -P $MASTER_MYPORT --ssl-mode=REQUIRED --tls-version=TLSv1.3 -u$USER --tls-ciphersuites=$CIPHER_NAME -e "SHOW STATUS LIKE 'Ssl_cipher'" 2>&1
      --echo # Expecting connection success with cipher: $CIPHER_NAME on admin channel
      --exec $MYSQL --protocol=TCP --host=127.0.0.1 -P $MASTER_ADMINPORT --ssl-mode=REQUIRED --tls-version=TLSv1.3 -u$USER --tls-ciphersuites=$CIPHER_NAME -e "SHOW STATUS LIKE 'Ssl_cipher'" 2>&1
    }
    --inc $i
  }
  --echo
  --echo #-----------------------------------------------------------------------
  --echo
}

--let $records = `SELECT JSON_LENGTH(ciphers) FROM $cipher_db.deprecated`
if ($records != "") {
  --echo
  --echo #-----------------------------------------------------------------------
  --echo
  --echo # Checking deprecated ciphers
  --let $CIPHER_TABLE =deprecated
  --let $BLOCKED_CIPHERS=0
  --source set_ciphers.inc
  --let $i = 0
  while ($i < $records) {
    --let $CIPHER_NAME = `SELECT JSON_UNQUOTE(JSON_EXTRACT(ciphers, '$[$i]')) FROM $cipher_db.deprecated`
    --source search_cipher_deprecation.inc
    if ($TLS_VERSION == "TLSv1.2") {
      --echo # Expecting connection success with cipher: $CIPHER_NAME on main channel
      --exec $MYSQL --protocol=TCP --host=127.0.0.1 -P $MASTER_MYPORT --ssl-mode=REQUIRED --tls-version=TLSv1.2 -u$USER --ssl-cipher=$CIPHER_NAME -e "SHOW STATUS LIKE 'Ssl_cipher'" 2>&1
      --echo # Expecting connection success with cipher: $CIPHER_NAME on admin channel
      --exec $MYSQL --protocol=TCP --host=127.0.0.1 -P $MASTER_ADMINPORT --ssl-mode=REQUIRED --tls-version=TLSv1.2 -u$USER --ssl-cipher=$CIPHER_NAME -e "SHOW STATUS LIKE 'Ssl_cipher'" 2>&1
    }

    if ($TLS_VERSION == "TLSv1.3") {
      --echo # Expecting connection success with cipher: $CIPHER_NAME on main channel
      --exec $MYSQL --protocol=TCP --host=127.0.0.1 -P $MASTER_MYPORT --ssl-mode=REQUIRED --tls-version=TLSv1.3 -u$USER --tls-ciphersuites=$CIPHER_NAME -e "SHOW STATUS LIKE 'Ssl_cipher'" 2>&1
      --echo # Expecting connection success with cipher: $CIPHER_NAME on admin channel
      --exec $MYSQL --protocol=TCP --host=127.0.0.1 -P $MASTER_ADMINPORT --ssl-mode=REQUIRED --tls-version=TLSv1.3 -u$USER --tls-ciphersuites=$CIPHER_NAME -e "SHOW STATUS LIKE 'Ssl_cipher'" 2>&1
    }
    --inc $i
  }
  --echo
  --echo #-----------------------------------------------------------------------
  --echo
}

--let $records = `SELECT JSON_LENGTH(ciphers) FROM $cipher_db.blocked`
if ($records != "") {
  --echo
  --echo #-----------------------------------------------------------------------
  --echo
  --echo # Checking blocked ciphers
  --let $CIPHER_TABLE =blocked
  --let $BLOCKED_CIPHERS=1
  --source set_ciphers.inc
  --let $i = 0
  while ($i < $records) {
    --let $CIPHER_NAME = `SELECT JSON_UNQUOTE(JSON_EXTRACT(ciphers, '$[$i]')) FROM $cipher_db.blocked`
    --source search_cipher_deprecation.inc
    if ($TLS_VERSION == "TLSv1.2") {
      --echo # Expecting connection failure wiith cipher: $CIPHER_NAME on main channel
      --replace_regex /SSL connection error:.*/SSL connection error: Failed to set ciphers to use/
      --error 1
      --exec $MYSQL --protocol=TCP --host=127.0.0.1 -P $MASTER_MYPORT --ssl-mode=REQUIRED --tls-version=TLSv1.2 -u$USER --ssl-cipher=$CIPHER_NAME -e "SHOW STATUS LIKE 'Ssl_cipher'" 2>&1
      --echo # Expecting connection failure wiith cipher: $CIPHER_NAME on admin channel
      --replace_regex /SSL connection error:.*/SSL connection error: Failed to set ciphers to use/
      --error 1
      --exec $MYSQL --protocol=TCP --host=127.0.0.1 -P $MASTER_ADMINPORT --ssl-mode=REQUIRED --tls-version=TLSv1.2 -u$USER --ssl-cipher=$CIPHER_NAME -e "SHOW STATUS LIKE 'Ssl_cipher'" 2>&1
    }

    if ($TLS_VERSION == "TLSv1.3") {
      --echo # Expecting connection failure wiith cipher: $CIPHER_NAME on main channel
      --replace_regex /SSL connection error:.*/SSL connection error: Failed to set ciphers to use/
      --error 1
      --exec $MYSQL --protocol=TCP --host=127.0.0.1 -P $MASTER_MYPORT --ssl-mode=REQUIRED --tls-version=TLSv1.3 -u$USER --tls-ciphersuites=$CIPHER_NAME -e "SHOW STATUS LIKE 'Ssl_cipher'" 2>&1
      --echo # Expecting connection failure wiith cipher: $CIPHER_NAME on admin channel
      --replace_regex /SSL connection error:.*/SSL connection error: Failed to set ciphers to use/
      --error 1
      --exec $MYSQL --protocol=TCP --host=127.0.0.1 -P $MASTER_ADMINPORT --ssl-mode=REQUIRED --tls-version=TLSv1.3 -u$USER --tls-ciphersuites=$CIPHER_NAME -e "SHOW STATUS LIKE 'Ssl_cipher'" 2>&1
    }
    --inc $i
  }
  --echo
  --echo #-----------------------------------------------------------------------
  --echo
}