-
Notifications
You must be signed in to change notification settings - Fork 665
interfaces/builtin/network-setup-{control,observe}: allow using netplan directly #9784
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
Changes from all commits
cd18731
307066c
f0c16b3
f76a102
4f206b4
d241bd6
ebe115c
f701f46
a1f64aa
e063228
88e8811
8baa27a
55d20a2
47077e4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,6 +32,19 @@ const networkSetupControlBaseDeclarationSlots = ` | |
| const networkSetupControlConnectedPlugAppArmor = ` | ||
| # Description: Can read/write netplan configuration files | ||
|
|
||
| # Allow use of the netplan binary from the base snap. With this interface, this | ||
| # is expected to be able to apply and generate new network configuration, as | ||
| # well as get information about the current network configuration. | ||
| /usr/sbin/netplan ixr, | ||
| # core18+ has /usr/sbin/netplan as a symlink to this script | ||
| /usr/share/netplan/netplan.script ixr, | ||
| # netplan related files | ||
| /usr/share/netplan/ r, | ||
| /usr/share/netplan/** r, | ||
|
|
||
| # Netplan uses busctl internally, so allow using that as well | ||
| /usr/bin/busctl ixr, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I noticed when checking this that busctl triggers a net_admin denial, which is unfortunate, and not part of these interfaces but the command still succeeds: Since we are using 'ixr', we get dbus mediation which is why no other dbus rules are needed. |
||
|
|
||
| /etc/netplan/{,**} rw, | ||
| /etc/network/{,**} rw, | ||
| /etc/systemd/network/{,**} rw, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| #!/bin/sh | ||
|
|
||
| set -e | ||
|
|
||
| # netplan should be on $PATH from the base snap at /usr/sbin/netplan | ||
| netplan "$@" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| name: netplan-snap | ||
| version: 0.1 | ||
|
|
||
| # this gets replaced for different bases for the test | ||
| base: BASESNAP | ||
|
|
||
| plugs: | ||
| network: {} | ||
| network-bind: {} | ||
| network-setup-observe: {} | ||
| network-setup-control: {} | ||
|
|
||
| apps: | ||
| netplan: | ||
| command: bin/netplan.sh | ||
| # use a separate command for info since this one doesn't use netplan binary, | ||
| # instead it uses busctl to call the D-Bus endpoint | ||
| # we can't use netplan info, because netplan info will return things without | ||
| # using D-Bus, but for this test we want to test the D-Bus endpoint | ||
| # specifically | ||
| netplan-info: | ||
| command: bin/netplan-info.sh |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's a bit unclear what to do about that but it's not clear we can mandate for all bases to have neptlan inside them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I would expect this only to be used on Ubuntu Core systems, so really this is only a requirement of Ubuntu Core boot bases. We could make the snippet conditional and only applied on core systems if that makes you more comfortable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand the concern that the policy allows using the binary from the base snap, even if the base snap does not provide it, but I don't think this should be reason enough to block this pr because:
Really the concern here is about the interface contract providing access to something that might not be there, which is fine IMHO because there are plenty of other cases where this is true in interfaces such as when there is a resource in /dev/, we provide access via apparmor to the /dev/ file even if it doesn't exist.
At the end of the day allowing this access will not break snaps and will not permit folks to build a snap that works then someday becomes broken. It only allows folks to knowingly build broken snaps, which they can already do today. Additionally this access addresses a product offering gap which is that in order to actually use netplan you have to essentially maintain your own netplan inside your snap which is a really unfortunate user story.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's say we consider netplan optional, the other question is do we expect newer and older versions of netplan client to interoperate with newer/older version of actual system netplan?
I suppose we are ok because in the end it can only use the dbus interface that is the contract here? but actually we let it read the files as well under netplan? is the latter a problem?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well there are 2 cases:
For 1), the only way that the app snap could be broken is if the new netplan binary decides to send a different D-Bus API, which IMHO would be netplan breaking a compatibility guarantee, but I don't know if there exists such a version compatibility guarantee
For 2), the only way that the app snap could be broken is if the new netplan service implementation stops understanding old API, which is 100% a broken compatibility promise, and is the same kind of breakage that would happen without this PR if the client bundles and ships netplan in their app snap anyways (like they must be doing today anyways).
Thinking about this again, I think that if the netplan team says they do not guarantee forward compatibility such that a new netplan binary could some-day send incompatible data to an older netplan service, then we should not do this. I asked the team about this and will report back what I hear.
Regarding reading the files, I don't view this as a problem since really those are just python files underneath /usr/share/netplan/... that the netplan binary needs to read/load in order to work, as netplan doesn't install it's python files inside the typical site-packages directory which is allowed by the python apparmor abstraction AFAICT.