IRC logs for #buildstream for Thursday, 2017-06-08

*** jjardon[m] has joined #buildstream00:17
*** mattiasb has joined #buildstream00:56
*** jonathanmaw has joined #buildstream07:32
*** tristan has joined #buildstream08:05
jonathanmawmorning tristan. the dependencies required to run `debian/rules binary` for a debian source are quite large. So far I've needed to pull in debhelper, dpkg-dev, dpkg, libdpkg-perl, libtimedate-perl, lsb-release, python-docutils and python-roman08:06
jonathanmawand now it seems that I need non-busybox `du`08:07
tristanjonathanmaw, ok so, have you tried this against the debootstrap repo ? (https://gnome7.codethink.co.uk/repo/)08:10
tristanI suspect it would have everything you need, and we can leave the "providing the deps" part anyway as an exercise for the user08:11
tristanit already is for any other build element (users need a sysroot with automake and friends to use autotools builds)08:11
*** ChanServ sets mode: +o tristan08:12
jonathanmawhmm, I haven't tried that08:18
tristanjonathanmaw, you could easily use https://gitlab.com/BuildStream/gnome-modulesets-base as a template for a base system08:19
tristanRaising the fact that there are many dependencies, points to also requiring many dependencies for other elements (autotools is typically available on any dev system, but still requires a lot of deps generally)08:20
tristanThis makes me think it's even more interesting to let elements assert presence of tooling in the sandbox08:21
tristanbut also another idea08:21
tristanWhich is... looking at the very bottom of: https://buildstream.gitlab.io/buildstream/projectconf.html#projectconf08:21
tristanNote that it's possible for a project configuration to customize element configurations on a per-element-type basis08:22
tristanIt's conceivable for a project like baserock (which builds _everything_ from scratch), to configure element types with implied project-wide / element-type-specific dependencies08:23
tristanSo that that project, which only itself can know what element provides a specific host tool, can just simply assert that "Any autotools element implicitly depends on libtool, autoconf, m4, automake" etc08:24
tristan(although note that I doubt defining this is possible at this time, it would need some code to allow project config to append dependencies to all elements of a given type)08:29
tristanStill sounds interesting08:29
*** ssam2 has joined #buildstream08:33
jonathanmawtristan: I'm not sure how to use https://gnome7.codethink.co.uk/repo/. It seems to be a git repo, but `git clone https://gnome7.codethink.co.uk/repo/` isn't working, I assume because it's not a git server.08:36
ssam2isn't that an OSTree repo ?08:37
jonathanmawit's got a refs and objects subdir, I assumed it's a git repo08:40
*** juergbi has quit IRC08:45
*** juergbi has joined #buildstream08:46
jonathanmawit looks like the ostree repo that's in my buildstream artifact cache. huh, I didn't know ostree repos looked like that.08:53
*** jude has joined #buildstream09:11
tristanIt's an ostree repo yes09:19
tristanThe linked project shows a base-system.bst element which consumes that repo09:20
tristanjjardon[m], ssam2, systemd has a facility for assigning uids/gids at startup right ? not only running a service under a specified username ?09:32
tristanI think jjardon[m] had a link to that but I cant find it right now09:32
ssam2systemd-sysusers ?09:32
tristanmaybe that's it yeah09:33
tristanIs that "enough" to handle the case (at least for systemd systems) of needing to assign UID/GIDs to files in a disk image ?09:33
ssam2i'm not sure that it changes any file permissions .. i think it just updates /etc/passwd09:34
ssam2useful if you need an 'apache' user but don't want to hardcode a UID09:35
tristanI see09:35
ssam2something like the manifest used by the baserock install-files extension can handle file permissions though09:35
tristanSomething *can* be done at boot time yes09:36
tristanOk so basically: If there is nothing for the UID/GIDs, then there is no real argument for the suid mode bits either ?09:40
tristanssam2, thoughts ?09:40
tristanI'm looking for the simplest thing here09:40
ssam2I don't understand the question, sorry09:41
tristanWell, we cant create files owned by arbitrary uid/gids, nor can we check them out from ostree as a regular user09:41
tristanThis UID/GID is an annoying limitation to creating real bootable systems, but it would seem that it's not necessary for many cases (everything can be owned by root)09:42
tristanThat is true only somewhat, though.09:42
ssam2I'd be happy with an approach where user, group and setuid information is transmitted "out of bound"09:43
tristanssam2, If I want to make the case that I can get "very close" and not need other things which are strictly forbidden for the regular user09:43
ssam2it's definitely needed, but I think it's rare and often a bit of a legacy hack09:43
tristanBut, still want to have SUID because it's very easy to achieve09:44
tristanThen, my case is bunk basically, if UID/GID is at least as important09:44
tristanThe problem with "transmitted out of bound" is that every approach I can see so far is a horrible hack :-S09:44
tristanIf we wanted to use something like yocto psuedo, we would have to have pseudo *in the sandbox*09:45
ssam2just make it explicit in the definitions09:45
tristanOr, stop using bubblewrap09:45
ssam2add an 'ownership' section to an artifact that deployment elements can implement however is best for them09:46
ssam2for example if you're generating a tarfile you can make the permissions whatever you want as non-root09:46
tristanBut making it explicit in the definitions means more unnecessary work, its a bit counter my personal philosophy, that we should be able to get most things done by improving virtualization and reducing busywork09:46
ssam2fair enough. those are my thoughts though :-)09:47
tristanI.e. in other words: In the vast majority of cases "make install" should be taking care of everything the software wants09:47
ssam2that's already true, though09:47
ssam2it's only a very small minority of components that expect to be able to chown during `mkae install`09:47
tristanssam2, I dont understand what is "already true"09:49
ssam2'"make install" should be taking care of everything the software wants'09:49
ssam2that's already true09:49
ssam2in most cases09:49
tristanRight09:49
tristanThat should include chown and ensuring setuid I think, no ?09:50
ssam2not sure09:50
ssam2for how many programs is that important?09:50
ssam2I can only think of sudo09:50
ssam2and bubblewrap I guess09:50
tristanI think that is not the real question, I think the real question is; can you really make a production ready full system without that ?09:51
tristanAnd also...09:51
ssam2you're changing the question09:51
ssam2my view is that we should mark such special cases explicitly in the definitions09:51
ssam2and if that only needs to be done for sudo and bubblewrap, I don't think that's much burden on the user09:51
tristanDo upstreams usually take responsibility for doing that at make install time ? Or do they generally offload this responsibility to package maintainers to take care of in debian/rpm metadata instead ?09:51
tristanssam2, you make a fair point, if it really us such a small amount09:53
tristanssam2, on the other hand, this I think will mean; samba ? mysql... apache... also things like gdm I suspect09:53
ssam2I have 21 setuid binaries in /usr/bin09:55
ssam2at, change, chfn, chsh, crontab, fusermount, fusermount-glusterfs, gpasswd, ksu, mount, newgidmap, newgrp, newuidmap, passwd, pkexec, pkmount, pumount, schroot, su, sudo and umount09:55
tristanRight, my examples were about uids/gids09:55
tristanso that is also a fair amount09:56
tristanalthough those mostly come from 3 or 4 upstreams09:56
* ssam2 runs `find . -exec stat -c '%U' \{\} \;|egrep -v root`09:57
tristanssam2, so in any case, my first conclusion is probably right: If we cant have arbitrary uids/gids (in checkouts), then there is not much point in trying to have setuid/setgid in checkouts09:58
tristanAgreed ?09:58
ssam2yes09:58
tristanRight that was my first order of business, if that is the case, then we really shouldnt bother arguing this line with Colin any further09:58
tristanAnd it's better for security of users who build stuff, anyway.09:58
tristanSo this fixes the issue mostly: https://github.com/ostreedev/ostree/commit/5913b2294490a1f85d4b617fdcc9455ed0bc63a210:06
tristanWith the ugly permission modifications10:07
tristanNow user mode checkouts really only strip the suid, I *think*10:07
ssam2FWIW my /usr contains only 3 files that aren't owned by root10:19
ssam2one owned by 'abrt', one by 'polkitd', and one by me (probably a cockup :-)10:19
ssam2 even /etc only has a few files not owned by root, in fact10:21
tristanssam2, right, I think ownership comes into play a bit more on servers10:27
tristanhowever most daemons have a very simple setup where they tell the OS that they are user "foo" and they have a home dir somewhere10:28
ssam2true, I have some server stuff installed probably though10:28
tristanand then the OS takes care of creating that home dir10:28
tristannot sure if it's necessarily created at useradd time10:28
tristanor if it can be deferred10:28
ssam2I think that's exactly what systemd-sysusers is aiming to solve10:29
ssam21. create user; 2. create /var directory for daemon with correct permissions; 3. run daemon as correct user; 4. daemon initializes its directory in /var as correct user10:30
ssam2(well sysusers just does step 1, a systemd unit does the rest)10:30
ssam2any shell-based init system can do the same if it wants to10:30
tristanright, but I think *anyway* a lot of this is handled in /etc/passwd10:31
tristanthis takes care of defining the uids *and* specifying the home dir10:31
tristanI think the init system takes care of setup based on this, it's not normally done at build time10:31
tristanalthough debian has some triggers (I think they have adduser and addgroup which they use instead of useradd and groupadd)10:32
tristanmaybe those *also* do some of that special sauce10:32
persiaadduser and addgroup are just wrappers for useradd and groupadd (to allow changing implementations later without impact)10:50
persiaBut they *do* do the special sauce, of which there are two typs defined by debian policy.10:50
persiaType A is static, where it was determined that it would be difficult to translate names to IDs reliably, and so there is a project-wide registry of the allocations so that different packages can reliably use the same IDs, etc.10:51
persiaType B is dynamic, where users/groups are created in specific ranges (depending on purpose): I believe that is suppsoed to happen in preinst (although I haven't delved into it in some time).10:52
persiaOne of the issues with type B is that this contributes to the issue that installing the same package on two systems does not cause the same result.10:52
persiaWhen I was paying more attention, the Debian Project was trying to reduce the amount of Type A that existed (and removing an entry from that list was considered a significant win, if someone managed to do it).10:53
*** tristan has quit IRC11:09
*** tristan has joined #buildstream11:20
*** ChanServ sets mode: +o tristan11:21
tristanfwiw: https://mail.gnome.org/archives/ostree-list/2017-June/msg00025.html11:26
tristanssam2, that also has a wild idea I think we might be able to eventually do, using a similar to 'pseudo' approach but backed by ostree11:27
tristanthat would be really nice actually11:27
ssam2a bit less hacky, but still requires everything to use the same C library and be dynamically linked11:36
*** tristan has quit IRC11:37
*** tristan has joined #buildstream12:25
*** ChanServ sets mode: +o tristan12:25
tristanssam2, yeah, I would prefer something a bit different, hence that part:12:27
tristanI'm not sure how I could get that to work without requiring that the12:27
tristanruntime environment inside bubblewrap actually have the said LD_PRELOAD12:27
tristanlibrary available, for now it's just a wild but I think interesting12:27
tristanidea :)12:27
tristanBasically, it sucks if the content of the bubblewrap container has to be custom in some way12:27
ssam2using ostree as the backend is neat12:27
tristanMaybe another fuse mount approach could do it, but I'm not sure of the restrictions which apply12:28
tristanI.e. could accessing a fuse mount be told that things are suid, but not have it really be so ?12:28
ssam2except you still need a way to go from "ostree repo with arbitrary UIDs and setuid binaries" to "system image"12:28
tristanSame for extended attrs and even dev nodes ?12:28
ssam2most of the paths to do that require using the kernel, which will require privileges12:29
tristanssam2, no, creating images is not a problem at all12:29
tristancreating images has to be 100% user space12:30
tristanThere is no such nonsense as mounting a loopback involved12:30
tristanThats what mkfs -d is for12:30
tristanSo mkfs -d will create a filesystem image from the -d ${sysroot}, where ${sysroot} is a directory that reports basically whatever attributes it wants (hopefully)12:31
tristanUsing the LD_PRELOAD, yocto people manage to get mkfs -d to see the filesys as they want it (as it is hacked by pseudo)12:31
tristanBut I just wonder if it can be done with fuse, it should I think12:32
persiaYou might be able to change permissions with a combination of overlayfs and fuse, although the fuse mount would have to be done privileged.12:33
tristanOnce you get to the real underlying filesys, then the kernel is involved and will complain if the fuse layer tries to create a real dev node ?12:33
tristanWhy ?12:33
tristanfuse mounting doesnt require privileges afaik12:33
persiaIn order to have a file on a filesystem that exposes privileges, that filesystem has to be mounted with those privileges.12:34
tristanThe only questions are really, if the fuse mount is able to report false UID/GIDs to the user and suchlike12:34
persiaThe alternative is to fuse-mount setuid0 shell and run that to gain root anytime you like.12:34
tristanHmmm, not sure I follow, maybe you are answering my question, the part I'm not sure about12:35
tristanpersia, i.e. the way I'm seeing it, is that fuse sits on *top* of a real filesys (or can be backed by anything)12:36
persiaI may be mistaken, but my understanding was that a fuse mount could expose any data one wanted *except* that if the mount was performed by an unpriviliged user, then no privileged files are honoured.12:36
tristanpersia, but that filesys itself does not need to hit the kernel12:36
persiafuse+overlay can sit on top.  Fuse by itself is just a filesystem.12:36
persiaOh!  Yes, if you never need to exercise the permissions, it ought be fine.12:37
tristanpersia, if you implement a passthrough and implement mknod in fuse, it will be the fuse process which gets permission denied if it tries to really mknod (instead of save something to a DB)12:37
persiaSo, if you're setuid0 in a unprivileged container, you should be able to set a file as setuid0 on a FUSE, although that won't be honoured later.  But maybe it doesn't work: I remember some folk complaining about not being able to access port79 from an unprivileged container in another context, which is a similar thing.12:38
tristanRight so you would have user mode checkout of ostree underneath, and a fuse fs on top, which reports the UIDs/GIDs from the real ostree checkout (that was never *really* checked out)12:38
persiaAnd I thought you wanted it uncomplicated :)12:38
tristanBut those UIDs and GIDs are *reported* by fuse, but hopefully never exercised on a real filesys12:38
tristanRight I'm not sure if it can work12:39
tristanpersia, actually this is *quite* uncomplicated if it actually works12:39
tristanBut, I think we at least dont need it for immediate future12:39
tristanGNOME can live easily without that, but it will be great later on for real production systems12:39
tristanpersia, here is an example of complicated: https://mail.gnome.org/archives/ostree-list/2017-June/msg00018.html12:40
tristan(email I was replying to)12:41
tristanFor the Fedora/Project Atomic space in practice we end up using12:41
tristanAnaconda-in-a-VM (via a tool called imagefactory) - and remember12:41
tristanone can create VMs unprivileged.12:41
tristanAnd then the installer reads content from the host via a temporary webserver,12:41
tristanalthough with some work we could inject a virtio channel.12:41
tristan"12:41
tristanLike, holy shit12:41
tristanAnd that of course already requires a lot of host installed stuff12:41
persiaIt's like they never heard of 9fs or something12:41
tristanOn the other hand, while pseudo is a lot nicer, probably even more than fakeroot (but I dont know fakeroot well enough to judge), it *still* requires that that custom LD_PRELOAD be a part of your build environment12:42
tristanThis works for yocto because the build environment is your host (multi sysroot madness)12:42
tristanBut in a namespace, it's ugly because you dont want to impose anything on what is placed in the runtime12:43
tristanBut, *if* that same pseudo stuff can be done with a fuse layer, that is a pretty small amount of code, and a clean / not hacky experience12:43
persiaAt least it provides a clean interface.  I'm not sure it isn't a hack.12:44
tristanRight, I mean a not-hacky experience12:44
persiaGiven the age of the relevant technologies, I would have considered it an acceptable ObHack for the alt.hack hierarchy back when I read newsgroups.12:44
persia(as it isn't obvious, but pleasing in it's own way)12:45
tristanmouahahahaha13:31
tristanpersia, http://bindfs.org/docs/bindfs.1.html13:31
tristanssam2, ^^^13:31
tristanOk with this, we *really* can do that13:31
ssam2oh yeah, I've used bindfs before13:33
tristanssam2, that will do it, well; something similar, and it can all be done with python haha13:33
ssam2is BuildStream still aiming to run on kernels other than Linux ?13:34
tristanWill fuse not be supported on other systems ?13:34
ssam2i don't know that it is13:34
tristanYes, we want to support other unixes13:34
tristanssam2, *however*13:34
tristanit's already certain that we wont have ostree or bwrap on other platforms13:35
tristanSo that is sort of moot13:35
ssam2true, i guess we just require root there13:35
tristanThat is worst case scenario yes, I'll want to have a chroot fallback13:35
tristanstart with that, + tarball artifacts13:35
tristanBut other platforms have special features to optimize and do sandboxing also13:36
tristanwe looked into that last time in manchester13:36
* tristan is currently putting together a fuse context manager thingy for the copy-on-write hardlinks, which is fairly straight forward I think13:37
tristanfrom there it's actually pretty simple to do all that pseudo stuff13:38
tristanWell that's done; but I have to churn the Sandbox API and BuildElement code a bit, tomorrow should be all done (not the awesome spoofing of permissions, but at least copy-on-write hardlinks)15:26
tristanI guess elements will have a bit more control on how sandboxes are constructed, I'll try to keep the API surface for this small, though15:27
*** jonathanmaw has quit IRC15:45
*** tristan has quit IRC15:59
*** tristan has joined #buildstream16:06
*** ChanServ sets mode: +o tristan16:06
*** ssam2 has quit IRC18:11
*** tristan has quit IRC21:06

Generated by irclog2html.py 2.14.0 by Marius Gedminas - find it at mg.pov.lt!