Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
4198865
bump version to 3.0.5 across all relevant files
LeChatP Jan 17, 2025
36466e9
Refactor serialization and deserialization of SCapabilities; remove u…
LeChatP Jan 17, 2025
5308938
Add conditional compilation for tests under 'finder' feature
LeChatP Jan 17, 2025
08e1660
Add unit test for deserialization of SConfig with alias handling
LeChatP Jan 17, 2025
905fde7
Add bon dependency and refactor code to use Builder pattern for structs
LeChatP Feb 2, 2025
c10b4c3
Add --preserve-env
LeChatP Feb 2, 2025
3ca0fe2
Refactor user credential handling to use SUserChooser for setuid and …
Feb 3, 2025
b318114
Merge remote-tracking branch 'upstream/dev'
Feb 3, 2025
4f11e69
feat: add -u option
Feb 3, 2025
ce34338
Add 'dev' branch support to GitHub workflows for pull requests
LeChatP Feb 3, 2025
e18bc0b
feat: refactor actor handling
LeChatP Feb 7, 2025
1983ac0
feat: add sorted-vec dependency and clean up unused user fields in CL…
Feb 8, 2025
920faf1
new
Feb 8, 2025
1770471
feat: add fetch_eq method for SUserType and update user comparison logic
LeChatP Feb 10, 2025
b3369d1
cargo fmt
Feb 10, 2025
8f1dbd2
Update Cargo.toml
LeChatP Feb 10, 2025
300a6c2
Fix Regression
LeChatP Feb 10, 2025
c5e34f9
Enhance test is_root
LeChatP Feb 10, 2025
3d7546b
feat: replace getuid with get_non_root_uid for fallback user in setui…
LeChatP Feb 10, 2025
f7cecd1
refactor: reorganize imports and define FilterMatcher struct in datab…
LeChatP Feb 10, 2025
1f4cf4f
refactor: remove redundant FilterMatcher struct definition from finde…
LeChatP Feb 10, 2025
659044c
cargo clippy
Feb 12, 2025
a107d99
wip
Feb 12, 2025
4706b4c
refactor: update SConfig, SRole, and STask structs to use Option<Rc<R…
LeChatP Feb 12, 2025
5aa4b5b
refactor: remove unused wrapper module and update override_behavior t…
LeChatP Feb 12, 2025
397baa5
Merge pull request #64 from hocineait7/main
LeChatP Feb 12, 2025
8a31465
Format Rust code using rustfmt
github-actions[bot] Feb 12, 2025
7a66d70
add unit tests for SUserType and SGroupType
Feb 18, 2025
af85575
Merge branch 'dev' into main
LeChatP Feb 18, 2025
f4fd365
refactor: consolidate serialization and deserialization logic for pat…
LeChatP Feb 18, 2025
cd59598
refactor: update serialization and deserialization for LinkedHashSet …
LeChatP Feb 18, 2025
393107d
fix tests on generic machine
LeChatP Feb 18, 2025
55b2ec5
Merge pull request #66 from hocineait7/main
LeChatP Feb 18, 2025
31f3ef1
doc: update Docs and default config
LeChatP Feb 18, 2025
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
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
pull_request:
branches:
- 'main'
- 'dev'
jobs:
build:
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ on:
pull_request:
branches:
- 'main'
- 'dev'

jobs:

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
pull_request:
branches:
- 'main'
- 'dev'

jobs:
rust-coverage:
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ members = ["xtask", "rar-common"]
[package]
name = "rootasrole"
# The project version is managed on json file in resources/rootasrole.json
version = "3.0.4"
version = "3.0.5"
rust-version = "1.76.0"
authors = ["Eddie Billoir <[email protected]>"]
edition = "2021"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<!-- The project version is managed on json file in resources/rootasrole.json -->
<!-- markdownlint-restore -->

# RootAsRole (V3.0.4) : A memory-safe and security-oriented alternative to sudo/su commands
# RootAsRole (V3.0.5) : A memory-safe and security-oriented alternative to sudo/su commands

**RootAsRole** is a project to allow Linux/Unix administrators to delegate their administrative tasks access rights to users. Its main features are :

