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.

21 lines
684 B

  1. # -*- coding: utf-8 -*-
  2. # © 2016 Therp BV <http://therp.nl>
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  4. import os
  5. from openerp import http
  6. from openerp.http import request
  7. from openerp.tools.misc import file_open
  8. class Letsencrypt(http.Controller):
  9. @http.route('/.well-known/acme-challenge/<filename>', auth='none')
  10. def acme_challenge(self, filename):
  11. try:
  12. with file(
  13. os.path.join(request.env['letsencrypt'].get_challenge_dir(),
  14. filename)
  15. ) as challenge:
  16. return challenge.read()
  17. except IOError:
  18. pass
  19. return request.not_found()