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

main: override systemd features only when security.nesting=false #619

Merged
merged 1 commit into from
Apr 20, 2022

Conversation

simondeziel
Copy link
Contributor

Distrobuilder creates a systemd generator (/etc/systemd/system-generators/lxc) to, among other things, work around problems with broken name space support inside containers.

Many of the distro images built by distrobuilder come with systemd. Those often ship multiple systemd units leveraging hardening features that rely on mount name spaces. The problem is that mount name spaces do not work well inside containers so the workaround so far has been to disable those features to avoid causing service failures.

This PR proposes to be more selective and only disable those hardening features relying on mount name spaces when security.nesting=false.

This was tested on a Focal host with kernel 5.13, LXD 5.0.0-e478009 rev 22894 and the following containers:

Distro Priv Nesting
alt/Sisyphus true true
alt/Sisyphus true false
alt/Sisyphus false true
alt/Sisyphus false false
debian/sid true true
debian/sid true false
debian/sid false true
debian/sid false false
ubuntu/focal false true
ubuntu/focal false false
ubuntu/focal false true
ubuntu/focal false false
ubuntu/jammy false true
ubuntu/jammy false false
ubuntu/jammy false true
ubuntu/jammy false false

I would appreciate some extra testing because a previous attempt (#559) caused many regressions. My hope is those regressions happened because NoNewPrivileges has interactions with mount name spaces which didn't work in the security.nesting=false case.

Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
@monstermunchkin
Copy link
Member

@simondeziel I tested the relevant images, and they seem to behave just fine.

@simondeziel
Copy link
Contributor Author

Thanks @monstermunchkin for the test drive, I really appreciate it!

@simondeziel simondeziel marked this pull request as ready for review April 20, 2022 20:43
@monstermunchkin monstermunchkin merged commit 75f5c91 into lxc:master Apr 20, 2022
@simondeziel simondeziel deleted the systemd-nested branch April 20, 2022 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants