Thursday, May 25, 2023

GCE- MANUAL KEY CONFIGURATION - SSH KEY -PROJECT

 

Today, we will create VMs and provision SSH key manually within security. This is for learning purposes.

STEP 1:
Create a VM instances and  add a label ( key: env and value: dev)




STEP 2: 
Select a machine type. We are using fi-micro based on the workload and its cost effective based on the region. 



STEP3:
Select the boot disk. You need the O/S type. 



STEP 4:
This hands-on, we are using centos O/S.




STEP 4:
Click on advance and select security, we need to provision a manual key. 




STEP 5:
Open your terminal or Git bash. To manually generate SSH keys. You'll always share your public key within your workstation. You ensure that you're in the ~ directory in your terminal or git bash. We change the default name id_rsa to a customize name "gce-ssh".

To manually Generate SSH key

ssh-keygen -t rsa

## copy everything in the bracket
/Users/ucheonyemah/.ssh/id_rsa

### delete the id_rsa and provide key

##
/Users/ucheonyemah/.ssh/gce-ssh-key


## .ssh is a directory and ls is to list all directory in the folder
ls -al .ssh

##
You should see the private and public key
.pub indicate a public key

##
To view the key, we use the command “cat”

cat ~/.ssh/gce-ssh-key.pub


##
Copy the encrypted public key and paste within your console within security and create.


## copy your “VM IP external “
ssh 31.10.100.000

##
ssh 31.10.100.000


STEP 6:
You should get the encrypted key, copy the key and paste it within manually generated SSH keys within your console in step 4. 

STEP 7:
To see your private key, run this command.

cat ~/.ssh/gce-ssh-key



STEP 8:
Allow you to identify the private key file, you use the "-i" flag. You replace with the customize username, key and IP. If you're not sure of the user. Run the command "whoami". Get the external IP from your instance. SSH is the primary base command to login in any Linux O/S.


ssh -i .ssh/PRIVATE_KEY USER_NAME@EXTERNAL_IP


ssh -i .ssh/gce-ssh-key uche@31.10.100.000

STEP 9:
Paste the private key command and run it on your terminal. You should be able to get access within your private key. Run the command "whoiam". Your directory should be your instance that you're connecting into.


STEP 10:
You successfully and manually configured SSH KEY. 



Happy Learning!! 😊

Referencing: Google Cloud. 
  

No comments:

Post a Comment

CONFIGURING A PHISHING CAMPAIGN IN MICROSOFT DEFENDER.

Configuring a phishing campaign in Microsoft Defender (specifically Microsoft Defender for Office 365) involves creating a simulated attack ...