From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id UHsnOohh7WGPTgEAgWs5BA (envelope-from ) for ; Sun, 23 Jan 2022 15:09:12 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id wJOhN4hh7WG0BgAA9RJhRA (envelope-from ) for ; Sun, 23 Jan 2022 15:09:12 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 49FAD1C416 for ; Sun, 23 Jan 2022 15:09:12 +0100 (CET) Received: from localhost ([::1]:46380 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nBdYN-0001Sg-A2 for larch@yhetil.org; Sun, 23 Jan 2022 09:09:11 -0500 Received: from eggs.gnu.org ([209.51.188.92]:54004) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nBdYE-0001SG-7p for guix-patches@gnu.org; Sun, 23 Jan 2022 09:09:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:46070) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nBdYD-0007mF-V7 for guix-patches@gnu.org; Sun, 23 Jan 2022 09:09:01 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nBdYD-0007Xz-Oq for guix-patches@gnu.org; Sun, 23 Jan 2022 09:09:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53468] [RFC PATCH] gnu: linux-pam: Change path to unix_chkpwd helper. Resent-From: Andrew Tropin Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 23 Jan 2022 14:09:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53468 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 53468@debbugs.gnu.org Received: via spool by 53468-submit@debbugs.gnu.org id=B53468.164294693628998 (code B ref 53468); Sun, 23 Jan 2022 14:09:01 +0000 Received: (at 53468) by debbugs.gnu.org; 23 Jan 2022 14:08:56 +0000 Received: from localhost ([127.0.0.1]:38973 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nBdY7-0007Xd-SA for submit@debbugs.gnu.org; Sun, 23 Jan 2022 09:08:56 -0500 Received: from mail-lj1-f175.google.com ([209.85.208.175]:39639) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nBdY6-0007XJ-HW for 53468@debbugs.gnu.org; Sun, 23 Jan 2022 09:08:55 -0500 Received: by mail-lj1-f175.google.com with SMTP id z26so7425542lji.6 for <53468@debbugs.gnu.org>; Sun, 23 Jan 2022 06:08:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=trop-in.20210112.gappssmtp.com; s=20210112; h=from:to:subject:in-reply-to:references:date:message-id:mime-version; bh=CyO1lHSHCnsSEQ7dbL/5Nnp2kLyCYjR0qxlf6hbNWoA=; b=ORPIJ+eXnmIw4pi7SEvB0pSP+wqsQh/SoVQzV00fiV1jmyY4kQ1wlIHj51RRx206wM ZXHuWS52aFIWOAF/I6rxQ+vPJp2CIIpClGZEBuWsef4IAAPPZuEmf3rYAnk6tW8A00r3 gsIGc7pLXe4LYYvTJaxJ15Ipdumg/sUT0eodw2EGKJk+KlxgMvLfQ1Yid157+IUjAIXk HnjYbs/oiXgfleYHNeThdIGTXrzFLU/okgzEv32Gm0v1QRll19evKTM9FrMTuL1BtjD1 JdJkeAukxv4Da9z1t0xm0FjSQ1yPUOtSYkksc2p5jzfq/NwjmI6h78l7fnwMHlWxQLEz tzDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:in-reply-to:references:date :message-id:mime-version; bh=CyO1lHSHCnsSEQ7dbL/5Nnp2kLyCYjR0qxlf6hbNWoA=; b=8J6DDKSBisT10A5CT+nO00Y6+c695skOT8Gc8rcDi+Kw9xGN3YikKC3RlhnZ9KieqT KT4bIwz63B3tZ3yh8VwUgHXM86SWA1GesCDR39eUVAfkxAAuIPJrwTfA1rnMKKcbXvlm KKkp6PHj/HR3ZhlYkVFNgxP4vI2FuiCExwJv3IydrYwQWHZJ6jcZEeS8NYLkALWaEJvl NEuPr00mi3M189nC1nKV1pqRYHotv1TZsyWteGvktaRWTAs7LpjBGiI6xMiY15Yx2HKz +j/ybx3FFUr68BbcRez4QcwdY7u8UWzqufswLnnFRQdZWWEdprUsPye21Yh+gpDVOoE3 U2WQ== X-Gm-Message-State: AOAM5336y212jC6gwc56tDWdSJGsGb7tPEh3aHc4mt9jvoSCwiHYaycB s1hJBvDGkwsEkjNJKhCo/p8u9lO/GVSe5g== X-Google-Smtp-Source: ABdhPJzQSroG98ti5I6DmW7SwRZvkxPv0NkVFHu7pcQQGXVH5S/3Lvx0dp34lu4McV18s5Wc0PxkrA== X-Received: by 2002:a2e:9b8c:: with SMTP id z12mr1953605lji.525.1642946927923; Sun, 23 Jan 2022 06:08:47 -0800 (PST) Received: from localhost (109-252-135-33.dynamic.spd-mgts.ru. [109.252.135.33]) by smtp.gmail.com with ESMTPSA id y15sm315141lfk.195.2022.01.23.06.08.47 for <53468@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Jan 2022 06:08:47 -0800 (PST) From: Andrew Tropin In-Reply-To: <87tudu38yz.fsf@trop.in> References: <87tudu38yz.fsf@trop.in> Date: Sun, 23 Jan 2022 17:08:43 +0300 Message-ID: <87sftetuhg.fsf@trop.in> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1642946952; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=CyO1lHSHCnsSEQ7dbL/5Nnp2kLyCYjR0qxlf6hbNWoA=; b=ELWDkfRiOyWgagsR84fJb5rK+HAmWeR66bWk5DFzB/W2a25KGOdoclWb9EZDJDXJ574sl3 d3+99CRJXX9SClCwpom2Fern8TBZ8bSNsdWXuAb15YLYfVQs4fCIcNt6fv4mr2cX1PaMIR xVR0Qka1nUiEAqKUXCeuKg6GqYkZLJN8PZReJDblM5dMbFMzkUYVHOKIyd0p1AOSEOS/hJ lqM5PunzQcXdFjJT24/WG2odmE0dCYs6HPZoO1u4hdHmDbqCiqaPKuhMMCbslV4nZD6z3b OjT8Kv7SY4YGJzhUJgsblxFBTcx6klFoqkY+wSkzVT9frcdaHHCetYfSbn7FFw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1642946952; a=rsa-sha256; cv=none; b=aCBkqa6sD2/VAJB0cuHVtmtpHKYdHTJ1OBH1v9KBxAnMlYpIffXqUfcwSjmPrrsJzmovKL 3NZYp5bW9UpIlVdecXtFfj6IK2jfuJ/Jb5nrm5C8uMt0Wex3xPI8g13zdSQ2u2m/+BmDCx FxxRFPRSbC2P8QxLieVAIRDNUSNjTui1LVmBRO2kaV6BQMFEKQUVDTdO+6i2W0qGqpsDO1 qqfXAvdOCKZpWF4/KTwbKEsxbbyLd3W3BHOP5nlkc0xVarz5OGFE6ipw8izferyvufNYbC 1AGmnnRDLXzB1UOgwVb7KwdoF8r7s1ifudIN5I4hES1lDjE/U3DTT7JRCsKunA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=trop-in.20210112.gappssmtp.com header.s=20210112 header.b=ORPIJ+eX; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -5.53 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=trop-in.20210112.gappssmtp.com header.s=20210112 header.b=ORPIJ+eX; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 49FAD1C416 X-Spam-Score: -5.53 X-Migadu-Scanner: scn0.migadu.com X-TUID: OKtrdygPytaH --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Attaching a second version of the patch, added missing import and lambda. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=v2-0001-gnu-linux-pam-Change-path-to-unix_chkpwd-helper.patch Content-Transfer-Encoding: quoted-printable From=20ad876e5b134072601fa97d82a39b320a269f34a5 Mon Sep 17 00:00:00 2001 From: Andrew Tropin Date: Thu, 13 Jan 2022 21:41:58 +0300 Subject: [RFC PATCH v2] gnu: linux-pam: Change path to unix_chkpwd helper. * gnu/packages/patches/change-path-to-unix_chkpwd.patch: New file * gnu/packages/linux.scm (linux-pam): Add patch. * gnu/system/pam.scm (pam-root-service-type): Add unix_chkpwd to setuid binaries. =2D-- gnu/packages/linux.scm | 3 +- .../patches/change-path-to-unix_chkpwd.patch | 54 +++++++++++++++++++ gnu/system/pam.scm | 10 +++- 3 files changed, 64 insertions(+), 3 deletions(-) create mode 100644 gnu/packages/patches/change-path-to-unix_chkpwd.patch diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index 7b12cb8ec1..ee0df3c625 100644 =2D-- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -1590,7 +1590,8 @@ (define-public linux-pam (sha256 (base32 "1z4jayf69qyyxln1gl6ch4qxfd66ib1g42garnrv2d8i1drl0790")) =2D (patches (search-patches "linux-pam-no-setfsuid.patch")))) + (patches (search-patches "change-path-to-unix_chkpwd.patch" + "linux-pam-no-setfsuid.patch")))) =20 (build-system gnu-build-system) (native-inputs diff --git a/gnu/packages/patches/change-path-to-unix_chkpwd.patch b/gnu/pa= ckages/patches/change-path-to-unix_chkpwd.patch new file mode 100644 index 0000000000..90a8b639f6 =2D-- /dev/null +++ b/gnu/packages/patches/change-path-to-unix_chkpwd.patch @@ -0,0 +1,54 @@ +From f314ab148b488e23a2e48e7222964e46d0d03447 Mon Sep 17 00:00:00 2001 +From: Andrew Tropin +Date: Wed, 12 Jan 2022 17:17:42 +0300 +Subject: [PATCH] Change path to unix_chkpwd. + +--- + modules/pam_unix/pam_unix_acct.c | 4 ++-- + modules/pam_unix/support.c | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/modules/pam_unix/pam_unix_acct.c b/modules/pam_unix/pam_unix_= acct.c +index 8f5ed3e0..2fdec6c7 100644 +--- a/modules/pam_unix/pam_unix_acct.c ++++ b/modules/pam_unix/pam_unix_acct.c +@@ -122,12 +122,12 @@ int _unix_run_verify_binary(pam_handle_t *pamh, unsi= gned long long ctrl, + } +=20 + /* exec binary helper */ +- args[0] =3D CHKPWD_HELPER; ++ args[0] =3D "/run/setuid-programs/unix_chkpwd"; + args[1] =3D user; + args[2] =3D "chkexpiry"; +=20 + DIAG_PUSH_IGNORE_CAST_QUAL; +- execve(CHKPWD_HELPER, (char *const *) args, envp); ++ execve("/run/setuid-programs/unix_chkpwd", (char *const *) args, envp= ); + DIAG_POP_IGNORE_CAST_QUAL; +=20 + pam_syslog(pamh, LOG_ERR, "helper binary execve failed: %m"); +diff --git a/modules/pam_unix/support.c b/modules/pam_unix/support.c +index 27ca7127..d02f394e 100644 +--- a/modules/pam_unix/support.c ++++ b/modules/pam_unix/support.c +@@ -523,7 +523,7 @@ static int _unix_run_helper_binary(pam_handle_t *pamh,= const char *passwd, + } +=20 + /* exec binary helper */ +- args[0] =3D CHKPWD_HELPER; ++ args[0] =3D "/run/setuid-programs/unix_chkpwd"; + args[1] =3D user; + if (off(UNIX__NONULL, ctrl)) { /* this means we've succeeded */ + args[2]=3D"nullok"; +@@ -532,7 +532,7 @@ static int _unix_run_helper_binary(pam_handle_t *pamh,= const char *passwd, + } +=20 + DIAG_PUSH_IGNORE_CAST_QUAL; +- execve(CHKPWD_HELPER, (char *const *) args, envp); ++ execve("/run/setuid-programs/unix_chkpwd", (char *const *) args, envp); + DIAG_POP_IGNORE_CAST_QUAL; +=20 + /* should not get here: exit with error */ +--=20 +2.34.0 + diff --git a/gnu/system/pam.scm b/gnu/system/pam.scm index 2574e019f1..b635681642 100644 =2D-- a/gnu/system/pam.scm +++ b/gnu/system/pam.scm @@ -21,6 +21,7 @@ (define-module (gnu system pam) #:use-module (guix derivations) #:use-module (guix gexp) #:use-module (gnu services) + #:use-module (gnu system setuid) #:use-module (ice-9 match) #:use-module (srfi srfi-1) #:use-module (srfi srfi-9) @@ -375,8 +376,13 @@ (define (extend-configuration initial extensions) =20 (define pam-root-service-type (service-type (name 'pam) =2D (extensions (list (service-extension etc-service-type =2D /etc-entry))) + (extensions + (list (service-extension + setuid-program-service-type + (lambda (_) + (list (file-like->setuid-program + (file-append linux-pam "/sbin/unix_chkpwd= "))))) + (service-extension etc-service-type /etc-entry))) =20 ;; Arguments include as well as procedures. (compose concatenate) =2D-=20 2.34.0 --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Reconfigured my system with the patch above. I tested it with the swaylock built with pam support: =2D-8<---------------cut here---------------start------------->8--- (define-public swaylock (package (name "swaylock") (version "1.6") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/swaywm/swaylock") (commit "5150d3869cd801cb2badb3c645fa41c01bbfbbbf"))) (file-name (git-file-name name version)) (sha256 (base32 "16n389w5hx8f8dqnhzjgimxmaw648cnnmifazx6zwx2v5vhxa38r")))) (build-system meson-build-system) (inputs (list cairo gdk-pixbuf libxkbcommon linux-pam wayland)) (native-inputs (list pango pkg-config scdoc wayland-protocols)) (home-page "https://github.com/swaywm/sway") (synopsis "Screen locking utility for Wayland compositors") (description "Swaylock is a screen locking utility for Wayland composit= ors.") (license license:expat))) =2D-8<---------------cut here---------------end--------------->8--- and following system service: =2D-8<---------------cut here---------------start------------->8--- (simple-service 'sway-add-swaylock-pam pam-root-service-type (list (unix-pam-service "swaylock"))) =2D-8<---------------cut here---------------end--------------->8--- I'll make a patch for swaylock separately, when this ticket will be resolved. =2D-=20 Best regards, Andrew Tropin --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJDBAEBCgAtFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmHtYWwPHGFuZHJld0B0 cm9wLmluAAoJECII0glYwd6wFuQP/iHU8//zTDyOGY9XOy6vMhsYfonZD3R4ZzIR jSu2GM5LFlduzXMarNzMufYjyPyT8ht1xp4HVR6fX8QYtS4x9/I8nmqQjZhN1vFo HTnyRRu8nDjRUKqjFIsJmT3VnMsck+zQLqCuk98yfMNFjAuYsVuuN9DKuD07TkQ4 W/9ynqb5FuErTaLtfWDWdIygnBcjUR61FpmqgsFKKlpxSwZlPP72fEBW7tGx3pWR BmzMolDYTF4fCkforyMYtXSy2YS0INooW/4CJCGXCHi4CevRepz0pFmR+Ws1UBAS +lagCjDynM367THQ6zmfoP5zWwBAe0RTtDiPE3AqwenFiL8FmEum2fnMb4JwGEHb PsjzRqvtaBZuebAPcvdq1rjHH+Ergu+hVZ4WlwOScfLUwhx0wvdYI1g2VYd1R4XC faq8oo8cRb0FRiKMNb7W56pyZcD1T0+VzAc6eEx7zF76aAQOH+aaf19B4phGTnGS aBDaxMGP47BmNA96rGEFcgzN5QBmYTZQnwMF+jBWyeF15xQ23t57QDjD3e6jKGD/ xiP4HGY3dZJPLPuRe5PIKmF0gOv18jg62QqNkoFmW+u6BId/F4huEKC6KB0VO6BP FWbImLJcUOGcJbMq1OLnOC4cepASVtxySNFYikXkpYZI4OXgecynuZ9nwFEBzYE5 XrNr+TzX =A/5x -----END PGP SIGNATURE----- --==-=-=--