From 9f1591867cb1230a8cb298bcf60bbcf192d154b0 Mon Sep 17 00:00:00 2001 From: runout-at Date: Sun, 29 Oct 2017 22:34:33 +0100 Subject: [PATCH 1/8] LMTP transport --- .../transport/30_vexim_virtual_delivery_lmtp | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 docs/debian-conf.d/transport/30_vexim_virtual_delivery_lmtp diff --git a/docs/debian-conf.d/transport/30_vexim_virtual_delivery_lmtp b/docs/debian-conf.d/transport/30_vexim_virtual_delivery_lmtp new file mode 100644 index 00000000..84dac7c3 --- /dev/null +++ b/docs/debian-conf.d/transport/30_vexim_virtual_delivery_lmtp @@ -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 From 1ebcabb1c7d7175204fdcbcf490fdbdd73d99b1b Mon Sep 17 00:00:00 2001 From: runout-at Date: Sun, 29 Oct 2017 22:37:11 +0100 Subject: [PATCH 2/8] LMTP config --- docs/debian-conf.d/main/00_vexim_listmacrosdefs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/debian-conf.d/main/00_vexim_listmacrosdefs b/docs/debian-conf.d/main/00_vexim_listmacrosdefs index 850ea8de..4cb76f95 100644 --- a/docs/debian-conf.d/main/00_vexim_listmacrosdefs +++ b/docs/debian-conf.d/main/00_vexim_listmacrosdefs @@ -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 From 2b628026a0c2b1ff2edef0c82c52143e98a2fb21 Mon Sep 17 00:00:00 2001 From: runout-at Date: Sun, 29 Oct 2017 22:39:28 +0100 Subject: [PATCH 3/8] LMTP router --- .../router/250_vexim_virtual_domains | 85 ++++++++++++++++--- 1 file changed, 74 insertions(+), 11 deletions(-) diff --git a/docs/debian-conf.d/router/250_vexim_virtual_domains b/docs/debian-conf.d/router/250_vexim_virtual_domains index 4d8d1f1c..5b31e76f 100644 --- a/docs/debian-conf.d/router/250_vexim_virtual_domains +++ b/docs/debian-conf.d/router/250_vexim_virtual_domains @@ -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: @@ -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 @@ -37,27 +45,74 @@ 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 username, 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 @@ -65,9 +120,11 @@ virtual_domains: 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 # @@ -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 @@ -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 From 001dabd36afa00fd41bab9fc232a7a3d2e639c9b Mon Sep 17 00:00:00 2001 From: Markus Gschwendt Date: Sat, 5 May 2018 13:25:06 +0200 Subject: [PATCH 4/8] change .gitignore --- .gitignore | 1 + veximpy/.gitignore | 75 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 veximpy/.gitignore diff --git a/.gitignore b/.gitignore index 9dd29d16..c637ca38 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ vexim/config/variables.php +veximpy/ diff --git a/veximpy/.gitignore b/veximpy/.gitignore new file mode 100644 index 00000000..f5e54934 --- /dev/null +++ b/veximpy/.gitignore @@ -0,0 +1,75 @@ +.eric6project/ +_eric6project/ +.eric5project/ +_eric5project/ +.eric4project/ +_eric4project/ +.ropeproject/ +_ropeproject/ +.directory/ +*.pyc +*.pyo +*.orig +*.bak +*.rej +*~ +cur/ +tmp/ +__pycache__/ +*.DS_Store +venv/ +app/static/*.zip + +### JetBrains template +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff: +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/dictionaries + +# Sensitive or high-churn files: +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.xml +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml + +# Gradle: +.idea/**/gradle.xml +.idea/**/libraries + +# CMake +cmake-build-debug/ +cmake-build-release/ + +# Mongo Explorer plugin: +.idea/**/mongoSettings.xml + +## File-based project format: +*.iws + +## Plugin-specific files: + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +.idea From 983b9f6f1e57cb31589778e51219765dee6b9b28 Mon Sep 17 00:00:00 2001 From: Markus Gschwendt Date: Sat, 5 May 2018 13:42:17 +0200 Subject: [PATCH 5/8] changed .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 9dd29d16..c637ca38 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ vexim/config/variables.php +veximpy/ From e1dc1250a792726caa7c03139c466e5478ac7202 Mon Sep 17 00:00:00 2001 From: runout-at Date: Sat, 5 May 2018 16:26:15 +0200 Subject: [PATCH 6/8] Delete .gitignore --- veximpy/.gitignore | 75 ---------------------------------------------- 1 file changed, 75 deletions(-) delete mode 100644 veximpy/.gitignore diff --git a/veximpy/.gitignore b/veximpy/.gitignore deleted file mode 100644 index f5e54934..00000000 --- a/veximpy/.gitignore +++ /dev/null @@ -1,75 +0,0 @@ -.eric6project/ -_eric6project/ -.eric5project/ -_eric5project/ -.eric4project/ -_eric4project/ -.ropeproject/ -_ropeproject/ -.directory/ -*.pyc -*.pyo -*.orig -*.bak -*.rej -*~ -cur/ -tmp/ -__pycache__/ -*.DS_Store -venv/ -app/static/*.zip - -### JetBrains template -# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm -# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 - -# User-specific stuff: -.idea/**/workspace.xml -.idea/**/tasks.xml -.idea/dictionaries - -# Sensitive or high-churn files: -.idea/**/dataSources/ -.idea/**/dataSources.ids -.idea/**/dataSources.xml -.idea/**/dataSources.local.xml -.idea/**/sqlDataSources.xml -.idea/**/dynamic.xml -.idea/**/uiDesigner.xml - -# Gradle: -.idea/**/gradle.xml -.idea/**/libraries - -# CMake -cmake-build-debug/ -cmake-build-release/ - -# Mongo Explorer plugin: -.idea/**/mongoSettings.xml - -## File-based project format: -*.iws - -## Plugin-specific files: - -# IntelliJ -out/ - -# mpeltonen/sbt-idea plugin -.idea_modules/ - -# JIRA plugin -atlassian-ide-plugin.xml - -# Cursive Clojure plugin -.idea/replstate.xml - -# Crashlytics plugin (for Android Studio and IntelliJ) -com_crashlytics_export_strings.xml -crashlytics.properties -crashlytics-build.properties -fabric.properties - -.idea From 030f688f6c6011301de12b2c63efca6a41f2ec03 Mon Sep 17 00:00:00 2001 From: Markus Gschwendt Date: Sat, 5 May 2018 22:58:02 +0200 Subject: [PATCH 7/8] fix username to concat localpart@domain --- docs/debian-conf.d/router/250_vexim_virtual_domains | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/debian-conf.d/router/250_vexim_virtual_domains b/docs/debian-conf.d/router/250_vexim_virtual_domains index 5b31e76f..74ba61e9 100644 --- a/docs/debian-conf.d/router/250_vexim_virtual_domains +++ b/docs/debian-conf.d/router/250_vexim_virtual_domains @@ -96,7 +96,7 @@ virtual_domains: driver = accept domains = +local_domains address_data = ${lookup mysql{ \ - select username, smtp, localpart, users.sa_tag*10 AS sa_tag, users.on_spamassassin AND domains.spamassassin AS on_spamassassin, \ + 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 users.type='local' \ @@ -150,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 \ From 642eb3ba1236aed940ec216d1bd782d6e149bec4 Mon Sep 17 00:00:00 2001 From: Markus Gschwendt Date: Sat, 5 May 2018 23:02:04 +0200 Subject: [PATCH 8/8] fix username to concat localpart@domain --- docs/configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/configure b/docs/configure index 065212b2..df4a24d8 100644 --- a/docs/configure +++ b/docs/configure @@ -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 \