docs: Update outdated tutorials

Closes #222
This commit is contained in:
fox.cpp 2020-05-11 13:42:47 +03:00
parent 244b030051
commit b472734713
No known key found for this signature in database
GPG key ID: 5B991F6215D2FCC0
3 changed files with 23 additions and 19 deletions

View file

@ -32,12 +32,13 @@ tweaking:
```
smtp tcp://0.0.0.0:25 {
... checks ...
... global limits ...
... local source check ...
default_source {
destination $(local_domains) {
import local_delivery_actions
... local checks ...
modify &local_modifiers
deliver_to &local_mailboxes
}
@ -50,8 +51,8 @@ smtp tcp://0.0.0.0:25 {
Here is the quick explanation of what is going on here: When maddy receives a
message on port 25, it runs a set of checks, checks the recipients against
'destination' blocks, runs what is specified in local_delivery_actions
(that includes alias_file) and finally delivers the message to targets inside
'destination' blocks, runs what is specified in local_modifiers
(that includes replace_rcpt file) and finally delivers the message to targets inside
the matching 'destination' blocks.
The problem here is that recipients are matched before aliases are resolved so
@ -61,12 +62,13 @@ is to insert another step into the pipeline configuration to rerun matching
```
smtp tcp://0.0.0.0:25 {
... checks ...
... global limits ...
... local source check ...
default_source {
destination $(local_domains) {
import local_delivery_actions
... local checks ...
modify &local_modifiers
reroute {
destination $(local_domains) {

View file

@ -19,19 +19,21 @@
## Building
First, make sure Go Modules support is enabled:
Clone maddy repo:
```
export GO111MODULE=on
git clone https://github.com/foxcpp/maddy.git
cd maddy
```
There are two binaries to install, server itself and DB management
utility. Use the following command to install them:
There are two binaries to build, server itself and DB management
utility. Use the following commands to install them:
```
go get github.com/foxcpp/maddy/cmd/{maddy,maddyctl}@master
go build ./cmd/maddyctl
go build ./cmd/maddy
```
Executables will be placed in the $GOPATH/bin directory (defaults to
$HOME/go/bin).
Executables will be placed in the current directory. Copy them to
/usr/local/bin or whatever directory you them to be in.
## Configuration
@ -39,11 +41,11 @@ $HOME/go/bin).
basic ideas about how email works.
1. Install maddy and maddyctl (see above)
2. Copy maddy.conf from this repo to /etc/maddy/maddy.conf
2. Copy maddy.conf from the repo to /etc/maddy/maddy.conf
3. Create /run/maddy and /var/lib/maddy, make sure they are writable
for the maddy user. Though, you don't have to use system directories,
see `maddy -help`.
4. Open maddy.conf with ~~vim~~your favorite editor and change
4. Open maddy.conf with your favorite editor and change
the following:
- `tls ...`
Change to paths to TLS certificate and key.
@ -67,4 +69,4 @@ SMTP endpoint is on port 465 with TLS enforced ("implicit TLS").
### systemd unit
You can use the systemd unit file from the [dist/](dist) directory in
this repo.
the repo to supervise the server process and start it at boot.

View file

@ -32,7 +32,7 @@ primary one.
For each handled domain, the following line should be added to the
`local_modifiers` block:
```
replace_rcpt /(.+)@example.com/ $1@$(primary_domain)
replace_rcpt regexp /(.+)@example.com/ $1@$(primary_domain)
```
It does regexp replacement, turning anything@example.com into
anything@$(primary_domain) where $(primary_domain) in our case is example.org.
@ -42,8 +42,8 @@ E.g.
$(primary_domain) = example.org
modifiers local_modifiers {
replace_rcpt /(.+)@example.net/ $1@$(primary_domain)
replace_rcpt /(.+)@example.com/ $1@$(primary_domain)
replace_rcpt regexp /(.+)@example.net/ $1@$(primary_domain)
replace_rcpt regexp /(.+)@example.com/ $1@$(primary_domain)
}
```
With that configuration, all messages for foo@example.net and foo@example.com