Skip to content

Commit 5f021a3

Browse files
committed
New package: sudo-rs-0.2.13
1 parent 9cdb038 commit 5f021a3

5 files changed

Lines changed: 139 additions & 0 deletions

File tree

srcpkgs/sudo-rs/INSTALL

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#
2+
# This script sets up correct perms for /etc/sudoers.
3+
#
4+
case "${ACTION}" in
5+
post)
6+
if [ -f etc/sudoers ]; then
7+
echo "Setting up permissions to /etc/sudoers..."
8+
chmod 0440 etc/sudoers
9+
fi
10+
[ ! -d etc/sudoers.d ] && install -d etc/sudoers.d
11+
[ ! -d var/db/sudo ] && install -dm750 var/db/sudo
12+
;;
13+
esac

srcpkgs/sudo-rs/REMOVE

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#
2+
# This script fragment removes etc/sudoers.d at post remove time
3+
# and only if it's empty.
4+
#
5+
case "${ACTION}" in
6+
post)
7+
[ -d etc/sudoers.d ] && rmdir etc/sudoers.d 2>/dev/null
8+
;;
9+
purge)
10+
[ -d var/db/sudo ] && rm -rf var/db/sudo
11+
;;
12+
esac

srcpkgs/sudo-rs/files/sudo.pam

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#%PAM-1.0
2+
auth include system-auth
3+
account include system-auth
4+
session include system-auth
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
## sudoers file.
2+
##
3+
## This file SHOULD be edited with the 'visudo' command as root.
4+
## Failure to use 'visudo' may result in syntax or file permission errors
5+
## that prevent sudo from running.
6+
##
7+
## See the sudoers man page for the details on how to write a sudoers file.
8+
9+
## Defaults specification
10+
##
11+
## Preserve editor environment variables for visudo.
12+
## To preserve these for all commands, remove the "!visudo" qualifier.
13+
Defaults!/usr/sbin/visudo env_keep += "SUDO_EDITOR EDITOR VISUAL"
14+
##
15+
## Use a hard-coded PATH instead of the user's to find commands.
16+
## This also helps prevent poorly written scripts from running
17+
## arbitrary commands under sudo.
18+
Defaults secure_path="/usr/sbin:/usr/bin:/usr/sbin:/usr/bin:/sbin:/bin"
19+
##
20+
## Uncomment this to allow commands run by sudo to see the
21+
## environment variables set by sshd(8).
22+
# Defaults env_keep += "SSH_*"
23+
##
24+
## Uncomment to disable "use_pty" when running commands as root.
25+
## Commands run as non-root users will run in a pseudo-terminal,
26+
## not the user's own terminal, to prevent command injection.
27+
# Defaults>root !use_pty
28+
##
29+
## Uncomment if the historical silent password prompt is desired
30+
# Defaults !pwfeedback
31+
32+
### User privilege specifications
33+
34+
## Allow root to execute any command
35+
root ALL=(ALL:ALL) ALL
36+
37+
## Allow members of group wheel to execute any command
38+
# %wheel ALL=(ALL:ALL) ALL
39+
40+
## Same thing without a password
41+
# %wheel ALL=(ALL:ALL) NOPASSWD: ALL
42+
43+
## Allow members of group sudo to execute any command
44+
# %sudo ALL=(ALL:ALL) ALL
45+
46+
## Read drop-in files from /etc/sudoers.d
47+
@includedir /etc/sudoers.d

srcpkgs/sudo-rs/template

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Template file for 'sudo-rs'
2+
pkgname=sudo-rs
3+
version=0.2.13
4+
revision=1
5+
build_style=cargo
6+
make_build_args="--bin sudo --bin visudo --features gettext"
7+
make_install_args="--path . --bin sudo --bin visudo --features gettext"
8+
hostmakedepends="gettext pkg-config"
9+
makedepends="pam-devel"
10+
short_desc="Memory-safe implementation of sudo"
11+
maintainer="Nafis <mnabid.25@outlook.com>"
12+
license="Apache-2.0 OR MIT"
13+
homepage="https://github.com/trifectatechfoundation/sudo-rs"
14+
distfiles="${homepage}/archive/refs/tags/v${version}.tar.gz"
15+
checksum=79becefc504d14ffccc7cab18d42f8d892e78b2d13d9c5bb887c5f02a2721eaf
16+
conf_files="/etc/pam.d/sudo /etc/sudoers"
17+
conflicts="sudo"
18+
replaces="sudo>=0"
19+
20+
make_check=no # tests fail in chroot
21+
22+
# Failed tests:
23+
# common::context::tests::test_build_run_context
24+
# common::resolve::test::canonicalization
25+
# su::context::tests::invalid_shell
26+
# sudo::env::environment::tests::test_tzinfo
27+
# system::audit::test::secure_open_is_predictable
28+
# system::audit::test::test_traverse_secure_open_negative
29+
# system::audit::test::test_traverse_secure_open_positive
30+
# system::interface::test::test_unix_user
31+
# system::tests::test_get_user_and_group_by_id
32+
33+
post_install() {
34+
# Install man pages
35+
vman docs/man/sudo.8.man sudo.8
36+
vman docs/man/sudoers.5.man sudoers.5
37+
vman docs/man/visudo.8.man visudo.8
38+
39+
# Install sudoers and PAM config
40+
vinstall ${FILESDIR}/sudoers.example 440 etc sudoers
41+
vinstall ${FILESDIR}/sudoers.example 664 usr/share/examples/sudo-rs
42+
vinstall ${FILESDIR}/sudo.pam 644 etc/pam.d sudo
43+
44+
# Set setuid permission on sudo binary
45+
chmod 4755 ${DESTDIR}/usr/bin/sudo
46+
47+
# Create sudoedit symlink pointing to sudo
48+
ln -s sudo ${DESTDIR}/usr/bin/sudoedit
49+
ln -s sudo.8 ${DESTDIR}/usr/share/man/man8/sudoedit.8
50+
51+
# Install translations
52+
for po in po/*.po; do
53+
if [ -f "${po}" ]; then
54+
lang=$(basename "${po}" .po)
55+
dir="${DESTDIR}/usr/share/locale/${lang}/LC_MESSAGES"
56+
install -d "${dir}"
57+
msgfmt -o "${dir}/sudo-rs.mo" "${po}"
58+
fi
59+
done
60+
61+
vlicense LICENSE-APACHE
62+
vlicense LICENSE-MIT
63+
}

0 commit comments

Comments
 (0)