import Downloads from './Downloads.js'; import GetCopy from './GetCopy.js'; export default { components: { Downloads, GetCopy }, props: [ 'cluster', 'token', 'state' ], data() { return { signReqValidity: "1d", sshSignReq: { PubKey: "", Principal: "root", }, sshUserCert: null, kubeSignReq: { CSR: "", User: "anonymous", Group: "", }, kubeUserCert: null, }; }, methods: { sshCASign() { event.preventDefault(); fetch(`/clusters/${this.cluster.Name}/ssh/user-ca/sign`, { method: 'POST', body: JSON.stringify({ ...this.sshSignReq, Validity: this.signReqValidity }), headers: { 'Authorization': 'Bearer ' + this.token, 'Content-Type': 'application/json' }, }).then((resp) => resp.blob()) .then((cert) => { this.sshUserCert = URL.createObjectURL(cert) }) .catch((e) => { alert('failed to sign: '+e); }) }, kubeCASign() { event.preventDefault(); fetch(`/clusters/${this.cluster.Name}/kube/sign`, { method: 'POST', body: JSON.stringify({ ...this.kubeSignReq, Validity: this.signReqValidity }), headers: { 'Authorization': 'Bearer ' + this.token, 'Content-Type': 'application/json' }, }).then((resp) => resp.blob()) .then((cert) => { this.kubeUserCert = URL.createObjectURL(cert) }) .catch((e) => { alert('failed to sign: '+e); }) }, }, template: `
Name | Certificate | Signed certificates |
---|---|---|
{{ ca.Name }} |
{{" "}}
|
Allow cluster access from a public key
Certificate time validity: ie: -5m:1w, 5m, 1M, 1y, 1d-1s, etc.
Public key (OpenSSH format):
Principal:
Certificate signing request (PEM format):
User:
Group:
` }