Skip to content

daemon: Rework taints to use logind directly - #291

Closed
cgwalters wants to merge 3 commits into
openshift:masterfrom
cgwalters:watch-for-login
Closed

cgwalters wants to merge 3 commits into
openshift:masterfrom
cgwalters:watch-for-login

Conversation

@cgwalters

Copy link
Copy Markdown
Member

This way nothing lives in the critical path of ssh to host; which
admins will turn to (ideally only) when something is badly wrong.
It's also just less code and keeps the functionality in one place.

Just add the basic skeleton.
This way nothing lives in the critical path of ssh to host; which
admins will turn to (ideally only) when something is badly wrong.
It's also just less code and keeps the functionality in one place.
@openshift-ci-robot openshift-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jan 11, 2019
@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 11, 2019
@cgwalters

Copy link
Copy Markdown
Member Author

I tested login sessions but not tainting yet.

/hold

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 11, 2019
@yuqi-zhang

Copy link
Copy Markdown
Contributor

I agree that this is likely a better path. However we still cannot apply taints at the moment as it would break e2e. I suggest for the time being, have this to write to motd to warn the user? (There is the problem of race condition between motd updates and the user seeing it upon login, though)

@cgwalters

Copy link
Copy Markdown
Member Author

(One minor point of trivia: this approach will also work if someone logs in on a "local" console; which you'd have to set a password via a MachineConfig to do. Think bare metal physical console, and most of the cloud providers offer a connection to a virtual console)

@cgwalters

cgwalters commented Jan 11, 2019 •

Copy link
Copy Markdown
Member Author

However we still cannot apply taints at the moment as it would break e2e.

Ah. So no matter what this code has to change. EDIT: Done ⬇️

(There is the problem of race condition between motd updates and the user seeing it upon login, though)

Yeah. My vote is we change the default /etc/motd to say something like:

WARNING: Direct ssh access to machines is not recommended.
In a future version of Red Hat CoreOS, this will cause nodes to become
tainted.

We still have to port the tests.
@openshift-ci-robot openshift-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 11, 2019
@cgwalters

Copy link
Copy Markdown
Member Author

Tested this patch stack and as expected it just results in some logs:

I0111 22:06:28.752824   69224 daemon.go:284] Detected a new logged in session: &{:1.2 /org/freedesktop/login1 org.freedesktop.login1.Manager.SessionNew [1 /org/freedesktop/login1/session/_31]}
I0111 22:06:28.752871   69224 daemon.go:285] Login session taints node
I0111 22:06:28.752994   69224 daemon.go:453] NOTE: In a future version of RHCOS this will taint the node

@yuqi-zhang

Copy link
Copy Markdown
Contributor

/retest

@cgwalters

Copy link
Copy Markdown
Member Author

/hold cancel

Although we still aren't decided if this is the way to go.

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 11, 2019
@yuqi-zhang

Copy link
Copy Markdown
Contributor

/retest

@yuqi-zhang

Copy link
Copy Markdown
Contributor

/retest
Appears to be network issues

@jlebon jlebon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Some minor suggestions, but looks sane to me overall. Will let others take a look.
/approve

Comment thread pkg/daemon/daemon.go
}
if err := dn.applySSHTaint(); err != nil {
glog.Errorf("Error during taint: cannot apply taint due to: %v", err)
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We'll need to remember to write any errors here to the exitCh once we enable this. Might be worth adding a comment about that somewhere in there.

Comment thread pkg/daemon/daemon.go
return
case msg := <-sessionNewCh:
glog.Infof("Detected a new logged in session: %v", msg)
glog.Infof("Login session taints node")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Minor: do we need this line given the logging in applySSHTaint already?

@openshift-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cgwalters, jlebon

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@yuqi-zhang

Copy link
Copy Markdown
Contributor

The one behaviour that could be an issue is, if the user ssh's in before the logind (or mcd for that matter) is ready, he may see an error message in the motd but the taint won't actually be applied.

The original case of the file allows for us to check the pre-existence of a write once the mcd is ready. That's potentially an edge case for this route.

@ashcrow

ashcrow commented Jan 12, 2019

Copy link
Copy Markdown
Member

/test e2e-aws

@ashcrow

ashcrow commented Jan 14, 2019

Copy link
Copy Markdown
Member

/test e2e-aws

Failures look unrelated to this PR.

@ashcrow

ashcrow commented Jan 16, 2019

Copy link
Copy Markdown
Member

/retest

@ashcrow

ashcrow commented Jan 16, 2019

Copy link
Copy Markdown
Member

Terraform failure flakes

@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@cgwalters: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
ci/prow/e2e-aws e7fc982 link /test e2e-aws
ci/prow/e2e-aws-op e7fc982 link /test e2e-aws-op

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@cgwalters: PR needs rebase.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 31, 2019
@ashcrow

ashcrow commented Jan 31, 2019

Copy link
Copy Markdown
Member

Rebase needed due to taint work being removed.

@cgwalters

Copy link
Copy Markdown
Member Author

/close

Superceded by #359

@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@cgwalters: Closed this PR.

Details

In response to this:

/close

Superceded by #359

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants