-
Notifications
You must be signed in to change notification settings - Fork 178
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
Mutual authentication #379
Conversation
Hello @DariusIMP , In order to accept your PR, you should sign the Eclipse CA first. |
Done. Also fixed the code for a failing test. I still need to add tests to this PR. |
… async-rustls-update
I reckon the benefit of using the latest version (i.e. pointing to git) of However, to be able accept the PR, we need a specific I've opened an issue on |
492c9db
to
865e02a
Compare
The issue has been closed and |
Thank you for this fix! Just for future reference, I would like to point out that this set up for testing 2 way authentication only works for the localhost case. I used this on two containers with their own hostnames and needed another configuration. The fix is valid and works well for this use case as well. For future reference, I'll just specify another layout. Say we have the hostnames "server" and "client" as above. Then the minica workflow for generating the keys would be like this: # Getting minica
$ git clone https://github.com/jsha/minica.git
$ cd minica
$ go build
# create CA and server certificates
$ ./minica --domains server,client
$ ./minica --domains client,server
$ find .
...
./minica-key.pem
./server
./server/cert.pem
./server/key.pem
./minica.pem
./client
./client/cert.pem
./client/key.pem
... The configuration files For the server: {
mode: "router",
listen: {
endpoints: [ "tls/server:7447" ]
},
transport: {
link: {
tls: {
client_auth: true,
root_ca_certificate: "./minica/minica.pem",
server_private_key: "./minica/server/key.pem",
server_certificate: "./minica/server/cert.pem",
},
},
},
} For the client: {
mode: "client",
connect: {
endpoints: [ "tls/server:7447" ]
},
transport: {
link: {
tls: {
client_auth: true,
root_ca_certificate: "./minica/minica.pem",
client_private_key: "./minica/client/key.pem",
client_certificate: "./minica/client/cert.pem",
},
},
},
} |
Features
How to test the 2 way authentication
Let's create 2 certificates, one for the "server" and one for the "client". For this, it is explained in the zenoh documentation regarding TLS (https://zenoh.io/docs/manual/tls/) how to create certificates using MiniCA.
You can store the certificates as follows, under a certificates folder on your zenoh folder. It should look like this:
From your zenoh folder, after having build this branch,
1- run the router with:
RUST_LOG=debug cargo run --bin=zenohd -- -c configs/router.json5
2- run a publisher with:
RUST_LOG=debug ./target/debug/examples/z_pub -c configs/client.json5
3- run a subscriber with:
RUST_LOG=debug ./target/debug/examples/z_sub -c configs/client.json5
where
configs/client.json5
isand
configs/router.json5
is:(see the configs are inside a folder
configs
under your/zenoh
folder).