重命名项目并补充插件与安全整改文档
This commit is contained in:
1 parent
a6049bf052
commit
e91a64136b
131 files changed
+1306
-771
No files matched your search
@@ -13,12 +13,12 @@ body:
|
|||||||
required: true
|
required: true
|
||||||
- label: 我搜索了issues,没有发现已提出的类似问题。
|
- label: 我搜索了issues,没有发现已提出的类似问题。
|
||||||
required: true
|
required: true
|
||||||
- label: 我已经阅读了项目[Readme](https://github.com/Jinnrry/PMail/blob/master/README_CN.md)和[常见问题](https://github.com/Jinnrry/PMail/discussions/170)
|
- label: 我已经阅读了项目[Readme](https://git.pcux.cn/xuans/Smail/src/branch/main/README_CN.md)和[常见问题](https://git.pcux.cn/xuans/Smail/issues)
|
||||||
required: true
|
required: true
|
||||||
- type: input
|
- type: input
|
||||||
attributes:
|
attributes:
|
||||||
label: 版本
|
label: 版本
|
||||||
description: 使用的PMail版本
|
description: 使用的Smail版本
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
- type: markdown
|
- type: markdown
|
||||||
@@ -31,9 +31,9 @@ body:
|
|||||||
|
|
||||||
### 对于日志
|
### 对于日志
|
||||||
请先将日志等级设置为 debug.
|
请先将日志等级设置为 debug.
|
||||||
重启 PMail ,再按复现方式操作,尽量减少日志中的无关部分。
|
重启 Smail ,再按复现方式操作,尽量减少日志中的无关部分。
|
||||||
记得删除有关个人信息的部分。
|
记得删除有关个人信息的部分。
|
||||||
提供 PMail 的日志,而不是面板或者别的东西输出的日志。
|
提供 Smail 的日志,而不是面板或者别的东西输出的日志。
|
||||||
|
|
||||||
### 最后
|
### 最后
|
||||||
在去掉不影响复现的部分后,提供实际运行的**完整**文件,不要出于自己的判断只提供入站出站或者几行日志。
|
在去掉不影响复现的部分后,提供实际运行的**完整**文件,不要出于自己的判断只提供入站出站或者几行日志。
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
contact_links:
|
contact_links:
|
||||||
- name: 部署错误及使用讨论 / Community Support and Questions
|
- name: 部署错误及使用讨论 / Community Support and Questions
|
||||||
url: https://github.com/Jinnrry/PMail/discussions
|
url: https://git.pcux.cn/xuans/Smail/issues
|
||||||
about: 非程序异常请前往Discussions讨论 / Please ask and answer questions there. The issue tracker is for issues with core.
|
about: 非程序异常请前往Discussions讨论 / Please ask and answer questions there. The issue tracker is for issues with core.
|
||||||
@@ -7,4 +7,4 @@ assignees: ''
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 请完整读完[README](https://github.com/Jinnrry/PMail/blob/master/README_CN.md)再提问! / Before asking questions, please read the [README](https://github.com/Jinnrry/PMail/blob/master/README.md) !
|
## 请完整读完[README](https://git.pcux.cn/xuans/Smail/src/branch/main/README_CN.md)再提问! / Before asking questions, please read the [README](https://git.pcux.cn/xuans/Smail/src/branch/main/README.md) !
|
||||||
@@ -1,70 +0,0 @@
|
|||||||
name: Docker Image CI
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
release:
|
|
||||||
types: [released]
|
|
||||||
|
|
||||||
env:
|
|
||||||
REGISTRY: ghcr.io
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-and-push-image:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
packages: write
|
|
||||||
steps:
|
|
||||||
- name: Get version
|
|
||||||
id: get_version
|
|
||||||
run: |
|
|
||||||
echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> ${GITHUB_ENV}
|
|
||||||
echo "${GITHUB_REF/refs\/tags\//}"
|
|
||||||
echo "${GITHUB_REF#refs/*/}"
|
|
||||||
echo "${GITHUB_REF}"
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: set lower case repository name
|
|
||||||
run: |
|
|
||||||
echo "REPOSITORY_LC=${REPOSITORY,,}" >> ${GITHUB_ENV}
|
|
||||||
env:
|
|
||||||
REPOSITORY: '${{ github.repository }}'
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v3
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
|
|
||||||
- uses: actions/setup-node@v4
|
|
||||||
|
|
||||||
- name: Build FE
|
|
||||||
run: |
|
|
||||||
echo "$(git show -s --format=%H)"
|
|
||||||
echo "GITHASH=$(git show -s --format=%H)" >> ${GITHUB_ENV}
|
|
||||||
make build_fe
|
|
||||||
|
|
||||||
- name: Log in to the Container registry
|
|
||||||
uses: docker/login-action@v2.1.0
|
|
||||||
with:
|
|
||||||
registry: ${{ env.REGISTRY }}
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Build and push Docker images
|
|
||||||
uses: docker/build-push-action@v4
|
|
||||||
with:
|
|
||||||
build-args: |
|
|
||||||
VERSION=${{ env.VERSION }}
|
|
||||||
GITHASH=${{ env.GITHASH }}
|
|
||||||
context: .
|
|
||||||
file: ./DockerfileGithubAction
|
|
||||||
platforms: |
|
|
||||||
linux/386
|
|
||||||
linux/amd64
|
|
||||||
linux/arm/v7
|
|
||||||
linux/arm64
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
${{ env.REGISTRY }}/${{ env.REPOSITORY_LC }}:${{ env.VERSION }}
|
|
||||||
${{ env.REGISTRY }}/${{ env.REPOSITORY_LC }}:latest
|
|
||||||
@@ -1,68 +0,0 @@
|
|||||||
name: Docker Image CI Pre
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
release:
|
|
||||||
types: [ prereleased ]
|
|
||||||
|
|
||||||
env:
|
|
||||||
REGISTRY: ghcr.io
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-and-push-image:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
packages: write
|
|
||||||
steps:
|
|
||||||
- name: Get version
|
|
||||||
id: get_version
|
|
||||||
run: |
|
|
||||||
echo "VERSION=pre${GITHUB_REF/refs\/tags\//}" >> ${GITHUB_ENV}
|
|
||||||
echo "${GITHUB_REF/refs\/tags\//}"
|
|
||||||
echo "${GITHUB_REF#refs/*/}"
|
|
||||||
echo "${GITHUB_REF}"
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: set lower case repository name
|
|
||||||
run: |
|
|
||||||
echo "REPOSITORY_LC=${REPOSITORY,,}" >> ${GITHUB_ENV}
|
|
||||||
env:
|
|
||||||
REPOSITORY: '${{ github.repository }}'
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v3
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
|
|
||||||
- uses: actions/setup-node@v4
|
|
||||||
|
|
||||||
- name: Build FE
|
|
||||||
run: |
|
|
||||||
echo "GITHASH=$(git show -s --format=%H)" >> ${GITHUB_ENV}
|
|
||||||
make build_fe
|
|
||||||
|
|
||||||
- name: Log in to the Container registry
|
|
||||||
uses: docker/login-action@v2.1.0
|
|
||||||
with:
|
|
||||||
registry: ${{ env.REGISTRY }}
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Build and push Docker images
|
|
||||||
uses: docker/build-push-action@v4
|
|
||||||
with:
|
|
||||||
build-args: |
|
|
||||||
VERSION=${{ env.VERSION }}
|
|
||||||
GITHASH=${{ env.GITHASH }}
|
|
||||||
context: .
|
|
||||||
file: ./DockerfileGithubAction
|
|
||||||
platforms: |
|
|
||||||
linux/386
|
|
||||||
linux/amd64
|
|
||||||
linux/arm/v7
|
|
||||||
linux/arm64
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
${{ env.REGISTRY }}/${{ env.REPOSITORY_LC }}:${{ env.VERSION }}
|
|
||||||
@@ -37,14 +37,14 @@ jobs:
|
|||||||
check-latest: true
|
check-latest: true
|
||||||
- name: Gen output name
|
- name: Gen output name
|
||||||
run: |
|
run: |
|
||||||
echo "FILENAME=pmail_${{ matrix.goos }}_${{ matrix.goarch }}" >> ${GITHUB_ENV}
|
echo "FILENAME=smail_${{ matrix.goos }}_${{ matrix.goarch }}" >> ${GITHUB_ENV}
|
||||||
echo "WCFILENAME=wechat_push_${{ matrix.goos }}_${{ matrix.goarch }}" >> ${GITHUB_ENV}
|
echo "WCFILENAME=wechat_push_${{ matrix.goos }}_${{ matrix.goarch }}" >> ${GITHUB_ENV}
|
||||||
echo "SPAMBLOCKFILENAME=spam_block_${{ matrix.goos }}_${{ matrix.goarch }}" >> ${GITHUB_ENV}
|
echo "SPAMBLOCKFILENAME=spam_block_${{ matrix.goos }}_${{ matrix.goarch }}" >> ${GITHUB_ENV}
|
||||||
echo "ZIPNAME=${{ matrix.goos }}_${{ matrix.goarch }}" >> ${GITHUB_ENV}
|
echo "ZIPNAME=${{ matrix.goos }}_${{ matrix.goarch }}" >> ${GITHUB_ENV}
|
||||||
- name: Rename Windows File
|
- name: Rename Windows File
|
||||||
if: matrix.goos == 'windows'
|
if: matrix.goos == 'windows'
|
||||||
run: |
|
run: |
|
||||||
echo "FILENAME=pmail_${{ matrix.goos }}_${{ matrix.goarch }}.exe" >> ${GITHUB_ENV}
|
echo "FILENAME=smail_${{ matrix.goos }}_${{ matrix.goarch }}.exe" >> ${GITHUB_ENV}
|
||||||
echo "WCFILENAME=wechat_push_${{ matrix.goos }}_${{ matrix.goarch }}.exe" >> ${GITHUB_ENV}
|
echo "WCFILENAME=wechat_push_${{ matrix.goos }}_${{ matrix.goarch }}.exe" >> ${GITHUB_ENV}
|
||||||
echo "SPAMBLOCKFILENAME=spam_block_${{ matrix.goos }}_${{ matrix.goarch }}.exe" >> ${GITHUB_ENV}
|
echo "SPAMBLOCKFILENAME=spam_block_${{ matrix.goos }}_${{ matrix.goarch }}.exe" >> ${GITHUB_ENV}
|
||||||
- name: FE Build
|
- name: FE Build
|
||||||
|
|||||||
@@ -1,69 +0,0 @@
|
|||||||
name: PR - Docker unit test
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
types: [opened, reopened, synchronize, edited]
|
|
||||||
# Please, always create a pull request instead of push to master.
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
pull-requests: write
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: docker-test-${{ github.ref_name }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
name: Docker tests
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
services:
|
|
||||||
mysql:
|
|
||||||
image: mysql
|
|
||||||
env:
|
|
||||||
MYSQL_DATABASE: pmail
|
|
||||||
MYSQL_ROOT_PASSWORD: githubTest
|
|
||||||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
|
||||||
postgres:
|
|
||||||
image: postgres
|
|
||||||
env:
|
|
||||||
POSTGRESQL_PASSWORD: githubTest
|
|
||||||
container:
|
|
||||||
image: golang
|
|
||||||
env:
|
|
||||||
REPOSITORY: ${{ github.repository }}
|
|
||||||
TRIGGERING_ACTOR: ${{ github.triggering_actor }}
|
|
||||||
SOURCE_BRANCH: ${{ github.ref_name }}
|
|
||||||
COMMIT: ${{ github.workflow_sha }}
|
|
||||||
EVENT: ${{ github.event_name}}
|
|
||||||
steps:
|
|
||||||
- name: Setup Node.js environment
|
|
||||||
run: apt update && apt install -y nodejs npm
|
|
||||||
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Pull Request Labeler
|
|
||||||
if: ${{ failure() }}
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
run: |
|
|
||||||
gh pr edit ${{ github.event.pull_request.number }} --add-label "Auto: Test Failed"
|
|
||||||
|
|
||||||
- name: Install Dependencies
|
|
||||||
run: npm install --global yarn
|
|
||||||
|
|
||||||
- name: FE build
|
|
||||||
run: make build_fe
|
|
||||||
|
|
||||||
- name: Run Test Mysql
|
|
||||||
run: make test_mysql
|
|
||||||
|
|
||||||
- name: Run Test
|
|
||||||
run: make test
|
|
||||||
|
|
||||||
# - name: Run postgres
|
|
||||||
# run: make test_postgres
|
|
||||||
|
|
||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
dist
|
dist
|
||||||
output
|
output
|
||||||
pmail.db
|
smail.db
|
||||||
server/plugins
|
server/plugins
|
||||||
config
|
config
|
||||||
*_KEY
|
*_KEY
|
||||||
|
|||||||
-37
@@ -1,37 +0,0 @@
|
|||||||
FROM node:lts-alpine as febuild
|
|
||||||
WORKDIR /work
|
|
||||||
|
|
||||||
COPY fe .
|
|
||||||
|
|
||||||
RUN yarn && yarn build
|
|
||||||
|
|
||||||
|
|
||||||
FROM golang:alpine as serverbuild
|
|
||||||
ARG VERSION
|
|
||||||
WORKDIR /work
|
|
||||||
COPY . .
|
|
||||||
COPY --from=febuild /work/dist /work/server/listen/http_server/dist
|
|
||||||
RUN apk update && apk add git
|
|
||||||
RUN cd /work/server && go build -ldflags "-s -w -X 'main.version=${VERSION}' -X 'main.goVersion=$(go version)' -X 'main.gitHash=$(git show -s --format=%H)' -X 'main.buildTime=$(TZ=UTC-8 date +%Y-%m-%d" "%H:%M:%S)'" -o pmail main.go
|
|
||||||
RUN cd /work/server/hooks/wechat_push && go build -ldflags "-s -w" -o output/wechat_push wechat_push.go
|
|
||||||
RUN cd /work/server/hooks/spam_block && go build -ldflags "-s -w" -o output/spam_block spam_block.go
|
|
||||||
|
|
||||||
|
|
||||||
FROM alpine
|
|
||||||
|
|
||||||
WORKDIR /work
|
|
||||||
|
|
||||||
# 设置时区
|
|
||||||
RUN apk add --no-cache tzdata \
|
|
||||||
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
|
|
||||||
&& echo "Asia/Shanghai" > /etc/timezone \
|
|
||||||
&&rm -rf /var/cache/apk/* /tmp/* /var/tmp/* $HOME/.cache
|
|
||||||
|
|
||||||
|
|
||||||
COPY --from=serverbuild /work/server/pmail .
|
|
||||||
COPY --from=serverbuild /work/server/hooks/wechat_push/output/* ./plugins/
|
|
||||||
COPY --from=serverbuild /work/server/hooks/spam_block/output/* ./plugins/
|
|
||||||
|
|
||||||
EXPOSE 25 80 110 443 465 587 995 993
|
|
||||||
|
|
||||||
CMD /work/pmail
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
FROM golang:alpine as serverbuild
|
|
||||||
ARG VERSION
|
|
||||||
ARG GITHASH
|
|
||||||
WORKDIR /work
|
|
||||||
|
|
||||||
COPY server .
|
|
||||||
|
|
||||||
RUN apk update && apk add git
|
|
||||||
RUN go build -ldflags "-s -w -X 'main.version=${VERSION}' -X 'main.goVersion=$(go version)' -X 'main.gitHash=${GITHASH}' -X 'main.buildTime=$(TZ=UTC-8 date +%Y-%m-%d" "%H:%M:%S)'" -o pmail main.go
|
|
||||||
RUN cd /work/hooks/wechat_push && go build -ldflags "-s -w" -o output/wechat_push wechat_push.go
|
|
||||||
RUN cd /work/hooks/spam_block && go build -ldflags "-s -w" -o output/spam_block spam_block.go
|
|
||||||
|
|
||||||
|
|
||||||
FROM alpine
|
|
||||||
|
|
||||||
WORKDIR /work
|
|
||||||
|
|
||||||
# 设置时区
|
|
||||||
RUN apk add --no-cache tzdata \
|
|
||||||
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
|
|
||||||
&& echo "Asia/Shanghai" > /etc/timezone \
|
|
||||||
&&rm -rf /var/cache/apk/* /tmp/* /var/tmp/* $HOME/.cache
|
|
||||||
|
|
||||||
|
|
||||||
COPY --from=serverbuild /work/pmail .
|
|
||||||
COPY --from=serverbuild /work/hooks/wechat_push/output/* ./plugins/
|
|
||||||
COPY --from=serverbuild /work/hooks/spam_block/output/* ./plugins/
|
|
||||||
|
|
||||||
EXPOSE 25 80 110 443 465 587 995 993
|
|
||||||
|
|
||||||
CMD /work/pmail
|
|
||||||
@@ -10,10 +10,10 @@ build_fe:
|
|||||||
cd server && cp -rf ../fe/dist listen/http_server
|
cd server && cp -rf ../fe/dist listen/http_server
|
||||||
|
|
||||||
build_server:
|
build_server:
|
||||||
cd server && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w -X 'main.goVersion=$(go version)' -X 'main.gitHash=$(git show -s --format=%H)' -X 'main.buildTime=$(TZ=UTC-8 date +%Y-%m-%d" "%H:%M:%S)'" -o pmail_linux_amd64 main.go
|
cd server && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w -X 'main.goVersion=$(go version)' -X 'main.gitHash=$(git show -s --format=%H)' -X 'main.buildTime=$(TZ=UTC-8 date +%Y-%m-%d" "%H:%M:%S)'" -o smail_linux_amd64 main.go
|
||||||
cd server && CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "-s -w -X 'main.goVersion=$(go version)' -X 'main.gitHash=$(git show -s --format=%H)' -X 'main.buildTime=$(TZ=UTC-8 date +%Y-%m-%d" "%H:%M:%S)'" -o pmail_windows_amd64.exe main.go
|
cd server && CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "-s -w -X 'main.goVersion=$(go version)' -X 'main.gitHash=$(git show -s --format=%H)' -X 'main.buildTime=$(TZ=UTC-8 date +%Y-%m-%d" "%H:%M:%S)'" -o smail_windows_amd64.exe main.go
|
||||||
cd server && CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w -X 'main.goVersion=$(go version)' -X 'main.gitHash=$(git show -s --format=%H)' -X 'main.buildTime=$(TZ=UTC-8 date +%Y-%m-%d" "%H:%M:%S)'" -o pmail_mac_amd64 main.go
|
cd server && CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w -X 'main.goVersion=$(go version)' -X 'main.gitHash=$(git show -s --format=%H)' -X 'main.buildTime=$(TZ=UTC-8 date +%Y-%m-%d" "%H:%M:%S)'" -o smail_mac_amd64 main.go
|
||||||
cd server && CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags "-s -w -X 'main.goVersion=$(go version)' -X 'main.gitHash=$(git show -s --format=%H)' -X 'main.buildTime=$(TZ=UTC-8 date +%Y-%m-%d" "%H:%M:%S)'" -o pmail_mac_arm64 main.go
|
cd server && CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags "-s -w -X 'main.goVersion=$(go version)' -X 'main.gitHash=$(git show -s --format=%H)' -X 'main.buildTime=$(TZ=UTC-8 date +%Y-%m-%d" "%H:%M:%S)'" -o smail_mac_arm64 main.go
|
||||||
|
|
||||||
wechat_push:
|
wechat_push:
|
||||||
cd server/hooks/wechat_push && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w" -o output/wechat_push_linux_amd64 wechat_push.go
|
cd server/hooks/wechat_push && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w" -o output/wechat_push_linux_amd64 wechat_push.go
|
||||||
@@ -34,7 +34,7 @@ plugin: spam_block wechat_push
|
|||||||
|
|
||||||
package: clean
|
package: clean
|
||||||
mkdir output
|
mkdir output
|
||||||
mv server/pmail* output/
|
mv server/smail* output/
|
||||||
mkdir output/config
|
mkdir output/config
|
||||||
mkdir output/plugins
|
mkdir output/plugins
|
||||||
cp -r server/config/dkim output/config/
|
cp -r server/config/dkim output/config/
|
||||||
@@ -45,10 +45,10 @@ package: clean
|
|||||||
cp README.md output/
|
cp README.md output/
|
||||||
|
|
||||||
test:
|
test:
|
||||||
export setup_port=17888 && cd server && export PMail_ROOT=$(CURDIR)/server/ && go test -v -p 1 ./...
|
export setup_port=17888 && cd server && export SMAIL_ROOT=$(CURDIR)/server/ && go test -v -p 1 ./...
|
||||||
|
|
||||||
test_mysql:
|
test_mysql:
|
||||||
export setup_port=17888 && cd server && export PMail_ROOT=$(CURDIR)/server/ && go test -args "mysql" -v -p 1 ./...
|
export setup_port=17888 && cd server && export SMAIL_ROOT=$(CURDIR)/server/ && go test -args "mysql" -v -p 1 ./...
|
||||||
|
|
||||||
test_postgres:
|
test_postgres:
|
||||||
export setup_port=17888 && cd server && export PMail_ROOT=$(CURDIR)/server/ && go test -args "postgres" -v -p 1 ./...
|
export setup_port=17888 && cd server && export SMAIL_ROOT=$(CURDIR)/server/ && go test -args "postgres" -v -p 1 ./...
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
# PMail
|
# Smail
|
||||||
|
|
||||||
> A server, a domain, a line of code, a minute, and you'll be able to build a domain mailbox of your own.
|
> A server, a domain, a line of code, a minute, and you'll be able to build a domain mailbox of your own.
|
||||||
|
|
||||||
@@ -8,7 +8,7 @@ I'm Chinese, and I'm not good at English, so I apologise for my translation.
|
|||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
|
|
||||||
PMail is a personal email server that pursues a minimal deployment process and extreme resource consumption. It runs on
|
Smail is a personal email server that pursues a minimal deployment process and extreme resource consumption. It runs on
|
||||||
a single file and contains complete send/receive mail service and web-side mail management functions. Just a server , a
|
a single file and contains complete send/receive mail service and web-side mail management functions. Just a server , a
|
||||||
domain name , a line of code , a minute of deployment time , you will be able to build a domain name mailbox of your
|
domain name , a line of code , a minute of deployment time , you will be able to build a domain name mailbox of your
|
||||||
own .
|
own .
|
||||||
@@ -43,12 +43,12 @@ First go to [spamhaus](https://check.spamhaus.org/) and check your domain name a
|
|||||||
|
|
||||||
## 1、Download
|
## 1、Download
|
||||||
|
|
||||||
* [Click Here](https://github.com/Jinnrry/PMail/releases) Download a program file that matches you.
|
* [Click Here](https://git.pcux.cn/xuans/Smail/releases) Download a program file that matches you.
|
||||||
* Or use Docker `docker pull ghcr.io/jinnrry/pmail:latest`
|
* Or use Docker `docker pull ghcr.io/jinnrry/pmail:latest`
|
||||||
|
|
||||||
## 2、Run
|
## 2、Run
|
||||||
|
|
||||||
`./pmail -p 80`
|
`./smail -p 80`
|
||||||
|
|
||||||
> -p Set the http port of the bootstrap setup interface, the default is port 80, note that this parameter only affects the bootstrap setup phase, if you need to change the port after setup is complete, please modify the configuration file.
|
> -p Set the http port of the bootstrap setup interface, the default is port 80, note that this parameter only affects the bootstrap setup phase, if you need to change the port after setup is complete, please modify the configuration file.
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ use [https://www.mail-tester.com/](https://www.mail-tester.com/) for checking.
|
|||||||
"sslType": "0", // ssl certificate update mode, 0 automatic, 1 manual
|
"sslType": "0", // ssl certificate update mode, 0 automatic, 1 manual
|
||||||
"SSLPrivateKeyPath": "config/ssl/private.key", // ssl certificate path
|
"SSLPrivateKeyPath": "config/ssl/private.key", // ssl certificate path
|
||||||
"SSLPublicKeyPath": "config/ssl/public.crt", // ssl certificate path
|
"SSLPublicKeyPath": "config/ssl/public.crt", // ssl certificate path
|
||||||
"dbDSN": "./config/pmail.db", // database connect DSN
|
"dbDSN": "./config/smail.db", // database connect DSN
|
||||||
"dbType": "sqlite", //database type ,`sqlite` or `mysql`
|
"dbType": "sqlite", //database type ,`sqlite` or `mysql`
|
||||||
"httpsEnabled": 0, // enabled https , 0:enabled 1:enablde 2:disenabled
|
"httpsEnabled": 0, // enabled https , 0:enabled 1:enablde 2:disenabled
|
||||||
"httpPort": 80, // http port . default 80
|
"httpPort": 80, // http port . default 80
|
||||||
@@ -119,7 +119,7 @@ IMAP Port: 993(SSL)
|
|||||||
|
|
||||||
## Plugin Install
|
## Plugin Install
|
||||||
> [!IMPORTANT]
|
> [!IMPORTANT]
|
||||||
> Plugins run on your server as independent processes, please review the security of third-party plugins on your own.PMail currently only maintains the three plugins mentioned above.
|
> Plugins run on your server as independent processes, please review the security of third-party plugins on your own.Smail currently only maintains the three plugins mentioned above.
|
||||||
|
|
||||||
Copy plugin binary file to `/plugins`
|
Copy plugin binary file to `/plugins`
|
||||||
|
|
||||||
@@ -145,10 +145,10 @@ The code is in `server` folder.
|
|||||||
|
|
||||||
## Api Documentation
|
## Api Documentation
|
||||||
|
|
||||||
[go to wiki](https://github.com/Jinnrry/PMail/wiki/%E5%90%8E%E7%AB%AF%E6%8E%A5%E5%8F%A3%E6%96%87%E6%A1%A3)
|
[go to wiki](https://git.pcux.cn/xuans/Smail/wiki/%E5%90%8E%E7%AB%AF%E6%8E%A5%E5%8F%A3%E6%96%87%E6%A1%A3)
|
||||||
|
|
||||||
## Plugin Development
|
## Plugin Development
|
||||||
|
|
||||||
[go to wiki](https://github.com/Jinnrry/PMail/wiki/%E6%8F%92%E4%BB%B6%E5%BC%80%E5%8F%91%E8%AF%B4%E6%98%8E)
|
[go to wiki](https://git.pcux.cn/xuans/Smail/wiki/%E6%8F%92%E4%BB%B6%E5%BC%80%E5%8F%91%E8%AF%B4%E6%98%8E)
|
||||||
|
|
||||||
|
|
||||||
+8
-8
@@ -1,8 +1,8 @@
|
|||||||
# PMail
|
# Smail
|
||||||
|
|
||||||
> 一台服务器、一个域名、一行代码、一分钟时间,你就能够搭建出一个自己的域名邮箱。
|
> 一台服务器、一个域名、一行代码、一分钟时间,你就能够搭建出一个自己的域名邮箱。
|
||||||
|
|
||||||
PMail是一个追求极简部署流程、极致资源占用的个人域名邮箱服务器。单文件运行,包含完整的收发邮件服务和Web端邮件管理功能。只需一台服务器、一个域名、一行代码、一分钟部署时间,你就能够搭建出一个自己的域名邮箱。
|
Smail是一个追求极简部署流程、极致资源占用的个人域名邮箱服务器。单文件运行,包含完整的收发邮件服务和Web端邮件管理功能。只需一台服务器、一个域名、一行代码、一分钟部署时间,你就能够搭建出一个自己的域名邮箱。
|
||||||
|
|
||||||
欢迎各类PR,无论你是修复bug、新增功能、修改翻译。另外,也为这个项目征集一个漂亮可爱的Logo!
|
欢迎各类PR,无论你是修复bug、新增功能、修改翻译。另外,也为这个项目征集一个漂亮可爱的Logo!
|
||||||
|
|
||||||
@@ -51,12 +51,12 @@ PMail是一个追求极简部署流程、极致资源占用的个人域名邮箱
|
|||||||
|
|
||||||
## 1、下载文件
|
## 1、下载文件
|
||||||
|
|
||||||
* [点击这里](https://github.com/Jinnrry/PMail/releases)下载一个与你匹配的程序文件。
|
* [点击这里](https://git.pcux.cn/xuans/Smail/releases)下载一个与你匹配的程序文件。
|
||||||
* 或者使用Docker运行 `docker pull ghcr.io/jinnrry/pmail:latest`
|
* 或者使用Docker运行 `docker pull ghcr.io/jinnrry/pmail:latest`
|
||||||
|
|
||||||
## 2、运行
|
## 2、运行
|
||||||
|
|
||||||
`./pmail -p 80`
|
`./smail -p 80`
|
||||||
|
|
||||||
> `-p 指定引导设置界面的http端口,默认为80端口,注意该参数仅影响引导设置阶段,设置完成后如果需要修改端口请修改配置文件`
|
> `-p 指定引导设置界面的http端口,默认为80端口,注意该参数仅影响引导设置阶段,设置完成后如果需要修改端口请修改配置文件`
|
||||||
|
|
||||||
@@ -89,7 +89,7 @@ PMail是一个追求极简部署流程、极致资源占用的个人域名邮箱
|
|||||||
"sslType": "0", // ssl证书更新模式,0自动,HTTP模式,1手动、2自动,DNS模式
|
"sslType": "0", // ssl证书更新模式,0自动,HTTP模式,1手动、2自动,DNS模式
|
||||||
"SSLPrivateKeyPath": "config/ssl/private.key", // ssl 证书地址
|
"SSLPrivateKeyPath": "config/ssl/private.key", // ssl 证书地址
|
||||||
"SSLPublicKeyPath": "config/ssl/public.crt", // ssl 证书地址
|
"SSLPublicKeyPath": "config/ssl/public.crt", // ssl 证书地址
|
||||||
"dbDSN": "./config/pmail.db", // 数据库连接DSN
|
"dbDSN": "./config/smail.db", // 数据库连接DSN
|
||||||
"dbType": "sqlite", //数据库类型,支持sqlite 和 mysql
|
"dbType": "sqlite", //数据库类型,支持sqlite 和 mysql
|
||||||
"httpsEnabled": 0, // web后台是否启用https 0默认(启用),1启用,2不启用
|
"httpsEnabled": 0, // web后台是否启用https 0默认(启用),1启用,2不启用
|
||||||
"spamFilterLevel": 0,// 垃圾邮件过滤级别,0不过滤、1 spf dkim 校验均失败时且无有效收件人过滤,2 spf校验不通过时且无有效收件人过滤 3,dkim 校验不过的时候且无有效收件人过滤
|
"spamFilterLevel": 0,// 垃圾邮件过滤级别,0不过滤、1 spf dkim 校验均失败时且无有效收件人过滤,2 spf校验不通过时且无有效收件人过滤 3,dkim 校验不过的时候且无有效收件人过滤
|
||||||
@@ -125,7 +125,7 @@ IMAP端口: 993(SSL)
|
|||||||
|
|
||||||
## 插件安装
|
## 插件安装
|
||||||
> [!IMPORTANT]
|
> [!IMPORTANT]
|
||||||
> 插件已独立进程的方式运行在你的服务器上,请自行审查第三方插件的安全性。PMail目前仅维护上述三款插件
|
> 插件已独立进程的方式运行在你的服务器上,请自行审查第三方插件的安全性。Smail目前仅维护上述三款插件
|
||||||
|
|
||||||
将插件二进制文件放到`plugins`文件夹中即可
|
将插件二进制文件放到`plugins`文件夹中即可
|
||||||
|
|
||||||
@@ -151,10 +151,10 @@ IMAP端口: 993(SSL)
|
|||||||
|
|
||||||
## 后端接口文档
|
## 后端接口文档
|
||||||
|
|
||||||
[go to wiki](https://github.com/Jinnrry/PMail/wiki/%E5%90%8E%E7%AB%AF%E6%8E%A5%E5%8F%A3%E6%96%87%E6%A1%A3)
|
[go to wiki](https://git.pcux.cn/xuans/Smail/wiki/%E5%90%8E%E7%AB%AF%E6%8E%A5%E5%8F%A3%E6%96%87%E6%A1%A3)
|
||||||
|
|
||||||
## 插件开发
|
## 插件开发
|
||||||
|
|
||||||
[go to wiki](https://github.com/Jinnrry/PMail/wiki/%E6%8F%92%E4%BB%B6%E5%BC%80%E5%8F%91%E8%AF%B4%E6%98%8E)
|
[go to wiki](https://git.pcux.cn/xuans/Smail/wiki/%E6%8F%92%E4%BB%B6%E5%BC%80%E5%8F%91%E8%AF%B4%E6%98%8E)
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,775 @@
|
|||||||
|
# Smail 安全审查风险整改任务清单
|
||||||
|
|
||||||
|
> 审查日期:2026-08-24
|
||||||
|
> 审查范围:当前工作区 `D:\Desktop\Smail`
|
||||||
|
> 文档用途:按照任务项逐项整改,并在整改完成后进行复审。
|
||||||
|
|
||||||
|
## 一、使用说明
|
||||||
|
|
||||||
|
### 1. 状态标记
|
||||||
|
|
||||||
|
- `[ ] 未开始`
|
||||||
|
- `[~] 进行中`
|
||||||
|
- `[x] 已完成,等待复审`
|
||||||
|
- `[✓] 复审通过`
|
||||||
|
- `[!] 暂缓或存在阻塞`
|
||||||
|
|
||||||
|
每项整改完成后,请补充以下内容:
|
||||||
|
|
||||||
|
- 实际修改的文件和提交号;
|
||||||
|
- 修改前后的行为差异;
|
||||||
|
- 测试命令或手工验证步骤;
|
||||||
|
- 测试结果和遗留风险;
|
||||||
|
- 复审日期。
|
||||||
|
|
||||||
|
### 2. 优先级说明
|
||||||
|
|
||||||
|
- **P0:上线阻断项**。可能导致凭据泄漏、管理员被抢先创建、会话被窃取或跨用户影响,生产上线前必须完成。
|
||||||
|
- **P1:高优先级安全整改**。需要在近期版本完成,否则会扩大攻击面或降低租户隔离能力。
|
||||||
|
- **P2:加固和质量整改**。建议纳入后续版本和持续安全建设。
|
||||||
|
|
||||||
|
### 3. 整改原则
|
||||||
|
|
||||||
|
- 不要把密码、私钥、数据库凭据或初始化令牌写入 Git、脚本、测试输出和普通日志。
|
||||||
|
- 所有资源 ID 都必须同时校验当前用户或租户归属。
|
||||||
|
- 安全修复应增加回归测试,避免只修改实现而没有验证边界。
|
||||||
|
- 测试不得删除工作区真实配置或数据库;应使用临时目录和测试专用配置。
|
||||||
|
- 本次不保留旧密码算法兼容逻辑,不执行旧算法与新算法双轨校验;已有账号通过统一的密码重置或重新初始化流程设置新密码。
|
||||||
|
- 登录、管理员操作、初始化和第三方配置验证必须复用统一的凭据校验服务;需要向第三方服务发起连接的密钥不得使用不可逆密码哈希保存,而应使用受控加密存储。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 二、整改总览
|
||||||
|
|
||||||
|
| 任务编号 | 优先级 | 风险主题 | 主要位置 | 状态 |
|
||||||
|
| --- | --- | --- | --- | --- |
|
||||||
|
| SEC-001 | P0 | SMTP 587 在 STARTTLS 前允许认证 | `server/listen/smtp_server/smtp.go` | [ ] |
|
||||||
|
| SEC-002 | P0 | SMTP 日志记录明文密码 | `server/listen/smtp_server/action.go` | [ ] |
|
||||||
|
| SEC-003 | P0 | 初始化接口缺少访问保护 | `server/listen/http_server/`、`server/controllers/setup.go` | [ ] |
|
||||||
|
| SEC-004 | P0 | 明文 HTTP 承载完整登录会话 | `server/listen/http_server/http_server.go` | [ ] |
|
||||||
|
| SEC-005 | P1 | 邮件移动未验证目标分组归属 | `server/controllers/email/move.go`、`server/services/group/group.go` | [ ] |
|
||||||
|
| SEC-006 | P1 | 删除分组后的邮件更新缺少用户条件 | `server/services/group/group.go` | [ ] |
|
||||||
|
| SEC-007 | P1 | 密码使用 MD5 和固定盐 | `server/utils/password/encode.go` | [ ] |
|
||||||
|
| SEC-008 | P1 | 请求体读取没有统一大小限制 | `server/controllers/` | [ ] |
|
||||||
|
| SEC-009 | P1 | 缺少统一 CSRF 防护 | Cookie 会话状态修改接口 | [ ] |
|
||||||
|
| SEC-010 | P1 | 邮件 HTML 清理策略较宽松 | `server/dto/parsemail/email.go`、`fe/src/views/EmailDetailView.vue` | [ ] |
|
||||||
|
| SEC-011 | P1 | 缺少统一安全响应头,插件 iframe 未隔离 | `server/listen/http_server/`、`fe/src/components/PluginSettings.vue` | [ ] |
|
||||||
|
| SEC-012 | P1 | 初始化 SSL 路径校验不足 | `server/controllers/setup.go` | [ ] |
|
||||||
|
| SEC-013 | P1 | 出站 SMTPS 跳过证书校验 | `server/utils/smtp/smtp.go` | [ ] |
|
||||||
|
| SEC-014 | P1 | 测试可能删除真实配置和数据库 | `server/main_test.go` | [ ] |
|
||||||
|
| SEC-015 | P2 | 敏感文件权限过宽 | `server/services/auth/`、`server/services/setup/ssl/`、`server/config/` | [ ] |
|
||||||
|
| SEC-016 | P2 | DKIM RSA 密钥长度只有 1024 位 | `server/services/auth/auth.go` | [ ] |
|
||||||
|
| SEC-017 | P2 | 附件下载响应头和文件名处理不规范 | `server/controllers/attachments.go` | [ ] |
|
||||||
|
| SEC-018 | P2 | Windows 路径处理不完整 | `server/config/config.go` | [ ] |
|
||||||
|
| SEC-019 | P2 | 插件进程信任边界较宽 | `server/hooks/base.go` | [ ] |
|
||||||
|
| SEC-020 | P2 | IMAP 未使用辅助函数缺少 UID 用户隔离 | `server/services/detail/detail.go` | [ ] |
|
||||||
|
| SEC-021 | P2 | 依赖漏洞审计和锁文件审计尚未建立 | Go、前端依赖管理 | [ ] |
|
||||||
|
| SEC-022 | P2 | `go vet` 现有问题降低静态检查效果 | `server/dto/parsemail/email.go`、`server/controllers/group.go` | [ ] |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# 三、P0:上线阻断项
|
||||||
|
|
||||||
|
## SEC-001:禁止 SMTP 587 在 STARTTLS 前认证
|
||||||
|
|
||||||
|
- **状态**:[ ] 未开始
|
||||||
|
- **风险等级**:P0 / 高风险
|
||||||
|
- **关联问题**:SMTP 明文认证导致凭据泄漏。
|
||||||
|
- **关联文件**:
|
||||||
|
- `server/listen/smtp_server/smtp.go`
|
||||||
|
- SMTP 认证和 STARTTLS 相关测试文件
|
||||||
|
|
||||||
|
### 整改要求
|
||||||
|
|
||||||
|
1. 587 端口在 TLS 建立前不得声明 `AUTH` 能力。
|
||||||
|
2. 只有 STARTTLS 成功后才允许 `AUTH PLAIN`、`AUTH LOGIN` 或其他认证方式。
|
||||||
|
3. 移除或关闭允许不安全认证的配置。
|
||||||
|
4. 465 端口继续使用隐式 TLS,不与 587 的明文升级逻辑混用。
|
||||||
|
5. 对 TLS 协商失败、重复认证和 STARTTLS 降级行为增加测试。
|
||||||
|
|
||||||
|
### 验收标准
|
||||||
|
|
||||||
|
- 明文连接执行 `EHLO` 时只返回 `STARTTLS`,不返回 `AUTH`。
|
||||||
|
- 未执行 STARTTLS 直接发送认证命令时,服务器拒绝认证。
|
||||||
|
- STARTTLS 成功后重新执行 `EHLO`,才返回认证能力。
|
||||||
|
- 认证失败时日志中不包含密码或密码编码值。
|
||||||
|
- 增加自动化测试,覆盖成功、失败和降级场景。
|
||||||
|
|
||||||
|
### 复审建议
|
||||||
|
|
||||||
|
使用隔离测试端口执行 SMTP 对话验证,并保存不含凭据的协议输出。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## SEC-002:删除 SMTP 明文密码日志
|
||||||
|
|
||||||
|
- **状态**:[ ] 未开始
|
||||||
|
- **风险等级**:P0 / 高风险
|
||||||
|
- **关联问题**:Debug 日志输出认证密码。
|
||||||
|
- **关联文件**:
|
||||||
|
- `server/listen/smtp_server/action.go`
|
||||||
|
- 其他 SMTP 认证日志调用点
|
||||||
|
|
||||||
|
### 整改要求
|
||||||
|
|
||||||
|
1. 删除所有用户名和密码同时输出的日志。
|
||||||
|
2. 不记录明文密码、Base64 密码或完整 AUTH 报文。
|
||||||
|
3. 只记录认证方式、脱敏账号、结果、远端地址和追踪信息。
|
||||||
|
4. 搜索整个仓库,确认没有其他认证密码日志。
|
||||||
|
5. 检查现有日志配置,避免调试模式绕过脱敏逻辑。
|
||||||
|
|
||||||
|
### 验收标准
|
||||||
|
|
||||||
|
- 使用成功和失败认证各执行一次,日志中均不存在密码原文。
|
||||||
|
- 搜索源代码和测试输出,不存在密码格式化日志。
|
||||||
|
- 日志中账号已按需要脱敏。
|
||||||
|
- 认证失败日志不会回显用户输入的敏感字段。
|
||||||
|
|
||||||
|
### 复审建议
|
||||||
|
|
||||||
|
使用固定测试账号进行验证,但不要把实际密码写入命令历史、报告或 Git。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## SEC-003:保护初始化接口并限制初始化网络边界
|
||||||
|
|
||||||
|
- **状态**:[ ] 未开始
|
||||||
|
- **风险等级**:P0 / 高风险
|
||||||
|
- **关联问题**:攻击者可能在管理员之前抢先完成初始化。
|
||||||
|
- **关联文件**:
|
||||||
|
- `server/listen/http_server/setup_server.go`
|
||||||
|
- `server/listen/http_server/https_server.go`
|
||||||
|
- `server/controllers/setup.go`
|
||||||
|
|
||||||
|
### 整改要求
|
||||||
|
|
||||||
|
1. 初始化接口必须要求一次性随机初始化令牌。
|
||||||
|
2. 默认初始化服务只监听 `127.0.0.1` 或受控管理地址。
|
||||||
|
3. 初始化成功后立即使令牌失效。
|
||||||
|
4. 初始化完成后,`/api/setup` 必须永久拒绝重复初始化。
|
||||||
|
5. 增加来源限制、失败次数限制和速率限制。
|
||||||
|
6. 初始化操作必须记录审计事件,但不得记录密码、私钥内容或数据库凭据。
|
||||||
|
7. 对数据库、管理员、域名、SSL 路径等字段进行服务端校验,不能仅依赖前端。
|
||||||
|
|
||||||
|
### 验收标准
|
||||||
|
|
||||||
|
- 无初始化令牌不能调用初始化接口。
|
||||||
|
- 令牌只能使用一次,重复使用失败。
|
||||||
|
- 非本机来源无法完成首次初始化,除非管理员明确配置了受控入口。
|
||||||
|
- 初始化完成后再次调用接口返回拒绝结果。
|
||||||
|
- 端口扫描或未授权请求不会泄漏初始化配置细节。
|
||||||
|
|
||||||
|
### 复审建议
|
||||||
|
|
||||||
|
在隔离环境启动一个全新实例,分别验证无令牌、错误令牌、重复令牌、跨来源请求和初始化成功后的重复调用。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## SEC-004:禁止明文 HTTP 承载登录会话
|
||||||
|
|
||||||
|
- **状态**:[ ] 未开始
|
||||||
|
- **风险等级**:P0 / 高风险
|
||||||
|
- **关联问题**:HTTP 模式下可能窃听登录请求和会话 Cookie。
|
||||||
|
- **关联文件**:
|
||||||
|
- `server/listen/http_server/http_server.go`
|
||||||
|
- `server/listen/http_server/https_server.go`
|
||||||
|
- 会话 Cookie 配置
|
||||||
|
- `server/config/config*.json`
|
||||||
|
|
||||||
|
### 整改要求
|
||||||
|
|
||||||
|
1. 生产模式强制 HTTPS。
|
||||||
|
2. HTTP 只允许安全跳转或 ACME 挑战,不加载完整业务路由。
|
||||||
|
3. HTTPS 下的会话 Cookie 必须设置 `Secure=true`。
|
||||||
|
4. 保持 `HttpOnly=true`,合理设置 `SameSite`。
|
||||||
|
5. 添加 HSTS,并确认代理转发场景下协议判断正确。
|
||||||
|
6. 避免由于错误的反向代理头导致服务误判为 HTTP 或 HTTPS。
|
||||||
|
|
||||||
|
### 验收标准
|
||||||
|
|
||||||
|
- 通过 HTTP 访问登录页面时只能获得安全跳转或明确拒绝。
|
||||||
|
- HTTP 不接受登录请求、不返回完整业务页面、不设置可用会话 Cookie。
|
||||||
|
- HTTPS 响应中的会话 Cookie 包含 `Secure` 和 `HttpOnly`。
|
||||||
|
- HTTPS 页面不存在混合内容。
|
||||||
|
- HSTS 只在确认 HTTPS 部署正确后启用。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# 四、P1:高优先级安全整改
|
||||||
|
|
||||||
|
## SEC-005:验证邮件移动目标分组属于当前用户
|
||||||
|
|
||||||
|
- **状态**:[ ] 未开始
|
||||||
|
- **风险等级**:P1 / 中高风险
|
||||||
|
- **关联问题**:用户可以引用其他用户的分组 ID。
|
||||||
|
- **关联文件**:
|
||||||
|
- `server/controllers/email/move.go`
|
||||||
|
- `server/services/group/group.go`
|
||||||
|
|
||||||
|
### 整改要求
|
||||||
|
|
||||||
|
1. 移动邮件前验证目标 `group_id` 存在且属于当前用户。
|
||||||
|
2. 对默认分组和系统分组使用明确的归属规则。
|
||||||
|
3. 无效或跨用户分组 ID 统一返回安全错误,不泄漏其他用户资源是否存在。
|
||||||
|
4. 同时覆盖 HTTP、IMAP 或其他可能修改分组的入口。
|
||||||
|
|
||||||
|
### 验收标准
|
||||||
|
|
||||||
|
- 用户 B 不能将邮件移动到用户 A 的分组。
|
||||||
|
- 不存在的分组 ID 与跨用户分组 ID 返回一致的错误语义。
|
||||||
|
- 正常移动仍然成功。
|
||||||
|
- 增加跨用户回归测试。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## SEC-006:删除分组后的更新必须带用户条件
|
||||||
|
|
||||||
|
- **状态**:[ ] 未开始
|
||||||
|
- **风险等级**:P1 / 中高风险
|
||||||
|
- **关联问题**:删除用户 A 的分组可能影响用户 B 的邮件元数据。
|
||||||
|
- **关联文件**:
|
||||||
|
- `server/services/group/group.go`
|
||||||
|
- 分组删除相关测试
|
||||||
|
|
||||||
|
### 整改要求
|
||||||
|
|
||||||
|
将分组删除后的邮件更新限制在当前用户范围内,例如逻辑上必须包含:
|
||||||
|
|
||||||
|
```sql
|
||||||
|
update user_email
|
||||||
|
set group_id=0
|
||||||
|
where group_id in (...)
|
||||||
|
and user_id=?
|
||||||
|
```
|
||||||
|
|
||||||
|
同时检查事务范围,确保删除分组和清理邮件引用处于同一事务中。
|
||||||
|
|
||||||
|
### 验收标准
|
||||||
|
|
||||||
|
- 用户 A 删除分组不会改变用户 B 的任何邮件数据。
|
||||||
|
- 用户 A 自己关联该分组的邮件会被正确清理。
|
||||||
|
- 删除失败时不会留下半完成状态。
|
||||||
|
- 增加双用户事务和回滚测试。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## SEC-007:统一密码哈希与凭据验证机制
|
||||||
|
|
||||||
|
- **状态**:[ ] 未开始
|
||||||
|
- **风险等级**:P1 / 中风险
|
||||||
|
- **关联问题**:MD5、固定盐、无独立随机盐。
|
||||||
|
- **关联文件**:
|
||||||
|
- `server/utils/password/encode.go`
|
||||||
|
- 用户创建、登录、修改密码流程
|
||||||
|
- 数据库用户表结构
|
||||||
|
|
||||||
|
### 整改要求
|
||||||
|
|
||||||
|
1. 统一使用 Argon2id 作为用户密码的唯一哈希算法,不再保留 MD5、固定盐、bcrypt、scrypt 或其他旧算法的运行时兼容分支。
|
||||||
|
2. 每个密码使用独立的密码学安全随机盐,并保存经过评审的算法参数和版本。
|
||||||
|
3. 将密码处理集中到统一的密码服务,例如 `PasswordService`,统一提供密码策略校验、哈希和验证能力。
|
||||||
|
4. 登录、用户改密、管理员重置、初始化管理员密码和其他用户密码验证入口必须调用同一个密码服务,不允许各业务模块自行拼接或比较哈希。
|
||||||
|
5. 第三方配置验证必须复用统一的凭据校验流程、输入规范化、超时、错误分类和脱敏日志规则。
|
||||||
|
6. 需要向第三方服务发起连接的 SMTP、API 或其他密钥不能使用不可逆密码哈希保存,应使用受控加密存储,并通过统一的 `CredentialValidator` 完成配置有效性验证。
|
||||||
|
7. 密码比较和第三方凭据校验应避免时序侧信道;所有失败响应不得泄露账号、配置或凭据是否存在的额外信息。
|
||||||
|
8. 不在日志、错误响应或审计记录中记录密码、第三方密钥、令牌或完整认证报文。
|
||||||
|
9. 对已有旧算法密码不提供兼容登录;发布前完成账号密码重置或强制重新设置密码,并提供管理员可审计的处理结果。
|
||||||
|
|
||||||
|
### 验收标准
|
||||||
|
|
||||||
|
- 新创建和重置后的用户密码均使用 Argon2id,数据库中不存在新写入的 MD5 或其他旧算法哈希。
|
||||||
|
- 每个用户的盐值不同,算法参数和版本可以被服务端正确解析。
|
||||||
|
- 登录、初始化、用户改密和管理员重置使用同一个密码服务,并对相同输入给出一致的成功或失败结果。
|
||||||
|
- 旧算法密码不会被兼容登录;没有完成密码重置的旧账号按明确策略被拒绝并引导设置新密码。
|
||||||
|
- 第三方 SMTP、API 等配置使用统一的凭据验证流程;验证成功的配置与实际运行时连接使用相同的规范化和校验规则。
|
||||||
|
- 第三方密钥不会以明文或不可逆哈希形式保存,日志、错误响应和审计记录均已脱敏。
|
||||||
|
- 密码哈希参数经过性能和部署环境验证。
|
||||||
|
- 错误密码、无效第三方配置和不存在的凭据不会产生可用于枚举的差异化错误信息。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## SEC-008:为请求体和附件增加大小限制
|
||||||
|
|
||||||
|
- **状态**:[ ] 未开始
|
||||||
|
- **风险等级**:P1 / 中风险
|
||||||
|
- **关联问题**:多个接口直接使用无上限 `io.ReadAll`。
|
||||||
|
- **关联范围**:
|
||||||
|
- `server/controllers/login.go`
|
||||||
|
- `server/controllers/setup.go`
|
||||||
|
- `server/controllers/user.go`
|
||||||
|
- `server/controllers/settings.go`
|
||||||
|
- `server/controllers/rule.go`
|
||||||
|
- `server/controllers/plugin.go`
|
||||||
|
- `server/controllers/group.go`
|
||||||
|
- `server/controllers/email/`
|
||||||
|
|
||||||
|
### 整改要求
|
||||||
|
|
||||||
|
1. 为每个接口定义请求体上限。
|
||||||
|
2. 普通 JSON、邮件正文和附件使用不同限制。
|
||||||
|
3. 附件限制总大小、单文件大小、文件数量和 Base64 解码后的大小。
|
||||||
|
4. 超限请求在解析前拒绝。
|
||||||
|
5. 设置请求读取超时和上传超时。
|
||||||
|
6. 对压缩内容和异常编码考虑解压缩炸弹或放大攻击。
|
||||||
|
|
||||||
|
### 验收标准
|
||||||
|
|
||||||
|
- 超过接口限制的请求返回明确错误。
|
||||||
|
- 服务内存不会随请求体无限增长。
|
||||||
|
- 附件原始大小和解码后大小都受到限制。
|
||||||
|
- 正常大小的登录、设置、邮件发送仍然可用。
|
||||||
|
- 增加边界值和并发上传测试。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## SEC-009:增加统一 CSRF 防护和状态修改方法限制
|
||||||
|
|
||||||
|
- **状态**:[ ] 未开始
|
||||||
|
- **风险等级**:P1 / 中风险
|
||||||
|
- **关联问题**:Cookie 会话状态修改接口缺少统一 CSRF 防护。
|
||||||
|
- **关联范围**:登录后的所有状态修改接口。
|
||||||
|
|
||||||
|
### 整改要求
|
||||||
|
|
||||||
|
1. 对 Cookie 会话增加 CSRF Token。
|
||||||
|
2. 对状态修改请求校验 `Origin`,必要时校验 `Referer`。
|
||||||
|
3. 所有状态修改接口只接受合适的非 GET 方法。
|
||||||
|
4. 删除、发送邮件、修改规则和账号设置等操作统一接入防护中间件。
|
||||||
|
5. 对 API 客户端和浏览器会话区分认证方式,避免 CSRF 逻辑互相绕过。
|
||||||
|
|
||||||
|
### 验收标准
|
||||||
|
|
||||||
|
- 无 CSRF Token 的跨站状态修改请求被拒绝。
|
||||||
|
- 错误 Origin 被拒绝。
|
||||||
|
- GET 请求不能执行有副作用的操作。
|
||||||
|
- 正常前端请求自动携带并校验 Token。
|
||||||
|
- 登录、退出和 Token 失效流程经过验证。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## SEC-010:收紧邮件 HTML 清理和展示隔离
|
||||||
|
|
||||||
|
- **状态**:[ ] 未开始
|
||||||
|
- **风险等级**:P1 / 中风险
|
||||||
|
- **关联问题**:邮件正文使用 `v-html`,允许较宽的 HTML 和外链能力。
|
||||||
|
- **关联文件**:
|
||||||
|
- `server/dto/parsemail/email.go`
|
||||||
|
- `fe/src/views/EmailDetailView.vue`
|
||||||
|
|
||||||
|
### 整改要求
|
||||||
|
|
||||||
|
1. 使用成熟的 HTML Sanitizer 或严格白名单。
|
||||||
|
2. 默认禁止 `<style>` 和全局 `style` 属性。
|
||||||
|
3. 禁止危险协议,包括变体和编码绕过形式。
|
||||||
|
4. 外链图片默认不加载,或通过受控代理加载。
|
||||||
|
5. 优先使用隔离 iframe 展示邮件 HTML。
|
||||||
|
6. 配合 CSP 限制脚本、对象、表单、顶层导航和网络请求。
|
||||||
|
7. 增加恶意 HTML 回归样本,但测试样本中不得包含真实用户数据。
|
||||||
|
|
||||||
|
### 验收标准
|
||||||
|
|
||||||
|
- 脚本、事件处理器和危险协议均被移除。
|
||||||
|
- CSS 无法覆盖或伪造系统登录界面。
|
||||||
|
- 邮件内容无法修改主页面 DOM。
|
||||||
|
- 外链图片按用户隐私设置生效。
|
||||||
|
- 常见实体、大小写、编码和嵌套绕过测试通过。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## SEC-011:增加统一安全响应头并隔离插件 iframe
|
||||||
|
|
||||||
|
- **状态**:[ ] 未开始
|
||||||
|
- **风险等级**:P1 / 中风险
|
||||||
|
- **关联问题**:缺少统一安全响应头,插件 iframe 未使用 `sandbox`。
|
||||||
|
- **关联文件**:
|
||||||
|
- `server/listen/http_server/`
|
||||||
|
- `fe/src/components/PluginSettings.vue`
|
||||||
|
|
||||||
|
### 整改要求
|
||||||
|
|
||||||
|
1. 增加统一安全响应头中间件。
|
||||||
|
2. 根据部署方式配置 CSP,禁止不必要的脚本和连接来源。
|
||||||
|
3. 添加 `X-Content-Type-Options: nosniff`。
|
||||||
|
4. 添加点击劫持防护,优先使用 CSP `frame-ancestors`。
|
||||||
|
5. 配置 `Referrer-Policy` 和 `Permissions-Policy`。
|
||||||
|
6. 插件 iframe 使用 `sandbox`,仅开放确实需要的权限。
|
||||||
|
7. 插件 URL 使用可信来源白名单,不允许任意用户输入直接加载。
|
||||||
|
|
||||||
|
### 验收标准
|
||||||
|
|
||||||
|
- 主要业务响应包含统一安全响应头。
|
||||||
|
- 插件 iframe 无法访问主页面敏感 DOM、Cookie 或不必要的能力。
|
||||||
|
- 非白名单插件 URL 被拒绝。
|
||||||
|
- CSP 报告和实际资源加载行为符合预期。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## SEC-012:限制初始化 SSL 文件路径并验证证书私钥匹配
|
||||||
|
|
||||||
|
- **状态**:[ ] 未开始
|
||||||
|
- **风险等级**:P1 / 中风险
|
||||||
|
- **关联问题**:客户端可以直接指定 SSL 路径。
|
||||||
|
- **关联文件**:
|
||||||
|
- `server/controllers/setup.go`
|
||||||
|
- `server/services/setup/ssl/`
|
||||||
|
|
||||||
|
### 整改要求
|
||||||
|
|
||||||
|
1. 只允许使用受控证书目录中的普通文件。
|
||||||
|
2. 拒绝 `..`、符号链接逃逸和不符合规范的绝对路径。
|
||||||
|
3. 规范化路径后再次验证最终位置。
|
||||||
|
4. 解析证书和私钥,验证二者匹配。
|
||||||
|
5. 拒绝弱密钥、空文件和错误格式。
|
||||||
|
6. 不向客户端回显私钥内容或详细文件系统错误。
|
||||||
|
7. 对配置文件中保存的路径进行权限和可读性检查。
|
||||||
|
|
||||||
|
### 验收标准
|
||||||
|
|
||||||
|
- 受控目录内的有效证书可以配置。
|
||||||
|
- 目录外路径、路径穿越、符号链接逃逸均被拒绝。
|
||||||
|
- 不匹配的证书和私钥无法保存。
|
||||||
|
- 错误响应不会泄漏服务器真实目录结构。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## SEC-013:恢复出站 SMTPS 证书校验
|
||||||
|
|
||||||
|
- **状态**:[ ] 未开始
|
||||||
|
- **风险等级**:P1 / 中风险
|
||||||
|
- **关联问题**:出站 SMTP 使用 `InsecureSkipVerify: true`。
|
||||||
|
- **关联文件**:
|
||||||
|
- `server/utils/smtp/smtp.go`
|
||||||
|
- 出站 SMTP 配置和测试
|
||||||
|
|
||||||
|
### 整改要求
|
||||||
|
|
||||||
|
1. 默认校验远端证书链、主机名和有效期。
|
||||||
|
2. 自签名兼容场景使用显式信任根或指定证书指纹。
|
||||||
|
3. 禁止由普通用户请求参数直接关闭证书校验。
|
||||||
|
4. 记录证书校验失败事件,但不记录认证密码。
|
||||||
|
5. 增加证书过期、主机名不匹配和自签名证书测试。
|
||||||
|
|
||||||
|
### 验收标准
|
||||||
|
|
||||||
|
- 证书无效或主机名不匹配时连接失败。
|
||||||
|
- 配置的受信任根可以正常连接。
|
||||||
|
- 不存在全局跳过证书校验的默认路径。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## SEC-014:修复测试副作用,禁止删除真实配置和数据库
|
||||||
|
|
||||||
|
- **状态**:[ ] 未开始
|
||||||
|
- **风险等级**:P1 / 测试安全与可靠性
|
||||||
|
- **关联问题**:测试会删除工作区配置和临时数据库。
|
||||||
|
- **关联文件**:
|
||||||
|
- `server/main_test.go`
|
||||||
|
- 依赖运行时配置的测试包
|
||||||
|
|
||||||
|
### 整改要求
|
||||||
|
|
||||||
|
1. 测试使用 `t.TempDir()` 或独立临时目录。
|
||||||
|
2. 测试配置通过显式路径注入,不使用真实运行目录。
|
||||||
|
3. 测试数据库使用临时数据库文件或内存数据库。
|
||||||
|
4. 禁止在测试中直接删除仓库配置文件。
|
||||||
|
5. 测试失败时保留必要诊断信息,但不保留敏感数据。
|
||||||
|
6. CI 环境和本地环境使用相同的隔离方式。
|
||||||
|
|
||||||
|
### 验收标准
|
||||||
|
|
||||||
|
- 执行 `go test ./...` 前后,真实配置和数据库文件内容不变。
|
||||||
|
- 测试失败也不会删除或覆盖工作区文件。
|
||||||
|
- 测试可以并行执行,不共享固定数据库路径。
|
||||||
|
- CI 测试具备可重复性。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# 五、P2:加固和质量整改
|
||||||
|
|
||||||
|
## SEC-015:收紧敏感文件和目录权限
|
||||||
|
|
||||||
|
- **状态**:[ ] 未开始
|
||||||
|
- **风险等级**:P2 / 低至中风险
|
||||||
|
- **整改范围**:配置文件、数据库、SSL 私钥、认证密钥和相关目录。
|
||||||
|
|
||||||
|
### 整改要求
|
||||||
|
|
||||||
|
- 私钥使用 `0600`;
|
||||||
|
- 配置文件使用 `0600`;
|
||||||
|
- 数据库文件使用 `0600`;
|
||||||
|
- 敏感目录使用 `0700` 或部署所需的最小权限;
|
||||||
|
- 禁止使用 `0666` 创建敏感文件;
|
||||||
|
- 启动时检测权限过宽并记录告警或拒绝启动。
|
||||||
|
|
||||||
|
### 验收标准
|
||||||
|
|
||||||
|
在 Linux 部署环境中检查实际权限,确认普通系统用户无法读取数据库凭据、认证密钥和 TLS 私钥。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## SEC-016:将 DKIM RSA 密钥提升到至少 2048 位
|
||||||
|
|
||||||
|
- **状态**:[ ] 未开始
|
||||||
|
- **风险等级**:P2 / 低风险
|
||||||
|
- **关联文件**:
|
||||||
|
- `server/services/auth/auth.go`
|
||||||
|
- DKIM 生成和轮换逻辑
|
||||||
|
|
||||||
|
### 整改要求
|
||||||
|
|
||||||
|
1. 新生成密钥至少使用 RSA 2048。
|
||||||
|
2. 保留旧密钥平滑轮换窗口。
|
||||||
|
3. DNS 公钥更新和缓存时间纳入轮换设计。
|
||||||
|
4. 不在日志中输出私钥。
|
||||||
|
|
||||||
|
### 验收标准
|
||||||
|
|
||||||
|
- 新生成 DKIM 私钥长度达到要求。
|
||||||
|
- 外发邮件签名仍能通过验证。
|
||||||
|
- 密钥轮换期间旧邮件和新邮件处理正常。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## SEC-017:规范附件下载响应头和文件名
|
||||||
|
|
||||||
|
- **状态**:[ ] 未开始
|
||||||
|
- **风险等级**:P2 / 低风险
|
||||||
|
- **关联文件**:`server/controllers/attachments.go`
|
||||||
|
|
||||||
|
### 整改要求
|
||||||
|
|
||||||
|
1. 使用标准 `Content-Type`。
|
||||||
|
2. 对文件名进行 CR/LF 清理、长度限制和编码处理。
|
||||||
|
3. 使用安全的 `Content-Disposition` 格式。
|
||||||
|
4. 设置 `X-Content-Type-Options: nosniff`。
|
||||||
|
5. 保持附件所属邮件和用户权限校验。
|
||||||
|
|
||||||
|
### 验收标准
|
||||||
|
|
||||||
|
覆盖以下文件名场景:
|
||||||
|
|
||||||
|
- 中文文件名;
|
||||||
|
- 空文件名;
|
||||||
|
- 超长文件名;
|
||||||
|
- 含引号文件名;
|
||||||
|
- 含 CR/LF 文件名;
|
||||||
|
- 含路径分隔符文件名。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## SEC-018:完善 Windows 和 Linux 路径处理
|
||||||
|
|
||||||
|
- **状态**:[ ] 未开始
|
||||||
|
- **风险等级**:P2 / 低风险
|
||||||
|
- **关联文件**:`server/config/config.go`
|
||||||
|
|
||||||
|
### 整改要求
|
||||||
|
|
||||||
|
1. 使用 `filepath.IsAbs` 判断绝对路径。
|
||||||
|
2. 使用 `filepath.Clean` 规范化路径。
|
||||||
|
3. 校验规范化后的路径仍在允许目录内。
|
||||||
|
4. 覆盖 Windows 盘符、UNC 路径、Linux 绝对路径和相对路径。
|
||||||
|
5. 对路径错误返回通用错误,避免泄漏本机目录。
|
||||||
|
|
||||||
|
### 验收标准
|
||||||
|
|
||||||
|
Windows 和 Linux 下的配置路径解析结果一致且符合预期,路径穿越和目录外访问均被拒绝。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## SEC-019:收紧插件进程权限和环境变量
|
||||||
|
|
||||||
|
- **状态**:[ ] 未开始
|
||||||
|
- **风险等级**:P2 / 低至中风险
|
||||||
|
- **关联文件**:`server/hooks/base.go`
|
||||||
|
|
||||||
|
### 整改要求
|
||||||
|
|
||||||
|
1. 插件必须通过显式白名单才能启动。
|
||||||
|
2. 插件目录不允许普通业务用户写入。
|
||||||
|
3. 不继承主进程的全部环境变量。
|
||||||
|
4. 只传递插件必要的配置。
|
||||||
|
5. 使用独立用户或沙箱运行插件。
|
||||||
|
6. 限制插件文件系统、网络和进程权限。
|
||||||
|
7. 收紧插件 Unix socket 的文件权限。
|
||||||
|
|
||||||
|
### 验收标准
|
||||||
|
|
||||||
|
- 未授权插件不会被自动执行。
|
||||||
|
- 插件无法读取数据库密码、TLS 私钥和无关环境变量。
|
||||||
|
- 低权限用户不能通过写入插件目录获得服务进程权限。
|
||||||
|
- 插件异常退出不会导致主服务泄漏敏感信息。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## SEC-020:为 IMAP 辅助查询函数补充 UID 用户隔离
|
||||||
|
|
||||||
|
- **状态**:[ ] 未开始
|
||||||
|
- **风险等级**:P2 / 未来回归风险
|
||||||
|
- **关联文件**:`server/services/detail/detail.go`
|
||||||
|
|
||||||
|
### 整改要求
|
||||||
|
|
||||||
|
1. `FindUE` 等辅助函数必须接收当前用户 ID 或租户 ID。
|
||||||
|
2. 查询 `user_email` 时必须包含用户归属条件。
|
||||||
|
3. 禁止只按 UID 或邮件 ID 查询。
|
||||||
|
4. 增加跨用户 UID 回归测试。
|
||||||
|
5. 检查所有调用方,防止后续新增生产路径绕过隔离。
|
||||||
|
|
||||||
|
### 验收标准
|
||||||
|
|
||||||
|
- 用户 B 使用用户 A 的 UID 无法获得用户 A 的邮件记录。
|
||||||
|
- 正常用户范围内的 UID 查询不受影响。
|
||||||
|
- 代码审查确认所有 IMAP 查询入口都进行用户隔离。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## SEC-021:建立 Go 和前端依赖漏洞审计流程
|
||||||
|
|
||||||
|
- **状态**:[ ] 未开始
|
||||||
|
- **风险等级**:P2 / 流程风险
|
||||||
|
|
||||||
|
### 当前限制
|
||||||
|
|
||||||
|
本轮审查未完成完整依赖漏洞扫描,原因包括:
|
||||||
|
|
||||||
|
- 当前环境未安装 `govulncheck`;
|
||||||
|
- 前端存在 `yarn.lock`,但未安装 `yarn.cmd`;
|
||||||
|
- 没有 `package-lock.json`,因此 `npm audit` 返回 `ENOLOCK`。
|
||||||
|
|
||||||
|
### 整改要求
|
||||||
|
|
||||||
|
1. 固定 Go 依赖版本并定期执行 `govulncheck`。
|
||||||
|
2. 明确前端唯一包管理器,保留对应锁文件。
|
||||||
|
3. 在 CI 中执行依赖漏洞扫描。
|
||||||
|
4. 记录漏洞版本、影响范围、修复版本和例外原因。
|
||||||
|
5. 禁止在没有锁文件的情况下发布生产构建。
|
||||||
|
|
||||||
|
### 验收标准
|
||||||
|
|
||||||
|
- CI 能自动执行 Go 和前端依赖扫描。
|
||||||
|
- 依赖扫描失败时阻止生产发布,或必须经过明确的安全例外审批。
|
||||||
|
- 扫描结果可以追溯到具体提交和构建产物。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## SEC-022:修复 `go vet` 问题并恢复静态检查门禁
|
||||||
|
|
||||||
|
- **状态**:[ ] 未开始
|
||||||
|
- **风险等级**:P2 / 工程质量
|
||||||
|
- **关联文件**:
|
||||||
|
- `server/dto/parsemail/email.go`
|
||||||
|
- `server/controllers/group.go`
|
||||||
|
|
||||||
|
### 整改要求
|
||||||
|
|
||||||
|
1. 修复未命名结构体字段等 `go vet` 报告问题。
|
||||||
|
2. 在 CI 中执行 `go vet ./...`。
|
||||||
|
3. 不允许通过忽略规则掩盖真实问题,除非有书面安全说明。
|
||||||
|
4. 将静态检查作为合并前门禁。
|
||||||
|
|
||||||
|
### 验收标准
|
||||||
|
|
||||||
|
以下命令成功:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
go vet ./...
|
||||||
|
```
|
||||||
|
|
||||||
|
并且 CI 与本地结果一致。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# 六、统一复审清单
|
||||||
|
|
||||||
|
所有整改完成后,按以下顺序执行复审:
|
||||||
|
|
||||||
|
## 1. 认证和传输安全
|
||||||
|
|
||||||
|
- [ ] 587 STARTTLS 前不返回 AUTH。
|
||||||
|
- [ ] 587 STARTTLS 失败时不能认证。
|
||||||
|
- [ ] 465 必须使用隐式 TLS。
|
||||||
|
- [ ] 出站 SMTP 校验证书和主机名。
|
||||||
|
- [ ] HTTP 不承载登录和业务会话。
|
||||||
|
- [ ] HTTPS Cookie 包含 `Secure`、`HttpOnly` 和合理的 `SameSite`。
|
||||||
|
- [ ] HSTS 配置与反向代理行为一致。
|
||||||
|
|
||||||
|
## 2. 初始化和权限边界
|
||||||
|
|
||||||
|
- [ ] 初始化接口需要一次性令牌。
|
||||||
|
- [ ] 初始化令牌不可重复使用。
|
||||||
|
- [ ] 初始化完成后接口永久失效。
|
||||||
|
- [ ] 初始化阶段默认只允许本机或受控来源访问。
|
||||||
|
- [ ] SSL 路径只能指向受控目录。
|
||||||
|
- [ ] 证书和私钥匹配校验通过。
|
||||||
|
- [ ] 私钥和配置文件权限符合要求。
|
||||||
|
|
||||||
|
## 3. 用户和租户隔离
|
||||||
|
|
||||||
|
- [ ] 所有邮件查询包含用户条件。
|
||||||
|
- [ ] 所有分组查询包含用户条件。
|
||||||
|
- [ ] 移动邮件不能引用其他用户分组。
|
||||||
|
- [ ] 删除分组不能修改其他用户邮件。
|
||||||
|
- [ ] 附件下载不能跨用户访问。
|
||||||
|
- [ ] IMAP UID 不能跨用户读取邮件。
|
||||||
|
|
||||||
|
## 4. 输入和内容安全
|
||||||
|
|
||||||
|
- [ ] 所有请求体均有大小上限。
|
||||||
|
- [ ] 附件总大小和解码后大小均有限制。
|
||||||
|
- [ ] 状态修改接口启用 CSRF 防护。
|
||||||
|
- [ ] GET 不执行有副作用的操作。
|
||||||
|
- [ ] 邮件 HTML 通过严格白名单清理。
|
||||||
|
- [ ] 外链图片策略符合隐私要求。
|
||||||
|
- [ ] 插件 iframe 使用隔离策略。
|
||||||
|
- [ ] 附件文件名不能注入响应头。
|
||||||
|
|
||||||
|
## 5. 日志和构建安全
|
||||||
|
|
||||||
|
- [ ] 日志中不包含密码、私钥和数据库凭据。
|
||||||
|
- [ ] 认证失败日志已脱敏。
|
||||||
|
- [ ] 测试不会删除真实配置和数据库。
|
||||||
|
- [ ] `go test ./...` 在隔离环境中可重复执行。
|
||||||
|
- [ ] `go vet ./...` 成功。
|
||||||
|
- [ ] Go 依赖完成漏洞扫描。
|
||||||
|
- [ ] 前端依赖锁文件和漏洞扫描流程已确定。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# 七、整改记录
|
||||||
|
|
||||||
|
| 任务编号 | 修改提交 | 修改文件 | 验证命令或链接 | 验证结果 | 复审日期 | 复审人 |
|
||||||
|
| --- | --- | --- | --- | --- | --- | --- |
|
||||||
|
| SEC-001 | | | | | | |
|
||||||
|
| SEC-002 | | | | | | |
|
||||||
|
| SEC-003 | | | | | | |
|
||||||
|
| SEC-004 | | | | | | |
|
||||||
|
| SEC-005 | | | | | | |
|
||||||
|
| SEC-006 | | | | | | |
|
||||||
|
| SEC-007 | | | | | | |
|
||||||
|
| SEC-008 | | | | | | |
|
||||||
|
| SEC-009 | | | | | | |
|
||||||
|
| SEC-010 | | | | | | |
|
||||||
|
| SEC-011 | | | | | | |
|
||||||
|
| SEC-012 | | | | | | |
|
||||||
|
| SEC-013 | | | | | | |
|
||||||
|
| SEC-014 | | | | | | |
|
||||||
|
| SEC-015 | | | | | | |
|
||||||
|
| SEC-016 | | | | | | |
|
||||||
|
| SEC-017 | | | | | | |
|
||||||
|
| SEC-018 | | | | | | |
|
||||||
|
| SEC-019 | | | | | | |
|
||||||
|
| SEC-020 | | | | | | |
|
||||||
|
| SEC-021 | | | | | | |
|
||||||
|
| SEC-022 | | | | | | |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# 八、当前审查限制
|
||||||
|
|
||||||
|
- 本清单基于 2026-08-24 对当前工作区的安全审查结果。
|
||||||
|
- 当前工作区已有大量未提交变更,后续复审必须记录具体提交或文件版本。
|
||||||
|
- 前端构建成功,但 Go 全量测试受到测试副作用影响,尚未作为完整通过依据。
|
||||||
|
- Go 和前端依赖漏洞扫描尚未完成,需要在 SEC-021 中补齐。
|
||||||
|
- IMAP `detail.FindUE` 已确认存在未来回归风险,但当前未发现其被正常生产路径调用。
|
||||||
|
- 本文档只记录整改任务,不代表相关风险已经修复。
|
||||||
@@ -26,3 +26,5 @@ coverage
|
|||||||
*.njsproj
|
*.njsproj
|
||||||
*.sln
|
*.sln
|
||||||
*.sw?
|
*.sw?
|
||||||
|
auto-imports.d.ts
|
||||||
|
components.d.ts
|
||||||
+2
-2
@@ -2,9 +2,9 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<link rel="icon" href="/favicon.ico">
|
<link rel="icon" type="image/png" href="/smail-logo.png">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>PMail</title>
|
<title>Smail</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "fe",
|
"name": "smail-frontend",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 4.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.1 MiB |
@@ -1 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 261.76 226.69"><path d="M161.096.001l-30.225 52.351L100.647.001H-.005l130.877 226.688L261.749.001z" fill="#41b883"/><path d="M161.096.001l-30.225 52.351L100.647.001H52.346l78.526 136.01L209.398.001z" fill="#34495e"/></svg>
|
|
||||||
|
Before Width: | Height: | Size: 276 B |
@@ -2,8 +2,8 @@
|
|||||||
<div class="sidebar-main">
|
<div class="sidebar-main">
|
||||||
<div class="brand">
|
<div class="brand">
|
||||||
<router-link to="/" class="brand-link">
|
<router-link to="/" class="brand-link">
|
||||||
<span class="brand-dot"></span>
|
<img src="/smail-logo.png" alt="Smail" class="brand-logo" />
|
||||||
<span class="brand-text">PMail</span>
|
<span class="brand-text">Smail</span>
|
||||||
</router-link>
|
</router-link>
|
||||||
</div>
|
</div>
|
||||||
<div class="search-box">
|
<div class="search-box">
|
||||||
@@ -113,13 +113,14 @@ const openSettings = function () {
|
|||||||
gap: 8px;
|
gap: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.brand-dot {
|
/* 品牌 logo 图标(黑底圆角,contain 使纸飞机居中显示) */
|
||||||
width: 9px;
|
.brand-logo {
|
||||||
height: 9px;
|
width: 28px;
|
||||||
border-radius: 50%;
|
height: 28px;
|
||||||
background: var(--pm-primary-color);
|
border-radius: 8px;
|
||||||
box-shadow: 0 0 0 6px rgba(0, 113, 227, 0.14);
|
object-fit: contain;
|
||||||
animation: pm-soft-pulse 2.6s ease-in-out infinite;
|
background: #000;
|
||||||
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.brand-text {
|
.brand-text {
|
||||||
|
|||||||
@@ -6,7 +6,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="mobile-logo">
|
<div class="mobile-logo">
|
||||||
<router-link to="/">
|
<router-link to="/">
|
||||||
<h1>PMail</h1>
|
<img src="/smail-logo.png" alt="Smail" class="mobile-logo-img" />
|
||||||
|
<h1>Smail</h1>
|
||||||
</router-link>
|
</router-link>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -112,6 +113,19 @@ onUnmounted(() => {
|
|||||||
|
|
||||||
.mobile-logo a {
|
.mobile-logo a {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 移动端标题栏 logo 图标 */
|
||||||
|
.mobile-logo-img {
|
||||||
|
width: 26px;
|
||||||
|
height: 26px;
|
||||||
|
border-radius: 7px;
|
||||||
|
object-fit: contain;
|
||||||
|
background: #000;
|
||||||
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.settings-btn {
|
.settings-btn {
|
||||||
|
|||||||
+8
-8
@@ -55,10 +55,10 @@ let lang = {
|
|||||||
"setOther": "Other",
|
"setOther": "Other",
|
||||||
"welcome": "Welcome",
|
"welcome": "Welcome",
|
||||||
"next": "Next",
|
"next": "Next",
|
||||||
"tks_pmail": "Thanks for using Pmail",
|
"tks_smail": "Thanks for using Smail",
|
||||||
"guid_desc": "Next, you will be guided to perform initial configuration. If you have already configured, please use your configuration file to overwrite the config folder of the running directory. If you have not configured it, please follow this guide.",
|
"guid_desc": "Next, you will be guided to perform initial configuration. If you have already configured, please use your configuration file to overwrite the config folder of the running directory. If you have not configured it, please follow this guide.",
|
||||||
"select_db": "select database",
|
"select_db": "select database",
|
||||||
"db_desc": "PMail currently supports MySQL and SQLite3 databases, you can choose according to your needs.",
|
"db_desc": "Smail currently supports MySQL and SQLite3 databases, you can choose according to your needs.",
|
||||||
"type": "Type",
|
"type": "Type",
|
||||||
"db_select_ph": "please select your database",
|
"db_select_ph": "please select your database",
|
||||||
"mysql_dsn": "MySQL DSN",
|
"mysql_dsn": "MySQL DSN",
|
||||||
@@ -76,7 +76,7 @@ let lang = {
|
|||||||
"ssl_challenge_type": "Challenge Type",
|
"ssl_challenge_type": "Challenge Type",
|
||||||
"ssl_auto_http": "Http Request",
|
"ssl_auto_http": "Http Request",
|
||||||
"ssl_auto_dns": "DNS Records",
|
"ssl_auto_dns": "DNS Records",
|
||||||
"challenge_typ_desc": "If PMail uses port 80 directly, it is recommended that you use the HTTP challenge method.",
|
"challenge_typ_desc": "If Smail uses port 80 directly, it is recommended that you use the HTTP challenge method.",
|
||||||
"oomain_service_provider": "Domain Name Service Provider",
|
"oomain_service_provider": "Domain Name Service Provider",
|
||||||
"ssl_manuallyf": "Manually configure an SSL certificate",
|
"ssl_manuallyf": "Manually configure an SSL certificate",
|
||||||
"ssl_key_path": "ssl key file path",
|
"ssl_key_path": "ssl key file path",
|
||||||
@@ -109,7 +109,7 @@ let lang = {
|
|||||||
"move": "Move to group",
|
"move": "Move to group",
|
||||||
"del_rule_confirm": "Are you sure to delete this?",
|
"del_rule_confirm": "Are you sure to delete this?",
|
||||||
"rule_params": "Executed params",
|
"rule_params": "Executed params",
|
||||||
"autoSSLWarn": "PMail is not currently running on port 80. If you want PMail to manage SSL certificates automatically, please forward the /.well-known/* route to PMail. See https://github.com/Jinnrry/PMail/issues/94 for details.",
|
"autoSSLWarn": "Smail is not currently running on port 80. If you want Smail to manage SSL certificates automatically, please forward the /.well-known/* route to Smail. See https://git.pcux.cn/xuans/Smail/issues/94 for details.",
|
||||||
"err_db_dsn_empty": "Database path cannot be empty!",
|
"err_db_dsn_empty": "Database path cannot be empty!",
|
||||||
"modify_pwd_desc": "Update your account password to keep it secure.",
|
"modify_pwd_desc": "Update your account password to keep it secure.",
|
||||||
"enter_new_pwd": "Enter new password",
|
"enter_new_pwd": "Enter new password",
|
||||||
@@ -189,10 +189,10 @@ const zhCN = {
|
|||||||
"setOther": "其他设置",
|
"setOther": "其他设置",
|
||||||
"welcome": "欢迎",
|
"welcome": "欢迎",
|
||||||
"next": "下一步",
|
"next": "下一步",
|
||||||
"tks_pmail": "感谢使用PMail",
|
"tks_smail": "感谢使用Smail",
|
||||||
"guid_desc": "接下来将会指引你进行初始化配置,如果你已有配置,请使用你的配置文件覆盖运行目录的config文件夹。如果你没有配置过,请按照该指引操作。",
|
"guid_desc": "接下来将会指引你进行初始化配置,如果你已有配置,请使用你的配置文件覆盖运行目录的config文件夹。如果你没有配置过,请按照该指引操作。",
|
||||||
"select_db": "数据库选择",
|
"select_db": "数据库选择",
|
||||||
"db_desc": "PMail目前支持MySQL和SQLite3两种数据库,你可根据需要选择。",
|
"db_desc": "Smail目前支持MySQL和SQLite3两种数据库,你可根据需要选择。",
|
||||||
"type": "类型",
|
"type": "类型",
|
||||||
"db_select_ph": "请选择你的数据库",
|
"db_select_ph": "请选择你的数据库",
|
||||||
"mysql_dsn": "MySQL DSN",
|
"mysql_dsn": "MySQL DSN",
|
||||||
@@ -208,7 +208,7 @@ const zhCN = {
|
|||||||
"ssl_auto_dns": "DNS记录",
|
"ssl_auto_dns": "DNS记录",
|
||||||
"ssl_challenge_type": "验证方式",
|
"ssl_challenge_type": "验证方式",
|
||||||
"ssl_manuallyf": "手动配置SSL证书",
|
"ssl_manuallyf": "手动配置SSL证书",
|
||||||
"challenge_typ_desc": "如果PMail直接使用80端口,建议使用HTTP验证方式。",
|
"challenge_typ_desc": "如果Smail直接使用80端口,建议使用HTTP验证方式。",
|
||||||
"wait_desc": "请稍等",
|
"wait_desc": "请稍等",
|
||||||
"dns_challenge_wait": "DNS传播和缓存刷新时间较长,此处可能等待10-30分钟",
|
"dns_challenge_wait": "DNS传播和缓存刷新时间较长,此处可能等待10-30分钟",
|
||||||
"ssl_key_path": "ssl key文件位置",
|
"ssl_key_path": "ssl key文件位置",
|
||||||
@@ -241,7 +241,7 @@ const zhCN = {
|
|||||||
"move": "移动分组",
|
"move": "移动分组",
|
||||||
"del_rule_confirm": "确定要删除吗?",
|
"del_rule_confirm": "确定要删除吗?",
|
||||||
"rule_params": "执行参数",
|
"rule_params": "执行参数",
|
||||||
"autoSSLWarn": "PMail当前未使用80端口启动,如果想要PMail自动管理SSL证书,请将/.well-known/*路由转发到PMail。 详见https://github.com/Jinnrry/PMail/issues/94",
|
"autoSSLWarn": "Smail当前未使用80端口启动,如果想要Smail自动管理SSL证书,请将/.well-known/*路由转发到Smail。 详见https://git.pcux.cn/xuans/Smail/issues/94",
|
||||||
"err_db_dsn_empty": "数据库路径不能为空!",
|
"err_db_dsn_empty": "数据库路径不能为空!",
|
||||||
"modify_pwd_desc": "修改您的账户密码以确保安全。",
|
"modify_pwd_desc": "修改您的账户密码以确保安全。",
|
||||||
"enter_new_pwd": "输入新密码",
|
"enter_new_pwd": "输入新密码",
|
||||||
|
|||||||
@@ -3,7 +3,8 @@
|
|||||||
<div class="login-container">
|
<div class="login-container">
|
||||||
<div class="login-left">
|
<div class="login-left">
|
||||||
<div class="brand-info">
|
<div class="brand-info">
|
||||||
<h1>PMail</h1>
|
<img src="/smail-logo.png" alt="Smail" class="brand-logo-img" />
|
||||||
|
<h1>Smail</h1>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="login-right">
|
<div class="login-right">
|
||||||
@@ -121,6 +122,18 @@ const onSubmit = () => {
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 登录页品牌 logo 图标 */
|
||||||
|
.brand-logo-img {
|
||||||
|
width: 84px;
|
||||||
|
height: 84px;
|
||||||
|
border-radius: 20px;
|
||||||
|
object-fit: contain;
|
||||||
|
background: #000;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
|
||||||
|
animation: pm-rise-in 0.5s var(--pm-ease-out);
|
||||||
|
}
|
||||||
|
|
||||||
.brand-info h1 {
|
.brand-info h1 {
|
||||||
font-size: 56px;
|
font-size: 56px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
@@ -210,6 +223,12 @@ const onSubmit = () => {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
.brand-logo-img {
|
||||||
|
width: 64px;
|
||||||
|
height: 64px;
|
||||||
|
border-radius: 16px;
|
||||||
|
margin-bottom: 18px;
|
||||||
|
}
|
||||||
.brand-info h1 {
|
.brand-info h1 {
|
||||||
font-size: 38px;
|
font-size: 38px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
<div v-if="active === 0" class="ctn">
|
<div v-if="active === 0" class="ctn">
|
||||||
<div class="desc">
|
<div class="desc">
|
||||||
<h2>{{ lang.tks_pmail }}</h2>
|
<h2>{{ lang.tks_smail }}</h2>
|
||||||
<div style="margin-top: 10px;">{{ lang.guid_desc }}</div>
|
<div style="margin-top: 10px;">{{ lang.guid_desc }}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -35,16 +35,16 @@
|
|||||||
|
|
||||||
<el-form-item :label="lang.mysql_dsn" v-if="dbSettings.type === 'mysql'">
|
<el-form-item :label="lang.mysql_dsn" v-if="dbSettings.type === 'mysql'">
|
||||||
<el-input :rows="2" type="textarea" v-model="dbSettings.dsn"
|
<el-input :rows="2" type="textarea" v-model="dbSettings.dsn"
|
||||||
placeholder="root:12345@tcp(127.0.0.1:3306)/pmail?parseTime=True&loc=Local"></el-input>
|
placeholder="root:12345@tcp(127.0.0.1:3306)/smail?parseTime=True&loc=Local"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item :label="lang.pg_dsn" v-if="dbSettings.type === 'postgres'">
|
<el-form-item :label="lang.pg_dsn" v-if="dbSettings.type === 'postgres'">
|
||||||
<el-input :rows="2" type="textarea" v-model="dbSettings.dsn"
|
<el-input :rows="2" type="textarea" v-model="dbSettings.dsn"
|
||||||
placeholder="postgres://postgres:12345@127.0.0.1:5432/pmail?sslmode=disable"></el-input>
|
placeholder="postgres://postgres:12345@127.0.0.1:5432/smail?sslmode=disable"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item :label="lang.sqlite_db_path" v-if="dbSettings.type === 'sqlite'">
|
<el-form-item :label="lang.sqlite_db_path" v-if="dbSettings.type === 'sqlite'">
|
||||||
<el-input v-model="dbSettings.dsn" placeholder="./config/pmail.db"></el-input>
|
<el-input v-model="dbSettings.dsn" placeholder="./config/smail.db"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
@@ -93,7 +93,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item :label="lang.web_domain">
|
<el-form-item :label="lang.web_domain">
|
||||||
<el-input placeholder="pmail.domain.com" v-model="domainSettings.web_domain"></el-input>
|
<el-input placeholder="smail.domain.com" v-model="domainSettings.web_domain"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item :label="lang.multi_domain_setting">
|
<el-form-item :label="lang.multi_domain_setting">
|
||||||
@@ -243,7 +243,7 @@ const adminSettings = reactive({
|
|||||||
|
|
||||||
const dbSettings = reactive({
|
const dbSettings = reactive({
|
||||||
"type": "sqlite",
|
"type": "sqlite",
|
||||||
"dsn": "./config/pmail.db",
|
"dsn": "./config/smail.db",
|
||||||
"lable": ""
|
"lable": ""
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -343,7 +343,7 @@ const getDomainConfig = () => {
|
|||||||
|
|
||||||
const setDbConfig = () => {
|
const setDbConfig = () => {
|
||||||
// 切换数据库类型为sqlite时,数据库路径为空,则使用默认路径
|
// 切换数据库类型为sqlite时,数据库路径为空,则使用默认路径
|
||||||
if (dbSettings.type === "sqlite" && !dbSettings.dsn) dbSettings.dsn = "./config/pmail.db";
|
if (dbSettings.type === "sqlite" && !dbSettings.dsn) dbSettings.dsn = "./config/smail.db";
|
||||||
else if (!dbSettings.dsn) ElMessage({
|
else if (!dbSettings.dsn) ElMessage({
|
||||||
title: "Error",
|
title: "Error",
|
||||||
message: lang.err_db_dsn_empty,
|
message: lang.err_db_dsn_empty,
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -6,7 +6,7 @@
|
|||||||
"sslType": "0",
|
"sslType": "0",
|
||||||
"SSLPrivateKeyPath": "config/ssl/private.key",
|
"SSLPrivateKeyPath": "config/ssl/private.key",
|
||||||
"SSLPublicKeyPath": "config/ssl/public.crt",
|
"SSLPublicKeyPath": "config/ssl/public.crt",
|
||||||
"dbDSN": "./config/pmail.db",
|
"dbDSN": "./config/smail.db",
|
||||||
"dbType": "sqlite",
|
"dbType": "sqlite",
|
||||||
"spamFilterLevel": 2,
|
"spamFilterLevel": 2,
|
||||||
"httpPort": 80,
|
"httpPort": 80,
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"encoding/pem"
|
"encoding/pem"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/Jinnrry/pmail/utils/context"
|
"git.pcux.cn/xuans/Smail/utils/context"
|
||||||
"github.com/Jinnrry/pmail/utils/errors"
|
"git.pcux.cn/xuans/Smail/utils/errors"
|
||||||
"github.com/Jinnrry/pmail/utils/file"
|
"git.pcux.cn/xuans/Smail/utils/file"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@@ -55,8 +55,8 @@ var ROOT_PATH = ""
|
|||||||
func init() {
|
func init() {
|
||||||
envs := os.Environ()
|
envs := os.Environ()
|
||||||
for _, env := range envs {
|
for _, env := range envs {
|
||||||
if strings.HasPrefix(env, "PMail_ROOT=") {
|
if strings.HasPrefix(env, "SMAIL_ROOT=") {
|
||||||
ROOT_PATH = strings.TrimSpace(strings.ReplaceAll(env, "PMail_ROOT=", ""))
|
ROOT_PATH = strings.TrimSpace(strings.ReplaceAll(env, "SMAIL_ROOT=", ""))
|
||||||
if !strings.HasSuffix(ROOT_PATH, "/") {
|
if !strings.HasSuffix(ROOT_PATH, "/") {
|
||||||
ROOT_PATH += "/"
|
ROOT_PATH += "/"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
"sslType": "1",
|
"sslType": "1",
|
||||||
"SSLPrivateKeyPath": "./config/ssl/private.key",
|
"SSLPrivateKeyPath": "./config/ssl/private.key",
|
||||||
"SSLPublicKeyPath": "./config/ssl/public.crt",
|
"SSLPublicKeyPath": "./config/ssl/public.crt",
|
||||||
"dbDSN": "./config/pmail_temp.db",
|
"dbDSN": "./config/smail_temp.db",
|
||||||
"dbType": "sqlite",
|
"dbType": "sqlite",
|
||||||
"httpsEnabled": 2,
|
"httpsEnabled": 2,
|
||||||
"spamFilterLevel": 0,
|
"spamFilterLevel": 0,
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
"sslType": "0",
|
"sslType": "0",
|
||||||
"SSLPrivateKeyPath": "config/ssl/private.key",
|
"SSLPrivateKeyPath": "config/ssl/private.key",
|
||||||
"SSLPublicKeyPath": "config/ssl/public.crt",
|
"SSLPublicKeyPath": "config/ssl/public.crt",
|
||||||
"dbDSN": "root:root@tcp(127.0.0.1:3306)/pmail?parseTime=True&loc=Local",
|
"dbDSN": "root:root@tcp(127.0.0.1:3306)/smail?parseTime=True&loc=Local",
|
||||||
"dbType": "mysql",
|
"dbType": "mysql",
|
||||||
"spamFilterLevel": 1,
|
"spamFilterLevel": 1,
|
||||||
"httpPort": 80,
|
"httpPort": 80,
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ package controllers
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/Jinnrry/pmail/dto/response"
|
"git.pcux.cn/xuans/Smail/dto/response"
|
||||||
"github.com/Jinnrry/pmail/services/attachments"
|
"git.pcux.cn/xuans/Smail/services/attachments"
|
||||||
"github.com/Jinnrry/pmail/utils/context"
|
"git.pcux.cn/xuans/Smail/utils/context"
|
||||||
"github.com/spf13/cast"
|
"github.com/spf13/cast"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package controllers
|
package controllers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Jinnrry/pmail/utils/context"
|
"git.pcux.cn/xuans/Smail/utils/context"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ package email
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/Jinnrry/pmail/dto/response"
|
"git.pcux.cn/xuans/Smail/dto/response"
|
||||||
"github.com/Jinnrry/pmail/services/del_email"
|
"git.pcux.cn/xuans/Smail/services/del_email"
|
||||||
"github.com/Jinnrry/pmail/utils/context"
|
"git.pcux.cn/xuans/Smail/utils/context"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ package email
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/Jinnrry/pmail/dto/response"
|
"git.pcux.cn/xuans/Smail/dto/response"
|
||||||
"github.com/Jinnrry/pmail/services/detail"
|
"git.pcux.cn/xuans/Smail/services/detail"
|
||||||
"github.com/Jinnrry/pmail/utils/context"
|
"git.pcux.cn/xuans/Smail/utils/context"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ package email
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/Jinnrry/pmail/dto"
|
"git.pcux.cn/xuans/Smail/dto"
|
||||||
"github.com/Jinnrry/pmail/dto/parsemail"
|
"git.pcux.cn/xuans/Smail/dto/parsemail"
|
||||||
"github.com/Jinnrry/pmail/dto/response"
|
"git.pcux.cn/xuans/Smail/dto/response"
|
||||||
"github.com/Jinnrry/pmail/services/list"
|
"git.pcux.cn/xuans/Smail/services/list"
|
||||||
"github.com/Jinnrry/pmail/utils/context"
|
"git.pcux.cn/xuans/Smail/utils/context"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"github.com/spf13/cast"
|
"github.com/spf13/cast"
|
||||||
"io"
|
"io"
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ package email
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/Jinnrry/pmail/dto/response"
|
"git.pcux.cn/xuans/Smail/dto/response"
|
||||||
"github.com/Jinnrry/pmail/models"
|
"git.pcux.cn/xuans/Smail/models"
|
||||||
"github.com/Jinnrry/pmail/services/group"
|
"git.pcux.cn/xuans/Smail/services/group"
|
||||||
"github.com/Jinnrry/pmail/utils/context"
|
"git.pcux.cn/xuans/Smail/utils/context"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ package email
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/Jinnrry/pmail/dto/response"
|
"git.pcux.cn/xuans/Smail/dto/response"
|
||||||
"github.com/Jinnrry/pmail/services/detail"
|
"git.pcux.cn/xuans/Smail/services/detail"
|
||||||
"github.com/Jinnrry/pmail/utils/context"
|
"git.pcux.cn/xuans/Smail/utils/context"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|||||||
@@ -4,18 +4,18 @@ import (
|
|||||||
"database/sql"
|
"database/sql"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/Jinnrry/pmail/config"
|
"git.pcux.cn/xuans/Smail/config"
|
||||||
"github.com/Jinnrry/pmail/db"
|
"git.pcux.cn/xuans/Smail/db"
|
||||||
"github.com/Jinnrry/pmail/dto/parsemail"
|
"git.pcux.cn/xuans/Smail/dto/parsemail"
|
||||||
"github.com/Jinnrry/pmail/dto/response"
|
"git.pcux.cn/xuans/Smail/dto/response"
|
||||||
"github.com/Jinnrry/pmail/hooks"
|
"git.pcux.cn/xuans/Smail/hooks"
|
||||||
"github.com/Jinnrry/pmail/hooks/framework"
|
"git.pcux.cn/xuans/Smail/hooks/framework"
|
||||||
"github.com/Jinnrry/pmail/i18n"
|
"git.pcux.cn/xuans/Smail/i18n"
|
||||||
"github.com/Jinnrry/pmail/models"
|
"git.pcux.cn/xuans/Smail/models"
|
||||||
"github.com/Jinnrry/pmail/utils/array"
|
"git.pcux.cn/xuans/Smail/utils/array"
|
||||||
"github.com/Jinnrry/pmail/utils/async"
|
"git.pcux.cn/xuans/Smail/utils/async"
|
||||||
"github.com/Jinnrry/pmail/utils/context"
|
"git.pcux.cn/xuans/Smail/utils/context"
|
||||||
"github.com/Jinnrry/pmail/utils/send"
|
"git.pcux.cn/xuans/Smail/utils/send"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"github.com/spf13/cast"
|
"github.com/spf13/cast"
|
||||||
"io"
|
"io"
|
||||||
|
|||||||
@@ -2,13 +2,13 @@ package controllers
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/Jinnrry/pmail/dto"
|
"git.pcux.cn/xuans/Smail/dto"
|
||||||
"github.com/Jinnrry/pmail/dto/response"
|
"git.pcux.cn/xuans/Smail/dto/response"
|
||||||
"github.com/Jinnrry/pmail/i18n"
|
"git.pcux.cn/xuans/Smail/i18n"
|
||||||
"github.com/Jinnrry/pmail/models"
|
"git.pcux.cn/xuans/Smail/models"
|
||||||
"github.com/Jinnrry/pmail/services/group"
|
"git.pcux.cn/xuans/Smail/services/group"
|
||||||
"github.com/Jinnrry/pmail/utils/array"
|
"git.pcux.cn/xuans/Smail/utils/array"
|
||||||
"github.com/Jinnrry/pmail/utils/context"
|
"git.pcux.cn/xuans/Smail/utils/context"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package controllers
|
package controllers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Jinnrry/pmail/config"
|
"git.pcux.cn/xuans/Smail/config"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
+10
-10
@@ -3,16 +3,16 @@ package controllers
|
|||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/Jinnrry/pmail/config"
|
"git.pcux.cn/xuans/Smail/config"
|
||||||
"github.com/Jinnrry/pmail/db"
|
"git.pcux.cn/xuans/Smail/db"
|
||||||
"github.com/Jinnrry/pmail/dto/response"
|
"git.pcux.cn/xuans/Smail/dto/response"
|
||||||
"github.com/Jinnrry/pmail/i18n"
|
"git.pcux.cn/xuans/Smail/i18n"
|
||||||
"github.com/Jinnrry/pmail/models"
|
"git.pcux.cn/xuans/Smail/models"
|
||||||
"github.com/Jinnrry/pmail/session"
|
"git.pcux.cn/xuans/Smail/session"
|
||||||
"github.com/Jinnrry/pmail/utils/array"
|
"git.pcux.cn/xuans/Smail/utils/array"
|
||||||
"github.com/Jinnrry/pmail/utils/context"
|
"git.pcux.cn/xuans/Smail/utils/context"
|
||||||
"github.com/Jinnrry/pmail/utils/errors"
|
"git.pcux.cn/xuans/Smail/utils/errors"
|
||||||
"github.com/Jinnrry/pmail/utils/password"
|
"git.pcux.cn/xuans/Smail/utils/password"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package controllers
|
package controllers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Jinnrry/pmail/dto/response"
|
"git.pcux.cn/xuans/Smail/dto/response"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package controllers
|
package controllers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Jinnrry/pmail/dto/response"
|
"git.pcux.cn/xuans/Smail/dto/response"
|
||||||
"github.com/Jinnrry/pmail/hooks"
|
"git.pcux.cn/xuans/Smail/hooks"
|
||||||
"github.com/Jinnrry/pmail/utils/context"
|
"git.pcux.cn/xuans/Smail/utils/context"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
|||||||
+10
-10
@@ -2,16 +2,16 @@ package controllers
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/Jinnrry/pmail/db"
|
"git.pcux.cn/xuans/Smail/db"
|
||||||
"github.com/Jinnrry/pmail/dto"
|
"git.pcux.cn/xuans/Smail/dto"
|
||||||
"github.com/Jinnrry/pmail/dto/response"
|
"git.pcux.cn/xuans/Smail/dto/response"
|
||||||
"github.com/Jinnrry/pmail/i18n"
|
"git.pcux.cn/xuans/Smail/i18n"
|
||||||
"github.com/Jinnrry/pmail/models"
|
"git.pcux.cn/xuans/Smail/models"
|
||||||
"github.com/Jinnrry/pmail/services/rule"
|
"git.pcux.cn/xuans/Smail/services/rule"
|
||||||
"github.com/Jinnrry/pmail/utils/address"
|
"git.pcux.cn/xuans/Smail/utils/address"
|
||||||
"github.com/Jinnrry/pmail/utils/array"
|
"git.pcux.cn/xuans/Smail/utils/array"
|
||||||
"github.com/Jinnrry/pmail/utils/context"
|
"git.pcux.cn/xuans/Smail/utils/context"
|
||||||
"github.com/Jinnrry/pmail/utils/errors"
|
"git.pcux.cn/xuans/Smail/utils/errors"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ package controllers
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/Jinnrry/pmail/db"
|
"git.pcux.cn/xuans/Smail/db"
|
||||||
"github.com/Jinnrry/pmail/dto/response"
|
"git.pcux.cn/xuans/Smail/dto/response"
|
||||||
"github.com/Jinnrry/pmail/i18n"
|
"git.pcux.cn/xuans/Smail/i18n"
|
||||||
"github.com/Jinnrry/pmail/utils/context"
|
"git.pcux.cn/xuans/Smail/utils/context"
|
||||||
"github.com/Jinnrry/pmail/utils/password"
|
"git.pcux.cn/xuans/Smail/utils/password"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ package controllers
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/Jinnrry/pmail/config"
|
"git.pcux.cn/xuans/Smail/config"
|
||||||
"github.com/Jinnrry/pmail/dto/response"
|
"git.pcux.cn/xuans/Smail/dto/response"
|
||||||
"github.com/Jinnrry/pmail/services/setup"
|
"git.pcux.cn/xuans/Smail/services/setup"
|
||||||
"github.com/Jinnrry/pmail/services/setup/ssl"
|
"git.pcux.cn/xuans/Smail/services/setup/ssl"
|
||||||
"github.com/Jinnrry/pmail/utils/context"
|
"git.pcux.cn/xuans/Smail/utils/context"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"github.com/spf13/cast"
|
"github.com/spf13/cast"
|
||||||
"io"
|
"io"
|
||||||
|
|||||||
@@ -2,13 +2,13 @@ package controllers
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/Jinnrry/pmail/config"
|
"git.pcux.cn/xuans/Smail/config"
|
||||||
"github.com/Jinnrry/pmail/db"
|
"git.pcux.cn/xuans/Smail/db"
|
||||||
"github.com/Jinnrry/pmail/dto/response"
|
"git.pcux.cn/xuans/Smail/dto/response"
|
||||||
"github.com/Jinnrry/pmail/models"
|
"git.pcux.cn/xuans/Smail/models"
|
||||||
"github.com/Jinnrry/pmail/utils/array"
|
"git.pcux.cn/xuans/Smail/utils/array"
|
||||||
"github.com/Jinnrry/pmail/utils/context"
|
"git.pcux.cn/xuans/Smail/utils/context"
|
||||||
"github.com/Jinnrry/pmail/utils/password"
|
"git.pcux.cn/xuans/Smail/utils/password"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"github.com/spf13/cast"
|
"github.com/spf13/cast"
|
||||||
"io"
|
"io"
|
||||||
|
|||||||
+4
-4
@@ -4,10 +4,10 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Jinnrry/pmail/config"
|
"git.pcux.cn/xuans/Smail/config"
|
||||||
"github.com/Jinnrry/pmail/models"
|
"git.pcux.cn/xuans/Smail/models"
|
||||||
"github.com/Jinnrry/pmail/utils/context"
|
"git.pcux.cn/xuans/Smail/utils/context"
|
||||||
"github.com/Jinnrry/pmail/utils/errors"
|
"git.pcux.cn/xuans/Smail/utils/errors"
|
||||||
_ "github.com/go-sql-driver/mysql"
|
_ "github.com/go-sql-driver/mysql"
|
||||||
_ "github.com/lib/pq"
|
_ "github.com/lib/pq"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|||||||
+12
-12
@@ -28,27 +28,27 @@ func TestSQLiteDSNOptions(t *testing.T) {
|
|||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "plain filename gets default timeout",
|
name: "plain filename gets default timeout",
|
||||||
dsn: "/tmp/pmail.db",
|
dsn: "/tmp/smail.db",
|
||||||
wantBusyTimeout: "busy_timeout(1000)",
|
wantBusyTimeout: "busy_timeout(1000)",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "timeout at cap is preserved byte for byte",
|
name: "timeout at cap is preserved byte for byte",
|
||||||
dsn: "file:pmail.db?_txlock=deferred&_pragma=BUSY_TIMEOUT%20%3D%201000&mode=memory",
|
dsn: "file:smail.db?_txlock=deferred&_pragma=BUSY_TIMEOUT%20%3D%201000&mode=memory",
|
||||||
wantDSN: "file:pmail.db?_txlock=deferred&_pragma=BUSY_TIMEOUT%20%3D%201000&mode=memory",
|
wantDSN: "file:smail.db?_txlock=deferred&_pragma=BUSY_TIMEOUT%20%3D%201000&mode=memory",
|
||||||
wantBusyTimeout: "BUSY_TIMEOUT = 1000",
|
wantBusyTimeout: "BUSY_TIMEOUT = 1000",
|
||||||
wantTxLock: "deferred",
|
wantTxLock: "deferred",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "explicit timeout is capped and other options are preserved",
|
name: "explicit timeout is capped and other options are preserved",
|
||||||
dsn: "file:pmail.db?mode=memory&_pragma=journal_mode(WAL)&_pragma=busy_timeout%20%3D%20600000&_txlock=deferred",
|
dsn: "file:smail.db?mode=memory&_pragma=journal_mode(WAL)&_pragma=busy_timeout%20%3D%20600000&_txlock=deferred",
|
||||||
wantBusyTimeout: "busy_timeout(1000)",
|
wantBusyTimeout: "busy_timeout(1000)",
|
||||||
wantJournalMode: "journal_mode(WAL)",
|
wantJournalMode: "journal_mode(WAL)",
|
||||||
wantTxLock: "deferred",
|
wantTxLock: "deferred",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "negative timeout is preserved byte for byte",
|
name: "negative timeout is preserved byte for byte",
|
||||||
dsn: "file:pmail.db?cache=shared&_pragma=%20busy_timeout%20%28%20-1%20%29%20",
|
dsn: "file:smail.db?cache=shared&_pragma=%20busy_timeout%20%28%20-1%20%29%20",
|
||||||
wantDSN: "file:pmail.db?cache=shared&_pragma=%20busy_timeout%20%28%20-1%20%29%20",
|
wantDSN: "file:smail.db?cache=shared&_pragma=%20busy_timeout%20%28%20-1%20%29%20",
|
||||||
wantBusyTimeout: " busy_timeout ( -1 ) ",
|
wantBusyTimeout: " busy_timeout ( -1 ) ",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -94,23 +94,23 @@ func TestSQLiteDSNRejectsInvalidBusyTimeout(t *testing.T) {
|
|||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "duplicate timeout pragmas",
|
name: "duplicate timeout pragmas",
|
||||||
dsn: "file:pmail.db?_pragma=busy_timeout(10)&_pragma=BUSY_TIMEOUT%20%3D%2020",
|
dsn: "file:smail.db?_pragma=busy_timeout(10)&_pragma=BUSY_TIMEOUT%20%3D%2020",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "missing timeout value",
|
name: "missing timeout value",
|
||||||
dsn: "file:pmail.db?_pragma=busy_timeout",
|
dsn: "file:smail.db?_pragma=busy_timeout",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "nonnumeric timeout",
|
name: "nonnumeric timeout",
|
||||||
dsn: "file:pmail.db?_pragma=busy_timeout(forever)",
|
dsn: "file:smail.db?_pragma=busy_timeout(forever)",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "timeout with trailing junk",
|
name: "timeout with trailing junk",
|
||||||
dsn: "file:pmail.db?_pragma=busy_timeout(10)%20milliseconds",
|
dsn: "file:smail.db?_pragma=busy_timeout(10)%20milliseconds",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "overflowing timeout",
|
name: "overflowing timeout",
|
||||||
dsn: "file:pmail.db?_pragma=busy_timeout(9223372036854775808)",
|
dsn: "file:smail.db?_pragma=busy_timeout(9223372036854775808)",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,7 +135,7 @@ func TestSQLiteDSNWarnsWhenBusyTimeoutIsCapped(t *testing.T) {
|
|||||||
logger.SetLevel(originalLevel)
|
logger.SetLevel(originalLevel)
|
||||||
})
|
})
|
||||||
|
|
||||||
if _, err := sqliteDSNWithReliabilityOptions("file:pmail.db?_pragma=busy_timeout(600000)"); err != nil {
|
if _, err := sqliteDSNWithReliabilityOptions("file:smail.db?_pragma=busy_timeout(600000)"); err != nil {
|
||||||
t.Fatalf("sqliteDSNWithReliabilityOptions() error = %v", err)
|
t.Fatalf("sqliteDSNWithReliabilityOptions() error = %v", err)
|
||||||
}
|
}
|
||||||
for _, want := range []string{"600000ms", "1000ms"} {
|
for _, want := range []string{"600000ms", "1000ms"} {
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import (
|
|||||||
"crypto/x509"
|
"crypto/x509"
|
||||||
"encoding/pem"
|
"encoding/pem"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/Jinnrry/pmail/config"
|
"git.pcux.cn/xuans/Smail/config"
|
||||||
"github.com/Jinnrry/pmail/utils/consts"
|
"git.pcux.cn/xuans/Smail/utils/consts"
|
||||||
"github.com/Jinnrry/pmail/utils/context"
|
"git.pcux.cn/xuans/Smail/utils/context"
|
||||||
"github.com/emersion/go-msgauth/dkim"
|
"github.com/emersion/go-msgauth/dkim"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"golang.org/x/crypto/ed25519"
|
"golang.org/x/crypto/ed25519"
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Jinnrry/pmail/config"
|
"git.pcux.cn/xuans/Smail/config"
|
||||||
"github.com/Jinnrry/pmail/models"
|
"git.pcux.cn/xuans/Smail/models"
|
||||||
"github.com/Jinnrry/pmail/utils/context"
|
"git.pcux.cn/xuans/Smail/utils/context"
|
||||||
"github.com/emersion/go-message"
|
"github.com/emersion/go-message"
|
||||||
_ "github.com/emersion/go-message/charset"
|
_ "github.com/emersion/go-message/charset"
|
||||||
"github.com/emersion/go-message/mail"
|
"github.com/emersion/go-message/mail"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package parsemail
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/Jinnrry/pmail/models"
|
"git.pcux.cn/xuans/Smail/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestNewEmailAuthentication(t *testing.T) {
|
func TestNewEmailAuthentication(t *testing.T) {
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/Jinnrry/pmail/config"
|
"git.pcux.cn/xuans/Smail/config"
|
||||||
"github.com/Jinnrry/pmail/models"
|
"git.pcux.cn/xuans/Smail/models"
|
||||||
"github.com/Jinnrry/pmail/utils/context"
|
"git.pcux.cn/xuans/Smail/utils/context"
|
||||||
"github.com/emersion/go-message/mail"
|
"github.com/emersion/go-message/mail"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Jinnrry/pmail/models"
|
"git.pcux.cn/xuans/Smail/models"
|
||||||
"github.com/emersion/go-message"
|
"github.com/emersion/go-message"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package response
|
package response
|
||||||
|
|
||||||
import "github.com/Jinnrry/pmail/models"
|
import "git.pcux.cn/xuans/Smail/models"
|
||||||
|
|
||||||
type EmailResponseData struct {
|
type EmailResponseData struct {
|
||||||
models.Email `xorm:"extends"`
|
models.Email `xorm:"extends"`
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@ package dto
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/Jinnrry/pmail/models"
|
"git.pcux.cn/xuans/Smail/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
type RuleType int
|
type RuleType int
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
module github.com/Jinnrry/pmail
|
module git.pcux.cn/xuans/Smail
|
||||||
|
|
||||||
go 1.24.0
|
go 1.24.0
|
||||||
|
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ import (
|
|||||||
oContext "context"
|
oContext "context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/Jinnrry/pmail/dto/parsemail"
|
"git.pcux.cn/xuans/Smail/dto/parsemail"
|
||||||
"github.com/Jinnrry/pmail/hooks/framework"
|
"git.pcux.cn/xuans/Smail/hooks/framework"
|
||||||
"github.com/Jinnrry/pmail/models"
|
"git.pcux.cn/xuans/Smail/models"
|
||||||
"github.com/Jinnrry/pmail/utils/context"
|
"git.pcux.cn/xuans/Smail/utils/context"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"io"
|
"io"
|
||||||
"net"
|
"net"
|
||||||
@@ -220,7 +220,7 @@ func Init(serverVersion string) {
|
|||||||
|
|
||||||
os.Remove(socketPath)
|
os.Remove(socketPath)
|
||||||
|
|
||||||
//socketPath = "/PMail/server/hooks/spam_block/1555.socket" //debug
|
//socketPath = "/Smail/server/hooks/spam_block/1555.socket" //debug
|
||||||
|
|
||||||
log.Infof("[%s] Plugin Load", info.Name())
|
log.Infof("[%s] Plugin Load", info.Name())
|
||||||
p, err := os.StartProcess(path, []string{
|
p, err := os.StartProcess(path, []string{
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/Jinnrry/pmail/dto/parsemail"
|
"git.pcux.cn/xuans/Smail/dto/parsemail"
|
||||||
"github.com/Jinnrry/pmail/hooks/framework"
|
"git.pcux.cn/xuans/Smail/hooks/framework"
|
||||||
"github.com/Jinnrry/pmail/models"
|
"git.pcux.cn/xuans/Smail/models"
|
||||||
"github.com/Jinnrry/pmail/utils/context"
|
"git.pcux.cn/xuans/Smail/utils/context"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Debug struct {
|
type Debug struct {
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/Jinnrry/pmail/dto/parsemail"
|
"git.pcux.cn/xuans/Smail/dto/parsemail"
|
||||||
"github.com/Jinnrry/pmail/models"
|
"git.pcux.cn/xuans/Smail/models"
|
||||||
"github.com/Jinnrry/pmail/utils/context"
|
"git.pcux.cn/xuans/Smail/utils/context"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"io"
|
"io"
|
||||||
"net"
|
"net"
|
||||||
@@ -34,7 +34,7 @@ type EmailHook interface {
|
|||||||
SettingsHtml(ctx *context.Context, url string, requestData string) string
|
SettingsHtml(ctx *context.Context, url string, requestData string) string
|
||||||
}
|
}
|
||||||
|
|
||||||
// HookDTO PMail 主程序和插件通信的结构体
|
// HookDTO Smail 主程序和插件通信的结构体
|
||||||
type HookDTO struct {
|
type HookDTO struct {
|
||||||
ServerVersion string // 服务端程序版本
|
ServerVersion string // 服务端程序版本
|
||||||
Ctx *context.Context // 上下文
|
Ctx *context.Context // 上下文
|
||||||
@@ -216,7 +216,7 @@ func (p *Plugin) Run() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getExePath() string {
|
func getExePath() string {
|
||||||
//return "/PMail/server/hooks/spam_block" //debug socket path
|
//return "/Smail/server/hooks/spam_block" //debug socket path
|
||||||
|
|
||||||
ex, err := os.Executable()
|
ex, err := os.Executable()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/Jinnrry/pmail/dto/parsemail"
|
"git.pcux.cn/xuans/Smail/dto/parsemail"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestHookDTOIncludesEmailAuthentication(t *testing.T) {
|
func TestHookDTOIncludesEmailAuthentication(t *testing.T) {
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ Request的形式提交机器学习的各类样本数据。
|
|||||||
|
|
||||||
你可以给testData和trainData这两个文件夹下面的csv文件提交PR,CSV文件每行的第一个数字表示数据类型,0表示正常邮件,1表示广告邮件,2表示诈骗邮件。
|
你可以给testData和trainData这两个文件夹下面的csv文件提交PR,CSV文件每行的第一个数字表示数据类型,0表示正常邮件,1表示广告邮件,2表示诈骗邮件。
|
||||||
|
|
||||||
你可以使用export.go这个脚本或者从Release中下载[email_export工具](https://github.com/Jinnrry/PMail/releases/tag/v2.6.1)导出你全部的邮件数据,过滤掉隐私内容并且标记好分类后提交上来。
|
你可以使用export.go这个脚本或者从Release中下载[email_export工具](https://git.pcux.cn/xuans/Smail/releases/tag/v2.6.1)导出你全部的邮件数据,过滤掉隐私内容并且标记好分类后提交上来。
|
||||||
|
|
||||||
# 如何运行
|
# 如何运行
|
||||||
|
|
||||||
1、下载[emotion_model.zip](https://github.com/Jinnrry/PMail/releases/tag/v2.8.3)或者自己训练模型
|
1、下载[emotion_model.zip](https://git.pcux.cn/xuans/Smail/releases/tag/v2.8.3)或者自己训练模型
|
||||||
|
|
||||||
2、使用docker运行tensorflow模型
|
2、使用docker运行tensorflow模型
|
||||||
`docker run -d -p 127.0.0.1:8501:8501 \
|
`docker run -d -p 127.0.0.1:8501:8501 \
|
||||||
@@ -50,13 +50,13 @@ curl -X POST http://localhost:8501/v1/models/emotion_model:predict -d '{
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
4、将spam_block插件移动到pmail插件目录
|
4、将spam_block插件移动到Smail插件目录
|
||||||
|
|
||||||
5、设置插件
|
5、设置插件
|
||||||
|
|
||||||
PMail后台->右上角设置按钮->插件设置->SpamBlock
|
Smail后台->右上角设置按钮->插件设置->SpamBlock
|
||||||
|
|
||||||
接口地址表示模型api访问地址,如果你是使用Docker部署,PMail和tensorflow/serving容器需要设置为相同网络才能通信,并且需要把localhost替换为tensorflow/serving的容器名称
|
接口地址表示模型api访问地址,如果你是使用Docker部署,Smail和tensorflow/serving容器需要设置为相同网络才能通信,并且需要把localhost替换为tensorflow/serving的容器名称
|
||||||
|
|
||||||
# 模型效果
|
# 模型效果
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/Jinnrry/pmail/config"
|
"git.pcux.cn/xuans/Smail/config"
|
||||||
"github.com/Jinnrry/pmail/db"
|
"git.pcux.cn/xuans/Smail/db"
|
||||||
"github.com/Jinnrry/pmail/hooks/spam_block/tools"
|
"git.pcux.cn/xuans/Smail/hooks/spam_block/tools"
|
||||||
"github.com/Jinnrry/pmail/models"
|
"git.pcux.cn/xuans/Smail/models"
|
||||||
"github.com/spf13/cast"
|
"github.com/spf13/cast"
|
||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -4,11 +4,11 @@ import (
|
|||||||
_ "embed"
|
_ "embed"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/Jinnrry/pmail/dto/parsemail"
|
"git.pcux.cn/xuans/Smail/dto/parsemail"
|
||||||
"github.com/Jinnrry/pmail/hooks/framework"
|
"git.pcux.cn/xuans/Smail/hooks/framework"
|
||||||
"github.com/Jinnrry/pmail/hooks/spam_block/tools"
|
"git.pcux.cn/xuans/Smail/hooks/spam_block/tools"
|
||||||
"github.com/Jinnrry/pmail/models"
|
"git.pcux.cn/xuans/Smail/models"
|
||||||
"github.com/Jinnrry/pmail/utils/context"
|
"git.pcux.cn/xuans/Smail/utils/context"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"github.com/spf13/cast"
|
"github.com/spf13/cast"
|
||||||
"io"
|
"io"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/Jinnrry/pmail/utils/context"
|
"git.pcux.cn/xuans/Smail/utils/context"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestSettingsHtmlRejectsNonAdminSave(t *testing.T) {
|
func TestSettingsHtmlRejectsNonAdminSave(t *testing.T) {
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ package main
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/Jinnrry/pmail/config"
|
"git.pcux.cn/xuans/Smail/config"
|
||||||
"github.com/Jinnrry/pmail/dto/parsemail"
|
"git.pcux.cn/xuans/Smail/dto/parsemail"
|
||||||
"github.com/Jinnrry/pmail/hooks/framework"
|
"git.pcux.cn/xuans/Smail/hooks/framework"
|
||||||
"github.com/Jinnrry/pmail/models"
|
"git.pcux.cn/xuans/Smail/models"
|
||||||
"github.com/Jinnrry/pmail/utils/context"
|
"git.pcux.cn/xuans/Smail/utils/context"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"github.com/spf13/cast"
|
"github.com/spf13/cast"
|
||||||
"io"
|
"io"
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package cron_server
|
package cron_server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Jinnrry/pmail/config"
|
"git.pcux.cn/xuans/Smail/config"
|
||||||
"github.com/Jinnrry/pmail/services/setup/ssl"
|
"git.pcux.cn/xuans/Smail/services/setup/ssl"
|
||||||
"github.com/Jinnrry/pmail/signal"
|
"git.pcux.cn/xuans/Smail/signal"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"time"
|
"time"
|
||||||
// 新增:HTTP 就绪探测
|
// 新增:HTTP 就绪探测
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ package http_server
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/Jinnrry/pmail/config"
|
"git.pcux.cn/xuans/Smail/config"
|
||||||
"github.com/Jinnrry/pmail/controllers"
|
"git.pcux.cn/xuans/Smail/controllers"
|
||||||
"github.com/Jinnrry/pmail/controllers/email"
|
"git.pcux.cn/xuans/Smail/controllers/email"
|
||||||
"github.com/Jinnrry/pmail/session"
|
"git.pcux.cn/xuans/Smail/session"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|||||||
@@ -5,16 +5,16 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/Jinnrry/pmail/config"
|
"git.pcux.cn/xuans/Smail/config"
|
||||||
"github.com/Jinnrry/pmail/controllers"
|
"git.pcux.cn/xuans/Smail/controllers"
|
||||||
"github.com/Jinnrry/pmail/db"
|
"git.pcux.cn/xuans/Smail/db"
|
||||||
"github.com/Jinnrry/pmail/dto/response"
|
"git.pcux.cn/xuans/Smail/dto/response"
|
||||||
"github.com/Jinnrry/pmail/i18n"
|
"git.pcux.cn/xuans/Smail/i18n"
|
||||||
"github.com/Jinnrry/pmail/models"
|
"git.pcux.cn/xuans/Smail/models"
|
||||||
"github.com/Jinnrry/pmail/session"
|
"git.pcux.cn/xuans/Smail/session"
|
||||||
"github.com/Jinnrry/pmail/utils/context"
|
"git.pcux.cn/xuans/Smail/utils/context"
|
||||||
"github.com/Jinnrry/pmail/utils/id"
|
"git.pcux.cn/xuans/Smail/utils/id"
|
||||||
"github.com/Jinnrry/pmail/utils/password"
|
"git.pcux.cn/xuans/Smail/utils/password"
|
||||||
olog "log"
|
olog "log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/Jinnrry/pmail/config"
|
"git.pcux.cn/xuans/Smail/config"
|
||||||
"github.com/Jinnrry/pmail/controllers"
|
"git.pcux.cn/xuans/Smail/controllers"
|
||||||
"github.com/Jinnrry/pmail/utils/ip"
|
"git.pcux.cn/xuans/Smail/utils/ip"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"github.com/spf13/cast"
|
"github.com/spf13/cast"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package imap_server
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"github.com/Jinnrry/pmail/config"
|
"git.pcux.cn/xuans/Smail/config"
|
||||||
"github.com/emersion/go-imap/v2"
|
"github.com/emersion/go-imap/v2"
|
||||||
"github.com/emersion/go-imap/v2/imapserver"
|
"github.com/emersion/go-imap/v2/imapserver"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ package imap_server
|
|||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"github.com/Jinnrry/pmail/config"
|
"git.pcux.cn/xuans/Smail/config"
|
||||||
"github.com/Jinnrry/pmail/db"
|
"git.pcux.cn/xuans/Smail/db"
|
||||||
"github.com/Jinnrry/pmail/models"
|
"git.pcux.cn/xuans/Smail/models"
|
||||||
"github.com/Jinnrry/pmail/utils/array"
|
"git.pcux.cn/xuans/Smail/utils/array"
|
||||||
pcontext "github.com/Jinnrry/pmail/utils/context"
|
pcontext "git.pcux.cn/xuans/Smail/utils/context"
|
||||||
"github.com/Jinnrry/pmail/utils/password"
|
"git.pcux.cn/xuans/Smail/utils/password"
|
||||||
"github.com/emersion/go-imap/v2"
|
"github.com/emersion/go-imap/v2"
|
||||||
"github.com/emersion/go-imap/v2/imapclient"
|
"github.com/emersion/go-imap/v2/imapclient"
|
||||||
"github.com/emersion/go-message/charset"
|
"github.com/emersion/go-message/charset"
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package imap_server
|
package imap_server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Jinnrry/pmail/utils/context"
|
"git.pcux.cn/xuans/Smail/utils/context"
|
||||||
"github.com/Jinnrry/pmail/utils/id"
|
"git.pcux.cn/xuans/Smail/utils/id"
|
||||||
"github.com/emersion/go-imap/v2"
|
"github.com/emersion/go-imap/v2"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"sync"
|
"sync"
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
package imap_server
|
package imap_server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Jinnrry/pmail/consts"
|
"git.pcux.cn/xuans/Smail/consts"
|
||||||
"github.com/Jinnrry/pmail/db"
|
"git.pcux.cn/xuans/Smail/db"
|
||||||
"github.com/Jinnrry/pmail/dto/response"
|
"git.pcux.cn/xuans/Smail/dto/response"
|
||||||
"github.com/Jinnrry/pmail/models"
|
"git.pcux.cn/xuans/Smail/models"
|
||||||
"github.com/Jinnrry/pmail/services/group"
|
"git.pcux.cn/xuans/Smail/services/group"
|
||||||
"github.com/Jinnrry/pmail/services/list"
|
"git.pcux.cn/xuans/Smail/services/list"
|
||||||
"github.com/Jinnrry/pmail/utils/context"
|
"git.pcux.cn/xuans/Smail/utils/context"
|
||||||
"github.com/emersion/go-imap/v2"
|
"github.com/emersion/go-imap/v2"
|
||||||
"github.com/spf13/cast"
|
"github.com/spf13/cast"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package imap_server
|
package imap_server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Jinnrry/pmail/services/group"
|
"git.pcux.cn/xuans/Smail/services/group"
|
||||||
"github.com/emersion/go-imap/v2"
|
"github.com/emersion/go-imap/v2"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package imap_server
|
package imap_server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Jinnrry/pmail/services/group"
|
"git.pcux.cn/xuans/Smail/services/group"
|
||||||
"github.com/emersion/go-imap/v2"
|
"github.com/emersion/go-imap/v2"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package imap_server
|
package imap_server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Jinnrry/pmail/services/del_email"
|
"git.pcux.cn/xuans/Smail/services/del_email"
|
||||||
"github.com/emersion/go-imap/v2"
|
"github.com/emersion/go-imap/v2"
|
||||||
"github.com/emersion/go-imap/v2/imapserver"
|
"github.com/emersion/go-imap/v2/imapserver"
|
||||||
"github.com/spf13/cast"
|
"github.com/spf13/cast"
|
||||||
|
|||||||
@@ -7,12 +7,12 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Jinnrry/pmail/config"
|
"git.pcux.cn/xuans/Smail/config"
|
||||||
"github.com/Jinnrry/pmail/dto/parsemail"
|
"git.pcux.cn/xuans/Smail/dto/parsemail"
|
||||||
"github.com/Jinnrry/pmail/dto/response"
|
"git.pcux.cn/xuans/Smail/dto/response"
|
||||||
"github.com/Jinnrry/pmail/services/detail"
|
"git.pcux.cn/xuans/Smail/services/detail"
|
||||||
"github.com/Jinnrry/pmail/services/list"
|
"git.pcux.cn/xuans/Smail/services/list"
|
||||||
"github.com/Jinnrry/pmail/utils/context"
|
"git.pcux.cn/xuans/Smail/utils/context"
|
||||||
"github.com/emersion/go-imap/v2"
|
"github.com/emersion/go-imap/v2"
|
||||||
"github.com/emersion/go-imap/v2/imapserver"
|
"github.com/emersion/go-imap/v2/imapserver"
|
||||||
"github.com/spf13/cast"
|
"github.com/spf13/cast"
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package imap_server
|
package imap_server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Jinnrry/pmail/models"
|
"git.pcux.cn/xuans/Smail/models"
|
||||||
"github.com/Jinnrry/pmail/services/group"
|
"git.pcux.cn/xuans/Smail/services/group"
|
||||||
"github.com/Jinnrry/pmail/utils/context"
|
"git.pcux.cn/xuans/Smail/utils/context"
|
||||||
"github.com/emersion/go-imap/v2/imapserver"
|
"github.com/emersion/go-imap/v2/imapserver"
|
||||||
"github.com/spf13/cast"
|
"github.com/spf13/cast"
|
||||||
"sync"
|
"sync"
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package imap_server
|
package imap_server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Jinnrry/pmail/db"
|
"git.pcux.cn/xuans/Smail/db"
|
||||||
"github.com/Jinnrry/pmail/models"
|
"git.pcux.cn/xuans/Smail/models"
|
||||||
"github.com/Jinnrry/pmail/utils/context"
|
"git.pcux.cn/xuans/Smail/utils/context"
|
||||||
"github.com/emersion/go-imap/v2"
|
"github.com/emersion/go-imap/v2"
|
||||||
"github.com/emersion/go-imap/v2/imapserver"
|
"github.com/emersion/go-imap/v2/imapserver"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
@@ -17,7 +17,7 @@ func matchGroup(ctx *context.Context, w *imapserver.ListWriter, basePath, patter
|
|||||||
//w.WriteList(&imap.ListData{
|
//w.WriteList(&imap.ListData{
|
||||||
// Attrs: []imap.MailboxAttr{imap.MailboxAttrNoSelect, imap.MailboxAttrHasChildren},
|
// Attrs: []imap.MailboxAttr{imap.MailboxAttrNoSelect, imap.MailboxAttrHasChildren},
|
||||||
// Delim: '/',
|
// Delim: '/',
|
||||||
// Mailbox: "[PMail]",
|
// Mailbox: "[Smail]",
|
||||||
//})
|
//})
|
||||||
w.WriteList(&imap.ListData{
|
w.WriteList(&imap.ListData{
|
||||||
Attrs: []imap.MailboxAttr{imap.MailboxAttrHasNoChildren},
|
Attrs: []imap.MailboxAttr{imap.MailboxAttrHasNoChildren},
|
||||||
@@ -95,7 +95,7 @@ func (s *serverSession) List(w *imapserver.ListWriter, ref string, patterns []st
|
|||||||
w.WriteList(&imap.ListData{
|
w.WriteList(&imap.ListData{
|
||||||
Attrs: []imap.MailboxAttr{imap.MailboxAttrNoSelect, imap.MailboxAttrHasChildren},
|
Attrs: []imap.MailboxAttr{imap.MailboxAttrNoSelect, imap.MailboxAttrHasChildren},
|
||||||
Delim: '/',
|
Delim: '/',
|
||||||
Mailbox: "[PMail]",
|
Mailbox: "[Smail]",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
for _, pattern := range patterns {
|
for _, pattern := range patterns {
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ package imap_server
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"github.com/Jinnrry/pmail/db"
|
"git.pcux.cn/xuans/Smail/db"
|
||||||
"github.com/Jinnrry/pmail/models"
|
"git.pcux.cn/xuans/Smail/models"
|
||||||
"github.com/Jinnrry/pmail/utils/errors"
|
"git.pcux.cn/xuans/Smail/utils/errors"
|
||||||
"github.com/Jinnrry/pmail/utils/password"
|
"git.pcux.cn/xuans/Smail/utils/password"
|
||||||
"github.com/emersion/go-imap/v2"
|
"github.com/emersion/go-imap/v2"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"strings"
|
"strings"
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package imap_server
|
package imap_server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Jinnrry/pmail/dto/response"
|
"git.pcux.cn/xuans/Smail/dto/response"
|
||||||
"github.com/Jinnrry/pmail/services/group"
|
"git.pcux.cn/xuans/Smail/services/group"
|
||||||
"github.com/Jinnrry/pmail/services/list"
|
"git.pcux.cn/xuans/Smail/services/list"
|
||||||
"github.com/Jinnrry/pmail/utils/context"
|
"git.pcux.cn/xuans/Smail/utils/context"
|
||||||
"github.com/emersion/go-imap/v2"
|
"github.com/emersion/go-imap/v2"
|
||||||
"github.com/emersion/go-imap/v2/imapserver"
|
"github.com/emersion/go-imap/v2/imapserver"
|
||||||
"github.com/spf13/cast"
|
"github.com/spf13/cast"
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package imap_server
|
package imap_server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Jinnrry/pmail/db"
|
"git.pcux.cn/xuans/Smail/db"
|
||||||
"github.com/Jinnrry/pmail/models"
|
"git.pcux.cn/xuans/Smail/models"
|
||||||
"github.com/emersion/go-imap/v2/imapserver"
|
"github.com/emersion/go-imap/v2/imapserver"
|
||||||
"github.com/spf13/cast"
|
"github.com/spf13/cast"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package imap_server
|
package imap_server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Jinnrry/pmail/services/group"
|
"git.pcux.cn/xuans/Smail/services/group"
|
||||||
"github.com/emersion/go-imap/v2"
|
"github.com/emersion/go-imap/v2"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package imap_server
|
package imap_server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Jinnrry/pmail/services/list"
|
"git.pcux.cn/xuans/Smail/services/list"
|
||||||
"github.com/emersion/go-imap/v2"
|
"github.com/emersion/go-imap/v2"
|
||||||
"github.com/emersion/go-imap/v2/imapserver"
|
"github.com/emersion/go-imap/v2/imapserver"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package imap_server
|
package imap_server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Jinnrry/pmail/services/group"
|
"git.pcux.cn/xuans/Smail/services/group"
|
||||||
"github.com/emersion/go-imap/v2"
|
"github.com/emersion/go-imap/v2"
|
||||||
"github.com/spf13/cast"
|
"github.com/spf13/cast"
|
||||||
"strings"
|
"strings"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package imap_server
|
package imap_server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Jinnrry/pmail/services/group"
|
"git.pcux.cn/xuans/Smail/services/group"
|
||||||
"github.com/emersion/go-imap/v2"
|
"github.com/emersion/go-imap/v2"
|
||||||
"github.com/spf13/cast"
|
"github.com/spf13/cast"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package imap_server
|
package imap_server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Jinnrry/pmail/dto/response"
|
"git.pcux.cn/xuans/Smail/dto/response"
|
||||||
"github.com/Jinnrry/pmail/services/del_email"
|
"git.pcux.cn/xuans/Smail/services/del_email"
|
||||||
"github.com/Jinnrry/pmail/services/detail"
|
"git.pcux.cn/xuans/Smail/services/detail"
|
||||||
"github.com/Jinnrry/pmail/services/list"
|
"git.pcux.cn/xuans/Smail/services/list"
|
||||||
"github.com/Jinnrry/pmail/utils/array"
|
"git.pcux.cn/xuans/Smail/utils/array"
|
||||||
"github.com/emersion/go-imap/v2"
|
"github.com/emersion/go-imap/v2"
|
||||||
"github.com/emersion/go-imap/v2/imapserver"
|
"github.com/emersion/go-imap/v2/imapserver"
|
||||||
"github.com/spf13/cast"
|
"github.com/spf13/cast"
|
||||||
|
|||||||
@@ -4,19 +4,19 @@ import (
|
|||||||
"database/sql"
|
"database/sql"
|
||||||
errors2 "errors"
|
errors2 "errors"
|
||||||
"github.com/Jinnrry/gopop"
|
"github.com/Jinnrry/gopop"
|
||||||
"github.com/Jinnrry/pmail/consts"
|
"git.pcux.cn/xuans/Smail/consts"
|
||||||
"github.com/Jinnrry/pmail/db"
|
"git.pcux.cn/xuans/Smail/db"
|
||||||
"github.com/Jinnrry/pmail/dto"
|
"git.pcux.cn/xuans/Smail/dto"
|
||||||
"github.com/Jinnrry/pmail/dto/parsemail"
|
"git.pcux.cn/xuans/Smail/dto/parsemail"
|
||||||
"github.com/Jinnrry/pmail/models"
|
"git.pcux.cn/xuans/Smail/models"
|
||||||
"github.com/Jinnrry/pmail/services/del_email"
|
"git.pcux.cn/xuans/Smail/services/del_email"
|
||||||
"github.com/Jinnrry/pmail/services/detail"
|
"git.pcux.cn/xuans/Smail/services/detail"
|
||||||
"github.com/Jinnrry/pmail/services/list"
|
"git.pcux.cn/xuans/Smail/services/list"
|
||||||
"github.com/Jinnrry/pmail/utils/array"
|
"git.pcux.cn/xuans/Smail/utils/array"
|
||||||
"github.com/Jinnrry/pmail/utils/context"
|
"git.pcux.cn/xuans/Smail/utils/context"
|
||||||
"github.com/Jinnrry/pmail/utils/errors"
|
"git.pcux.cn/xuans/Smail/utils/errors"
|
||||||
"github.com/Jinnrry/pmail/utils/id"
|
"git.pcux.cn/xuans/Smail/utils/id"
|
||||||
"github.com/Jinnrry/pmail/utils/password"
|
"git.pcux.cn/xuans/Smail/utils/password"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"github.com/spf13/cast"
|
"github.com/spf13/cast"
|
||||||
"strings"
|
"strings"
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/Jinnrry/gopop"
|
"github.com/Jinnrry/gopop"
|
||||||
"github.com/Jinnrry/pmail/config"
|
"git.pcux.cn/xuans/Smail/config"
|
||||||
"github.com/Jinnrry/pmail/db"
|
"git.pcux.cn/xuans/Smail/db"
|
||||||
"github.com/Jinnrry/pmail/utils/context"
|
"git.pcux.cn/xuans/Smail/utils/context"
|
||||||
"github.com/emersion/go-message/mail"
|
"github.com/emersion/go-message/mail"
|
||||||
"io"
|
"io"
|
||||||
"testing"
|
"testing"
|
||||||
@@ -15,7 +15,7 @@ import (
|
|||||||
func Test_action_Retr(t *testing.T) {
|
func Test_action_Retr(t *testing.T) {
|
||||||
config.Init()
|
config.Init()
|
||||||
config.Instance.DbType = config.DBTypeSQLite
|
config.Instance.DbType = config.DBTypeSQLite
|
||||||
config.Instance.DbDSN = config.ROOT_PATH + "./config/pmail_temp.db"
|
config.Instance.DbDSN = config.ROOT_PATH + "./config/smail_temp.db"
|
||||||
db.Init("")
|
db.Init("")
|
||||||
|
|
||||||
a := action{}
|
a := action{}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import (
|
|||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"github.com/Jinnrry/gopop"
|
"github.com/Jinnrry/gopop"
|
||||||
"github.com/Jinnrry/pmail/config"
|
"git.pcux.cn/xuans/Smail/config"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ package smtp_server
|
|||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"errors"
|
"errors"
|
||||||
"github.com/Jinnrry/pmail/db"
|
"git.pcux.cn/xuans/Smail/db"
|
||||||
"github.com/Jinnrry/pmail/models"
|
"git.pcux.cn/xuans/Smail/models"
|
||||||
"github.com/Jinnrry/pmail/utils/context"
|
"git.pcux.cn/xuans/Smail/utils/context"
|
||||||
"github.com/Jinnrry/pmail/utils/id"
|
"git.pcux.cn/xuans/Smail/utils/id"
|
||||||
"github.com/Jinnrry/pmail/utils/password"
|
"git.pcux.cn/xuans/Smail/utils/password"
|
||||||
"github.com/emersion/go-sasl"
|
"github.com/emersion/go-sasl"
|
||||||
"github.com/emersion/go-smtp"
|
"github.com/emersion/go-smtp"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|||||||
@@ -7,16 +7,16 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/Jinnrry/pmail/config"
|
"git.pcux.cn/xuans/Smail/config"
|
||||||
"github.com/Jinnrry/pmail/consts"
|
"git.pcux.cn/xuans/Smail/consts"
|
||||||
"github.com/Jinnrry/pmail/db"
|
"git.pcux.cn/xuans/Smail/db"
|
||||||
"github.com/Jinnrry/pmail/dto/parsemail"
|
"git.pcux.cn/xuans/Smail/dto/parsemail"
|
||||||
"github.com/Jinnrry/pmail/hooks"
|
"git.pcux.cn/xuans/Smail/hooks"
|
||||||
"github.com/Jinnrry/pmail/hooks/framework"
|
"git.pcux.cn/xuans/Smail/hooks/framework"
|
||||||
"github.com/Jinnrry/pmail/models"
|
"git.pcux.cn/xuans/Smail/models"
|
||||||
"github.com/Jinnrry/pmail/utils/array"
|
"git.pcux.cn/xuans/Smail/utils/array"
|
||||||
"github.com/Jinnrry/pmail/utils/async"
|
"git.pcux.cn/xuans/Smail/utils/async"
|
||||||
"github.com/Jinnrry/pmail/utils/context"
|
"git.pcux.cn/xuans/Smail/utils/context"
|
||||||
smtp "github.com/emersion/go-smtp"
|
smtp "github.com/emersion/go-smtp"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"xorm.io/builder"
|
"xorm.io/builder"
|
||||||
|
|||||||
@@ -13,16 +13,16 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Jinnrry/pmail/config"
|
"git.pcux.cn/xuans/Smail/config"
|
||||||
"github.com/Jinnrry/pmail/consts"
|
"git.pcux.cn/xuans/Smail/consts"
|
||||||
"github.com/Jinnrry/pmail/db"
|
"git.pcux.cn/xuans/Smail/db"
|
||||||
"github.com/Jinnrry/pmail/dto"
|
"git.pcux.cn/xuans/Smail/dto"
|
||||||
"github.com/Jinnrry/pmail/dto/parsemail"
|
"git.pcux.cn/xuans/Smail/dto/parsemail"
|
||||||
"github.com/Jinnrry/pmail/hooks"
|
"git.pcux.cn/xuans/Smail/hooks"
|
||||||
"github.com/Jinnrry/pmail/hooks/framework"
|
"git.pcux.cn/xuans/Smail/hooks/framework"
|
||||||
"github.com/Jinnrry/pmail/models"
|
"git.pcux.cn/xuans/Smail/models"
|
||||||
listservice "github.com/Jinnrry/pmail/services/list"
|
listservice "git.pcux.cn/xuans/Smail/services/list"
|
||||||
"github.com/Jinnrry/pmail/utils/context"
|
"git.pcux.cn/xuans/Smail/utils/context"
|
||||||
smtp "github.com/emersion/go-smtp"
|
smtp "github.com/emersion/go-smtp"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
_ "modernc.org/sqlite"
|
_ "modernc.org/sqlite"
|
||||||
|
|||||||
@@ -6,13 +6,13 @@ import (
|
|||||||
"net/netip"
|
"net/netip"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/Jinnrry/pmail/config"
|
"git.pcux.cn/xuans/Smail/config"
|
||||||
"github.com/Jinnrry/pmail/db"
|
"git.pcux.cn/xuans/Smail/db"
|
||||||
"github.com/Jinnrry/pmail/dto/parsemail"
|
"git.pcux.cn/xuans/Smail/dto/parsemail"
|
||||||
"github.com/Jinnrry/pmail/hooks"
|
"git.pcux.cn/xuans/Smail/hooks"
|
||||||
"github.com/Jinnrry/pmail/hooks/framework"
|
"git.pcux.cn/xuans/Smail/hooks/framework"
|
||||||
"github.com/Jinnrry/pmail/models"
|
"git.pcux.cn/xuans/Smail/models"
|
||||||
"github.com/Jinnrry/pmail/utils/context"
|
"git.pcux.cn/xuans/Smail/utils/context"
|
||||||
"xorm.io/xorm"
|
"xorm.io/xorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -10,19 +10,19 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Jinnrry/pmail/config"
|
"git.pcux.cn/xuans/Smail/config"
|
||||||
"github.com/Jinnrry/pmail/consts"
|
"git.pcux.cn/xuans/Smail/consts"
|
||||||
"github.com/Jinnrry/pmail/db"
|
"git.pcux.cn/xuans/Smail/db"
|
||||||
"github.com/Jinnrry/pmail/dto/parsemail"
|
"git.pcux.cn/xuans/Smail/dto/parsemail"
|
||||||
"github.com/Jinnrry/pmail/hooks"
|
"git.pcux.cn/xuans/Smail/hooks"
|
||||||
"github.com/Jinnrry/pmail/hooks/framework"
|
"git.pcux.cn/xuans/Smail/hooks/framework"
|
||||||
"github.com/Jinnrry/pmail/listen/imap_server"
|
"git.pcux.cn/xuans/Smail/listen/imap_server"
|
||||||
"github.com/Jinnrry/pmail/models"
|
"git.pcux.cn/xuans/Smail/models"
|
||||||
"github.com/Jinnrry/pmail/services/rule"
|
"git.pcux.cn/xuans/Smail/services/rule"
|
||||||
"github.com/Jinnrry/pmail/utils/array"
|
"git.pcux.cn/xuans/Smail/utils/array"
|
||||||
"github.com/Jinnrry/pmail/utils/async"
|
"git.pcux.cn/xuans/Smail/utils/async"
|
||||||
"github.com/Jinnrry/pmail/utils/context"
|
"git.pcux.cn/xuans/Smail/utils/context"
|
||||||
"github.com/Jinnrry/pmail/utils/send"
|
"git.pcux.cn/xuans/Smail/utils/send"
|
||||||
"github.com/mileusna/spf"
|
"github.com/mileusna/spf"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"github.com/spf13/cast"
|
"github.com/spf13/cast"
|
||||||
|
|||||||
@@ -2,12 +2,12 @@ package smtp_server
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"github.com/Jinnrry/pmail/config"
|
"git.pcux.cn/xuans/Smail/config"
|
||||||
"github.com/Jinnrry/pmail/db"
|
"git.pcux.cn/xuans/Smail/db"
|
||||||
parsemail2 "github.com/Jinnrry/pmail/dto/parsemail"
|
parsemail2 "git.pcux.cn/xuans/Smail/dto/parsemail"
|
||||||
"github.com/Jinnrry/pmail/hooks"
|
"git.pcux.cn/xuans/Smail/hooks"
|
||||||
"github.com/Jinnrry/pmail/session"
|
"git.pcux.cn/xuans/Smail/session"
|
||||||
"github.com/Jinnrry/pmail/utils/context"
|
"git.pcux.cn/xuans/Smail/utils/context"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"net"
|
"net"
|
||||||
"net/netip"
|
"net/netip"
|
||||||
@@ -40,7 +40,7 @@ func testInit() {
|
|||||||
config.Init()
|
config.Init()
|
||||||
config.Instance.DkimPrivateKeyPath = config.ROOT_PATH + "./config/dkim/dkim.priv"
|
config.Instance.DkimPrivateKeyPath = config.ROOT_PATH + "./config/dkim/dkim.priv"
|
||||||
config.Instance.DbType = config.DBTypeSQLite
|
config.Instance.DbType = config.DBTypeSQLite
|
||||||
config.Instance.DbDSN = config.ROOT_PATH + "./config/pmail_temp.db"
|
config.Instance.DbDSN = config.ROOT_PATH + "./config/smail_temp.db"
|
||||||
|
|
||||||
parsemail2.Init()
|
parsemail2.Init()
|
||||||
db.Init("")
|
db.Init("")
|
||||||
@@ -137,7 +137,7 @@ PGRpdiBkaXI9Imx0ciI+PGRpdj7mraPmlofmtYvor5UyPC9kaXY+PC9kaXY+DQo=
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPmailEmail(t *testing.T) {
|
func TestSmailEmail(t *testing.T) {
|
||||||
testInit()
|
testInit()
|
||||||
emailData := `DKIM-Signature: a=rsa-sha256; bh=x7Rh+N2y2K9exccEAyKCTAGDgYKfnLZpMWc25ug5Ny4=;
|
emailData := `DKIM-Signature: a=rsa-sha256; bh=x7Rh+N2y2K9exccEAyKCTAGDgYKfnLZpMWc25ug5Ny4=;
|
||||||
c=simple/simple; d=domain.com;
|
c=simple/simple; d=domain.com;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import (
|
|||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Jinnrry/pmail/config"
|
"git.pcux.cn/xuans/Smail/config"
|
||||||
"github.com/emersion/go-smtp"
|
"github.com/emersion/go-smtp"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|||||||
Loaded 100 of 131 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user