The snap-confine program reads a number of files written by snapd. To reduce complexity each file is in a different format so that the corresponding parser is easier to write and test. In a perfect world we’d just dump one big file that has everything (say yaml or json) and load it back. In that world we’d have no problem with squeezing a few key=value pairs in a miscellaneous section, to tell snap-confine about things that we currently hard-code as a compile-time choice.
To truly support re-execution on any distribution we need to be able to have the exact same executable of snap-confine work correctly. Currently, from the top of my head, we can, as a compile time choice:
- control if apparmor is enabled
- control if seccomp is enabled
- control where the /snap directory is
- control if the distribution uses merged /usr or not
- control which nvidia driver model to use
All of those need to become variables that snapd tells to snap-confine.
I’d like to propose that we add a new file, say /var/lib/snapd/snap-confine.cfg that can contain simple key=value pairs. This file would be written by snapd (or even shipped in a distro pacakge as it is all constant) and read by snap-confine. The file would be easily extensible and unknown values could be ignored by snap-confine. With a few patches we could then replace each compile-time choice to a runtime choice. Eventually, as the number of patches drops to zero and number of compile time choices drops to zero, we could enable re-execution everywhere.
What do you guys think?