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

local tls: add ca cert export and documentation + argo cert #1903

Merged
merged 7 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
wikibase-local-ca.crt

6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ help:
{ printf " %-20s %s\n", $$1, $$2 }; \
'

.PHONY: local-ca
local-ca: # @HELP Get the CA certificate that is used in the local environment
local-ca:
kubectl get secret wikibase-local-tls -o json | jq -r '.data."ca.crt"' | base64 -d > wikibase-local-ca.crt
realpath wikibase-local-ca.crt

.PHONY: minikube-start
minikube-start: # @HELP Start a local k8s cluster using minikube
minikube-start:
Expand Down
11 changes: 10 additions & 1 deletion doc/local-dev-env.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,15 @@ sudo wget https://raw.githubusercontent.com/roboll/helmfile/master/autocomplete/
sudo sh -c 'skaffold completion bash > /usr/share/bash-completion/completions/skaffold'
```

## [Optional] install local CA certificate
Since we [introduced](https://phabricator.wikimedia.org/T378691) using HTTPS for local ingresses, you will get a scary warning when accessing local web interfaces. This can be mitigated by trusting the local CA certificate that is getting used for self-signing. The easiest way to do this is to save the local CA certificate in a file by accessing the secret it lives in (`wikibase-local-tls`) and importing it in your browser settings. There is also the possibility to import it into the trust store of your operating system, for example via the tool [mkcert](https://github.com/FiloSottile/mkcert), but you should be aware of the possible consequences this could have for the security of your machine.

> [!TIP]
> Running `make local-ca` will save the certificate to the file `wikibase-local-tls.crt`. It is highly recommended to delete the file again after importing it.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
> Running `make local-ca` will save the certificate to the file `wikibase-local-tls.crt`. It is highly recommended to delete the file again after importing it.
> Running `make local-ca` will save the certificate to the file `wikibase-local-tls.crt`.

If I understand correctly a certificate isn't something secret we need to protect. Deleting it would be convenient for not getting mixed up but it's not the tls.key which I think is what you want to keep secret


> [!NOTE]
> If you recreate your local cluster, you have to re-import the CA certificate, as a new one will get generated and used instead.

## Testing changes
[skaffold](https://skaffold.dev) is used to load changes made in other repositories (e.g. `api`, `mediawiki`, `quickstatements`, etc) into the pods running in minikube. See the [README](../skaffold/README.md) in the skaffold directory for details on how to use.

Expand All @@ -270,7 +279,7 @@ it is likely because `make diff-local` uses the `--skip-deps` option when execut
Here are a few things to try:
- make sure minikube is running `make minikube-start`
- make sure the minikube tunnel is running `make minikube-tunnel`
- make sure you are using http:// and not https:// (there are no TLS certificates)
- make sure you are using https:// and not http://
- check the health of your pods `kubectl --profile minikube-wbaas get pods`

### **API isn't running // Some pods are missing**
Expand Down
4 changes: 0 additions & 4 deletions k8s/helmfile/env/local/argo-cd-base.values.yaml.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,3 @@ server:
ingress:
enabled: true
ingressClassName: nginx
annotations:
nginx.ingress.kubernetes.io/force-ssl-redirect: "false"
nginx.ingress.kubernetes.io/ssl-passthrough: "false"
tls: false
9 changes: 8 additions & 1 deletion k8s/helmfile/env/local/certificates.values.yaml.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,11 @@ certificates:
- '*.wbaas.localhost'
- 'wbaas.localhost'
secretName: wikibase-local-tls
issuerRef: selfsigned-cluster-issuer
issuerRef: wikibase-local-issuer
- name: argocd-server-tls
namespace: argocd
commonName: argo.wbaas.localhost
dnsNames:
- 'argo.wbaas.localhost'
secretName: argocd-server-tls
issuerRef: wikibase-local-issuer
4 changes: 2 additions & 2 deletions k8s/helmfile/helmfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ releases:
- name: clusterissuers
namespace: cert-manager
chart: wbstack/wikibase-cloud-clusterissuers
version: 0.2.0
version: 0.2.1
values:
- email: {{ .Values.external.letsencrypt.email }}
- gceProject: {{ .Values.gceProject }}
Expand All @@ -95,7 +95,7 @@ releases:
- name: certificates
namespace: default
chart: wbstack/certificates
version: 0.1.0
version: 0.1.1
<<: *default_release

- name: argocd-config
Expand Down
Loading