mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-11-21 22:47:14 -08:00
Merge updates from master
This commit is contained in:
@@ -0,0 +1 @@
|
||||
DIST token2-fido-bridge-0.1.4.tar.gz 23227 BLAKE2B f3515c783489eb16bc01e40a3720965b8d4b64b87eba603b8c656df45f24233313180dcba45c9a8ff45fa0b1b4b5a1e81a3ed55067ddc6c2a16e79ea92efca0b SHA512 60c581b97aa3195ab1f214ea05bba798e2f466406046a357d8703028c004e54adb1456ecbecdbce0cee33aca5b1403727b841fd980f1a78211092bbb0aaf16a2
|
||||
@@ -0,0 +1,74 @@
|
||||
From 2b69bd8d0d128a1c612ac3ee984fed16c9eaca73 Mon Sep 17 00:00:00 2001
|
||||
From: David Seifert <soap@gentoo.org>
|
||||
Date: Sun, 1 Nov 2026 13:58:32 +0100
|
||||
Subject: [PATCH] Sandbox the systemd service
|
||||
|
||||
The daemon only needs /dev/uhid and the pcscd socket, so drop all
|
||||
capabilities and confine it, keeping modprobe outside the sandbox.
|
||||
---
|
||||
README.md | 3 ++-
|
||||
packaging/token2-fido-bridge.service | 30 +++++++++++++++++++++++++++-
|
||||
2 files changed, 31 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/README.md b/README.md
|
||||
index cc4a049..94f1802 100644
|
||||
--- a/README.md
|
||||
+++ b/README.md
|
||||
@@ -55,7 +55,8 @@ project has none of that: install the `.deb`, and it just runs.
|
||||
|
||||
- Linux with the `uhid` kernel module (standard on Ubuntu/Debian/Fedora)
|
||||
- `pcscd` running, a PC/SC reader, and a FIDO2-capable smartcard
|
||||
-- Runs as root (needs `/dev/uhid`)
|
||||
+- Runs as root (needs `/dev/uhid`), but the systemd service drops all
|
||||
+ capabilities and sandboxes the daemon
|
||||
|
||||
## Install
|
||||
|
||||
diff --git a/packaging/token2-fido-bridge.service b/packaging/token2-fido-bridge.service
|
||||
index 605cf9c..60adb99 100644
|
||||
--- a/packaging/token2-fido-bridge.service
|
||||
+++ b/packaging/token2-fido-bridge.service
|
||||
@@ -6,11 +6,39 @@ Wants=pcscd.service
|
||||
[Service]
|
||||
Type=simple
|
||||
# Ensure the uhid kernel module is available before we open /dev/uhid.
|
||||
-ExecStartPre=-/sbin/modprobe uhid
|
||||
+# "+" runs this outside the sandbox below, which forbids module loading.
|
||||
+ExecStartPre=-+/sbin/modprobe uhid
|
||||
ExecStart=/usr/bin/token2-fido-bridge
|
||||
Restart=on-failure
|
||||
RestartSec=2
|
||||
+# root only because /dev/uhid is root:root 0600 and pcscd's polkit policy
|
||||
+# refuses session-less users; as the owner, root needs no capabilities.
|
||||
User=root
|
||||
|
||||
+# The daemon only opens /dev/uhid and talks to pcscd over its UNIX socket.
|
||||
+CapabilityBoundingSet=
|
||||
+NoNewPrivileges=yes
|
||||
+DevicePolicy=closed
|
||||
+DeviceAllow=/dev/uhid rw
|
||||
+PrivateNetwork=yes
|
||||
+RestrictAddressFamilies=AF_UNIX
|
||||
+ProtectSystem=strict
|
||||
+ProtectHome=yes
|
||||
+PrivateTmp=yes
|
||||
+ProtectClock=yes
|
||||
+ProtectHostname=yes
|
||||
+ProtectKernelLogs=yes
|
||||
+ProtectKernelModules=yes
|
||||
+ProtectKernelTunables=yes
|
||||
+ProtectControlGroups=yes
|
||||
+RestrictNamespaces=yes
|
||||
+RestrictRealtime=yes
|
||||
+RestrictSUIDSGID=yes
|
||||
+LockPersonality=yes
|
||||
+MemoryDenyWriteExecute=yes
|
||||
+SystemCallArchitectures=native
|
||||
+SystemCallFilter=@system-service
|
||||
+SystemCallErrorNumber=EPERM
|
||||
+
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
--
|
||||
2.56.0
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
|
||||
<pkgmetadata>
|
||||
<maintainer type="person">
|
||||
<email>soap@gentoo.org</email>
|
||||
<name>David Seifert</name>
|
||||
</maintainer>
|
||||
<upstream>
|
||||
<remote-id type="github">token2/token2-fido-bridge</remote-id>
|
||||
</upstream>
|
||||
</pkgmetadata>
|
||||
@@ -0,0 +1,57 @@
|
||||
# Copyright 2026 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
inherit cmake linux-info optfeature systemd udev
|
||||
|
||||
DESCRIPTION="Expose PC/SC smartcards as virtual FIDO2/WebAuthn USB-HID security keys"
|
||||
HOMEPAGE="https://github.com/token2/token2-fido-bridge"
|
||||
SRC_URI="https://github.com/token2/token2-fido-bridge/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"
|
||||
|
||||
LICENSE="MIT"
|
||||
SLOT="0"
|
||||
KEYWORDS="~amd64"
|
||||
|
||||
DEPEND="sys-apps/pcsc-lite"
|
||||
RDEPEND="${DEPEND}"
|
||||
BDEPEND="virtual/pkgconfig"
|
||||
|
||||
CONFIG_CHECK="~HIDRAW ~UHID"
|
||||
|
||||
PATCHES=(
|
||||
"${FILESDIR}"/${P}-systemd-sandboxing.patch
|
||||
)
|
||||
|
||||
src_prepare() {
|
||||
cmake_src_prepare
|
||||
|
||||
# Upstream hardcodes /usr/lib/{systemd,udev} install paths;
|
||||
# install these with the eclass helpers in src_install instead.
|
||||
sed -i -e '/^install(FILES packaging\//d' CMakeLists.txt || die
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
local mycmakeargs=(
|
||||
-DSTATIC_CXX_RUNTIME=OFF
|
||||
)
|
||||
cmake_src_configure
|
||||
}
|
||||
|
||||
src_install() {
|
||||
cmake_src_install
|
||||
|
||||
systemd_dounit packaging/${PN}.service
|
||||
udev_dorules packaging/70-${PN}.rules
|
||||
insinto /usr/lib/modules-load.d
|
||||
newins packaging/uhid.conf ${PN}-uhid.conf
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
udev_reload
|
||||
optfeature "USB CCID smartcard readers" app-crypt/ccid
|
||||
}
|
||||
|
||||
pkg_postrm() {
|
||||
udev_reload
|
||||
}
|
||||
Reference in New Issue
Block a user