Gestire l'accesso di emergenza a una macchina bare metal utilizzando il az networkcloud cluster baremetalmachinekeyset
Attenzione
Si noti che questo processo viene usato in situazioni di emergenza quando tutte le altre opzioni di risoluzione dei problemi che usano Azure sono state esaurite. L'accesso SSH a questi computer bare metal è limitato agli utenti gestiti tramite questo metodo dalla jump host list specificata.
Ci sono rare situazioni in cui un utente deve analizzare e risolvere i problemi relativi a una macchina bare metal e tutti gli altri modi sono stati esauriti tramite Azure. Azure Operator Nexus fornisce il az networkcloud cluster baremetalmachinekeyset
comando in modo che gli utenti possano gestire l'accesso SSH a questi computer bare metal. Durante la creazione del keyset, gli utenti vengono convalidati in base all'ID Di Microsoft Entra per l'autorizzazione appropriata facendo riferimento al nome dell'entità utente fornito per un utente rispetto all'ID --azure-group-id <Entra Group ID>
Microsoft Entra fornito.
Se il nome dell'entità utente per un utente non è membro del gruppo fornito, lo stato dell'utente è impostato su "Non valido" e il messaggio di stato indica "Non valido perché userPrincipal non è membro del gruppo AAD". Se l'ID gruppo di Azure non è valido, ogni utente nel keyset avrà lo stato impostato su "Non valido" e il messaggio di stato indica che il gruppo AAD non esiste. Gli utenti non validi rimangono nel keyset, ma la chiave non verrà abilitata per l'accesso SSH.
Nota
Attualmente è previsto un periodo transitorio in cui specificare i nomi delle entità utente è facoltativo. In una versione futura diventerà obbligatorio e la convalida dell'ID Entra di Microsoft verrà applicata per tutti gli utenti. Gli utenti sono invitati ad aggiungere nomi di entità utente ai propri set di chiavi prima della fine del periodo transitorio (previsto per luglio 2024) per evitare che i set di chiavi vengano invalidati. Si noti che se vengono aggiunti nomi di entità utente a un keyset, anche se non vengono aggiunti per tutti gli utenti, verrà abilitata la convalida dell'ID Entra di Microsoft e ciò comporterà l'invalidazione dell'intero keyset se l'ID gruppo specificato non è valido.
Quando il comando viene eseguito, viene eseguito in ogni computer bare metal nel cluster con un nodo Kubernetes attivo. Esiste un processo di riconciliazione che viene eseguito periodicamente che ritenta il comando su qualsiasi computer bare metal non disponibile al momento del comando originale. Inoltre, qualsiasi computer bare metal che torna al cluster tramite un az networkcloud baremetalmachine reimage
comando o az networkcloud baremetalmachine replace
(vedere Funzioni BareMetal) invia un segnale che causa l'invio di set di chiavi attivi al computer non appena torna al cluster. Più comandi vengono eseguiti nell'ordine ricevuto.
Non esiste alcun limite al numero di utenti in un gruppo.
Attenzione
Note per gli indirizzi IP dell'host jump
- Il processo di creazione/aggiornamento del keyset aggiunge gli indirizzi IP dell'host di collegamento alle tabelle IP per ogni computer nel cluster. In questo modo, l'accesso SSH può essere consentito solo da tali jump host.
- È importante specificare gli indirizzi IP con connessione cluster per i jump host. Questi indirizzi IP potrebbero essere diversi dall'indirizzo IP pubblico usato per accedere all'host jump.
- Dopo l'aggiunta, gli utenti sono in grado di accedere a computer bare metal da qualsiasi IP host jump specificato, incluso un IP dell'host jump definito in un altro gruppo di keyset di computer bare metal.
- L'accesso SSH esistente rimane quando si aggiunge il primo keyset di computer bare metal. Tuttavia, il comando keyset limita l'accesso SSH di un utente esistente agli indirizzi IP dell'host jump specificato nei comandi keyset.
Prerequisiti
- Installare la versione più recente delle estensioni dell'interfaccia della riga di comando appropriate.
- Il cluster locale deve avere connettività ad Azure.
- Ottenere il nome del gruppo di risorse per la
Cluster
risorsa. - Il processo applica i set di chiavi a tutti i computer bare metal in esecuzione.
- Gli utenti aggiunti devono far parte di un gruppo Microsoft Entra. Per altre informazioni, vedere Come gestire i gruppi.
- Per limitare l'accesso per la gestione dei set di chiavi, creare un ruolo personalizzato. Per altre informazioni, vedere Ruoli personalizzati di Azure. In questa istanza aggiungere o escludere autorizzazioni per
Microsoft.NetworkCloud/clusters/bareMetalMachineKeySets
. Le opzioni sono/read
,/write
e/delete
.
Nota
Quando viene creato, modificato o eliminato l'accesso alla macchina bare metal tramite i comandi descritti in questo articolo, un processo in background recapita tali modifiche ai computer. Questo processo viene sospeso durante gli aggiornamenti software Operator Nexus. Se è noto che un aggiornamento è in corso, è possibile usare l'opzione --no-wait
con il comando per impedire al prompt dei comandi di attendere il completamento del processo.
Creazione di un keyset di computer bare metal
Il baremetalmachinekeyset create
comando crea l'accesso SSH al computer bare metal in un cluster per un gruppo di utenti.
La sintassi del comando è:
az networkcloud cluster baremetalmachinekeyset create \
--name "<bare metal machine Keyset Name>" \
--extended-location name="<Extended Location ARM ID>" \
type="CustomLocation" \
--location "<Azure Region>" \
--azure-group-id "<Azure Group ID>" \
--expiration "<Expiration Timestamp>" \
--jump-hosts-allowed "<List of jump server IP addresses>" \
--os-group-name "<Name of the Operating System Group>" \
--privilege-level "<"Standard" or "Superuser">" \
--user-list '[{"description":"<User List Description>","azureUserName":"<User Name>",\
"sshPublicKey":{"keyData":"<SSH Public Key>"}, \
"userPrincipalName":""}]', \
--tags key1="<Key Value>" key2="<Key Value>" \
--cluster-name "<Cluster Name>" \
--resource-group "<cluster_RG>"
Creare argomenti
--azure-group-id [Required] : The object ID of Azure Active Directory
group that all users in the list must
be in for access to be granted. Users
that are not in the group do not have
access.
--bare-metal-machine-key-set-name --name -n [Required] : The name of the bare metal machine key
set.
--cluster-name [Required] : The name of the cluster.
--expiration [Required] : The date and time after which the users
in this key set are removed from
the bare metal machines. Format is:
"YYYY-MM-DDTHH:MM:SS.000Z"
--extended-location [Required] : The extended location of the cluster
associated with the resource.
Usage: --extended-location name=XX type=XX
name: Required. The resource ID of the extended location on which the resource is created.
type: Required. The extended location type: "CustomLocation".
--jump-hosts-allowed [Required] : The list of IP addresses of jump hosts
with management network access from
which a login is be allowed for the
users. Supports IPv4 or IPv6 addresses.
--privilege-level [Required] : The access level allowed for the users
in this key set. Allowed values:
"Standard" or "Superuser".
--resource-group -g [Required] : Name of cluster resource group. Optional if
configuring the default group using `az
configure --defaults group=<name>`.
--user-list [Required] : The unique list of permitted users.
Usage: --user-list azure-user-name=XX description=XX key-data=XX
azure-user-name: Required. User name used to login to the server.
description: The free-form description for this user.
key-data: Required. The public ssh key of the user.
userPrincipalName: Optional. The User Principal Name of the User.
Multiple users can be specified by using more than one --user-list argument.
--os-group-name : The name of the group that users are assigned
to on the operating system of the machines.
--tags : Space-separated tags: key[=value]
[key[=value] ...]. Use '' to clear
existing tags.
--location -l : Azure Region. Values from: `az account
list-locations`. You can configure the
default location using `az configure
--defaults location=<location>`.
--no-wait : Do not wait for the long-running
operation to finish.
Argomenti globali dell'interfaccia della riga di comando di Azure (applicabili a tutti i comandi)
--debug : Increase logging verbosity to show all
debug logs.
--help -h : Show this help message and exit.
--only-show-errors : Only show errors, suppressing warnings.
--output -o : Output format. Allowed values: json,
jsonc, none, table, tsv, yaml, yamlc.
Default: json.
--query : JMESPath query string. See
http://jmespath.org/ for more
information and examples.
--subscription [Required] : Name or ID of subscription. Optional if
configuring the default subscription
using `az account set -s NAME_OR_ID`.
--verbose : Increase logging verbosity. Use --debug
for full debug logs.
In questo esempio viene creato un nuovo keyset con due utenti con accesso standard da due jump host.
az networkcloud cluster baremetalmachinekeyset create \
--name "bareMetalMachineKeySetName" \
--extended-location name="/subscriptions/subscriptionId/resourceGroups/cluster_RG/providers/Microsoft.ExtendedLocation/customLocations/clusterExtendedLocationName" \
type="CustomLocation" \
--location "eastus" \
--azure-group-id "f110271b-XXXX-4163-9b99-214d91660f0e" \
--expiration "2022-12-31T23:59:59.008Z" \
--jump-hosts-allowed "192.0.2.1" "192.0.2.5" \
--os-group-name "standardAccessGroup" \
--privilege-level "Standard" \
--user-list '[{"description":"Needs access for troubleshooting as a part of the support team","azureUserName":"userABC", "sshPublicKey":{"keyData":"ssh-rsa AAtsE3njSONzDYRIZv/WLjVuMfrUSByHp+jfaaOLHTIIB4fJvo6dQUZxE20w2iDHV3tEkmnTo84eba97VMueQD6OzJPEyWZMRpz8UYWOd0IXeRqiFu1lawNblZhwNT/ojNZfpB3af/YDzwQCZgTcTRyNNhL4o/blKUmug0daSsSXISTRnIDpcf5qytjs1XoyYyJMvzLL59mhAyb3p/cD+Y3/s3WhAx+l0XOKpzXnblrv9d3q4c2tWmm/SyFqthaqd0= admin@vm"},"userPrincipalName":"example@contoso.com"},\
{"description":"Needs access for troubleshooting as a part of the support team","azureUserName":"userXYZ","sshPublicKey":{"keyData":"ssh-rsa AAtsE3njSONzDYRIZv/WLjVuMfrUSByHp+jfaaOLHTIIB4fJvo6dQUZxE20w2iDHV3tEkmnTo84eba97VMueQD6OzJPEyWZMRpz8UYWOd0IXeRqiFu1lawNblZhwNT/ojNZfpB3af/YDzwQCZgTcTRyNNhL4o/blKUmug0daSsSXTSTRnIDpcf5qytjs1XoyYyJMvzLL59mhAyb3p/cD+Y3/s3WhAx+l0XOKpzXnblrv9d3q4c2tWmm/SyFqthaqd0= admin@vm"}, "userPrincipalName":"example@contoso.com"}]' \
--tags key1="myvalue1" key2="myvalue2" \
--cluster-name "clusterName"
--resource-group "cluster_RG"
Per assistenza nella creazione della struttura, vedere Abbreviato dell'interfaccia della --user-list
riga di comando di Azure.
Eliminazione di un keyset di computer bare metal
Il baremetalmachinekeyset delete
comando rimuove l'accesso SSH al computer bare metal per un gruppo di utenti. Tutti i membri del gruppo non hanno più accesso SSH a nessuno dei computer bare metal nel cluster.
La sintassi del comando è:
az networkcloud cluster baremetalmachinekeyset delete \
--name "<bare metal machine Keyset Name>" \
--cluster-name "<Cluster Name>" \
--resource-group "<cluster_RG>"
Elimina argomenti
--bare-metal-machine-key-set-name --name -n [Required] : The name of the bare metal machine key set to be
deleted.
--cluster-name [Required] : The name of the cluster.
--resource-group -g [Required] : Name of cluster resource group. Optional if configuring the
default group using `az configure --defaults
group=<name>`.
--no-wait : Do not wait for the long-running operation to
finish.
--yes -y : Do not prompt for confirmation.
In questo esempio viene rimosso il gruppo di keyset "bareMetalMachineKeysetName" nel cluster "clusterName".
az networkcloud cluster baremetalmachinekeyset delete \
--name "bareMetalMachineKeySetName" \
--cluster-name "clusterName" \
--resource-group "cluster_RG"
Aggiornamento di un keyset di computer bare metal
Il baremetalmachinekeyset update
comando consente agli utenti di apportare modifiche a un gruppo di keyset esistente.
La sintassi del comando è:
az networkcloud cluster baremetalmachinekeyset update \
--name "<bare metal machine Keyset Name>" \
--jump-hosts-allowed "<List of jump server IP addresses>" \
--privilege-level "<"Standard" or "Superuser">" \
--user-list '[{"description":"<User List Description>","azureUserName":"<User Name>",\
"sshPublicKey":{"keyData":"<SSH Public Key>"}, \
"userPrincipalName":""}]', \
--tags key1="<Key Value>" key2="<Key Value> "\
--cluster-name "<Cluster Name>" \
--resource-group "<cluster_RG>"
Aggiornare gli argomenti
--bare-metal-machine-key-set-name --name -n [Required] : The name of the bare metal machine key set.
--cluster-name [Required] : The name of the cluster.
--expiration : The date and time after which the users
in this key set are removed from
the bare metal machines. Format is:
"YYYY-MM-DDTHH:MM:SS.000Z"
--jump-hosts-allowed : The list of IP addresses of jump hosts
with management network access from
which a login is allowed for the
users. Supports IPv4 or IPv6 addresses.
--privilege-level : The access level allowed for the users
in this key set. Allowed values:
"Standard" or "Superuser".
--user-list : The unique list of permitted users.
Usage: --user-list azure-user-name=XX description=XX key-data=XX
azure-user-name: Required. User name used to login to the server.
description: The free-form description for this user.
key-data: Required. The public SSH key of the user.
userPrincipalName: Optional. The User Principal Name of the User.
Multiple users can be specified by using more than one --user-list argument.
--resource-group -g [Required] : Name of cluster resource group. Optional if
configuring the default group using `az
configure --defaults group=<name>`.
--tags : Space-separated tags: key[=value]
[key[=value] ...]. Use '' to clear
existing tags.
--no-wait : Do not wait for the long-running
operation to finish.
In questo esempio vengono aggiunti due nuovi utenti al gruppo "baremetalMachineKeySetName" e viene modificata l'ora di scadenza per il gruppo.
az networkcloud cluster baremetalmachinekeyset update \
--name "bareMetalMachineKeySetName" \
--expiration "2023-12-31T23:59:59.008Z" \
--user-list '[{"description":"Needs access for troubleshooting as a part of the support team",\
"azureUserName":"userABC", \
"sshPublicKey":{"keyData":"ssh-rsa AAtsE3njSONzDYRIZv/WLjVuMfrUSByHp+jfaaOLHTIIB4fJvo6dQUZxE20w2iDHV3tEkmnTo84eba97VMueQD6OzJPEyWZMRpz8UYWOd0IXeRqiFu1lawNblZhwNT/ojNZfpB3af/YDzwQCZgTcTRyNNhL4o/blKUmug0daSsSXISTRnIDpcf5qytjs1XoyYyJMvzLL59mhAyb3p/cD+Y3/s3WhAx+l0XOKpzXnblrv9d3q4c2tWmm/SyFqthaqd0= admin@vm"}, \
"userPrincipalName":"example@contoso.com"},\
{"description":"Needs access for troubleshooting as a part of the support team",\
"azureUserName":"userXYZ", \
"sshPublicKey":{"keyData":"ssh-rsa AAtsE3njSONzDYRIZv/WLjVuMfrUSByHp+jfaaOLHTIIB4fJvo6dQUZxE20w2iDHV3tEkmnTo84eba97VMueQD6OzJPEyWZMRpz8UYWOd0IXeRqiFu1lawNblZhwNT/ojNZfpB3af/YDzwQCZgTcTRyNNhL4o/blKUmug0daSsSXTSTRnIDpcf5qytjs1XoyYyJMvzLL59mhAyb3p/cD+Y3/s3WhAx+l0XOKpzXnblrv9d3q4c2tWmm/SyFqthaqd0= admin@vm"}, \
"userPrincipalName":"example@contoso.com"}]' \
--cluster-name "clusterName" \
--resource-group "cluster_RG"
Listato set di chiavi della macchina bare metal
Il baremetalmachinekeyset list
comando consente agli utenti di visualizzare i gruppi di keyset esistenti in un cluster.
La sintassi del comando è:
az networkcloud cluster baremetalmachinekeyset list \
--cluster-name "<Cluster Name>" \
--resource-group "<cluster_RG>"
Argomenti elenco
--cluster-name [Required] : The name of the cluster.
--resource-group -g [Required] : Name of cluster resource group. Optional if
configuring the default group using `az
configure --defaults group=<name>`.
Mostra dettagli keyset computer bare metal
Il baremetalmachinekeyset show
comando consente agli utenti di visualizzare i dettagli di un gruppo di keyset esistente in un cluster.
La sintassi del comando è:
az networkcloud cluster baremetalmachinekeyset show \
--cluster-name "<Cluster Name>" \
--resource-group "<cluster_RG>"
Mostra argomenti
--bare-metal-machine-key-set-name --name -n [Required] : The name of the bare metal machine key
set.
--cluster-name [Required] : The name of the cluster.
--resource-group -g [Required] : Name of cluster resource group. You can
configure the default group using `az
configure --defaults group=<name>`.