Skip to content

Commit b57be94

Browse files
authored
Release 0.2.7 (#1155)
1 parent 5c06a13 commit b57be94

File tree

12 files changed

+81
-21
lines changed

12 files changed

+81
-21
lines changed

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
11
# Changelog
22

3+
## [0.2.7] - 2025-07-01
4+
5+
### Added
6+
- Linux kernels older than 5.9 are now supported.
7+
- Support for `Defaults noexec`/`NOEXEC:` on Linux systems based on seccomp
8+
filtering to prevent shell escapes in wide range of cases. This should also
9+
work on programs not written in C and statically linked executables.
10+
- Support for `passwd_timeout`
11+
- Support for `umask` and `umask_override`
12+
- `--preserve-env=VAR` is now supported to preserve selected environment
13+
variables in a more convenient way
14+
15+
### Changed
16+
- sudo-rs now uses CLOEXEC to close open file descriptors in the child process
17+
- Relative paths like `./` in `secure_path`/`PATH` are now ignored.
18+
- `apparmor.so` is dynamically loaded by sudo itself, as-needed
19+
20+
### Fixed
21+
- Usernames that start with `_` or have non-western characters were not supported
22+
as a valid username in /etc/sudoers (#1149)
23+
- Other usability improvements in /etc/sudoers (#1117, #1126, #1134, #1157)
24+
325
## [0.2.6] - 2025-05-06
426

527
### Added

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "sudo-rs"
33
description = "A memory safe implementation of sudo and su."
4-
version = "0.2.6"
4+
version = "0.2.7"
55
license = "Apache-2.0 OR MIT"
66
edition = "2021"
77
repository = "https://github.com/trifectatechfoundation/sudo-rs"

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ We currently only offer these for x86-64 systems.
5151
We recommend installing sudo-rs and su-s in your `/usr/local` hierarchy so it can co-exist with
5252
your existing sudo installation. You can achieve this using the commands:
5353
```sh
54-
sudo tar -C /usr/local -xvf sudo-0.2.6.tar.gz
54+
sudo tar -C /usr/local -xvf sudo-0.2.7.tar.gz
5555
```
5656
and for su-rs:
5757
```sh
58-
sudo tar -C /usr/local -xvf su-0.2.6.tar.gz
58+
sudo tar -C /usr/local -xvf su-0.2.7.tar.gz
5959
```
6060
This will install sudo-rs and su-rs in `/usr/local/bin` using the usual commands `sudo` and `su`; it
6161
will also install our version of `visudo` in that location.

docs/man/su.1.man

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.\" Automatically generated by Pandoc 3.6.3
22
.\"
3-
.TH "SU" "1" "" "sudo\-rs 0.2.6" "sudo\-rs"
3+
.TH "SU" "1" "" "sudo\-rs 0.2.7" "sudo\-rs"
44
.SH NAME
55
\f[CR]su\f[R] \- run a shell or command as another user
66
.SH SYNOPSIS

docs/man/su.1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: SU(1) sudo-rs 0.2.6 | sudo-rs
2+
title: SU(1) sudo-rs 0.2.7 | sudo-rs
33
---
44

55
# NAME

docs/man/sudo.8.man

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.\" Automatically generated by Pandoc 3.6.3
22
.\"
3-
.TH "SUDO" "8" "" "sudo\-rs 0.2.6" "sudo\-rs"
3+
.TH "SUDO" "8" "" "sudo\-rs 0.2.7" "sudo\-rs"
44
.SH NAME
55
\f[CR]sudo\f[R] \- execute a command as another user
66
.SH SYNOPSIS
@@ -108,8 +108,8 @@ The following percent (`%') escape sequences are supported:
108108
.PP
109109
The custom prompt will override the default prompt or the one specified
110110
by the SUDO_PROMPT environment variable.
111-
No \f[I]prompt\f[R] will suppress the the prompt provided by PAM, unless
112-
the requested \f[I]prompt\f[R] is empty (\f[CR]\[dq]\[dq]\f[R])
111+
No \f[I]prompt\f[R] will suppress the prompt provided by PAM, unless the
112+
requested \f[I]prompt\f[R] is empty (\f[CR]\[dq]\[dq]\f[R])
113113
.RE
114114
.TP
115115
\f[CR]\-S\f[R], \f[CR]\-\-stdin\f[R]

docs/man/sudo.8.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: SUDO(8) sudo-rs 0.2.6 | sudo-rs
2+
title: SUDO(8) sudo-rs 0.2.7 | sudo-rs
33
---
44

55
# NAME

docs/man/sudoers.5.man

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,9 @@ parameters.
366366
367367
Chdir_Spec ::= \[aq]CWD=directory\[aq]
368368
369-
Tag_Spec ::= (\[aq]PASSWD:\[aq] | \[aq]NOPASSWD:\[aq] | \[aq]SETENV:\[aq] | \[aq]NOSETENV:\[aq])
369+
Tag_Spec ::= (\[aq]PASSWD:\[aq] | \[aq]NOPASSWD:\[aq] |
370+
\[aq]SETENV:\[aq] | \[aq]NOSETENV:\[aq]
371+
\[aq]EXEC:\[aq] | \[aq]NOEXEC\[aq])
370372
371373
AppArmor_Spec ::= \[aq]APPARMOR_PROFILE=profile\[aq]
372374
.EE
@@ -493,6 +495,19 @@ NOSETENV.
493495
Once a tag is set on a Cmnd, subsequent Cmnds in the Cmnd_Spec_List,
494496
inherit the tag unless it is overridden by the opposite tag (in other
495497
words, PASSWD overrides NOPASSWD and NOSETENV overrides SETENV).
498+
.SS EXEC and NOEXEC
499+
On Linux systems, the NOEXEC tag can be used to prevent an executable
500+
from running further commands itself.
501+
.PP
502+
In the following example, user aaron may run /usr/bin/more and
503+
/usr/bin/vi but shell escapes will be disabled.
504+
.IP
505+
.EX
506+
aaron shanty = NOEXEC: /usr/bin/more, /usr/bin/vi
507+
.EE
508+
.PP
509+
See the Preventing shell escapes section below for more details on how
510+
NOEXEC works and whether or not it suits your purpose.
496511
.SS PASSWD and NOPASSWD
497512
By default, sudo requires that a user authenticate before running a
498513
command.
@@ -697,6 +712,16 @@ A list of all supported Defaults parameters, grouped by type, are listed
697712
below.
698713
.SS Boolean Flags:
699714
.IP \[bu] 2
715+
noexec
716+
.RS 2
717+
.PP
718+
If set, all commands run via sudo will behave as if the NOEXEC tag has
719+
been set, unless overridden by an EXEC tag.
720+
See the description of EXEC and NOEXEC as well as the Preventing shell
721+
escapes section at the end of this manual.
722+
This flag is off by default.
723+
.RE
724+
.IP \[bu] 2
700725
env_editor
701726
.RS 2
702727
.PP
@@ -937,10 +962,23 @@ Common programs that permit shell escapes include shells (obviously),
937962
editors, paginators (such as \f[I]less\f[R]), mail, and terminal
938963
programs.
939964
.PP
940-
sudo\-rs currently doesn\[cq]t offer Todd Miller\[cq]s sudo\[cq]s
941-
protection mechanisms; i.e.\ be very careful that when a user is not
942-
supposed to receive shell access, that the commands that they have
943-
access to does not allow escaping to the shell.
965+
On Linux, sudo\-rs has sudo\[cq]s \f[B]noexec* functionality, based on a
966+
seccomp() filter.
967+
Programs that are run in \f[R]noexec** mode cannot run other programs.
968+
The implementation in sudo\-rs is different than in Todd Miller\[cq]s
969+
sudo, and should also work on statically linked binaries.
970+
.PP
971+
Note that restricting shell escapes is not a panacea.
972+
Programs running as root are still capable of many potentially hazardous
973+
operations (such as changing or overwriting files) that could lead to
974+
unintended privilege escalation.
975+
NOEXEC is also not a protection against malicious programs.
976+
It doesn\[cq]t prevent mapping memory as executable, nor does it protect
977+
against future syscalls that can do an exec() like the proposed
978+
\f[CR]io_uring\f[R] exec feature in Linux.
979+
And it also doesn\[cq]t protect against honest programs that
980+
intentionally or not allow the user to write to /proc/self/mem for the
981+
same reasons as that it doesn\[cq]t protect against malicious programs.
944982
.SS Timestamp file checks
945983
sudo\-rs will check the ownership of its timestamp directory
946984
(/run/sudo/ts by default) and ignore the directory\[cq]s contents if it

docs/man/visudo.8.man

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.\" Automatically generated by Pandoc 3.6.3
22
.\"
3-
.TH "VISUDO" "8" "" "sudo\-rs 0.2.6" "sudo\-rs"
3+
.TH "VISUDO" "8" "" "sudo\-rs 0.2.7" "sudo\-rs"
44
.SH NAME
55
\f[CR]visudo\f[R] \- safely edit the sudoers file
66
.SH SYNOPSIS

docs/man/visudo.8.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: VISUDO(8) sudo-rs 0.2.6 | sudo-rs
2+
title: VISUDO(8) sudo-rs 0.2.7 | sudo-rs
33
---
44

55
# NAME

util/build-release.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ DATE=$(grep -m1 '^##' "$PROJECT_DIR"/CHANGELOG.md | grep -o '[0-9]\{4\}-[0-9]\{2
1414
# Build binaries
1515
docker build --pull --tag "$BUILDER_IMAGE_TAG" --file "$SCRIPT_DIR/Dockerfile-release" "$SCRIPT_DIR"
1616
docker run --rm --user "$(id -u):$(id -g)" -v "$PROJECT_DIR:/build" -w "/build" "$BUILDER_IMAGE_TAG" cargo clean
17-
docker run --rm --user "$(id -u):$(id -g)" -v "$PROJECT_DIR:/build" -w "/build" "$BUILDER_IMAGE_TAG" cargo build --release --features pam-login
17+
docker run --rm --user "$(id -u):$(id -g)" -v "$PROJECT_DIR:/build" -w "/build" "$BUILDER_IMAGE_TAG" cargo build --release --features pam-login,apparmor
1818

1919
# Generate man pages
2020
"$PROJECT_DIR/util/generate-docs.sh"
@@ -64,7 +64,7 @@ EOF
6464
mkdir -p "$target_dir_su/bin"
6565
mkdir -p "$target_dir_su/share/man/man1"
6666
cp "$PROJECT_DIR/target/release/su" "$target_dir_su/bin/su"
67-
cp "$PROJECT_DIR/target/docs/man/su.1" "$target_dir_su/share/man/man1/su.1"
67+
cp "$PROJECT_DIR/docs/man/su.1.man" "$target_dir_su/share/man/man1/su.1"
6868
mkdir -p "$target_dir_su/share/doc/sudo-rs/su"
6969
cp "$PROJECT_DIR/README.md" "$target_dir_su/share/doc/sudo-rs/su/README.md"
7070
cp "$PROJECT_DIR/CHANGELOG.md" "$target_dir_su/share/doc/sudo-rs/su/CHANGELOG.md"

0 commit comments

Comments
 (0)