mirror of
https://github.com/warp-tech/warpgate.git
synced 2024-09-20 06:46:17 +08:00
wip
This commit is contained in:
parent
9dc43eb353
commit
3c6abd0a82
|
@ -27,6 +27,10 @@ replace = version = "{new_version}"
|
|||
search = version = "{current_version}"
|
||||
replace = version = "{new_version}"
|
||||
|
||||
[bumpversion:file:warpgate-protocol-mysql/Cargo.toml]
|
||||
search = version = "{current_version}"
|
||||
replace = version = "{new_version}"
|
||||
|
||||
[bumpversion:file:warpgate-protocol-ssh/Cargo.toml]
|
||||
search = version = "{current_version}"
|
||||
replace = version = "{new_version}"
|
||||
|
|
626
Cargo.lock
generated
626
Cargo.lock
generated
|
@ -288,6 +288,15 @@ dependencies = [
|
|||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "atoi"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d7c57d12312ff59c811c0643f4d80830505833c9ffaebd193d819392b265be8e"
|
||||
dependencies = [
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "atomic-waker"
|
||||
version = "1.0.0"
|
||||
|
@ -408,9 +417,9 @@ checksum = "8a32fd6af2b5827bce66c29053ba0e7c42b9dcab01835835058558c10851a46b"
|
|||
|
||||
[[package]]
|
||||
name = "bcrypt-pbkdf"
|
||||
version = "0.6.2"
|
||||
version = "0.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7c38c03b9506bd92bf1ef50665a81eda156f615438f7654bffba58907e6149d7"
|
||||
checksum = "12621b8e87feb183a6e5dbb315e49026b2229c4398797ee0ae2d1bc00aef41b9"
|
||||
dependencies = [
|
||||
"blowfish",
|
||||
"crypto-mac",
|
||||
|
@ -419,12 +428,42 @@ dependencies = [
|
|||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bigdecimal"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6aaf33151a6429fe9211d1b276eafdf70cdff28b071e76c0b0e1503221ea3744"
|
||||
dependencies = [
|
||||
"num-bigint 0.4.3",
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bimap"
|
||||
version = "0.6.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bc0455254eb5c6964c4545d8bac815e1a1be4f3afe0ae695ea539c12d728d44b"
|
||||
|
||||
[[package]]
|
||||
name = "bindgen"
|
||||
version = "0.59.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2bd2a9a458e8f4304c52c43ebb0cfbd520289f8379a52e329a38afda99bf8eb8"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cexpr",
|
||||
"clang-sys",
|
||||
"lazy_static",
|
||||
"lazycell",
|
||||
"peeking_take_while",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"regex",
|
||||
"rustc-hash",
|
||||
"shlex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bit-vec"
|
||||
version = "0.6.3"
|
||||
|
@ -437,6 +476,18 @@ version = "1.3.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||
|
||||
[[package]]
|
||||
name = "bitvec"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1489fcb93a5bb47da0462ca93ad252ad6af2145cce58d10d46a83931ba9f016b"
|
||||
dependencies = [
|
||||
"funty",
|
||||
"radium",
|
||||
"tap",
|
||||
"wyz",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "blake2"
|
||||
version = "0.10.4"
|
||||
|
@ -541,6 +592,15 @@ version = "1.0.73"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11"
|
||||
|
||||
[[package]]
|
||||
name = "cexpr"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
|
||||
dependencies = [
|
||||
"nom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.0"
|
||||
|
@ -576,6 +636,17 @@ dependencies = [
|
|||
"generic-array",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clang-sys"
|
||||
version = "1.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a050e2153c5be08febd6734e29298e844fdb0fa21aeddd63b4eb7baa106c69b"
|
||||
dependencies = [
|
||||
"glob",
|
||||
"libc",
|
||||
"libloading",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "2.34.0"
|
||||
|
@ -630,6 +701,15 @@ dependencies = [
|
|||
"os_str_bytes",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cmake"
|
||||
version = "0.1.48"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e8ad8cef104ac57b68b89df3208164d228503abbdce70f6880ffa3d970e7443a"
|
||||
dependencies = [
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "color_quant"
|
||||
version = "1.1.0"
|
||||
|
@ -710,6 +790,12 @@ dependencies = [
|
|||
"tracing-subscriber",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "const-oid"
|
||||
version = "0.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3"
|
||||
|
||||
[[package]]
|
||||
name = "const_fn"
|
||||
version = "0.4.9"
|
||||
|
@ -777,7 +863,16 @@ version = "2.1.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49fc9a695bca7f35f5f4c15cddc84415f66a74ea78eef08e90c5024f2b540e23"
|
||||
dependencies = [
|
||||
"crc-catalog",
|
||||
"crc-catalog 1.1.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crc"
|
||||
version = "3.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "53757d12b596c16c78b83458d732a5d1a17ab3f53f2f7412f6fb57cc8a140ab3"
|
||||
dependencies = [
|
||||
"crc-catalog 2.1.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -786,6 +881,12 @@ version = "1.1.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ccaeedb56da03b09f598226e25e80088cb4cd25f316e6e4df7d695f0feeb1403"
|
||||
|
||||
[[package]]
|
||||
name = "crc-catalog"
|
||||
version = "2.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2d0165d2900ae6778e36e80bbc4da3b5eefccee9ba939761f9c2882a5d9af3ff"
|
||||
|
||||
[[package]]
|
||||
name = "crc32fast"
|
||||
version = "1.3.2"
|
||||
|
@ -825,6 +926,16 @@ dependencies = [
|
|||
"lazy_static",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crypto-bigint"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "03c6a1d5fa1de37e071642dfa44ec552ca5b299adb128fab16138e24b548fd21"
|
||||
dependencies = [
|
||||
"generic-array",
|
||||
"subtle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crypto-common"
|
||||
version = "0.1.3"
|
||||
|
@ -916,6 +1027,17 @@ dependencies = [
|
|||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "der"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6919815d73839e7ad218de758883aae3a257ba6759ce7a9992501efbb53d705c"
|
||||
dependencies = [
|
||||
"const-oid",
|
||||
"crypto-bigint",
|
||||
"pem-rfc7468",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "derive_more"
|
||||
version = "0.99.17"
|
||||
|
@ -1064,6 +1186,7 @@ dependencies = [
|
|||
"cfg-if",
|
||||
"crc32fast",
|
||||
"libc",
|
||||
"libz-sys",
|
||||
"miniz_oxide",
|
||||
]
|
||||
|
||||
|
@ -1110,6 +1233,70 @@ dependencies = [
|
|||
"percent-encoding",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "frunk"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0cd67cf7d54b7e72d0ea76f3985c3747d74aee43e0218ad993b7903ba7a5395e"
|
||||
dependencies = [
|
||||
"frunk_core",
|
||||
"frunk_derives",
|
||||
"frunk_proc_macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "frunk_core"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1246cf43ec80bf8b2505b5c360b8fb999c97dabd17dbb604d85558d5cbc25482"
|
||||
|
||||
[[package]]
|
||||
name = "frunk_derives"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3dbc4f084ec5a3f031d24ccedeb87ab2c3189a2f33b8d070889073837d5ea09e"
|
||||
dependencies = [
|
||||
"frunk_proc_macro_helpers",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "frunk_proc_macro_helpers"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "99f11257f106c6753f5ffcb8e601fb39c390a088017aaa55b70c526bff15f63e"
|
||||
dependencies = [
|
||||
"frunk_core",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "frunk_proc_macros"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a078bd8459eccbb85e0b007b8f756585762a72a9efc53f359b371c3b6351dbcc"
|
||||
dependencies = [
|
||||
"frunk_core",
|
||||
"frunk_proc_macros_impl",
|
||||
"proc-macro-hack",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "frunk_proc_macros_impl"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6ffba99f0fa4f57e42f57388fbb9a0ca863bc2b4261f3c5570fed579d5df6c32"
|
||||
dependencies = [
|
||||
"frunk_core",
|
||||
"frunk_proc_macro_helpers",
|
||||
"proc-macro-hack",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fsevent-sys"
|
||||
version = "4.1.0"
|
||||
|
@ -1119,6 +1306,12 @@ dependencies = [
|
|||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "funty"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c"
|
||||
|
||||
[[package]]
|
||||
name = "futures"
|
||||
version = "0.3.21"
|
||||
|
@ -1271,6 +1464,12 @@ version = "0.26.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4"
|
||||
|
||||
[[package]]
|
||||
name = "glob"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
|
||||
|
||||
[[package]]
|
||||
name = "gloo-timers"
|
||||
version = "0.2.4"
|
||||
|
@ -1317,6 +1516,15 @@ dependencies = [
|
|||
"ahash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.12.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "db0d4cf898abf0081f964436dc980e96670a0f36863e4b83aaacdb65c9d7ccc3"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashlink"
|
||||
version = "0.7.0"
|
||||
|
@ -1326,6 +1534,15 @@ dependencies = [
|
|||
"hashbrown 0.11.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashlink"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d452c155cb93fecdfb02a73dd57b5d8e442c2063bd7aac72f1bc5e4263a43086"
|
||||
dependencies = [
|
||||
"hashbrown 0.12.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hdrhistogram"
|
||||
version = "7.5.0"
|
||||
|
@ -1686,6 +1903,88 @@ name = "lazy_static"
|
|||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||
dependencies = [
|
||||
"spin 0.5.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lazycell"
|
||||
version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
|
||||
|
||||
[[package]]
|
||||
name = "lexical"
|
||||
version = "6.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c7aefb36fd43fef7003334742cbf77b243fcd36418a1d1bdd480d613a67968f6"
|
||||
dependencies = [
|
||||
"lexical-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lexical-core"
|
||||
version = "0.8.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2cde5de06e8d4c2faabc400238f9ae1c74d5412d03a7bd067645ccbc47070e46"
|
||||
dependencies = [
|
||||
"lexical-parse-float",
|
||||
"lexical-parse-integer",
|
||||
"lexical-util",
|
||||
"lexical-write-float",
|
||||
"lexical-write-integer",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lexical-parse-float"
|
||||
version = "0.8.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "683b3a5ebd0130b8fb52ba0bdc718cc56815b6a097e28ae5a6997d0ad17dc05f"
|
||||
dependencies = [
|
||||
"lexical-parse-integer",
|
||||
"lexical-util",
|
||||
"static_assertions",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lexical-parse-integer"
|
||||
version = "0.8.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6d0994485ed0c312f6d965766754ea177d07f9c00c9b82a5ee62ed5b47945ee9"
|
||||
dependencies = [
|
||||
"lexical-util",
|
||||
"static_assertions",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lexical-util"
|
||||
version = "0.8.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5255b9ff16ff898710eb9eb63cb39248ea8a5bb036bea8085b1a767ff6c4e3fc"
|
||||
dependencies = [
|
||||
"static_assertions",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lexical-write-float"
|
||||
version = "0.8.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "accabaa1c4581f05a3923d1b4cfd124c329352288b7b9da09e766b0668116862"
|
||||
dependencies = [
|
||||
"lexical-util",
|
||||
"lexical-write-integer",
|
||||
"static_assertions",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lexical-write-integer"
|
||||
version = "0.8.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e1b6f3d1f4422866b68192d62f77bc5c700bee84f3069f2469d7bc8c77852446"
|
||||
dependencies = [
|
||||
"lexical-util",
|
||||
"static_assertions",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
|
@ -1693,6 +1992,22 @@ version = "0.2.124"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "21a41fed9d98f27ab1c6d161da622a4fa35e8a54a8adc24bbf3ddd0ef70b0e50"
|
||||
|
||||
[[package]]
|
||||
name = "libloading"
|
||||
version = "0.7.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "efbc0f03f9a775e9f6aed295c6a1ba2253c5757a9e03d55c6caa46a681abcddd"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libm"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "33a33a362ce288760ec6a508b94caaec573ae7d3bbbd91b87aa0bad4456839db"
|
||||
|
||||
[[package]]
|
||||
name = "libsodium-sys"
|
||||
version = "0.2.7"
|
||||
|
@ -1716,6 +2031,17 @@ dependencies = [
|
|||
"vcpkg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libz-sys"
|
||||
version = "1.1.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9702761c3935f8cc2f101793272e202c72b99da8f4224a19ddcf1279a6450bbf"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"pkg-config",
|
||||
"vcpkg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "linked-hash-map"
|
||||
version = "0.5.4"
|
||||
|
@ -1848,6 +2174,43 @@ dependencies = [
|
|||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mysql_common"
|
||||
version = "0.29.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "20ce6fdcef94a8e87fea3f9402de4d7e403f10e8c20b6e2bd207e6b6f8a4eab0"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"bigdecimal",
|
||||
"bindgen",
|
||||
"bitflags",
|
||||
"bitvec",
|
||||
"byteorder",
|
||||
"bytes",
|
||||
"cc",
|
||||
"cmake",
|
||||
"crc32fast",
|
||||
"flate2",
|
||||
"frunk",
|
||||
"lazy_static",
|
||||
"lexical",
|
||||
"num-bigint 0.4.3",
|
||||
"num-traits",
|
||||
"rand",
|
||||
"regex",
|
||||
"rust_decimal",
|
||||
"saturating",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sha-1",
|
||||
"sha2 0.10.2",
|
||||
"smallvec",
|
||||
"subprocess",
|
||||
"thiserror",
|
||||
"time 0.3.11",
|
||||
"uuid 1.1.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "native-tls"
|
||||
version = "0.2.10"
|
||||
|
@ -1925,6 +2288,23 @@ dependencies = [
|
|||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-bigint-dig"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "566d173b2f9406afbc5510a90925d5a2cd80cae4605631f1212303df265de011"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"lazy_static",
|
||||
"libm",
|
||||
"num-integer",
|
||||
"num-iter",
|
||||
"num-traits",
|
||||
"rand",
|
||||
"smallvec",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-integer"
|
||||
version = "0.1.44"
|
||||
|
@ -1964,6 +2344,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"libm",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2204,6 +2585,12 @@ dependencies = [
|
|||
"sha2 0.9.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "peeking_take_while"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
|
||||
|
||||
[[package]]
|
||||
name = "pem"
|
||||
version = "1.0.2"
|
||||
|
@ -2213,6 +2600,15 @@ dependencies = [
|
|||
"base64",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pem-rfc7468"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "01de5d978f34aa4b2296576379fcc416034702fd94117c56ffd8a1a767cefb30"
|
||||
dependencies = [
|
||||
"base64ct",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "percent-encoding"
|
||||
version = "2.1.0"
|
||||
|
@ -2269,6 +2665,28 @@ version = "0.1.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
|
||||
|
||||
[[package]]
|
||||
name = "pkcs1"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a78f66c04ccc83dd4486fd46c33896f4e17b24a7a3a6400dedc48ed0ddd72320"
|
||||
dependencies = [
|
||||
"der",
|
||||
"pkcs8",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pkcs8"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7cabda3fb821068a9a4fab19a683eac3af12edf0f34b94a8be53c4972b8149d0"
|
||||
dependencies = [
|
||||
"der",
|
||||
"spki",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pkg-config"
|
||||
version = "0.3.25"
|
||||
|
@ -2353,7 +2771,7 @@ dependencies = [
|
|||
"serde_urlencoded",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
"uuid",
|
||||
"uuid 0.8.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2517,6 +2935,12 @@ dependencies = [
|
|||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "radium"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09"
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.8.5"
|
||||
|
@ -2673,6 +3097,26 @@ dependencies = [
|
|||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rsa"
|
||||
version = "0.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4cf22754c49613d2b3b119f0e5d46e34a2c628a937e3024b8762de4e7d8c710b"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"digest 0.10.3",
|
||||
"num-bigint-dig",
|
||||
"num-integer",
|
||||
"num-iter",
|
||||
"num-traits",
|
||||
"pkcs1",
|
||||
"pkcs8",
|
||||
"rand_core",
|
||||
"smallvec",
|
||||
"subtle",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "russh"
|
||||
version = "0.34.0-beta.5"
|
||||
|
@ -2881,6 +3325,12 @@ dependencies = [
|
|||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "saturating"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ece8e78b2f38ec51c51f5d475df0a7187ba5111b2a28bdc761ee05b075d40a71"
|
||||
|
||||
[[package]]
|
||||
name = "schannel"
|
||||
version = "0.1.19"
|
||||
|
@ -2936,7 +3386,7 @@ dependencies = [
|
|||
"time 0.2.27",
|
||||
"tracing",
|
||||
"url",
|
||||
"uuid",
|
||||
"uuid 0.8.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2997,7 +3447,7 @@ dependencies = [
|
|||
"sea-query-driver",
|
||||
"serde_json",
|
||||
"time 0.2.27",
|
||||
"uuid",
|
||||
"uuid 0.8.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -3227,6 +3677,12 @@ dependencies = [
|
|||
"lazy_static",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "shlex"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3"
|
||||
|
||||
[[package]]
|
||||
name = "signal-hook-registry"
|
||||
version = "1.4.0"
|
||||
|
@ -3279,6 +3735,16 @@ dependencies = [
|
|||
"lock_api",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "spki"
|
||||
version = "0.5.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "44d01ac02a6ccf3e07db148d2be087da624fea0221a16152ed01f0496a6b0a27"
|
||||
dependencies = [
|
||||
"base64ct",
|
||||
"der",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sqlformat"
|
||||
version = "0.1.8"
|
||||
|
@ -3307,12 +3773,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "e48c61941ccf5ddcada342cd59e3e5173b007c509e1e8e990dafc830294d9dc5"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"atoi",
|
||||
"atoi 0.4.0",
|
||||
"bitflags",
|
||||
"byteorder",
|
||||
"bytes",
|
||||
"chrono",
|
||||
"crc",
|
||||
"crc 2.1.0",
|
||||
"crossbeam-queue",
|
||||
"either",
|
||||
"event-listener",
|
||||
|
@ -3322,7 +3788,7 @@ dependencies = [
|
|||
"futures-executor",
|
||||
"futures-intrusive",
|
||||
"futures-util",
|
||||
"hashlink",
|
||||
"hashlink 0.7.0",
|
||||
"hex",
|
||||
"indexmap",
|
||||
"itoa",
|
||||
|
@ -3340,13 +3806,59 @@ dependencies = [
|
|||
"sha2 0.10.2",
|
||||
"smallvec",
|
||||
"sqlformat",
|
||||
"sqlx-rt",
|
||||
"sqlx-rt 0.5.13",
|
||||
"stringprep",
|
||||
"thiserror",
|
||||
"time 0.2.27",
|
||||
"tokio-stream",
|
||||
"url",
|
||||
"uuid",
|
||||
"uuid 0.8.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sqlx-core-guts"
|
||||
version = "0.6.0"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"atoi 1.0.0",
|
||||
"bitflags",
|
||||
"byteorder",
|
||||
"bytes",
|
||||
"crc 3.0.0",
|
||||
"crossbeam-queue",
|
||||
"digest 0.10.3",
|
||||
"either",
|
||||
"event-listener",
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
"futures-intrusive",
|
||||
"futures-util",
|
||||
"generic-array",
|
||||
"hashlink 0.8.0",
|
||||
"hex",
|
||||
"indexmap",
|
||||
"itoa",
|
||||
"libc",
|
||||
"log",
|
||||
"memchr",
|
||||
"num-bigint 0.4.3",
|
||||
"once_cell",
|
||||
"paste",
|
||||
"percent-encoding",
|
||||
"rand",
|
||||
"rsa",
|
||||
"rustls",
|
||||
"rustls-pemfile",
|
||||
"sha-1",
|
||||
"sha2 0.10.2",
|
||||
"smallvec",
|
||||
"sqlformat",
|
||||
"sqlx-rt 0.6.0",
|
||||
"stringprep",
|
||||
"thiserror",
|
||||
"tokio-stream",
|
||||
"url",
|
||||
"webpki-roots",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -3364,7 +3876,7 @@ dependencies = [
|
|||
"serde_json",
|
||||
"sha2 0.10.2",
|
||||
"sqlx-core",
|
||||
"sqlx-rt",
|
||||
"sqlx-rt 0.5.13",
|
||||
"syn",
|
||||
"url",
|
||||
]
|
||||
|
@ -3381,6 +3893,15 @@ dependencies = [
|
|||
"tokio-native-tls",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sqlx-rt"
|
||||
version = "0.6.0"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"tokio",
|
||||
"tokio-rustls",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "stable_deref_trait"
|
||||
version = "1.2.0"
|
||||
|
@ -3396,6 +3917,12 @@ dependencies = [
|
|||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "static_assertions"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
||||
|
||||
[[package]]
|
||||
name = "stdweb"
|
||||
version = "0.4.20"
|
||||
|
@ -3467,6 +3994,16 @@ version = "0.10.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
|
||||
|
||||
[[package]]
|
||||
name = "subprocess"
|
||||
version = "0.2.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0c2e86926081dda636c546d8c5e641661049d7562a68f5488be4a1f7f66f6086"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "subtle"
|
||||
version = "2.4.1"
|
||||
|
@ -3490,6 +4027,12 @@ version = "0.1.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "20518fe4a4c9acf048008599e464deb21beeae3d3578418951a189c235a7a9a8"
|
||||
|
||||
[[package]]
|
||||
name = "tap"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369"
|
||||
|
||||
[[package]]
|
||||
name = "tempfile"
|
||||
version = "3.3.0"
|
||||
|
@ -4070,6 +4613,12 @@ dependencies = [
|
|||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "uuid"
|
||||
version = "1.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dd6469f4314d5f1ffec476e05f17cc9a78bc7a27a6a857842170bdf8d6f98d2f"
|
||||
|
||||
[[package]]
|
||||
name = "valuable"
|
||||
version = "0.1.0"
|
||||
|
@ -4161,6 +4710,7 @@ dependencies = [
|
|||
"warpgate-admin",
|
||||
"warpgate-common",
|
||||
"warpgate-protocol-http",
|
||||
"warpgate-protocol-mysql",
|
||||
"warpgate-protocol-ssh",
|
||||
]
|
||||
|
||||
|
@ -4185,7 +4735,7 @@ dependencies = [
|
|||
"thiserror",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"uuid",
|
||||
"uuid 0.8.2",
|
||||
"warpgate-common",
|
||||
"warpgate-db-entities",
|
||||
"warpgate-protocol-ssh",
|
||||
|
@ -4221,7 +4771,7 @@ dependencies = [
|
|||
"tracing-core",
|
||||
"tracing-subscriber",
|
||||
"url",
|
||||
"uuid",
|
||||
"uuid 0.8.2",
|
||||
"warpgate-db-entities",
|
||||
"warpgate-db-migrations",
|
||||
]
|
||||
|
@ -4235,7 +4785,7 @@ dependencies = [
|
|||
"sea-orm",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"uuid",
|
||||
"uuid 0.8.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -4246,7 +4796,7 @@ dependencies = [
|
|||
"chrono",
|
||||
"sea-orm",
|
||||
"sea-orm-migration",
|
||||
"uuid",
|
||||
"uuid 0.8.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -4270,13 +4820,30 @@ dependencies = [
|
|||
"tokio",
|
||||
"tokio-tungstenite",
|
||||
"tracing",
|
||||
"uuid",
|
||||
"uuid 0.8.2",
|
||||
"warpgate-admin",
|
||||
"warpgate-common",
|
||||
"warpgate-db-entities",
|
||||
"warpgate-web",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "warpgate-protocol-mysql"
|
||||
version = "0.3.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
"bytes",
|
||||
"mysql_common",
|
||||
"sqlx-core-guts",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"uuid 0.8.2",
|
||||
"warpgate-admin",
|
||||
"warpgate-common",
|
||||
"warpgate-db-entities",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "warpgate-protocol-ssh"
|
||||
version = "0.3.0"
|
||||
|
@ -4295,9 +4862,10 @@ dependencies = [
|
|||
"time 0.3.11",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"uuid",
|
||||
"uuid 0.8.2",
|
||||
"warpgate-common",
|
||||
"warpgate-db-entities",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -4408,6 +4976,15 @@ dependencies = [
|
|||
"untrusted",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "webpki-roots"
|
||||
version = "0.22.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "44d8de8415c823c8abd270ad483c6feeac771fad964890779f9a8cb24fbbc1bf"
|
||||
dependencies = [
|
||||
"webpki",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wepoll-ffi"
|
||||
version = "0.1.2"
|
||||
|
@ -4500,6 +5077,15 @@ dependencies = [
|
|||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wyz"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "30b31594f29d27036c383b53b59ed3476874d518f0efb151b27a4c275141390e"
|
||||
dependencies = [
|
||||
"tap",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "yaml-rust"
|
||||
version = "0.4.5"
|
||||
|
@ -4530,6 +5116,6 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "zeroize"
|
||||
version = "1.3.0"
|
||||
version = "1.5.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd"
|
||||
checksum = "20b578acffd8516a6c3f2a1bdefc1ec37e547bb4e0fb8b6b01a4cafc886b4442"
|
||||
|
|
|
@ -6,6 +6,7 @@ members = [
|
|||
"warpgate-db-migrations",
|
||||
"warpgate-db-entities",
|
||||
"warpgate-protocol-http",
|
||||
"warpgate-protocol-mysql",
|
||||
"warpgate-protocol-ssh",
|
||||
"warpgate-web",
|
||||
]
|
||||
|
|
|
@ -44,6 +44,11 @@ fn _default_http_listen() -> String {
|
|||
"0.0.0.0:8888".to_owned()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn _default_mysql_listen() -> String {
|
||||
"0.0.0.0:33306".to_owned()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn _default_retention() -> Duration {
|
||||
Duration::SECOND * 60 * 60 * 24 * 7
|
||||
|
@ -133,6 +138,8 @@ pub struct UserRequireCredentialsPolicy {
|
|||
pub http: Option<Vec<String>>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub ssh: Option<Vec<String>>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub mysql: Option<Vec<String>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
||||
|
@ -209,6 +216,32 @@ impl Default for HTTPConfig {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
||||
pub struct MySQLConfig {
|
||||
#[serde(default = "_default_false")]
|
||||
pub enable: bool,
|
||||
|
||||
#[serde(default = "_default_mysql_listen")]
|
||||
pub listen: String,
|
||||
|
||||
#[serde(default)]
|
||||
pub certificate: String,
|
||||
|
||||
#[serde(default)]
|
||||
pub key: String,
|
||||
}
|
||||
|
||||
impl Default for MySQLConfig {
|
||||
fn default() -> Self {
|
||||
MySQLConfig {
|
||||
enable: true,
|
||||
listen: _default_http_listen(),
|
||||
certificate: "".to_owned(),
|
||||
key: "".to_owned(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
||||
pub struct RecordingsConfig {
|
||||
#[serde(default = "_default_false")]
|
||||
|
@ -266,6 +299,9 @@ pub struct WarpgateConfigStore {
|
|||
#[serde(default)]
|
||||
pub http: HTTPConfig,
|
||||
|
||||
#[serde(default)]
|
||||
pub mysql: MySQLConfig,
|
||||
|
||||
#[serde(default)]
|
||||
pub log: LogConfig,
|
||||
}
|
||||
|
@ -281,6 +317,7 @@ impl Default for WarpgateConfigStore {
|
|||
database_url: _default_database_url(),
|
||||
ssh: SSHConfig::default(),
|
||||
http: HTTPConfig::default(),
|
||||
mysql: MySQLConfig::default(),
|
||||
log: LogConfig::default(),
|
||||
}
|
||||
}
|
||||
|
|
21
warpgate-protocol-mysql/Cargo.toml
Normal file
21
warpgate-protocol-mysql/Cargo.toml
Normal file
|
@ -0,0 +1,21 @@
|
|||
[package]
|
||||
edition = "2021"
|
||||
license = "Apache-2.0"
|
||||
name = "warpgate-protocol-mysql"
|
||||
version = "0.3.0"
|
||||
|
||||
[dependencies]
|
||||
sqlx-core-guts = { version = "0.6", features = [
|
||||
"runtime-tokio-rustls",
|
||||
"mysql",
|
||||
], path = "../../sqlx-core-guts/sqlx-core-guts" }
|
||||
warpgate-admin = { version = "*", path = "../warpgate-admin" }
|
||||
warpgate-common = { version = "*", path = "../warpgate-common" }
|
||||
warpgate-db-entities = { version = "*", path = "../warpgate-db-entities" }
|
||||
anyhow = "1.0"
|
||||
async-trait = "0.1"
|
||||
tokio = { version = "1.19", features = ["tracing", "signal"] }
|
||||
tracing = "0.1"
|
||||
uuid = { version = "0.8", features = ["v4"] }
|
||||
bytes = "1.1"
|
||||
mysql_common = "0.29"
|
3
warpgate-protocol-mysql/src/common.rs
Normal file
3
warpgate-protocol-mysql/src/common.rs
Normal file
|
@ -0,0 +1,3 @@
|
|||
use warpgate_common::ProtocolName;
|
||||
|
||||
pub const PROTOCOL_NAME: ProtocolName = "MySQL";
|
216
warpgate-protocol-mysql/src/lib.rs
Normal file
216
warpgate-protocol-mysql/src/lib.rs
Normal file
|
@ -0,0 +1,216 @@
|
|||
#![feature(type_alias_impl_trait, let_else, try_blocks)]
|
||||
mod common;
|
||||
use anyhow::{Context, Result};
|
||||
use async_trait::async_trait;
|
||||
use bytes::buf::Chain;
|
||||
use bytes::{Buf, Bytes, BytesMut};
|
||||
use mysql_common::constants::{CapabilityFlags, StatusFlags};
|
||||
use mysql_common::io::ParseBuf;
|
||||
use mysql_common::misc::raw::{Const, RawBytes, RawInt, Skip};
|
||||
use mysql_common::packets::{HandshakePacket, HandshakeResponse, OkPacket};
|
||||
use mysql_common::proto::codec::PacketCodec;
|
||||
use mysql_common::proto::{MyDeserialize, MySerialize};
|
||||
use sqlx_core_guts::io::{BufStream, Encode};
|
||||
use sqlx_core_guts::mysql::connection::stream::MySqlStream;
|
||||
use sqlx_core_guts::mysql::protocol::connect::Handshake;
|
||||
use sqlx_core_guts::mysql::protocol::response::Status;
|
||||
use sqlx_core_guts::mysql::protocol::{Capabilities, Packet};
|
||||
use std::borrow::Cow;
|
||||
use std::fmt::Debug;
|
||||
use std::net::SocketAddr;
|
||||
use tokio::io::{AsyncRead, AsyncReadExt};
|
||||
use tokio::net::tcp::ReadHalf;
|
||||
use tokio::net::{TcpListener, TcpStream};
|
||||
use tracing::*;
|
||||
use warpgate_common::{ProtocolServer, Services, Target, TargetTestError};
|
||||
|
||||
pub struct MySQLProtocolServer {
|
||||
services: Services,
|
||||
}
|
||||
|
||||
impl MySQLProtocolServer {
|
||||
pub async fn new(services: &Services) -> Result<Self> {
|
||||
Ok(MySQLProtocolServer {
|
||||
services: services.clone(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl ProtocolServer for MySQLProtocolServer {
|
||||
async fn run(self, address: SocketAddr) -> Result<()> {
|
||||
info!(?address, "Listening");
|
||||
let listener = TcpListener::bind(address).await?;
|
||||
loop {
|
||||
let (stream, addr) = listener.accept().await?;
|
||||
tokio::spawn(async move {
|
||||
match Session::new(stream).run().await {
|
||||
Ok(_) => info!(?addr, "Session finished"),
|
||||
Err(e) => error!(?addr, ?e, "Session failed"),
|
||||
}
|
||||
});
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn test_target(self, _target: Target) -> Result<(), TargetTestError> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Debug for MySQLProtocolServer {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "MySQLProtocolServer")
|
||||
}
|
||||
}
|
||||
|
||||
struct Session {
|
||||
stream: BufStream<TcpStream>,
|
||||
sequence_id: u8,
|
||||
capabilities: Capabilities,
|
||||
}
|
||||
|
||||
impl Session {
|
||||
pub fn new(stream: TcpStream) -> Self {
|
||||
let mut capabilities = Capabilities::PROTOCOL_41
|
||||
| Capabilities::IGNORE_SPACE
|
||||
| Capabilities::DEPRECATE_EOF
|
||||
| Capabilities::FOUND_ROWS
|
||||
| Capabilities::TRANSACTIONS
|
||||
| Capabilities::SECURE_CONNECTION
|
||||
| Capabilities::PLUGIN_AUTH_LENENC_DATA
|
||||
| Capabilities::MULTI_STATEMENTS
|
||||
| Capabilities::MULTI_RESULTS
|
||||
| Capabilities::PLUGIN_AUTH
|
||||
| Capabilities::PS_MULTI_RESULTS
|
||||
| Capabilities::SSL;
|
||||
|
||||
Self {
|
||||
stream: BufStream::new(stream),
|
||||
capabilities,
|
||||
sequence_id: 0,
|
||||
}
|
||||
}
|
||||
|
||||
async fn recv_packet(&mut self) -> Result<Packet<Bytes>> {
|
||||
// https://dev.mysql.com/doc/dev/mysql-server/8.0.12/page_protocol_basic_packets.html
|
||||
// https://mariadb.com/kb/en/library/0-packet/#standard-packet
|
||||
|
||||
let mut header: Bytes = self.stream.read(4).await?;
|
||||
|
||||
let packet_size = header.get_uint_le(3) as usize;
|
||||
let sequence_id = header.get_u8();
|
||||
|
||||
self.sequence_id = sequence_id.wrapping_add(1);
|
||||
|
||||
let payload: Bytes = self.stream.read(packet_size).await?;
|
||||
|
||||
// TODO: packet compression
|
||||
// TODO: packet joining
|
||||
|
||||
if payload
|
||||
.get(0)
|
||||
.ok_or(anyhow::anyhow!("Packet empty"))?
|
||||
.eq(&0xff)
|
||||
{
|
||||
// self.waiting.pop_front();
|
||||
|
||||
// instead of letting this packet be looked at everywhere, we check here
|
||||
// and emit a proper Error
|
||||
anyhow::bail!("Protocol error");
|
||||
// return Err(MySqlDatabaseError(ErrPacket::decode_with(
|
||||
// payload,
|
||||
// self.capabilities,
|
||||
// )?)
|
||||
// .into());
|
||||
}
|
||||
|
||||
Ok(Packet(payload))
|
||||
}
|
||||
|
||||
pub(crate) async fn send_packet<'en, T>(&mut self, payload: T) -> Result<()>
|
||||
where
|
||||
T: Encode<'en, Capabilities>,
|
||||
{
|
||||
self.sequence_id = 0;
|
||||
self.write_packet(payload);
|
||||
self.stream.flush().await.context("Failed to flush stream")
|
||||
}
|
||||
|
||||
pub(crate) fn write_packet<'en, T>(&mut self, payload: T)
|
||||
where
|
||||
T: Encode<'en, Capabilities>,
|
||||
{
|
||||
self.stream
|
||||
.write_with(Packet(payload), (self.capabilities, &mut self.sequence_id));
|
||||
}
|
||||
|
||||
pub async fn run(mut self) -> Result<()> {
|
||||
let mut inner = vec![];
|
||||
HandshakePacket::new(
|
||||
10,
|
||||
Cow::Borrowed(&b"10.0.0-Warpgate"[..]),
|
||||
1,
|
||||
b"abcdefgh".to_owned(),
|
||||
None::<&[u8]>,
|
||||
CapabilityFlags::CLIENT_PROTOCOL_41
|
||||
| CapabilityFlags::CLIENT_PLUGIN_AUTH
|
||||
| CapabilityFlags::CLIENT_LONG_PASSWORD
|
||||
| CapabilityFlags::CLIENT_FOUND_ROWS
|
||||
| CapabilityFlags::CLIENT_LONG_FLAG
|
||||
| CapabilityFlags::CLIENT_NO_SCHEMA
|
||||
| CapabilityFlags::CLIENT_IGNORE_SIGPIPE
|
||||
| CapabilityFlags::CLIENT_MULTI_RESULTS
|
||||
| CapabilityFlags::CLIENT_MULTI_STATEMENTS
|
||||
| CapabilityFlags::CLIENT_PS_MULTI_RESULTS
|
||||
| CapabilityFlags::CLIENT_CONNECT_ATTRS
|
||||
| CapabilityFlags::CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA
|
||||
| CapabilityFlags::CLIENT_CONNECT_WITH_DB
|
||||
| CapabilityFlags::CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS
|
||||
| CapabilityFlags::CLIENT_SESSION_TRACK
|
||||
| CapabilityFlags::CLIENT_IGNORE_SPACE
|
||||
| CapabilityFlags::CLIENT_INTERACTIVE
|
||||
| CapabilityFlags::CLIENT_TRANSACTIONS
|
||||
| CapabilityFlags::MULTI_FACTOR_AUTHENTICATION
|
||||
| CapabilityFlags::CLIENT_DEPRECATE_EOF
|
||||
| CapabilityFlags::CLIENT_RESERVED
|
||||
| CapabilityFlags::CLIENT_SECURE_CONNECTION,
|
||||
0,
|
||||
StatusFlags::empty(),
|
||||
Some(Cow::Borrowed(&b"mysql_native_password"[..])),
|
||||
)
|
||||
.serialize(&mut inner);
|
||||
|
||||
let mut packet = BytesMut::new();
|
||||
let mut codec = PacketCodec::default();
|
||||
codec
|
||||
.encode(&mut &*inner, &mut packet)
|
||||
.context("Failed to encode handshake packet")?;
|
||||
|
||||
self.stream.write(&packet[..]);
|
||||
|
||||
self.stream
|
||||
.flush()
|
||||
.await
|
||||
.context("Failed to flush stream")?;
|
||||
|
||||
let mut inbound_buffer = BytesMut::new();
|
||||
loop {
|
||||
let read_bytes = self.stream.read_buf(&mut inbound_buffer).await?;
|
||||
if read_bytes == 0 {
|
||||
break;
|
||||
}
|
||||
info!(?inbound_buffer, "got packet");
|
||||
let mut inner_buf = vec![];
|
||||
let result = codec.decode(&mut inbound_buffer, &mut inner_buf)?;
|
||||
if result {
|
||||
info!(?inner_buf, "got full packet");
|
||||
let mut pb = ParseBuf(&inner_buf);
|
||||
let pkt = HandshakeResponse::deserialize((), &mut pb)?;
|
||||
info!(?pkt, "got response");
|
||||
}
|
||||
info!(?inbound_buffer, "after got packet");
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
|
@ -22,3 +22,4 @@ tracing = "0.1"
|
|||
uuid = {version = "0.8", features = ["v4"]}
|
||||
warpgate-common = {version = "*", path = "../warpgate-common"}
|
||||
warpgate-db-entities = {version = "*", path = "../warpgate-db-entities"}
|
||||
zeroize="^1.5"
|
||||
|
|
|
@ -30,6 +30,7 @@ tracing-subscriber = {version = "0.3", features = ["env-filter", "local-time"]}
|
|||
warpgate-admin = {version = "*", path = "../warpgate-admin"}
|
||||
warpgate-common = {version = "*", path = "../warpgate-common"}
|
||||
warpgate-protocol-http = {version = "*", path = "../warpgate-protocol-http"}
|
||||
warpgate-protocol-mysql = {version = "*", path = "../warpgate-protocol-mysql"}
|
||||
warpgate-protocol-ssh = {version = "*", path = "../warpgate-protocol-ssh"}
|
||||
|
||||
[target.'cfg(target_os = "linux")'.dependencies]
|
||||
|
|
|
@ -7,6 +7,7 @@ use warpgate_common::db::cleanup_db;
|
|||
use warpgate_common::logging::install_database_logger;
|
||||
use warpgate_common::{ProtocolServer, Services};
|
||||
use warpgate_protocol_http::HTTPProtocolServer;
|
||||
use warpgate_protocol_mysql::MySQLProtocolServer;
|
||||
use warpgate_protocol_ssh::SSHProtocolServer;
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
|
@ -49,6 +50,20 @@ pub(crate) async fn command(cli: &crate::Cli) -> Result<()> {
|
|||
);
|
||||
}
|
||||
|
||||
if config.store.mysql.enable {
|
||||
protocol_futures.push(
|
||||
MySQLProtocolServer::new(&services).await?.run(
|
||||
config
|
||||
.store
|
||||
.mysql
|
||||
.listen
|
||||
.to_socket_addrs()?
|
||||
.next()
|
||||
.ok_or_else(|| anyhow::anyhow!("Failed to resolve the listen address"))?,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
tokio::spawn({
|
||||
let services = services.clone();
|
||||
async move {
|
||||
|
|
Loading…
Reference in a new issue