- 
                Notifications
    
You must be signed in to change notification settings  - Fork 42
 
File permissions validations #355
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| 
          
            
          
           | 
    @@ -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 commentThe 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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more.  | 
||
| 
     | 
||
| err = t.Cluster().Validate() | ||
| if err != nil { | ||
| if err := t.Cluster().Validate(); err != nil { | ||
| result = multierror.Append(result, err) | ||
| } | ||
| 
     | 
||
| err = t.Cluster().Environment().Validate() | ||
| if err != nil { | ||
| if err := t.Cluster().Environment().Validate(); err != nil { | ||
| result = multierror.Append(result, err) | ||
| } | ||
| 
     | 
||
| if err := t.SSH().Validate(); err != nil { | ||
| result = multierror.Append(result, err) | ||
| } | ||
| 
     | 
||
| return result | ||
| return result.ErrorOrNil() | ||
| } | ||
| 
     | 
||
| func (t *Tarmak) Cleanup() { | ||
| 
          
            
          
           | 
    ||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| 
          
            
          
           | 
    @@ -261,3 +261,22 @@ func (v *Vault) VerifyInitFromFQDNs(instances []string, vaultCA, vaultKMSKeyID, | |
| 
     | 
||
| return fmt.Errorf("time out verifying that vault cluster is initialiased and unsealed: %s", err) | ||
| } | ||
| 
     | 
||
| func (v *Vault) Validate() error { | ||
| 
     | 
||
| path := v.rootTokenPath() | ||
| f, err := os.Stat(path) | ||
| if err != nil { | ||
| if os.IsNotExist(err) { | ||
| return nil | ||
| } | ||
| 
     | 
||
| return fmt.Errorf("failed to get vault root token '%s' file stat: %v", path, err) | ||
| } | ||
| 
     | 
||
| if f.Mode() != os.FileMode(0600) { | ||
                
       | 
||
| return fmt.Errorf("vault root token file '%s' does not match permissions (0600): %v", path, f.Mode()) | ||
| } | ||
| 
     | 
||
| return nil | ||
| } | ||
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