Skip to content

LMTP #247

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

LMTP #247

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
vexim/config/variables.php
veximpy/
2 changes: 1 addition & 1 deletion docs/configure
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ virtual_dom_groups:
g.enabled = '1' and \
g.is_public = 'N' and c.member_id = u.user_id and \
d.domain_id = u.domain_id and u.enabled = '1' \
and u.username = '${quote_mysql:$sender_address}' }}}}
and concat_ws('@', u.localpart, d.domain) = '${quote_mysql:$sender_address}' }}}}
data = ${lookup mysql{ \
select concat_ws('@', u.localpart, d.domain) \
from domains d, groups g, group_contents c, users u \
Expand Down
7 changes: 7 additions & 0 deletions docs/debian-conf.d/main/00_vexim_listmacrosdefs
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,10 @@ CHECK_DATA_LOCAL_ACL_FILE = /etc/exim4/vexim-acl-check-content.conf
# compact version of the report. If you tweak your template this way, you may
# as well want to change the header name here.
VEXIM_SPAM_REPORT_HEADER_NAME = X-Spam-Report

# lmtp delivery to an lmtp capable application like dovecot
# can be enabled by setting either LMTP_COMMAND or LMTP_SOCKET
# this will enable the LMTP routers and set a command or socket in the LMTP transport
# ! Set only one of the macros !
#LMTP_COMMAND = /some/local/lmtp/delivery/program
LMTP_SOCKET = /var/run/dovecot/lmtp
87 changes: 75 additions & 12 deletions docs/debian-conf.d/router/250_vexim_virtual_domains
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@

### router/250_vexim_virtual_domains
###
### to enable routing for LMTP transport
### set one of LMTP_COMMAND or LMTP_SOCKET in main/00_vexim_listmacrosdefs
#################################

virtual_vacation:
Expand All @@ -15,6 +17,12 @@ virtual_vacation:
no_expn
unseen
transport = virtual_vacation_delivery
# using local_part_suffixes enables possibility to use user-"something" localparts
# which could cause you trouble if you're creating email-adresses with dashes in between.
.ifdef VEXIM_LOCALPART_SUFFIX
local_part_suffix = VEXIM_LOCALPART_SUFFIX
local_part_suffix_optional
.endif

virtual_forward:
driver = redirect
Expand All @@ -37,37 +45,86 @@ virtual_forward:
and domain = '${quote_mysql:$domain}' \
and users.on_forward = '1' \
and users.domain_id=domains.domain_id}}}{1} }} {yes}{no} }
# using local_part_suffixes enables possibility to use user-"something" localparts
# which could cause you trouble if you're creating email-adresses with dashes in between.
.ifdef VEXIM_LOCALPART_SUFFIX
local_part_suffix = VEXIM_LOCALPART_SUFFIX
local_part_suffix_optional
.endif

virtual_domains:
virtual_domains_useralias:
debug_print = "R: virtual_domains_useralias for $local_part@$domain"
driver = redirect
domains = +local_domains
allow_fail
data = ${lookup mysql{select smtp from users,domains \
where users.type = 'alias' \
and localpart = '${quote_mysql:$local_part}' \
and domain = '${quote_mysql:$domain}' \
and domains.enabled = '1' \
and users.enabled = '1' \
and users.domain_id = domains.domain_id}}
# using local_part_suffixes enables possibility to use user-"something" localparts
# which could cause you trouble if you're creating email-adresses with dashes in between.
.ifdef VEXIM_LOCALPART_SUFFIX
local_part_suffix = VEXIM_LOCALPART_SUFFIX
local_part_suffix_optional
.endif

