8000 stage1: execute pre-start/post-stop hooks as privileged by iaguis · Pull Request #3844 · rkt/rkt · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Feb 24, 2020. It is now read-only.

stage1: execute pre-start/post-stop hooks as privileged #3844

Merged
merged 2 commits into from
Nov 22, 2017

Conversation

iaguis
Copy link
Member
@iaguis iaguis commented Nov 10, 2017

Even if we run the container as an unprivileged user.

Usually, pre-start and post-stop are used to initialize or shut down a
service, and very often this needs privileges.

Even if we run the container as an unprivileged user.

Usually, pre-start and post-stop are used to initialize or shut down a
service, and very often this needs privileges.
@alban
Copy link
Member
alban commented Nov 16, 2017

Sounds good but:

  • any test for it?
  • I wonder if it should be documented somewhere. I didn't find a good place though.

@iaguis
Copy link
Member Author
iaguis commented Nov 16, 2017

I'll add a test

@iaguis
Copy link
Member Author
iaguis commented Nov 16, 2017

Apparently this requires #3830 because pre-start hooks don't work with iottymux without it.

However the test that fails in Semaphore passes on my laptop 🤔

@iaguis
Copy link
Member Author
iaguis commented Nov 21, 2017

There's currently a bug when using iottymux with pre-start hooks, it involves a systemd bug I tried to fix in systemd/systemd#7072 but it needs rework to be merged upstream.

That's why the test was failing on Semaphore and passing on my laptop (I was using stage1-src with the systemd fix included).

I'll rework my test code so I only add pre-start hooks for that particular test.

8000

Copy link
Member
@alban alban left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small changes requested


prestartManifestFile := "prestart-manifest.json"
if err := ioutil.WriteFile(prestartManifestFile, []byte(prestartManifestStr), 0600); err != nil {
t.Fatalf("Cannot write noapp manifest: %v", err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copy/paste: this is not a "noapp" manifest

ctx := testutils.NewRktRunCtx()
defer ctx.Cleanup()

rktCmd := fmt.Sprintf("%s --insecure-options=image run --mds-register=false %s", ctx.Cmd(), prestartImage)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mds-register is false by default. Could be removed

@alban
Copy link
Member
alban commented Nov 22, 2017

There's currently a bug when using iottymux with pre-start hooks, it involves a systemd bug I tried to fix in systemd/systemd#7072 but it needs rework to be merged upstream.

Does it mean we should not merge this PR until rkt uses a systemd version with a fix?

It tests that the pre-start hook runs and that it runs as root even when
the app itself runs as an unprivileged user.
@iaguis iaguis force-pushed the iaguis/pre-start-root branch from 9f0437c to 01b7478 Compare November 22, 2017 11:17
@iaguis
Copy link
Member Author
iaguis commented Nov 22, 2017

Does it mean we should not merge this PR until rkt uses a systemd version with a fix?

No, I changed the tests so we only add a pre-start hook in the new test. Before it was adding the pre-start hook to the default inspect image and causing tests that run with RKT_EXPERIMENT_ATTACH to fail.

I captured the comment in a new issue #3861

Copy link
Member
@alban alban left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since #3861 is not a regression caused by this PR, LGTM.

@iaguis iaguis merged commit bdbcf98 into rkt:master Nov 22, 2017
@iaguis iaguis added this to the 1.30.0 milestone Apr 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0