v20 certbot not working

Bergwerk IT

Silver Partner
Joined
Dec 18, 2020
Messages
17
Reaction score
0
after adding a letsencrypt snippet containing the following to nginx, creating the directory structure and adding a ping.txt file containing "pong" I can reach this at http://3cx.domain.tld/.well-known/acme-challenge/ping.txt. This can be reached per browser using HTTP as well as CURL. However, after installing certbot and setting "webroot-path = /var/www/letsencrypt" in /etc/letsencrypt/cli.ini and running certbot certonly --debug-challenges -v --test-cert --webroot -d 3cx.domain.tld -w /var/www/letsencrypt it fails. This same process works on all other debian boxes we have that is running either Apache or NginX.

Code:
#############################################################################
# Configuration file for Let's Encrypt ACME Challenge location
# This file is already included in listen_xxx.conf files.
# Do NOT include it separately!
#############################################################################
#
# This config enables to access /.well-known/acme-challenge/xxxxxxxxxxx
# on all our sites (HTTP), including all subdomains.
# This is required by ACME Challenge (webroot authentication).
# You can check that this location is working by placing ping.txt here:
# /var/www/letsencrypt/.well-known/acme-challenge/ping.txt
# And pointing your browser to:
# http://xxx.domain.tld/.well-known/acme-challenge/ping.txt
#
# Sources:
# https://community.letsencrypt.org/t/howto-easy-cert-generation-and-renewal-with-nginx/3491
#
#############################################################################

# Rule for legitimate ACME Challenge requests (like /.well-known/acme-challenge/xxxxxxxxx)
# We use ^~ here, so that we don't check other regexes (for speed-up). We actually MUST cancel
# other regex checks, because in our other config files have regex rule that denies access to files with dotted names.

location ^~ /.well-known/acme-challenge/ {

    allow all;

    proxy_redirect off;

    # Set correct content type. According to this:
    # https://community.letsencrypt.org/t/using-the-webroot-domain-verification-method/1445/29
    # Current specification requires "text/plain" or no content header at all.
    # It seems that "text/plain" is a safe option.
    default_type "text/plain";

    # This directory must be the same as in /etc/letsencrypt/cli.ini
    # as "webroot-path" parameter. Also don't forget to set "authenticator" parameter
    # there to "webroot".
    # Do NOT use alias, use root! Target directory is located here:
    # /var/www/common/letsencrypt/.well-known/acme-challenge/
    root         /var/www/letsencrypt;

    try_files $uri =404;

    break;
}

# Hide /acme-challenge subdirectory and return 404 on all requests.
# It is somewhat more secure than letting Nginx return 403.
# Ending slash is important!
location = /.well-known/acme-challenge/ {
    return 404;
}

If anyone has any idea how this could happen please let me know.

thx
chuck
 
What are you trying to do? You dont need to install anything on your pbx. Anyway this also not supported.
 
this is an onsite install not one hosted by 3cx.
 
That doesnt matter..
 
  • Like
Reactions: Evolute IT
1. whether "supported" or not is irrelevant.
2. without certbot you get no letsencrypt so saying its not needed is not correct.
 
Certbot is already there... what are you trying to do? To adjust or install something isnt supported.
 
certbot was NOT installed. I installed it. and I have figured out that it isnt a certbot issue its a nginx issue.
 
Again, for what do you need anything installed on the pbx?
 
so I can get a ssl cert from letsencrypt. it is now working. problem was 3cx nginx config blocking remote access to port 80 which is needed for the initial cert. now have a cert and the world is good. thx.
 
LE is working fine without any customization. If you want your own certificate you need to get it from somewhere else. This way isn't supported and could break your pbx anytime.
 
  • Like
Reactions: Evolute IT
na. wont break and works fine. wont even realize whats going on. but thanks for the input.
 
I wont support this for any customer... But anyway, thats on you than.
 
  • Like
Reactions: Evolute IT
well this is our own cert and we also support our customers and has not been a problem for years. if you can figure out how 3cx breaks things you can fix it. for the most part they get things pretty good. but every once in a while they make decisions that make no sense what so ever.
 
well this is our own cert and we also support our customers and has not been a problem for years. if you can figure out how 3cx breaks things you can fix it. for the most part they get things pretty good. but every once in a while they make decisions that make no sense what so ever.
If you use your own cert thats no problem. You are using an LE cert and thats not your own cert. We have also customers with there own fqdn and cert, but going the supported way without any problems at all.
 
na. wont break and works fine. wont even realize whats going on. but thanks for the input.
This isnt the same PBX with the web client audio problem is it?
 
yes. upgraded from 18 to 20. fresh install with migrated config from the old v18. normally these go quite smooth. this time its a bit weird.
 
Thats because you messed with the webserver config. This should never be messed with.

na. wont break and works fine. wont even realize whats going on. but thanks for the input.

Your other post seems to suggest otherwise. This is why we provide Let's Encrypt certificates of our own. Thisi s why we do allow the uploading of 3rd party certificates by just uploading the certificate file and key file.

See this document https://www.3cx.com/blog/docs/ssl-crt-csr/

You should never need to touch the NGINX config file.
 
  • Like
Reactions: bitn2
the nginx config was not adjusted on the old server.

the import of the v18 migration would only continue with an uploaded cert so we had to use the letsencrypt cert and key. unfortunately this runs out in about a week to we needed to get letsencrypt working. and because 3cx only supports letsencrypt for its own domains and not for custom domains we needed to install certbot (which was not installed initially).

once we figured out that port 80 was only open on the internal LAN it was easy to figure out where the problem was.
 
and the webclient situation is only the audio and NOT https.
 
  • Like
Reactions: bitn2

Forum statistics

Threads
111,956
Messages
589,928
Members
164,861
Latest member
LewisJC