Error running certbot behind a http proxy

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: cubacatering.avianet.cu

I ran this command:sudo certbot --apache

It produced this output:Saving debug log to /var/log/letsencrypt/letsencrypt.log
Enter email address (used for urgent renewal and security notices)
(Enter 'c' to cancel): ******@gmail.com
An unexpected error occurred:
ValueError: Requesting acme-v02.api.letsencrypt.org/directory: Network is unreachable
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.

My web server is (include version): Apache 7.4.3

The operating system my web server runs on is (include version): Ubuntu 20.04

My hosting provider, if applicable, is:

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):

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

I followed the instructions of this topic Running certbot behind proxy? but it didn't work. I run certbot behing a http proxy

Is the HTTPS_PROXY environment variable set in the shell where you are running Certbot?

echo $HTTPS_PROXY

You may also need to run Certbot with sudo -E, if the environment variable is not available from the root user's shell.

The advice from the other thread is suitable to make sure the scheduled task runs with the environment variable set. But it won't help when running Certbot from a terminal.

3 Likes

Sorry, i'm quite new at this, I ran this in my terminal, no outputs. Then I tried again the steps of the other thread with sudo -E certbot --apache, same error

No problem.

What's the URL of your proxy?

2 Likes

http://192.168.x.x

Does this work for you?

export HTTPS_PROXY=http://192.168.x.x
sudo -E certbot register
2 Likes

An unexpected error occurred:
requests.exceptions.ConnectTimeout: HTTPSConnectionPool(host='acme-v02.api.letsencrypt.org', port=443): Max retries exceeded with url: /directory (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7f3f8457e520>, 'Connection to 192.168.x.x timed out. (connect timeout=45)'))

That was the output, please, remember that I'm behind a HTTP proxy, shall I use this command?: export HTTP_PROXY=http://192.168.x.x:port

To my understanding, the meaning of HTTPS_PROXY is "the proxy server to use for HTTPS requests". You can still pass an HTTP (insecure) proxy to it.

Most likely, you will need to set both HTTP_PROXY and HTTPS_PROXY, because Certbot uses a mix of secure and insecure requests. The latter is due to OCSP queries.

Well, that's some forward progress.

If you omitted the port number when you set HTTPS_PROXY, try including it.

Otherwise I would double check that the proxy URL is correct.

3 Likes

A simple way to test this would be:

HTTPS_PROXY=http://192.168.x.x curl -m10 -i https://ifconfig.me

If that works, it should work for Certbot as well.

If it doesn't, then you need to correct the proxy URL.

4 Likes

Sorry, I wasn't able to acces to the web and see your comments due service problems. I really appreciate your help... tomorrow I'll be back for sure

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.