public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Viorel Munteanu" <ceamac@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: net-misc/dropbear/files/, net-misc/dropbear/
Date: Wed, 23 Oct 2024 19:27:28 +0000 (UTC)	[thread overview]
Message-ID: <1729711624.7aaeab46a6f20d3eda4806be69907ac2d57b664f.ceamac@gentoo> (raw)

commit:     7aaeab46a6f20d3eda4806be69907ac2d57b664f
Author:     Viorel Munteanu <ceamac <AT> gentoo <DOT> org>
AuthorDate: Wed Oct 23 19:17:03 2024 +0000
Commit:     Viorel Munteanu <ceamac <AT> gentoo <DOT> org>
CommitDate: Wed Oct 23 19:27:04 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7aaeab46

net-misc/dropbear: add 2024.86

Signed-off-by: Viorel Munteanu <ceamac <AT> gentoo.org>

 net-misc/dropbear/Manifest                         |   2 +
 net-misc/dropbear/dropbear-2024.86.ebuild          | 201 +++++++++++++++++++++
 .../dropbear/files/dropbear-2024.86-tests.patch    |  59 ++++++
 3 files changed, 262 insertions(+)

diff --git a/net-misc/dropbear/Manifest b/net-misc/dropbear/Manifest
index f3d702c62cb0..06e599b49b35 100644
--- a/net-misc/dropbear/Manifest
+++ b/net-misc/dropbear/Manifest
@@ -2,3 +2,5 @@ DIST dropbear-2022.83.tar.bz2 2322904 BLAKE2B 4e26667458fb068a8c997b44dfd3c4f151
 DIST dropbear-2022.83.tar.bz2.asc 833 BLAKE2B 7dfcf13804738aed3136c264412f8c2f96cd3ff71482815af736346c9441c8f00adef26f4e8f89082cbbb4033249501adbc545c08f678e1cac4afc88a8fc9ed0 SHA512 e5cbd01dcbaeabb04dc473bd11933a422fda03ceb5bc02fb5c99abafd0841e3ac1f436cc1798500b33fbbc81923fa03c2a28c971fa26794ed5888d496fb7e2ad
 DIST dropbear-2024.85.tar.bz2 2304594 BLAKE2B 631b71733437a256267057a1c4846afa4d520fa9e29d9c14dfa7df09109c30cc2d649ada990a15c615567f7a1d6ff02340799216b7fa41327d72cb43dd9096e0 SHA512 09619e9874172658b7fc284823e0a619b6a4346a5db41487d1628768b46c1f8eac962bfd8ef73e2a59e466fc4022395f7a194b4309195c954b0d7e0d13254f67
 DIST dropbear-2024.85.tar.bz2.asc 833 BLAKE2B 1d0cc37fb1c528c6f7f6e064d3ec3d7c63617b568d8889592ca162171a325a46e84a23f24c16069b5396c806b2270434552833138ba95c7f34c8b5e6e425fcc7 SHA512 d2ad10b60f53d8d598a7a57337fe890c26c60bea115fb919f6135a01fe3f8f7e5863b0a7ed6c7eacbd5a3b810169b600c0004251a8d748d4b40584933c2c7383
+DIST dropbear-2024.86.tar.bz2 2306244 BLAKE2B 988e2cc03c123685c93ab8b1148b1844cecc78aa12ad00d48f737e74fdae24f8c0397b91dc343b7fb996ffcf986804f32ffd1b886edf13d158b6f914545c883a SHA512 6be3d2efd79e49e1f9fe13654c26b9c14d1504c9543720e59600f6d689aafae7365b4a0bbfa309f7bf692995672adbbd9e660b2c907ea3d68d9f71023d05f54e
+DIST dropbear-2024.86.tar.bz2.asc 833 BLAKE2B 5fc35fb4135f099c2204972d3fc365b01b2622eeadf4cf6093496176e5a4010c1fbe36056036fe370e1a1ffb05d86293e212d935a3b4c5d8b0005eae09423edc SHA512 b7dbae281b21d5d1dfbb311f6a94a2c1acd3ab44a3293baffa885194d24721ec8067e907b414ebc0b5d77bb32c511fcd5c31008b6622b946e8d253621012836f

