public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Henning Schild <henning.schild@siemens.com>
To: Alexander Smirnov <alex.bluesman.smirnov@gmail.com>
Cc: <isar-users@googlegroups.com>
Subject: Re: [PATCH 01/16] meta: ext4-img: copy and keep attributes, always copy with sudo
Date: Wed, 2 Aug 2017 13:18:43 +0200	[thread overview]
Message-ID: <20170802131843.5ff3dc85@md1em3qc> (raw)
In-Reply-To: <CAJmB2rB8zLOfO=yspEP+QuXY60=G3yFejQzyYZ--ztKYdEsf8Q@mail.gmail.com>

Am Wed, 2 Aug 2017 10:48:13 +0300
schrieb Alexander Smirnov <alex.bluesman.smirnov@gmail.com>:

> Hi,
> 
> 2017-08-01 13:17 GMT+03:00 Henning Schild
> <henning.schild@siemens.com>:
> 
> > Some security enhancing packages can cause our initrd to be not
> > readable by a normal user. So we need to copy with sudo.
> >  
> 
> Please be more explicit which packages, it'd be nice to have examples
> here in the commit message.

It is one of there packages
IMAGE_PREINSTALL += "acl adduser apparmor apt attr babeltrace
base-files base-passwd bash bridge-utils busybox bzip2 cdebconf
console-setup coreutils cpio cron cryptsetup dash dbus debconf
debian-archive-keyring debianutils debootstrap dh-python dhcpcd5
diffutils dns-root-data dnsmasq dpkg dropbear e2fsprogs ebtables
elfutils ethtool expat file findutils fuse gcc-6 gdb gettext gnupg2
grep grub2 gzip hostname init-system-helpers initramfs-tools iproute2
iptables kbd keyutils kmod less libcap2 libgcrypt20
liblocale-gettext-perl libtasn1-6 libtext-charwidth-perl
libtext-iconv-perl libtext-wrapi18n-perl libxml2 linux-base lsb lsof
ltrace lvm2 mawk mime-support netbase netcat openssl os-prober p11-kit
parted patch pciutils perl procps python2.7 python3.5 rename rsync sed
sensible-utils setserial sgml-base shared-mime-info sqlite3
squashfs-tools strace systemd tar tcpdump trace-cmd tzdata ucf usbutils
util-linux vim wget xauth xdg-user-dirs xml-core xz-utils"

I did not investigate a lot which one, because it is a waste of time.

> In general Isar follows the way to reduce usage of 'sudo' as much as
> possible, so every new entry should have good reasons.

As Andreas reported last week we have libpseudo in the making and almost
ready, so the sudo problem will go away.

> 
> > Also regular cp would destroy ownership and other attributes of
> > files, possibly creating problems in the future.
> >  
> 
> Also an example is highly appreciated.

cd /tmp
touch foobar
chgrp cron foobar
chown mail foobar
chmod 600 foobar
cp foobar bla
cp -a foobar bla2

If any debian package brings files not owned by root, plain cp will
destroy the ownership. I do not have a concrete example at hand.

Henning