Expand Down
7 changes: 6 additions & 1 deletion book/src/chsr/file-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,12 @@ The following example shows a RootAsRole config without plugins when almost ever
"name": "t_complete", // Task name, must be unique in the role
"purpose": "complete", // Task purpose, just a description
"cred": {
"setuid": "user1", // User to setuid before executing the command
"setuid": {
"fallback": "thefallbackuser", // Fallback user if the -u option is not set
"default": "none", // The sr user cannot use -u option in general
"add": ["theuser"], // the sr user can use "-u theuser" option
"sub": ["anotheruser"] // the sr user cannot use "-u anotheruser" option (overrides add, applies only if default is all)
}, // User to setuid before executing the command
"setgid": [ // Groups to setgid before executing the command, The first one is the primary group
"group1",
"group2"
Expand Down
2 changes: 2 additions & 0 deletions book/src/sr/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
<u><b>Options</b></u>:
<b>-r, --role</b> &lt;ROLE&gt; Role to select
<b>-t, --task</b> &lt;TASK&gt; Task to select (--role required)
<b>-u, --user</b> &lt;USER&gt; Specify the user to execute the command as
<b>-E, --preserve-env</b> Preserve environment variables
<b>-p, --prompt</b> &lt;PROMPT&gt; Prompt to display
<b>-i, --info</b> Display rights of executor
<b>-h, --help</b> Print help (see more with '--help')
Expand Down
3 changes: 2 additions & 1 deletion rar-common/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rootasrole-core"
version = "3.0.4"
version = "3.0.5"
edition = "2021"
description = "This core crate contains the RBAC and main features for the RootAsRole project."
license = "GPL-3.0-or-later"
Expand All @@ -26,6 +26,7 @@ hex = "0.4"
log = "0.4"
syslog = "7.0"
env_logger = "0.11"
bon = { version = "3.3.2", features = ["experimental-overwritable"] }

[dev-dependencies]
log = "0.4"
Expand Down
14 changes: 9 additions & 5 deletions rar-common/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@
use strum::EnumIs;

#[cfg(feature = "finder")]
use crate::database::finder::{Cred, ExecSettings, FilterMatcher, TaskMatch, UserMin};
use crate::database::finder::{ActorMatchMin, Cred, ExecSettings, TaskMatch};
use crate::database::FilterMatcher;

use crate::database::structs::{SActor, SConfig, SRole, STask};
use crate::database::{
actor::SActor,
structs::{SConfig, SRole, STask},
};
use once_cell::sync::Lazy;
static API: Lazy<Mutex<PluginManager>> = Lazy::new(|| Mutex::new(PluginManager::new()));

Expand Down Expand Up @@ -52,7 +56,7 @@
matcher: &mut TaskMatch,
) -> PluginResultAction;
#[cfg(feature = "finder")]
pub type UserMatcher = fn(role: &SRole, user: &Cred, user_struct: &Value) -> UserMin;
pub type UserMatcher = fn(role: &SRole, user: &Cred, user_struct: &Value) -> ActorMatchMin;

pub type RoleInformation = fn(role: &SRole) -> Option<String>;
pub type ActorInformation = fn(actor: &SActor) -> Option<String>;
Expand Down Expand Up @@ -200,15 +204,15 @@
}

#[cfg(feature = "finder")]
pub fn notify_user_matcher(role: &SRole, user: &Cred, user_struct: &Value) -> UserMin {
pub fn notify_user_matcher(role: &SRole, user: &Cred, user_struct: &Value) -> ActorMatchMin {

Check warning on line 207 in rar-common/src/api.rs

View check run for this annotation

Codecov / codecov/patch

rar-common/src/api.rs#L207

Added line #L207 was not covered by tests
let api = API.lock().unwrap();
for plugin in api.user_matcher_plugins.iter() {
let res = plugin(role, user, user_struct);
if !res.is_no_match() {
return res;
}
}
UserMin::NoMatch
ActorMatchMin::NoMatch

Check warning on line 215 in rar-common/src/api.rs

View check run for this annotation

Codecov / codecov/patch

rar-common/src/api.rs#L215

Added line #L215 was not covered by tests
}

#[cfg(feature = "finder")]
Expand Down
Loading
Loading