You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

164 lines
5.4 KiB

  1. .. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
  2. :alt: License: AGPL-3
  3. =============================================
  4. Request SSL certificates from letsencrypt.org
  5. =============================================
  6. This module was written to have your Odoo installation request SSL certificates
  7. from https://letsencrypt.org automatically.
  8. Installation
  9. ============
  10. After installation, this module generates a private key for your account at
  11. letsencrypt.org automatically in ``$data_dir/letsencrypt/account.key``. If you
  12. want or need to use your own account key, replace the file.
  13. For certificate requests to work, your site needs to be accessible via plain
  14. HTTP, see below for configuration examples in case you force your clients to
  15. the SSL version.
  16. After installation, trigger the cronjob `Update letsencrypt certificates` and
  17. watch your log for messages.
  18. This addon depends on the ``openssl`` binary and the ``acme_tiny`` and ``IPy``
  19. python modules.
  20. For installing the OpenSSL binary you can use your distro package manager.
  21. For Debian and Ubuntu, that would be:
  22. sudo apt-get install openssl
  23. For installing the ACME-Tiny python module, use the PIP package manager:
  24. sudo pip install acme-tiny
  25. For installing the IPy python module, use the PIP package manager:
  26. sudo pip install IPy
  27. Configuration
  28. =============
  29. This addons requests a certificate for the domain named in the configuration
  30. parameter ``web.base.url`` - if this comes back as ``localhost`` or the like,
  31. the module doesn't request anything.
  32. If you want your certificate to contain multiple alternative names, just add
  33. them as configuration parameters ``letsencrypt.altname.N`` with ``N`` starting
  34. from ``0``. The amount of domains that can be added are subject to `rate
  35. limiting <https://community.letsencrypt.org/t/rate-limits-for-lets-encrypt/6769>`_.
  36. Note that all those domains must be publicly reachable on port 80 via HTTP, and
  37. they must have an entry for ``.well-known/acme-challenge`` pointing to your odoo
  38. instance.
  39. Usage
  40. =====
  41. The module sets up a cronjob that requests and renews certificates automatically.
  42. After the first run, you'll find a file called ``domain.crt`` in
  43. ``$datadir/letsencrypt``, configure your SSL proxy to use this file as certificate.
  44. .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
  45. :alt: Try me on Runbot
  46. :target: https://runbot.odoo-community.org/runbot/149/8.0
  47. For further information, please visit:
  48. * https://www.odoo.com/forum/help-1
  49. In depth configuration
  50. ======================
  51. This module uses ``openssl`` to generate CSRs suitable to be submitted to
  52. letsencrypt.org. In order to do this, it copies ``/etc/ssl/openssl.cnf`` to a
  53. temporary and adapts it according to its needs (currently, that's just adding a
  54. ``[SAN]`` section if necessary). If you want the module to use another configuration
  55. template, set config parameter ``letsencrypt.openssl.cnf``.
  56. After refreshing the certificate, the module attempts to run the content of
  57. ``letsencrypt.reload_command``, which is by default ``sudo service nginx reload``.
  58. Change this to match your server's configuration.
  59. You'll also need a matching sudo configuration, like::
  60. your_odoo_user ALL = NOPASSWD: /usr/sbin/service nginx reload
  61. Further, if you force users to https, you'll need something like for nginx::
  62. if ($scheme = "http") {
  63. set $redirect_https 1;
  64. }
  65. if ($request_uri ~ ^/.well-known/acme-challenge/) {
  66. set $redirect_https 0;
  67. }
  68. if ($redirect_https) {
  69. rewrite ^ https://$server_name$request_uri? permanent;
  70. }
  71. and this for apache::
  72. RewriteEngine On
  73. RewriteCond %{HTTPS} !=on
  74. RewriteCond %{REQUEST_URI} "!^/.well-known/"
  75. RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
  76. In case you need to redirect other nginx sites to your Odoo instance, declare
  77. an upstream for your odoo instance and do something like::
  78. location /.well-known {
  79. proxy_pass http://yourodooupstream;
  80. }
  81. If you're using a multi-database installation (with or without dbfilter option)
  82. where /web/databse/selector returns a list of more than one database, then
  83. you need to add ``letsencrypt`` addon to wide load addons list
  84. (by default, only ``web`` addon), setting ``--load`` option.
  85. For example, ``--load=web,letsencrypt``
  86. Bug Tracker
  87. ===========
  88. Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-tools/issues>`_.
  89. In case of trouble, please check there if your issue has already been reported.
  90. If you spotted it first, help us smashing it by providing a detailed and welcomed feedback
  91. `here <https://github.com/OCA/server-tools/issues/new?body=module:%20letsencrypt%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
  92. Credits
  93. =======
  94. Contributors
  95. ------------
  96. * Holger Brunn <hbrunn@therp.nl>
  97. * Antonio Espinosa <antonio.espinosa@tecnativa.com>
  98. ACME implementation
  99. -------------------
  100. * https://github.com/diafygi/acme-tiny/blob/master/acme_tiny.py
  101. Icon
  102. ----
  103. * https://helloworld.letsencrypt.org
  104. Maintainer
  105. ----------
  106. .. image:: https://odoo-community.org/logo.png
  107. :alt: Odoo Community Association
  108. :target: https://odoo-community.org
  109. This module is maintained by the OCA.
  110. OCA, or the Odoo Community Association, is a nonprofit organization whose
  111. mission is to support the collaborative development of Odoo features and
  112. promote its widespread use.
  113. To contribute to this module, please visit https://odoo-community.org.