/srv/irclogs.ubuntu.com/2018/09/29/#snappy.txt

k1412Hello, I have a little question. How do we configure network-control for an existing snapd application. I don't find a complete tutorial about it.08:14
mupPR snapd#5886 opened: [testing] [pre-rfc] [wip] split spread in travis <Created by chipaca> <https://github.com/snapcore/snapd/pull/5886>09:57
=== sgclark_sleeping is now known as sgclark
zygak1412: hey,12:49
zygak1412: just add a network-control slot to your snapcraft.yaml file12:49
zygathen connect it12:49
zygait grants numerous permissions to setup networking12:49
k1412Hello zyga, it work also if we installed it with snap install anbox --devmode --beta ? Because in this case I not know where is the yaml file exactly12:50
zygak1412: what are you trying to do exactly?12:51
zygaare you making a new snap12:51
zygaor changing an existing snap?12:51
k1412Changing an existing one, I want launch it isolate in a defined network namespace12:52
k1412zyga: normaly I launch my application with ip netns exec but for snapd it fail with an error so I saw he info about network-control12:55
zygammm12:55
zygayou can repack a snap but I would not recommend to do that12:55
k1412zyga: it look a little compicate when I hear that ^^, maybe the error message can help to understand the issue ?12:56
zygak1412: snapd doesn't use network namespaces12:56
zygaso you should be able to just wrap the whole thing with a new network namespace12:56
zygaand run any snap this way12:56
k1412zyga: this is the error I have when I try to run my snap with ip netns12:57
k1412cannot execute snap-update-ns: Permission denied12:57
k1412snap-update-ns failed with code 1: File exists12:57
zygado you have any apparmor denials in syslog/journald?12:58
k1412I use debian so I think there is maybe a default configuration (this is the command I use for launch it sudo ip netns exec protected sudo -u $USER snap run anbox)12:58
zygawhat is 'protected'?13:00
zygaand what are you trying to achieve?13:00
zygaanbox snap is just an installer last time I checked13:00
zygait requires some thighs that may or may not work on Debian (I don't know)13:00
k1412protected is my network namespace I created before, I want be sure that anbox only use the interface that I allow to use (example  no connection, vpn, lan network)13:02
k1412zyga: the normal launch (snap run anbox) is working13:03
zygaMmm. I see13:12
zygaTBH not sure why it fails13:12
k1412zyga: no issue, i will try to have some answers from firejail too because they have a snapd profile but it look failling too (https://privatebin.net/?299984217221dd99#Iv9/L1Q49cU41it7bVeo2zjRIqKt9mAHD3JO7/SKy00=)13:15
zygaFrankly unless you want to jump into kernel and snapd confining snapd is not an easy task13:16
zygaPerhaps run it in a VM13:16
zygaIf you want to investigate what is going on at that level then all the power to you13:16
zygaJust want to say it is severely complicated.13:16
k1412I'm not good enough to going so far away ^^ maybe a complete chroot with firejail would be more easy13:17
zygaI doubt it13:20
zygaFirejail is just another level of apparmor and seccomp13:20
zygaSo more complexity and kernel interaction13:20
zygaAnd snap changes profiles13:20
zygaSo unless firejail stacks (and that is a super new feature in apparmor itself) you may effectively NOP13:21
zygaFirejail won’t confine snap apps13:21
zyga(Again, just a theory)13:21
k1412I will try it to see, it would be a lot of fun ^^ (that is assuming that snapd can work in something like a chroot, I'm already not sure about it)13:22
zygaWell, snapd talks to systemd13:23
zygaAnd to the kernel13:23
zygaI’m unsure your actions make sense in trying to prevent snapd from affecting your system13:24
k1412It's more that if it can work in a chroot (like another system) I just need to pass my complete chroot to my network namespace (but that is many theory) I will begin to just try to run snap from a chroot and see what happen13:26
zygaSnapd can get out of a chroot13:27
zygaChoot is not effective confinement13:27
k1412zyga: Ah ? there is a way to test it (in same time so I can try it a little)13:28
zygak1412: test what specifically?13:34
k1412zyga: to exit a chroot with snap13:35
zygak1412: all of those things have complex interactions; it seems you are trying to harden your installation of snapd; to effectively measure if the hardening makes any changes you'd have to know how snapd operates and how the kernel features it uses and (+chroot + fire jail) interact with each other; then you could try to mount an attack to see if the contraption works13:35
zygak1412: snap-confine does this13:36
zygaI don't think this is sensible confinement13:36
zygabecause it deals with sandboxing of apps snapd is not a typical service that can be sandboxed easily13:36
zygathe permissions snapd _can_ grant applications are equivalent of sandbox escape in some cases13:37
zygaso it's really meaningless to chroot it13:37
k1412I see, to be honnest i just try to find a way to affect it to a network namespace I want but without rebuilding a snap. Maybe you have reason it's maybe more easy to run it in virtualbox and assign virtualbox to a network namespace13:38
zygaI don't know why it failed for you in the most straightforward case13:38
zygaI'd look at debugging that13:38
zygastrace ip setns13:39
zygasee what happens13:39
k1412zyga: it look complaining about the uid that is not 0 and think that sudo is maybe with suid or without root rights (it's maybe related when i do sudo -u the second time)13:44
zygait == ip setns?13:45
k1412zyga: snap i can copy paste the log of strace but it's in french, i'm not sure it will help13:46
zygaI think I'm too tired to debug that13:46
k1412No issue thanks for giving me some tracks that can help13:47
erio:O14:59
eriodamn14:59
eriohttps://github.com/search?q=depends-on-alsa&type=Code14:59
eriohttps://www.google.com/search?q=%22depends-on-alsa%3A%22+%22snapcraft.yaml%22&oq=%22depends-on-alsa%3A%22+%22snapcraft.yaml%22&aqs=chrome..69i57.10368j0j1&sourceid=chrome&ie=UTF-815:02
erioanyone here?15:31
=== matteo| is now known as matteo
erio:O17:30
erio:o18:01
erio?18:59
mupPR snapd#5887 opened: tests: moving core-snap-refresh-on-core test from main to nested suite <Created by sergiocazzolato> <https://github.com/snapcore/snapd/pull/5887>20:32
eriocould someone explain me wth is stage and wth is prime ?20:41
eriothe definition in the docs is just awful20:41
erioanyone online?23:44
erioanyone online?23:49

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