2023-02-07 21:29:19 +01:00
|
|
|
|
|
|
|
import Downloads from './Downloads.js';
|
2023-02-12 11:58:26 +01:00
|
|
|
import GetCopy from './GetCopy.js';
|
2023-02-07 21:29:19 +01:00
|
|
|
|
|
|
|
export default {
|
2023-02-12 11:58:26 +01:00
|
|
|
components: { Downloads, GetCopy },
|
2023-02-07 21:29:19 +01:00
|
|
|
props: [ 'cluster', 'token', 'state' ],
|
2025-06-29 00:12:12 +02:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
sshSignReq: {
|
|
|
|
PubKey: "",
|
|
|
|
Principal: "root",
|
|
|
|
Validity: "+1d",
|
|
|
|
},
|
|
|
|
sshUserCert: null,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
sshCASign() {
|
|
|
|
event.preventDefault();
|
|
|
|
fetch(`/clusters/${this.cluster.Name}/ssh/user-ca/sign`, {
|
|
|
|
method: 'POST',
|
|
|
|
body: JSON.stringify(this.sshSignReq),
|
|
|
|
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); })
|
|
|
|
},
|
|
|
|
},
|
2023-02-07 21:29:19 +01:00
|
|
|
template: `
|
2025-06-29 00:12:12 +02:00
|
|
|
<h3>Tokens</h3>
|
2023-02-12 11:58:26 +01:00
|
|
|
<section class="links">
|
|
|
|
<GetCopy v-for="n in cluster.Tokens" :token="token" :name="n" :href="'/clusters/'+cluster.Name+'/tokens/'+n" />
|
|
|
|
</section>
|
2025-06-29 00:12:12 +02:00
|
|
|
|
|
|
|
<h3>Passwords</h3>
|
2023-02-12 11:58:26 +01:00
|
|
|
<section class="links">
|
|
|
|
<GetCopy v-for="n in cluster.Passwords" :token="token" :name="n" :href="'/clusters/'+cluster.Name+'/passwords/'+n" />
|
|
|
|
</section>
|
2025-06-29 00:12:12 +02:00
|
|
|
|
|
|
|
<h3>Downloads</h3>
|
|
|
|
<Downloads :token="token" :state="state" kind="cluster" :name="cluster.Name" />
|
|
|
|
|
|
|
|
<h3>CAs</h3>
|
2023-02-15 08:49:34 +01:00
|
|
|
<table><tr><th>Name</th><th>Certificate</th><th>Signed certificates</th></tr>
|
|
|
|
<tr v-for="ca in cluster.CAs">
|
|
|
|
<td>{{ ca.Name }}</td>
|
|
|
|
<td><GetCopy :token="token" name="cert" :href="'/clusters/'+cluster.Name+'/CAs/'+ca.Name+'/certificate'" /></td>
|
|
|
|
<td><template v-for="signed in ca.Signed">
|
|
|
|
{{" "}}
|
|
|
|
<GetCopy :token="token" :name="signed" :href="'/clusters/'+cluster.Name+'/CAs/'+ca.Name+'/signed?name='+signed" />
|
|
|
|
</template></td>
|
|
|
|
</tr></table>
|
2025-06-29 00:12:12 +02:00
|
|
|
|
|
|
|
<h3>SSH</h3>
|
|
|
|
<form @submit="sshCASign()" action="">
|
|
|
|
<p>User public key (OpenSSH format):<br/>
|
|
|
|
<textarea v-model="sshSignReq.PubKey"></textarea>
|
|
|
|
</p>
|
|
|
|
<p>Principal: <input type="text" v-model="sshSignReq.Principal"/></p>
|
|
|
|
<p>Validity: <input type="text" v-model="sshSignReq.Validity"/></p>
|
|
|
|
<input type="submit" value="Sign key" />
|
|
|
|
</form>
|
|
|
|
<p v-if="sshUserCert">
|
|
|
|
<a :href="sshUserCert" download="ssh-cert.pub">Get user SSH certificate</a>
|
|
|
|
</p>
|
2023-02-07 21:29:19 +01:00
|
|
|
`
|
|
|
|
}
|