diff --git a/packages/linux-pam/pam.d/run-as b/packages/linux-pam/pam.d/run-as new file mode 100644 index 0000000..685a3eb --- /dev/null +++ b/packages/linux-pam/pam.d/run-as @@ -0,0 +1,7 @@ +# SemiOS PAM service config for un-as operations, +# like sudo. + +auth required pam_semios.so +account required pam_semios.so +password required pam_permit.so +session required pam_permit.so diff --git a/packages/linux-pam/pkgbuild.py b/packages/linux-pam/pkgbuild.py index 1334a10..8bdc684 100644 --- a/packages/linux-pam/pkgbuild.py +++ b/packages/linux-pam/pkgbuild.py @@ -5,7 +5,7 @@ from lib import arch, cpp from lib.make import * -version("1.7.2") +version("1.7.2+1") description("Linux PAM (Pluggable Authentication Modules for Linux) project") maintainer("sisungo ") source_url("https://github.com/linux-pam/linux-pam/releases/download/v1.7.2/Linux-PAM-1.7.2.tar.xz") diff --git a/packages/sudo-rs/config/sudoers b/packages/sudo-rs/config/sudoers new file mode 100644 index 0000000..c3fe11d --- /dev/null +++ b/packages/sudo-rs/config/sudoers @@ -0,0 +1,38 @@ +## sudoers file. +## +## This file SHOULD be edited with the 'visudo' command as root. +## Failure to use 'visudo' may result in syntax or file permission errors +## that prevent sudo from running. +## +## See the sudoers man page for the details on how to write a sudoers file. + +## Defaults specification +## +## Preserve editor environment variables for visudo. +## To preserve these for all commands, remove the "!visudo" qualifier. +Defaults!/bin/visudo env_keep += "SUDO_EDITOR EDITOR VISUAL" +## +## Use a hard-coded PATH instead of the user's to find commands. +## This also helps prevent poorly written scripts from running +## arbitrary commands under sudo. +Defaults secure_path="/bin" +## +## Uncomment this to allow commands run by sudo to see the +## environment variables set by sshd(8). +# Defaults env_keep += "SSH_*" +## +## Uncomment to disable "use_pty" when running commands as root. +## Commands run as non-root users will run in a pseudo-terminal, +## not the user's own terminal, to prevent command injection. +# Defaults>root !use_pty +## +## Uncomment if the historical silent password prompt is desired +# Defaults !pwfeedback + +### User privilege specifications + +## Allow root to execute any command +root ALL=(ALL:ALL) ALL + +## Allow members of group wheel to execute any command +%wheel ALL=(ALL:ALL) ALL diff --git a/packages/sudo-rs/patches/0010-sudoers-path.patch b/packages/sudo-rs/patches/0010-sudoers-path.patch new file mode 100644 index 0000000..1781d7c --- /dev/null +++ b/packages/sudo-rs/patches/0010-sudoers-path.patch @@ -0,0 +1,26 @@ +--- a/src/sudo/mod.rs ++++ b/src/sudo/mod.rs +50,61c50,59 +< let mut path = if cfg!(target_os = "freebsd") { +< option_env!("LOCALBASE").unwrap_or("/usr/local").into() +< } else { +< PathBuf::from("/") +< }; +< path.push("etc/sudoers-rs"); +< if !path.exists() { +< path.set_file_name("sudoers"); +< }; +< +< dev_info!("Running with {} file", path.display()); +< path +--- +> let user = PathBuf::from("/var/config/sudo/sudoers"); +> if !user.exists() { +> if let Ok(mut path) = std::env::current_exe() { +> path.pop(); +> path.pop(); +> path.push("share/config/sudoers"); +> return path; +> } +> } +> user diff --git a/packages/sudo-rs/patches/0020-pam-service-name.patch b/packages/sudo-rs/patches/0020-pam-service-name.patch new file mode 100644 index 0000000..b24f9a9 --- /dev/null +++ b/packages/sudo-rs/patches/0020-pam-service-name.patch @@ -0,0 +1,8 @@ +--- a/src/sudo/pam.rs ++++ b/src/sudo/pam.rs +42,43c42,43 +< LaunchType::Login if cfg!(feature = "pam-login") => "sudo-i", +< LaunchType::Login | LaunchType::Shell | LaunchType::Direct => "sudo", +--- +> LaunchType::Login if cfg!(feature = "pam-login") => "run-as", +> LaunchType::Login | LaunchType::Shell | LaunchType::Direct => "run-as", diff --git a/packages/sudo-rs/patches/0030-wheel-group.patch b/packages/sudo-rs/patches/0030-wheel-group.patch new file mode 100644 index 0000000..ffa53c8 --- /dev/null +++ b/packages/sudo-rs/patches/0030-wheel-group.patch @@ -0,0 +1,11 @@ +--- a/src/common/resolve.rs ++++ b/src/common/resolve.rs +@@ -144,7 +144,7 @@ + // when no -u or -g is specified, default to root:root + (None, None) => { + target_user = User::from_name(c"root")?; +- target_group = Group::from_name(if cfg!(target_os = "linux") { ++ target_group = Group::from_name(if false { + c"root" + } else { + c"wheel" diff --git a/packages/sudo-rs/pkgbuild.py b/packages/sudo-rs/pkgbuild.py new file mode 100644 index 0000000..b0ea9d4 --- /dev/null +++ b/packages/sudo-rs/pkgbuild.py @@ -0,0 +1,35 @@ +import os + +import lib.rust as rust +from lib.make import * + + +version("0.2.15") +description("A memory safe implementation of sudo.") +maintainer("sisungo ") +source_managed("github://trifectatechfoundation/sudo-rs#v0.2.15", "rust") + +builddep("shortcut/rust") +builddep("libpam-dev @target") + + +def build(): + rust.build() + +on_build(build) + + +configdir = os.getcwd() + "/config" + +def pack(composer): + os.chdir(rust.artifacts_dir()) + composer.makedir("bin") + composer.add("sudo", "bin/sudo") + composer.add("visudo", "bin/visudo") + composer.makedir("share") + composer.add(configdir, "share/config") + +package("sudo") +dep("semi-libc @same-arch") +dep("libpam @same-arch") +on_pack(pack)