How To Install python-backports.ssl-match-hostname on Ubuntu 18.04

In this tutorial we learn how to install python-backports.ssl-match-hostname on Ubuntu 18.04. python-backports.ssl-match-hostname is Backport of the Python 3.5 SSL hostname checking function

Introduction

In this tutorial we learn how to install python-backports.ssl-match-hostname on Ubuntu 18.04.

What is python-backports.ssl-match-hostname

python-backports.ssl-match-hostname is:

The Secure Sockets layer is only actually secure if you check the hostname in the certificate returned by the server to which you are connecting, and verify that it matches to hostname that you are trying to reach.

But the matching logic, defined in RFC2818, can be a bit tricky to implement on your own. So the ssl package in the Standard Library of Python 3.2 and greater now includes a match_hostname() function for performing this check instead of requiring every application to implement the check separately.

This package contains a backport of the ssl.match_hostname function for Python 2.4 and above.

There are three methods to install python-backports.ssl-match-hostname on Ubuntu 18.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install python-backports.ssl-match-hostname Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install python-backports.ssl-match-hostname using apt-get by running the following command:

sudo apt-get -y install python-backports.ssl-match-hostname

Install python-backports.ssl-match-hostname Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install python-backports.ssl-match-hostname using apt by running the following command:

sudo apt -y install python-backports.ssl-match-hostname

Install python-backports.ssl-match-hostname Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install python-backports.ssl-match-hostname using aptitude by running the following command:

sudo aptitude -y install python-backports.ssl-match-hostname

How To Uninstall python-backports.ssl-match-hostname on Ubuntu 18.04

To uninstall only the python-backports.ssl-match-hostname package we can use the following command:

sudo apt-get remove python-backports.ssl-match-hostname

Uninstall python-backports.ssl-match-hostname And Its Dependencies

To uninstall python-backports.ssl-match-hostname and its dependencies that are no longer needed by Ubuntu 18.04, we can use the command below:

sudo apt-get -y autoremove python-backports.ssl-match-hostname

Remove python-backports.ssl-match-hostname Configurations and Data

To remove python-backports.ssl-match-hostname configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge python-backports.ssl-match-hostname

Remove python-backports.ssl-match-hostname configuration, data, and all of its dependencies

We can use the following command to remove python-backports.ssl-match-hostname configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge python-backports.ssl-match-hostname

References

Summary

In this tutorial we learn how to install python-backports.ssl-match-hostname package on Ubuntu 18.04 using different package management tools: apt, apt-get and aptitude.