Skip to content

Feature: passwords instead of keyfiles #410

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

Open
tpwrules opened this issue Feb 22, 2025 · 11 comments
Open

Feature: passwords instead of keyfiles #410

tpwrules opened this issue Feb 22, 2025 · 11 comments

Comments

@tpwrules
Copy link

Would you accept a PR to implement using passwords as a command line option instead of having to generate and share keyfiles? It should be straightforward to do using the libsodium API and would allow smoother setup.

@svpcom
Copy link
Owner

svpcom commented Feb 23, 2025

Why not use https://github.com/svpcom/wfb-ng/wiki/Drone-auto-provisioning ?
Enter any password anyway will require some network connection.

@tpwrules
Copy link
Author

tpwrules commented Feb 23, 2025

Sorry, I guess I should have been clearer, I meant as options to wfb_tx and wfb_rx. I am using them in a project instead of the whole wfb-ng system, so I would not be interested in using the auto provisioning right now.

It looks like passwords will also let you have in effect multiple binds at once. Passwords wouldn't be mandatory by any means but would just be a convenience and could migrate to other tools later.

@svpcom
Copy link
Owner

svpcom commented Feb 23, 2025

How to derive pubkey/privkey keypair from the password?

@tpwrules
Copy link
Author

That's possible using libsodium's crypto_box_seed_keypair and a KDF like crypto_pwhash. Would you accept a PR to use that?

@svpcom
Copy link
Owner

svpcom commented Feb 23, 2025

yes.

@svpcom
Copy link
Owner

svpcom commented Feb 23, 2025

Also if crypto_box_seed_keypair can generate keypair deterministically from the password, then the easiest solution will to write two screen of code utility (like wfb_keygen.c) that will just generate keypair from the password and no other patches for wfb_rx/tx are needed

@svpcom
Copy link
Owner

svpcom commented Feb 23, 2025

Also original password will not be revealed to public because only generated keys will be stored in system

@tpwrules
Copy link
Author

I will do some investigation but for my purposes it would be useful to not have another utility.

@svpcom
Copy link
Owner

svpcom commented Feb 23, 2025

Just add additional command-line option and crypto_box_see_keypair here:

if (crypto_box_keypair(drone_publickey, drone_secretkey) !=0 ||

@tpwrules
Copy link
Author

tpwrules commented Feb 24, 2025

I think the implementation you have just added is not correct. You should generate 2*crypto_box_SEEDBYTES bytes with Argon2 and then pass one half of the buffer to each crypto_box_seed_keypair call. Currently both sides will get the same keys.

I still also would like to refactor the stuff out of the generator utility and have it as an option direct to wfb_tx and wfb_rx. We might have to turn down the amount of RAM used, I was thinking like 1MiB. The brute-forceability does not need to be super duper resistant.

@svpcom
Copy link
Owner

svpcom commented Feb 24, 2025

Libsodium crypto_box implementation allows to use such identical keypairs for both sides. I've already tested them. But I'll implement your sugesstion to have clean encryption logic.

Argon2 key derivation eats alot of memory and cpu (because it provides bruteforce protection) and recalculate it during every wfb_tx/rx start will be very slow and can lead to out of memory condition (especially on cheap devices like openipc cameras and openwrt routers). Also having password as cmdline argument vs key in the file is less secure, because every user ( or process in system) can run ps and read it

svpcom added a commit that referenced this issue Feb 25, 2025
svpcom added a commit that referenced this issue Feb 25, 2025
svpcom added a commit that referenced this issue Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants