-
Notifications
You must be signed in to change notification settings - Fork 462
pkg/daemon: detect ssh accesses before daemon started #381
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
pkg/daemon: detect ssh accesses before daemon started #381
Conversation
049ffe4 to
ce09d42
Compare
|
/test unit |
ce09d42 to
afb2de2
Compare
|
so tests all fail because we're missing the |
93dcf8f to
8613c23
Compare
|
I think right now it's failing because it's trying to link it for all the container builds but the dep was only added for the daemon Dockerfiles. @abhinavdahiya mentioned in #335 (comment) that we should only turn on (Also, can you do the vendoring part as a separate commit; can probably just cherry-pick 1068940 :)). |
|
I believe the build container is derived from https://github.com/openshift/release/blob/a30cd48207d5f7244ed492450e111c6fbde5b757/projects/origin-release/golang-1.10/Dockerfile I'm not sure about precedent for either adding to it or making a new one (or a derived container). |
@jlebon I did that but still fails cause we're probably using another Dockerfile and image in tests (???)
@jlebon is
thanks, I'll check that out |
|
While it may seem like a hack honestly I'd say we just fork off that |
that's fine with me, let's see how it goes when adding a build dep on the release image openshift/release#2783 |
8613c23 to
10b54e4
Compare
pkg/daemon/daemon.go
Outdated
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.
We don't even need to check the MESSAGE here. The msg id already represents the event we're looking for.
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.
Also, there's no need for a for loop here, right? We can just .Next() and then .GetEntry() sequentially.
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.
for the second point, just 1 entry is already enough to mark the node ssh/accessed so yeah, no need for a loop or sequentially calling GetEntry
I've just been doing |
|
Running this locally shows: |
|
yes, we're waiting for openshift/release#2783 or go raw journalctl |
43060b1 to
26f97f6
Compare
|
/retest |
1 similar comment
|
/retest |
|
openshift/release#2783 merged |
|
/retest |
1 similar comment
|
/retest |
|
So rhel-images will fail until the upstream change makes it there. Not sure how long that will take. |
hack/build-go.sh
Outdated
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 made this conditional on the MCD only in c02eb5d#diff-9283775b0feecc10455ec28bd08983b0.
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.
Hmm, actually that might not work. It looks like other components will then fail to build. From #335:
--> RUN WHAT=machine-config-controller ./hack/build-go.sh
Using version from git...
Building github.com/openshift/machine-config-operator/cmd/machine-config-controller (v3.11.0-589-gf62a5cf6-dirty)
vendor/github.com/coreos/go-systemd/sdjournal/functions.go...machine-config-operator/vendor/github.com/coreos/pkg/dlopen
error: build error: running 'WHAT=machine-config-controller ./hack/build-go.sh' failed with exit code 1
I'm not familiar enough with the golang build system, but it seems like it's trying to bundle all the vendored packages for all the targets instead of only the ones that actually need 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.
it's because the daemon package imports other packages (controller|server) and the build system bundle them together and that's why it's required for other components as well.
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.
You can use build tags to include / build files only when those tags are set...
https://golang.org/pkg/go/build/#hdr-Build_Constraints
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.
yeah, but that's gonna require some refactor as well
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.
my point is yeah, we're going to refactor for build tags but I guess for this PR we can ship with CGO_ENABLED=1 anyway, I'm creating a new issue to track this.
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.
26f97f6 to
a75271c
Compare
|
a75271c to
ad90c63
Compare
|
rebased and removed the vendoring since #335 pulled it already This should be ready |
ad90c63 to
0a7bdad
Compare
|
/retest |
1 similar comment
|
/retest |
jlebon
left a comment
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.
Just one minor nit, otherwise LGTM!
pkg/daemon/daemon.go
Outdated
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.
Minor: could avoid the indentation here by checking for 0 and returning early.
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.
thanks, fixed
Reads the journal checking for logind message ID and annotates the node with the ssh accessed label if it finds out there were previous accesses. Signed-off-by: Antonio Murdaca <[email protected]>
0a7bdad to
77cd586
Compare
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jlebon, runcom The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/retest |
1 similar comment
|
/retest |
Reads the journal checking for logind message ID and annotates the node
with the ssh accessed label if it finds out there were previous
accesses.
Close #379
Signed-off-by: Antonio Murdaca [email protected]