mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-21 09:58:26 +00:00
Add docs for how to create a smtp gateway
This commit is contained in:
14
tools/exim/README.md
Normal file
14
tools/exim/README.md
Normal file
@ -0,0 +1,14 @@
|
||||
# SMTP Gateway via Docker
|
||||
|
||||
This is an example setup for a SMTP server that forwards all incoming
|
||||
mails to docspell via `curl`.
|
||||
|
||||
The docker image contains [exim](https://exim.org) and a sample config
|
||||
file that runs curl against a configurable docspell url. It uses the
|
||||
[integration
|
||||
endpoint](https://docspell.org/doc/uploading#integration-endpoint) and
|
||||
it expects it to be configured with "http-header" protection. It can
|
||||
be easily adopted to use a different protection method.
|
||||
|
||||
Please see the [documentation
|
||||
page](https://docspell.org/doc/tools/smtpgateway) for a guide.
|
13
tools/exim/docker-compose.yml
Normal file
13
tools/exim/docker-compose.yml
Normal file
@ -0,0 +1,13 @@
|
||||
version: '3.7'
|
||||
services:
|
||||
smtp:
|
||||
image: ds-exim:latest
|
||||
ports:
|
||||
- "25:25"
|
||||
environment:
|
||||
# This is the configured header value for the integration-endpoint
|
||||
- DS_HEADER=test123
|
||||
# This is the URL to docspell
|
||||
- DS_URL=http://192.168.1.95:7880
|
||||
# Use host network for demo purposes
|
||||
network_mode: host
|
57
tools/exim/exim.conf
Normal file
57
tools/exim/exim.conf
Normal file
@ -0,0 +1,57 @@
|
||||
## Provide certificates to enable StartTLS
|
||||
# tls_certificate = /var/lib/acme/test.org/fullchain.pem
|
||||
# tls_privatekey = /var/lib/acme/test.org/key.pem
|
||||
tls_advertise_hosts =
|
||||
|
||||
primary_hostname = test.org
|
||||
domainlist local_domains = test.org
|
||||
timeout_frozen_after = 1m
|
||||
acl_smtp_rcpt = acl_check_rcpt
|
||||
acl_smtp_data = acl_check_data
|
||||
never_users = root
|
||||
host_lookup = *
|
||||
daemon_smtp_ports = 25
|
||||
|
||||
message_size_limit = 30m
|
||||
|
||||
keep_environment = DS_HEADER : DS_URL
|
||||
|
||||
begin acl
|
||||
acl_check_rcpt:
|
||||
require
|
||||
domains = +local_domains
|
||||
require
|
||||
message = Sender verification failed
|
||||
verify = sender
|
||||
require
|
||||
message = Receiver verification failed
|
||||
verify = recipient
|
||||
require
|
||||
message = Recipient unknown
|
||||
condition = ${run{/usr/bin/curl --out /dev/null --silent --fail -H "Docspell-Integration: ${env{DS_HEADER}{$value} fail}" "${env{DS_URL}{$value} fail}/api/v1/open/integration/item/$local_part"}{yes}{no}}
|
||||
warn
|
||||
message = Reverse lookup failed
|
||||
!verify = reverse_host_lookup
|
||||
accept
|
||||
|
||||
acl_check_data:
|
||||
deny
|
||||
message = Sender verification failed
|
||||
!verify = header_sender
|
||||
accept
|
||||
|
||||
begin routers
|
||||
local_users:
|
||||
driver = accept
|
||||
transport = docspell
|
||||
|
||||
begin transports
|
||||
docspell:
|
||||
driver = pipe
|
||||
command = /usr/bin/curl --out /dev/null --silent --fail -H "Docspell-Integration: ${env{DS_HEADER}{$value} fail}" -F "file=@-;filename=\"$h_subject:\"" "${env{DS_URL}{$value} fail}/api/v1/open/integration/item/$local_part"
|
||||
return_fail_output
|
||||
user = nobody
|
||||
delivery_date_add
|
||||
envelope_to_add
|
||||
return_path_add
|
||||
log_output
|
8
tools/exim/exim.dockerfile
Normal file
8
tools/exim/exim.dockerfile
Normal file
@ -0,0 +1,8 @@
|
||||
FROM alpine:latest
|
||||
|
||||
RUN apk add --no-cache exim curl
|
||||
USER exim
|
||||
COPY ./exim.conf /etc/exim/
|
||||
EXPOSE 25
|
||||
ENTRYPOINT ["exim"]
|
||||
CMD ["-bdf", "-v", "-q1m"]
|
Reference in New Issue
Block a user