diff --git a/net-misc/dropbear/dropbear-2024.86.ebuild b/net-misc/dropbear/dropbear-2024.86.ebuild
new file mode 100644
index 000000000000..7e1d6f159e8b
--- /dev/null
+++ b/net-misc/dropbear/dropbear-2024.86.ebuild
@@ -0,0 +1,201 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..13} )
+VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/dropbear.asc
+inherit pam python-any-r1 savedconfig verify-sig
+
+DESCRIPTION="Small SSH 2 client/server designed for small memory environments"
+HOMEPAGE="https://matt.ucc.asn.au/dropbear/dropbear.html"
+SRC_URI="https://matt.ucc.asn.au/dropbear/releases/${P}.tar.bz2
+	https://matt.ucc.asn.au/dropbear/testing/${P}.tar.bz2"
+SRC_URI+=" verify-sig? (
+		https://matt.ucc.asn.au/dropbear/releases/${P}.tar.bz2.asc
+		https://matt.ucc.asn.au/dropbear/testing/${P}.tar.bz2.asc
+	)"
+
+LICENSE="MIT GPL-2" # (init script is GPL-2 #426056)
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~m68k ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~x64-macos"
+IUSE="bsdpty minimal multicall pam +shadow static +syslog test zlib"
+RESTRICT="!test? ( test )"
+
+LIB_DEPEND="
+	virtual/libcrypt[static-libs(+)]
+	zlib? ( sys-libs/zlib[static-libs(+)] )
+"
+RDEPEND="
+	acct-group/sshd
+	acct-user/sshd
+	!static? (
+		>=dev-libs/libtomcrypt-1.18.2-r2[libtommath]
+		>=dev-libs/libtommath-1.2.0
+		${LIB_DEPEND//\[static-libs(+)]}
+	)
+	pam? ( sys-libs/pam )
+"
+DEPEND="
+	${RDEPEND}
+	static? ( ${LIB_DEPEND} )
+"
+RDEPEND+=" pam? ( >=sys-auth/pambase-20080219.1 )"
+BDEPEND="
+	test? (
+		sys-libs/nss_wrapper
+		$(python_gen_any_dep '
+			dev-python/asyncssh[${PYTHON_USEDEP}]
+			dev-python/attrs[${PYTHON_USEDEP}]
+			dev-python/iniconfig[${PYTHON_USEDEP}]
+			dev-python/packaging[${PYTHON_USEDEP}]
+			dev-python/pluggy[${PYTHON_USEDEP}]
+			dev-python/py[${PYTHON_USEDEP}]
+			dev-python/pyparsing[${PYTHON_USEDEP}]
+			dev-python/pytest[${PYTHON_USEDEP}]
+			dev-python/psutil[${PYTHON_USEDEP}]
+		')
+	)
+	verify-sig? ( sec-keys/openpgp-keys-dropbear )
+"
+
+REQUIRED_USE="pam? ( !static )"
+
+PATCHES=(
+	"${FILESDIR}"/${PN}-2024.84-dbscp.patch
+	"${FILESDIR}"/${PN}-2024.86-tests.patch
+	"${FILESDIR}"/${PN}-2024.84-test-bg-sleep.patch
+)
+
+set_options() {
+	progs=(
+		dropbear dbclient dropbearkey
+		$(usev !minimal "dropbearconvert scp")
+	)
+	makeopts=(
+		MULTI=$(usex multicall 1 0)
+	)
+}
+
+python_check_deps() {
+	python_has_version "dev-python/asyncssh[${PYTHON_USEDEP}]" && \
+		python_has_version "dev-python/attrs[${PYTHON_USEDEP}]" && \
+		python_has_version "dev-python/iniconfig[${PYTHON_USEDEP}]" && \
+		python_has_version "dev-python/packaging[${PYTHON_USEDEP}]" && \
+		python_has_version "dev-python/pluggy[${PYTHON_USEDEP}]" && \
+		python_has_version "dev-python/py[${PYTHON_USEDEP}]" && \
+		python_has_version "dev-python/pyparsing[${PYTHON_USEDEP}]" && \
+		python_has_version "dev-python/pytest[${PYTHON_USEDEP}]" && \
+		python_has_version "dev-python/psutil[${PYTHON_USEDEP}]"
+}
+
+pkg_setup() {
+	use test && python-any-r1_pkg_setup
+
+	if use static ; then
+		ewarn "Using bundled copies of libtommath and libtomcrypt"
+	fi
+}
+
+src_prepare() {
+	default
+
+	# dropbear does not accept -E if built w/o syslog support and fails the tests
+	if use syslog; then
+		eapply "${FILESDIR}"/${PN}-2024.84-non-interactive-tests.patch
+	else
+		eapply "${FILESDIR}"/${PN}-2024.84-non-interactive-tests-no-syslog.patch
+	fi
+
+	sed \
+		-e '/SFTPSERVER_PATH/s:".*":"/usr/lib/misc/sftp-server":' \
+		-e '/DROPBEAR_X11FWD/s:0:1:' \
+		src/default_options.h > localoptions.h || die
+	sed \
+		-e '/pam_start/s:sshd:dropbear:' \
+		-i src/svr-authpam.c || die
+	restore_config localoptions.h
+
+	use test && python_fix_shebang test/parent_dropbear_map.py
+
+	# dropbearconvert is not built with USE minimal
+	# test_concurrent needs dropbearconvert to convert the key before running
+	if use minimal; then
+		rm test/test_dropbearconvert.py test/test_concurrent.py || die
+	fi
+
+	# bsdpty requires CONFIG_LEGACY_PTYS in kernel; disable tests.
+	# bug #939601
+	if use bsdpty; then
+		rm test/test_channels.py || die
+	fi
+}
+
+src_configure() {
+	# Notes:
+	# 1) We use bundled libtom* when static build is enabled because
+	#    libtomcrypt lacks it and we don't particularly want to add it.
+	# 2) We disable the hardening flags as our compiler already enables them
+	#    by default as is appropriate for the target.
+	local myeconfargs=(
+		--disable-harden
+
+		# bug #836900
+		$(use_enable !elibc_musl lastlog)
+		$(use_enable !elibc_musl wtmp)
+
+		$(use_enable static bundled-libtom)
+		$(use_enable zlib)
+		$(use_enable pam)
+		$(use_enable !bsdpty openpty)
+		$(use_enable shadow)
+		$(use_enable static)
+		$(use_enable syslog)
+	)
+
+	econf "${myeconfargs[@]}"
+}
+
+src_compile() {
+	set_options
+	emake "${makeopts[@]}" PROGRAMS="${progs[*]}"
+
+	# need symlinks for tests
+	if use multicall && use test; then
+		local x
+		for x in "${progs[@]}" ; do
+			ln -sf dropbearmulti ${x} || die "ln -s dropbearmulti to ${x} failed"
+		done
+	fi
+}
+
+src_install() {
+	set_options
+	emake "${makeopts[@]}" PROGRAMS="${progs[*]}" DESTDIR="${D}" install
+	doman manpages/*.8
+	newinitd "${FILESDIR}"/dropbear.init.d dropbear
+	newconfd "${FILESDIR}"/dropbear.conf.d dropbear
+	dodoc CHANGES README.md SMALL.md MULTI.md
+
+	# The multi install target does not install the links right.
+	if use multicall ; then
+		pushd "${ED}"/usr/bin &> /dev/null || die
+		local x
+		for x in "${progs[@]}" ; do
+			ln -sf dropbearmulti ${x} || die "ln -s dropbearmulti to ${x} failed"
+		done
+		rm -f dropbear
+		dodir /usr/sbin
+		dosym -r /usr/bin/dropbearmulti /usr/sbin/dropbear
+		popd &> /dev/null || die
+	fi
+	save_config localoptions.h
+
+	if ! use minimal ; then
+		mv "${ED}"/usr/bin/{,db}scp || die
+	fi
+
+	if use pam; then
+		pamd_mimic system-remote-login dropbear auth account password session
+	fi
+}

diff --git a/net-misc/dropbear/files/dropbear-2024.86-tests.patch b/net-misc/dropbear/files/dropbear-2024.86-tests.patch
new file mode 100644
index 000000000000..18712d2e4f10
--- /dev/null
+++ b/net-misc/dropbear/files/dropbear-2024.86-tests.patch
@@ -0,0 +1,59 @@
+Create all the keys needed for the tests.
+Enable testing server auth.
+
+dbclient obeys $HOME, but dropbear (the server) resolves HOME using getpwnam.
+Use sys-libs/nss_wrapper to fake it during tests.
+
+--- a/test/Makefile.in
++++ b/test/Makefile.in
+@@ -4,18 +4,26 @@
+ 
+ all: test
+ 
+-test: venv/bin/pytest fakekey
+-	(source ./venv/bin/activate; pytest --hostkey=fakekey --dbclient=../dbclient --dropbear=../dropbear $(srcdir) )
++uid:=$(shell id -u)
++gid:=$(shell id -g)
++test: fakekey
++	mkdir -p ~/.ssh
++	../dropbearkey -t ecdsa -f ~/.ssh/id_dropbear
++	../dropbearkey -y -f ~/.ssh/id_dropbear | grep ^ecdsa > ~/.ssh/authorized_keys
++	# Convert to openssh format so that asyncssh can find it in tests
++	-../dropbearconvert dropbear openssh ~/.ssh/id_dropbear ~/.ssh/id_ecdsa
++	../dropbearkey -t ecdsa -f ~/.ssh/id_dropbear_key2 | grep ^ecdsa | sed 's/[^ ]*$$/key2 extra/' >> ~/.ssh/authorized_keys
++	../dropbearkey -t ecdsa -f ~/.ssh/id_dropbear_key3 | grep ^ecdsa | sed 's/[^ ]*$$/key3%char/' >> ~/.ssh/authorized_keys
++	../dropbearkey -t ecdsa -f ~/.ssh/id_dropbear_key4 | grep ^ecdsa | sed 's/[^ ]*$$/key4,char/' >> ~/.ssh/authorized_keys
++	echo "$(LOGNAME)::$(uid):$(gid):$(USER):$(HOME):/bin/bash" >> ~/passwd
++	echo "$(LOGNAME)::$(gid):" >> ~/group
++	chmod 0700 ~ ~/.ssh ~/.ssh/authorized_keys ~/passwd ~/group
++	DBTEST_IN_ACTION=y pytest --hostkey=fakekey --dbclient=../dbclient --dropbear=../dropbear $(srcdir)
+ 
+-one: venv/bin/pytest fakekey
+-	(source ./venv/bin/activate; pytest --hostkey=fakekey --dbclient=../dbclient --dropbear=../dropbear $(srcdir) -k exit)
++one: fakekey
++	pytest --hostkey=fakekey --dbclient=../dbclient --dropbear=../dropbear $(srcdir) -k exit
+ 
+ fakekey:
+ 	../dropbearkey -t ecdsa -f $@
+ 
+-venv/bin/pytest: $(srcdir)/requirements.txt
+-	python3 -m venv init venv
+-	./venv/bin/pip install --upgrade pip
+-	./venv/bin/pip install -r $(srcdir)/requirements.txt
+-
+ .PHONY: test
+--- a/test/test_dropbear.py
++++ b/test/test_dropbear.py
+@@ -27,7 +27,11 @@ def dropbear(request):
+ 		]
+ 	print("subprocess args: ", args)
+ 
+-	p = subprocess.Popen(args, stderr=subprocess.PIPE, text=True)
++	env = os.environ
++	env['LD_PRELOAD'] = 'libnss_wrapper.so'
++	env['NSS_WRAPPER_PASSWD'] = env['HOME'] + '/passwd'
++	env['NSS_WRAPPER_GROUP'] = env['HOME'] + '/group'
++	p = subprocess.Popen(args, stderr=subprocess.PIPE, text=True, env=env)
+ 	# Wait until it has started listening
+ 	for l in p.stderr:
+ 		if "Not backgrounding" in l:


             reply	other threads:[~2024-10-23 19:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-23 19:27 Viorel Munteanu [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-02-21  9:00 [gentoo-commits] repo/gentoo:master commit in: net-misc/dropbear/files/, net-misc/dropbear/ Viorel Munteanu
2025-02-21  9:00 Viorel Munteanu
2024-09-14 11:25 Viorel Munteanu
2024-08-27 18:26 Viorel Munteanu
2024-04-07  6:36 Viorel Munteanu
2024-04-06  5:58 Viorel Munteanu
2022-04-23 21:35 Conrad Kostecki
2019-11-14  9:09 Lars Wendler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1729711624.7aaeab46a6f20d3eda4806be69907ac2d57b664f.ceamac@gentoo \
    --to=ceamac@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox