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

[bitnami/etcd] fix: healthcheck will failed when startup etcd with on… #70597

Merged
merged 1 commit into from
Sep 23, 2024

Conversation

chenraoCR
Copy link
Contributor

@chenraoCR chenraoCR commented Aug 6, 2024

Description of the change

modified the script healthcheck.sh to skip tls verification to allow startup etcd with one-way tls authentication

Benefits

Possible drawbacks

Applicable issues

Additional information

@github-actions github-actions bot added etcd triage Triage is needed labels Aug 6, 2024
@github-actions github-actions bot requested a review from javsalgar August 6, 2024 03:42
@javsalgar javsalgar added verify Execute verification workflow for these changes in-progress labels Aug 6, 2024
@github-actions github-actions bot removed the triage Triage is needed label Aug 6, 2024
@github-actions github-actions bot removed the request for review from javsalgar August 6, 2024 09:11
@chenraoCR
Copy link
Contributor Author

@andresbono @javsalgar so what's the progress of this PR?

Copy link
Contributor

@andresbono andresbono left a comment

Choose a reason for hiding this comment

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

Thank you for submitting this PR!

The changes you are proposing will affect several functions. Isn't adding --insecure-transport=false and --insecure-skip-tls-verify=true unconditionally too aggressive?

Maybe it could only be necessary when there is no ETCD_TRUSTED_CA_FILE? Or maybe it should be scoped to the healthcheck.sh script only.

Let me know your thoughts!

@chenraoCR
Copy link
Contributor Author

Thank you for submitting this PR!

The changes you are proposing will affect several functions. Isn't adding --insecure-transport=false and --insecure-skip-tls-verify=true unconditionally too aggressive?

Maybe it could only be necessary when there is no ETCD_TRUSTED_CA_FILE? Or maybe it should be scoped to the healthcheck.sh script only.

Let me know your thoughts!

ya, could only be necessary when there is no ETCD_TRUSTED_CA_FILE

@chenraoCR chenraoCR force-pushed the fix/bitnami/etcd/70554 branch 3 times, most recently from 455cc83 to 9b429b0 Compare August 20, 2024 06:19
@@ -307,7 +307,8 @@ etcdctl_auth_norbac_flags() {
authFlags+=("--cert" "${ETCD_DATA_DIR}/fixtures/client/cert.pem" "--key" "${ETCD_DATA_DIR}/fixtures/client/key.pem")
else
[[ -f "$ETCD_CERT_FILE" ]] && [[ -f "$ETCD_KEY_FILE" ]] && authFlags+=("--cert" "$ETCD_CERT_FILE" "--key" "$ETCD_KEY_FILE")
[[ -f "$ETCD_TRUSTED_CA_FILE" ]] && authFlags+=("--cacert" "$ETCD_TRUSTED_CA_FILE")
# if CA file exists, then use CA to verify server certs; otherwise, just skip server certs verification
[[ -f "$ETCD_TRUSTED_CA_FILE" ]] && authFlags+=("--cacert" "$ETCD_TRUSTED_CA_FILE") || authFlags+=("--insecure-transport=false --insecure-skip-tls-verify=true")
Copy link
Contributor

Choose a reason for hiding this comment

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

Is --insecure-transport=false necessary? We didn't have it set at

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ya, can remove it, and already updated it

@chenraoCR chenraoCR force-pushed the fix/bitnami/etcd/70554 branch 2 times, most recently from 750bb20 to 49c6d16 Compare August 21, 2024 05:55
@chenraoCR
Copy link
Contributor Author

@andresbono already updated, please kindly approve this PR

Comment on lines 310 to 311
# if CA file exists, then use CA to verify server certs; otherwise, just skip server certs verification
[[ -f "$ETCD_TRUSTED_CA_FILE" ]] && authFlags+=("--cacert" "$ETCD_TRUSTED_CA_FILE") || authFlags+=("--insecure-skip-tls-verify")
fi
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like there is some redundancy between setting --insecure-skip-tls-verify here and in the healthcheck.sh script. Do you think it can be simplified somehow?

For example, removing it from healthcheck.sh and apply the following change:

Suggested change
# if CA file exists, then use CA to verify server certs; otherwise, just skip server certs verification
[[ -f "$ETCD_TRUSTED_CA_FILE" ]] && authFlags+=("--cacert" "$ETCD_TRUSTED_CA_FILE") || authFlags+=("--insecure-skip-tls-verify")
fi
fi
# If CA file exists, then use CA to verify server certs; otherwise, just skip server certs verification
[[ -f "$ETCD_TRUSTED_CA_FILE" ]] && authFlags+=("--cacert" "$ETCD_TRUSTED_CA_FILE") || authFlags+=("--insecure-skip-tls-verify")
fi

But that could be insecure. Users not setting the recommended CA file would not notice it is missing, although it is recommended.

The other option is that you only set the flag in the healthcheck.sh script, changing the condition in which it is set so it fits you use case.

Copy link
Contributor

@andresbono andresbono left a comment

Choose a reason for hiding this comment

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

I added a new comment, please let me know your thoughts.

Copy link

This Pull Request has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thank you for your contribution.

@github-actions github-actions bot added the stale 15 days without activity label Sep 13, 2024
…e-way tls authentication (bitnami#70554)

Signed-off-by: Chen Rao <chenrao317328@163.com>
@chenraoCR
Copy link
Contributor Author

chenraoCR commented Sep 17, 2024

I added a new comment, please let me know your thoughts.

@andresbono just updated as u suggested, please kindly approve this PR

@github-actions github-actions bot removed the stale 15 days without activity label Sep 18, 2024
Copy link
Contributor

@andresbono andresbono left a comment

Choose a reason for hiding this comment

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

LGTM, thank you for your contribution!!

@andresbono andresbono merged commit 1a0f63f into bitnami:main Sep 23, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
etcd solved verify Execute verification workflow for these changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bitnami/etcd] bug: healthcheck will failed when startup etcd with one-way tls authentication
3 participants