-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
add ed22519 support #786
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I support sha256 and caching_sha256 already. I never used pluggable auth. I merged PR for adding auth_plugin_map with real experience. |
BTW, I don't like cryptography dependency so I want to use pure Python solution. |
right when I looked at the plugin API i had the impression it wasn't necessarily going to work :) So what is my path forward for a customer that wants to use ed25519? do you want me to PR a scheme for _auth.py that uses the |
Ah, yes. Please add it to |
OK so there is a reference Python implementation that has no dependencies at https://ed25519.cr.yp.to/python/ed25519.py , intro is at https://ed25519.cr.yp.to/software.html and this is public domain. that's one approach where if we were to use that I'd likely keep ed25519 in its own file. another approach is to use the C bindings: https://pypi.org/project/ed25519/ which fortunately seems to be a standalone C implementation, last released in 2015 so might not be tested with newer python 3 versions. would you want to break out _auth.py into a package so that things can be separated better? |
Initial support for PyMySQL#786 based on PyNaCl. Currently, authentication is limited to 32bytes-long passwords.
After having discussed with @zzzeek , I evaluated what I believe were the possible options for supporting MariaDB's Ed25519-based authentication. TL;DR: I have proposed #791 to add initial support for Ed25519 for passwords which are 32 bytes long, which would unblock us until another commit supports passwords of arbitrary size. Detailed context: I'm saying "inspired", because in the reference Ed25519 implementation, the seed used to generate the signing key and the public key must be a 32 byte random input, whereas MariaDB expects the This has an impact on the crypto package we can depend upon. Below is a list of what I evaluated:
Note: "The Apache2 license + use of C library" seems reasonable to me,
In https://github.com/dciabrin/PyMySQL/tree/ed25519-djb we started discussing a first implementation based on 1. with @zzzeek , but given the limitations, I dropped it. Based on our experience, it seems to me that the only viable Ed25519 implementation rely on native libraries, and all those libraries only support 32 bytes seed as input. Based on that, I did two implementations based on PyNaCl:
I'm planning to discuss the possible improvement with the PyNaCl folks upstream, but until then I believe #791 is ready to be reviewed and would allow us to at least partially support Ed25519 in MariaDB. |
See also https://jira.mariadb.org/browse/MDEV-19217 in case it's not linked here yet. |
So starting libsodium 1.0.17 we have all the low-level crypto function necessary to implement signature for arbitrary-length password. PyNaCl currently only provides bindings for libsodium 1.0.16, so I'll propose a PR to support to 1.0.17. Once this support lands I'll update #791 to fully support auth_ed25519 in PyMySQL. |
Heads up, FTR dciabrin@b02098d implements full support for auth_ed25519, with arbitrary passwords length. I didn't update #791 yet because it requires on pyca/pynacl#528 to land first. |
Looking at issues like #651, #532, #583, it looks like pymysql does not wish to support any client side authentication modules, such as sha256, or ed25519 which is what MariaDB supports. Two of the issues seem to be closed without any explanation though in #583 I see statements like "I don't want to add dependency" "Please move your code to pymysql/auth/sha256password.py".
It doesn't seem like there is a "pymysql/auth" folder in the source tree.
I have a need to understand what the path is here, my immediate use case is the ed25519 plugin. So here are what I see as all the possible choices, you can check these off:
auth_plugin_map
parameter, and we welcome contributors to add these plugins to an as-yet-not-created folderpymysql/auth
. PyMySQL will distribute the plugins but not support them unless their authors doauth_plugin_map
argument does. You will need to use mysql-connector-python or mysqlclient (does the latter support them?)The text was updated successfully, but these errors were encountered: