Skip to content

Commit b8dfc9d

Browse files
(userd) Replace C++ userd with Rust implementation
- Add userd-rs crate with full user management functionality - Remove C++ userd implementation (userd/ directory) - Add userd binary to sonic-host-services-rs package - Add userd.service to sonic-host-services-data package Features: - User CRUD operations (create, update, delete) - Role-based access control (administrator, operator) - SSH key management with validation - Security policies and PAM faillock configuration - Consistency checking on startup - CONFIG_DB monitoring via SubscriberStateTable The Rust implementation is a drop-in replacement for the C++ version, producing the same 'userd' binary installed to /usr/local/bin/userd. Signed-off-by: Manoharan Sundaramoorthy <manoharan@nexthop.ai>
1 parent 5251666 commit b8dfc9d

58 files changed

Lines changed: 5937 additions & 1365 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Cargo.lock

Lines changed: 335 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
resolver = '2'
33
members = [
44
"crates/procdockerstatsd-rs",
5+
"crates/userd-rs",
56
]
67
exclude = []
78

@@ -23,7 +24,7 @@ unused_import_braces = 'warn'
2324
[workspace.dependencies]
2425
# System info and SONiC database
2526
sysinfo = "0.35.0"
26-
swss-common = { git = "https://github.com/sonic-net/sonic-swss-common", branch = "master" }
27+
swss-common = { git = "https://github.com/sonic-net/sonic-swss-common", branch = "master", features = ["async"] }
2728

2829
# Regex and pattern matching
2930
regex = "1.10"
@@ -50,4 +51,20 @@ syslog-tracing = "0.3"
5051

5152
# Serialization
5253
serde = { version = "1.0", features = ["derive"] }
53-
serde_json = "1.0"
54+
serde_json = "1.0"
55+
56+
# Error handling
57+
thiserror = "1.0"
58+
59+
# Unix/POSIX system calls
60+
nix = { version = "0.29", features = ["user", "fs"] }
61+
62+
# Async runtime and signal handling
63+
tokio = { version = "1", features = ["rt-multi-thread", "signal", "macros", "time"] }
64+
65+
# Testing
66+
mockall = "0.13"
67+
tempfile = "3.10"
68+
69+
# Static initialization
70+
lazy_static = "1.4"

crates/userd-rs/Cargo.toml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
[package]
2+
name = "userd_rs"
3+
version.workspace = true
4+
edition.workspace = true
5+
description = "SONiC User Management Daemon in Rust"
6+
license.workspace = true
7+
authors.workspace = true
8+
9+
[dependencies]
10+
swss-common.workspace = true
11+
serde.workspace = true
12+
serde_json.workspace = true
13+
tracing.workspace = true
14+
tracing-subscriber.workspace = true
15+
syslog-tracing.workspace = true
16+
libc.workspace = true
17+
thiserror.workspace = true
18+
nix.workspace = true
19+
tokio.workspace = true
20+
tempfile.workspace = true
21+
lazy_static.workspace = true
22+
23+
[dev-dependencies]
24+
mockall.workspace = true
25+
26+
[[bin]]
27+
name = "userd"
28+
path = "src/main.rs"
29+
30+
[lib]
31+
name = "userd_rs"
32+
path = "src/lib.rs"
33+

0 commit comments

Comments
 (0)