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

PB-6687 :: Placing PX secret in nfsrestore job spec #360

Merged
merged 1 commit into from
May 3, 2024
Merged

Conversation

vikasit12
Copy link
Collaborator

@vikasit12 vikasit12 commented Apr 22, 2024

What this PR does / why we need it:
This PR gets secret env from stork deploy used in nfs restore of secured portworx volumes. The access key retrieved is passed as env variable in nfs restore job to complete nfs restore

Which issue(s) this PR fixes (optional)
Closes #PB-6687

Special notes for your reviewer:
image
image

Test Cases combination performed:
Backup and restore

  1. Portworx (Across Cluster)
  2. Portworx + CSI + OFFLOAD ( Across Cluster )
  3. Portworx + KDMP ( Across Cluster )
  4. Portworx + CSI ( Same Cluster ) ( Retain ) ( Deleted App before Restore )
  5. BACKUP_TYPE = Generic

@@ -248,6 +248,11 @@ func jobForRestoreResource(
logrus.Infof("failed to get the px service name and namespace: %v", err)
return nil, fmt.Errorf("failed to get the px service name and namespace: %v", err)
}
//
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: remove this blank comment line.. or add some story here describing what scenario we need this secret fetching

Copy link
Contributor

@vsundarraj-px vsundarraj-px left a comment

Choose a reason for hiding this comment

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

This review is generated on the latest stork. Can you please rebase with master and then send PR. There are stale changes.

Also if there is vendor changes. Best to send it as seperate PR to have only the necessary changes show up in commit.

Value: pxSecretIssuer,
})
}
if len(pxSecretKey) != 0{
Copy link
Contributor

Choose a reason for hiding this comment

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

By setting the secretKey as ENV would make this visible to every one who has even pod view. If I understand from stork. The stork deployment only references the k8s secret reference name but the secretKey is embedded in the k8s secret. But here we are passing as job pod env. I am not sure if this becomes a security vulnerability.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

By setting the secretKey as ENV would make this visible to every one who has even pod view. If I understand from stork. The stork deployment only references the k8s secret reference name but the secretKey is embedded in the k8s secret. But here we are passing as job pod env. I am not sure if this becomes a security vulnerability.

This is a nfs restore job so once completed it gets deleted. Also stork can use that in such a manner because it resides in same namespace as of portworx but nfs restore will start in some other ns where that secret will not be present hence passing that as ENV.

Also anyone having job pod view right now can view these access keys from stork too as in pod it is an ENV variable only

Copy link
Contributor

Choose a reason for hiding this comment

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

@vikasit12 As discussed, let us please create the secret in the stork code ( Resourceexport reconciler code) and pass only the secret name and namespace similar to other secret like cred/cert/image registry secret.

@portworx portworx deleted a comment from github-actions bot May 2, 2024
@portworx portworx deleted a comment from github-actions bot May 2, 2024
@portworx portworx deleted a comment from github-actions bot May 2, 2024
@portworx portworx deleted a comment from github-actions bot May 2, 2024
@vikasit12 vikasit12 requested a review from vsundarraj-px May 2, 2024 13:44
@pallav-px pallav-px merged commit 2d70102 into master May 3, 2024
3 checks passed
vikasit12 added a commit that referenced this pull request May 6, 2024
This reverts commit 2d70102, reversing
changes made to 31782fe.
vikasit12 added a commit that referenced this pull request May 6, 2024
This reverts commit 2d70102, reversing
changes made to 31782fe.
@vikasit12 vikasit12 deleted the PB-6687 branch May 9, 2024 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants