| 1 |
# |
| 2 |
# Usage: |
| 3 |
# --let $CIPHER_DB = dbname |
| 4 |
# --let $USER = user |
| 5 |
# --let $TLS_VERSION = "TLSv1.2" or "TLSv1.3" |
| 6 |
# |
| 7 |
# --source ../inc/cipher_test.inc |
| 8 |
# |
| 9 |
|
| 10 |
# Usage: |
| 11 |
# --source ../inc/set_ciphers.inc |
| 12 |
--let $records = `SELECT JSON_LENGTH(ciphers) FROM $cipher_db.acceptable` |
| 13 |
if ($records != "") { |
| 14 |
--echo |
| 15 |
--echo #----------------------------------------------------------------------- |
| 16 |
--echo |
| 17 |
--echo # Checking accetable ciphers |
| 18 |
--let $CIPHER_TABLE =acceptable |
| 19 |
--let $BLOCKED_CIPHERS=0 |
| 20 |
--source set_ciphers.inc |
| 21 |
--let $i = 0 |
| 22 |
while ($i < $records) { |
| 23 |
--let $CIPHER_NAME = `SELECT JSON_UNQUOTE(JSON_EXTRACT(ciphers, '$[$i]')) FROM $cipher_db.acceptable` |
| 24 |
if ($TLS_VERSION == "TLSv1.2") { |
| 25 |
--echo # Expecting connection success with cipher: $CIPHER_NAME on main channel |
| 26 |
--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 |
| 27 |
--echo # Expecting connection success with cipher: $CIPHER_NAME on admin channel |
| 28 |
--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 |
| 29 |
} |
| 30 |
|
| 31 |
if ($TLS_VERSION == "TLSv1.3") { |
| 32 |
--echo # Expecting connection success with cipher: $CIPHER_NAME on main channel |
| 33 |
--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 |
| 34 |
--echo # Expecting connection success with cipher: $CIPHER_NAME on admin channel |
| 35 |
--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 |
| 36 |
} |
| 37 |
--inc $i |
| 38 |
} |
| 39 |
--echo |
| 40 |
--echo #----------------------------------------------------------------------- |
| 41 |
--echo |
| 42 |
} |
| 43 |
|
| 44 |
--let $records = `SELECT JSON_LENGTH(ciphers) FROM $cipher_db.blocked` |
| 45 |
if ($records != "") { |
| 46 |
--echo |
| 47 |
--echo #----------------------------------------------------------------------- |
| 48 |
--echo |
| 49 |
--echo # Checking blocked ciphers |
| 50 |
--let $CIPHER_TABLE =blocked |
| 51 |
--let $BLOCKED_CIPHERS=1 |
| 52 |
--source set_ciphers.inc |
| 53 |
--let $i = 0 |
| 54 |
while ($i < $records) { |
| 55 |
--let $CIPHER_NAME = `SELECT JSON_UNQUOTE(JSON_EXTRACT(ciphers, '$[$i]')) FROM $cipher_db.blocked` |
| 56 |
--source search_cipher_deprecation.inc |
| 57 |
if ($TLS_VERSION == "TLSv1.2") { |
| 58 |
--echo # Expecting connection failure wiith cipher: $CIPHER_NAME on main channel |
| 59 |
--replace_regex /SSL connection error:.*/SSL connection error: Failed to set ciphers to use/ |
| 60 |
--error 1 |
| 61 |
--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 |
| 62 |
--echo # Expecting connection failure wiith cipher: $CIPHER_NAME on admin channel |
| 63 |
--replace_regex /SSL connection error:.*/SSL connection error: Failed to set ciphers to use/ |
| 64 |
--error 1 |
| 65 |
--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 |
| 66 |
} |
| 67 |
|
| 68 |
if ($TLS_VERSION == "TLSv1.3") { |
| 69 |
--echo # Expecting connection failure wiith cipher: $CIPHER_NAME on main channel |
| 70 |
--replace_regex /SSL connection error:.*/SSL connection error: Failed to set ciphers to use/ |
| 71 |
--error 1 |
| 72 |
--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 |
| 73 |
--echo # Expecting connection failure wiith cipher: $CIPHER_NAME on admin channel |
| 74 |
--replace_regex /SSL connection error:.*/SSL connection error: Failed to set ciphers to use/ |
| 75 |
--error 1 |
| 76 |
--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 |
| 77 |
} |
| 78 |
--inc $i |
| 79 |
} |
| 80 |
--echo |
| 81 |
--echo #----------------------------------------------------------------------- |
| 82 |
--echo |
| 83 |
} |