Jinnrry/PMail

docker时,可以修改443的端口吗?

Closed this issue · 7 comments

另外一个VPN应用占用了443端口。

root@v930260445:~# docker run -p 25:25 -p 8011:80 -p 8443:443 -p 465:465 -v $(pwd)/config:/work/config ghcr.io/jinnrry/pmail:latest
[info][2023-09-14 13:03:35][/work/main.go:76]***************************************************
[info][2023-09-14 13:03:35][/work/main.go:77]*** Server Start Success Version:2.2.5

[info][2023-09-14 13:03:35][/work/main.go:78]*** Git Commit Hash:
[info][2023-09-14 13:03:35][/work/main.go:79]*** Build TimeStamp: 2023-09-12 18:46:31
[info][2023-09-14 13:03:35][/work/main.go:80]*** Build GoLang Version: go version go1.21.1 linux/amd64
[info][2023-09-14 13:03:35][/work/main.go:81]***************************************************
[fatal][2023-09-14 13:03:35][/work/smtp_server/smtp.go:64]tls: failed to find any PEM data in certificate input
root@v930260445:~# docker run -p 25:25 -p 8011:80 -p 8443:444 -p 465:465 -v $(pwd)/config:/work/config ghcr.io/jinnrry/pmail:latest
[info][2023-09-14 13:05:42][/work/main.go:76]***************************************************
[info][2023-09-14 13:05:42][/work/main.go:77]*** Server Start Success Version:2.2.5

[info][2023-09-14 13:05:42][/work/main.go:78]*** Git Commit Hash:
[info][2023-09-14 13:05:42][/work/main.go:79]*** Build TimeStamp: 2023-09-12 18:46:31
[info][2023-09-14 13:05:42][/work/main.go:80]*** Build GoLang Version: go version go1.21.1 linux/amd64
[info][2023-09-14 13:05:42][/work/main.go:81]***************************************************
[error][2023-09-14 13:05:42][/work/cron_server/ssl_update.go:17]SSL Check Error, Update SSL Certificate. Error Info :at /work/services/setup/ssl/ssl.go:155
tls: failed to find any PEM data in certificate input
[fatal][2023-09-14 13:05:42][/work/smtp_server/smtp.go:64]tls: failed to find any PEM data in certificate input

求助解决!

报错是没有找到证书文件,和端口没关系

docker run -p 25:25 -p 8011:80 -p 8443:444 -p 465:465 -v $(pwd)/config:/work/config ghcr.io/jinnrry/pmail:latest

[info][2023-09-14 17:08:44][/work/db/init.go:73]Create Table: create table rule
(
id INTEGER PRIMARY KEY AUTOINCREMENT,
user_id int,
name varchar(255) default '' not null,
value json not null,
action int default 0 not null,
params varchar(255) default '' not null,
sort int default 0 not null
)
[info][2023-09-14 17:11:26][/work/http_server/https_server.go:37]Http Server Start
panic: tls: failed to find any PEM data in certificate input

我手动上传你们的证书文件。启动时打开我原有的443OPENVPN,设置了界面mail.xxx.com
估计还是证书问题。那如何搞定证书呀???能否详细介绍一下
我查看了下config
{"logLevel":"","domain":"xxx.com","webDomain":"mail.xxx.com","dkimPrivateKeyPath":"config/dkim/dkim.priv","sslType":"1","SSLPrivateKeyPath":"config/ssl/private.key","SSLPublicKeyPath":"config/ssl/public.crt","dbDSN":"./config/pmail.db","dbType":"sqlite","httpsEnabled":0,"spamFilterLevel":0,"httpPort":0,"httpsPort":0,"weChatPushAppId":"","weChatPushSecret":"","weChatPushTemplateId":"","weChatPushUserId":"","tgBotToken":"","tgChatId":"","isInit":true}
怎么httpPort":0,"httpsPort":0,httpsEnabled":0

如果你要用程序自动生成SSL证书的话,那你在引导页面的时候必须保证你的域名能够直接访问到PMail服务。因为PMail需要去Let’s Encrypt申请证书,申请的过程中必须向Let’s Encrypt证明自己拥有域名的所有权。Let’s Encrypt服务器是通过直接访问域名进行验证的。

另外,后续PMail更新证书的话,也需要想Let’s Encrypt证明域名所有权,也需要通过http证明。

如果你不用PMail自动处理证书的话,在配置文件中把sslType改成1,然后自己上传你的证书就行了。但是你得确保你传的证书位置和配置文件中的位置对应。容器的运行路径是在/work/,这个路径是和你物理机不一样的

你说的配置文件需要修改sslType改成1,这个配置文件是/work/中的吗?如何进入容器修改work中的配置文件?还是只需要修改挂载的/root/config下的配置文件。

另外直接下载编译的文件,如何在运行./pmail_linux_amd64前修改配置文件呀?443端口被占用。似乎配置文件运行之前没有建立呀?

容器可以exec进去,配置文件随便哪里改都行,挂载进去就行了

非常希望你们的docker可以直接修改相关端口,如"HTTPS=OFF" -e "HTTPS_PORT=4433" -e "HTTP_PORT=8080" ,请参考https://poste.io/doc/

docker -p 映射成任意端口,手动配置SSL证书,然后使用 nginx 反代 80 和 443 映射的端口。我原来就是 nginx 占用 443,所以不冲突