virtual_pipe:
debug_print = "R: virtual_pipe for $local_part@$domain"
driver = redirect
domains = +local_domains
address_data = ${lookup mysql{\
select smtp, users.sa_tag*10 AS sa_tag, users.on_spamassassin AND domains.spamassassin AS on_spamassassin, \
allow_fail
data = ${lookup mysql{select smtp from users,domains \
where users.type='piped' \
and localpart = '${quote_mysql:$local_part}' \
and domain = '${quote_mysql:$domain}' \
and domains.enabled = '1' \
and users.enabled = '1' \
and users.domain_id = domains.domain_id}}
# using local_part_suffixes enables possibility to use user-"something" localparts
# which could cause you trouble if you're creating email-adresses with dashes in between.
.ifdef VEXIM_LOCALPART_SUFFIX
local_part_suffix = VEXIM_LOCALPART_SUFFIX
local_part_suffix_optional
.endif
pipe_transport = vexim_pipe

virtual_domains:
debug_print = "R: LMTP virtual_user for $local_part@$domain"
driver = accept
domains = +local_domains
address_data = ${lookup mysql{ \
select concat_ws('@', localpart, domains.domain), smtp, localpart, users.sa_tag*10 AS sa_tag, users.on_spamassassin AND domains.spamassassin AS on_spamassassin, \
users.uid AS uid, users.gid AS gid, quota \
from users,domains \
where localpart = '${quote_mysql:$local_part}' \
where users.type='local' \
and localpart = '${quote_mysql:$local_part}' \
and domain = '${quote_mysql:$domain}' \
and domains.enabled = '1' \
and users.enabled = '1' \
and users.domain_id = domains.domain_id}{$value}fail}
allow_fail
data = ${extract{smtp}{$address_data}}
cannot_route_message = Unknown user
headers_add = ${if and { \
{match{$domain}{$original_domain}} \
{match{$local_part}{$original_local_part}} \
{>={$spam_score_int}{${extract{sa_tag}{$address_data}}}} \
{eq{1}{${extract{on_spamassassin}{$address_data}}}} \
} {X-Spam-Flag: YES\nX-Spam-Score: $acl_m_spam_score\nVEXIM_SPAM_REPORT_HEADER_NAME: $acl_m_spam_report}{} }

# using local_part_suffixes enables possibility to use user-"something" localparts
# which could cause you trouble if you're creating email-adresses with dashes in between.
.ifdef VEXIM_LOCALPART_SUFFIX
local_part_suffix = VEXIM_LOCALPART_SUFFIX
local_part_suffix_optional
.endif
retry_use_local_part
file_transport = virtual_delivery
reply_transport = address_reply
pipe_transport = address_pipe
.ifdef LMTP_COMMAND LMTP_SOCKET
transport = virtual_delivery_lmtp
.else
transport = virtual_delivery
.endif

# A group is a list of users
#
Expand All @@ -93,7 +150,7 @@ virtual_dom_groups:
g.enabled = '1' and \
g.is_public = 'N' and c.member_id = u.user_id and \
d.domain_id = u.domain_id and u.enabled = '1' \
and u.username = '${quote_mysql:$sender_address}' }}}}
and concat_ws('@', u.localpart, d.domain) = '${quote_mysql:$sender_address}' }}}}
data = ${lookup mysql{ \
select concat_ws('@', u.localpart, d.domain) \
from domains d, groups g, group_contents c, users u \
Expand Down Expand Up @@ -124,7 +181,11 @@ virtual_domains_catchall:
and domain = '${quote_mysql:$domain}' \
and users.domain_id = domains.domain_id}}
retry_use_local_part
file_transport = virtual_delivery
.ifdef LMTP_COMMAND LMTP_SOCKET
file_transport = virtual_delivery_lmtp
.else
file_transport = virtual_delivery
.endif
reply_transport = address_reply
pipe_transport = address_pipe_catchall

Expand All @@ -136,3 +197,5 @@ virtual_domain_alias:
from domains,domainalias where domainalias.alias = '${quote_mysql:$domain}' \
and domainalias.domain_id = domains.domain_id}}
retry_use_local_part

#.endif
13 changes: 13 additions & 0 deletions docs/debian-conf.d/transport/30_vexim_virtual_delivery_lmtp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
### transport/30_vexim_virtual_delivery_lmtp
#######################################
virtual_delivery_lmtp:
debug_print = "T: virtual_delivery_lmtp for $local_part@$domain"
driver = lmtp
# socket = /var/run/dovecot/lmtp
.ifdef LMTP_COMMAND
command = LMTP_COMMAND
.elifdef LMTP_SOCKET
socket = LMTP_SOCKET
.endif
#maximum number of deliveries per batch, default 1
batch_max = 200