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

Automate generation of TLS Certs using Helm #779

Merged
merged 10 commits into from
Jun 3, 2021

Conversation

rahulchheda
Copy link
Contributor

@rahulchheda rahulchheda commented May 12, 2021

In this PR, I tried to create self-signed certificate for Terrascan Admission Controller using Helm. This seems to be a very simple implementation for this.

Signed-off-by: Rahul M Chheda rahul.chheda@accurics.com

Signed-off-by: Rahul M Chheda <rahul.chheda@accurics.com>
@codecov
Copy link

codecov bot commented May 12, 2021

Codecov Report

Merging #779 (2ec7934) into master (1839b24) will increase coverage by 3.36%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #779      +/-   ##
==========================================
+ Coverage   74.85%   78.22%   +3.36%     
==========================================
  Files         111      162      +51     
  Lines        3345     4354    +1009     
==========================================
+ Hits         2504     3406     +902     
- Misses        656      734      +78     
- Partials      185      214      +29     
Impacted Files Coverage Δ
pkg/config/config-reader.go 80.64% <0.00%> (-6.32%) ⬇️
pkg/utils/severity.go 94.11% <0.00%> (-5.89%) ⬇️
pkg/iac-providers/kubernetes/v1/load-file.go 71.87% <0.00%> (-4.13%) ⬇️
pkg/utils/json.go 68.75% <0.00%> (-2.68%) ⬇️
pkg/policy/opa/engine.go 64.40% <0.00%> (-1.18%) ⬇️
pkg/version/version.go 100.00% <0.00%> (ø)
pkg/http-server/start.go 0.00% <0.00%> (ø)
pkg/iac-providers/output/types.go 100.00% <0.00%> (ø)
pkg/iac-providers/helm/v3/load-dir.go 82.89% <0.00%> (ø)
pkg/iac-providers/kustomize/v3/types.go 100.00% <0.00%> (ø)
... and 57 more

Signed-off-by: Rahul M Chheda <rahul.chheda@accurics.com>
Signed-off-by: Rahul M Chheda <rahul.chheda@accurics.com>
@rahulchheda rahulchheda changed the title [WIP] Generate TLS Certs for Helm Automate generation of TLS Certs using Helm May 13, 2021
@rahulchheda rahulchheda marked this pull request as ready for review May 13, 2021 12:59
Signed-off-by: Rahul M Chheda <rahul.chheda@accurics.com>
@devang-gaur
Copy link
Contributor

@rahulchheda can you update the README there as well?

Copy link
Contributor

@devang-gaur devang-gaur left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution.

minor changes requested. please update the README.md for this feature.

{{ .Files.Get "data/server.key" | b64enc }}
cert: |-
{{ .Files.Get "data/server.crt" | b64enc }}
{{- if and (eq "" .Values.secrets.tlsCertFilePath) (eq "" .Values.secrets.tlsKeyFilePath) }}
Copy link
Contributor

Choose a reason for hiding this comment

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

either we should use or operator here or we should have additional else if cases that handle the cases where key is blank but cert is defined and vice versa.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

and would do the trick in this case, if any of the 2 keys are missing, it will error out somewhat like this: unknown object type "nil" in Secret.data.tls.crt

Copy link
Contributor

Choose a reason for hiding this comment

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

great!

deploy/helm-charts/values.yaml Outdated Show resolved Hide resolved
Signed-off-by: Rahul M Chheda <rahul.chheda@accurics.com>
…eature/auto-gen-secret

Signed-off-by: Rahul M Chheda <rahul.chheda@accurics.com>
…eature/auto-gen-secret

Signed-off-by: Rahul M Chheda <rahul.chheda@accurics.com>
@devang-gaur devang-gaur self-assigned this Jun 1, 2021
@devang-gaur devang-gaur added this to In progress in Main Board Jun 1, 2021
@amirbenv amirbenv removed this from In progress in Main Board Jun 1, 2021
Signed-off-by: Rahul M Chheda <rahul.chheda@accurics.com>
Signed-off-by: Rahul M Chheda <rahul.chheda@accurics.com>
Signed-off-by: Rahul M Chheda <rahul.chheda@accurics.com>
@sonarcloud
Copy link

sonarcloud bot commented Jun 3, 2021

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Contributor

@devang-gaur devang-gaur left a comment

Choose a reason for hiding this comment

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

LGTM. Working for me.

@devang-gaur devang-gaur merged commit 05e4db3 into tenable:master Jun 3, 2021
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.

Out of the box handling of certificates in helm charts for terrascan in Server mode
2 participants