1
0
mirror of https://github.com/certbot/certbot.git synced 2026-01-26 07:41:33 +03:00
Adrien Ferrand 06a53cb7df Upgrade to mypy 0.812 (#8748)
Fixes #8425

This PR upgrades mypy to the latest version available, 0.812.

Given the advanced type inference capabilities provided by this newer version, this PRs also fixes various type inconsistencies that are now detected. Here are the non obvious changes done to fix types:
* typing in mixins has been solved using `Protocol` classes, as recommended by mypy (https://mypy.readthedocs.io/en/latest/more_types.html#mixin-classes, https://mypy.readthedocs.io/en/stable/protocols.html)
* `cast` when we are playing with `Union` types

This PR also disables the strict optional checks that have been enable by default in recent versions of mypy. Once this PR is merged, I will create an issue to study how these checks can be enabled.

`typing.Protocol` is available only since Python 3.8. To keep compatibility with Python 3.6, I try to import the class `Protocol` from `typing`, and fallback to assign `object` to `Protocol` if that fails. This way the code is working with all versions of Python, but the mypy check can be run only with Python 3.8+ because it needs the protocol feature. As a consequence, tox runs mypy under Python 3.8.

Alternatives are:
* importing `typing_extensions`, that proposes backport of newest typing features to Python 3.6, but this implies to add a dependency to Certbot just to run mypy
* redesign the concerned classes to not use mixins, or use them differently, but this implies to modify the code itself even if there is nothing wrong with it and it is just a matter of instructing mypy to understand in which context the mixins can be used
* ignoring type for these classes with `# type: ignore` but we loose the benefit of mypy for them

* Upgrade mypy

* First step for acme

* Cast for the rescue

* Fixing types for certbot

* Fix typing for certbot-nginx

* Finalize type fixes, configure no optional strict check for mypy in tox

* Align requirements

* Isort

* Pylint

* Protocol for python 3.6

* Use Python 3.9 for mypy, make code compatible with Python 3.8<

* Pylint and mypy

* Pragma no cover

* Pythonic NotImplemented constant

* More type definitions

* Add comments

* Simplify typing logic

* Use vararg tuple

* Relax constraints on mypy

* Add more type

* Do not silence error if target is not defined

* Conditionally import Protocol for type checking only

* Clean up imports

* Add comments

* Align python version linting with mypy and coverage

* Just ignore types in an unused module

* Add comments

* Fix lint
2021-04-02 11:54:40 -07:00
2021-04-02 11:54:40 -07:00
2021-04-02 11:54:40 -07:00
2021-04-02 11:54:40 -07:00
2021-03-02 13:50:04 -08:00
2021-03-02 13:50:04 -08:00
2021-03-02 13:50:04 -08:00
2021-03-02 13:50:04 -08:00
2021-03-02 13:50:04 -08:00
2021-03-02 13:50:04 -08:00
2021-04-02 11:54:40 -07:00
2021-02-03 12:03:09 -08:00
2021-02-03 12:03:09 -08:00
2019-12-09 15:50:20 -05:00
2021-03-23 13:01:01 -07:00
2021-03-02 13:49:58 -08:00
2021-02-03 12:03:09 -08:00
2021-03-02 13:49:58 -08:00
2020-05-05 09:38:20 -07:00
2021-04-02 11:54:40 -07:00

Certbot is part of EFFs effort to encrypt the entire Internet. Secure communication over the Web relies on HTTPS, which requires the use of a digital certificate that lets browsers verify the identity of web servers (e.g., is that really google.com?). Web servers obtain their certificates from trusted third parties called certificate authorities (CAs). Certbot is an easy-to-use client that fetches a certificate from Lets Encrypt—an open certificate authority launched by the EFF, Mozilla, and others—and deploys it to a web server.

Anyone who has gone through the trouble of setting up a secure website knows what a hassle getting and maintaining a certificate is. Certbot and Lets Encrypt can automate away the pain and let you turn on and manage HTTPS with simple commands. Using Certbot and Let's Encrypt is free, so theres no need to arrange payment.

How you use Certbot depends on the configuration of your web server. The best way to get started is to use our interactive guide. It generates instructions based on your configuration settings. In most cases, youll need root or administrator access to your web server to run Certbot.

Certbot is meant to be run directly on your web server, not on your personal computer. If youre using a hosted service and dont have direct access to your web server, you might not be able to use Certbot. Check with your hosting provider for documentation about uploading certificates or using certificates issued by Lets Encrypt.

Certbot is a fully-featured, extensible client for the Let's Encrypt CA (or any other CA that speaks the ACME protocol) that can automate the tasks of obtaining certificates and configuring webservers to use them. This client runs on Unix-based operating systems.

To see the changes made to Certbot between versions please refer to our changelog.

Contributing

If you'd like to contribute to this project please read Developer Guide.

This project is governed by EFF's Public Projects Code of Conduct.

How to run the client

The easiest way to install and run Certbot is by visiting certbot.eff.org, where you can find the correct instructions for many web server and OS combinations. For more information, see Get Certbot.

Understanding the client in more depth

To understand what the client is doing in detail, it's important to understand the way it uses plugins. Please see the explanation of plugins in the User Guide.

Documentation: https://certbot.eff.org/docs

Software project: https://github.com/certbot/certbot

Notes for developers: https://certbot.eff.org/docs/contributing.html

Main Website: https://certbot.eff.org

Let's Encrypt Website: https://letsencrypt.org

Community: https://community.letsencrypt.org

ACME spec: RFC 8555

ACME working area in github (archived): https://github.com/ietf-wg-acme/acme

Azure Pipelines CI status

System Requirements

See https://certbot.eff.org/docs/install.html#system-requirements.

Current Features

  • Supports multiple web servers:
    • apache/2.x
    • nginx/0.8.48+
    • webroot (adds files to webroot directories in order to prove control of domains and obtain certificates)
    • standalone (runs its own simple webserver to prove you control a domain)
    • other server software via third party plugins
  • The private key is generated locally on your system.
  • Can talk to the Let's Encrypt CA or optionally to other ACME compliant services.
  • Can get domain-validated (DV) certificates.
  • Can revoke certificates.
  • Adjustable RSA key bit-length (2048 (default), 4096, ...).
  • Adjustable EC key (secp256r1 (default), secp384r1, secp521r1).
  • Can optionally install a http -> https redirect, so your site effectively runs https only (Apache only)
  • Fully automated.
  • Configuration changes are logged and can be reverted.
  • Supports an interactive text UI, or can be driven entirely from the command line.
  • Free and Open Source Software, made with Python.

For extensive documentation on using and contributing to Certbot, go to https://certbot.eff.org/docs. If you would like to contribute to the project or run the latest code from git, you should read our developer guide.

Description
Certbot - это инструмент EFF для получения сертификатов от Let's Encrypt и (опционально) автоматического включения HTTPS на вашем сервере. Он также может выступать в качестве клиента для любого другого центра сертификации, использующего протокол ACME
Readme 124 MiB
Languages
Python 94.1%
Shell 3.7%
Batchfile 0.8%
Makefile 0.7%
NSIS 0.3%
Other 0.2%