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

Add certificate and user/password authentication methods to ACL filters #1073

Merged
merged 75 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from 59 commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
4456e3f
adding test files
kauncoder Mar 13, 2024
3c84e59
testing cert names
kauncoder Mar 13, 2024
7c8ee21
testing cert authn
kauncoder Mar 13, 2024
a067a77
adding basic authID functionality
kauncoder Mar 18, 2024
4e91772
remove secret files
kauncoder Mar 18, 2024
613086c
add extensibility
kauncoder Mar 19, 2024
e83ca81
add extensibility
kauncoder Mar 19, 2024
fa20fad
add extensibility
kauncoder Mar 19, 2024
bc1558d
adding type constraints
kauncoder Mar 20, 2024
294e0c5
adding level abstraction for authentication info
kauncoder Mar 22, 2024
f512764
adding username authentication
kauncoder Mar 25, 2024
8d048f4
cleaning code
kauncoder Mar 26, 2024
8ed2361
added cfg checks for auth_usrpwd
kauncoder Mar 27, 2024
29760c0
adding test files
kauncoder Mar 13, 2024
339170d
merge with 0.11
kauncoder Apr 22, 2024
39ec2bf
fix error due to vsock
kauncoder Apr 22, 2024
e43aa77
fix test error
kauncoder Apr 23, 2024
0b6b80f
access auth ids in acl interceptor
kauncoder Apr 25, 2024
427733b
add authentication support in acl
kauncoder Apr 25, 2024
78eacc9
added Subject
kauncoder Apr 25, 2024
7ba77b6
adding test files
kauncoder Mar 13, 2024
49143b4
merge with quic changes
kauncoder Apr 25, 2024
310c122
add authn features with acl
kauncoder Apr 26, 2024
b6eb797
remove error
kauncoder Apr 30, 2024
66dc536
add tests for tls and quic
kauncoder May 2, 2024
bfeaa53
add tests for user-password
kauncoder May 2, 2024
84bd03a
merge with latest acl
kauncoder May 2, 2024
0513918
remove format error
kauncoder May 2, 2024
b999a21
ignore tests without testfiles
kauncoder May 3, 2024
ae40b9c
remove shm test errors
kauncoder May 3, 2024
58739b1
remove typos
kauncoder May 3, 2024
bb16d4c
add testfiles for authn
kauncoder May 4, 2024
babdabc
fix testfiles for authn
kauncoder May 4, 2024
b4aaef9
Merge branch 'dev/1.0.0' into authn/testing
oteffahi May 28, 2024
0a03e99
Chore: Code format
oteffahi May 28, 2024
f91e885
Change port numbers to allow tests to run concurrently
oteffahi May 29, 2024
2714ced
Fix TLS and Quic test failures due to subsequent sessions on same por…
oteffahi May 29, 2024
baf4704
Format json configs
oteffahi May 29, 2024
405000a
Remove unused deprecated dependency async-rustls
oteffahi May 31, 2024
84ae20e
Chore: format list of cargo dependencies
oteffahi May 31, 2024
ae7f496
Merge branch 'dev/1.0.0' into authn/testing
oteffahi May 31, 2024
b136812
Fix imports
oteffahi May 31, 2024
51028d4
Fix some styling and format
oteffahi Jun 7, 2024
08fd83c
Fix feature usage
oteffahi Jun 11, 2024
b9bf9c2
Remove unnecessary redefinition of RecvOpenSynOut
oteffahi Jun 11, 2024
f0521a3
Remove unnecessary clones
oteffahi Jun 11, 2024
536b6ac
Rewrite return value
oteffahi Jun 11, 2024
b5ee6e8
Fix typo
oteffahi Jun 11, 2024
5f11793
Implement get_auth_ids for TransportUnicastLowlatency
oteffahi Jun 12, 2024
3dd5314
Fix disabled access control for certain tests
oteffahi Jun 13, 2024
27d6225
Add lowlatency test
oteffahi Jun 13, 2024
6630842
Remove unnecessary warnings
oteffahi Jun 13, 2024
f4cc818
Check only if interfaces list is empty
oteffahi Jun 13, 2024
01c4aca
Merge branch 'dev/1.0.0' into authn/testing (squashed)
oteffahi Jun 13, 2024
d30def4
Merge branch 'dev/1.0.0' into authn/testing
oteffahi Jun 13, 2024
0998b7d
Move x509-parser dependency to workspace
oteffahi Jun 13, 2024
8d086e2
Merge branch 'dev/1.0.0' into authn/testing
oteffahi Jun 13, 2024
2c3cde5
Merge branch 'dev/1.0.0' into authn/testing
oteffahi Jun 14, 2024
97a87ef
Revert "Check only if interfaces list is empty"
oteffahi Jun 14, 2024
1dffa67
Change LinkAuthIdBuilder to return Self instead of &mut Self
oteffahi Jun 14, 2024
e78c3ff
Add LinkAuthId::builder()
oteffahi Jun 14, 2024
392fb1f
chore: Reorder tokio features
oteffahi Jun 14, 2024
540bb55
Add LinkAuthId::none()
oteffahi Jun 14, 2024
b647685
Change LinkUnicastTrait.get_auth_identifier to return ref
oteffahi Jun 14, 2024
e91821c
Change get_cert_common_name(conn) parameter to ref
oteffahi Jun 14, 2024
63e82d4
Add license header
oteffahi Jun 14, 2024
639da69
Rename get_auth_identifier to get_auth_id
oteffahi Jun 14, 2024
b05797b
Rewrite unnecessary match blocs, add evaluation of get_interface_name…
oteffahi Jun 14, 2024
25362ce
Use std::env::temp_dir() instead of hardcoded path in zenoh/authentic…
oteffahi Jun 14, 2024
ca5d08a
Change return type with auth_usrpwd feature
oteffahi Jun 14, 2024
42a48d5
Lint test
oteffahi Jun 14, 2024
2244b86
Fix link-vsock implementation of get_auth_id
oteffahi Jun 17, 2024
719418d
Fix authtests filepaths on Ubuntu
oteffahi Jun 17, 2024
3336b37
Update default config
oteffahi Jun 17, 2024
fb923ca
Optimize collecting AuthIds from Links
oteffahi Jun 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@

