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

Update pki_helpers.go #122040

Closed
wants to merge 1 commit into from
Closed

Conversation

DeeptanshuDas
Copy link

@DeeptanshuDas DeeptanshuDas commented Nov 25, 2023

revoke world-accessible permissions that are unnecessary

What type of PR is this?

/kind documentation

What this PR does / why we need it:

revoke world-accessible permissions that are unnecessary to make the file give the written permission to the owner of a file.

Which issue(s) this PR fixes:

Fixes #81116

revoke world-accessible permissions  that are unnecessary
@k8s-ci-robot
Copy link
Contributor

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

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 kind/documentation Categorizes issue or PR as related to documentation. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Nov 25, 2023
@k8s-ci-robot
Copy link
Contributor

Please note that we're already in Test Freeze for the release-1.29 branch. This means every merged PR will be automatically fast-forwarded via the periodic ci-fast-forward job to the release branch of the upcoming v1.29.0 release.

Fast forwards are scheduled to happen every 6 hours, whereas the most recent run was: Sat Nov 25 10:00:10 UTC 2023.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Nov 25, 2023
@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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 needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 25, 2023
@k8s-ci-robot
Copy link
Contributor

Hi @DeeptanshuDas. 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 needs-priority Indicates a PR lacks a `priority/foo` label and requires one. label Nov 25, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: DeeptanshuDas
Once this PR has been reviewed and has the lgtm label, please assign sataqiu for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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 area/kubeadm sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Nov 25, 2023
@@ -218,7 +218,7 @@ func WriteCSR(csrDir, name string, csr *x509.CertificateRequest) error {
return errors.Wrapf(err, "failed to make directory %s", filepath.Dir(csrPath))
}

if err := os.WriteFile(csrPath, EncodeCSRPEM(csr), os.FileMode(0600)); err != nil {
if err := os.WriteFile(csrPath, EncodeCSRPEM(csr), os.FileMode(0600) | os.FileMode(syscall.S_IWUSR)); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

revoke world-accessible permissions that are unnecessary to make the file give the written permission to the owner of a file.

the permission used to be 644, but now it's 600.
#81116

600 already means RW only for the owner, which in kubeadm's case is root.

Copy link
Author

Choose a reason for hiding this comment

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

it make less error than 600

Copy link
Member

@neolit123 neolit123 Nov 27, 2023

Choose a reason for hiding this comment

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

that's not how IWUSR works.

see this:

package main

import (
	"fmt"
	"os"
	"syscall"
)

func main() {
	fmt.Printf("%v\n", os.FileMode(0600))
	fmt.Printf("%v\n", os.FileMode(syscall.S_IWUSR)|os.FileMode(syscall.S_IRUSR))
	fmt.Printf("%v\n", os.FileMode(0600)|os.FileMode(syscall.S_IWUSR))
}
-rw-------
-rw-------
-rw-------

closing as 600 already fixed the problem.

/close

@k8s-ci-robot
Copy link
Contributor

@neolit123: Closed this PR.

In response to this:

that's not how IWUSR wokrs.

see this:

package main

import (
  "fmt"
  "os"
  "syscall"
)

func main() {
  fmt.Printf("%v\n", os.FileMode(0600))
  fmt.Printf("%v\n", os.FileMode(syscall.S_IWUSR)|os.FileMode(syscall.S_IRUSR))
  fmt.Printf("%v\n", os.FileMode(0600)|os.FileMode(syscall.S_IWUSR))
}
-rw-------
-rw-------
-rw-------

closing as 600 already fixed the problem.

/close

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
area/kubeadm cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. kind/documentation Categorizes issue or PR as related to documentation. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TOB-K8S-004: Pervasive world-accessible file permissions
3 participants