mirror of https://github.com/k3s-io/k3s
Add validation for KUBE_USER
Malformed KUBE_USER causes error in cluster setup.pull/6/head
parent
9a9c98912b
commit
acea7040bc
|
@ -755,7 +755,7 @@ function start-kube-apiserver {
|
||||||
if [[ -n "${KUBE_USER:-}" ]]; then
|
if [[ -n "${KUBE_USER:-}" ]]; then
|
||||||
local -r abac_policy_json="${src_dir}/abac-authz-policy.jsonl"
|
local -r abac_policy_json="${src_dir}/abac-authz-policy.jsonl"
|
||||||
remove-salt-config-comments "${abac_policy_json}"
|
remove-salt-config-comments "${abac_policy_json}"
|
||||||
sed -i -e "s@{{kube_user}}@${KUBE_USER}@g" "${abac_policy_json}"
|
sed -i -e "s/{{kube_user}}/${KUBE_USER}/g" "${abac_policy_json}"
|
||||||
cp "${abac_policy_json}" /etc/srv/kubernetes/
|
cp "${abac_policy_json}" /etc/srv/kubernetes/
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -1115,6 +1115,14 @@ if [[ ! -e "${KUBE_HOME}/kube-env" ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
source "${KUBE_HOME}/kube-env"
|
source "${KUBE_HOME}/kube-env"
|
||||||
|
|
||||||
|
if [[ -n "${KUBE_USER:-}" ]]; then
|
||||||
|
if ! [[ "${KUBE_USER}" =~ ^[-._@a-zA-Z0-9]+$ ]]; then
|
||||||
|
echo "Bad KUBE_USER format."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
config-ip-firewall
|
config-ip-firewall
|
||||||
create-dirs
|
create-dirs
|
||||||
ensure-local-ssds
|
ensure-local-ssds
|
||||||
|
|
Loading…
Reference in New Issue