-
Notifications
You must be signed in to change notification settings - Fork 43
File permissions validations #355
base: master
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Assign the PR to them by writing 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 |
I've looked over this and the code changes look fine. When I have the incorrect permissions set now I get the following error:
Clearly a huge improvement on the output in #170. |
/lgtm |
/unassign |
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 a few comments from my side
/assign @JoshVanL
/unassign
pkg/tarmak/vault/vault.go
Outdated
return fmt.Errorf("failed to get vault root token '%s' file stat: %v", path, err) | ||
} | ||
|
||
if f.Mode() != os.FileMode(0600) { |
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 think we should be only checking if others and group are having a zero like that
(f.Mode() & 0077) == 0
pkg/tarmak/ssh/ssh.go
Outdated
err := fmt.Errorf("'%s' does not match permissions (0600): %v", path, f.Mode()) | ||
result = multierror.Append(result, err) | ||
continue | ||
} |
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 think we should be only checking if others and group are having a zero like that
(f.Mode() & 0077) == 0
@@ -281,20 +281,21 @@ func (t *Tarmak) Version() string { | |||
} | |||
|
|||
func (t *Tarmak) Validate() error { | |||
var err error | |||
var result error | |||
var result *multierror.Error |
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 think this whole method should just be calling to validateSSHSetup() or something like that
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.
Not too sure what you mean by this. tarmak.Validate() should only call to validateSSHSetup?
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.
New changes are detected. LGTM label has been removed. |
/assign @simonswine |
/unassign |
@JoshVanL: PR needs rebase. 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. |
@JoshVanL: The following test failed, say
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. 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. |
What this PR does / why we need it:
Adds validations to ensure 600 permissions on id_rsa, ssh_config and vault_root_token
fixes #170
/assign @charlieegan3