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