[feat] Update SSL option to connect securely by default#1418
[feat] Update SSL option to connect securely by default#1418rolandwalker merged 9 commits intodbcli:mainfrom
Conversation
|
While I favor this, there is a lot to consider. The vendor client does not simply use SSL/TLS by default, but tries encrypted transport first, then retries without encryption on failure (https://dev.mysql.com/doc/refman/9.0/en/encrypted-connections.html). That's probably the minimum we need to do, to avoid a flood of incoming issues. To help the user out, and to do better than the vendor client, we could also have a config-file option for encrypted transport with three states: on/off/auto, with the default of "auto".
|
Good callout. I actually thought it would downgrade automatically as long as the server wasn't requiring SSL, so definitely did not expect that; I will rework that bit. RE: the config, I did think about adding a config file option but thought it might be scope creep. But if you also think it's a good idea I will work on that bit as well! |
Ah, well I haven't check pymysql docs/internals before writing that — maybe the library does! |
It doesn't apparently; that's why I was surprised anyway, hah! So it will need a decent amount of work to add in the config and retry logic. Will take a look though. |
… ssl options. Added tests to cover ssl_mode functionality.
mycli/main.py
Outdated
|
|
||
| if ssl_enable is not None: | ||
| click.secho( | ||
| "Warning: The --ssl/--no-ssl CLI options will be deprecated in a future release. " |
There was a problem hiding this comment.
Can we say "are deprecated and will be removed in a future release"?
mycli/myclirc
Outdated
| # Define one or more SQL statements per alias (semicolon-separated). | ||
| # example_dsn = "SET sql_select_limit=1000; SET time_zone='+00:00'" | ||
|
|
||
| [ssl] |
There was a problem hiding this comment.
Are other SSL/TLS settings expected in the [ssl] section? If not, should this be part of [main]? (If so, a new section makes sense.)
…/no-ssl deprecation warning. Updated changelog to match.
Description
What:
Currently mycli does not connect via SSL by default, while the official MySQL client does.
Why:
Connecting via SSL by default is more secure.
Resolves #760
Checklist
changelog.md.AUTHORSfile (or it's already there).uv run ruff check && uv run ruff format && uv run mypy --install-types .to lint and format the code.