我是否应该始终将/.well-known/acme-challenge暴露在服务器上?这是我的HTTP配置:
server {
listen 80;
location '/.well-known/acme-challenge' {
root /var/www/demo;
}
location / {
if ($scheme = http) {
return 301 https://$server_name$request_uri;
}
}
Run Code Online (Sandbox Code Playgroud)
它基本上将所有请求重定向到https,除了acme-challenge(用于自动续订)。我的问题:将位置“ /.well-known/acme-challenge”始终暴露在端口80上可以吗?还是在需要重新颁发证书时手动对其进行注释/取消注释?是否有任何安全问题?
任何建议或链接阅读有关此位置的赞赏。谢谢!
我已经设置了我的Google云端项目,以便将负载均衡器与自动扩展实例模板结合使用.目前,实例组只有一个实例.
我的域名成功引用了负载均衡器IP.直到这些步骤一切正常.
现在我想为这个项目设置SSL.我想用Letsencrypt服务做到这一点,但是在尝试设置它时我没有成功.
在Google Cloud Engine负载均衡器窗口中,可以选择将先前创建的带有Google Cloud shell的证书设置到负载均衡器前端.不幸的是,我只能使用Google Cloud Shell创建.csr和.key文件.此外,我可以创建一个不安全的ssl证书并从中获取.cert文件,但我想使用letsencrypt创建一个安全的SSL证书文件.Letsencrypt服务需要直接访问域,从执行命令行的命令行界面,这可能是我收到错误的原因,表明无法检索域名.
我正在寻找一种使用Google Cloud在loadbalancer上安装Letsencrypt证书的方法.有没有办法如何使用letsencrypt手动创建.cert文件而不是直接安装?如果没有,是否有另一种方法或服务来从.csr和.key文件创建.cert文件?
ssl load-balancing google-compute-engine lets-encrypt certbot
我已经使用带有--manual插件的certbot-auto生成了证书.现在certbot版本从0.25.1升级到0.26.1,现在我无法使用--manual选项,因为它在certbot 0.26.1中已弃用.
这是我用来生成证书的命令 -
`./certbot-auto certonly --manual -d *.example.com -d example.com --preferred-challenges dns-01 --server https://acme-v02.api.letsencrypt.org/directory`
Run Code Online (Sandbox Code Playgroud)
还有其他相关插件吗--manual?我可以在哪里生成TXT记录并在我的aws route53中更新它.
到目前为止,我有这个,但我遗漏了一些事情,如编写cron作业脚本.不想以root身份执行此操作.所以我假设可以做更多的事情来同时设置第一个用户.该脚本需要是幂等的(可以反复运行,如果以前使用相同的参数运行,则无需更改任何内容).
singledomaincertnginx.sh:
#!/bin/bash
if [ -z "$3" ]; then
echo use is "singledomaincertnginx.sh <server-ssh-address> <ssl-admin-email> <ssl-domain>"
echo example: "singledomaincertnginx.sh user@mydomain.com admin@mydomain.com some-sub-domain.mydomain.com"
exit
fi
ssh $1 "cat > ~/wks" << 'EOF'
#!/bin/bash
echo email: $1
echo domain: $2
sudo add-apt-repository -y ppa:certbot/certbot
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install -y software-properties-common
sudo apt-get install -y python-certbot-nginx
sudo apt-get install -y nginx
sudo sed -i "s/server_name .*;/server_name $2;/" /etc/nginx/sites-available/default
sudo systemctl restart nginx.service
if [[ -e /etc/letsencrypt/live/$2/fullchain.pem ]]; …Run Code Online (Sandbox Code Playgroud) 我收到了一封来自 noreply@letsencrypt.org 的电子邮件,主题是“更新您的客户端软件以继续使用 Let's Encrypt”
我在托管 https 站点的服务器中使用 Ubuntu 14.04.05 LTS,Certbot 是 0.22.2+1+ubuntu
这是我存储库中的最新版本。
我尝试更新域强制使用 ACME v2 服务器,按照此文档https://certbot.eff.org/docs/using.html?highlight=acmev2#changed-the-acme-server添加“--服务器https://acme-v02.api.letsencrypt.org/directory " 到更新命令,但它不起作用。
现在我被困住了,需要一些帮助。
感谢您的阅读和帮助。
如果您有一个仅使用 Apache(可能使用 PHP)的网站,该网站位于:
/home/www/mywebsite/
/home/www/mywebsite/index.php
/home/www/mywebsite/style.css
Run Code Online (Sandbox Code Playgroud)
然后,很容易certbot设置--webroot-path:
./certbot-auto certonly --webroot --webroot-path /home/www/mywebsite/
--domain example.com --domain www.example.com --email a@example.com
Run Code Online (Sandbox Code Playgroud)
问题:当使用由 NodeJS 或 Python Flask 或 Bottle 运行的网站时,通过 WSGI (mod_wsgi) 或简单代理链接到 Apache(我知道在 Python 的情况下不推荐后者)
RewriteEngine On
RewriteRule /(.*) http://localhost:5000/$1 [P,L]
Run Code Online (Sandbox Code Playgroud)
应该是什么--webroot-path?
更具体地说,如果我们有:
/home/www/mywebsite/ (Pyton example)
/home/www/mywebsite/myapp.py
/home/www/mywebsite/myapp.sqlite
/home/www/mywebsite/static/style.css
...
Run Code Online (Sandbox Code Playgroud)
或者
/home/www/mywebsite/ (NodeJS example)
/home/www/mywebsite/myapp.js
/home/www/mywebsite/myapp.sqlite
/home/www/mywebsite/static/style.css
...
Run Code Online (Sandbox Code Playgroud)
--webroot-path那么选择as就没有意义了/home/www/mywebsite/,对吧?
事实上,我不希望任何其他程序/脚本(例如 LetsEncrypt certbot)来摆弄我的 .py 文件。
无论如何,--webroot-pathin是certbot做什么的?那里的文件会被分析、解析吗?
我试图将 www 重定向到非 www,但它不起作用。我尝试过类似问题的各种答案,但没有成功。
我使用 certbot 为 3 个域提供了 SSL 证书example.com,www.example.com并且admin.example.com.
这是我当前的配置,适用于非 www 和管理员,但 www.example.com 不起作用。
# HTTP - redirect all requests to HTTPS
server {
listen 80;
listen [::]:80;
return 301 https://$host$request_uri;
}
# Redirect to non-www
server {
server_name www.example.com;
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/example.se/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/example.se/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
return …Run Code Online (Sandbox Code Playgroud) 我有一个带有 Nginx docker 容器的应用程序,在部署应用程序的主机(使用 Ubuntu 操作系统)中使用以下命令手动生成 TLS 证书:
certbot certonly --manual --manual-public-ip-logging-ok --preferred-challenges dns -d my.app.com
Run Code Online (Sandbox Code Playgroud)
当证书过期时,我必须更新它们。
但我不能certbot renew为此目的使用以下命令,因为它会给出错误:
$ sudo certbot renew
Failed to renew certificate my.app.com with error: The manual plugin is not working; there may be problems with your existing configuration.
The error was: PluginError('An authentication script must be provided with --manual-auth-hook when using the manual plugin non-interactively.')
Run Code Online (Sandbox Code Playgroud)
因此,我现在要做的是再次创建证书(使用certbot certonly之前使用的相同命令)而不是更新它们。
如何使用certbot renew命令修复错误?
我怎样才能自动化这个设置?
在我的 Ubuntu 22.04.2 LTS 和 Python 3.10.6 上,Certbot 给出以下错误:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/requests_toolbelt/_compat.py", line 48, in <module>
from requests.packages.urllib3.contrib import appengine as gaecontrib
ImportError: cannot import name 'appengine' from 'requests.packages.urllib3.contrib' (/usr/local/lib/python3.10/dist-packages/urllib3/contrib/__init__.py)
Run Code Online (Sandbox Code Playgroud)
带有完整的错误消息:
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/certbot", line 33, in <module>
sys.exit(load_entry_point('certbot==1.21.0', 'console_scripts', 'certbot')())
File "/usr/bin/certbot", line 25, in importlib_load_entry_point
return next(matches).load()
File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 171, in load
module = import_module(match.group('module'))
File "/usr/lib/python3.10/importlib/__init__.py", line 126, in …Run Code Online (Sandbox Code Playgroud) 我正在尝试为我的域生成证书。我可以 ping 我的域,但仍然出错。我已将入站防火墙规则添加到我的数字海洋服务器以接受 ipv4 和 ipv6 上的端口 80。不知道出了什么问题。[注意:我的 nginx 服务器没有运行,因为我无法获得证书]
https://community.letsencrypt.org/t/invalid-response-404-nginx-docker-container/102525
我的域名是:www.1040nra.com
我运行了这个命令:sudo certbot certonly --staging --webroot -w /root/dt-app-data/ -d 1040nra.com -d www.1040nra.com
它产生了这个输出:
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for 1040nra.com
http-01 challenge for www.1040nra.com
Using the webroot path /root/dt-app-data for all unmatched domains.
Waiting for verification…
Cleaning up challenges
Failed authorization procedure. 1040nra.com (http-01): urn:ietf:params:acme:error:connection :: The server could not connect to the client to verify the domain :: Fetching http://1040nra.com/.well-known/acme-challenge/22AD-KFmF62z373CPiUKzk6dlr-0s5wMOmnmrziMqd4: Connection refused, www.1040nra.com …Run Code Online (Sandbox Code Playgroud) certbot ×10
lets-encrypt ×5
nginx ×3
ssl ×3
ubuntu ×3
apache ×2
acme.sh ×1
bash ×1
flask ×1
https ×1
manual ×1
nginx-config ×1
node.js ×1
python-3.10 ×1
ssh ×1