From 9e8726e1f82f621d96c0a9c212f31c2f0a7bc214 Mon Sep 17 00:00:00 2001 From: ZacharyZcR <2903735704@qq.com> Date: Mon, 23 Dec 2024 02:21:25 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0POP3=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E7=8E=AF=E5=A2=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TestDocker/POP3/Dockerfile | 64 ++++++++++++++++++++++++++++++++++++++ TestDocker/POP3/README.txt | 2 ++ 2 files changed, 66 insertions(+) create mode 100644 TestDocker/POP3/Dockerfile create mode 100644 TestDocker/POP3/README.txt diff --git a/TestDocker/POP3/Dockerfile b/TestDocker/POP3/Dockerfile new file mode 100644 index 0000000..b8c1b54 --- /dev/null +++ b/TestDocker/POP3/Dockerfile @@ -0,0 +1,64 @@ +FROM ubuntu:20.04 + +# 避免交互式提示 +ENV DEBIAN_FRONTEND=noninteractive + +# 安装必要的包 +RUN apt-get update && apt-get install -y \ + dovecot-pop3d \ + openssl \ + && rm -rf /var/lib/apt/lists/* + +# 生成SSL证书 +RUN openssl req -x509 -nodes -days 365 -newkey rsa:2048 \ + -keyout /etc/ssl/private/dovecot.pem \ + -out /etc/ssl/certs/dovecot.pem \ + -subj "/C=US/ST=State/L=City/O=Organization/CN=localhost" + +# 配置Dovecot +RUN echo '\ +protocols = pop3\n\ +listen = *\n\ +ssl = yes\n\ +ssl_cert = /etc/dovecot/dovecot.conf + +# 创建密码文件 +RUN echo '\ +admin:{PLAIN}admin123\n\ +test:{PLAIN}test123\n\ +root:{PLAIN}root123\n\ +' > /etc/dovecot/passwd + +# 创建用户文件 +RUN echo '\ +admin:x:1000:1000::/home/admin:/bin/false\n\ +test:x:1001:1001::/home/test:/bin/false\n\ +root:x:1002:1002::/home/root:/bin/false\n\ +' > /etc/dovecot/users + +# 创建必要的目录和权限 +RUN mkdir -p /home/admin /home/test /home/root && \ + chown 1000:1000 /home/admin && \ + chown 1001:1001 /home/test && \ + chown 1002:1002 /home/root + +# 暴露端口 +EXPOSE 110 995 + +# 启动Dovecot +CMD ["dovecot", "-F"] \ No newline at end of file diff --git a/TestDocker/POP3/README.txt b/TestDocker/POP3/README.txt new file mode 100644 index 0000000..84ae03a --- /dev/null +++ b/TestDocker/POP3/README.txt @@ -0,0 +1,2 @@ +docker build -t pop3-test . +docker run -d --name pop3-server -p 110:110 -p 995:995 pop3-test \ No newline at end of file