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

Vault Init script #4

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open

Vault Init script #4

wants to merge 25 commits into from

Conversation

v-starodubov
Copy link
Collaborator

This is small rework of #3 request, related to #2

Changes:

  • Lightweight and secure Docker image that contains all scripts required.
  • Init scripts reworked to make API requests directly to k8s API server and Vault API without requiring installed kubectl (and corresponding RBAC permissions in cluster)
  • Removed unnecessary dynamic RBAC manifests creation. We don't need to modify them dynamically.
  • Deleted external-secrets dependency, because right now it don't have required namespace label for umbrella chart deployment (Changes requested)
  • Removed ESO manifests and created templates/tests cases for helm test runs (requires installed ESO)
  • Added helm repository, hosted here in helm-repo branch.
  • GitHub Actions: build and scan Docker image with Trivy (triggered on tag with proper semver formating), helm packaging and deploying on changes in vault/Chart.yaml.
  • Updated README.md with proper commands.

@v-starodubov v-starodubov requested a review from jradikk February 5, 2024 16:37
@v-starodubov v-starodubov self-assigned this Feb 5, 2024
@v-starodubov
Copy link
Collaborator Author

v-starodubov commented Feb 5, 2024

Currently this branch is not fully tested and can contain some errors during run.
I'll update this PR with ready to review when everything is done.

Signed-off-by: Volodymyr Starodubov <[email protected]>
@v-starodubov v-starodubov marked this pull request as ready for review February 7, 2024 19:18
@v-starodubov
Copy link
Collaborator Author

@jradikk ready to review.

ignore-unfixed: true
severity: 'CRITICAL,HIGH'
exit-code: '1'
format: 'table'
Copy link

Choose a reason for hiding this comment

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

I think Github supports using nice reports for security findings. Although, it might require a subscription. Can you check that please? If it's not an option, let's think about maybe using badges in README or anything else that comes with a nicer UI than a log

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There two possible ways:

I don't know which is better, so I'll test both.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Choosed SARIF code scanning, because SBOM not working with non-default branches and tags. Example of medium severity report: https://github.com/Alpacked/security-hardening-helm/security/code-scanning/1

Another question about severity of reports, we can have all types in Security tab and GitHub will create alerts only for high and higher thresholds.
Or left or mechanism as is, create security findings only for HIGH and CRITICAL vulnerabilities?
Screenshot 2024-02-14 at 15 24 37
Screenshot 2024-02-14 at 15 19 04

Copy link

Choose a reason for hiding this comment

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

Let's capture all of them, but fail the build and alert for high and critical only

Copy link
Collaborator Author

@v-starodubov v-starodubov Feb 14, 2024

Choose a reason for hiding this comment

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

If we want use SARIF/Code scanning reports, we can't fail our pipeline during scan action because it will prevent results from uploading. I'm thinking on two options:

  1. (Lame) Make second scan right before pushing to Docker Hub.
  2. Build and scan at (master) branch push (restrict to paths: scripts/*.sh and Dockerfile), build and push at tag push (will be restricted by ruleset if there high or higher errors not resolved).

What do you think?

Copy link

Choose a reason for hiding this comment

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

Is there an option to create a some sort of an artifact or a variable that would contain a boolean value, based on which a push job is triggered?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Found a workaround for how to run the upload step even if 'scan' found some vulnerabilities, but if SARIF isn't limited by our rule (we can upload a full file with 'limit-severities-for-sarif' parameter) it will always fail if some vulnerabilities are found.

So in that case we need to limit SARIF output to our HIGH and CRITICAL, until trivy-action change something.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Created issue in trivy-action repository: aquasecurity/trivy-action#309

For now, security findings will be limited by high and critical vulnerabilities.

- Removing vaultInit.serviceAccount
- Moving image values to values root
- Iterating for enabled inits for manifests: jobs, roles, rolebindings

Signed-off-by: Volodymyr Starodubov <[email protected]>
Signed-off-by: Volodymyr Starodubov <[email protected]>
Signed-off-by: Volodymyr Starodubov <[email protected]>
Signed-off-by: Volodymyr Starodubov <[email protected]>
Signed-off-by: Volodymyr Starodubov <[email protected]>
Signed-off-by: Volodymyr Starodubov <[email protected]>
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.

3 participants