Skip to main content

Generate

Members of an organization can generate certificates for themselves Signing certificates for other users requires a special permission

import { cloudApi, serviceClients, Session } from "@yandex-cloud/nodejs-sdk";

const GenerateSshCertificateRequest =
cloudApi.organizationmanager.ssh_certificate_service
.GenerateSshCertificateRequest;

(async () => {
const authToken = process.env["YC_OAUTH_TOKEN"];
const session = new Session({ oauthToken: authToken });
const client = session.client(serviceClients.SshCertificateServiceClient);

const result = await client.generate(
GenerateSshCertificateRequest.fromPartial({
// cloudId: "cloudId",
// organizationId: "organizationId",
// subjectId: "subjectId",
// osLogin: "osLogin",
publicKey: "publicKey",
})
);
console.log(result);
})();

GenerateSshCertificateRequest

One of scope

  • cloudId : string

    the cloud must be attached to an organization

  • organizationId : string

One of subject

  • subjectId : string

    specify subject to generate certificate for default login

  • osLogin : string

    specify os_login for a specific login

publicKey : string

GenerateSshCertificateResponse

signedCertificate : string

as per specification https://cvsweb.openbsd.org/src/usr.bin/ssh/PROTOCOL.certkeys?annotate=HEAD