Esegui l'autenticazione utilizzando le chiavi pubbliche SSH
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Gli utenti e i service account possono utilizzare le chiavi pubbliche SSH per l'autenticazione ai repository Secure Source Manager. Questa pagina descrive come generare una coppia di chiavi SSH e poi aggiungerla come metodo di autenticazione nell'interfaccia web di Secure Source Manager.
Secure Source Manager supporta i tipi di chiavi SSH RSA, ECDSA ed Ed25519.
Ruoli obbligatori
Per ottenere le autorizzazioni
necessarie per l'autenticazione tramite chiavi pubbliche SSH,
chiedi all'amministratore di concederti i
seguenti ruoli IAM:
Per aggiungere una chiave SSH per un utente:
Secure Source Manager Instance Accessor (roles/securesourcemanager.instanceAccessor)
nell'istanza Secure Source Manager
Per aggiungere una chiave SSH per un account di servizio:
Questi ruoli predefiniti contengono
le autorizzazioni necessarie per l'autenticazione tramite chiavi pubbliche SSH. Per vedere quali sono esattamente le autorizzazioni richieste, espandi la sezione Autorizzazioni obbligatorie:
Autorizzazioni obbligatorie
Per l'autenticazione tramite chiavi pubbliche SSH sono necessarie le seguenti autorizzazioni:
Quando ti viene chiesto, inserisci una posizione e un nome file per il file della chiave pubblica.
Per accettare la posizione e il nome file predefiniti, premi Invio.
Quando ti viene richiesto, lascia la passphrase vuota e premi Invio.
Nella finestra che si apre, seleziona il tipo di chiave dal campo Parametri.
Fai clic su Genera.
PuTTYGen mostra la stringa della chiave pubblica generata.
Quando ti viene richiesto, lascia la passphrase vuota e premi Invio.
Per salvare la coppia di chiavi generata nel sistema locale, fai clic su
Salva chiave pubblica e Salva chiave privata.
Aggiungere chiavi SSH per gli utenti
Nell'interfaccia web di Secure Source Manager, dalla pagina dell'istanza o
del repository, fai clic sul menu more_vertAltre opzioni.
Fai clic su Chiavi SSH utente.
Si apre la pagina Chiavi SSH utente e viene visualizzato un elenco
delle chiavi esistenti che hai creato.
Nella pagina Chiavi SSH utente, fai clic su Aggiungi chiave.
Nella pagina Aggiungi chiave SSH, inserisci i seguenti valori per la chiave:
Titolo: aggiungi un titolo descrittivo per la chiave.
Chiave pubblica SSH: incolla la stringa della chiave pubblica. Per ottenere
la stringa della chiave pubblica, esegui questo comando:
cat ~/.ssh/FILENAME.pub
Dove FILENAME è il nome che hai dato al file della chiave.
Puoi utilizzare le chiavi SSH per l'autenticazione in qualsiasi repository Secure Source Manager, a condizione che tu disponga delle autorizzazioni necessarie per quel repository.
Aggiungere chiavi SSH per i service account
Per consentire l'accesso programmatico al repository, puoi aggiungere una chiave SSH per un account di servizio.
Se non hai ancora un account di servizio da utilizzare,
creane uno.
Nell'interfaccia web di Secure Source Manager, fai clic sul menu more_vertAltre opzioni.
Fai clic su Chiavi SSH dell'account di servizio. Si apre la pagina Chiavi SSH del service account e viene visualizzato un elenco delle chiavi esistenti che hai aggiunto.
Nella pagina Chiavi SSH dell'account di servizio, fai clic su Aggiungi chiave.
Nella pagina Aggiungi chiave SSH service account, inserisci i seguenti valori
per la chiave:
Titolo: un titolo descrittivo per la chiave
Service account: l'email del account di servizio per il service account in cui vuoi utilizzare la chiave SSH nel formato
SA_NAME@PROJECT_ID.iam.gserviceaccount.com
Dove
SA_NAME è il nome del account di servizio.
PROJECT_ID è l'ID progetto del progetto in cui è stato creato il service account.
Chiave pubblica SSH: la tua chiave pubblica SSH. Per informazioni su come generare una coppia di chiavi SSH, consulta Generare una coppia di chiavi.
Se il account di servizio non si trova nello stesso progetto dell'istanza Secure Source Manager, concedi all'agente di servizio di Secure Source Manager uno dei seguenti ruoli o autorizzazioni per il account di servizio che vuoi utilizzare:
iam.serviceAccounts.signJwt autorizzazione
Ruolo Creatore token service account (roles/iam.serviceAccountTokenCreator)
Esegui il comando seguente per aggiungere un criterio IAM al account di servizio Secure Source Manager per concedergli il ruolo Creatore token service account.
dove SERVICE_ACCOUNT è il account di servizio che vuoi utilizzare e
INSTANCE_PROJECT_NUMBER è il numero di progetto della tua
istanza di Secure Source Manager.
SERVICE_ACCOUNT deve essere formattato come ID account di servizio numerico o come email, ad esempio: 123456789876543212345 o my-iam-account@somedomain.com.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-04 UTC."],[],[],null,["# Authenticate using SSH public keys\n\nUsers and service accounts can use SSH public keys to authenticate to\nSecure Source Manager repositories. This page describes how to generate an\nSSH key pair, and then add it as an authentication method in the\nSecure Source Manager web interface.\n\nSecure Source Manager supports RSA, ECDSA, and Ed25519 SSH key types.\n\nRequired roles\n--------------\n\n\nTo get the permissions that\nyou need to authenticate using SSH public keys,\n\nask your administrator to grant you the\nfollowing IAM roles:\n\n- To add an SSH key for a user: [Secure Source Manager Instance Accessor](/iam/docs/roles-permissions/securesourcemanager#securesourcemanager.instanceAccessor) (`roles/securesourcemanager.instanceAccessor`) on the Secure Source Manager instance\n- To add an SSH key for a service account:\n - [Secure Source Manager Instance Manager](/iam/docs/roles-permissions/securesourcemanager#securesourcemanager.instanceManager) (`roles/securesourcemanager.instanceManager`) on the Secure Source Manager instance\n - [Service Account User](/iam/docs/roles-permissions/iam#iam.serviceAccountUser) (`roles/iam.serviceAccountUser`) on the service account\n\n\nFor more information about granting roles, see [Manage access to projects, folders, and organizations](/iam/docs/granting-changing-revoking-access).\n\n\nThese predefined roles contain\n\nthe permissions required to authenticate using SSH public keys. To see the exact permissions that are\nrequired, expand the **Required permissions** section:\n\n\n#### Required permissions\n\nThe following permissions are required to authenticate using SSH public keys:\n\n- ` ``securesourcemanager.sshkeys.createAny` on the Secure Source Manager instance\n- To assign an SSH key to a service account: ` ``iam.serviceAccounts.actAs` on the service account\n\n\nYou might also be able to get\nthese permissions\nwith [custom roles](/iam/docs/creating-custom-roles) or\nother [predefined roles](/iam/docs/roles-overview#predefined).\n\nFor information on granting Secure Source Manager roles,\nsee [Access control with IAM](/secure-source-manager/docs/access-control) and\n[Grant users instance access](/secure-source-manager/docs/grant-users-instance-access).\n\nGenerate a key pair\n-------------------\n\nAn SSH key pair consists of a private key that resides on your local system and\na public key that you register with Google Cloud. \n\n### Linux or macOS\n\n1. Install\n [OpenSSH](https://www.openssh.com/)\n on your local system.\n\n2. At a command prompt, enter the following command:\n\n ssh-keygen -t [KEY_TYPE] -C \"[USER_EMAIL]\"\n\n Where:\n - `[USER_EMAIL]` is your email address.\n - `[KEY_TYPE]` is one of `rsa`, `ecdsa`, or `ed25519`.\n\n For example: \n\n ssh-keygen -t rsa -C \"user@example.com\"\n\n 1. When prompted, enter a location and filename for the public key file.\n To accept the default location and filename, press **Enter**.\n\n 2. When prompted, leave the passphrase empty and press **Enter**.\n\n### Windows\n\n1. Install\n [PuTTY](https://www.putty.org/)\n on your local system.\n\n2. From the Windows **Start** menu, start PuTTYGen.\n\n3. In the window that opens, select the key type from the **Parameters**\n field.\n\n4. Click **Generate**.\n\n PuTTYGen displays the generated public key string.\n5. When prompted, leave the passphrase empty and press **Enter**.\n\n6. To save the key pair you generated to your local system, click\n **Save Public Key** and **Save Private Key**.\n\nAdd SSH keys for users\n----------------------\n\n1. In the Secure Source Manager web interface, from the instance or repository page, click the more_vert **more options** menu.\n2. Click **User SSH keys**.\n\n The **User SSH keys** page opens, and a list of\n any existing keys you've created is displayed.\n3. In the **User SSH keys** page, click **Add key**.\n\n4. In the **Add SSH Key** page, enter the following values for your key:\n\n 1. **Title**: add a descriptive title for the key.\n 2. **SSH public key**: paste your public key string. To get your public key string, run the following command:\n\n cat ~/.ssh/\u003cvar translate=\"no\"\u003eFILENAME\u003c/var\u003e.pub\n\n Where \u003cvar translate=\"no\"\u003e\u003ccode translate=\"no\" dir=\"ltr\"\u003eFILENAME\u003c/code\u003e\u003c/var\u003e is the name you gave the key file.\n\nYou can use SSH keys to authenticate to any Secure Source Manager repository\nprovided you have the needed permissions on that repository.\n\nAdd SSH keys for service accounts\n---------------------------------\n\nTo allow programmatic access to your repository, you can add an SSH key for a\nservice account.\n\n1. If you don't already have a service account that you want to use, [create a service account](/iam/docs/creating-managing-service-accounts#creating).\n2. From the Secure Source Manager web interface, click the more_vert **more options** menu.\n3. Click **Service account SSH keys** . The **Service account SSH keys** page opens, and a list of any existing keys you've added is displayed.\n4. In the **Service account SSH keys** page, click **Add key**.\n5. In the **Add service account SSH key** page, enter the following values\n for your key:\n\n 1. **Title**: a descriptive title for the key\n 2. **Service account** : the service account email for the service\n account you want to use the SSH key in the format\n \u003cvar translate=\"no\"\u003eSA_NAME\u003c/var\u003e`@`\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e`.iam.gserviceaccount.com`\n\n Where\n - \u003cvar translate=\"no\"\u003e\u003ccode translate=\"no\" dir=\"ltr\"\u003eSA_NAME\u003c/code\u003e\u003c/var\u003e is the service account name.\n - \u003cvar translate=\"no\"\u003e\u003ccode translate=\"no\" dir=\"ltr\"\u003ePROJECT_ID\u003c/code\u003e\u003c/var\u003e is the project ID of the project the service account was created in.\n 3. **SSH Public Key** : Your public SSH key. See\n [Generate a key pair](#generate-key-pair) for information on how to\n generate an SSH key pair.\n\n6. If the service account is not in the same project as your\n Secure Source Manager instance, give Secure Source Manager's\n [service agent](/iam/docs/service-agents)\n one of the following roles or permissions on the service account you want to\n use:\n\n - `iam.serviceAccounts.signJwt` permission\n - Service Account Token Creator (`roles/iam.serviceAccountTokenCreator`) role\n\n\n Run the following command to add an IAM policy to your\n Secure Source Manager service account to grant it the Service Account\n Token Creator role. \n\n gcloud iam service-accounts add-iam-policy-binding \u003cvar translate=\"no\"\u003eSERVICE_ACCOUNT\u003c/var\u003e \\\n --member=\"serviceAccount:service-\u003cvar translate=\"no\"\u003eINSTANCE_PROJECT_NUMBER\u003c/var\u003e@gcp-sa-sourcemanager.iam.gserviceaccount.com\" \\\n --role=\"roles/iam.serviceAccountTokenCreator\"\n\n Where \u003cvar translate=\"no\"\u003eSERVICE_ACCOUNT\u003c/var\u003e is the service account you want to use and\n \u003cvar translate=\"no\"\u003eINSTANCE_PROJECT_NUMBER\u003c/var\u003e is the project number of your\n Secure Source Manager instance.\n\n The \u003cvar translate=\"no\"\u003eSERVICE_ACCOUNT\u003c/var\u003e should be formatted either as a numeric\n service account ID or as an email, like this: 123456789876543212345 or\n my-iam-account@somedomain.com.\n\nWhat's next\n-----------\n\n- [Connect to Cloud Build](/secure-source-manager/docs/connect-cloud-build).\n- [Connect to Jenkins](/secure-source-manager/docs/connect-jenkins)."]]