fix: remove --gateway-insecure by adding route FQDN to cert SAN and automating CA trust - #42
Draft
LinoyBitan1 wants to merge 2 commits into
Draft
Conversation
…utomating CA trust The gateway generated TLS certs with only host.openshell.internal as a SAN, so the CLI rejected the cert when connecting via the external route hostname. This required --gateway-insecure everywhere. Fix: - Add routeHost helper that resolves from route.host or global.clusterDomain - Cloud-init writes OPENSHELL_ROUTE_FQDN to gateway.env and creates a systemd override adding the route FQDN as an additional --server-san - openshell-saw-create.sh computes the route hostname from the cluster's ingress domain and passes it to Helm via --set route.host - New export-ca-cert.sh setup Job phase extracts the CA cert from the VM and stores it in a Kubernetes Secret (<name>-gateway-ca) - configure-gateway target reads the CA cert from the Secret and places it at ~/.config/openshell/gateways/<name>/mtls/ca.crt - Remove --gateway-insecure from all Makefile targets, scripts, and README
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix gateway TLS verification end-to-end by adding the external route FQDN to the gateway certificate SANs and automating CA certificate distribution to the CLI.
Stop requiring
--gateway-insecureby putting the route FQDN on the gateway cert SAN and copying the CA to the CLI.The cert was issued only for host.openshell.internal, so the CLI rejected the OpenShift route hostname. Cloud-init
writes a systemd drop-in with --server-san ; the setup Job daemon-reloads and restarts the gateway so that drop-in is used. The Job then puts the VM CA in Secret -gateway-ca. make openshell-saw-configure-gateway copies it to ~/.config/openshell/gateways//mtls/ca.crt before registering the gateway, and fails if the Secret is missing.
--gateway-insecureis removed from Makefile targets, README, and helper scripts.Jira: APPENG-5921
Background
The
openshellCLI already supports trusting a custom CA at~/.config/openshell/gateways/<name>/mtls/ca.crt, but two things prevented it from working:--server-san host.openshell.internal, but the external route hostname (e.g.openshell-saw-gateway-openshell-agents.apps.<cluster>) was not included. The CLI rejected the certificate withcertificate not valid for name.As a result, every CLI invocation required
--gateway-insecure.Changes
_helpers.tpl—openshell-sandbox.routeHostcomputes the external route FQDN fromroute.hostorglobal.clusterDomain.cloudinit-sandbox.yaml— writesOPENSHELL_ROUTE_FQDNintogateway.envand a user systemd drop-in (route-san.conf) that adds the route FQDN as an extra--server-san.upgrade-openshell.sh—daemon-reload && restartof the user gateway unit so the drop-in is picked up after the binary upgrade (first-boot setup may already have loaded the unit before the drop-in existed).export-ca-cert.sh— new setup Job phase: SSH the CA off the VM into Secret<name>-gateway-ca;return 1if the file is missing so the Job retries instead of succeeding with no Secret.run-setup.sh— sourcesexport-ca-cert.shafter the OpenShell upgrade.openshell-saw-create.sh— setsroute.hostfrom the cluster ingress domain so the quickstart path always has a FQDN.Makefile-quickstart— removed--gateway-insecure.configure-gatewaycopies the CA from the Secret intomtls/ca.crt, fails if it is missing, thengateway add/select.README.md— removed--gateway-insecurefrom examples.demo-governance.sh,governance-profile.sh,openshell-saw-gui.sh— removed--gateway-insecureandgrep -v 'TLS certificate'pipes.Verification
make openshell-saw-configure-gatewaycopies the CA certificate to the CLI configopenshell sandbox listworks without--gateway-insecure--gateway-insecureis fully removed from Makefile targets and README