cargo-timing*.html

#ignore test data
testfiles
oteffahi marked this conversation as resolved.
Show resolved Hide resolved
ci/valgrind-check/*.log
113 changes: 113 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ validated_struct = "2.1.0"
vec_map = "0.8.2"
webpki-roots = "0.26.0"
winapi = { version = "0.3.9", features = ["iphlpapi"] }
x509-parser = "0.16.0"
z-serial = "0.2.3"
zenoh-ext = { version = "0.11.0-dev", path = "zenoh-ext" }
zenoh-shm = { version = "0.11.0-dev", path = "commons/zenoh-shm" }
Expand Down
4 changes: 4 additions & 0 deletions commons/zenoh-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ pub struct DownsamplingItemConf {
#[derive(Serialize, Debug, Deserialize, Clone)]
pub struct AclConfigRules {
pub interfaces: Option<Vec<String>>,
pub cert_common_names: Option<Vec<String>>,
pub usernames: Option<Vec<String>>,
pub key_exprs: Vec<String>,
pub actions: Vec<Action>,
pub flows: Option<Vec<InterceptorFlow>>,
Expand All @@ -126,6 +128,8 @@ pub struct PolicyRule {
#[serde(rename_all = "snake_case")]
pub enum Subject {
Interface(String),
CertCommonName(String),
Username(String),
}

#[derive(Clone, Copy, Debug, Serialize, Deserialize, Eq, Hash, PartialEq)]
Expand Down
3 changes: 3 additions & 0 deletions io/zenoh-link-commons/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ pub struct Link {
pub is_reliable: bool,
pub is_streamed: bool,
pub interfaces: Vec<String>,
pub auth_identifier: LinkAuthId,
}

#[async_trait]
Expand Down Expand Up @@ -78,6 +79,7 @@ impl From<&LinkUnicast> for Link {
is_reliable: link.is_reliable(),
is_streamed: link.is_streamed(),
interfaces: link.get_interface_names(),
auth_identifier: link.get_auth_identifier(),
}
}
}
Expand All @@ -98,6 +100,7 @@ impl From<&LinkMulticast> for Link {
is_reliable: link.is_reliable(),
is_streamed: false,
interfaces: vec![],
auth_identifier: LinkAuthId::default(),
}
}
}
Expand Down
70 changes: 70 additions & 0 deletions io/zenoh-link-commons/src/unicast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use core::{
use std::net::SocketAddr;

use async_trait::async_trait;
use serde::Serialize;
use zenoh_protocol::{
core::{EndPoint, Locator},
transport::BatchSize,
Expand Down Expand Up @@ -51,6 +52,7 @@ pub trait LinkUnicastTrait: Send + Sync {
fn is_reliable(&self) -> bool;
fn is_streamed(&self) -> bool;
fn get_interface_names(&self) -> Vec<String>;
fn get_auth_identifier(&self) -> LinkAuthId;
async fn write(&self, buffer: &[u8]) -> ZResult<usize>;
async fn write_all(&self, buffer: &[u8]) -> ZResult<()>;
async fn read(&self, buffer: &mut [u8]) -> ZResult<usize>;
Expand Down Expand Up @@ -118,3 +120,71 @@ pub fn get_ip_interface_names(addr: &SocketAddr) -> Vec<String> {
}
}
}

#[derive(Clone, Debug, Serialize, Hash, PartialEq, Eq)]
pub enum LinkAuthType {
Tls,
Quic,
None,
}

#[derive(Clone, Debug, Serialize, Hash, PartialEq, Eq)]
pub struct LinkAuthId {
auth_type: LinkAuthType,
auth_value: Option<String>,
}

impl LinkAuthId {
oteffahi marked this conversation as resolved.
Show resolved Hide resolved
pub fn get_type(&self) -> &LinkAuthType {
&self.auth_type
}
pub fn get_value(&self) -> &Option<String> {
&self.auth_value
}
}

impl Default for LinkAuthId {
oteffahi marked this conversation as resolved.
Show resolved Hide resolved
fn default() -> Self {
LinkAuthId {
auth_type: LinkAuthType::None,
auth_value: None,
}
}
}

#[derive(Debug)]
pub struct LinkAuthIdBuilder {
pub auth_type: LinkAuthType, // HAS to be provided when building
pub auth_value: Option<String>, // actual value added to the above type; is None for None type
}

impl Default for LinkAuthIdBuilder {
fn default() -> Self {
Self::new()
}
}

impl LinkAuthIdBuilder {
pub fn new() -> LinkAuthIdBuilder {
LinkAuthIdBuilder {
auth_type: LinkAuthType::None,
auth_value: None,
}
}

pub fn auth_type(&mut self, auth_type: LinkAuthType) -> &mut Self {
oteffahi marked this conversation as resolved.
Show resolved Hide resolved
self.auth_type = auth_type;
self
}
pub fn auth_value(&mut self, auth_value: Option<String>) -> &mut Self {
self.auth_value = auth_value;
self
}

pub fn build(&self) -> LinkAuthId {
LinkAuthId {
auth_type: self.auth_type.clone(),
auth_value: self.auth_value.clone(),
}
}
}
7 changes: 4 additions & 3 deletions io/zenoh-links/zenoh-link-quic/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ base64 = { workspace = true }
futures = { workspace = true }
quinn = { workspace = true }
rustls-native-certs = { workspace = true }
rustls-pki-types = { workspace = true }
rustls-pki-types = { workspace = true }
rustls-webpki = { workspace = true }
secrecy = { workspace = true }
tokio = { workspace = true, features = [
"fs",
"io-util",
"net",
"fs",
oteffahi marked this conversation as resolved.
Show resolved Hide resolved
"sync",
"time",
] }
Expand All @@ -54,5 +54,6 @@ zenoh-sync = { workspace = true }
zenoh-util = { workspace = true }
# Lock due to quinn not supporting rustls 0.22 yet
rustls = { version = "0.21", features = ["dangerous_configuration", "quic"] }
tokio-rustls = "0.24.1"
rustls-pemfile = { version = "1" }
tokio-rustls = "0.24.1"
Mallets marked this conversation as resolved.
Show resolved Hide resolved
x509-parser = { workspace = true }
Loading
Loading