refactor: update Kanidm password reset script to reset any account

https://github.com/khuedoan/homelab/issues/130
This commit is contained in:
Khue Doan 2024-01-18 20:18:47 +07:00
parent bd0d7b556d
commit f3e3fa22ec
2 changed files with 6 additions and 1 deletions

View File

@ -1,5 +1,9 @@
#!/bin/sh #!/bin/sh
set -eu
account="${1}"
echo "WARNING: Kanidm admin can do anything in the cluster, only use it for just enough initial setup or in emergencies." >&2 echo "WARNING: Kanidm admin can do anything in the cluster, only use it for just enough initial setup or in emergencies." >&2
export KUBECONFIG=./metal/kubeconfig.yaml export KUBECONFIG=./metal/kubeconfig.yaml
kubectl exec -it -n kanidm statefulset/kanidm -- kanidmd recover-account admin kubectl exec -it -n kanidm statefulset/kanidm -- kanidmd recover-account "${account}"

View File

@ -4,6 +4,7 @@ username="${1}"
fullname="${2}" fullname="${2}"
mail="${3}" mail="${3}"
export KUBECONFIG=./metal/kubeconfig.yaml
host="$(kubectl get ingress --namespace kanidm kanidm --output jsonpath='{.spec.rules[0].host}')" host="$(kubectl get ingress --namespace kanidm kanidm --output jsonpath='{.spec.rules[0].host}')"
kanidm person create "${username}" "${fullname}" --url "https://${host}" --name idm_admin kanidm person create "${username}" "${fullname}" --url "https://${host}" --name idm_admin