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

selinux-policy: allow api helpers to modify state files #1247

Merged
merged 1 commit into from
Dec 18, 2020

Conversation

tjkirch
Copy link
Contributor

@tjkirch tjkirch commented Dec 17, 2020

Specifically, this allows the host-containers program to write user-data files
to the host container's persistent storage area when modified by API calls
after boot, when host-containers is spawned by apiserver (through
thar-be-settings).  Without this, it only works at boot time, because it's
called outside of the apiserver context.

Related: #1244, which adds the user-data key.

Testing done:

Before, changing host-container user-data after boot wouldn't work, and I saw host-containers give a permission denied error when trying to write the user-data file. This AVC denial was in dmesg:

audit: type=1400 audit(1608167357.016:3): avc:  denied  { write } for  pid=9016 comm="host-containers" name="admin" dev="nvme1n1p1" ino=1177347 scontext=system_u:system_r:api_t:s0 tcontext=system_u:object_r:state_t:s0 tclass=dir permissive=0

After, it works:

bash-5.0# apiclient -u /settings -m PATCH -d '{"host-containers": {"admin": {"user-data": "aGkgdGhlcmUKaG93IGFyZSB5b3UK"}}}'
bash-5.0# apiclient -u /tx/commit_and_apply -m POST  
["settings.host-containers.admin.user-data"]
bash-5.0# cat /local/host-containers/admin/user-data 
hi there
how are you

Terms of contribution:

By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.

Specifically, this allows the host-containers program to write user-data files
to the host container's persistent storage area when modified by API calls
after boot, when host-containers is spawned by apiserver (through
thar-be-settings).  Without this, it only works at boot time, because it's
called outside of the apiserver context.
@tjkirch tjkirch merged commit b785d20 into bottlerocket-os:develop Dec 18, 2020
@tjkirch tjkirch deleted the api-local-selinux branch December 18, 2020 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants