-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: move all common sources + first packaging commit
Common sources are now in a separate crate. This has the advantage to avoid many "unused" warnings. Indeed as chsr uses some calls that sr don't use, it raise this warning. And as the same with sr. So many unused warnings were wrongly reported. I started to make deployment work, as sr and chsr seems to be well-tested and made some security checks. For now, deployment is WIP.
- Loading branch information
Showing
42 changed files
with
822 additions
and
406 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Deploy pkg to GitHub Packages | ||
|
||
## only triger manual | ||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
components: clippy | ||
override: true | ||
|
||
- name: Install Dependencies | ||
run: ./dependencies.sh -yd | ||
|
||
- name: Configure | ||
run: sudo ./configure.sh -yd | ||
|
||
- name: Install cargo deb | ||
run: cargo install cargo-deb | ||
|
||
- name: Build | ||
run: cargo deb | ||
|
||
- name: Upload to GitHub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[workspace] | ||
members = ["xtask", "capable", "capable-common"] | ||
members = ["xtask", "capable", "capable-common", "rar-common"] | ||
|
||
[package] | ||
name = "RootAsRole" | ||
|
@@ -9,11 +9,13 @@ rust-version = "1.74.1" | |
authors = ["Eddie Billoir <[email protected]>"] | ||
edition = "2021" | ||
default-run = "sr" | ||
description = "RootAsRole is an alternative to sudo that uses Linux capabilities and RBAC for scalability." | ||
license-file = "LICENSE" | ||
description = "An alternative to sudo that uses Linux capabilities and Role based access control." | ||
license = "GPL-3.0-or-later" | ||
repository = "https://github.com/LeChatP/RootAsRole" | ||
homepage = "https://lechatp.github.io/RootAsRole/" | ||
keywords = ["sudo", "capabilities", "rbac", "linux", "security"] | ||
categories = ["command-line-utilities", "os::linux-apis", "config"] | ||
exclude = ["sudoers-reader/*", "book/*"] | ||
|
||
[badges] | ||
maintainance ={ status = "actively-maintained", badge = "https://img.shields.io/badge/maintenance-actively%20maintained-brightgreen.svg" } | ||
|
@@ -46,12 +48,13 @@ serde_json = "1.0.116" | |
toml = "0.8.13" | ||
|
||
[dependencies] | ||
rar-common = { path = "rar-common" } | ||
tracing = "0.1.40" | ||
tracing-subscriber = "0.3.18" | ||
libc = "0.2.155" | ||
strum = { version = "0.26.2", features = ["derive"] } | ||
strum = { version = "0.26.3", features = ["derive"] } | ||
semver = { version = "1.0.23", features = ["serde"] } | ||
nix = { version = "0.28.0", features = ["user","process", "signal", "fs"] } | ||
nix = { version = "0.29.0", features = ["user","process", "signal", "fs"] } | ||
#sudoers-reader = { path = "sudoers-reader" } | ||
capctl = "0.2.4" | ||
pcre2 = "0.2.7" | ||
|
@@ -86,3 +89,44 @@ tracing-subscriber = { version = "0.3.16", default-features = false, features = | |
pest-test-gen = "0.1.7" | ||
pest-test = "0.1.6" | ||
lazy_static = "1.4.0" | ||
|
||
|
||
[package.metadata.deb] | ||
maintainer = "Eddie Billoir <[email protected]>" | ||
license-file = "LICENSE" | ||
depends = "libpam0g, e2fsprogs, libcap2-bin, libpam-modules, libpcre2-8-0" | ||
section = "admin" | ||
priority = "optional" | ||
assets = [ | ||
["target/release/sr", "usr/bin/sr", "0555"], | ||
["target/release/chsr", "usr/bin/chsr", "0555"], | ||
["resources/rootasrole.json", "usr/share/rootasrole/default.json", "0640"], | ||
["resources/debian/deb_sr_pam.conf", "usr/share/rootasrole/pam_sr.conf", "0644"] | ||
] | ||
conf-files = ["/etc/pam.d/sr"] | ||
maintainer-scripts = "resources/debian/" | ||
extended-description = "RootAsRole is a project to allow Linux/Unix administrators to delegate their administrative tasks access rights to multiple co-administrators through RBAC model and Linux Capabilities features." | ||
|
||
[package.metadata.generate-rpm] | ||
assets = [ | ||
{ source = "target/release/sr", target = "/usr/bin/sr", mode = "0555" }, | ||
{ source = "target/release/chsr", target = "/usr/bin/chsr", mode = "0555" }, | ||
{ source = "resources/rootasrole.json", target = "/etc/security/rootasrole.json", mode = "0640" } | ||
] | ||
|
||
[package.metadata.generate-rpm.requires] | ||
libcap = "*" | ||
e2fsprogs = "*" | ||
coreutils = "*" | ||
gawk = "*" | ||
sed = "*" | ||
|
||
[package.metadata.aur] | ||
depends = ["libcap", "e2fsprogs", "pcre2", "pam"] | ||
files = [ ["target/release/sr", "/usr/bin/sr"], | ||
["target/release/chsr", "/usr/bin/chsr"], | ||
["resources/arch_sr_pam.conf", "/usr/share/rootasrole/pam_sr.conf"], | ||
["resources/rootasrole.json", "/usr/share/rootasrole/default.json"], | ||
["resources/debian/postinst", "/usr/share/rootasrole/postinst" ] ] | ||
custom = [ "$pkgdir/usr/share/rootasrole/postinst" ] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#/bin/sh | ||
|
||
# This script build every package for Arch Linux, Debian, Fedora. | ||
|
||
cargo build --release --bin sr --bin chsr || exit 1 | ||
|
||
# Arch Linux | ||
if [ -z "$ARCH" ]; then | ||
ARCH=$(uname -m) | ||
fi | ||
PKGEXT=.pkg.tar.zst | ||
|
||
|
||
mkdir -p target/arch/usr/bin | ||
mkdir -p target/arch/etc/pam.d | ||
mkdir -p target/arch/usr/share/rootasrole | ||
cp target/release/sr target/release/chsr target/arch/usr/bin | ||
cp resources/rootasrole.json target/arch/usr/share/rootasrole/default.json | ||
cp resources/arch/arch_sr_pam.conf target/arch/etc/pam.d/sr | ||
cp resources/arch/PKGBUILD resources/arch/rootasrole.install target/arch | ||
|
||
sed -i "s/%ARCH%/$ARCH/g" target/arch/PKGBUILD | ||
|
||
cd target/arch | ||
|
||
makepkg -f -p PKGBUILD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
[package] | ||
name = "rar-common" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
tracing = "0.1.40" | ||
tracing-subscriber = "0.3.18" | ||
libc = "0.2.155" | ||
strum = { version = "0.26.3", features = ["derive"] } | ||
semver = { version = "1.0.23", features = ["serde"] } | ||
nix = { version = "0.29.0", features = ["user","process", "signal", "fs"] } | ||
#sudoers-reader = { path = "sudoers-reader" } | ||
capctl = "0.2.4" | ||
pcre2 = "0.2.7" | ||
serde = { version = "1.0.202", features=["rc"] } | ||
serde_json = "1.0.117" | ||
ciborium = "0.2.2" | ||
glob = "0.3.1" | ||
pam-client = { version = "0.5.0", git = "https://gitlab.com/LeChatP/rust-pam-client.git" } | ||
pam-sys = "1.0.0-alpha5" | ||
bitflags = { version = "2.5.0" } | ||
shell-words = "1.1.0" | ||
syslog-tracing = "0.3.0" | ||
linked_hash_set = { version = "0.1.4" } | ||
derivative = "2.2.0" | ||
sha2 = "0.10.8" | ||
sha1 = "0.10.6" | ||
md5 = "0.7.0" | ||
chrono = "0.4.37" | ||
pty-process = "0.4.0" | ||
once_cell = "1.19.0" | ||
pest = "2.7.8" | ||
pest_derive = "2.7.8" | ||
phf = { version = "0.11.2", features = ["macros"] } | ||
const_format = "0.2.32" | ||
hex = "0.4.3" | ||
|
||
[dev-dependencies] | ||
env_logger = "*" | ||
test-log = { version = "0.2.12", features = ["trace"] } | ||
tracing = "0.1.37" | ||
tracing-subscriber = { version = "0.3.16", default-features = false, features = ["env-filter", "fmt"] } | ||
pest-test-gen = "0.1.7" | ||
pest-test = "0.1.6" | ||
lazy_static = "1.4.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.