> >
> > Signed-off-by: Henning Schild <henning.schild@siemens.com>
> > ---
> >  meta/classes/ext4-img.bbclass | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/meta/classes/ext4-img.bbclass
> > b/meta/classes/ext4-img.bbclass index 65d4c11..6dc2039 100644
> > --- a/meta/classes/ext4-img.bbclass
> > +++ b/meta/classes/ext4-img.bbclass
> > @@ -21,16 +21,16 @@ do_ext4_image() {
> >
> >      mkdir -p ${WORKDIR}/mnt
> >      sudo mount -o loop ${EXT4_IMAGE_FILE} ${WORKDIR}/mnt
> > -    sudo cp -r ${S}/* ${WORKDIR}/mnt
> > +    sudo cp -a ${S}/* ${WORKDIR}/mnt
> >      sudo umount ${WORKDIR}/mnt
> >      rm -r ${WORKDIR}/mnt
> >
> >      if [ -n "${KERNEL_IMAGE}" ]; then
> > -        cp ${S}/boot/${KERNEL_IMAGE} ${DEPLOY_DIR_IMAGE}
> > +        sudo cp -a ${S}/boot/${KERNEL_IMAGE} ${DEPLOY_DIR_IMAGE}
> >  
> 
> 1. Ideally DEPLOY_DIR_IMAGE should not contain files with root
> permissions, the only multistrap filesystems should require them. Any
> spread of sudo significantly increases the probability to damage host
> system. Also I don't see the reason to keep kernel image undo
> supervisor permissions. 2. If KERNEL_IMAGE is symbolic link, 'cp -a'
> will copy symlink only.
> 
> 
> >      fi
> >
> >      if [ -n "${INITRD_IMAGE}" ]; then
> > -        cp ${S}/boot/${INITRD_IMAGE} ${DEPLOY_DIR_IMAGE}
> > +        sudo cp -a ${S}/boot/${INITRD_IMAGE} ${DEPLOY_DIR_IMAGE}
> >      fi
> >  
> 
> I think that closed initrd is more private case than mainstream. Can
> we cosider possibility to implement this as optional security feature?
> 
> 
> >  }
> >
> > --
> > 2.13.0
> >
> > --
> > You received this message because you are subscribed to the Google
> > Groups "isar-users" group.
> > To unsubscribe from this group and stop receiving emails from it,
> > send an email to isar-users+unsubscribe@googlegroups.com.
> > To post to this group, send email to isar-users@googlegroups.com.
> > To view this discussion on the web visit
> > https://groups.google.com/d/
> > msgid/isar-users/5e98880f61dba959ada0c9bc8feca65b0a5760e5.1501582237.git.
> > henning.schild%40siemens.com. For more options, visit
> > https://groups.google.com/d/optout. 


  reply	other threads:[~2017-08-02 11:16 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-01 10:17 [PATCH 00/16] fixes and introducing dpdk-bin support Henning Schild
2017-08-01 10:17 ` [PATCH 01/16] meta: ext4-img: copy and keep attributes, always copy with sudo Henning Schild
2017-08-02  7:48   ` Alexander Smirnov
2017-08-02 11:18     ` Henning Schild [this message]
2017-10-19 18:04   ` Henning Schild
2017-10-19 19:41     ` Alexander Smirnov
2017-08-01 10:17 ` [PATCH 02/16] meta: classes: use base.bbclass from bitbake Henning Schild
     [not found]   ` <CAJmB2rBjBqHxPKTna-XUtgmW9i-ooQwbACyFgQTQahTqUAxHcg@mail.gmail.com>
2017-08-02  8:21     ` Alexander Smirnov
2017-08-01 10:17 ` [PATCH 03/16] meta: isar-base: remove unused function Henning Schild
     [not found]   ` <CAJmB2rBwssbfjgqL2wAsOFfGUK7DbBY31tF_QhR09Ot0rmRVjQ@mail.gmail.com>
2017-08-02  8:20     ` Alexander Smirnov
2017-08-01 10:17 ` [PATCH 04/16] remove redundant variable THISDIR Henning Schild
2017-08-02  8:25   ` Alexander Smirnov
2017-08-02 11:20     ` Henning Schild
2017-08-01 10:17 ` [PATCH 05/16] meta: conf: use bitbake.conf from bitbake and apply local changes Henning Schild
2017-08-02  8:34   ` Alexander Smirnov
2017-08-02 11:22     ` Henning Schild
2017-08-01 10:17 ` [PATCH 06/16] meta: conf: clean up local bitbake config Henning Schild
2017-08-02  8:35   ` Alexander Smirnov
2017-08-02 11:23     ` Henning Schild
2017-08-01 10:17 ` [PATCH 07/16] classes: use WORKDIR and get rid of BUILDROOT Henning Schild
2017-08-02  9:24   ` Alexander Smirnov
2017-08-02 11:30     ` Henning Schild
2017-08-03 11:24     ` Henning Schild
2017-08-01 10:17 ` [PATCH 08/16] classes: move fetch and unpack into isar-base Henning Schild
2017-08-02  9:47   ` Alexander Smirnov
2017-08-02 11:33     ` Henning Schild
2017-08-01 10:17 ` [PATCH 09/16] meta: dpdk use [dirs] directive instead of mkdir Henning Schild
2017-08-01 10:17 ` [PATCH 10/16] meta: dpkg: reorder and rename do_install to install in addtask Henning Schild
2017-08-01 10:17 ` [PATCH 11/16] meta: classes: make do_build always the end of the task-chain Henning Schild
2017-08-02  9:54   ` Alexander Smirnov
2017-08-02 12:05     ` Henning Schild
2017-08-01 10:17 ` [PATCH 12/16] meta: dpkg rename install to install_package Henning Schild
2017-08-02  9:59   ` Alexander Smirnov
2017-08-01 10:17 ` [PATCH 13/16] meta: classes: move install_package to isar-base Henning Schild
2017-08-01 11:48   ` Claudius Heine
2017-08-01 14:00   ` Claudius Heine
2017-08-01 15:01     ` Henning Schild
2017-08-01 10:17 ` [PATCH 14/16] meta: classes: rename dpkg to dpkg-src Henning Schild
2017-08-02 10:02   ` Alexander Smirnov
2017-08-03 15:37     ` Henning Schild
2017-08-03 15:45       ` Jan Kiszka
2017-08-01 10:17 ` [PATCH 15/16] meta: add dpkg-bin class Henning Schild
2017-08-01 14:25   ` Claudius Heine
2017-08-01 15:10     ` Claudius Heine
2017-08-02 10:11       ` Alexander Smirnov
2017-08-02 10:25         ` Henning Schild
2017-08-02 12:31         ` Henning Schild
2017-08-02 12:50           ` Jan Kiszka
2017-08-02 13:40       ` Henning Schild
2017-08-02 15:03         ` Claudius Heine
2017-08-03  7:57           ` Henning Schild
2017-08-03 10:39             ` Claudius Heine
2017-08-03 14:17               ` Henning Schild
2017-08-02 11:11   ` Claudius Heine
2017-08-02 11:17     ` Claudius Heine
2017-08-02 11:26       ` Claudius Heine
2017-08-01 10:17 ` [PATCH 16/16] recipes-app/hello-bin: add example on how to use dpkg-bin Henning Schild
2017-08-02  6:33   ` Jan Kiszka
2017-08-02  6:55     ` Claudius Heine
2017-08-03 18:48     ` Henning Schild
2017-08-01 10:23 ` [PATCH 00/16] fixes and introducing dpdk-bin support Henning Schild
2017-08-01 11:24 ` Claudius Heine
2017-08-11  9:15 ` Alexander Smirnov
2017-08-11 10:35   ` Henning Schild

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=20170802131843.5ff3dc85@md1em3qc \
    --to=henning.schild@siemens.com \
    --cc=alex.bluesman.smirnov@gmail.com \
    --cc=isar-users@googlegroups.com \
    /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