Tuesday, March 4, 2025

How to manage and apply security patches for vSphere ESXi

 

How to manage and apply security patches for vSphere ESXi

  1. Updates and patches from VMware Patch Portal:
    • VMware releases security patches and updates through the VMware Patch Portal.
    • These patches include security updates, performance improvements, bug fixes, and fixes related to the ESXi operating system, as well as vSphere-related products.
  2. Specific security patches for ESXi:
    • Security patches are released regularly for ESXi, which typically fixes vulnerabilities in the ESXi kernel or its virtual machines.
    • Specifically, VMware recommends that patches and updates be applied immediately after release to protect virtual infrastructure.
  3. Instructions for updating and installing security patches:
  4. Security Patches and Vulnerabilities:
    • VMware typically releases security vulnerabilities and patches through VMware Security Advisories.
    • To view ESXi-related security vulnerabilities and patches, see VMware Security Advisories:
  5. Check for patches and updates for specific releases:
    • ESXi 6.7 and ESXi 7.0 are the most popular versions for security updates and patches.
    • If you're using older versions like ESXi 5.x or 6.x, it's recommended to upgrade to newer versions for security reasons, as these versions may no longer be supported.

Important Notes on ESXi Security Patches:

  • Back up before applying patches: Always perform a full backup of your system and data before applying security patches.
  • Performance monitoring: Check system performance after applying patches to ensure that there are no issues with the operation of ESXi or virtual machines.
  • Regular updates: To avoid security risks, it is recommended that you apply security updates regularly and as quickly as possible.

To install security patches in vSphere ESXi, you can use a few different methods. In this tutorial, we'll introduce two common ways to install patches in ESXi: using vSphere Update Manager (VUM) and Command Line (CLI). We'll also look at how to install patches manually via the vSphere Client.

Method One: Install the Patch via vSphere Update Manager (VUM)


vSphere Update Manager (VUM) is VMware's official tool for managing updates and patches. This tool allows you to manage updates and patches easily through the vSphere Client.

Steps to install the patch via vSphere Update Manager:

  1. Logging in to vSphere Client:
    • First, log in to your vSphere Client.
    • On the left-hand side, connect to vCenter Server.
  2. Choosing ESXi Host:
    • In vSphere Client, from the sidebar, select Hosts and Clusters.
    • Then select the ESXi Host you want to install the patches on.
  3. Select Update Manager:
    • From the Menu menu, select Update Manager.
    • In the Update Manager window, go to the Baselines section and select New Baseline from there.
  4. Creating Baseline for Patches:
    • After selecting New Baseline, enter a name for the Baseline and select Patch.
    • Then select Download Latest Patches.
    • Once you select this option, Update Manager will automatically download the latest security patches.
  5. Connecting Baseline to ESXi Host:
    • Go back to the Host page and select the Attach Baseline option.
    • Select the new Baseline you have built and connect it to ESXi Host.
  6. Scanning and applying patches:
    • Once the Baseline is connected, select the Scan for Updates option.
    • The system will start checking the status and uninstalled patches.
    • Then select Remediate to have the patches installed automatically on the ESXi server.
    • Once the patches have been applied, the ESXi server will need to restart for the changes to be applied correctly.

Method 2: Installing the ESXi Patch via CLI (Command Line Interface)

In this method, you use the command line and the esxcli tool to install security patches on ESXi. This method is especially useful when you don't want to use the vSphere Client or vCenter and only log into ESXi via SSH.

