Skip to content
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

Presharedkey support #11

Closed
Ange-Cesari opened this issue Sep 26, 2023 · 8 comments
Closed

Presharedkey support #11

Ange-Cesari opened this issue Sep 26, 2023 · 8 comments
Labels
bug Something isn't working

Comments

@Ange-Cesari
Copy link

Hi,

I couldn't see any code related to the presharedkey for the server (nor the client)

Is it supported ?

If so, would it be possible to provide a example with presharedkey support ?

If it's supported by the library but not implemented yet (macros, public function...), do you think it's possible to provide an example of how to create the presharedkey with dalek and write to the api ?

Thanks,
Ange

@teon
Copy link
Contributor

teon commented Sep 28, 2023

Right now we do not support pre-shared key, but we will put this on the roadmap.

@Ange-Cesari
Copy link
Author

Hi @teon

Would it be possible to have a link to that roadmap ? I couldn't find it on github. Is it public ?

Best,
Ange

@master-hax
Copy link

fwiw i'm using this as a workaround at the moment:

let mut file = NamedTempFile::new()?;
writeln!(file, "{}", preshared_key.to_string());
let path = file.into_temp_path();
println!("wrote psk to file {:#?}", path);

let output = std::process::Command::new("wg")
.args(["set", interface_name, "peer", &peer_public_key.to_string(), "preshared-key", path.to_str().unwrap()])
.output()?;

path.close()?;

@Ange-Cesari
Copy link
Author

Hey @master-hax ,

Thank you for the work around.
Unfortunately I can't write on the disk and I can't process command from the binary due to security reasons, so I guess I'll have to wait for @wojcik91 to implement it.

Best,
Ange

@wojcik91
Copy link
Contributor

wojcik91 commented Oct 9, 2023

Hi @Ange-Cesari & @master-hax!
I did not have time to look into this yet, but from what I know the Peer struct already includes an optional preshared_key field.

Did you try it out?

@master-hax
Copy link

master-hax commented Oct 9, 2023

Hi @Ange-Cesari & @master-hax!
I did not have time to look into this yet, but from what I know the Peer struct already includes an optional preshared_key field.

Did you try it out?

Yes I've tried it out.

The key passed to the struct is persisted and looks like it gets applied when the interface configuration is read back.

However, if we double-check the peer with wg showwe can see that the preshared key is not set.

@Ange-Cesari
Copy link
Author

Hey, @wojcik91

I tried too,

It seems it's not a structure issue, it's an interface configuration issue and more like how are applied the different fields

@wojcik91 wojcik91 added the bug Something isn't working label Oct 10, 2023
@wojcik91
Copy link
Contributor

Hi.
There was indeed a bug in Linux implementation. Should be resolved now by #21. I'll make a new patch release shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants