我正在尝试按照 Certbot 网站上的步骤将 Certbot 安装到我的 Nginx 容器中: https: //certbot.eff.org/lets-encrypt/pip-nginx
Dockerfile:
FROM nginx:1.17.1
# install wget
RUN apt-get update
RUN apt-get install wget -y
# install certbot
RUN wget https://dl.eff.org/certbot-auto
RUN mv certbot-auto /usr/local/bin/certbot-auto
RUN chown root /usr/local/bin/certbot-auto
RUN chmod 0755 /usr/local/bin/certbot-auto
# get certificate
RUN /usr/local/bin/certbot-auto --nginx -y
# setup automatic renewal
...
Run Code Online (Sandbox Code Playgroud)
我使用 docker-compose 构建图像
$ docker-compose build
Run Code Online (Sandbox Code Playgroud)
构建在“# getcertificate”步骤中止
...因为我无法在构建过程中输入“y”?
有没有办法可以在构建过程中输入“y”?我已尝试传递 -y 标志(如 Dockerfile 中所示),但构建仍然中止。
我有一个已启动并正在运行的 http 网站(带有 Flask 和 nginx)。我正在尝试使用 ssl 安装,certbot并按照他们的步骤操作会导致成功安装消息(恭喜...),但刷新我的网页会导致404 Not Found nginx/1.18.0 (Ubuntu). 这是nginx.conf之后的文件sudo certbot --nginx
server {
server_name www.mydomain.com;
location /static {
alias /home/ubuntu/adviser/flaskblog/static;
}
location / {
proxy_pass http://localhost:8000;
include /etc/nginx/proxy_params;
proxy_redirect off;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/www.mydomain.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/www.mydomain.com/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
}
server {
if ($host = www.mydomain.com) …Run Code Online (Sandbox Code Playgroud) 我已在本地安装了 certbot 并成功为 mydomain.blah 和 site1.mydomain.blah 创建证书,它们位于/etc/letsencrypt/live/mydomain.blah和/etc/letsencrypt/live/site1.mydomain.blah
现在我尝试在 nginx 容器内使用它们,因此在我的 docker-compose 中我映射了一个如下所示的卷:
version '3.4'
services:
webserver:
image: nginx
volumes:
- ./conf:/etc/nginx/conf.d
- /etc/letsencrypt/live:/cert
ports:
- "80:80"
- "443:443"
Run Code Online (Sandbox Code Playgroud)
我的 nginxconf 就像这样:
server {
listen 443 ssl;
server_name mydomain.blah;
ssl_certificate /cert/mydomain.blah/fullchain.pem;
ssl_certificate_key /cert/mydomain.blah/privkey.pem;
location / {
proxy_pass http://1.2.3.4:8080;
}
}
server {
listen 443 ssl;
server_name site1.mydomain.blah;
ssl_certificate /cert/site1.mydomain.blah/fullchain.pem;
ssl_certificate_key /cert/site1.mydomain.blah/privkey.pem;
location / {
proxy_pass http://4.3.2.1:8080;
}
}
Run Code Online (Sandbox Code Playgroud)
但是当我启动 docker-compose 时,nginx 因错误而退出,cannot load certificate "/cert/mydomain.blah/fullchain.pem"因为存在No …
我在这里尝试做的事情如下:我有一个由计时器控制的 systemd 服务,该计时器负责处理 LetsEncrypt 证书的更新。这些证书的外观在配置文件中规定。
[Unit]
Description=Let's Encrypt renewal
[Service]
Type=oneshot
Environment=CONFIG_FILE=/etc/letsencrypt/test.conf
ExecStart=-/usr/bin/certbot renew --quiet --agree-tos --noninteractive --no-random-sleep-on-renew
Run Code Online (Sandbox Code Playgroud)
续订会运行一些后处理脚本,以确保部署和安装证书。
如果配置在证书生成和上次续订之间发生更改,这些脚本将找不到预期名称下的证书。然后,这些脚本会自动触发另一个脚本,以确保创建证书:
if [[ ! -d /etc/letsencrypt/live/${CERT_NAME} ]]
then
#certificate folder we expect isn't there , request a new cert
. /etc/letsencrypt/renewal-hooks/request-new-cert.sh
fi
Run Code Online (Sandbox Code Playgroud)
我遇到的问题是在执行 request-new-cert.sh 期间出现错误Another Instance of Certbot is already running,导致脚本失败。
我在这件事上做错了吗?有没有更好的方法来实现我想要做的事情?
我需要从 LetsEncrypt 获取 AWS Route 53 上托管的域的证书。我没有暴露任何端口 80 或 443,因为服务器用于 VPN 并且没有公共访问权限。
因此,实现此目的的唯一方法是通过路由 53 的 DNS 验证。
到目前为止我已经安装了 certbot 和 dns-route53 插件
sudo snap install --beta --classic certbot
sudo snap set certbot trust-plugin-with-root=ok
sudo snap install --beta certbot-dns-route53
sudo snap connect certbot:plugin certbot-dns-route53
Run Code Online (Sandbox Code Playgroud)
我在我的 AWS 账户中创建了一个可以访问 Route53 的特殊用户,并且在 ~/.aws/config 和 ~/.aws/credentials 中添加了访问密钥 id 和秘密访问密钥,如下所示
[default]
aws_access_key_id=foo
aws_secret_access_key=bar
Run Code Online (Sandbox Code Playgroud)
基本上遵循此处给出的每个步骤:https ://certbot-dns-route53.readthedocs.io/en/stable/
现在,当我运行以下命令时:
sudo certbot certonly -d mydomain.com --dns-route53
Run Code Online (Sandbox Code Playgroud)
它给出以下输出:
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator dns-route53, Installer None
Requesting …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 Let's Entrypt 为我的域 example.com 生成通配符 PFX 证书,然后使用 certbot,最后使用 OpenSSL 将 .pem 转换为 pfx。问题是,最终的 PFX 文件似乎不符合安全浏览器要求,并且密钥没有至少 2048 个字符,但这确实很奇怪,因为 Certbot 默认情况下以 2048 位 RSA 密钥工作(已经尝试强制4096 但我得到相同的结果)。
这是我遵循的程序:
从 Certbot (通过 Anaconda Python 安装)我运行
调用 C:\ProgramData\Anaconda3\Scripts\activate.bat
certbot certonly --dns-cloudflare --dns-cloudflare-credentials "C:\Users\administrator.EXAMPLE\Desktop\certificati\cloudflare.ini" --dns-cloudflare-propagation-seconds 30 -d *.example.com - -电子邮件 example@example.com
之后,我从 OpenSSL 运行
openssl pkcs12 -export -out "C:\Users\administrator.EXAMPLE\Desktop\certificati\EXAMPLE.com.pfx" -inkey "C:\Certbot\live\EXAMPLE.com\privkey.pem" -in "C:\ Certbot\live\EXAMPLE.com\fullchain.pem" - 密码通过:TEST2023!
在深信服 VDI 界面中,当我尝试导入证书时会出现警报,并且如果我测试从 Chrome 访问 FQDN,则由于 SSL 不匹配而无法加载域。
这花了我一段时间才能弄清楚,所以我想我会留下一些说明,说明如何完成此操作,以防其他人遇到相同的问题。
我需要允许Express中的.well-known目录访问目录,以便能够使用certbot生成SSL证书。
我已经使用安装了 Certbot 证书certbot --apache。安装成功,现在我无法通过 https 访问我的网站。
当我在服务器本身上点击命令时,openssl s_client -connect localhost:443 -servername它给出Connected (00000005)
我的网站可通过 http 访问。但无法通过 https 访问。
任何帮助都会有所帮助。
我是 AWS 的新手,让我们对两者进行加密。我关注和文章并简单地运行这些命令
wget https://dl.eff.org/certbot-auto
chmod a+x certbot-auto
sudo cp certbot-auto /usr/bin/
Run Code Online (Sandbox Code Playgroud)
然后我运行这个命令。
sudo /usr/bin/certbot-auto --nginx -d example.com -d www.example.com --debug
Run Code Online (Sandbox Code Playgroud)
这给了我错误
抱歉,我不知道如何在您的操作系统上引导 Certbot!
您将需要安装操作系统依赖项、配置 virtualenv 并手动运行 pip install。请参阅 https://letsencrypt.readthedocs.org/en/latest/contributing.html#prerequisites 了解更多信息。
这究竟意味着什么?
如何在 AWS linux 上设置 certbot?
我已经在谷歌云服务器上托管了我的反应应用程序(ubuntu 18.04 LTS),并将我的域名与之关联。nginx我正在尝试免费使用 certbot 对我的网站进行 SSL,但不幸的是,我在任何地方看到它都有使用或设置它的教程apache。为了服务我的应用程序,我使用了简单的命令:
sudo npm run build
sudo serve -s build --listen 80
Run Code Online (Sandbox Code Playgroud)
现在我在为我的 React 应用程序设置 ssl 时遇到了一些困难,以前有人尝试过同样的事情吗?