Steps to install the patch via CLI:

  1. Logging in to the ESXi server via SSH:
    • First, enable SSH on your ESXi server (in case you haven't already).
    • To enable SSH in ESXi, go to your Host via vSphere Client and go to Configure > System > Security Profile.
    • Under Services, select the SSH option and set it to the Start mode.
    • Then log in to the ESXi server using an SSH tool like PuTTY.
  2. Download Patch:
    • ESXi security patches and updates can be downloaded from VMware Patch Portal.
    • The patch file is usually available with a .zip extension.
    • After downloading the patch file, upload it to your ESXi server.
  3. Using esxcli to install the patch:
    • On the command line, use the esxcli command to install the patches.
    • To install the patch, use the following command:
      esxcli software vib install -d /path/to/patch.zip
      

      Note that you need to enter the exact path of the patch file in the command.

  4. Making changes:
    • After installing the patch, you will need to restart the ESXi server for the changes to be applied correctly.
      reboot
      
  5. Patch Installation Check:
    • After restarting the ESXi server, you can make sure that the patch is installed correctly using the following command:
      esxcli software vib list
      
    • This command displays a list of all available patches and VIB (installed software).

Method 3: Install the patch manually via vSphere Client

This method involves installing the patch manually via the vSphere Client without using the Update Manager.

Steps to install the patch manually:

  1. Download the patch from VMware:
    • Download patches and updates from VMware Patch Portal.
    • The patch file is usually .zip with the extension.
  2. Connection to ESXi Host:
    • Log in to the vSphere Client and connect to your ESXi Host.
  3. Upload Patch File:
    • Upload the downloaded patch file to your ESXi server via vSphere Client.
  4. Installing the patch manually:
    • From the Host menu, select the Actions > Reboot option.
    • Then install the patch file via the Local CLI during the reboot.
  5. Restart:
    • After installing the patch, restart the server.

Important Notes:

  • Backups: Always back up your virtual machines and ESXi server before installing patches.
  • Check for patches: Before applying any patches, read the documentation and warnings released by VMware to make sure the new patch is compatible with your system.
  • Patch Installation Time: Installing security patches and updates will typically cause the ESXi server to restart, so it's best to do so at times that have the least impact on system performance.

With these methods, you can easily install security patches and updates on your ESXi servers and maintain the security of your virtual infrastructure.

To enable SSH go and select your host > configuration > security profile > services > properties > SSH.

Then connect via SSH and run this command:
esxcli software vib install -d /vmfs/volumes/datastore1/patch-directory/ESXixxxxxxx.zip
esxcli software vib install -d/vmfs/volumes/drobo/patches/ESXiESXixxxxxxx.zip
Reboot the host and leave the maintenance mode.

    Monday, March 3, 2025

    Veeam Backup & Replication

     

    Veeam Backup & Replication

    Backup Chain in Veeam Backup & Replication

    A backup chain is a sequence of backup files created by backup jobs. The backup chain makes it possible to restore data. The backup chain includes the first full backup file, incremental backup files, metadata files, and some additional files. Full and incremental backup files are related to the restore points of the backed up virtual machines (VMs). You can think of recovery points as "snapshots" of virtual machine data at specific times. Restore points allow you to restore virtual machines to the desired state.

    The type of backup files and how they are arranged in the backup chain depends on the backup method chosen. The number of backup chains for the backed-up virtual machines depends on the format of the backup chain chosen.

    Backup Files

    Veeam Backup & Replication creates and maintains different types of backup files:

    • VBK — Full backup files that store complete copies of VM images virtual machines.
    • VIB or VRB — Incremental backups that store incremental changes to VM images of virtual machines.
    • VBM — Backup metadata files that store information about the backup job, virtual machines processed by the backup job, the number and structure of backup files, restore points, etc. Metadata files facilitate the import of backups, mapping backups, and other operations.

    In addition to these file types, Veeam Backup & Replication can create the following files in the backup repository:

    • VSB — Virtual synthetic backup files used to generate full virtual backups on tapes.
    • VLB, VSM, and VLM—Files that store Microsoft SQL Server transaction log data.
    • VLB, VOM, and VLM—Files that store Oracle log data.
    • VLB, VPM, and VLM — Files that store PostgreSQL WAL data.

    All backup files created by Job Backup are stored in a special folder related to Job in the backup repository. For example, if you create a backup job named "DC Backup", Veeam Backup & Replication will create a folder named "DC Backup" in the target backup repository and store all the backup files generated by this job in this folder.

    Back to Rolling Back VMs

    To return a virtual machine to a specific point in time, you need a chain of backup files: a full backup file plus a set of incremental backup files that depend on this full backup file. If some files are lost in the backup chain, you won't be able to revert to the desired state. For this reason, you should not manually delete individual backup files from the backup repository. Instead, you'll need to specify retention policy settings that allow you to maintain the desired number of backup files in the backup repository.

    Backup Methods

    Veeam Backup & Replication offers several ways to create backup chains:

    Forever forward incremental incremental (FFI) incremental incremental backups

    When the Perpetual Incremental Backup (FFI) method is used, Veeam Backup & Replication creates a backup chain that includes the first full backup file (VBK) and a set of Perpetual Incremental Backup (VIB) files that follow.

    This backup method helps you save backup storage space, as Veeam Backup & Replication only stores a full backup file and deletes incremental backup files when the retention period ends. To comply with the retention policy settings, Veeam Backup & Replication imports the data from an increment file into the full backup file before the increment is deleted. These changes can lead to the fragmentation of the entire backup file, and you should plan the compression operation of the full backup file. This operation generates an additional I/O load on the backup storage. Overall, the FFI method has a modest impact on backup storage I/O compared to other backup methods.

    Restoring to the first restore point from backup files created using the FFI method is the fastest compared to other methods, as the first restore point available is always a full backup. Recovery to other recovery points can be compared to the FI method in terms of speed.

    Veeam forward incremental training

    Incremental Incremental Forward Backup (FI)

    When the Forward Incremental Backup (FI) method is used, Veeam Backup & Replication creates a backup chain that includes multiple full backup files (VBK) and a set of forward incremental backup (VIB) files that are located after each full backup file. Full backups can be created using full synthetic and fully active backup methods. By performing regular full backups, the backup chain is broken down into shorter series. This reduces the chances of losing the backup chain entirely, making this backup method one of the most reliable.

    This backup method requires more storage space compared to other methods because the backup chain contains multiple complete backup files, and sometimes Veeam Backup & Replication stores more than the number specified in the retention policy settings of restore points due to the FI retention policy features.

    The FI method has the least impact on backup storage I/O. However, its impact on backup storage increases on days when full synthetic backups are scheduled, as does its impact on production storage on days when full active backups are scheduled.

    Restoring from backup files created using the FI method is the most time-efficient compared to other methods (in cases where you do not return to the first or last restore point). This is because the backup chain is usually broken down into short series of full and incremental backup files, and it doesn't take much time to consolidate the desired restore point.

    Learn Veeam reversed incrementa chainl

    Reverse incremental (RI) backup

    When the reverse incremental backup (RI) method is used, Veeam Backup & Replication creates a backup chain that includes a full backup file (VBK) and a set of reverse incremental backup (VRB) files that precede it.

    This backup method helps you save backup storage space, as Veeam Backup & Replication only stores one full backup file (if full backups are not scheduled periodically) and deletes incremental backups when the retention period ends.

    The RI method has the greatest I/O impact on backup storage compared to other backup methods. This is because during backup, Veeam Backup & Replication imports the changed data into the full backup file and also creates reverse incremental backup files. Such changes can lead to the fragmentation of the entire backup file, and you should plan the compression operation of the full backup file. This operation generates an additional I/O load on the backup storage.

    Restoring to the last restore point from backup files created using the RI method is the fastest compared to other methods because the most recent restore point is always a complete backup that is updated after each backup cycle. Restoring to previous restore points is slower than other backup methods.

    Veeam reversed incremental training

    Forever Forward Incremental Backup

    The Perpetual Incremental Backup (FFI) method generates a backup chain that includes the first full backup file (VBK) and a set of Perpetual Incremental Backup (VIB) files that follow.

    Veeam Backup & Replication creates a perpetual incremental backup chain in the following form:

    1. In the first backup job session, Veeam Backup & Replication creates a full backup file in the backup repository.
    2. In subsequent backup job sessions, Veeam Backup & Replication only copies the data blocks of the virtual machine (VM) that have changed since the last backup session (full or incremental) and stores these blocks as an incremental backup file in the backup chain.
    3. After a new restore point is added to the backup chain, Veeam Backup & Replication reviews the job retention policy. If Veeam Backup & Replication detects an obsolete restore point, it will change the backup chain to allow space for the most recent restore point.

    Veeam forward incremental training

    To use the incremental backup method permanently, you'll need to select the following options in the backup job settings:

    1. Select Incremental Incremental Backup Mode.
    2. Disable full synthetic backups and full active backups. If you enable full synthetic backups and full active backups, Veeam Backup & Replication will generate an incremental backup chain going forward.

    This method allows you to save only one full backup and then only save data changes, which saves storage space.

    Forward Incremental Backup

    The incremental backup method generates a backup chain that includes the first full backup file (VBK) and a set of forward incremental backup (VIB) files that follow. In addition, the incremental backup chain forward includes full synthetic backup files and active full backups, which divide the backup chain into shorter series.

    Veeam Backup & Replication creates an incremental backup chain forward in the following form:

    1. In the first backup job session, Veeam Backup & Replication creates a full backup file in the backup repository.
    2. In subsequent backup job sessions, Veeam Backup & Replication only copies the data blocks of the virtual machine (VM) that have changed since the last backup session (full or incremental) and stores these blocks as an incremental backup file in the backup chain.
    3. On days when full synthetic backups or full active backups are scheduled, Veeam Backup & Replication creates a full backup file and adds it to the backup chain. Incremental restore points that are generated after this full backup file use it as a new starting point.
    4. After a new restore point is added to the backchain, Veeam Backup & Replication checks the retention policy set for the job. If Veeam Backup & Replication detects an outdated restore point, it will try to remove that point from the backup chain.

    Learn Veeam reversed incrementa chainl

    Incremental backups are the default way to create a backup chain with full synthetic backup enabled. To use this backup method, you can keep the default settings or select the following options in the backup job settings:

    1. Incremental Incremental Backup Mode Selection
    2. Enable full synthetic backup or full backup enabled. If full synthetic backups and full active backups are not enabled, Veeam Backup & Replication will generate an incremental backup chain permanently.

    Reverse Incremental Backup

    The reverse incremental backup method generates a backup chain that includes the last full backup file (VBK) and a set of reverse incremental backup (VRB) files that precede it.

    Veeam Backup & Replication creates an inverse incremental backup chain in the following form:

    1. In the first backup job session, Veeam Backup & Replication creates a full backup file in the backup repository.
    2. In subsequent backup job sessions, Veeam Backup & Replication copies only the data blocks of the virtual machine (VM) that have changed since the last backup session and imports these blocks into the full backup file to bring it to the most recent VM state. In addition, Veeam Backup & Replication creates a reverse incremental backup file that contains the data blocks that were replaced when the full backup file was restored, and this adds the reverse incremental backup file before the full backup file in the backup chain.
    3. After a new restore point is added to the backchain, Veeam Backup & Replication checks the retention policy set for the job. If Veeam Backup & Replication detects an outdated restore point, it removes it from the backup chain.

    The result is that the most recent restore point in the backup chain is always a full backup, and it is updated after each successful backup session.

    The reverse incremental backup method allows you to instantly restore a VM to the most recent state without the need for additional processing, as the most recent restore point is always a full backup file. If you need to restore a VM to a specific point in time, Veeam Backup & Replication applies the required VRB files to the VBK file to reach the desired recovery point.

    Veeam reversed incremental trainingTo use the reverse incremental backup method, you need to select the Reverse incremental option in the backup job settings.

    Switching Between Backup Methods

    You can easily change the backup methods. Veeam Backup & Replication does not replace the previous backup chain, but rather creates a new backup chain alongside the existing chain in the following ways:

    1. If you switch from the reverse incremental method to the incremental method permanently or incrementally forward, Veeam Backup & Replication creates a set of incremental backup files alongside the reverse incremental backup chain. The full backup file is used in the reverse incremental chain as a starting point for incremental backup files.
    2. If you switch from the incremental method permanently or incrementally forward to the reverse incremental method, Veeam Backup & Replication will first create a full backup file next to the incremental backup files. In each new job session, Veeam Backup & Replication updates this full backup file and adds inverse incremental backup files to the backup chain.
    3. If you switch from the incremental method permanently to the incremental method forward, Veeam Backup & Replication will create a full synthetic backup according to the specified timeline. When the number of restore points in the new chain reaches the maintenance limit, the old backup chain is deleted.
    4. If you switch from incremental forward to incremental permanently, full synthetic backup will no longer be created. When the number of restore points created from the last full backup reaches the retention limit, the old backup chain is deleted. From then on, with each restore point creation, the initial incremental file will be merged with the full backup file.

    Friday, February 28, 2025

    How to Secure SSH in Linux (SSH Hardening)

     

    How to Secure SSH in Linux (SSH Hardening)

    The Secure Shell (SSH) protocol is one of the essential tools for Linux system administrators. This tool allows you to manage Linux servers from the comfort of your office or even from the comfort of your home. After all, this method is much better than having to put on your jacket and go through security barriers to enter the cold server room. The word secure in Secure Shell means that everything you type or transmit is encrypted. This eliminates the possibility that someone could obtain sensitive data by connecting to your network through a sniffer.

    At this point in your Linux career, you need to know how to use Secure Shell or SSH to log in remotely and transfer files remotely. What you may not know is that the default configuration of SSH is actually relatively insecure. In this chapter, we'll explore ways to boost the default configuration. We'll explore how to use stronger encryption algorithms than the default, how to set up passwordless authentication, and how to set up a prison for Secure File Transfer Protocol (SFTP) users. As an added bonus, we'll explore how to scan SSH servers for vulnerable configurations and how to share a remote directory via Secure Shell Filesystem (SSHFS).

    In this chapter, we will explore the following topics:

    • Ensure that SSH protocol version 1 is disabled
    • Create and manage keys to log in without the need for a password
    • Disable root user login
    • Disable login with username and password
    • Configuring Secure Shell with Strong Encryption Algorithms
    • Setting Global Encryption Policies in RHEL 8/CentOS 8
    • FIPS Mode in CentOS 8/Red Hat 8
    • Configure more accurate logging
    • Access Control with Whitelisting and TCP Wrappers
    • Configuring automatic checkouts and security banners
    • Various other security settings
    • Configuring Different Settings for Different Hosts
    • Configure different settings for different users and groups
    • Scan an SSH server
    • Setting up a chroot environment for SFTP users
    • Setting up shared directories with SSHFS
    • Remote connection from Windows desktops

    So if you're ready, let's get started.

    Ensure that SSH protocol version 1 is disabled

    The SSH version 1 protocol, which is the original SSH protocol, has serious flaws and should never be used. This protocol is still available on most Linux distributions, but thankfully it's disabled by default. However, let's say you open your file and see this line:/etc/ssh/sshd_config

    Protocol 1
    

    Or you might see:

    Protocol 1, 2
    

    If you see this, you are facing a problem.

    The MAN Help page for files in Ubuntu says that version 1 of the protocol is still available for use with older devices. However, if you still have devices with such versions, you should seriously consider upgrading them. As Linux distributions are updated, you'll see that the SSH protocol version 1 is gradually being completely removed, as was the case with Red Hat and CentOS version 7.4.sshd_config

    Creating and Managing Keys for Passwordless Login

    SSH is an excellent set of tools used to communicate with remote servers. You can use the SSH component to enter the command line of a device remotely, and you can also use it to transfer files securely. The default way to use any of these components is to use a person's normal Linux account username and password. So, logging into the remote device from my OpenSUSE device terminal would look something like this:scpsftp

    donnie@linux-0ro8:~> ssh donnie@192.168.0.8
    donnie@192.168.0.8's password:
    

    While it's true that usernames and passwords are transmitted cryptographically over the network, making it harder for attackers to penetrate, it's still not the most secure way to do so. The problem is that the attackers have access to automated tools that can carry out password brute-force attacks against an SSH server. Botnets, such as Hail Mary Cloud, perform continuous scans across the internet to find servers with SSH-enabled.

    If a botnet detects that servers are allowing access to SSH via username and password, it initiates a brute-force password attack. Unfortunately, such attacks have been successful several times, especially when server operators allow the root user to log in via SSH.

    This old article provides more information about the Hail Mary Cloud botnet: Article Link.

    In the next section, we will look at two ways to help prevent these types of attacks:

    • Enabling SSH Login via Public Key Exchange
    • Disable root user login via SSH

    Now let's create a few keys.

    Creating an SSH Key Set for a User

    Each user has the option to create their own set of private and public keys. It doesn't matter if the user's client device is running Linux, macOS, Cygwin on Windows, or Bash Shell for Windows. In all these cases, the process of doing the work is exactly the same.

    Creating SSH keys for users

    There are many different types of keys you can create, and RSA keys with a length of 2048 bits are usually used as the default. Until not so long, RSA keys with a length of 2048 bits were considered strong enough for the foreseeable future. But now, the most recent guidance from the U.S. National Institute of Standards and Technology (NIST) recommends using an RSA key with a minimum of 3072 bits or an elliptical curve digital signature algorithm (ECDSA) key with a minimum of 384 bits. (Sometimes these ECDSA keys are also known as P-384). The reason for this recommendation is that they want to prepare us for quantum computing, which would be so powerful that it would render any weaker cryptographic algorithm obsolete. Of course, quantum computing is not yet operational, and so far it seems like it's always something that will come ten years from now, no matter what year we're in. But even if we assume that we ignore the problem of quantum computing, we must acknowledge that our current non-quantum computers are still getting more and more powerful. So, it's still not a bad idea to start using stronger crypto standards.

    To view the list of cryptographic algorithms recommended by NIST and the proposed key lengths, you can visit this link.

    For these few demos, let's switch to an Ubuntu 18.04 client. To create an RSA key pair with a length of 3072 bits, simply enter the following command:

    donnie@ubuntu1804-1:~$ ssh-keygen -t rsa -b 3072
    

    Here, we'll use the option to specify if we want to generate an RSA key, and we'll use the option to determine the bit length. When you are asked to enter the location and name of the keys, I just hit Enter to select the default values. You can leave the private key without a passphrase, but this method is not recommended.-t-b

    Note that if you choose a different name for your key files, you'll need to enter the full path of the files to make everything work properly. For example, in my case, I have to specify the path of the donnie_rsa keys./home/donnie/.ssh/donnie_rsa

    You will see your new keys in the .ssh directory:

    donnie@ubuntu1804-1:~$ ls -l .ssh
    total 8
    -rw------- 1 donnie donnie 2546 Aug 28 15:23 id_rsa
    -rw-r--r-- 1 donnie donnie 573 Aug 28 15:23 id_rsa.pub
    donnie@ubuntu1804-1:~$
    

    Here:

    • id_rsa It's your private key.
    • id_rsa.pub is your public key.

    As you can see, id_rsa has limited access(), which means that only you (the donnie user) can read and write it, which provides decent security. The public key (id_rsa.pub) is readable for others to easily use on other servers for SSH authentication.-rw-------

    Note that if you have created the default 2048-bit keys, the names will be similar.

    • id_rsa key is your private key, and only you can read and write it.
    • id_rsa.pub key is your public key that should be readable to everyone.

    For ECDSA keys, the default length is 256 bits. If you decide to use ECDSA instead of RSA, enter the following command to create a strong 384-bit key:

    donnie@ubuntu1804-1:~$ ssh-keygen -t ecdsa -b 384
    

    Either way, when you look at the .ssh directory, you'll see that the names of the ECDSA keys are different from the RSA keys:

    donnie@ubuntu1804-1:~$ ls -l .ssh
    total 8
    -rw------- 1 donnie donnie 379 May 27 17:43 id_ecdsa
    -rw-r--r-- 1 donnie donnie 225 May 27 17:43 id_ecdsa.pub
    donnie@ubuntu1804-1:~$
    

    The beauty of elliptic curve algorithms is that their seemingly short key lengths are just as safe as long RSA keys. Even the largest ECDSA keys require less computing power than RSA keys. The maximum key length you can use with ECDSA is 521 bits. (Yes, you read that right. 521 bits, not 524 bits.)

    So you may ask, why not only use 521-bit keys? The main reason is that 521-bit keys are not recommended by NIST. The reason for this is the concern of padding attacks, which can allow attackers to crack your encryption and steal your data.

    If you take a look at the MAN's guide page for, you'll notice that you can create an Ed25519-type key, sometimes referred to as the curve25519. This variant is not on the list of algorithms recommended by NIST, but there are a few reasons why some people prefer to use it.ssh-keygen

    The first reason is that RSA and DSA can disclose private key data when creating signatures if the operating system's random number generator is in trouble. ED25519 does not require the generation of random numbers when creating signatures, so it is resistant to this problem. Additionally, Ed25519 is coded to be much less vulnerable to side-channel attacks. (Side-channel attacks occur when someone tries to exploit vulnerabilities in the underlying operating system instead of a cryptographic algorithm.)

    The second reason why some people prefer Ed25519 is precisely because it is not on the NIST list. These people are people who, rightly or wrongly, do not trust the recommendations of government agencies.

    A few years ago, earlier this century, there was a scandal about the Dual Elliptic Curve Deterministic Random Bit Generator (Dual_EC_DRBG). It was a random number generator that was to be designed for use in elliptical curve cryptography. The problem was that initially, some independent researchers found that the manufacturer had the capabilities to create back doors, which anyone who was aware of could import. Interestingly, the only people who should have known about this capability were those who worked for the U.S. National Security Agency (NSA). At the request of the NSA, NIST placed Dual_EC_DRBG on its list of recommended algorithms, and this situation continued until April 2014, when it was finally removed.

    For more details, you can visit the following links:

    To read more details about ED25519, you can visit the following link:

    For Ed25519, there is only one key size, which is 256 bits. So, to create a curve25519 key, just use the following command:

    donnie@ubuntu1804-1:~$ ssh-keygen -t ed25519
    

    Here are the keys I've created:

    donnie@ubuntu1804-1:~$ ls -l .ssh
    total 8
    -rw------- 1 donnie donnie 464 May 27 20:11 id_ed25519
    -rw-r--r-- 1 donnie donnie 101 May 27 20:11 id_ed25519.pub
    donnie@ubuntu1804-1:~$
    

    However, ED25519 has some potential disadvantages:

    1. Lack of support by legacy SSH clients: However, this issue shouldn't be an issue when everyone on the team is using new operating systems and up-to-date SSH clients.

    2. Only one fixed key length: This key is equivalent to 256-bit elliptic curve or 3,000-bit RSA encryption algorithms. So it may not be as good for foresight as some of the other algorithms we've covered.

    3. Non-compliance with NIST requirements: If your organization must comply with NIST recommendations, you will not be able to use this key.

    Finally, another type of key that can still be generated by ssh-keygen is the old DSA key. But it is not recommended to use this type. The DSA algorithm is outdated, fragile, and highly insecure by modern standards. So, when you get to the DSA, just say no.

    Transferring the public key to the remote server allows the server to identify both me and my client's device. Before I can transfer my public key to the remote server, I must first add the private key to my session keyring. This requires two instructions. (One command runs ssh-agent, and the other adds the private key to the keyring):

    donnie@ubuntu1804-1:~$ exec /usr/bin/ssh-agent $SHELL
    donnie@ubuntu1804-1:~$ ssh-add
    Enter passphrase for /home/donnie/.ssh/id_rsa:
    Identity added: /home/donnie/.ssh/id_rsa (/home/donnie/.ssh/id_rsa)
    Identity added: /home/donnie/.ssh/id_ecdsa (/home/donnie/.ssh/id_ecdsa)
    Identity added: /home/donnie/.ssh/id_ed25519 (donnie@ubuntu1804-1)
    donnie@ubuntu1804-1:~$
    

    Finally, I can move my public keys to the CentOS server, which is located at 192.168.0.8:

    donnie@ubuntu1804-1:~$ ssh-copy-id donnie@192.168.0.8
    The authenticity of host '192.168.0.8 (192.168.0.8)' can't be established.
    ECDSA key fingerprint is
    SHA256:jUVyJDJl2AHJgyrqLudOWx4YUtbUxD88tv5oKeFtfXk.
    Are you sure you want to continue connecting (yes/no)? yes
    /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to
    filter out any that are already installed
    /usr/bin/ssh-copy-id: INFO: 3 key(s) remain to be installed -- if you are
    prompted now it is to install the new keys
    donnie@192.168.0.8's password:
    Number of key(s) added: 3
    Now try logging into the machine, with: "ssh 'donnie@192.168.0.8'"
    and check to make sure that only the key(s) you wanted were added.
    donnie@ubuntu1804-1:~$
    

    With this, your public keys have been added to the destination server, and you can log in to the server securely. Usually, you only make a pair of keys of the type you have chosen. As you can see here, I've made three pairs of keys, one pair of each type. All three private keys have been added to my session keyring, and all three public keys have been moved to the remote server. The next time I log in, I'll use Key Exchange and won't need to enter a password:

    donnie@ubuntu1804-1:~$ ssh donnie@192.168.0.8
    Last login: Wed Aug 28 13:43:50 2019 from 192.168.0.225
    [donnie@localhost ~]$
    

    As I said earlier, usually you only make one pair of keys for each device. However, there are exceptions to this rule. Some administrators prefer to use a different key pair for each server they manage, rather than using the same key pair for all servers. A convenient way to do this is to construct keys with file names that match the hostnames of the respective servers. You can then use the -i option to specify the key pair you want to use.

    In this example, I only have one server, but I have different keys for it. Suppose I prefer to use the Ed25519 keys:

    donnie@ubuntu1804-1:~$ ssh -i ~/.ssh/id_ed25519 donnie@192.168.0.8
    Last login: Wed Aug 28 15:58:26 2019 from 192.168.0.3
    [donnie@localhost ~]$
    

    Now, you may be asking, if I log in without entering a password, how is it secure? The answer is that when I close the terminal window of my client device that I used to log in, the private key will be removed from my session keyring. When I open a new terminal and want to log in to the remote server, I see this message:

    donnie@ubuntu1804-1:~$ ssh donnie@192.168.0.8
    Enter passphrase for key '/home/donnie/.ssh/id_rsa':
    Last login: Wed Aug 28 16:00:33 2019 from 192.168.0.3
    [donnie@localhost ~]$
    

    So every time I log in to this server, I have to enter my private key password (unless I add it back to the session keyring with the two commands I showed earlier)...