mirror of
https://github.com/drwetter/testssl.sh.git
synced 2025-01-03 23:39:45 +01:00
Add sockets implementation of mysql starttls
This is the simplest direct socket implementation of the MySQL STARTTLS protocol. This is a binary protocol, so it requires a new stream based send (instead of the current line based send).
This commit is contained in:
parent
a8ae90137d
commit
8be69e9789
24
testssl.sh
24
testssl.sh
@ -6883,11 +6883,18 @@ starttls_line() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# Line based send with newline characters appended
|
||||
starttls_just_send(){
|
||||
debugme echo -e "C: $1"
|
||||
echo -ne "$1\r\n" >&5
|
||||
}
|
||||
|
||||
# Stream based send
|
||||
starttls_just_send2(){
|
||||
debugme echo -e "C: $1"
|
||||
echo -ne "$1" >&5
|
||||
}
|
||||
|
||||
starttls_just_read(){
|
||||
debugme echo "=== just read banner ==="
|
||||
if [[ "$DEBUG" -ge 2 ]]; then
|
||||
@ -7015,9 +7022,20 @@ starttls_postgres_dialog() {
|
||||
|
||||
starttls_mysql_dialog() {
|
||||
debugme echo "=== starting mysql STARTTLS dialog ==="
|
||||
|
||||
debugme echo "mysql socket dialog not yet implemented"
|
||||
|
||||
local login_request="
|
||||
, 20, 00, 00, 01, # payload_length, sequence_id
|
||||
85, ae, ff, 00, # capability flags, CLIENT_SSL always set
|
||||
00, 00, 00, 01, # max-packet size
|
||||
21, # character set
|
||||
00, 00, 00, 00, 00, 00, 00, 00, # string[23] reserved (all [0])
|
||||
00, 00, 00, 00, 00, 00, 00, 00,
|
||||
00, 00, 00, 00, 00, 00, 00"
|
||||
code2network "${login_request}"
|
||||
starttls_just_read && debugme echo -e "\nreceived server greeting" &&
|
||||
starttls_just_send2 "$NW_STR" && debugme echo "initiated STARTTLS"
|
||||
# TODO: We could detect if the server supports STARTTLS via the "Server Capabilities"
|
||||
# bit field, but we'd need to parse the binary stream, with greater precision than regex.
|
||||
local ret=$?
|
||||
debugme echo "=== finished mysql STARTTLS dialog with ${ret} ==="
|
||||
return $ret
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user