Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Design for use with linux-user-chroot #8

Closed
cgwalters opened this issue Jul 23, 2015 · 4 comments
Closed

Design for use with linux-user-chroot #8

cgwalters opened this issue Jul 23, 2015 · 4 comments

Comments

@cgwalters
Copy link
Contributor

A security issue today with RPM-based buildsystems is that while it's common for the actual compilation process (make or whatever) to run as non-root, the buildroot creation still requires root.

I maintain: https://git.gnome.org/browse/linux-user-chroot/tree/README?id=1ab0cc3bc401c8e5578dd1da05aed502544e5183
which is intended to address this - and works successfully for the GNOME Continuous buildsystem.
However, that isn't using RPM.

I briefly looked at what it would take to use linux-user-chroot with RPM. This would mean not having the primary process call chroot() directly, but instead only do chroot /path/to/installroot /path/to/script when calling out to %post scripts - and that code path could then optionally use linux-user-chroot instead of plain chroot.

However, RPM currently relies on the chroot() system call to affect where it places files - so it would have to learn to either prepend the installroot when writing out content, or use openat() and friends with a directory fd for the install root.

Another subtle but important one: RPM presently relies on chroot() affecting NSS lookups pulling uid/gid mappings from the target /etc/passwd and such. See: http://lists.rpm.org/pipermail/rpm-maint/2014-January/003656.html This one would be annoying to fix - may need custom NSS code.

@cgwalters
Copy link
Contributor Author

Also worth linking to https://github.com/wrpseudo/pseudo which is a maintained alternative approach for non-root RPM operation.

@kad
Copy link
Contributor

kad commented Jul 23, 2015

There is also http://proot.me/ that uses ptrace instead of LD_PRELOAD (like pseudo or fakeroot).

cgwalters added a commit to cgwalters/rpm-ostree that referenced this issue Jul 24, 2015
Someday we'll enhance RPM; see
rpm-software-management/rpm#8

But anyways right now at least a few people have tried,
and we get all the way past downloading packages and then bomb
out when doing the actual transaction with a useless error
message.

So let's be up front about this.
@ffesti
Copy link
Contributor

ffesti commented Jul 24, 2015

On 07/23/2015 10:07 PM, Colin Walters wrote:

A security issue today with RPM-based buildsystems is that while it's
common for the actual compilation process (|make| or whatever) to run as
non-root, the buildroot creation still requires root.

I maintain:
https://git.gnome.org/browse/linux-user-chroot/tree/README?id=1ab0cc3bc401c8e5578dd1da05aed502544e5183
which is intended to address this - and works successfully for the GNOME
Continuous buildsystem.
However, that isn't using RPM.

I briefly looked at what it would take to use |linux-user-chroot| with
RPM. This would mean not having the primary process call |chroot()|
directly, but instead only do |chroot /path/to/installroot
/path/to/script| when calling out to |%post| scripts - and that code
path could then optionally use |linux-user-chroot| instead of plain
|chroot|.

However, RPM currently relies on the |chroot()| system call to affect
where it places files - so it would have to learn to either prepend the
installroot when writing out content, or use |openat()| and friends with
a directory fd for the install root.

Another subtle but important one: RPM presently relies on |chroot()|
affecting NSS lookups pulling uid/gid mappings from the target
|/etc/passwd| and such. See:
http://lists.rpm.org/pipermail/rpm-maint/2014-January/003656.html This
one would be annoying to fix - may need custom NSS code.

While you caught some of the uses of chroot this list is far from
complete. Another one would be access to the rpmdb (which is done by
libdb and though not 100% under our control). As the index dbs and the
environment files may be opened or even create during normal operation
it also take doesn't take messing around with chroot lightly.

Florian


Reply to this email directly or view it on GitHub
#8.

Red Hat GmbH, http://www.de.redhat.com/ Registered seat: Grasbrunn,
Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Charles Cachera, Michael Cunningham, Michael
O'Neill, Charles Peters

cgwalters added a commit to coreos/rpm-ostree that referenced this issue Aug 30, 2015
Someday we'll enhance RPM; see
rpm-software-management/rpm#8

But anyways right now at least a few people have tried,
and we get all the way past downloading packages and then bomb
out when doing the actual transaction with a useless error
message.

So let's be up front about this.
cgwalters added a commit to coreos/rpm-ostree that referenced this issue Aug 31, 2015
Someday we'll enhance RPM; see
rpm-software-management/rpm#8

But anyways right now at least a few people have tried,
and we get all the way past downloading packages and then bomb
out when doing the actual transaction with a useless error
message.

So let's be up front about this.
@ffesti
Copy link
Contributor

ffesti commented Sep 24, 2015

Moved issue to http://rpm.org/ticket/896 as we are closing the github issue tracker for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants