How to acme challenge with Website runnning Apache, Django and FreeBSD

Please fill out the fields below so we can help you better. Note: you must provide your domain name to get help. Domain names for issued certificates are all made public in Certificate Transparency logs (e.g. crt.sh | example.com), so withholding your domain name here does not increase secrecy, but only makes it harder for us to provide help.

My domain is: http://emplois.kagan.ch

I ran this command:

pip install letsencrypt
letsencrypt · PyPI

certbot/certbot: Certbot is EFF's tool to obtain certs from Let's Encrypt and (optionally) auto-enable HTTPS on your server. It can also act as a client for any other CA that uses the ACME protocol. (github.com)

watching videos on youtube, google searching, and making changes to apache file

sudo certbot certonly --webroot but challenge failed... changing the root from the directory to the static files directory...

apachectl -k restart

It produced this output:

My web server is (include version):
Apache 2.4
The operating system my web server runs on is (include version): FreeBSD 13.1

My hosting provider, if applicable, is: Google Cloud

I can login to a root shell on my machine (yes or no, or I don't know): yes

I'm using a control panel to manage my site (no, or provide the name and version of the control panel): no

The version of my client is (e.g. output of certbot --version or certbot-auto --version if you're using Certbot): certbot 1.27.0

not sure about if it works on bsd but try sudo certbot --apache?

3 Likes

...with exactly what message? Did you specify the correct webroot path? Was Apache running when you ran this?

3 Likes

yes I don't know what the correct webpath would be ...

httpd-vhosts.conf: 463 lines, 13647 characters.
root@videotron:/usr/local/etc/apache24/extra # apachectl -k restart
root@videotron:/usr/local/etc/apache24/extra # certbot certonly --webroot
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Please enter the domain name(s) you would like on your certificate (comma and/or
space separated) (Enter 'c' to cancel): emplois.kagan.ch
Requesting a certificate for emplois.kagan.ch
Input the webroot for emplois.kagan.ch: (Enter 'c' to cancel): /usr/home/sixpiece/python/emploiquebec/emploiquebec/

Certbot failed to authenticate some domains (authenticator: webroot). The Certificate Authority reported these problems:
Domain: emplois.kagan.ch
Type: unauthorized
Detail: 108.61.177.246: Invalid response from http://emplois.kagan.ch/.well-known/acme-challenge/vZurjdgsG_g79rDPYHlSsl5ckyPpczMSDYY8M8VEfUc: 404

Hint: The Certificate Authority failed to download the temporary challenge files created by Certbot. Ensure that the listed domains serve their content from the provided --webroot-path/-w and that files created there can be downloaded from the internet.

Some challenges have failed.
Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.
root@videotron:/usr/local/etc/apache24/extra # certbot certonly --webroot
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Please enter the domain name(s) you would like on your certificate (comma and/or
space separated) (Enter 'c' to cancel): /usr/home/sixpiece/python/emploiquebec/
Requesting a certificate for /usr/home/sixpiece/python/emploiquebec/
An unexpected error occurred:
Error creating new order :: Cannot issue for "/usr/home/sixpiece/python/emploiquebec/": Domain name contains an invalid character
Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.
root@videotron:/usr/local/etc/apache24/extra # certbot certonly --webroot
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Please enter the domain name(s) you would like on your certificate (comma and/or
space separated) (Enter 'c' to cancel): emplois.kagan.ch
Requesting a certificate for emplois.kagan.ch
Input the webroot for emplois.kagan.ch: (Enter 'c' to cancel): /usr/home/sixpiece/python/emploiquebec/

Certbot failed to authenticate some domains (authenticator: webroot). The Certificate Authority reported these problems:
Domain: emplois.kagan.ch
Type: unauthorized
Detail: 108.61.177.246: Invalid response from http://emplois.kagan.ch/.well-known/acme-challenge/5538YZvQq25pJ6cueamf83FJn7rXTNxi_IPIkmhPjKA: 404

Hint: The Certificate Authority failed to download the temporary challenge files created by Certbot. Ensure that the listed domains serve their content from the provided --webroot-path/-w and that files created there can be downloaded from the internet.

Some challenges have failed.
Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.
root@videotron:/usr/local/etc/apache24/extra #

Certbot failing to install on apache / django sites - Help - Let's Encrypt Community Support (letsencrypt.org)

I just tried this ... (no luck yet)

Please provide the actual, literal steps you did instead of simply refering to an entire different thread. Please provide Apache configuration files et cetera.

Also, where did you get the recommendation to use pip install letsencrypt? That's not the recommended method of installing Certbot on FreeBSD. The fact the term "letsencrypt" for Certbot is like, ANCIENT and there is official documentation at Certbot Instructions | Certbot.

4 Likes

That's going to be very important to determine, and the only way to know for sure would be to check your Apache config files. I'd guess, given that this is FreeBSD, it would be something like /usr/local/www/html unless you've configured it to use something different. I don't know where your path of /usr/home/sixpiece/python/emploiquebec/ comes from.

4 Likes

well we are talking about django so I presume the root is where the manage.py files are? this is the root that I have set with apache... it works you can view the website at http://emplois.kagan.ch

I tried making some of the commands universal instead of within the Virtual Host path. I tried different paths outside of the root . I installed the pip letsencrypt and followed the steps until step 5. django-letsencrypt · PyPI

Installation & Configuration

  1. pip install django-letsencrypt
  2. Add letsencrypt to your INSTALLED_APPS

INSTALLED_APPS = [ ... , 'letsencrypt', ... , ]

  1. Include the letsencrypt in your project's urls.py, or where applicable (usually your root urls.py).

re_path(r'^.well-known/', include('letsencrypt.urls'))

  1. Run manage.py migrate to create the required table for the letsencrypt model
  • starting here I have trouble :

  1. Create your ACME Challenge objects in your Django admin interface
  2. Test your ACME Challenge objects and their responses by visiting them:
{Django Site}/.well-known/acme-challenge/challenge_text
  1. Enjoy your easy to manage ACME Challenges inside your Django project!

from step 5 to 7

I also tried commenting everything out... that didn't work ... WSGI stuff

Apparently not, or you wouldn't be getting the 404 error.

Here's what I see there:
image

3 Likes

yes exactly... that's all it is now... there's also an admin page Connexion | Site d’administration de Django

very interesting... it also doesn't work ...

root@videotron:/usr/home/sixpiece/python/emploiquebec/splashpage # sudo certbot certonly --webroot
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Please enter the domain name(s) you would like on your certificate (comma and/or
space separated) (Enter 'c' to cancel): /usr/home/sixpiece/python/emploiquebec/splashpage/
Requesting a certificate for /usr/home/sixpiece/python/emploiquebec/splashpage/
An unexpected error occurred:
Error creating new order :: Cannot issue for "/usr/home/sixpiece/python/emploiquebec/splashpage/": Domain name contains an invalid character
Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.
root@videotron:/usr/home/sixpiece/python/emploiquebec/splashpage # sudo certbot certonly --webroot
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Please enter the domain name(s) you would like on your certificate (comma and/or
space separated) (Enter 'c' to cancel): emplois.kagan.ch
Requesting a certificate for emplois.kagan.ch
Input the webroot for emplois.kagan.ch: (Enter 'c' to cancel): /usr/home/sixpiece/python/emploiquebec/splashpage

Certbot failed to authenticate some domains (authenticator: webroot). The Certificate Authority reported these problems:
  Domain: emplois.kagan.ch
  Type:   unauthorized
  Detail: 108.61.177.246: Invalid response from http://emplois.kagan.ch/.well-known/acme-challenge/v869xU6IR8ggjE8EgkxVjTkzJsX4szdJ4CAIZBNhSO4: 404

Hint: The Certificate Authority failed to download the temporary challenge files created by Certbot. Ensure that the listed domains serve their content from the provided --webroot-path/-w and that files created there can be downloaded from the internet.

Some challenges have failed.
Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.
root@videotron:/usr/home/sixpiece/python/emploiquebec/splashpage # sudo certbot certonly --webroot
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Please enter the domain name(s) you would like on your certificate (comma and/or
space separated) (Enter 'c' to cancel): /usr/home/sixpiece/python/emploiquebec/splashpage/index.html
Requesting a certificate for /usr/home/sixpiece/python/emploiquebec/splashpage/index.html
An unexpected error occurred:
Error creating new order :: Cannot issue for "/usr/home/sixpiece/python/emploiquebec/splashpage/index.html": Domain name contains an invalid character
Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.
root@videotron:/usr/home/sixpiece/python/emploiquebec/splashpage #

the error log can be viewed at the following link :

videotron.fr/letsencrypt.log

/usr/home/sixpiece/python/emploiquebec/splashpage/ is obviously not your domain name; I don't know why you keep trying with that.

You're getting 404 errors on the challenge. That means, assuming your DNS records are pointing to the correct IP address (108.61.177.246), that you're using the wrong webroot path. You need to figure out what the correct path is, or post your virtual host config file and perhaps one of us can figure it out.

3 Likes

videotron.fr/letsencrypt.log.1 here is the error page with a different root the one I believe is root...

right I never thought it was splashpage but a lot of my attempts are things that I don't think will work but I am trying them in an ad hoc manner to see if they will. The reason for that attempt was because of your earlier reply here's what I see here ... Bonjour vous etes a l'index which you make a good point it's not the index.html anyways... even that produces it it's simply an http response from the view... in the splashpage app of the Emploiquebec app...

having said all that the path is
/usr/home/sixpiece/python/emploiquebec/ the one that you suggest that you don't know where it comes from ...

also since you are demanding the httpd.conf virtual host file , it is here...

<VirtualHost *:80>
    WSGIDaemonProcess emplois.kagan.ch python-home=/usr/home/sixpiece/env python-path=/usr/home/sixpiece/python/emploiquebec/
    WSGIProcessGroup emplois.kagan.ch
    WSGIScriptAlias / /usr/home/sixpiece/python/emploiquebec/emploiquebec/wsgi.py
    ServerName emplois.kagan.ch
    DocumentRoot /usr/home/sixpiece/python/emploiquebec/emploiquebec/
</VirtualHost>

although I don't think it will help for anything...

it's working it's not an issue this part it's the let's encrypt that is not working...


maybe it's something in here that I am supposed to do?


file structure at root...

emplois.kagan.ch/.well-known/acme-challenge/test there's something here also maybe it is similar to the nodejs setup I have??? i created this in the administration panel the application adds this it's a bit confusing but I don't know what to do or think just yet...