From patchwork Thu Mar 7 21:47:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yann E. MORIN" X-Patchwork-Id: 225958 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from silver.osuosl.org (silver.osuosl.org [140.211.166.136]) by ozlabs.org (Postfix) with ESMTP id 3DE7E2C037B for ; Fri, 8 Mar 2013 08:47:35 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 7A28F3122D; Thu, 7 Mar 2013 21:47:34 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NXfvK-WybVmA; Thu, 7 Mar 2013 21:47:33 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 1BBED31281; Thu, 7 Mar 2013 21:47:33 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id F22758F753 for ; Thu, 7 Mar 2013 21:47:38 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 5ED178BEA3 for ; Thu, 7 Mar 2013 21:47:31 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WEXc16cOGTtE for ; Thu, 7 Mar 2013 21:47:30 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-we0-f182.google.com (mail-we0-f182.google.com [74.125.82.182]) by whitealder.osuosl.org (Postfix) with ESMTPS id C29458C095 for ; Thu, 7 Mar 2013 21:47:29 +0000 (UTC) Received: by mail-we0-f182.google.com with SMTP id t57so224823wey.41 for ; Thu, 07 Mar 2013 13:47:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer; bh=DQQLzI+nfgVkNO6sLl8n+cwuMFTOOiSYhy7SS/J1b2c=; b=vATVr/e63neTLs4j/mEgXI97RzV0rhsKIME1oO5kOKtetA5H+4hiZIMrV01c/9JxSV r9vYbRRFsXYuT0wJXRIZY1BWBf6eE17xd+/hayi/XOg4y1z1b+gQNHCIhgguz7TzUyzy VCNQivNNTNTMwicRENacy7lM7o0ujShc5lxIyoQqgd4IGG/04oSyldY3AaaLZ1gpXBd5 BCEAph8fBgTCvoNlE8JpYLWYnl6J+k6R0YIDKHR1j0XxsKaN37lAtCj49uk+IMTi1PEz 49W0HUgkPmwJjvc0BJpfwfLEHN7pKpIB5UYLwvsP90fsLurV98bsIyLGGysSX84QBHpy Qkng== X-Received: by 10.194.158.161 with SMTP id wv1mr57935454wjb.38.1362692847982; Thu, 07 Mar 2013 13:47:27 -0800 (PST) Received: from localhost.localdomain (ARennes-555-1-167-217.w2-2.abo.wanadoo.fr. [2.2.22.217]) by mx.google.com with ESMTPS id n2sm35887097wiy.6.2013.03.07.13.47.25 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 07 Mar 2013 13:47:26 -0800 (PST) From: "Yann E. MORIN" To: buildroot@busybox.net Date: Thu, 7 Mar 2013 22:47:18 +0100 Message-Id: X-Mailer: git-send-email 1.7.2.5 Cc: "Yann E. MORIN" Subject: [Buildroot] [pull request v8] Pull request for branch yem-package-create-user X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net Hello All! Here is a series that allows packages to create users. Packages that install daemons may well want to run those daemons as non-root users to avoid security issues. Currently, there are two users of choice to run 'generic' daemons: root or daemon (although there are a few dedicated users to run a few services: mail, sshd, ftp...). This series builds upon both the package infrastrucutre to define the user(s) a package may want to create, and the filesystem infrastructure to actually generate these users, and chown their ${HOME}s. Documentation is updated accordingly. As a proof of concept, the package tvheadend has been updated to use a dedicated user to run its daemon as (call me stubborn! ;-] ). Changes v7 -> v8: - rebased on master, fixed conflicts in docs/manual Changes v6 -> v7: - rebased onto the 'next' branch for Peter Changes v5 -> v6: (All after suggestions by Arnout) - clean up awk invocations - ensure users with an explicit uid are created before users with a computed uid - ditto for groups/gid - cleanup group-addign function - fix password encoding method - cleanup /etc/shadow fields - fix typos Changes v4 -> v5: - rebased ontop master after Developer's Day comments and upstreaming Changes v3 -> v4: - use the configured password encryption scheme - some tweaks and typo-fixes to the documentation Changes v2 -> v3: - clarify password prefixes (Samuel) - move makeuser syntax doc to its own file (Samuel) - use awk instead of sed to parse /etc/passwd et al. (Cam, Thomas) - sanitise use of grep (Cam) - enhancements and fixes to makuser syntax doc (Cam) Changes v1 -> v2: - drop the gshadow patch (Thomas, Peter) - tvheadend user is now part of the video secondary group The following changes since commit 203c30796e232faaf3a7de19090657bf3e7db16a: rpi-userland: provides OpenGL ES, EGL and OpenVG (2013-03-06 22:18:39 +0100) are available in the git repository at: git://gitorious.org/buildroot/buildroot.git yem-package-create-user Yann E. MORIN (2): packages: add ability for packages to create users package/tvheadend: use a non-root user to run the daemon docs/manual/adding-packages-generic.txt | 17 ++- docs/manual/appendix.txt | 1 + docs/manual/makeusers-syntax.txt | 87 +++++++ fs/common.mk | 3 + package/pkg-generic.mk | 1 + package/tvheadend/etc.default.tvheadend | 5 +- package/tvheadend/tvheadend.mk | 10 +- support/scripts/mkusers | 409 +++++++++++++++++++++++++++++++ 8 files changed, 526 insertions(+), 7 deletions(-) create mode 100644 docs/manual/makeusers-syntax.txt create mode 100755 support/scripts/mkusers Regards, Yann E. MORIN