From nobody Tue Apr 08 00:21:19 2025 X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4ZWmvz57GYz5sQS8; Tue, 08 Apr 2025 00:21:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ZWmvz3Lqlz42TT; Tue, 08 Apr 2025 00:21:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1744071679; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=rIP50OFRUu+i0WDOuIDNs9IwfSvJ/65wI09scq2vZs8=; b=unlJeHndUtNGHkh00beKaNGIwgGwe8A/lKggrCQZIK10VLyXg+V2HE8DIElIhJt/T1esh3 JggLkXJ5cfGUeFVfHy0OANMU4vTA4IZLPZqtf1XX6C3OuqCVHXZkvgpOlNuYA907i0+Xkm S+fQPiAv7ohaVucSoJ/V9WnQSPbFTzT0p+Uf3lN0+W7BHE80S3ezW9tt2f2VMW7uyaGBsB 7SPtf3SU64G+6kwH89sYQ6LiwarWTa4K7fmFjhMtjaP8iOLGEwlcehs4vfQ/m2OjIHMK1s ndaGX+YyCB2f+1EOVgPnUUHYgDoF/IXP5Jw88DGBjVblTDUo8WvD82z5uSoycA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1744071679; a=rsa-sha256; cv=none; b=qzzKlKUSV6lOLD0Dp2Avpl7oXB+nf5004ckVDLcQY4a8v2rZ751NcatiLA2nMHOufx4GBc lMXNEbXWb03dzt/U1PkHVa481EPkaznf022lP/3gIGPuTb2GwhOsmHG6r5HwhRk3++wWSs wVFsZXVcv0brjT7D+rN5xG+SLsz+QIMsNbbSjl3yCHKrsXfYwwhVC6OOPTwUGYaFjV0zRW iEwk0hUhz6VWyABUmEjSrZqqdtqByzLR7JAhFtDvTKJnY8IpKZuwcqH5JrMw8SLLHa87jd u+fU1srQMaEPdxQpWokw3L1qhBPM/lDcGQF2jMW6Z6U0D/ng40Wb/T9AEmVTiw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1744071679; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=rIP50OFRUu+i0WDOuIDNs9IwfSvJ/65wI09scq2vZs8=; b=g1Cm9It2UrwyV232yVlM5EsEeoustWoy/0WcEdU7TwY/VS+id/by+HUtG4ruSRJokJ/PoW MStZwE2fuIFhRz15ngeC2ZGwZhgi3oVNun1KmGu4UUjXj8Bhy5wy//fOJjwFD4JIRfi8JD 7LOkL7Qv5b+brnwxKgOK0KX8A4cmAOTsMt4srA7joZgs8wjlO+eICkmlG8WNMi0Gd77XAK O88zb6vDcHk5lKgOiNp2uzzJoXsnAj9Jr3WbFQKvYyGuhGFMJHyBsvZd5DCudYGdyfDsG4 GEP7fYS+FZlMyzg2AImj8DQAb4mU9xyhihDUMz2hWNi3k+U31Qtx5ZtT3VVmEA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4ZWmvz2w6Tz17ct; Tue, 08 Apr 2025 00:21:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5380LJXe037513; Tue, 8 Apr 2025 00:21:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5380LJHe037510; Tue, 8 Apr 2025 00:21:19 GMT (envelope-from git) Date: Tue, 8 Apr 2025 00:21:19 GMT Message-Id: <202504080021.5380LJHe037510@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Koichiro Iwao Subject: git: 2030729b0ff7 - main - security/sudo-rs: add new port, rust re-implementation of sudo List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-ports-all@freebsd.org Sender: owner-dev-commits-ports-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: meta X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2030729b0ff7207ccd185bce1d1e2400d20fb4fe Auto-Submitted: auto-generated The branch main has been updated by meta: URL: https://cgit.FreeBSD.org/ports/commit/?id=2030729b0ff7207ccd185bce1d1e2400d20fb4fe commit 2030729b0ff7207ccd185bce1d1e2400d20fb4fe Author: Marc Schoolderman AuthorDate: 2025-04-04 15:21:59 +0000 Commit: Koichiro Iwao CommitDate: 2025-04-08 00:20:48 +0000 security/sudo-rs: add new port, rust re-implementation of sudo Reviewed by: meta, mikael PR: 285861 WWW: https://github.com/trifectatechfoundation/sudo-rs/ --- security/sudo-rs/Makefile | 78 +++++++++++++++++++++++++++++++++++++++++ security/sudo-rs/distinfo | 15 ++++++++ security/sudo-rs/files/pam.conf | 16 +++++++++ security/sudo-rs/files/sudoers | 73 ++++++++++++++++++++++++++++++++++++++ security/sudo-rs/pkg-descr | 6 ++++ security/sudo-rs/pkg-plist | 10 ++++++ 6 files changed, 198 insertions(+) diff --git a/security/sudo-rs/Makefile b/security/sudo-rs/Makefile new file mode 100644 index 000000000000..0541804b25f7 --- /dev/null +++ b/security/sudo-rs/Makefile @@ -0,0 +1,78 @@ +PORTNAME= sudo-rs +PORTVERSION= 0.2.5 +DISTVERSIONPREFIX= v +CATEGORIES= security + +MAINTAINER= marc@trifectatech.org +COMMENT= Allow others to run commands as root +WWW= https://trifectatech.org/initiatives/privilege-boundary/ + +LICENSE= APACHE20 MIT +LICENSE_COMB= dual +LICENSE_FILE_APACHE20= ${WRKSRC}/LICENSE-APACHE +LICENSE_FILE_MIT= ${WRKSRC}/LICENSE-MIT + +BUILD_DEPENDS= pandoc:${PORTSDIR}/textproc/hs-pandoc + +USES= cargo + +USE_GITHUB= yes +GH_ACCOUNT= trifectatechfoundation +GH_TAGNAME= main + +CARGO_CRATES= diff-0.1.13 \ + glob-0.3.2 \ + libc-0.2.170 \ + log-0.4.26 \ + pretty_assertions-1.4.1 \ + yansi-1.0.1 + +.if !defined(USER) || ${USER} == root +CARGO_TEST= no +.endif + +PLIST_SUB+= RS_SUFFIX=${RS_SUFFIX} + +PORTDOCS= CHANGELOG.md CONTRIBUTING.md COPYRIGHT LICENSE-* README.md \ + SECURITY.md + +OPTIONS_DEFINE= COEXIST DOCS +OPTIONS_SUB= yes + +COEXIST_DESC= Install using -rs prefix to coexist with security/sudo +COEXIST_CONFLICTS_INSTALL_OFF= sudo +COEXIST_VARS= RS_SUFFIX=-rs + +post-patch: + ${REINPLACE_CMD} -E -e "s:(/usr/local)?/etc:${LOCALBASE}/etc:" ${WRKSRC}/src/sudo/mod.rs + +post-build: +.for man in sudo.8 visudo.8 sudoers.5 + @${MKDIR} ${WRKDIR}/docs/man + pandoc -s -t man ${WRKSRC}/docs/man/${man}.md -o ${WRKDIR}/docs/man/${man} +.endfor + +post-install: + ${MV} ${STAGEDIR}${PREFIX}/bin/visudo ${STAGEDIR}${PREFIX}/sbin/visudo${RS_SUFFIX} + ${INSTALL_MAN} ${WRKDIR}/docs/man/sudo.8 ${STAGEDIR}${PREFIX}/share/man/man8/sudo${RS_SUFFIX}.8 + ${INSTALL_MAN} ${WRKDIR}/docs/man/visudo.8 ${STAGEDIR}${PREFIX}/share/man/man8/visudo${RS_SUFFIX}.8 + ${INSTALL_MAN} ${WRKDIR}/docs/man/sudoers.5 ${STAGEDIR}${PREFIX}/share/man/man5/sudoers${RS_SUFFIX}.5 + ${MKDIR} ${STAGEDIR}${PREFIX}/etc/sudoers.d + ${MKDIR} ${STAGEDIR}${PREFIX}/etc/pam.d + ${MKDIR} ${STAGEDIR}/var/run/sudo + ${MKDIR} ${STAGEDIR}/var/db/sudo +# we are not going to try to replace 'su', since that is part of FreeBSD itself + ${RM} ${STAGEDIR}${PREFIX}/bin/su + +post-install-COEXIST-on: + ${MV} ${STAGEDIR}${PREFIX}/bin/sudo ${STAGEDIR}${PREFIX}/bin/sudo${RS_SUFFIX} + +post-install-COEXIST-off: + ${INSTALL_DATA} ${FILESDIR}/pam.conf ${STAGEDIR}${PREFIX}/etc/pam.d/sudo.default + ${INSTALL_DATA} ${FILESDIR}/sudoers ${STAGEDIR}${PREFIX}/etc/sudoers.dist + +post-install-DOCS-on: + ${MKDIR} ${STAGEDIR}${DOCSDIR} + cd ${WRKSRC} && ${INSTALL_DATA} ${PORTDOCS} ${STAGEDIR}${DOCSDIR} + +.include diff --git a/security/sudo-rs/distinfo b/security/sudo-rs/distinfo new file mode 100644 index 000000000000..5d7966a4ccbf --- /dev/null +++ b/security/sudo-rs/distinfo @@ -0,0 +1,15 @@ +TIMESTAMP = 1743665625 +SHA256 (rust/crates/diff-0.1.13.crate) = 56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8 +SIZE (rust/crates/diff-0.1.13.crate) = 46216 +SHA256 (rust/crates/glob-0.3.2.crate) = a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2 +SIZE (rust/crates/glob-0.3.2.crate) = 22359 +SHA256 (rust/crates/libc-0.2.170.crate) = 875b3680cb2f8f71bdcf9a30f38d48282f5d3c95cbf9b3fa57269bb5d5c06828 +SIZE (rust/crates/libc-0.2.170.crate) = 760076 +SHA256 (rust/crates/log-0.4.26.crate) = 30bde2b3dc3671ae49d8e2e9f044c7c005836e7a023ee57cffa25ab82764bb9e +SIZE (rust/crates/log-0.4.26.crate) = 47022 +SHA256 (rust/crates/pretty_assertions-1.4.1.crate) = 3ae130e2f271fbc2ac3a40fb1d07180839cdbbe443c7a27e1e3c13c5cac0116d +SIZE (rust/crates/pretty_assertions-1.4.1.crate) = 78952 +SHA256 (rust/crates/yansi-1.0.1.crate) = cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049 +SIZE (rust/crates/yansi-1.0.1.crate) = 75497 +SHA256 (trifectatechfoundation-sudo-rs-v0.2.5-main_GH0.tar.gz) = 0eb28fe7aacd79505c2949a4318d079a39151d9646e057ff6f362e8f2706cfb5 +SIZE (trifectatechfoundation-sudo-rs-v0.2.5-main_GH0.tar.gz) = 707844 diff --git a/security/sudo-rs/files/pam.conf b/security/sudo-rs/files/pam.conf new file mode 100644 index 000000000000..e70ff2093eea --- /dev/null +++ b/security/sudo-rs/files/pam.conf @@ -0,0 +1,16 @@ +# PAM configuration for the "sudo" service +# + +# auth +auth include system + +# account +account include system + +# session +# XXX: pam_lastlog (used in system) causes users to appear as though +# they are no longer logged in in system logs. +session required pam_permit.so + +# password +password include system diff --git a/security/sudo-rs/files/sudoers b/security/sudo-rs/files/sudoers new file mode 100644 index 000000000000..99ef7934c811 --- /dev/null +++ b/security/sudo-rs/files/sudoers @@ -0,0 +1,73 @@ +## sudoers file. +## +## This file MUST 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!/usr/local/sbin/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="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" +## +## Uncomment if needed to preserve environmental variables related to the +## FreeBSD pkg utility and fetch. +# Defaults env_keep += "PKG_CACHEDIR PKG_DBDIR FTP_PASSIVE_MODE" +## +## Additionally uncomment if needed to preserve environmental variables +## related to portupgrade +# Defaults env_keep += "PORTSDIR PORTS_INDEX PORTS_DBDIR PACKAGES PKGTOOLS_CONF" +## +## You may wish to keep some of the following environment variables +## when running commands via sudo. +## +## Locale settings +# Defaults env_keep += "LANG LANGUAGE LINGUAS LC_* _XKB_CHARSET" +## +## X11 resource path settings +# Defaults env_keep += "XAPPLRESDIR XFILESEARCHPATH XUSERFILESEARCHPATH" +## +## Desktop path settings +# Defaults env_keep += "QTDIR KDEDIR" +## +## Allow sudo-run commands to inherit the callers' ConsoleKit session +# Defaults env_keep += "XDG_SESSION_COOKIE" +## +## Uncomment to enable special input methods. Care should be taken as +## this may allow users to subvert the command being run via sudo. +# Defaults env_keep += "XMODIFIERS GTK_IM_MODULE QT_IM_MODULE QT_IM_SWITCHER" +## +## 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 +## + +## +## User privilege specification +## +root ALL=(ALL:ALL) ALL + +## Uncomment to allow members of group wheel to execute any command +# %wheel ALL=(ALL:ALL) ALL + +## Same thing without a password +# %wheel ALL=(ALL:ALL) NOPASSWD: ALL + +## Uncomment to allow members of group sudo to execute any command +# %sudo ALL=(ALL:ALL) ALL + +## Uncomment to allow any user to run sudo if they know the password +## of the user they are running the command as (root by default). +# Defaults targetpw # Ask for the password of the target user +# ALL ALL=(ALL:ALL) ALL # WARNING: only use this together with 'Defaults targetpw' + +## Read drop-in files from /usr/local/etc/sudoers.d +@includedir sudoers.d diff --git a/security/sudo-rs/pkg-descr b/security/sudo-rs/pkg-descr new file mode 100644 index 000000000000..e02b45a024ad --- /dev/null +++ b/security/sudo-rs/pkg-descr @@ -0,0 +1,6 @@ +Sudo-rs is a memory safe re-implementation of the sudo utility. + +Sudo is a program designed to allow a sysadmin to give limited root +privileges to users and log root activity. The basic philosophy is to +give as few privileges as possible but still allow people to get their +work done. diff --git a/security/sudo-rs/pkg-plist b/security/sudo-rs/pkg-plist new file mode 100644 index 000000000000..e8bdee449e15 --- /dev/null +++ b/security/sudo-rs/pkg-plist @@ -0,0 +1,10 @@ +@(,,4755) bin/sudo%%RS_SUFFIX%% +sbin/visudo%%RS_SUFFIX%% +share/man/man5/sudoers%%RS_SUFFIX%%.5.gz +share/man/man8/sudo%%RS_SUFFIX%%.8.gz +share/man/man8/visudo%%RS_SUFFIX%%.8.gz +%%NO_COEXIST%%@sample etc/pam.d/sudo.default etc/pam.d/sudo +%%NO_COEXIST%%@sample etc/sudoers.dist etc/sudoers +@dir etc/sudoers.d +@dir /var/db/sudo +@dir /var/run/sudo