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

Add new flag --user and to log executed commands #10106

Merged
merged 7 commits into from
Jan 26, 2021

Conversation

spowelljr
Copy link
Member

@spowelljr spowelljr commented Jan 7, 2021

Implements #10041

Example log:

% cat .minikube/logs/audit.json
{"data":{"args":"--user user1","command":"start","endTime":"Thu, 14 Jan 2021 16:21:04 MST","profile":"minikube","startTime":"Thu, 14 Jan 2021 16:20:18 MST","user":"user1"},"datacontenttype":"application/json","id":"042ad16a-79fe-461d-aec7-375c413c52f8","source":"https://minikube.sigs.k8s.io/","specversion":"1.0","type":"io.k8s.sigs.minikube.audit"}
{"data":{"args":"--user user2","command":"delete","endTime":"Thu, 14 Jan 2021 16:21:27 MST","profile":"minikube,"startTime":"Thu, 14 Jan 2021 16:21:24 MST","user":"user2"},"datacontenttype":"application/json","id":"5b88b158-b9c4-4a25-b3db-fde1eb81563c","source":"https://minikube.sigs.k8s.io/","specversion":"1.0","type":"io.k8s.sigs.minikube.audit"}

Pretty-print of entry

{
  "data": {
    "args": "--user test123 --alsologtostderr",
    "command": "start",
    "endTime": "Thu, 14 Jan 2021 16:21:04 MST",
    "profile": "minikube",
    "startTime": "Thu, 14 Jan 2021 16:20:18 MST",
    "user": "testUser"
  },
  "datacontenttype": "application/json",
  "id": "042ad16a-79fe-461d-aec7-375c413c52f8",
  "source": "https://minikube.sigs.k8s.io/",
  "specversion": "1.0",
  "type": "io.k8s.sigs.minikube.audit"
}

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 7, 2021
@k8s-ci-robot
Copy link
Contributor

Hi @spowelljr. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jan 7, 2021
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jan 7, 2021
@minikube-bot
Copy link
Collaborator

Can one of the admins verify this patch?

cmd/minikube/cmd/start_flags.go Outdated Show resolved Hide resolved
cmd/minikube/cmd/audit.go Outdated Show resolved Hide resolved
cmd/minikube/cmd/audit.go Outdated Show resolved Hide resolved
cmd/minikube/cmd/audit.go Outdated Show resolved Hide resolved
site/content/en/docs/commands/start.md Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-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 7, 2021
@spowelljr spowelljr force-pushed the userFlag branch 2 times, most recently from 41a9cbc to 4a7ce31 Compare January 8, 2021 00:08
pkg/minikube/out/register/json.go Outdated Show resolved Hide resolved
pkg/minikube/out/register/log.go Outdated Show resolved Hide resolved
cmd/minikube/cmd/root.go Show resolved Hide resolved
@medyagh medyagh changed the title WIP: Add user flag and log executed commands WIP: Add new flag --user and to log executed commands Jan 8, 2021
cmd/minikube/cmd/root.go Show resolved Hide resolved
pkg/minikube/audit/audit.go Outdated Show resolved Hide resolved
pkg/minikube/audit/audit.go Outdated Show resolved Hide resolved
@medyagh
Copy link
Member

medyagh commented Jan 8, 2021

additionally, I am curious does this design allow us to ban one of the commands from auditing ?
for example in some 3rd party tool they call "minikube status" every second, this could result in recording a large audit footprint just for status.

maybe we could either disable it for not intrusive operations such as "status" or "version"

@spowelljr spowelljr force-pushed the userFlag branch 6 times, most recently from ca1fe41 to a4f0350 Compare January 14, 2021 22:08
@spowelljr
Copy link
Member Author

additionally, I am curious does this design allow us to ban one of the commands from auditing ?
for example in some 3rd party tool they call "minikube status" every second, this could result in recording a large audit footprint just for status.

maybe we could either disable it for not intrusive operations such as "status" or "version"

Added functionality to not run on specified commands.

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jan 20, 2021
@medyagh
Copy link
Member

medyagh commented Jan 20, 2021

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 20, 2021
@medyagh medyagh requested review from medyagh and tstromberg January 20, 2021 23:37
pkg/minikube/config/config.go Outdated Show resolved Hide resolved
test/integration/json_output_test.go Outdated Show resolved Hide resolved
Copy link
Member

@medyagh medyagh left a comment

Choose a reason for hiding this comment

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

please add Basic Validaiton for user flag
for example dont allow more than ...X.. Length username.

@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 22, 2021
pkg/minikube/config/user.go Outdated Show resolved Hide resolved
pkg/minikube/audit/audit.go Outdated Show resolved Hide resolved
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: medyagh, spowelljr

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

The pull request process is described here

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 26, 2021
@medyagh medyagh merged commit 597091d into kubernetes:master Jan 26, 2021
@spowelljr spowelljr deleted the userFlag branch June 28, 2021 17:40
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants